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

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

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

问题

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

STAGE:2023-05-10 16:41:42 3392672:3392672 ActivityProfilerController.cpp:294] Completed Stage: Warm Up
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:

import torch
import torchvision.models as models
from torch.profiler import profile, ProfilerActivity

model = models.resnet18()
inputs = torch.randn(5, 3, 224, 224)

with profile(activities=[ProfilerActivity.CPU], record_shapes=True) as prof:
    model(inputs)

the console prints

STAGE:2023-05-10 16:41:42 3392672:3392672 ActivityProfilerController.cpp:294] Completed Stage: Warm Up
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

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

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

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

英文:

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:

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

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:

确定