Quickstart using CLI
Prior steps are logging in, creating a project and a dataset instance.
leapcliusing the following command:
pip install leapcli
Once installed successfully, the
leapcommand shall be available.
leapCLI is installed, you can initialize your project to be synced with the Tensorleap platform.
In the target project path, run the following command to initialize Tensorleap within the project:
leap init PROJECT_NAME DATASET_NAME
Replace the arguments with the corresponding value:
All the parameters are stored at the
.tensorleap/config.tomlfile and could be changed if needed.
In order to access the platform, we must run the
leap logincommand within the initialized project path, as such:
leap login [API_ID] [API_KEY] [ORIGIN]
For Tensorleap to read the data and fetch it to the model for training or evaluation, we must provide a Dataset Script. This script defines the preprocessing function, input/ground_truth encoders and metadata functions.
The script should be set at the
The model integration script is located at
.tensorleap/model.py, an example script below:
from pathlib import Path
from myproject.model import build_model # import from the parent project
def leap_save_model(target_file_path: Path):
# Load your model
model = build_model()
# Save it to the path supplied as an arugment (has a .h5 suffix)
leap_save_modelis automatically called by the CLI when pushing a model into the Tensorleap platform. Its purpose is to prepare and store the model in the provided
You can validate the dataset and model scripts locally by using the following command:
leap check --all
This command will validate the scripts together with its synchronization with the Tensorleap platform.
Once everything is validated, you can push the dataset script and model to the Tensorleap platform for further evaluation/training/analysis.
To push the dataset script, use the following command from the project path:
leap push --dataset
To push the model to the project, use the following command:
leap push --model
You can also set the
leap push --model [--branch-name=<BRANCH_NAME> [--description=<DESCRIPTION>]
You can follow the next steps to prepare the model for analysis:
- Find the imported model on the Versions view, hover your cursor over the view and clickon the right to Open Commit.
- The model is ready for training or evaluation:Already trained model - clickfrom the top bar to inference the data and collect metrics. Re-train / train from scratch in the Tensorleap platform - clickfrom the top bar to train the model. More info at Evaluate / Train Model.