Skip to content

[QUESTION]I cannot figure out TE(transformer_engine) #1049

Description

@Guodanding

I have not installed nvidia transformer_engine. I try running some example scripts (e.g train_mixtral_8x7b_distributed.sh) but fail with the TE error:

[rank0]: Traceback (most recent call last):
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/pretrain_gpt.py", line 246, in <module>
[rank0]:     pretrain(
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/megatron/training/training.py", line 270, in pretrain
[rank0]:     model, optimizer, opt_param_scheduler = setup_model_and_optimizer(
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/megatron/training/training.py", line 581, in setup_model_and_optimizer
[rank0]:     model = get_model(model_provider_func, model_type)
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/megatron/training/training.py", line 455, in get_model
[rank0]:     model = model_provider_func(
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/pretrain_gpt.py", line 74, in model_provider
[rank0]:     transformer_layer_spec = get_gpt_layer_with_transformer_engine_spec(args.num_experts, args.moe_grouped_gemm, args.qk_layernorm)
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/megatron/core/models/gpt/gpt_layer_specs.py", line 63, in get_gpt_layer_with_transformer_engine_spec
[rank0]:     mlp = _get_mlp_module_spec(
[rank0]:   File "/share/home/wenjunyi/guokb/workspace/imple-moe/Megatron-LM/megatron/core/models/gpt/gpt_layer_specs.py", line 154, in _get_mlp_module_spec
[rank0]:     linear_fc1 = TEColumnParallelGroupedLinear
[rank0]: NameError: name 'TEColumnParallelGroupedLinear' is not defined

I have read Megatron-LM/megatron/core/models/gpt/gpt_layer_specs.py and find that HAVE_TE has been set to False:

try:
    from megatron.core.transformer.custom_layers.transformer_engine import (
        TEColumnParallelGroupedLinear,
        TEDotProductAttention,
        TELayerNormColumnParallelLinear,
        TENorm,
        TERowParallelGroupedLinear,
        TERowParallelLinear,
    )

    HAVE_TE = True
except ImportError:

    HAVE_TE = False

But it is useless because the code is judged by:
use_te = args.transformer_impl == "transformer_engine"
or
if args.transformer_impl == "transformer_engine" then
I don't know how to set args.transformer_impl and what choices can be set.
Or Megatron-LM must be run with nvidia transformer_engine?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions