indevn / SwanLab

šŸ§SwanLab: a tool for your machine learning log tracking and experiment management.

Home Page:https://geektechstudio.feishu.cn/wiki/space/7310593325374013444?ccm_open_type=lark_wiki_spaceLink&open_tab_from=wiki_home

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwanLab Library

pypi Download Website GitHub release

SwanLab is the next-generation machine learning experiment management and visualization tool released by the SwanHub, designed to facilitate effective collaboration in machine learning training.

SwanLab provides streamlined APIs that make it easy to track machine learning metrics and record configurations. Additionally, SwanLab provides a visual dashboard for the most intuitive way to monitor, analyze, and compare your training.

For specific guidance on SwanLab's features, please refer to the User Guide.

Currently, SwanLab is undergoing rapid iterations and will continue to add new features.

Installation

This repository is tested on Python 3.8+.

SwanLab can be installed using pip as follows:

pip install swanlab

Quick tour

Let's simulate a simple machine learning training process, using swanlab.init to initialize the experiment and record configuration information, and using swanlab.log to track key metrics (in this example, it's loss and acc):

import swanlab
import time
import random

lr = 0.01
epochs = 20
offset = random.random() / 5

# Initialize the experiment and record configuration information
swanlab.init(
    description="This is a sample experiment for machine learning training.",
    config={
        "learning_rate": lr,
        "epochs": epochs,
    },
)

# Simulate a machine learning training process
for epoch in range(2, epochs):
    acc = 1 - 2**-epoch - random.random() / epoch - offset
    loss = 2**-epoch + random.random() / epoch + offset
    print(f"epoch={epoch}, accuracy={acc}, loss={loss}")
    # Track key metrics
    swanlab.log({"loss": loss, "accuracy": acc})
    time.sleep(1)

During the program running, a swanlog folder will be generated in the directory to record your training data.

If you want to visualize your experiment, open the terminal and enter the root directory (no need to enter the swanlog folder), and run the following command:

swanlab watch

If you see the following output, it means that the experimental board is running successfully:

[SwanLab-INFO]:        SwanLab Experiment Dashboard ready in 375ms

                        āžœ  Local:   http://127.0.0.1:5092

Accesshttp://127.0.0.1:5092 at this time to enter the experiment dashboard and browse your experimental resultsļ¼š

swanlab-dashboard-1

License

Apache 2.0 License

Contributors

swanlab contributors

About

šŸ§SwanLab: a tool for your machine learning log tracking and experiment management.

https://geektechstudio.feishu.cn/wiki/space/7310593325374013444?ccm_open_type=lark_wiki_spaceLink&open_tab_from=wiki_home

License:Apache License 2.0


Languages

Language:Python 54.3%Language:Vue 29.4%Language:JavaScript 13.7%Language:SCSS 2.5%Language:HTML 0.2%