mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-15 16:18:10 +08:00
fix: ZeRO3 does not work with MoE models
Former-commit-id: b2844c049a88ea89f8e1812e2d2e8662b4002965
This commit is contained in:
parent
fe4d93c6db
commit
18ad259fb3
@ -96,6 +96,11 @@ def load_model_and_tokenizer(
|
||||
**config_kwargs,
|
||||
)
|
||||
|
||||
if getattr(config, "model_type", None) == "mistral" and is_deepspeed_zero3_enabled():
|
||||
from deepspeed.utils import set_z3_leaf_modules
|
||||
from transformers.models.mixtral.modeling_mixtral import MixtralSparseMoeBlock
|
||||
set_z3_leaf_modules(model, [MixtralSparseMoeBlock])
|
||||
|
||||
patch_model(model, tokenizer, model_args, is_trainable)
|
||||
register_autoclass(config, model, tokenizer)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user