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

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

Closed
Zeyi-Lin opened this issue Dec 23, 2023 · 2 comments · Fixed by #104
Closed

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

Zeyi-Lin opened this issue Dec 23, 2023 · 2 comments · Fixed by #104
Assignees
Labels
🐛 bug Something isn't working

Comments

@Zeyi-Lin
Copy link
Member

🐛 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

@Zeyi-Lin Zeyi-Lin added the 🐛 bug Something isn't working label Dec 23, 2023
@SAKURA-CAT
Copy link
Contributor

We need to do some checks on the key entered

@Zeyi-Lin
Copy link
Member Author

Possible test code:

import swanlab

swanlab.init()

for i in range(1,100):
    swanlab.log({"train/loss":i, "test/loss": i*2})

The desired result is that the grouping of the chart is based on the word before '/', and the title of the chart includes all keys.

SAKURA-CAT added a commit that referenced this issue Dec 29, 2023
@SAKURA-CAT SAKURA-CAT self-assigned this Dec 29, 2023
SAKURA-CAT added a commit that referenced this issue Dec 30, 2023
* fix #86

* fix #79

* fix #102

* fix If a duplicate step is specified, the recorded problem will be repeated.

* update Add _summary.json configuration, backward compatible
---------

Co-authored-by: Zirui Cai <1575079435@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants