[bugfix] Shim PreTrainedModel._tp_plan to fix MOSS-TTS-Nano load crash (#4398)
Signed-off-by: akshatvishu <akshatnayak197@gmail.com>
This commit is contained in:
1 parent
679cbe226a
commit
d78a92ec54
3 files changed
+5
-3
No files matched your search
@@ -194,7 +194,11 @@ class MossTTSNanoForGeneration(nn.Module):
|
||||
tts_dtype = torch.float32
|
||||
|
||||
logger.info("Loading MOSS-TTS-Nano LM from %s (dtype=%s)", self.model_path, tts_dtype)
|
||||
from transformers import AutoModelForCausalLM
|
||||
from transformers import AutoModelForCausalLM, PreTrainedModel
|
||||
|
||||
# Shim _tp_plan to prevent TypeError in transformers when loading remote-code models
|
||||
if getattr(PreTrainedModel, "_tp_plan", None) is None:
|
||||
PreTrainedModel._tp_plan = {}
|
||||
|
||||
# Two orthogonal trust_remote_code transformers fixes:
|
||||
# - _hf_load_without_tp_warmup: tp_plan=None warmup crash (transformers 5.8.x)
|
||||
|
||||
Reference in new issue
Block a user