(checkpoint_path: str, trust_remote_code: bool = False)
| 411 | |
| 412 | |
| 413 | def load_huggingface_state_dict(checkpoint_path: str, trust_remote_code: bool = False): |
| 414 | import transformers |
| 415 | from verl.utils.model import get_hf_auto_model_class |
| 416 | |
| 417 | model_config = transformers.AutoConfig.from_pretrained( |
| 418 | checkpoint_path, |
| 419 | trust_remote_code=trust_remote_code, |
| 420 | ) |
| 421 | auto_model_cls = get_hf_auto_model_class(model_config) |
| 422 | model = auto_model_cls.from_pretrained( |
| 423 | checkpoint_path, |
| 424 | trust_remote_code=trust_remote_code, |
| 425 | ) |
| 426 | return model.state_dict() |
| 427 | |
| 428 | |
| 429 | def get_megatron_converter(checkpoint_path: str): |
no test coverage detected