How to surpress Completed Stage: Warm Up and Completed Stage: Collection logs from Pytorch Profiler?

huangapple go评论92阅读模式
英文:

How to surpress Completed Stage: Warm Up and Completed Stage: Collection logs from Pytorch Profiler?

问题

当在Jupyter笔记本中运行此代码时,控制台会打印以下内容:

  1. STAGE:2023-05-10 16:41:42 3392672:3392672 ActivityProfilerController.cpp:294] Completed Stage: Warm Up
  2. STAGE:2023-05-10 16:41:42 3392672:3392672 ActivityProfilerController.cpp:300] Completed Stage: Collection

有没有方法来抑制这些警告消息?

英文:

Basically title. When running this code in a Jupyter notebook:

  1. import torch
  2. import torchvision.models as models
  3. from torch.profiler import profile, ProfilerActivity
  4. model = models.resnet18()
  5. inputs = torch.randn(5, 3, 224, 224)
  6. with profile(activities=[ProfilerActivity.CPU], record_shapes=True) as prof:
  7. model(inputs)

the console prints

  1. STAGE:2023-05-10 16:41:42 3392672:3392672 ActivityProfilerController.cpp:294] Completed Stage: Warm Up
  2. STAGE:2023-05-10 16:41:42 3392672:3392672 ActivityProfilerController.cpp:300] Completed Stage: Collection

Is there a way to suppress these warning messages?

Thanks

答案1

得分: 1

这只是最近在一个拉取请求中修复/添加的。

现在你可以设置环境变量 KINETO_LOG_LEVEL
例如,在一个bash脚本中:export KINETO_LOG_LEVEL=3

根据源代码,日志级别如下:

  1. enum LoggerOutputType {
  2. VERBOSE = 0,
  3. INFO = 1,
  4. WARNING = 2,
  5. ERROR = 3,
  6. STAGE = 4,
  7. ENUM_COUNT = 5
  8. };

至少按照这个问题的说法,日志级别的更改尚未合并。

英文:

This was just recently fixed/added in a pull request

now you can set the env variable KINETO_LOG_LEVEL.
For example in a bash script: export KINETO_LOG_LEVEL=3

The levels according to the source code are:

  1. enum LoggerOutputType {
  2. VERBOSE = 0,
  3. INFO = 1,
  4. WARNING = 2,
  5. ERROR = 3,
  6. STAGE = 4,
  7. ENUM_COUNT = 5
  8. };

Thats atleast how it should work, according to this issue the changes for the log level have not been merged yet

huangapple
  • 本文由 发表于 2023年5月11日 04:43:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76222426.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定