Code Monkey home page Code Monkey logo

swanhubx / swanlab Goto Github PK

View Code? Open in Web Editor NEW
235.0 3.0 27.0 30.29 MB

⚡️SwanLab: your ML experiment notebook. 你的AI实验笔记本,跟踪与可视化你的机器学习全流程

Home Page: https://swanlab.cn

License: Apache License 2.0

JavaScript 5.97% Python 54.96% HTML 0.05% Vue 38.25% SCSS 0.72% TypeScript 0.03% Shell 0.02%
data-science deep-learning jax machine-learning python pytorch tensorflow transformers mlops model-versioning

swanlab's People

Contributors

clairdelunejs avatar feudalman avatar indevn avatar kashiwabyte avatar little1d avatar nexisato avatar sakura-cat avatar swpfy avatar xiaolin199912 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

swanlab's Issues

🐛 [BUG] When the experiment Finish, the status of `OverView/Experiment List` remains unchanged.

🐛 Bug description [Please make everyone to understand it]

When a experiment is completed, the status of the experiment in the Experiment List in Project OverView does not change until the Browser is refreshed, and then it will be normal.

image

👾 Expected result

Maybe refresh automatically when entering the Oview page?

🚑 Any additional [like screenshots]

  • SwanLab Version: v0.1.1

  • Platform: macOS-14.1.2-arm64-arm-64bit

[BUG] table resize

🐛 Bug description

Resetting the cell width of a table within its range will compress other cells

[FEATURE] More elegant modified project/experimental information

🤩 Features description [Please make everyone to understand it]

  • Experiment name check: word count, format
  • Experimental information check: word count
  • Optimization for tips
  • Back-end verification

👍 What problem does this feature solve

More elegant modified project/experimental information

🚑 Any additional [like screenshots]

[BUG] Internal server error: Failed to resolve import "tippy.js/dist/tippy.css" from "vue/src/main.js". Does the file exist?

🐛 Bug description [Please make everyone to understand it]

Error: The following dependencies are imported but could not be resolved:

  tippy.js/dist/tippy.css (imported by /Users/jqs/Desktop/Projects/BlackSwanXDU/SwanLab/vue/src/main.js)

Are they installed?
    at file:///Users/jqs/Desktop/Projects/BlackSwanXDU/SwanLab/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:65148:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///Users/jqs/Desktop/Projects/BlackSwanXDU/SwanLab/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-R0I0XnyH.js:64548:38
15:50:36 [vite] Pre-transform error: Failed to resolve import "tippy.js/dist/tippy.css" from "vue/src/main.js". Does the file exist?
15:50:37 [vite] Internal server error: Failed to resolve import "tippy.js/dist/tippy.css" from "vue/src/main.js". Does the file exist?
  Plugin: vite:import-analysis
  File: /Users/jqs/Desktop/Projects/BlackSwanXDU/SwanLab/vue/src/main.js:21:9
  19 |  // v-tippy
  20 |  import { directive } from 'vue-tippy'
  21 |  import 'tippy.js/dist/tippy.css'
     |          ^
  22 |  
  23 |  app.directive('tippy', directive)

🧑‍💻 Step to reproduce

pnpm install

👾 Expected result

pnpm is the best!

🚑 Any additional [like screenshots]

  • SwanLab Version:

  • Platform:

🤩 [FEATURE] FONT类型封装

🤩 Features description [Please make everyone to understand it]

开发时会用到各种命令行高亮展示,这时会遇到一些编码格式
我们期望封装一个类,这个类支持各种字符串加工,将各种命令行样式添加到类中

👍 What problem does this feature solve

提高代码利用率

👾 What does the proposed API look like

类似如下样子:

class FONT:
    @staticmethod
    def bold(s: str) -> str:
        """在终端中加粗字符串

        Parameters
        ----------
        s : str
            需要加粗的字符串

        Returns
        -------
        str
            加粗后的字符串
        """
        # ANSI 转义码用于在终端中改变文本样式
        return f"\033[1m{s}\033[0m"

    @staticmethod
    def green(s: str) -> str:
        """在终端中将字符串着色为绿色

        Parameters
        ----------
        s : str
            需要着色的字符串

        Returns
        -------
        str
            着色后的字符串
        """
        # ANSI 转义码用于在终端中改变文本样式
        return f"\033[32m{s}\033[0m"

🚑 Any additional [like screenshots]

SwanLog类也需要使用这个类进行打印展示

🐛 [BUG] Chart update issue:update rate decrease

🐛 Bug description [Please make everyone to understand it]

Compared to v0.1.0, the data update rate of thein Progress chart in v0.1.1 seems to have decreased significantly:

  • v0.1.0: Updated once every 1s
  • v0.1.1: Updated once every 3s

👾 Expected result

Updated once every 1s

🚑 Any additional [like screenshots]

  • SwanLab Version: v0.1.1

  • Platform: macOS-14.1.2-arm64-arm-64bit

🤔 [QUESTION] Table Components Optimization

🤔 Question description

There are some optimizations can be made for the table component SLTable.vue

Part 1

These are something about the code implementation methods.

  1. Tabe cell's width resizating
  2. Our custom colors definition
  3. Size calculation in JavaScript —— mouse events while dragging resizing line

Part 2

These are something more difficult and require some effort

  1. Dynamically load table content
  2. Organizational format of table data
  3. Api that we can use

🧑‍💻 Expected result

  1. More elegant code
  2. A smoother experience

🚑 Any additional

  • SwanLab Version: v0.1.1

🐛 [BUG] When the port is occupied, `swanlab watch` does not prompt an error.

🐛 Bug description [Please make everyone to understand it]

When the port of swanlab watch is occupied, the process is terminated directly without displaying any error message.

image

🧑‍💻 Step to reproduce

Open swanlab watch on two terminals.

👾 Expected result

When detected occupation, give the user a prompt message.

🚑 Any additional [like screenshots]

  • SwanLab Version: v0.1.1

  • Platform: MacOS M1Max

暂时可以不用设置静态资源路由

image

目前,这里的 ASSETS 指的是,前端 vue 项目打包之后生成目录中,用于存放打包后的 css js 文件的目录

这个目录下的东西是加在页面时候需要的资源文件,而不是应该直接访问的静态资源,所以不应该将该目录绑定为静态资源

这个目录已经配置了单独的路由处理(其中可能需要根据资源类别加载不同的响应头)

🐛 [BUG] windows下,广播ip给的地址不准确

🐛 Bug description [Please make everyone to understand it]

在windows下设置host为0.0.0.0,显示的地址有一些是错误的

🧑‍💻 Step to reproduce

运行swanlab watch -h 0.0.0.0即可复现错误

👾 Expected result

应该只保留一些可用的ip地址

🚑 Any additional [like screenshots]

  • SwanLab Version: 0.0.2

  • Platform: windows

image

🐛 [BUG] When the training is finished, the status of Chart is not updated to `Finish`

🐛 Bug description [Please make everyone to understand it]

When the training is finished, the status of the Chart page will not become "Finish", and the final chart does not appear.

Test Code:

import swanlab
import time

swanlab.init()

for i in range(10):
    swanlab.log({'loss': i})
    time.sleep(1)

# the final chart
swanlab.log({'acc': 0.99})

训练完成时的状态:

image

👾 Expected result

  • status -> Finish
  • the final chart appear.

🚑 Any additional [like screenshots]

  • SwanLab Version:v0.1.1

🐛 [BUG] fsspec uninstall error when install swanlab using pip on pytorch env

🐛 Bug description

In a conda environment that includes PyTorch, I encountered the following error when attempting to install swanlab using pip: "torch 2.1.2 requires fsspec, which is not installed." It's worth noting that this error isn't caused by the installation of PyTorch itself. I tried installing other packages like tqdm after installing PyTorch, and there were no errors. However, this specific error only occurred after I attempted to install swanlab.

Screenshot 2023-12-23 at 17 06 52

🧑‍💻 Step to reproduce

First, create a new Conda environment in Ubuntu 22.04, specifying Python version 3.11, and install PyTorch version 2.1.2 following the official PyTorch installation tutorial.

Next, install tqdm(for test) using command: pip install tqdm. It appears that the installation was successful, and there were no error messages.

Screenshot 2023-12-23 at 17 18 59

Finally, when using the pip install swanlab command to install swanlab, an error message appeared stating "torch 2.1.2 requires fsspec, which is not installed." Additionally, the log indicated that the version of typing_extensions had been changed at some point.

The error can be fix by using the command "pip install fsspec."

🤔️Analysis

I checked the logs, and it seems that the issue may be related to the version of typing_extensions. After installing torch 2.1.2, the environment will contain typing_extensions version 4.7.1, which appears to be a dependency of torch 2.1.2. However, when installing swanlab, typing_extensions is replaced with version 4.9.0. This could potentially be the cause of the problem.

Furthermore, when I use the "pip install typing_extensions==4.7.1" command to forcefully install version 4.7.1 of typing_extensions, an error message tells me that fastapi version 0.105.0 requires typing_extensions version 4.8.0 or higher, and fastapi is a package that swanlab depends on.

Screenshot 2023-12-23 at 17 24 43

有关server部分优化的提议

  1. 引入SQLite数据库和ORM。由于涉及到项目信息的“增删查改”,将基础配置信息写入数据库然后操作会更方便一些,操作JSON文件比较麻烦而且没有关系映射。ORM库例如:PeeweeSQLAlchemyPrisma(python版本不成熟,不推荐使用)
  2. 将路由集中,将 Handler 分散。目前是将路由和 Handler 部分写在一起的,由于Handler部分的代码过多,会对排查造成影响。

[BUG] 记录的console中,logging内容与实际终端显示内容不符

Bug 描述

出现此问题的原因在于,SwanConsole通过重定向 sys.stdout 来进行日志输出的记录,而 logging 模块通常会使用 sys.stdout、sys.stderr 或者其他句柄(handler)来进行输出。
SwanConsole实例作为SwanLog初始化后的属性,在SwanLog进行数据打印到控制台的时候调用了SwanConsole实例的add方法来添加记录日志,但是我们没有考虑日志等级的问题

🐛 [BUG] `Logs` unrecorded full error

🐛 Bug description [Please make everyone to understand it]

When I get a "file not found" error, compare the IDE and logs;
the logs are missing some info:

image

image

🚑 Any additional [like screenshots]

  • SwanLab Version: v0.1.1

  • Platform: MacOS M1Max

🤩 [FEATURE] 前端日志显示

🤩 Features description [Please make everyone to understand it]

在v0.1.0版本中,我们将允许在前端查看后台日志显示
日志显示将只捕获用户通过print打印的日志以及swanlab本身产生的日志

👍 What problem does this feature solve

日志可视化,可查看当前运行状态

🚑 Any additional [like screenshots]

image

🤩 [FEATURE] 自动化SwanLab包的构建

🤩 Features description [Please make everyone to understand it]

我们需要将python包的构建、发布到pypi和github action结合,以完成更好的自动化流程

👍 What problem does this feature solve

自动化分发python包,减少重复劳动

🚑 Any additional [like screenshots]

相关细节还需做调研,后续会记录文档

🤩 [FEATURE] New Table Component

🤩 Features description [Please make everyone to understand it]

New table component to complete more complex logic

👍 What problem does this feature solve

Provide SwanLab with a richer display of information

前端tag信息读取问题

现在的tag信息请求被封装在了Plotly组件中,当后面增加了多tag放在同一个表里的时候,可能会造成信息的多次重复读取(以及数据的不同步)的问题
这块需要优化

[QUESTION] 前端日志渲染优化

🤔 Question description [Please make everyone to understand it]

目前前端是一下获取最多 max (默认6k)条数据,然后统一渲染。
可以优化一下,改成动态渲染,使用 render 函数对展示窗口的滚动监听再更新内容

Some necessary features?

  1. multi nodes and multi gpus examples
  2. system information log(GPU/CPU memory,utilization, temperature, Disk io/utilization and so on
  3. different devices log synchronize?
  4. support yaml(hydra,omegaconf)/json config

🐛 [BUG] An error occurred when using the notation "train/loss" in `swan.log`

🐛 Bug description [Please make everyone to understand it]

When the key with "/" is passed into swan.log, an error will occur, such as:

swanlab.log({"train/loss": loss.item()})

My running path is /Users/zeyilin/Desktop/Coding/examples/examples/resnet50-cats_vs_dogs
Error:

Error in sys.excepthook:
Traceback (most recent call last):
  File "/Users/zeyilin/miniforge3/envs/test_py310/lib/python3.10/site-packages/swanlab/database/__init__.py", line 40, in except_handler
    raise tp(val)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/zeyilin/Desktop/Coding/examples/examples/resnet50-cats_vs_dogs/swanlog/vibrant-hemlock-7/logs/train/loss'

Original exception was:
Traceback (most recent call last):
  File "/Users/zeyilin/Desktop/Coding/examples/examples/resnet50-cats_vs_dogs/load_datasets.py", line 102, in <module>
    swanlab.log({"train/loss": loss.item()})
  File "/Users/zeyilin/miniforge3/envs/test_py310/lib/python3.10/site-packages/swanlab/database/__init__.py", line 105, in log
    sd.add(key, data[key])
  File "/Users/zeyilin/miniforge3/envs/test_py310/lib/python3.10/site-packages/swanlab/database/main.py", line 105, in add
    self.__project.experiment.add(tag, data)
  File "/Users/zeyilin/miniforge3/envs/test_py310/lib/python3.10/site-packages/swanlab/database/expriment.py", line 105, in add
    self.save_tag(tag, data, self.experiment_id, tag_index, step=step)
  File "/Users/zeyilin/miniforge3/envs/test_py310/lib/python3.10/site-packages/swanlab/database/table.py", line 163, in save_tag
    os.mkdir(save_folder)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/zeyilin/Desktop/Coding/examples/examples/resnet50-cats_vs_dogs/swanlog/vibrant-hemlock-7/logs/train/loss'

👾 Expected result

I hope to support this writing style, and the title in the chart is “train/loss”

🚑 Any additional [like screenshots]

  • SwanLab Version: v0.1.0

  • Platform: macOS-14.1.2-arm64-arm-64bit

🐛 [BUG] windows下无法启动命令

🐛 Bug description [Please make everyone to understand it]

无法在windows操作系统下运行swanlab watch命令,报错Value Error:SO_REUSE PORT not supported on this platform

🧑‍💻 Step to reproduce

直接运行swanlab watch,就能出现此问题

👾 Expected result

Write down the results you expect

🚑 Any additional [like screenshots]

  • SwanLab Version: 0.0.2

  • Platform: windows11

img_v3_0268_06b700ac-4675-4499-8d3c-37051c98bfcg

🤩 [FEATURE] PR模板

🤩 Features description [Please make everyone to understand it]

我们将通过PR模板完成PR的准则制定

👍 What problem does this feature solve

完成PR的准则制定

🐛 [BUG] When the value passed into `swanlab.log` is a string instead of an int/float type, the chart displays abnormal.

🐛 Bug description [Please make everyone to understand it]

This Issue was discovered by @NoFish-528
When executing the following code (complete code from...this):

  log_info = {
      "Average loss": "{:.4f}".format(test_loss), 
      "Accuracy": "{}/{} ({:.0f}%".format(correct, len(test_loader.dataset),100. * correct / len(test_loader.dataset))
      }
  print(log_info)
  swanlab.log(log_info)

Value is a string rather than a numerical value, resulting in the display of the chart becoming like this:

image

👾 Expected result

Need to perform type checking and conversion on the value of Value.

🚑 Any additional [like screenshots]

  • SwanLab Version: v0.1.0

  • Platform: macOS-14.1.2-arm64-arm-64bit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.