(cls, pretrained_model_name_or_path, *args, **kwargs)
| 283 | |
| 284 | @classmethod |
| 285 | def model_pt(cls, pretrained_model_name_or_path, *args, **kwargs): |
| 286 | kwargs['cache_dir'] = cache_dir |
| 287 | if not isinstance(get_file_backend(pretrained_model_name_or_path), |
| 288 | LocalBackend): |
| 289 | kwargs['local_files_only'] = True |
| 290 | if cache_dir is not None and not isinstance( |
| 291 | get_file_backend(cache_dir), LocalBackend): |
| 292 | kwargs['local_files_only'] = True |
| 293 | |
| 294 | with patch_fileio(): |
| 295 | res = ori_model_pt.__func__(cls, pretrained_model_name_or_path, |
| 296 | *args, **kwargs) |
| 297 | return res |
| 298 | |
| 299 | PreTrainedModel.from_pretrained = model_pt |
| 300 |
nothing calls this directly
no test coverage detected