Upgrade from pyhectiqlab
The same work, in hectiqlab.
hectiqlab records to the same Hectiq Lab as pyhectiqlab, with a smaller API: one way to do each thing, and no call that can crash your training. Both packages install side by side and share the same key, so you can move one script at a time.
pip install "hectiqlab[cli]"A training script
from pyhectiqlab import Run, Step, Config
import pyhectiqlab.functional as hl
hl.set_project("hectiq-ai/demo")
with Run(title="My first run"):
hl.add_config(Config(lr=1e-3, epochs=3))
with Step(name="train"):
for epoch in range(3):
hl.add_metric(key="loss", step=epoch, value=train_one_epoch())
hl.add_artifact(path="confusion.png")
hl.create_model(name="my-model", path="checkpoints/")Call by call
| pyhectiqlab | hectiqlab |
|---|---|
Run(title=...) | hl.run(title) |
hl.add_config(config) | hl.run(title, config={...}), or hl.runs.update(config={...}) |
hl.retrieve_run(rank=42) | hl.runs.get(42) |
hl.add_metric(key=..., step=..., value=...) | hl.add_metric(name, step=..., value=...) |
Step(name=...), hl.start_step(...) | hl.stage(name), hl.each(iterable, name) |
hl.add_artifact(path=...) | hl.artifacts.create(path) |
hl.add_figure(figure=..., name=...) | fig.savefig(path), then hl.artifacts.create(path) |
hl.create_dataset(name=..., source=...) | hl.datasets.create(path, name=...) |
hl.download_dataset(name=..., version=...) | hl.datasets.download(name, version) |
hl.create_model(...), hl.download_model(...) | hl.models.create(...), hl.models.download(name, version) |
hl.add_tags_to_run(tags=[...]) | hl.runs.tag(*tags) |
run.track_version([...]) | Nothing: every run records its commit, diff and packages. |
hl.publish_message(...), hl.get_message(...) | Nothing yet: hectiqlab has no messages. |
Config | A plain dict. |
What changes in behavior
- Failures are values.
pyhectiqlablogged most errors and returnedNone. Inhectiqlab, a read or change returns aResult:.unwrap()gives the value or raises. See Results and errors. - Nothing waits on the network. Metrics, stages and uploads go out in the background. The run waits for them before it ends, and warns once if something didn't land.
- Runs are named by rank or id.
hl.runs.get(42)reads run 42 of the project; a string is an id. - The run ends by itself. No more
hl.completed()orhl.failed(): the run endscompleted,failedorstoppedwith its block.
The command line
hectiq-lab Class.method --flag becomes hlab <thing> <verb>:
| pyhectiqlab | hectiqlab |
|---|---|
hectiq-lab authenticate | hlab login |
hectiq-lab Run.retrieve --rank 42 | hlab run get 42 |
hectiq-lab Dataset.create --source data/ --name interactions | hlab dataset create data/ --name interactions |
hectiq-lab Model.download --name two-tower --version 1.3 | hlab model download two-tower --version 1.3 |
hectiq-lab Tag.list | hlab tag list |
Every hlab command takes --json.
Settings
| pyhectiqlab | hectiqlab |
|---|---|
HECTIQLAB_OFFLINE_MODE | HECTIQLAB_DISABLE |
HECTIQLAB_HIDE_PROGRESS | HECTIQLAB_PROGRESS=false |
HECTIQLAB_RAISE_ERROR | Nothing: call .unwrap() on a Result, or run.result() |
HECTIQLAB_API_KEY, HECTIQLAB_CREDENTIALS, HECTIQLAB_API_URL, HECTIQLAB_PROJECT | The same |
See Settings for the rest.