英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论