File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 1
1
# mypy: allow-untyped-defs
2
2
import collections
3
+ import logging
3
4
import warnings
4
5
from typing import Any , Union
5
6
18
19
)
19
20
from torch .fx .graph_module import _get_attr
20
21
22
+ log = logging .getLogger (__name__ )
23
+
21
24
22
25
class ConstantAttrMap (collections .abc .MutableMapping ):
23
26
"""A mapping class that understands how to use module constants (tensors,
@@ -198,7 +201,7 @@ def lift_constants_pass(
198
201
elif isinstance (constant_val , torch .Tensor ):
199
202
# Remove the parameterness of constant_val
200
203
if isinstance (constant_val , torch .nn .Parameter ):
201
- warnings . warn (
204
+ log . debug (
202
205
f"{ node .target } created when tracing { node .meta .get ('stack_trace' , '<unknown stack>' )} is a parameter. But"
203
206
f"it's not registered with register_parameter(). export will treat it as a constant tensor"
204
207
)
Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ def _unlift_inputs_as_getattr(
78
78
79
79
else :
80
80
with gm .graph .inserting_after (input_node ):
81
- getattr_node = gm .graph .get_attr (lifted_node )
81
+ with warnings .catch_warnings ():
82
+ warnings .simplefilter ("ignore" )
83
+ getattr_node = gm .graph .get_attr (lifted_node )
82
84
input_node .replace_all_uses_with (getattr_node )
83
85
metadata = input_node .meta
84
86
gm .graph .erase_node (input_node )
You can’t perform that action at this time.
0 commit comments