Lightning-AI/pytorch-lightning

When test, the printed log does not show the full text of the metrics, when named in Chinese

Open

#14,837 建立於 2022年9月22日

在 GitHub 查看
 (3 留言) (0 反應) (1 負責人)Python (3,233 fork)batch import
bughelp wantedloopstrainer: test

倉庫指標

Star
 (26,687 star)
PR 合併指標
 (平均合併 9天 15小時) (30 天內合併 3 個 PR)

描述

First check

  • I'm sure this is a bug.
  • I've added a descriptive title to this bug.
  • I've provided clear instructions on how to reproduce the bug.
  • I've added a code sample.
  • I've provided any other important info that is required.

Bug description

Hi,

I am dealing with a very messy segmentation problem, which requires me to log the per-category accuracy and iou at test time. I used self.log(category, metrics) to do this job at "on_test_epoch_end". However, the log does not show the full metrics text, and shorten rest of it to "..." instead, when the metric name is in Chinese. I know that in the file pytorch_lightning.loops.dataloader.evaluation_loop, by line 340, it setting the max_length based on the longest string. However, my longest Chinese metric is 22 words long, and I checked that "max_length" is 25, but the printed metrics still hides part of the name.

Screenshot from 2022-09-22 14-43-52

How to reproduce the bug

def on_test_epoch_end(self):
    self.log("车道线-虚减速让行线_清晰_树荫遮挡_acc", 0.0121)

Error messages and logs


# Error messages and logs here please

Important info


#- Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow): LightningModule
#- PyTorch Lightning Version (e.g., 1.5.0): 1.7.6
#- PyTorch Version (e.g., 1.10): 1.12.1
#- Python version (e.g., 3.9): 3.9
#- OS (e.g., Linux): Ubuntu 20.04 in English
#- CUDA/cuDNN version: 11.6
#- GPU models and configuration: 3060Ti
#- How you installed Lightning(`conda`, `pip`, source): pip
#- Running environment of LightningApp (e.g. local, cloud): local

More info

No response

cc @carmocca @justusschock @awaelchli

貢獻者指南