mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: When config contains callables, the current configs generated cannot be run: ``` torch._dynamo.config.reorderable_logging_functions = {<built-in function print>, <function warning at 0x7f774c595630>, <function log at 0x7f774c595870>, <function error at 0x7f774c595510>, <function info at 0x7f774c595750>, <built-in function warn>, <function exception at 0x7f774c5955a0>, <function debug at 0x7f774c5957e0>, <function critical at 0x7f774c5953f0>} ``` We fix the config to generate the right string, so the config is runnable, like below ``` import logging import warnings torch._dynamo.config.reorderable_logging_functions = { warnings.warn, logging.warn, print } ``` Test Plan: ``` buck2 run 'fbcode//mode/dev-nosan' fbcode//caffe2/test:utils -- -r test_codegen_config ``` Differential Revision: D67998703 Pull Request resolved: https://github.com/pytorch/pytorch/pull/144518 Approved by: https://github.com/desertfire
12 lines
218 B
Python
12 lines
218 B
Python
import sys
|
|
from typing import Callable, Optional
|
|
|
|
from torch.utils._config_module import install_config_module
|
|
|
|
|
|
e_list = [1]
|
|
e_set = {1}
|
|
e_func: Optional[Callable] = None
|
|
|
|
install_config_module(sys.modules[__name__])
|