mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
deepspeed
This commit is contained in:
parent
73c5196e97
commit
29fa4e4789
@ -35,8 +35,7 @@ def load_pretrained_model(
|
|||||||
|
|
||||||
logging.info(f"ckpt: {path}, use_deepspeed: {use_deepspeed}")
|
logging.info(f"ckpt: {path}, use_deepspeed: {use_deepspeed}")
|
||||||
|
|
||||||
if oss_bucket is None:
|
if use_deepspeed and os.path.isdir(path):
|
||||||
if use_deepspeed:
|
|
||||||
ckpt_dir = os.path.dirname(path)
|
ckpt_dir = os.path.dirname(path)
|
||||||
ckpt_name = os.path.basename(path)
|
ckpt_name = os.path.basename(path)
|
||||||
if os.path.exists(f"{ckpt_dir}/zero_to_fp32.py"):
|
if os.path.exists(f"{ckpt_dir}/zero_to_fp32.py"):
|
||||||
@ -67,9 +66,6 @@ def load_pretrained_model(
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
src_state = torch.load(path, map_location=map_location)
|
src_state = torch.load(path, map_location=map_location)
|
||||||
else:
|
|
||||||
buffer = BytesIO(oss_bucket.get_object(path).read())
|
|
||||||
src_state = torch.load(buffer, map_location=map_location)
|
|
||||||
|
|
||||||
src_state = src_state["state_dict"] if "state_dict" in src_state else src_state
|
src_state = src_state["state_dict"] if "state_dict" in src_state else src_state
|
||||||
src_state = src_state["model_state_dict"] if "model_state_dict" in src_state else src_state
|
src_state = src_state["model_state_dict"] if "model_state_dict" in src_state else src_state
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user