Skip to content

Use a repository from an instance or notebook

View as Markdown

Upload the files of a trained model to a repository from an instance or notebook, and download them there for training or testing. You reach a repository with the Python SDK or the MinIO CLI rather than mounting it as a folder. The keys are on the Overview tab, and the commands are on the three setup tabs.

  • A repository; see Create a repository.
  • Permission to read model repositories in the project. A Member gets it through a policy that allows reading for the Inference service.

The Using TIR Notebook tab has the code with the repository number filled in. Inside a notebook, the code leaves out the token step that the Using SDK tab has.

  1. Install the SDK:

    pip install e2enetworks
  2. Run the code in the notebook. Replace the placeholders:

    • <Delhi or Chennai> is the region you are working in.
    • <local-model-directory> is the folder to upload.
    • <local-download-path> is where to save the download.
    • <version-prefix> is a folder in the repository such as v1. Leave it empty for the top.
    • <repository-id> is the repository’s number.
    from e2enetworks.cloud import tir
    location = "<Delhi or Chennai>"
    models = tir.Models(location=location)
    models.push_model(model_path="<local-model-directory>", prefix="<version-prefix>", model_id=<repository-id>)
    models.download_model(model_id=<repository-id>, local_path="<local-download-path>", prefix="<version-prefix>")

The first call uploads a trained model’s files, and the second downloads them.

Use the SDK from an instance or your own computer

Section titled “Use the SDK from an instance or your own computer”

Use the Using SDK tab. It adds an API token step and the sign-in call. Upload model files has that setup code and shows how to create the client. Then download with this call. <repository-id> is the repository’s number, and the tab fills it in:

models.download_model(model_id=<repository-id>, local_path='', prefix='')

On an instance or your own computer, connect mc with the Using CLI tab and download the files:

mc cp -r <repository-name>/<bucket-name> <local-folder>

See Connect to a repository with the MinIO CLI or s3cmd for the setup and the placeholders.

The files are in the folder you gave. Anyone who can open the repository can see its keys, so keep them out of notebooks you share. For help with a message, see Troubleshooting Model Repository.