MCPcopy Index your code
hub / github.com/modelscope/modelscope / patch_transformers_for_safe_models

Function patch_transformers_for_safe_models

tests/run.py:557–571  ·  view source on GitHub ↗

Skip check_torch_load_is_safe checking in test cases, because these cases are running officially, and does not contain malicious models.

()

Source from the content-addressed store, hash-verified

555
556
557def patch_transformers_for_safe_models():
558 """Skip check_torch_load_is_safe checking in test cases, because these cases are running officially,
559 and does not contain malicious models.
560 """
561 try:
562
563 def check_torch_load_is_safe(*args, **kwargs):
564 pass
565
566 from transformers.utils import import_utils
567 from transformers import modeling_utils
568 modeling_utils.check_torch_load_is_safe = check_torch_load_is_safe
569 import_utils.check_torch_load_is_safe = check_torch_load_is_safe
570 except AttributeError or ImportError:
571 pass
572
573
574def hot_fix_transformers():

Callers 1

run.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…