File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -3380,14 +3380,21 @@ def _kt_unflatten(
3380
3380
return KeyedTensor (context [0 ], context [1 ], values [0 ])
3381
3381
3382
3382
3383
+ print_flatten_spec_warn = True
3384
+
3385
+
3383
3386
def _kt_flatten_spec (kt : KeyedTensor , spec : TreeSpec ) -> List [torch .Tensor ]:
3384
3387
_keys , _length_per_key = spec .context
3385
3388
# please read https://fburl.com/workplace/8bei5iju for more context,
3386
3389
# you can also consider use short_circuit_pytree_ebc_regroup with KTRegroupAsDict
3387
- logger .warning (
3388
- "KT's key order might change from spec from the torch.export, this could have perf impact. "
3389
- f"{ kt .keys ()} vs { _keys } "
3390
- )
3390
+ global print_flatten_spec_warn
3391
+ if print_flatten_spec_warn :
3392
+ logger .warning (
3393
+ "KT's key order might change from spec from the torch.export, this could have perf impact. "
3394
+ f"{ kt .keys ()} vs { _keys } "
3395
+ )
3396
+ print_flatten_spec_warn = False
3397
+
3391
3398
res = permute_multi_embedding ([kt ], [_keys ])
3392
3399
return [res [0 ]]
3393
3400
You can’t perform that action at this time.
0 commit comments