Skip to content

cannot import name 'L2Norm' from 'megatron.core.transformer.torch_norm' #13520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jakubMitura14 opened this issue May 9, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jakubMitura14
Copy link

Describe the bug

When trying to use nemotron ultra in nemo i get """cannot import name 'L2Norm' from 'megatron.core.transformer.torch_norm'"""

Steps/Code to reproduce bug

from nemo.collections import llm
llm.import_ckpt(model=llm.LlamaNemotronModel(llm.Llama31NemotronUltra253BConfig())
                , source='hf://nvidia/Llama-3_1-Nemotron-Ultra-253B-v1-FP8'
                ,output_path='/dataa/temp/nemo_output')

Expected behavior

Environment overview (please complete the following information)

slurm apptainer

instaled libraries on 08.05.2025 via

    python3 -m pip install --no-cache-dir Cython flashinfer-python
    # python3 -m pip install --no-cache-dir nemo_toolkit[all]
    python3 -m pip install --no-cache-dir 'nemo_toolkit[all]@git+https://github.com/NVIDIA/NeMo.git@main'
    echo "Cloning and installing Megatron-LM..."
    git clone https://github.com/NVIDIA/Megatron-LM.git
    cd Megatron-LM
    # Install in development mode
    python3 -m pip install -e .

Additional context
Nvidia A100

@jakubMitura14 jakubMitura14 added the bug Something isn't working label May 9, 2025
@suiyoubi
Copy link
Collaborator

"""cannot import name 'L2Norm' from 'megatron.core.transformer.torch_norm'"""

This seems to be a mismatch mcore version issue
Latest mcore has this class defined here: https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/core/transformer/torch_norm.py#L54
but seems like it cannot be located in your env

@jakubMitura14
Copy link
Author

It is possible; thanks !

@suiyoubi
Copy link
Collaborator

anyways, if you just want to run llama nemotron, you don't really need this, because L2Norm is only used for llama4, you can hack your code a little bit to get rid of this import if your goal is to run llama nemotron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants