8000 GitHub - swpfY/SwanLab: 🧐SwanLab: a tool for your machine learning log tracking and experiment management. Join our WeChat ⬇️
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

swpfY/SwanLab

 
 

Folders and files

NameName
Last commit message 8000
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwanLab Library

SwanLab is a robust open-source machine-learning training management tool for researchers. By using SwanLab, researchers can accumulate training experience and discover new ideas.

English | 简体中文

/ pypi Download Github Discussion Website license

hello_world_main2


✨ Features

  1. Real-time Indicator Record: A few lines of code can record your training metrics in real time.
  2. 🧪 Multiple Experimental Comparisons: Support multiple experimental metric comparisons.
  3. 🤖 ML Support:: Support mainstream training frameworks such as PyTorch, TensorFlow, Transformers, mmdetection.
  4. 📝 Environmental Record: Support automatic logging, error reporting, system hardware, Python environment and other environmental information.
  5. 🖥 Local and Public Cloud Support: Supports both local and public cloud (coming soon).

🔥 Examples

We've got some example code and articles to help you get a better grip on SwanLab:


⚡️ Quick Start

Hey, whether you're a developer or an everyday user, this quick-start guide will get you started and show you how to use SwanLab:

  • Record training settings
  • Keep track of key metrics
  • Visualize experiments

🎯 Step1:Installation

pip install -U swanlab

👋 Step2:Hello World

If we break down the training process in machine learning, it's basically all about tweaking settings, looping, and keeping an eye on the metrics we care about.

The following Python code simulates this:

import swanlab

# Initialization
swanlab.init()

for epoch in range(1, 20):
    print("epoch", epoch)
    # Tracking index: `epoch`
    swanlab.log({"epoch": epoch})

Among them, swanlab.init is necessary, which is used to initialize the instance and configure parameters; The function of swanlab.log is responsible for recording data, and the received data type is a dictionary (dict).

When running the above code, you will see the following output result:

[SwanLab-INFO]:        Run data will be saved locally in path/swanlog/majestic-hemlock-1
[SwanLab-INFO]:        Experiment_name: majestic-hemlock-1
[SwanLab-INFO]:        Run `swanlab watch` to view SwanLab Experiment Dashboard
epoch 1
epoch 2
epoch 3
epoch 4
epoch 5
epoch 6
epoch 7
epoch 8
epoch 9
[SwanLab-INFO]:        train successfully

And there will be swanlog folder in the root directory, which contains files automatically generated by SwanLab, recording a series of experimental data.


🧪 Step3:Run Dashboard

Now let's check the status of the instructions recorded by SwanLab in each loop step.

Run the command swanlab watch:

$ swanlab watch

[SwanLab-INFO]:        SwanLab Experiment Dashboard ready in 375ms
                       ➜  Local:   http://127.0.0.1:5092

Visit http://127.0.0.1:5092 , open the experiment dashboard, and access the experiment that was just run.

hello_world_main1


🚀 Level up a bit

In this section, let's write an advanced training script to simulate real machine learning training.

First, initialize swanlab and set the experiment name, description, and configuration:

swanlab.init(
    # Set experiment name
    experiment_name="sample_experiment",
    # Set description
    description="This is a sample experiment for machine learning training.",
    # Record tracked hyperparameters and run metadata.
    config={
        "learning_rate": lr,
        "epochs": epochs,
    },
)

Combine into 1 complete training script, use swanlab.log API to track the loss value loss and accuracy accuracy:

import swanlab
import time
import random

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

swanlab.init(
    # Set experiment name
    experiment_name="sample_experiment",
    # Set description
    description="This is a sample experiment for machine learning training.",
    # Record tracked hyperparameters and run metadata.
    config={
        "learning_rate": lr,
        "epochs": epochs,
    },
)

# Simulated 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}")
    # Tracking index: 'loss' and 'accuracy'
    swanlab.log({"loss": loss, "accuracy": acc})
    time.sleep(1)

Similarly, run swanlab watch to start the experiment dashboard:

hello_world_main2


🌱 Learn More


💬 Community

Join SwanLab Community to share your ideas, suggestions, or questions and connect with other users and contributors.

WeChat or Github Discussions:

PyPI - DownloadsDiscuss on GitHub


LICENSE

This project is currently licensed under Apache 2.0 License

About

🧐SwanLab: a tool for your machine learning log tracking and experiment management. Join our WeChat ⬇️

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vue 43.6%
  • Python 42.5%
  • JavaScript 12.2%
  • SCSS 1.5%
  • HTML 0.1%
  • TypeScript 0.1%
0