Upgrade guide
Upgrading pyhectiqlab to version 3.0.0.
The release of version 3.0.0 of pyhectiqlab package comes with many new features. In addition, we have conserved much of the old API, making the upgrade as smooth as possible. In this section, we show how to migrate your code.
Upgrading
To upgrade the pyhectiqlab package, use pip and specify the latest versions >=3.0.0:
pip install --upgrade "pyhectiqlab>=3.0.0"Run
To create runs, you can simply replace the name argument by title:
from pyhectiqlab import Run
run = Run(
title="My first run",
name="My first run",
project="lab/demo",
)Also, note that you can now remove the project argument from the run creation, as it can be fixed externally using the Project namespace or specifying using the environment variable HECTIQLAB_PROJECT:
import os
from pyhectiqlab import Project, Run
Project.set("lab/demo")
# or
os.environ["HECTIQLAB_PROJECT"] = "lab/demo"
run = Run(
title="My first run",
name="My first run",
project="lab/demo",
)Previously, the runs were identified using a universally unique identifier (UUID) system, where the UUIDs were given by the name of the runs. We changed this system to give less importance to the name of the run, hence we now work with a simple integer rank ID system. Now, to retrieve a run, you now have to specify the rank of the run:
from pyhectiqlab import Run
from pyhectiqlab import Project
Project.set("lab/demo")
retrieved_run = Run(
rank=14,
name="An old run",
project="lab/demo",
) You can find the rank ID of a specific run on the web application.
The Run class is now a singleton object, hence all instances of the class share the same information at all times. As a result, you cannot initialize multiple independent runs.
Config
The configs have had a facelift in the last upgrade. We change the run API for retrieving configs, which now must be performed through the Run class:
from pyhectiqlab import Run, Config
config = Config.download(run="My run", project="lab/demo")
config = Run.retrieve_config(rank=14, project="lab/demo") Managing versions
The version management system has been simplified to the bare minimum for you to track the git repos that are attached to your experiments. To push all the system and python related information and attach it to a given run, simply run the track_version.
from pyhectiqlab import Run
run = Run(
title="My run",
name="My run",
project="lab/demo"
)
run.track_version(["my_repos"])
run.add_package_repo_state("my_repos")
run.add_package_versions(globals()) Logs and messages
As of yet, the logs and messages system have been removed from version 3.0.0. We recommend using standard logging loggers. We will reimplement those features in future versions.
To track the logs of a run, use the steps system. For example:
import logging
logger = logging.getLogger()
from pyhectiqlab import Step, Run
run = Run(title="My run", project="lab/demo")
run.add_logger()
with Step(name="Step 1") as step:
logger.info("This message is logged.") Models and datasets
We have revamped the way datasets and models are uploaded and pushed to the lab. First, you no longer have to download or upload them using runs; it can be done using the functional or object-oriented API, as shown in the tutorial, or using the command-line interface.
from pyhectiqlab import Dataset
from pyhectiqlab import Run
Dataset.create(
name="my_dataset",
version="1.0.0",
source="path/to/the/data",
upload=True
)
run = Run(name="upload of dataset", project="lab/demo")
run.add_dataset(
source_path="path/to/the/data",
name="my_dataset",
version="1.0.0",
push_dir=True
) A similar API is used for uploading models:
from pyhectiqlab import Model
from pyhectiqlab import Run
Model.create(
path="path/to/the/model/data",
name="my_model",
version="1.0.0",
)
run = Run(name="upload of model", project="lab/demo")
run.add_mlmodel(
source_path="path/to/the/model/data",
name="my_model",
version="1.0.0",
push_dir=True
) For downloading datasets and models, you can also use the Dataset and Model classes:
from pyhectiqlab import Model
from pyhectiqlab import Run
Model.download(
name="my_model",
version="1.0.0",
path="path/to/the/model/data",
)
run = Run(name="upload of model", project="lab/demo")
run.download_mlmodel(
name="my_model",
version="1.0.0",
save_path="path/to/the/model/data",
) Artifacts
The artifact has not changed.
Metrics
The metrics have not changed.