Skip check_torch_load_is_safe checking in test cases, because these cases are running officially, and does not contain malicious models.
()
| 555 | |
| 556 | |
| 557 | def 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 | |
| 574 | def hot_fix_transformers(): |
no outgoing calls
no test coverage detected
searching dependent graphs…