CLI Assets upload
Describes the usage of the Tensorleap CLI to upload models and datasets to the platform
prerequisites to upload assets to the Tensorleap platform are:
Having a Tensorleap server installed, with access to the dataset.
Having a CLI installed & authenticated, that is able to access the Tensorleap server via port 4589.
Access to a valid integration script that passed the integration test OR/AND access to a .onnx or .h5 model that should be uploaded to the platform
The Tensorleap CLI is used to upload codebases and models to the Tensorleap platform.
Uploading code only
In order to upload a code integration into the platform, from within the root of the repo (where leap.yaml is located), run:
leap code push PATH-TO-MODEL
If leap.yaml fields are invalid or if this is the first integration of the code and some fields are missing, the CLI would interactively ask the user to choose an existing code integration to update from the platform or to create a new one.
In case the "Build Dynamic dependencies" was selected from the settings page in the platform, the first action that happens on code push and requirement.txt upload is a creation of a virtual environment. This might take some time at first creation, but subsequent upload with the same requirements will utilize this existing virutal environment. Otherwise, a default environment is being used.
Next, the code is uploaded to the platform. The server would try to run the preprocess function, get an input, get a GT, and run all of the metadata for the first index of the dataset.
If this is able to run successfully, the CLI should show:
INFO Code parsed successfully
Otherwise, the CLI should print the stack trace with the error it got. For a more complete log, login to the platform and review the runs & processes menu.
Common code integration errors may occur when:
Integration interface contract (i.e. shapes, types) was not kept. Please ensure you have been able to run a local integration test successfully.
Some of the files were not included in the leap.yaml.
An error in accessing a specific path. please ensure that all of the data you want to read from storage in the code integration (including configs, labels, or any other assets) is located within a folder that was mounted to the Tensorleap server on installation . The leap server info command lists the mounted folders under the datasetvolumes property.
Uploading a model
In order to upload a mode into the platform, from within the root of the repo (where leap.yaml is located), run:
leap models import PATH-TO-MODEL
If leap.yaml fields are invalid or if this is the first integration of the code and some fields are missing, the CLI would interactively ask the user to choose an existing project or create a new one. It would also inteartively ask for a model name.
Then, it would upload the model into the Tensorleap server, and run it through the Tensorleap model analysis pipeline. At the end of a successful import of the model to the platform, it would print:
INFO Successfully imported model
In case you encounter any errors in model upload - please contact the Tensorleap team.
Uploading both a code and model
In order to upload a model and a codebase, from within the root of the repo (where leap.yaml is located), run:
leap projects push PATH-TO-MODEL
This would first try to upload your code and would then try to upload the model.
If both works successfully and a leap_mapping.yaml is present, it would also try to create the corrosponding UI connections. In that case it would print:
INFO mapping was applied successfully applied with no validation errors
If you use a leap_mapping.yaml and do not see this print, rather a table with validation issues in the mapping - it means that the mapping was not applied successfully. Check if you are using the same archirecture that was used when creating the mapping & that the model was exported to .onnx/.h5 in the same way. If an error occurs, it is recommended to delete the leap_mapping.yaml, push the model with a mapping, and create a new mapping (via the UI) that matches the current model.
Last updated
Was this helpful?