MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / load_huggingface_state_dict

Function load_huggingface_state_dict

trinity/common/models/utils.py:413–426  ·  view source on GitHub ↗
(checkpoint_path: str, trust_remote_code: bool = False)

Source from the content-addressed store, hash-verified

411
412
413def 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
429def get_megatron_converter(checkpoint_path: str):

Callers 1

load_state_dictFunction · 0.85

Calls 1

state_dictMethod · 0.45

Tested by

no test coverage detected