Type: | Package |
Title: | Track Machine Learning Experiments |
Version: | 0.0.1 |
Description: | 'Guild AI' is an open-source tool for managing machine learning experiments. It's for scientists, engineers, and researchers who want to run scripts, compare results, measure progress, and automate machine learning workflow. 'Guild AI' is a light weight, external tool that runs locally. It works with any framework, doesn't require any changes to your code, or access to any web services. Users can easily record experiment metadata, track model changes, manage experiment artifacts, tune hyperparameters, and share results. 'Guild AI' combines features from 'Git', 'SQLite', and 'Make' to provide a lab notebook for machine learning. |
URL: | https://guildai.github.io/guildai-r/, https://github.com/guildai/guildai-r, https://my.guild.ai/ |
BugReports: | https://github.com/guildai/guildai-r/issues |
License: | Apache License 2.0 |
SystemRequirements: | Python (>= 3.6.0) |
Imports: | jsonlite, rappdirs, yaml, config, rlang, rstudioapi, readr, dplyr, processx, tibble |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Suggests: | fs, envir, rmarkdown, quarto, testthat (≥ 3.0.0), withr |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2023-03-03 18:29:47 UTC; tomasz |
Author: | Tomasz Kalinowski [aut, cph, cre], Posit, PBC [cph, fnd] |
Maintainer: | Tomasz Kalinowski <tomasz@posit.co> |
Repository: | CRAN |
Date/Publication: | 2023-03-06 13:50:02 UTC |
compare runs
Description
compare runs
Usage
.view_runs_diff(
runs = "1:2",
output_dir = file.path(tempdir(), paste(ids, collapse = "-")),
template = system.file("templates/compare-runs.qmd", package = "guildai"),
viewer = getOption("guildai.viewer"),
...
)
Arguments
runs |
A runs selection for two runs. Defaults to the latest two runs. |
output_dir |
Where to place the rendered html |
template |
Report template |
viewer |
Viewer to display training run information within (default
to an internal page viewer if available, otherwise to the R session
default web browser, |
... |
passed on to |
Value
path to the generated html, invisibly
guild_api_runs_cli Show runs as JSON.
Description
IMPORTANT: This command is experimental and subject to change without notice.
Usage
guild_api_runs_cli(
...,
format = NA,
filter = NULL,
operation = NULL,
label = NULL,
unlabeled = NA,
tag = NULL,
comment = NULL,
marked = NA,
unmarked = NA,
started = NULL,
digest = NULL,
running = NA,
completed = NA,
error = NA,
terminated = NA,
pending = NA,
staged = NA,
api_version = NULL,
deleted = NA,
include_batch = NA
)
Arguments
... |
passed on to the |
format |
(bool) Format the JSON outout. |
filter |
Filter runs using a filter expression. See Filter by Expression above for details. |
operation |
Filter runs with operations matching |
label |
Filter runs with labels matching VAL. To show unlabeled runs, use |
unlabeled |
(bool) Filter runs without labels. |
tag |
Filter runs with TAG. |
comment |
Filter runs with comments matching VAL. |
marked |
(bool) Filter marked runs. |
unmarked |
(bool) Filter unmarked runs. |
started |
Filter runs started within RANGE. See above for valid time ranges. |
digest |
Filter runs with a matching source code digest. |
running |
(bool) Filter runs that are still running. |
completed |
(bool) Filter completed runs. |
error |
(bool) Filter runs that exited with an error. |
terminated |
(bool) Filter runs terminated by the user. |
pending |
(bool) Filter pending runs. |
staged |
(bool) Filter staged runs. |
api_version |
API version. |
deleted |
(bool) Show deleted runs. |
include_batch |
(bool) Include batch runs. |
Copy run files into the current project working directory
Description
Copy run files into the current project working directory
Usage
guild_merge(run = NULL, ...)
Arguments
run |
a run selection |
... |
Arguments passed on to
|
Value
NULL
, invisibly. This function is called for its
side effect.
Examples
## Not run:
guild_merge("--help")
runs_scalars() %>%
dplyr::slice_max("epoch_acc") %>%
guild_merge(I("--yes --replace"))
## End(Not run)
guild_merge_cli Copy run files to a project directory.
Description
By default, Guild copies run files into the current directory. To
copy files to a different directory, use target_dir DIR
.
Usage
guild_merge_cli(
...,
filter = NULL,
operation = NULL,
label = NULL,
unlabeled = NA,
tag = NULL,
comment = NULL,
marked = NA,
unmarked = NA,
started = NULL,
digest = NULL,
running = NA,
completed = NA,
error = NA,
terminated = NA,
pending = NA,
staged = NA,
target_dir = NULL,
sourcecode = NA,
all = NA,
skip_sourcecode = NA,
skip_deps = NA,
exclude = NULL,
no_summary = NA,
summary_name = NULL,
preview = NA,
replace = NA,
no_replace = NA
)
Arguments
... |
passed on to the |
filter |
Filter runs using a filter expression. See Filter by Expression above for details. |
operation |
Filter runs with operations matching |
label |
Filter runs with labels matching VAL. To show unlabeled runs, use |
unlabeled |
(bool) Filter runs without labels. |
tag |
Filter runs with TAG. |
comment |
Filter runs with comments matching VAL. |
marked |
(bool) Filter marked runs. |
unmarked |
(bool) Filter unmarked runs. |
started |
Filter runs started within RANGE. See above for valid time ranges. |
digest |
Filter runs with a matching source code digest. |
running |
(bool) Filter runs that are still running. |
completed |
(bool) Filter completed runs. |
error |
(bool) Filter runs that exited with an error. |
terminated |
(bool) Filter runs terminated by the user. |
pending |
(bool) Filter pending runs. |
staged |
(bool) Filter staged runs. |
target_dir |
Directory to merge run files to (required if project directory cannot be determined for the run). |
sourcecode |
(bool) Only copy run source code. Implies use of |
all |
(bool) Copy all run files. May be used with |
skip_sourcecode |
(bool) Don't copy run source code. |
skip_deps |
(bool) Don't copy project-local dependencies. |
exclude |
Exclude a file or pattern (may be used multiple times). |
no_summary |
(bool) Don't generate a run summary. |
summary_name |
Name used for the run summary. Use '$run_id' in the name to include the run ID. |
preview |
(bool) Show what would happen on a merge. |
replace |
(bool) Allow replacement of existing files. Cannot be used with |
no_replace |
(bool) Fail if any target file would be replaced, even if that file is committed to the project VCS. Cannot be used with |
Details
Guild checks that the run originated from the current directory
before copying files. If the run is associated with a project from
a different directory, or is from a package, Guild exits with an
error message. In this case, use target_dir
to override the
check with an explicit path.
The command fails if any file would be replaced, unless a) the
replace
option is specified or b) the replaced file is
committed to the project VCS and unchanged. To prevent replacement
even when a file is committed to VCS and unchanged, specify
no_replace
.
Launch a guild run
Description
Launch a guild run
Usage
guild_run(
opspec = "train.R",
flags = NULL,
...,
echo = TRUE,
as_job = getOption("guildai.run_as_job", TRUE)
)
Arguments
opspec |
typically a path to an R script, but could be any string that guild recognizes as a valid operation. |
flags |
flag values for the run(s).
|
... |
Arguments passed on to
|
echo |
whether output from the run is shown in the current R
console. Note, this has no effect on whether expressions are echoed
in the guild run stdout log. To disable echoing of expression in
the run logs, specify |
as_job |
Run the operation as an RStudio background job. This is ignored outside of the RStudio IDE. |
Value
NULL
, invisibly. This function is called for its
side effect.
guild_run_cli Run an operation.
Description
By default Guild tries to run OPERATION
for the default model
defined in the current project.
Usage
guild_run_cli(
...,
label = NULL,
tag = NULL,
comment = NULL,
run_dir = NULL,
stage = NA,
start = NULL,
restart = NULL,
proto = NULL,
force_sourcecode = NA,
gpus = NULL,
no_gpus = NA,
batch_label = NULL,
batch_tag = NULL,
batch_comment = NULL,
optimizer = NULL,
optimize = NA,
minimize = NULL,
maximize = NULL,
opt_flag = NULL,
max_trials = NULL,
trials = NULL,
stage_trials = NA,
remote = NULL,
force_flags = NA,
force_deps = NA,
stop_after = NULL,
fail_on_trial_error = NA,
needed = NA,
background = NA,
pidfile = NULL,
no_wait = NA,
save_trials = NULL,
keep_run = NA,
keep_batch = NA,
dep = NULL,
quiet = NA,
print_cmd = NA,
print_env = NA,
print_trials = NA,
help_model = NA,
help_op = NA,
test_output_scalars = NULL,
test_sourcecode = NA,
test_flags = NA
)
Arguments
... |
passed on to the |
label |
Set a label for the run. |
tag |
Associate TAG with run. May be used multiple times. |
comment |
Comment associated with the run. |
run_dir |
Use alternative run directory DIR. Cannot be used with |
stage |
(bool) Stage an operation. |
start |
Start a staged run or restart an existing run. Cannot be used with |
restart |
Start a staged run or restart an existing run. Cannot be used with |
proto |
Use the operation, flags and source code from RUN. Flags may be added or redefined in this operation. Cannot be used with |
force_sourcecode |
(bool) Use working source code when |
gpus |
Limit availabe GPUs to DEVICES, a comma separated list of device IDs. By default all GPUs are available. Cannot beused with |
no_gpus |
(bool) Disable GPUs for run. Cannot be used with |
batch_label |
Label to use for batch runs. Ignored for non-batch runs. |
batch_tag |
Associate TAG with batch. Ignored for non-batch runs. May be used multiple times. |
batch_comment |
Comment associated with batch. |
optimizer |
Optimize the run using the specified algorithm. See Optimizing Runs for more information. |
optimize |
(bool) Optimize the run using the default optimizer. |
minimize |
Column to minimize when running with an optimizer. See help for compare command for details specifying a column. May not be used with |
maximize |
Column to maximize when running with an optimizer. See help for compare command for details specifying a column. May not be used with |
opt_flag |
Flag for OPTIMIZER. May be used multiple times. |
max_trials |
Maximum number of trials to run in batch operations. Default is optimizer specific. If optimizer is not specified, default is 20. |
trials |
Maximum number of trials to run in batch operations. Default is optimizer specific. If optimizer is not specified, default is 20. |
stage_trials |
(bool) For batch operations, stage trials without running them. |
remote |
Run the operation remotely. |
force_flags |
(bool) Accept all flag assignments, even for undefined or invalid values. |
force_deps |
(bool) Continue even when a required resource is not resolved. |
stop_after |
Stop operation after N minutes. |
fail_on_trial_error |
(bool) Stop batch operations when a trial exits with an error. |
needed |
(bool) Run only if there is not an available matching run. A matching run is of the same operation with the same flag values that is not stopped due to an error. |
background |
(bool) Run operation in background. |
pidfile |
Run operation in background, writing the background process ID to PIDFILE. |
no_wait |
(bool) Don't wait for a remote operation to complete. Ignored if run is local. |
save_trials |
Saves generated trials to a CSV batch file. See BATCH FILES for more information. |
keep_run |
(bool) Keep run even when configured with 'delete-on-success'. |
keep_batch |
(bool) Keep batch run rather than delete it on success. |
dep |
Include PATH as a dependency. |
quiet |
(bool) Do not show output. |
print_cmd |
(bool) Show operation command and exit. |
print_env |
(bool) Show operation environment and exit. |
print_trials |
(bool) Show generated trials and exit. |
help_model |
(bool) Show model help and exit. |
help_op |
(bool) Show operation help and exit. |
test_output_scalars |
Test output scalars on output. Use '-' to read from standard intput. |
test_sourcecode |
(bool) Test source code selection. |
test_flags |
(bool) Test flag configuration. |
Details
If MODEL
is specified, Guild uses it instead of the default
model.
OPERATION
may alternatively be a Python script. In this case any
current project is ignored and the script is run directly. Options
in the format --NAME=VAL
can be passed to the script using
flags (see below).
[MODEL]:OPERATION
may be omitted if restart
or proto
is
specified, in which case the operation used in RUN
is used.
Specify FLAG
values in the form FLAG=VAL
.
Batch Files
One or more batch files can be used to run multiple trials by
specifying the file path as @PATH
.
For example, to run trials specified in a CSV file named
trials.csv
, run:
guild run [MODEL:]OPERATION @trials.csv
NOTE: At this time you must specify the operation with batch files
batch files only contain flag values and cannot be used to run different operations for the same command.
Batch files may be formatted as CSV, JSON, or YAML. Format is determined by the file extension.
Each entry in the file is used as a set of flags for a trial run.
CSV files must have a header row containing the flag names. Each subsequent row is a corresponding list of flag values that Guild uses for a generated trial.
JSON and YAML files must contain a top-level list of flag-to-value maps.
Use print_trials
to preview the trials run for the specified
batch files.
Flag Lists
A list of flag values may be specified using the syntax
[VAL1[,VAL2]...]
. Lists containing white space must be
quoted. When a list of values is provided, Guild generates a trial
run for each value. When multiple flags have list values, Guild
generates the cartesian product of all possible flag combinations.
Flag lists may be used to perform grid search operations.
For example, the following generates four runs for operation
train
and flags learning-rate
and batch-size
:
guild run train learning-rate[0.01,0.1] batch-size=[10,100]
You can preview the trials generated from flag lists using
print_trials
. You can save the generated trials to a batch
file using save_trials
. For more information, see PREVIEWING
AND SAVING TRIALS below.
When optimizer
is specified, flag lists may take on different
meaning depending on the type of optimizer. For example, the
random
optimizer randomly selects values from a flag list,
rather than generate trials for each value. See OPTIMIZERS for
more information.
Optimizers
A run may be optimized using optimizer
. An optimizer runs up
to max_trials
runs using flag values and flag configuration.
For details on available optimizers and their behavior, refer to https://guild.ai/optimizers/.
Limit Trials
When using flag lists or optimizers, which generate trials, you
can limit the number of trials with max_trials
. By default,
Guild limits the number of generated trials to 20.
Guild limits trials by randomly sampling the maximum number from
the total list of generated files. You can specify the seed used
for the random sample with random_seed
. The random seed is
guaranteed to generate consistent results when used on the same
version of Python. When used across different versions of Python,
the results may be inconsistent.
Preview or Save Trials
When flag lists (used for grid search) or an optimizer is used,
you can preview the generated trials using print_trials
. You
can save the generated trials as a CSV batch file using
save_trials
.
Start an Operation Using a Prototype Run
If proto
is specified, Guild applies the operation, flags, and
source code used in RUN
to the new operation. You may add or
redefine flags in the new operation. You may use an alternative
operation, in which case only the flag values and source code from
RUN
are applied. RUN
must be a run ID or unique run ID prefix.
Restart an Operation
If restart
is specified, RUN
is restarted using its
operation and flags. Unlike proto
, restart does not create a
new run. You cannot change the operation, flags, source code, or
run directory when restarting a run.
Staging an Operation
Use stage
to stage an operation to be run later. Use start
with the staged run ID to start it.
If start
is specified, RUN
is started using the same rules
applied to restart
(see above).
Alternate Run Directory
To run an operation outside of Guild's run management facility,
use run_dir
or stage-dir
to specify an alternative run
directory. These options are useful when developing or debugging
an operation. Use stage-dir
to prepare a run directory for an
operation without running the operation itself. This is useful
when you want to verify run directory layout or manually run an
operation in a prepared directory.
NOTE: Runs started with run_dir
are not visible to Guild
and do not appear in run listings.
Control Visible GPUs
By default, operations have access to all available GPU
devices. To limit the GPU devices available to a run, use
gpus
.
For example, to limit visible GPU devices to 0
and 1
, run:
guild run gpus 0,1 ...
To disable all available GPUs, use no_gpus
.
NOTE: gpus
and no_gpus
are used to construct the
CUDA_VISIBLE_DEVICES
environment variable used for the run
process. If CUDA_VISIBLE_DEVICES
is set, using either of these
options redefines that environment variable for the run.
Optimize Runs
Use optimizer
to run the operation multiple times in attempt
to optimize a result. Use minimize
or maximize
to indicate
what should be optimized. Use --max-runs
to indicate the maximum
number of runs the optimizer should generate.
Edit Flags
Use edit_flags
to use an editor to review and modify flag
values. Guild uses the editor defined in VISUAL
or EDITOR
environment variables. If neither environment variable is defined,
Guild uses an editor suitable for the current platform.
Debug Source Code
Use debug_sourcecode
to specify the location of project source
code for debugging. Guild uses this path instead of the location
of the copied soure code for the run. For example, when debugging
project files, use this option to ensure that modules are loaded
from the project location rather than the run directory.
Breakpoints
Use break
to set breakpoints for Python based operations.
LOCATION
may be specified as [FILENAME:]LINE
or as
MODULE.FUNCTION
.
If FILENAME
is not specified, the main module is assumed. Use
the value 1
to break at the start of the main module (line 1).
Relative file names are resolved relative to the their location in
the Python system path. You can omit the .py
extension.
If a line number does not correspond to a valid breakpoint, Guild attempts to set a breakpoint on the next valid breakpoint line in the applicable module.
guild_select_cli Select a run and shows its ID.
Description
This command is generally used when specifying a run ID for
another Guild command. For example, to restart the latest train
run:
Usage
guild_select_cli(
...,
all = NA,
min = NULL,
max = NULL,
short_id = NA,
attr = NULL,
path = NA,
dir = NA,
filter = NULL,
operation = NULL,
label = NULL,
unlabeled = NA,
tag = NULL,
comment = NULL,
marked = NA,
unmarked = NA,
started = NULL,
digest = NULL,
running = NA,
completed = NA,
error = NA,
terminated = NA,
pending = NA,
staged = NA,
remote = NULL
)
Arguments
... |
passed on to the |
all |
(bool) Select all matching runs, not just the latest. |
min |
Select the run with the lowest value for the specified COLSPEC. |
max |
Select the run with the highest value for the specified COLSPEC. |
short_id |
(bool) Use short ID. |
attr |
Show specified run attribute rather than run ID. |
path |
(bool) Show run path. |
dir |
(bool) Show run path. |
filter |
Filter runs using a filter expression. See Filter by Expression above for details. |
operation |
Filter runs with operations matching |
label |
Filter runs with labels matching VAL. To show unlabeled runs, use |
unlabeled |
(bool) Filter runs without labels. |
tag |
Filter runs with TAG. |
comment |
Filter runs with comments matching VAL. |
marked |
(bool) Filter marked runs. |
unmarked |
(bool) Filter unmarked runs. |
started |
Filter runs started within RANGE. See above for valid time ranges. |
digest |
Filter runs with a matching source code digest. |
running |
(bool) Filter runs that are still running. |
completed |
(bool) Filter completed runs. |
error |
(bool) Filter runs that exited with an error. |
terminated |
(bool) Filter runs terminated by the user. |
pending |
(bool) Filter pending runs. |
staged |
(bool) Filter staged runs. |
remote |
Run the operation remotely. |
Details
`guild run --restart $(guild select -o train)`
Specify a Run
You may specify a run using a run ID, a run ID prefix, or a
one-based index corresponding to a run returned by the list
command.
If RUN isn't specified, the latest matching run is selected.
Selecting Min or Max Scalar
To select the run with the lowest or highest column value, use
min
or max
respectively. For example, to select the run
with the lowest loss
scalar value, use min loss
.
For help with COLSPEC formatting, see COLUMN SPECS
in compare
help by running guild compare help
.
Other run filters are applied before selecting a minimum or maximium scalar value.
Filter by Operation
Runs may be filtered by operation using operation
. A run is
only included if any part of its full operation name, including
the package and model name, matches the value.
Use operation
multiple times to include more runs.
Filter by Label
Use label
to only include runs with labels containing a
specified value. To select runs that do not contain a label,
specify a dash '-' for VAL
.
Use label
multiple times to include more runs.
Filter by Tag
Use tag
to only include runs with a specified tag. Tags must
match completely and are case sensitive.
Use tag
multiple times to include more runs.
Filter by Marked and Unmarked
Use marked
to only include marked runs.
Use unmarked
to only include unmarked runs. This option may
not be used with marked
.
Filter by Expression
Use filter
to limit runs that match a filter
expressions. Filter expressions compare run attributes, flag
values, or scalars to target values. They may include multiple
expressions with logical operators.
For example, to match runs with flag batch-size
equal to 100
that have loss
less than 0.8, use:
filter 'batch-size = 10 and loss < 0.8'
IMPORTANT: You must quote EXPR if it contains spaces or characters that the shell uses (e.g. '<' or '>').
Target values may be numbers, strings or lists containing numbers and strings. Strings that contain spaces must be quoted, otherwise a target string values does not require quotes. Lists are defined using square braces where each item is separated by a comma.
Comparisons may use the following operators: '=', '!=' (or '<>'), '<', '<=', '>', '>='. Text comparisons may use 'contains' to test for case-insensitive string membership. A value may be tested for membership or not in a list using 'in' or 'not in' respectively. An value may be tested for undefined using 'is undefined' or defined using 'is not undefined'.
Logical operators include 'or' and 'and'. An expression may be negated by preceding it with 'not'. Parentheses may be used to control the order of precedence when expressions are evaluated.
If a value reference matches more than one type of run information
(e.g. a flag is named 'label', which is also a run attribute), the
value is read in order of run attribute, then flag value, then
scalar. To disambiguate the reference, use a prefix attr:
,
flag:
, or scalar:
as needed. For example, to filter using a
flag value named 'label', use 'flag:label'.
Other examples:
operation = train and acc > 0.9
operation = train and (acc > 0.9 or loss < 0.3)
batch-size = 100 or batch-size = 200
batch-size in [100,200]
batch-size not in [400,800]
batch-size is undefined
batch-size is not undefined
label contains best and operation not in [test,deploy]
status in [error,terminated]
NOTE: Comments and tags are not supported in filter
expressions at this time. Use comment
and tag
options
along with filter expressions to further refine a selection.
Filter by Run Start Time
Use started
to limit runs to those that have started within a
specified time range.
IMPORTANT: You must quote RANGE values that contain spaces. For example, to filter runs started within the last hour, use the option:
started 'last hour'
You can specify a time range using several different forms:
after DATETIME
before DATETIME
between DATETIME and DATETIME
last N minutes|hours|days
today|yesterday
this week|month|year
last week|month|year
N days|weeks|months|years ago
DATETIME
may be specified as a date in the format YY-MM-DD
(the leading YY-
may be omitted) or as a time in the format
HH:MM
(24 hour clock). A date and time may be specified
together as DATE TIME
.
When using between DATETIME and DATETIME
, values for
DATETIME
may be specified in either order.
When specifying values like minutes
and hours
the trailing
s
may be omitted to improve readability. You may also use
min
instead of minutes
and hr
instead of hours
.
Examples:
after 7-1
after 9:00
between 1-1 and 4-30
between 10:00 and 15:00
last 30 min
last 6 hours
today
this week
last month
3 weeks ago
Filter by Source Code Digest
To show runs for a specific source code digest, use -g
or
digest
with a complete or partial digest value.
Filter by Run Status
Runs may also be filtered by specifying one or more status
filters: running
, completed
, error
, and
terminated
. These may be used together to include runs that
match any of the filters. For example to only include runs that
were either terminated or exited with an error, use terminated error
, or the short form -Set
.
You may combine more than one status character with -S
to
expand the filter. For example, -Set
shows only runs with
terminated or error status.
Status filters are applied before RUN
indexes are resolved. For
example, a run index of 1
is the latest run that matches the
status filters.
Select remote rnus
To apply select
to remote runs, specify remote REMOTE
. Use
guild remotes
to list available remotes.
For information on configuring remotes, see guild remotes help
.
Launch Guild Viewer
Description
Launch Guild Viewer
Usage
guild_view(
runs = NULL,
...,
host = NULL,
port = NULL,
include_batch = FALSE,
no_open = FALSE,
stop = FALSE
)
Arguments
runs |
an optional runs selection. |
... |
passed on to |
host |
Name of host interface to listen on. |
port |
Port to listen on. |
include_batch |
(bool) Include batch runs. |
no_open |
(bool) Don't open Guild View in a browser. |
stop |
Stop the existing Guild View application. |
Value
The url where the Guild View application can be accessed.
The url where the View application can be accessed, invisibly.
Examples
## Not run:
guild_view()
# see all supported options
guild_view("--help")
# three valid ways of supplying args to the guild executable
guild_view("--port" = "5678")
guild_view("--port", "5678")
guild_view(c("--port", "5678"))
## End(Not run)
guild_view_cli Visualize runs in a local web application.
Description
Features include:
Usage
guild_view_cli(
...,
host = NULL,
port = NULL,
include_batch = NA,
no_open = NA,
logging = NA,
filter = NULL,
operation = NULL,
label = NULL,
unlabeled = NA,
tag = NULL,
comment = NULL,
marked = NA,
unmarked = NA,
started = NULL,
digest = NULL,
running = NA,
completed = NA,
error = NA,
terminated = NA,
pending = NA,
staged = NA
)
Arguments
... |
passed on to the |
host |
Name of host interface to listen on. |
port |
Port to listen on. |
include_batch |
(bool) Include batch runs. |
no_open |
(bool) Don't open Guild View in a browser. |
logging |
(bool) Log requests. |
filter |
Filter runs using a filter expression. See Filter by Expression above for details. |
operation |
Filter runs with operations matching |
label |
Filter runs with labels matching VAL. To show unlabeled runs, use |
unlabeled |
(bool) Filter runs without labels. |
tag |
Filter runs with TAG. |
comment |
Filter runs with comments matching VAL. |
marked |
(bool) Filter marked runs. |
unmarked |
(bool) Filter unmarked runs. |
started |
Filter runs started within RANGE. See above for valid time ranges. |
digest |
Filter runs with a matching source code digest. |
running |
(bool) Filter runs that are still running. |
completed |
(bool) Filter completed runs. |
error |
(bool) Filter runs that exited with an error. |
terminated |
(bool) Filter runs terminated by the user. |
pending |
(bool) Filter pending runs. |
staged |
(bool) Filter staged runs. |
Details
View and filter runs
Compare runs
Browse run files
View run images and other media
View run output
Guild View does not currently support starting or modifying runs. For these operations, use the applicable command line interface. Run 'guild help' for a complete list of commands.
By default Guild View shows all runs. You can filter runs using the command options described below.
Specify Runs
You may use one or more RUN
arguments to indicate which runs
apply to the command. RUN
may be a run ID, a run ID prefix, or a
one-based index corresponding to a run returned by the list
command.
Indexes may also be specified in ranges in the form START:END
where START
is the start index and END
is the end
index. Either START
or END
may be omitted. If START
is
omitted, all runs up to END
are selected. If END
id omitted,
all runs from START
on are selected. If both START
and END
are omitted (i.e. the :
char is used by itself) all runs are
selected.
Filter by Operation
Runs may be filtered by operation using operation
. A run is
only included if any part of its full operation name, including
the package and model name, matches the value.
Use operation
multiple times to include more runs.
Filter by Label
Use label
to only include runs with labels containing a
specified value. To select runs that do not contain a label,
specify a dash '-' for VAL
.
Use label
multiple times to include more runs.
Filter by Tag
Use tag
to only include runs with a specified tag. Tags must
match completely and are case sensitive.
Use tag
multiple times to include more runs.
Filter by Marked and Unmarked
Use marked
to only include marked runs.
Use unmarked
to only include unmarked runs. This option may
not be used with marked
.
Filter by Expression
Use filter
to limit runs that match a filter
expressions. Filter expressions compare run attributes, flag
values, or scalars to target values. They may include multiple
expressions with logical operators.
For example, to match runs with flag batch-size
equal to 100
that have loss
less than 0.8, use:
filter 'batch-size = 10 and loss < 0.8'
IMPORTANT: You must quote EXPR if it contains spaces or characters that the shell uses (e.g. '<' or '>').
Target values may be numbers, strings or lists containing numbers and strings. Strings that contain spaces must be quoted, otherwise a target string values does not require quotes. Lists are defined using square braces where each item is separated by a comma.
Comparisons may use the following operators: '=', '!=' (or '<>'), '<', '<=', '>', '>='. Text comparisons may use 'contains' to test for case-insensitive string membership. A value may be tested for membership or not in a list using 'in' or 'not in' respectively. An value may be tested for undefined using 'is undefined' or defined using 'is not undefined'.
Logical operators include 'or' and 'and'. An expression may be negated by preceding it with 'not'. Parentheses may be used to control the order of precedence when expressions are evaluated.
If a value reference matches more than one type of run information
(e.g. a flag is named 'label', which is also a run attribute), the
value is read in order of run attribute, then flag value, then
scalar. To disambiguate the reference, use a prefix attr:
,
flag:
, or scalar:
as needed. For example, to filter using a
flag value named 'label', use 'flag:label'.
Other examples:
operation = train and acc > 0.9
operation = train and (acc > 0.9 or loss < 0.3)
batch-size = 100 or batch-size = 200
batch-size in [100,200]
batch-size not in [400,800]
batch-size is undefined
batch-size is not undefined
label contains best and operation not in [test,deploy]
status in [error,terminated]
NOTE: Comments and tags are not supported in filter
expressions at this time. Use comment
and tag
options
along with filter expressions to further refine a selection.
Filter by Run Start Time
Use started
to limit runs to those that have started within a
specified time range.
IMPORTANT: You must quote RANGE values that contain spaces. For example, to filter runs started within the last hour, use the option:
started 'last hour'
You can specify a time range using several different forms:
after DATETIME
before DATETIME
between DATETIME and DATETIME
last N minutes|hours|days
today|yesterday
this week|month|year
last week|month|year
N days|weeks|months|years ago
DATETIME
may be specified as a date in the format YY-MM-DD
(the leading YY-
may be omitted) or as a time in the format
HH:MM
(24 hour clock). A date and time may be specified
together as DATE TIME
.
When using between DATETIME and DATETIME
, values for
DATETIME
may be specified in either order.
When specifying values like minutes
and hours
the trailing
s
may be omitted to improve readability. You may also use
min
instead of minutes
and hr
instead of hours
.
Examples:
after 7-1
after 9:00
between 1-1 and 4-30
between 10:00 and 15:00
last 30 min
last 6 hours
today
this week
last month
3 weeks ago
Filter by Source Code Digest
To show runs for a specific source code digest, use -g
or
digest
with a complete or partial digest value.
Filter by Run Status
Runs may also be filtered by specifying one or more status
filters: running
, completed
, error
, and
terminated
. These may be used together to include runs that
match any of the filters. For example to only include runs that
were either terminated or exited with an error, use terminated error
, or the short form -Set
.
You may combine more than one status character with -S
to
expand the filter. For example, -Set
shows only runs with
terminated or error status.
Status filters are applied before RUN
indexes are resolved. For
example, a run index of 1
is the latest run that matches the
status filters.
Install guildai core
Description
This installs the guild
executable for use by the R package. It creates
an isolated python virtual environment private to the R package and installs
guildai into it. Repeated calls to install_guild()
result in a
fresh installation.
Usage
install_guild(guildai = "guildai", python = find_python())
Arguments
guildai |
Character vector of arguments passed directly to |
python |
Path to a python binary, used to create a private isolated venv. |
Details
It requires that a suitable python version is available on the system.
Value
path to the guild
executable
Note
install_guild()
installs guild as an isolated VM. For guild to
run a python operation, the python package guildai
must be installed
in the python library where it will be used, E.g., with pip install guildai
or reticulate::py_install()
.
Examples
## Not run:
## Install release version:
install_guild()
## Install release version using a specific python
# path_to_python <- reticulate::install_python() # path to python executable
install_guild("guildai", python = path_to_python)
## Install development version
install_guild(guildai = "dev", python = path_to_python)
## Install development version from URL
install_guild(
guildai = "https://api.github.com/repos/guildai/guildai/tarball/HEAD",
python = path_to_python)
## Install local development version:
install_guild(c("-e", "~/guild/guildai"))
## End(Not run)
Install guild for usage in the Terminal
Description
This function makes available the guild
executable installed by
install_guild()
for usage in the Terminal.
Usage
install_guild_cli(
dest = "~/bin",
completions = basename(Sys.getenv("SHELL")) %in% c("bash", "zsh", "fish")
)
Arguments
dest |
Directory where to place the |
completions |
Whether to also install shell completion helpers. |
Details
Note that the guild executable installed by the R function
install_guild()
is not able to run python operations. To run python
operations with guild, you must install guild into the target python
installation with pip install guildai
, and ensure that the desired guild
executable is on the PATH
.
Value
path to the installed guild executable, invisibly.
Is code executing in the context of a guild run?
Description
Is code executing in the context of a guild run?
Usage
is_run_active()
Value
Boolean
Resolve run ids
Description
This is a equivalent to runs_info(...)$id
, implemented more
efficiently.
Usage
resolve_run_ids(runs = NULL, ..., all = TRUE)
Arguments
runs |
a runs selection. If a data.frame, the columns |
... |
Other arguments passed on to |
all |
Return all matching runs. If |
Details
guild supports a rich syntax for runs selection throughout the api.
The same selection syntax is shared by the runs_*
family of
functions: runs_info()
, runs_scalars()
, runs_comment()
,
runs_label()
, runs_mark()
, runs_tag()
runs_delete()
,runs_purge()
, runs_restore()
, runs_export()
,
runs_import()
.
Value
A character vector of run ids.
Note
You can call Sys.setenv(GUILD_DEBUG_R = 1)
to see what system
calls to the guild
executable are made. This is useful when
looking to understand how R arguments are transformed into a cli
system call.
Examples
## Not run:
resolve_run_ids() # returns all run ids.
resolve_run_ids(1) # last run
resolve_run_ids(1:2) # last 2 runs
resolve_run_ids(1:2, operation = "train.py")
# three ways of getting ids for the currently staged or running runs
resolve_run_ids(staged = TRUE, running = TRUE)
resolve_run_ids("--staged", "--running")
resolve_run_ids(c("--staged", "--running"))
resolve_run_ids(I("--staged --running"))
# resolve_run_ids() uses the same selection rules and syntax as runs_info()
stopifnot(identical(
resolve_run_ids(),
runs_info()$id
))
## End(Not run)
Delete runs
Description
Delete runs
Usage
runs_delete(runs = NULL, ...)
runs_purge(runs = NULL, ...)
runs_restore(runs = NULL, ...)
Arguments
runs |
a runs selection |
... |
passed on to |
Details
-
runs_delete()
moves runs into a guild managed "trash" directory. -
runs_restore()
moves runs back into the main guild managed "runs" directory. -
runs_purge()
permanently delete runs from "trash" directory. Only deleted runs can be purged.
Value
The value supplied to the runs
argument, invisibly.
Note
To see deleted runs, do guildai:::guild("runs list --deleted")
(runs_info("--deleted")
supported soon)
Move or copy runs
Description
Move or copy runs
Usage
runs_export(runs = NULL, location, ..., move = FALSE, copy_resources = FALSE)
runs_import(runs = NULL, location, ..., move = FALSE, copy_resources = FALSE)
Arguments
runs |
A runs selection |
location |
A directory where to place the runs, or find the runs. |
... |
passed on to guild |
move |
bool, whether the runs should be moved or copied by the import or export operation. |
copy_resources |
whether run resources should be also copied. If
|
Value
The value supplied to the runs
argument, invisibly.
Get runs information
Description
Returns a dataframe with information about the guild runs stored in guild
home. Guild home is determined either by consulting the env var
Sys.getenv("GUILD_HOME")
, or if unset, by looking for a .guild
directory, starting from the current working directory and walking up
parent directories up to ~
or /
.
Usage
runs_info(
runs = NULL,
...,
filter = NULL,
operation = NULL,
label = NULL,
unlabeled = NA,
tag = NULL,
comment = NULL,
marked = NA,
unmarked = NA,
started = NULL,
digest = NULL,
running = NA,
completed = NA,
error = NA,
terminated = NA,
pending = NA,
staged = NA,
deleted = NA,
include_batch = NA
)
Arguments
runs |
a runs specification. |
... |
passed on to |
filter |
(character vector) Filter runs using a guild filter expression. See details section. |
operation |
(character vector) Filter runs with matching |
label |
(character vector) Filter runs with matching labels. |
unlabeled |
(bool) Filter only runs without labels. |
tag |
(character vector) Filter runs with |
comment |
(character vector) Filter runs with comments matching. |
marked |
(bool) Filter only marked runs. |
unmarked |
(bool) Filter only unmarked runs. |
started |
(string) Filter only runs started within RANGE. See details for valid time ranges. |
digest |
(string) Filter only runs with a matching source code digest. |
running |
(bool) Filter only runs that are still running. |
completed |
(bool) Filter only completed runs. |
error |
(bool) Filter only runs that exited with an error. |
terminated |
(bool) Filter only runs terminated by the user. |
pending |
(bool) Filter only pending runs. |
staged |
(bool) Filter only staged runs. |
deleted |
(bool) Show deleted runs. |
include_batch |
(bool) Include batch runs. |
Details
Guild has support for a custom filter expression syntax. This syntax is
primarily useful in the terminal, and R users will generally prefer to
filter the returned dataframe directly using dplyr::filter()
or [
.
Nevertheless, R users can supply guild filter expressions here as well.
Filter by Expression
Use filter
to limit runs that match a filter
expressions. Filter expressions compare run attributes, flag
values, or scalars to target values. They may include multiple
expressions with logical operators.
For example, to match runs with flag batch-size
equal to 100
that have loss
less than 0.8, use:
runs_info(filter = "batch-size = 10 and loss < 0.8")
Target values may be numbers, strings or lists containing numbers and strings. Lists are defined using square braces where each item is separated by a comma.
Comparisons may use the following operators: '=', '!=', '<', '<=', '>', '>='.
Text comparisons may use 'contains' to test for case-insensitive string membership. A value may be tested for membership or not in a list using 'in' or 'not in' respectively. An value may be tested for undefined using 'is undefined' or defined using 'is not undefined'.
Logical operators include 'or' and 'and'. An expression may be negated by preceding it with 'not'. Parentheses may be used to control the order of precedence when expressions are evaluated.
If a value reference matches more than one type of run information
(e.g. a flag is named 'label', which is also a run attribute), the
value is read in order of run attribute, then flag value, then
scalar. To disambiguate the reference, use a prefix attr:
,
flag:
, or scalar:
as needed. For example, to filter using a
flag value named 'label', use 'flag:label'.
Other examples:
"operation = train and acc > 0.9" "operation = train and (acc > 0.9 or loss < 0.3)" "batch-size = 100 or batch-size = 200" "batch-size in [100,200]" "batch-size not in [400,800]" "batch-size is undefined" "batch-size is not undefined" "label contains best and operation not in [test,deploy]" "status in [error,terminated]"
NOTE: Comments and tags are not supported in filter
expressions at this time. Use comment
and tag
options
along with filter expressions to further refine a selection.
Filter by Run Start Time
Use started
to limit runs to those that have started within a
specified time range.
runs_info(started = 'last hour')
You can specify a time range using several different forms:
"after DATETIME" "before DATETIME" "between DATETIME and DATETIME" "last N minutes|hours|days" "today|yesterday" "this week|month|year" "last week|month|year" "N days|weeks|months|years ago"
DATETIME
may be specified as a date in the format YY-MM-DD
(the leading YY-
may be omitted) or as a time in the format
HH:MM
(24 hour clock). A date and time may be specified
together as DATE TIME
.
When using between DATETIME and DATETIME
, values for
DATETIME
may be specified in either order.
When specifying values like minutes
and hours
the trailing
s
may be omitted to improve readability. You may also use
min
instead of minutes
and hr
instead of hours
.
Examples:
"after 7-1" "after 9:00" "between 1-1 and 4-30" "between 10:00 and 15:00" "last 30 min" "last 6 hours" "today" "this week" "last month" "3 weeks ago"
Filter by Run Status
Runs may also be filtered by specifying one or more status
filters: running
, completed
, error
, and
terminated
. These may be used together to include runs that
match any of the filters. For example to only include runs that
were either terminated or exited with an error, use
runs_info(terminated = TRUE, error = TRUE)
Status filters are applied before RUN
indexes are resolved. For
example, a run index of 1
(as in, runs_info(1, terminated = TRUE, error = TRUE)
is the latest run
that matches the status filters.
Value
A dataframe (tibble) of runs
Examples
## Not run:
withr::with_package("dplyr", {
runs_info() # get the full set of runs
runs_info(1) # get the most recent run
runs_info(1:3) # get the last 3 runs
# some other examples for passing filter expressions
runs_info(staged = TRUE) # list only staged runs
runs_info(tag = c("convnet", "keras"), started = "last hour")
runs_info(error = TRUE)
runs <- runs_info()
# filter down the runs list to ones of interest
runs <- runs %>%
filter(exit_status == 0) %>% # run ended without an error code
filter(scalars$test_accuracy > .8) %>%
filter(flags$epochs > 10) %>%
arrange(scalars$test_loss) %>%
select(id, flags, scalars)
# retrieve full scalars history from the runs of interest
runs$id %>%
runs_scalars()
# export the best run
best_runs_dir <- tempfile()
dir.create(best_runs_dir)
runs %>%
slice_max(scalars$test_accuracy) %>%
runs_tag("best") %>%
runs_export(best_runs_dir)
})
## End(Not run)
Annotate runs
Description
Annotate runs
Usage
runs_label(runs = NULL, label = NULL, ..., clear = FALSE)
runs_tag(runs = NULL, add = NULL, ..., remove = NULL, clear = FALSE)
runs_mark(runs = NULL, ..., clear = FALSE)
runs_comment(runs = NULL, comment = NULL, ..., delete = NULL, clear = FALSE)
Arguments
runs |
a runs selection |
label , comment |
a string |
... |
passed on to |
clear |
bool, whether to clear the existing tags/comments/label. |
add , remove |
a character vector of tags to add or remove |
delete |
integer vector, which comment(s) to delete,
corresponding to the row number(s) in the dataframe found at
|
Details
Annotation types and their recommended uses:
-
labels: short, single line descriptions tailored for readability, not programmatic consumption. Labels are presented prominently in
guild_view()
and other run views. -
tags: short single-token strings. Tags can be used for organizing, grouping, and filtering runs.
-
comments: longer (potentially multi-paragraph) descriptions of the run. Guild stores and presents run comments as log entries, complete with timestamps and author info.
-
marks: A boolean attribute of a run (a run can be marked or unmarked). Marked runs are primarily used to declare a run as the preferred source for resolving an operation dependency. If a operation declares a dependency on another operation, and one of the dependent operation runs is marked, the marked run is used rather than the latest run for resolving the dependency. Marks can also be a convenient mechanism for ad-hoc filtering operations, but in general, tags are preferred over marks for this.
Value
The value supplied to the runs
argument, invisibly.
Note
runs_comment()
will open up an editor if comment
is not
supplied.
Examples
## Not run:
runs_info(1) %>% runs_tag(clear = TRUE)
runs_info(1) %>% runs_tag("foo")
runs_info(1)$tags
runs_info(1) %>% runs_tag("bar")
runs_info(1)$tags
runs_info(1) %>% runs_tag(remove = "foo")
runs_info(1)$tags
runs_info(1) %>% runs_tag("baz", clear = TRUE)
runs_info(1)$tags
## pass through options to `guild tag` cli subcommand
runs_tag("--help")
## End(Not run)
Get full set of runs scalars
Description
Get full set of runs scalars
Usage
runs_scalars(runs = NULL, ...)
Arguments
runs |
a runs selection |
... |
passed on go |
Value
A dataframe (tibble) of runs
Examples
## Not run:
runs_scalars(1) # scalars from most recent run
runs_scalars(1:2) # scalars form two most recent runs
# pass in a dataframe of runs
runs_info() %>%
filter(flags$epochs > 5) %>%
runs_scalars()
## End(Not run)
Render a Run Summary Report
Description
Render a Run Summary Report
Usage
view_run_report(
run = "1",
output_dir = file.path(tempdir(), id),
template = system.file("templates/view-run.qmd", package = "guildai"),
viewer = getOption("guildai.viewer"),
...
)
Arguments
run |
a run selection. Defaults to the latest run. |
output_dir |
directory where to place the rendered document. |
template |
path to a parameterized quarto document. |
viewer |
Viewer to display training run information within (default
to an internal page viewer if available, otherwise to the R session
default web browser, |
... |
passed on to |
Value
path to the generated html, invisibly
View a runs diff
Description
Renders and displays an HTML document showing the diffs between two run directories.
Usage
view_runs_diff(
runs = 1:2,
...,
output_html = tempfile("guild-diff-", fileext = ".html"),
exclude = ".guild",
output_empty = TRUE,
exclude_directory_metadata = c("yes", "no", "auto", "recursive"),
viewer = utils::browseURL
)
Arguments
runs |
A runs selection for two runs. Defaults to the latest two runs. |
... , output_empty , exclude_directory_metadata |
Passed on to |
output_html |
Where to place the rendered html |
exclude |
Regex pattern for files or directories to exclude from the
rendered report. By default, the guild internal metadata store |
viewer |
Viewer to display the rendered html. Defaults to
|
Value
path to the generated html, invisibly
Write run attributes
Description
This function does nothing if is_run_active()
is FALSE
.
Usage
write_run_attr(name, data, ..., append = FALSE)
Arguments
name |
A string |
data |
The data to write. This needs to be encodable as yaml. If missing, the existing attr is deleted. |
... |
Arguments passed on to
|
append |
whether to append to the existing attr file. |
Value
the written lines, invisibly.