Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/readme-v0.2.1 #375

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vue/components.d.ts
vue/auto-imports.d.ts
swanlog/
swanlog.bak/
logs/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
167 changes: 75 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Track and visualize all the pieces of your machine learning pipeline
</p>

<p align="center">
👋 Join our <a href="https://geektechstudio.feishu.cn/wiki/NIZ9wp5LRiSqQykizbGcVzUKnic">WeChat</a>
<img alt="SwanLab Head Image" src="readme_files/swanlab-head-image.png" width="800">
</p>

<p align="center">
👀 View <a href="https://geektechstudio.feishu.cn/wiki/MwXmw9yDeiZWyQkPnNgcixwWnwu">Document</a> | 👋 Join our <a href="https://geektechstudio.feishu.cn/wiki/NIZ9wp5LRiSqQykizbGcVzUKnic">WeChat</a>
</p>

<p align="center">
Expand All @@ -30,58 +34,49 @@ English | <a href="README_zh-hans.md">中文</a>
- [Key Function](#key-function)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Tutorial](#Tutorial)
- [Use Case](#use-case)
- [More Tips](#more-tips)
- [LICENSE](#license)

<br>

## Changelog

[24/02/08] 🔥 Very Big Update! We supported [Image Chart](https://geektechstudio.feishu.cn/wiki/LZFxwTuegiXxPGkhXcpcBUEXnHb)、[Audio Chart](https://geektechstudio.feishu.cn/wiki/SU6mwcVNbixMf1k95KbcZHDCnJe)、Mutil-Experiments Chart and a series of comprehensive optimizations and improvements! Please be sure to upgrade to the latest version via `pip install -U swanlab`.
Upgrade to the latest version: `pip install -U swanlab`

[24/01/25] 😄 We supported a new Config/Summary table component that supports parameter search. Additionally, we've used new fonts and color schemes.
[24/03/01] 🚀 Still Very Big Upgrade!We supported [Text Chart](https://geektechstudio.feishu.cn/wiki/T0L7wYfzGiZUCKkxfehcFwYAnIh)to 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/01/23] 🚨 We use SQLite database and Peewee to replace the previous basic configuration information reading and writing solution by [#114](https://github.com/SwanHubX/SwanLab/issues/114). It's a major change that is highly beneficial for the future of the project, but the drawback is that it's not compatible with old versions (swanlab<=v0.1.4) of log data files. Therefore, if you need to visualize log files generated by older versions, please use [transfer script](script/transfer_logfile_0.1.4.py)
[24/02/08] 🔥 Very Big Upgrade! We supported [Image Chart](https://geektechstudio.feishu.cn/wiki/LZFxwTuegiXxPGkhXcpcBUEXnHb)、[Audio Chart](https://geektechstudio.feishu.cn/wiki/SU6mwcVNbixMf1k95KbcZHDCnJe)、Mutil-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)

Additionally, we supported export the experiment list as `CSV`, new environment record items `Run path` and `logdir`, added interactive quick copy function, and new API `swanlab.config`.
[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)

[Full Changelog](https://github.com/SwanHubX/SwanLab/releases)

<br>

## Key Function

- **🚀 Multimedia charts**: log Image/Audio/Video/Text/object3D...
- **📊 Visualize Training**: visualize your entire training process.

<div align="center">
<img src="readme_files/mutilmedia-chart.gif" width="600">
</div>

- **🧪 Experiments GridView**: compare your key metrics for inspiration faster

<div align="center">
<img src="readme_files/experiments-table.png" width="600">
<img src="readme_files/charts-1.gif" width="600">
</div>

- **📊 Charts**: visualize your entire training process
- **🚀 Multimedia Charts**: log Image/Audio/Video/Text/object3D...

<div align="center">
<img src="readme_files/charts-1.gif" width="600">
<img src="readme_files/mutilmedia-chart.gif" width="600">
</div>

- **⚡️ Track machine-learning pipeline**: Hyperparameters, Config, Metric, Terminal logging, Environment Information auto save
- **🧪 Experiments GridView**: compare your key metrics for inspiration faster.

<div align="center">
<img src="readme_files/track-machine-learning-pipeline.gif" width="600">
<img src="readme_files/experiments-table.png" width="600">
</div>

<br>

- **🥔 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
- **⚡️ Auto Save Environment Info**: Hyperparameters, Config, Metric, Terminal logging, Environment Information auto save.

> [!NOTE]
> See the SwanLab <a href="https://geektechstudio.feishu.cn/wiki/MwXmw9yDeiZWyQkPnNgcixwWnwu">Documentaion</a> and <a href="https://github.com/SwanHubX/SwanLab-examples">Examples</a> for a full description of the SwanLab.
- **🥔 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.

<br>

Expand Down Expand Up @@ -117,105 +112,93 @@ import swanlab

# Start a SwanLab Run with swanlab.init
swanlab.init(
# save model inputs and hyperparameters in a swanlab.config object
config={'learning_rate': 0.01},
# 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, 20):
for epoch in range(1, swanlab.config.epochs):
swanlab.log({"loss": loss})
```

3. Third, Run a Dashboard:
```bash
$ swanlab watch -l ./logs
```

That's it! Open http://127.0.0.1:5092 to view a dashboard of your first SwanLab Experiment.

<br>

## Use Case

Learn how to use SwanLab more effectively by following these use cases:

| Code Cases | Description |
| ------- | ------- |
| [Hello World](https://github.com/SwanHubX/SwanLab-examples/tree/main/Hello_World) | Getting Started |
| [MNIST](https://github.com/SwanHubX/SwanLab-examples/tree/main/MNIST) | Handwriting recognition based on a plain net and MNIST dataset with pytroch, swanlab. |
| [Image Classification](https://github.com/SwanHubX/SwanLab-examples/blob/main/Resnet50) | Cat and dog classification based on ResNet50 with pytorch, swanlab and gradio. [Tutorial](https://zhuanlan.zhihu.com/p/676430630). |
| [Text Generation](https://github.com/SwanHubX/SwanLab-examples/blob/main/Word_language_model) | Text generation based on Word_language_model (RNN/LSTM/GRU/Transformer) |
| [UIE-Finetune](https://github.com/SwanHubX/SwanLab-examples/tree/main/UIE) | how to use personal data to finetune UIE model and monitor training process through swanlab |

<br>

## More Tips

🏄‍♀️ Experiment Dashboard:

<details>
<summary>Set a log directory save path and run the Dashboard using it</summary>

Set a log directory save path, such as `./logs`:
For example, We wrote a simulation experiment script:

```python
import swanlab

swanlab.init(
logdir="./logs"
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"
)
```

Run the Dashboard using it:

```bash
$ swanlab watch --logdir ./logs_path
# 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})
```

</details>

<details>
<summary>Set the Host and Port for the Dashboard</summary>

3. Third, open the terminal and use the following command to start a SwanLab dashboard:
```bash
$ swanlab watch --host 0.0.0.0 --port 8080
$ swanlab watch -l ./logs
```

</details>

<details>
<summary>Remotely access Dashboard</summary>
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.

- Link:[Access the SwanLab Dashboard While Training on a Remote Server](https://zhuanlan.zhihu.com/p/677224865)
<div align="center">
<img src="readme_files/get-started.png" width="600">
</div>

</details>
<br>

⚙️ Other:
## Tutorial

<details>
<summary>argparse init swanlab.config</summary>
**Get Started**
- [Installation](#安装)
- [Quick Start](https://geektechstudio.feishu.cn/wiki/UInBw9eaziv17IkwfrOcHCZ1nbc)
- [Run Dashboard](https://geektechstudio.feishu.cn/wiki/YsEfwC79viJL2nk5TgPcAOUhn5U)

`swanlab.config` supports directly passing variables of type `argparse.Namespace`, such as:
**Python API**
- [init](https://geektechstudio.feishu.cn/wiki/H7Wbwt91LiCJtnkpHOzcar4TnCc)
- [log](https://geektechstudio.feishu.cn/wiki/RmjXwjmgUi5zGCkBPsTc5ygQn4g)
- [config](https://geektechstudio.feishu.cn/wiki/HkTOwxLkHiUC84kJNrlcohyGnuh)
- [Image](https://geektechstudio.feishu.cn/wiki/LZFxwTuegiXxPGkhXcpcBUEXnHb)
- [Audio](https://geektechstudio.feishu.cn/wiki/SU6mwcVNbixMf1k95KbcZHDCnJe)
- [Text](https://geektechstudio.feishu.cn/wiki/T0L7wYfzGiZUCKkxfehcFwYAnIh)

```python
import argparse
import swanlab
**CLI API**
- [watch](https://geektechstudio.feishu.cn/wiki/Q6I5wdyr9iRYkdkZ2gYcHQkxnCU)

parser = argparse.ArgumentParser()
···
args = parser.parse_args()
**技巧**
- [Remotely view Dashboard](https://geektechstudio.feishu.cn/wiki/Icesw6coTidDsPkN960c0lNtnCb)
- [Pass argparse into swanlab.config](https://geektechstudio.feishu.cn/wiki/CT1Xwo6ehimNH5kz7y9csTGkn0e)

<br>

swanlab.init(
config=args
)
```
## Use Case

</details>
Learn how to use SwanLab more effectively by following these use cases:

| Code Cases | Description |
| ------- | ------- |
| [Hello World](https://github.com/SwanHubX/SwanLab-examples/tree/main/Hello_World) | Getting Started |
| [MNIST](https://github.com/SwanHubX/SwanLab-examples/tree/main/MNIST) | Handwriting recognition based on a plain net and MNIST dataset with pytroch, swanlab. |
| [Image Classification](https://github.com/SwanHubX/SwanLab-examples/blob/main/Resnet50) | Cat and dog classification based on ResNet50 with pytorch, swanlab and gradio. [Tutorial](https://zhuanlan.zhihu.com/p/676430630). |
| [Text Generation](https://github.com/SwanHubX/SwanLab-examples/blob/main/Word_language_model) | Text generation based on Word_language_model (RNN/LSTM/GRU/Transformer) |
| [UIE-Finetune](https://github.com/SwanHubX/SwanLab-examples/tree/main/UIE) | how to use personal data to finetune UIE model and monitor training process through swanlab |

<br>

Expand Down
Loading