Models are a great option to store an immutable version of model code and its artifacts for reuse in other jobs. Models only will only incur storage charges for their size, and can be used on unlimited jobs simultaneously.
Models enable you to store a job's model directory permanently to reuse as the starting point for the model directory for subsequent jobs. Models only will incur storage charges for their size, which is also included in the 50 GB free storage option. When a model is used in a job, the job's working directory space must be sufficient to support the model size.
Models are immutable once created. When a model is used in a job, the contents can be modified while that job worker is running, but any changes do not affect the original model or any other jobs using that model. In order to save the modifications, you must save the job as a new model. The maximum size of any model is 50 GB, but you can have unlimited models.
Creating a Model
Models can be created from three different sources: external, notebooks, and training jobs.
External Model Source
To create a model from an external sources, navigate to the Models Dashboard from the side navigation and click the
Create button. Specify the name of the new model in the
Name field and then select the
Source Type of the location from which to populate the new model:
Local: Select this option if the model data resides on your local computer. You will be required to connect to the model for this option to work. Jobs using the local storage options will wait indefinitely for you to connect.
Git: Select this option if the model data resides in a git repository.
HTTP: Select this option if the model data resides on a publicly accessible HTTP or FTP server.
AWS: Select this option if the model data resides on Amazon S3.
GCP: Select this option if the model data resides on Google Cloud Storage.
Kaggle: Select this option if the model data is from a Kaggle Competition or Dataset
Specify the path of the model data within the storage type specified in the
Path field. If you specify a compressed file (zip, tar, tar.gz, or bz2), the file will be downloaded and automatically extracted prior to any worker starting. If you specify a directory path (ending in
/), it will run a sync starting from the path provided, downloading all files and subdirectories from the provided path. Valid paths for each
Source Type are the following:
Local: Must begin with
~/(home directory relative), or
$(environment variable path). Relative paths (using
./) are not supported.
Git: Both http and ssh git repository formats are supported. To use the ssh format, you must configure a git ssh key.
HTTP: Must begin with
AWS: Must begin with
GCP: Must begin with
Kaggle: Must be the short name of the competition or datasets compatible with the Kaggle API.
Create to start populating the model. If you selected any option except
Local, the model download will take place automatically and the model will change to a state of
ready when it is complete. If selected
Local, you must connect to the model by selecting the model and clicking the
Connect button to proceed with the data population.
To create a model from an existing notebook, select the notebook from the Notebook Dashboard and click
Copy button is only enabled when a single notebook is selected and that notebook is either
Save as Model as the
Copy Type. Enter the name for the new model in the
Name field and click
Copy. You will be automatically navigated to the models dashboard where you can monitor the progress of the model creation. The model will then be populated from the current contents of the
/opt/trainml/models directory inside the notebook instance.
Training jobs can be configured to send their output to a trainML model instead of an external source. To create a model from a training job, select
trainML Model as the
Output Type in the data section of the job form. When this option is selected, the TRAINML_OUTPUT_PATH environment variable is redirected to the same location as TRAINML_MODEL_PATH (
/opt/trainml/models). Once each worker in the training job finished, it will save the entire directory structure of
/opt/trainml/models to a new model with the name
Job - <job name> if there is one worker or
Job - <job name> Worker <worker number> if there are multiple workers.
Using a Model
Models can be used by selecting
trainML Model from the
Model Type field in the
Model section of the job form. Select the desired model from the list and create the job. Once the job is running you can access the model in the
/opt/trainml/models directory, or using the TRAINML_MODEL_PATH environment variable.
Removing a Model
Models can only be removed once all jobs that are configured to use them are finished. To remove a model, ensure that the
Active Jobs column is zero, select the model, and click the
Delete button. Since this action is permanent, you will be prompted to confirm prior to deleting.