MCPcopy Create free account
hub / github.com/modelscope/modelscope / test_patch_model

Method test_patch_model

tests/utils/test_hf_util.py:117–128  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

115 self.assertIsNotNone(model)
116
117 def test_patch_model(self):
118 from modelscope.utils.hf_util.patcher import patch_context
119 with patch_context():
120 from transformers import AutoModel
121 model = AutoModel.from_pretrained('Qwen/Qwen2.5-0.5B')
122 self.assertTrue(model is not None)
123 try:
124 model = AutoModel.from_pretrained('Qwen/Qwen2.5-0.5B')
125 except Exception:
126 pass
127 else:
128 self.assertTrue(False)
129
130 def test_patch_config(self):
131 with patch_context():

Callers

nothing calls this directly

Calls 2

patch_contextFunction · 0.90
from_pretrainedMethod · 0.45

Tested by

no test coverage detected