Model Management 
Use the SDK to create and manage your models on the OpenGradient Model Hub.
Managing Models 
To add files to existing or new model repositories, you need to define its name and version. If you use a model repository name that doesn't exist, it will automatically be created. Similarly, if you upload a file to a new version, the version will automatically be added to the repository.
You can use either our Python library or CLI to upload new files.
Using the CLI 
- To create a new model repository, use the following command:
opengradient create-model-repo --repo "my_model" --description "my description"- To add files to a model repository, you need to create a version. In the above create-modelcall, version0.01is automatically initialized for you. Versions can be used to organize different iterations of the same model. To create a new version, use:
opengradient create-version --repo "my_model" --notes "major feature"- To upload your ONNX model file or any associated file to a given model and version, use the following command:
opengradient upload-file path/to/model.onnx --repo "my_model" --version "0.01"- To list the files of a particular version of a model, run the list_filescommand:
opengradient list-files --repo "my_model" --version "0.01"Using the Library 
Using the Python library for model management. To initialize the opengradient client, run the following command:
import opengradient as og
og.init(private_key="<private_key>", email="<email>", password="<password>")TIP
Refer to our Getting Started guide to obtain these credentials
Creating a Model Repo 
To create a new model, run the following command:
og.create_model(model_name="<model_name>", model_desc="<model_description>")create_model automatically calls create_version to initalize v0.01 of your new model
Check the API Reference for more details.
Creating a new version 
new_version = og.create_version(model_name="<model_name>", notes="<notes>")Check the API Reference for more details.
File Upload 
To upload a file to a specific model repo and version, use the following command:
og.upload(model_path="<model_path>", model_name="<model_name>", version="<version>")Check the API Reference for more details.
List Files 
To see what files are in a model repo and version:
og.list_files(model_name="<model_name>", version="<version>")Tutorial 
import opengradient as og
# Initialize the opengradient client
og.init(private_key="<private_key>", email="<email>", password="<password>")
model_name = "<model_name>"
# Create a Model
og.create_model(model_name, model_desc="OpenGradient's dynamic fee model")
# Create a Version for the Model
versionString = og.create_version(model_name, notes="<notes>")
# Uploading a model
og.upload(model_path="local_path_to_your_model.onnx", model_name=model_name, version=versionString)SDK API Reference 
Please refer to our API Reference for any additional details around the SDK methods.
