Buckets:

rtrm's picture
|
download
raw
2.54 kB
# Quickstart Guide
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/gradio-app/trackio/blob/main/examples/notebooks/quickstart.ipynb)
To get started, you can run a simple example that logs some fake training metrics:
```python
import trackio
import random
import time
runs = 3
epochs = 8
for run in range(runs):
trackio.init(
project="my-project",
config={"epochs": epochs, "learning_rate": 0.001, "batch_size": 64}
)
for epoch in range(epochs):
train_loss = random.uniform(0.2, 1.0)
train_acc = random.uniform(0.6, 0.95)
val_loss = train_loss - random.uniform(0.01, 0.1)
val_acc = train_acc + random.uniform(0.01, 0.05)
trackio.log({
"epoch": epoch,
"train_loss": train_loss,
"train_accuracy": train_acc,
"val_loss": val_loss,
"val_accuracy": val_acc
})
time.sleep(0.2)
trackio.finish()
```
Running the above will print to the terminal instructions on launching the dashboard.
The usage of `trackio` is designed to be identical to `wandb` in most cases, so you can easily switch between the two libraries.
```py
import trackio as wandb
```
## Dashboard
You can launch the dashboard by running:
<hfoptions id="language">
<hfoption id="Shell">
```sh
trackio show
```
</hfoption>
<hfoption id="Python">
```py
import trackio
trackio.show()
```
</hfoption>
</hfoptions>
You can also provide an optional `project` name as the argument to load a specific project directly:
<hfoptions id="language">
<hfoption id="Shell">
```sh
trackio show --project "my-project"
```
</hfoption>
<hfoption id="Python">
```py
import trackio
trackio.show(project="my-project")
```
</hfoption>
</hfoptions>
## Deploying to Hugging Face Spaces
When calling `trackio.init()`, by default the service will run locally and store project data on the local machine.
But if you pass a `space_id` to [init()](/docs/trackio/pr_320/en/api#trackio.init), like:
```py
trackio.init(project="my-project", space_id="orgname/space_id")
```
or
```py
trackio.init(project="my-project", space_id="username/space_id")
```
it will use an existing or automatically deploy a new Hugging Face Space as needed. You should be logged in with the `huggingface-cli` locally and your token should have write permissions to create the Space.
<EditOnGithub source="https://github.com/gradio-app/trackio/blob/main/docs/source/quickstart.md" />

Xet Storage Details

Size:
2.54 kB
·
Xet hash:
31b0dd328a0db70a52a62e66eefb182ac9e90e7a0f8f788ba35c827529cc15c7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.