[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
@@ -32,7 +32,6 @@ _OMNI_RUNNER_PARAM = (
|
||||
)
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip(reason="issue#4361"),
|
||||
pytest.mark.full_model,
|
||||
pytest.mark.tts,
|
||||
pytest.mark.parametrize("omni_runner", [_OMNI_RUNNER_PARAM], indirect=True),
|
||||
|
||||
@@ -26,7 +26,6 @@ from tests.helpers.stage_config import get_deploy_config_path
|
||||
|
||||
# ``omni`` for all tests; 001/002 also get ``full_model`` via ``TestMossTtsNanoFull`` (003 is core+advanced only, no full_model).
|
||||
pytestmark = [
|
||||
pytest.mark.skip(reason="issue#4361"),
|
||||
pytest.mark.full_model,
|
||||
pytest.mark.tts,
|
||||
]
|
||||
|
||||
@@ -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