Track and visualize all the pieces of your machine learning pipeline
👀 View Document | 👋 Join our WeChat
English | 中文
[24/03/12] 👽 We supported the line chart smoothing feature, supporting 3 different smoothing algorithms; we support comparing Images and Audio charts in Charts; we have improved swanlab.Image
, supporting tensor as inputs.(v0.2.3)
[24/03/03] 🔧 We fixed some issues in v0.2.1 and added support for switching multimedia chart content by pressing keys.(v0.2.2)
[24/03/01] 🚀 Still Very Big Upgrade!We supported Text Chartto meet the needs of tasks in NLP, LLM, Agent and other scenarios; We have made a lot of optimizations to line chart's UI, legend, and rendering speed. We improved the rendering performance of Logs —— now viewing terminal printing information with 200k lines is also not lagging.(v0.2.1)
[24/02/08] 🔥 Very Big Upgrade! We supported Image Chart、Audio Chart、Multi-Experiments Chart and a series of comprehensive optimizations and improvements! Please be sure to upgrade to the latest version via pip install -U swanlab
.(v0.2.0)
[24/01/25] 😄 We supported a new Config/Summary table component that supports parameter search. Additionally, we've used new fonts and color schemes.(v0.1.6)
Upgrade to the latest version: pip install -U swanlab
。
- 📊 Visualize Training: visualize your entire training process.
- 🚀 Multimedia Charts: log Image/Audio/Video/Text/object3D...
- 🧪 Experiments GridView: compare your key metrics for inspiration faster.
-
⚡️ Auto Save Environment Info: Hyperparameters, Config, Metric, Terminal logging, Environment Information auto save.
-
🥔 Offline Support: SwanLab can run entirely offile, ithout requiring any access to the Internet. For instance, this may be on your local machine, behind a corporate firewall, or in a datacenter.
Requirement:Python 3.8+.
Use pip to install our stable release version. The installation command is as follows:
pip install -U swanlab
If you need the bleeding edge of the code and can't wait for a new release, you must install the library from source。
- First, install the SwanLab SDK with pip:
pip install -U swanlab
- Second, Use the example code snippet below as a template to integrate SwanLab to your Python script:
import swanlab
# Start a SwanLab Run with swanlab.init
swanlab.init(
# Save model inputs and hyperparameters in a swanlab.config object
config={'epochs': 20, 'learning_rate': 0.01},
# Specify the save path of the log file
logdir="./logs",
)
# Model training code here...
# Log metrics over time for visualizing performance with swanlab.log
for epoch in range(1, swanlab.config.epochs):
swanlab.log({"loss": loss})
For example, We wrote a simulation experiment script:
import swanlab
import random
offset = random.random() / 5
run = swanlab.init(
experiment_name="Example",
description="It's a ML experiment.",
config={
"learning_rate": 0.01,
"epochs": 20,
},
logdir="./logs"
)
# Simulate the ML training process
for epoch in range(2, run.config.epochs):
acc = 1 - 2**-epoch - random.random() / epoch - offset
loss = 2**-epoch + random.random() / epoch + offset
swanlab.log({"loss": loss, "accuracy": acc})
- Third, open the terminal and use the following command to start a SwanLab dashboard:
$ swanlab watch -l ./logs
SwanLab will give you a URL link (default is http://127.0.0.1:5092). Check the link to see the visualization results of your first experiment in the browser.
Get Started
Python API
CLI API
技巧
Learn how to use SwanLab more effectively by following these use cases:
Code Cases | Description |
---|---|
Hello World | Getting Started |
MNIST | Handwriting recognition based on a plain net and MNIST dataset with pytroch, swanlab. |
Image Classification | Cat and dog classification based on ResNet50 with pytorch, swanlab and gradio. Tutorial. |
Text Generation | Text generation based on Word_language_model (RNN/LSTM/GRU/Transformer) |
UIE-Finetune | how to use personal data to finetune UIE model and monitor training process through swanlab |
This project is currently licensed under Apache 2.0 License.