A model in Guild AI is a representation of a machine learning model. A model may be as simple, like a linear regression, or complex, like a deep neural network.
Models in Guild are characterized by their support of
operations, which are actions that can be performed
on the model. One of the most common model operations is
which iteratively modifies model parameters to optimize the model’s
predictive or generative capability. Other common operations include
Guild does not implement model operations. That task is the responsibility of the model developer. Guild instead manages the work flow associated with running operations and tracking results.
Consider the following Guild command:
guild run train mnist
When this command is run, Guild will look for a model named
and then for an operation associated with that model named
train. With this information, Guild will start a
run. Guild tracks run metadata and output so you can access
Guild looks for models in Guild files, which are
guild.yml that contain model definitions.
Here’s what a
guild.yml that defines an
mnist model might look
model: mnist operations: train: main: train_mnist
This file tells Guild that the model
mnist has an operation
that is performed by running a Python module
train_mnist.py might look like:
import mnist_data import mnist_model def train(): data = mnist_data.load() model = mnist_model.init() model.train(data) if __name__ == "__main__": train()
Models in Guild are flexible and can be used to manage any type of operation associated with the model.
Create a model
To create a model, create a file named
guild.yml in your model
Using a text editor, paste the following code sample into
- model: my-model description: My model operations: train: main: train_my_model
Replace the values for
descriptionto reflect the attributes of your model.
train_my_modelwith the Python module used to train your model.
For more information on defining models and operations, see Guile file reference.
For a detailed step-by-step example of creating a Guild model, see Add Guild to a project.
You can experiment with training your model by running:
guild run train
For information on working with runs generated by operations, see Runs.
Guild AI is a package manager that can be used to install models from the deep learning ecosystem. Models are distributed in standard Python packages that can be installed with pip or Guild.
To install a package, run:
guild install PACKAGE
You can lookup packages by running:
guild search TERM
For example, to install a package that contains ResNet models, search
resnet by running:
guild search resnet
After reviewing the list of available packages, if you decide to
tensorflow.reset, you can install it by running:
guild install tensorflow.resnet
Get model help
To view help for models defined in the current directory (i.e. models
To view help for models defined in another directory, run:
guild help DIRECTORY
DIRECTORY must contain a Guild file (i.e.
To view help for models defined in a package, run:
guild help PACKAGE
For example, to view help for the models provided by
guild help tensorflow.resnet
For more information, see the help command.
List available models by running:
You can filter the results using a term. For example, to list
available models that contain
guild models cnn
For more information, see the models command.
You can remove models defined in packages by uninstalling the packages.
guild uninstall PACKAGE
The package that a model is associated with is displayed when you run
guild models in the form