OutputModel
class OutputModel(task=None, config_text=None, config_dict=None, label_enumeration=None, name=None, tags=None, comment=None, framework=None, base_model_id=None)
Create an output model for a Task (experiment) to store the training results.
The model is read-write and automatically registered as the Task’s output model.
A common use case is to reuse the OutputModel object, and override the weights after storing a model snapshot. Another use case is to create multiple OutputModel objects for a Task, and after a new high score is found, store a model snapshot.
If the model configuration or label enumeration is not provided, values are inherited from the Task’s input model.
When executing a Task remotely with a clearml-agent, you can modify the model configuration and/or model’s label enumeration using the ClearML WebApp.
Create a new model and immediately connect it to a task.
We do not allow for Model creation without a task, so we always keep track on how we created the models. In remote execution, Model parameters can be overridden by the Task (such as model configuration & label enumerator).
-
Parameters
-
task (
Optional[ForwardRef]) – The Task object with which the OutputModel object is associated. -
config_text (
Optional[str]) – The configuration as a string. This is usually the content of a configuration dictionary file. Specifyconfig_textorconfig_dict, but not both. -
config_dict (
Optional[dict]) – The configuration as a dictionary. Specifyconfig_dictorconfig_text, but not both. -
label_enumeration (
Optional[Mapping[str,int]]) – The label enumeration dictionary of string (label) to integer (value) pairs.
For example:
{"background": 0,"person": 1}-
name (
Optional[str]) – The name for the newly created model. -
tags (
Optional[List[str]]) – A list of strings which are tags for the model. -
comment (
Optional[str]) – A comment / description for the model. -
framework (
Union[str,Framework,None]) – The framework of the model or a Framework object. -
base_model_id (
Optional[str]) – Model ID to be reused.
-
archive
archive()
Archive the model. If the model is already archived, this is a no-op
-
Return type
None
comment
property comment: str
A description of the model.
-
Return type
str -
Returns
The model description.
config_dict
property config_dict: dict
Get the configuration as a dictionary parsed from the config_text text. This usually represents the model
configuration. For example, from prototxt to .ini file or Python code to evaluate.
-
Return type
dict -
Returns
The configuration.
config_text
property config_text: str
Get the configuration as a string. For example, prototxt, a .ini file, or Python code to evaluate.
-
Return type
str -
Returns
The configuration.
connect
connect(task, name=None, **kwargs)
Connect a preexisting model to a Task object. Preexisting models include:
-
Imported models.
-
Models already in the ClearML platform
-
Models from external frameworks (e.g. TensorFlow)
-
Parameters
-
task (Task ) – A Task object.
-
name (
Optional[str]) – The model name as it would appear on the Task object. The model’s own name can differ, which is useful when a single Task uses multiple models. -
kwargs (Any ) –
-
-
Return type
None
framework
property framework: str
The ML framework of the model (for example: PyTorch, TensorFlow, XGBoost, etc.).
-
Return type
str -
Returns
The model’s framework
get_all_metadata
get_all_metadata()
Returns all metadata as a Dict[key, Dict[value, type]],
where key, value, and type are all strings.
To get values cast to their original types (if possible), use Model.get_all_metadata_casted.
-
Return type
Dict[str,Dict[str,str]] -
Returns
All metadata in
Dict[key, Dict[value, type]]format.
get_all_metadata_casted
get_all_metadata_casted()
Returns all metadata as a Dict[key, Dict[value, type]],
where key and type are strings, and value is cast to its original type where possible.
To get all values as strings, use Model.get_all_metadata.
-
Return type
Dict[str,Dict[str,Any]] -
Returns
All metadata in
Dict[key, Dict[value, type]]format.
get_metadata
get_metadata(key)
Get one metadata entry value (as a string) based on its key. See Model.get_metadata_casted
if you wish to cast the value to its type (if possible).
-
Parameters
key (
str) – Key of the metadata entry you want to get. -
Return type
Optional[str] -
Returns
String representation of the value of the metadata entry or
Noneif the entry was not found
get_metadata_casted
get_metadata_casted(key)
Get one metadata entry based on its key, casted to its type if possible.
-
Parameters
key (
str) – Key of the metadata entry you want to get. -
Return type
Optional[str] -
Returns
The value of the metadata entry, casted to its type (if not possible, the string representation will be returned) or
Noneif the entry was not found
get_weights
get_weights(raise_on_error=False, force_download=False, extract_archive=False)
Download the base model and return the locally stored filename.
-
Parameters
-
raise_on_error (
bool) – IfTrue, raiseValueErrorif the artifact download fails. -
force_download (
bool) – IfTrue, re-download base model even if a cached copy exists. -
extract_archive (
bool) – IfTrue, extract the downloaded weights file if possible.
-
-
Return type
str -
Returns
The locally stored file.
get_weights_package
get_weights_package(return_path=False, raise_on_error=False, force_download=False, extract_archive=True)
Download the base model package into a temporary directory (extract the files), or return a list of the locally stored filenames.
-
Parameters
-
return_path (
bool) – IfTrue, extract weights to a temp directory and return its path. IfFalse(default), return a list of local file paths. -
raise_on_error (
bool) – IfTrue, raiseValueErrorif the artifact download fails. IfFalse, returnsNoneand logs a warning. -
force_download (
bool) – IfTrue, re-download the base artifact even if a cached copy exists. -
extract_archive (
bool) – IfTrue, extract the downloaded weights file if possible.
-
-
Return type
Union[str,List[Path],None] -
Returns
The model weights, or a list of the locally stored filenames. If
raise_on_error=False, returnsNoneon error.
id
property id: str
The ID (system UUID) of the model.
-
Return type
str -
Returns
The model ID.
labels
property labels: Dict[str, int]
Get the label enumeration as a dictionary of string (label) to integer (value) pairs.
For example:
{
"background": 0,
"person": 1
}
-
Return type
Dict[str,int] -
Returns
The label enumeration.
name
property name: str
The name of the model.
-
Return type
str -
Returns
The model name.
original_task
property original_task: str
Return the ID of the Task that created this model.
-
Return type
str -
Returns
The Task ID
project
property project: str
Project ID of the model.
-
Return type
str -
Returns
Project ID
publish
publish()
Set the model to the status published and for public use. If the model’s status is already published,
then this method is a no-op.
-
Return type
None
published
property published: bool
Get the published state of this model.
-
Return type
bool -
Returns
Trueif the model is published,Falseotherwise.
report_confusion_matrix
report_confusion_matrix(title, series, matrix, iteration=None, xaxis=None, yaxis=None, xlabels=None, ylabels=None, yaxis_reversed=False, comment=None, extra_layout=None)
Plot a heat-map matrix.
For example:
confusion = np.random.randint(10, size=(10, 10))
model.report_confusion_matrix(
"example confusion matrix",
"ignored",
iteration=1,
matrix=confusion,
xaxis="title X",
yaxis="title Y",
)
-
Parameters
-
title (
str) – Plot title (metric). -
series (
str) – Series name (variant). -
matrix (
ndarray) – A heat-map matrix (example: confusion matrix). -
iteration (
Optional[int]) – The reported iteration / step. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
xlabels (
Optional[List[str]]) – Labels for each column of the matrix. -
ylabels (
Optional[List[str]]) – Labels for each row of the matrix. -
yaxis_reversed (
bool) – If set toFalse, the(0, 0)coordinate is at the bottom left corner. If set toTrue, the(0, 0)coordinate is at the top left corner. -
comment (
Optional[str]) – A comment displayed with the plot, underneath the title. -
extra_layout (
Optional[dict]) – Optional dictionary for layout configuration, passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/heatmap/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_histogram
report_histogram(title, series, values, iteration=None, labels=None, xlabels=None, xaxis=None, yaxis=None, mode=None, data_args=None, extra_layout=None)
Plot a (default grouped) histogram.
Notice this function will not calculate the histogram,
it assumes the histogram was already calculated in values.
For example:
vector_series = np.random.randint(10, size=10).reshape(2,5)
model.report_histogram(
title='histogram example',
series='histogram series',
values=vector_series,
iteration=0,
labels=['A','B'],
xaxis='X axis label',
yaxis='Y axis label',
)
-
Parameters
-
title (
str) – Plot title (metric). -
series (
str) – Series name (variant). -
values (
Sequence[Union[int,float]]) – The series values. A list of floats, or anN-dimensional Numpy array containing data for each histogram bar. -
iteration (
Optional[int]) – The reported iteration / step. Eachiterationcreates another plot. -
labels (
Optional[List[str]]) – Labels for each bar group, creating a plot legend labeling each series. -
xlabels (
Optional[List[str]]) – Labels per entry in each bucket in the histogram (vector), creating a set of labels for each histogram bar on the x-axis. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
mode (
Optional[str]) – Display mode for multiple histograms. The options are:-
group(default) -
stack -
relative
-
-
data_args (
Optional[dict]) – Optional dictionary for data configuration passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/bar/. Example:data_args={'orientation': 'h', 'marker': {'color': 'blue'}} -
extra_layout (
Optional[dict]) – Optional dictionary for layout configuration, passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/bar/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_line_plot
report_line_plot(title, series, xaxis, yaxis, mode='lines', iteration=None, reverse_xaxis=False, comment=None, extra_layout=None)
Plot one or more series as lines.
-
Parameters
-
title (
str) – Plot title (metric). -
series (
Sequence[SeriesInfo]) – All the series data, one list element for each line in the plot. -
iteration (
Optional[int]) – The reported iteration / step. -
xaxis (
str) – The x-axis title. -
yaxis (
str) – The y-axis title. -
mode (
str) – The type of line plot. The options are:lines(default),markers,lines+markers. -
reverse_xaxis (
bool) – IfTrue, reverse the x-axis (high to low). Defaults toFalse. -
comment (
Optional[str]) – A comment displayed underneath the plot title. -
extra_layout (
Optional[dict]) – Dictionary for layout configuration, passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/scatter/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_matrix
report_matrix(title, series, matrix, iteration=None, xaxis=None, yaxis=None, xlabels=None, ylabels=None, yaxis_reversed=False, extra_layout=None)
Plot a confusion matrix.
This method is the same as Model.report_confusion_matrix.
-
Parameters
-
title (
str) – Plot title (metric). -
series (
str) – Series name (variant). -
matrix (
ndarray) – A heat-map matrix (example: confusion matrix). -
iteration (
Optional[int]) – The reported iteration / step. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
xlabels (
Optional[List[str]]) – Labels for each column of the matrix. -
ylabels (
Optional[List[str]]) – Labels for each row of the matrix. -
yaxis_reversed (
bool) – If set toFalse, the(0, 0)coordinate is at the bottom left corner. If set toTrue, the(0, 0)coordinate is at the top left corner. -
extra_layout (
Optional[dict]) – Dictionary for layout configuration, passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/heatmap/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_scalar
report_scalar(title, series, value, iteration)
Plot a scalar series.
-
Parameters
-
title (
str) – Plot title (metric). Plot more than one scalar series on the same plot by using the sametitlefor each call to this method. -
series (
str) – Series name (variant). -
value (
float) – The value to plot per iteration. -
iteration (
int) – The reported iteration / step (x-axis of the reported time series)
-
-
Return type
None
report_scatter2d
report_scatter2d(title, series, scatter, iteration=None, xaxis=None, yaxis=None, labels=None, mode='line', comment=None, extra_layout=None)
Report a 2D scatter plot.
For example:
scatter2d = np.hstack((
np.atleast_2d(np.arange(0, 10)).T,
np.random.randint(10, size=(10, 1))
))
model.report_scatter2d(
title="example_scatter",
series="series",
iteration=0,
scatter=scatter2d,
xaxis="title x",
yaxis="title y",
)
Plot multiple 2D scatter series on the same plot by passing the same title and iteration values
to this method:
scatter2d_1 = np.hstack((
np.atleast_2d(np.arange(0, 10)).T,
np.random.randint(10, size=(10, 1))
))
model.report_scatter2d(
title="example_scatter",
series="series_1",
iteration=1,
scatter=scatter2d_1,
xaxis="title x",
yaxis="title y",
)
scatter2d_2 = np.hstack((
np.atleast_2d(np.arange(0, 10)).T,
np.random.randint(10, size=(10, 1)),
))
model.report_scatter2d(
"example_scatter",
"series_2",
iteration=1,
scatter=scatter2d_2,
xaxis="title x",
yaxis="title y",
)
-
Parameters
-
title (
str) – Plot title (metric). -
series (
str) – Series name (variant) of the reported scatter plot. -
scatter (
Union[Sequence[Tuple[float,float]],ndarray]) – The scatter data.numpy.ndarrayor list of (pairs of x,y) scatter. -
iteration (
Optional[int]) – The reported iteration / step. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
labels (
Optional[List[str]]) – Labels per point in the data assigned to thescatterparameter. The labels must be in the same order as the data. -
mode (
str) – The type of scatter plot. The options are:lines(default),markers,lines+markers. -
comment (
Optional[str]) – A comment displayed with the plot, underneath the title. -
extra_layout (
Optional[dict]) – Dictionary for layout configuration, passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/scatter/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_scatter3d
report_scatter3d(title, series, scatter, iteration=None, xaxis=None, yaxis=None, zaxis=None, labels=None, mode='markers', fill=False, comment=None, extra_layout=None)
Plot a 3D scatter graph. For example:
scatter3d = np.random.randint(10, size=(10, 3))
model.report_scatter3d(
title="example_scatter_3d",
series="series_xyz",
iteration=1,
scatter=scatter3d,
xaxis="title x",
yaxis="title y",
zaxis="title z",
)
-
Parameters
-
title (
str) – Plot title (metric) -
series (
str) – Series name (variant) -
scatter (
Union[Sequence[Tuple[float,float,float]],ndarray]) – The scatter data as-
a list of
(x,y,z)tuples -
a nested list
[[(x1,y1,z1)...]], or -
a
numpy.ndarray.
-
-
iteration (
Optional[int]) – The reported iteration / step. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
zaxis (
Optional[str]) – The z-axis title. -
labels (
Optional[List[str]]) – Labels per point in the data assigned to thescatterparameter. The labels must be in the same order as the data. -
mode (
str) – The type of scatter plot. The options are:markers(default),lines,lines+markers. -
fill (
bool) – IfTrue, fill the area under the curve. Defaults toFalse. -
comment (
Optional[str]) – A comment displayed underneath the plot title. -
extra_layout (
Optional[dict]) – Dictionary for layout configuration passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/scatter3d/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_single_value
report_single_value(name, value)
Reports a single value metric (for example, total experiment accuracy or mAP)
-
Parameters
-
name (
str) – Metric’s name -
value (
float) – Metric’s value
-
-
Return type
None
report_surface
report_surface(title, series, matrix, iteration=None, xaxis=None, yaxis=None, zaxis=None, xlabels=None, ylabels=None, camera=None, comment=None, extra_layout=None)
Report a 3D surface plot.
This method plots the same data as Model.report_confusion_matrix, but presents the
data as a surface diagram not a confusion matrix.
surface_matrix = np.random.randint(10, size=(10, 10))
model.report_surface(
"example surface",
"series",
iteration=0,
matrix=surface_matrix,
xaxis="title X",
yaxis="title Y",
zaxis="title Z",
)
-
Parameters
-
title (
str) – Plot title (metric). -
series (
str) – Series name (variant). -
matrix (
ndarray) – A heat-map matrix (example: confusion matrix). -
iteration (
Optional[int]) – The reported iteration / step. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
zaxis (
Optional[str]) – The z-axis title. -
xlabels (
Optional[List[str]]) – Labels for each column of the matrix (optional). -
ylabels (
Optional[List[str]]) – Labels for each row of the matrix (optional). -
camera (
Optional[Sequence[float]]) –(X,Y,Z)coordinates indicating the camera position. The default value is(1,1,1). -
comment (
Optional[str]) – A comment displayed underneath the plot title. -
extra_layout (
Optional[dict]) – Dictionary for layout configuration passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/surface/. Example:extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
-
-
Return type
None
report_table
report_table(title, series, iteration=None, table_plot=None, csv=None, url=None, extra_layout=None)
Report a table plot.
One and only one of the following parameters must be provided.
-
table_plot- Pandas DataFrame or Table as list of rows (list) -
csv- CSV file -
url- URL to CSV file
For example:
df = pd.DataFrame(
{
'num_legs': [2, 4, 8, 0],
'num_wings': [2, 0, 0, 0],
'num_specimen_seen': [10, 2, 1, 8]
},
index=['falcon', 'dog', 'spider', 'fish'],
)
model.report_table(title='table example', series='pandas DataFrame', iteration=0, table_plot=df)
-
Parameters
-
title (
str) – Table title (metric). -
series (
str) – Series name (variant). -
iteration (
Optional[int]) – The reported iteration / step. -
table_plot (
Union[DataFrame,Sequence[Sequence],None]) – The output table plot object. -
csv (
Optional[str]) – Path to local CSV file. -
url (
Optional[str]) – A URL to the location of CSV file. -
extra_layout (
Optional[Dict]) – Optional dictionary for layout configuration passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/layout/. Example:extra_layout={'height': 600}
-
-
Return type
None
report_vector
report_vector(title, series, values, iteration=None, labels=None, xlabels=None, xaxis=None, yaxis=None, mode=None, extra_layout=None)
Plot a vector as a (default stacked) histogram.
For example:
vector_series = np.random.randint(10, size=10).reshape(2,5)
model.report_vector(
title='vector example',
series='vector series',
values=vector_series,
iteration=0,
labels=['A','B'],
xaxis='X axis label',
yaxis='Y axis label',
)
-
Parameters
-
title (
str) – Plot title (metric). -
series (
str) – Series name (variant). -
values (
Sequence[Union[int,float]]) – Vector data as a list of floats or an N-dimensional Numpy array containing data for each histogram bar. -
iteration (
Optional[int]) – The reported iteration / step. Eachiterationcreates another plot. -
labels (
Optional[List[str]]) – Labels for each bar group, creating a plot legend labeling each series. -
xlabels (
Optional[List[str]]) – Labels per entry in each bucket in the histogram (vector), creating a set of labels for each histogram bar on the x-axis. -
xaxis (
Optional[str]) – The x-axis title. -
yaxis (
Optional[str]) – The y-axis title. -
mode (
Optional[str]) – Display mode for multiple histograms. The options are:-
group(default) -
stack -
relative
-
-
extra_layout (
Optional[dict]) – Optional dictionary for layout configuration, passed directly toplotly. See full details on the supported configuration: https://plotly.com/javascript/reference/layout/. Example:extra_layout={'showlegend': False, 'plot_bgcolor': 'yellow'}
-
-
Return type
None
set_all_metadata
set_all_metadata(metadata, replace=True)
Set metadata based on the given parameters. Allows replacing all entries or updating the current entries.
-
Parameters
-
metadata (
Dict[str,Dict[str,str]]) – A dictionary of formatDict[key, Dict[value, type]]representing the metadata you want to set. -
replace (
bool) – IfTrue, replace all metadata with the entries in themetadataparameter. IfFalse, keep the old metadata and update it with the entries in themetadataparameter (add or change it).
-
-
Return type
bool -
Returns
Trueif the metadata was set andFalseotherwise
OutputModel.set_default_upload_uri
classmethod set_default_upload_uri(output_uri)
Set the default upload URI for all OutputModels.
-
Parameters
output_uri (
Optional[str]) – URL for uploading models. Examples:-
https://demofiles.demo.clear.ml -
s3://bucket/ -
gs://bucket/ -
azure://bucket/ -
file:///mnt/shared/nfs
-
-
Return type
None
set_metadata
set_metadata(key, value, v_type=None)
Set one metadata entry. All parameters must be strings or castable to strings.
-
Parameters
-
key (
str) – Key of the metadata entry. -
value (
str) – Value of the metadata entry. -
v_type (
Optional[str]) – Type of the metadata entry.
-
-
Return type
bool -
Returns
Trueif the metadata was set,Falseotherwise.
set_upload_destination
set_upload_destination(uri)
Set the URI of the storage destination for uploaded model weight files. Supported storage destinations include S3, Google Cloud Storage, and file locations.
Using this method, file uploads are separate and then a link to each is stored in the model object.
For storage requiring credentials, the credentials are stored in the ClearML configuration file,
~/clearml.conf.
-
Parameters
uri (
str) – The URI of the upload storage destination.For example:
-
s3://bucket/directory/ -
file:///tmp/debug/
-
-
Return type
None
system_tags
property system_tags: List[str]
A list of system tags describing the model.
-
Return type
List[str] -
Returns
The list of tags.
tags
property tags: List[str]
A list of tags describing the model.
-
Return type
List[str] -
Returns
The list of tags.
task
property task: str
The ID of the task connected to this model. If no task is connected, returns the ID of the task that originally created it.
-
Return type
str -
Returns
The Task ID
unarchive
unarchive()
Unarchive the model. If the model is not archived, this is a no-op
-
Return type
None
update_design
update_design(config_text=None, config_dict=None)
Update the model configuration. Store a blob of text for custom usage.
This method’s behavior is lazy. The design update is only forced when the weights are updated.
-
Parameters
-
config_text (
Optional[str]) – The configuration as a string. This is usually the content of a configuration dictionary file. Specifyconfig_textorconfig_dict, but not both. -
config_dict (
Optional[dict]) – The configuration as a dictionary. Specifyconfig_textorconfig_dict, but not both.
-
-
Return type
bool -
Returns
Trueif the update was successful,Falseif it was not.
update_labels
update_labels(labels)
Update the label enumeration.
-
Parameters
labels (
Mapping[str,int]) – The label enumeration dictionary of string (label) to integer (value) pairs.For example:
{"background": 0,"person": 1} -
Return type
Any
update_weights
update_weights(weights_filename=None, upload_uri=None, target_filename=None, auto_delete_file=True, register_uri=None, iteration=None, update_comment=True, is_package=False, async_enable=True)
Update the model weights from a local file.
Uploading the model is a background process. This method returns immediately.
-
Parameters
-
weights_filename (
Optional[str]) – The name of the locally stored weights file to upload. Specifyweights_filenameorregister_uri, but not both. -
upload_uri (
Optional[str]) – The URI of the storage destination for model weights upload. The default value is the previously used URI. -
target_filename (
Optional[str]) – The newly created filename in the storage destination location. The default value is theweights_filenamevalue. -
auto_delete_file (
bool) – IfTrue(default), delete the temporary file after uploading. -
register_uri (
Optional[str]) – The URI of an already uploaded weights file. The URI must be valid. Specifyregister_uriorweights_filename, but not both. -
iteration (
Optional[int]) – The iteration number. -
update_comment (
bool) – IfTrue(default), append the local weights filename to the model comment (to maintain provenance). -
is_package (
bool) – IfTrue, mark the weights file as a compressed package, usually a zip file. Defaults toFalse. -
async_enable (
bool) – IfTrue(default), upload in the background and return immediately. IfFalse, block until the upload completes. Raises an error if the upload fails.
-
-
Return type
str -
Returns
The uploaded URI.
update_weights_package
update_weights_package(weights_filenames=None, weights_path=None, upload_uri=None, target_filename=None, auto_delete_file=True, iteration=None, async_enable=True)
Update the model weights from a local file, or from directory containing multiple files.
Uploading the model is a background process. This method returns immediately.
-
Parameters
-
weights_filenames (
Optional[Sequence[str]]) – The file names of the locally stored model files. Specifyweights_filenames, orweights_path, but not both. -
weights_path (
Optional[str]) – The directory path to a package. All the files in the directory will be uploaded. Specifyweights_pathorweights_filenames, but not both. -
upload_uri (
Optional[str]) – The URI of the storage destination for the model weights upload. The default is the previously used URI. -
target_filename (
Optional[str]) – The newly created filename in the storage destination URI location. The default is the value specified in theweights_filenameparameter. -
auto_delete_file (
bool) – IfTrue(default), delete temporary file after uploading. -
iteration (
Optional[int]) – The iteration number. -
async_enable (
bool) – Whether to upload model in background or to block. Will raise an error in the main thread if the weights failed to be uploaded or not.
-
-
Return type
str -
Returns
The uploaded URI for the weights package.
upload_storage_uri
property upload_storage_uri: str
The URI of the storage destination for uploaded model weight files.
-
Return type
str -
Returns
The URI string
url
property url: str
Return the URL of the model file (or archived files)
-
Return type
str -
Returns
The model file URL.
OutputModel.wait_for_uploads
classmethod wait_for_uploads(timeout=None, max_num_uploads=None)
Wait for any pending or in-progress model uploads to complete. If no uploads are pending or in-progress,
then the wait_for_uploads returns immediately.
-
Parameters
-
timeout (
Optional[float]) – The timeout interval to wait for uploads (seconds). -
max_num_uploads (
Optional[int]) – The maximum number of uploads to wait for.
-
-
Return type
None