MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / is_transformers_cache

Function is_transformers_cache

deepspeed/runtime/utils.py:1265–1272  ·  view source on GitHub ↗

Skip checks for the `transformers` cache class when performing AutoTP tensor comparisons.

(obj)

Source from the content-addressed store, hash-verified

1263
1264
1265def is_transformers_cache(obj):
1266 """Skip checks for the `transformers` cache class when performing AutoTP tensor comparisons."""
1267 try:
1268 from transformers.cache_utils import Cache
1269 except ImportError:
1270 return False
1271
1272 return isinstance(obj, Cache)
1273
1274
1275def compare_tensors_in_structures(inputs1: Union[List, Dict], inputs2: Union[List, Dict]) -> bool:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected