Transformers documentation

NeMo Automodel

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.22.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

NeMo Automodel

NeMo Automodel هو مكتبة تدريب مفتوحة المصدر من NVIDIA، مبنية على PyTorch DTensor. يدعم التدريب المسبق والتدريب الدقيق على نطاق واسع وصغير لـ LLMs و VLMs، مما يتيح تجارب سريعة في بيئات البحث والإنتاج، مع استراتيجيات توازي تشمل FSDP2، وتوازي الموترات، وتوازي الخطوط، وتوازي الخبراء، وتوازي السياق. ولتحقيق معدل إنتاجية عالٍ، يدمج نوى من DeepEP و TransformerEngine.

# Instantiating Nemotron V3 Nano with Expert Parallelism, FSDP2, and TransformerEngine + DeepEP kernels.
import os

import torch
import torch.distributed as dist

from nemo_automodel import NeMoAutoModelForCausalLM
from nemo_automodel.recipes._dist_utils import create_distributed_setup_from_config

dist.init_process_group(backend="nccl")
torch.cuda.set_device(int(os.environ.get("LOCAL_RANK", 0)))
torch.manual_seed(1111)

dist_setup = create_distributed_setup_from_config(
    {
        "strategy": "fsdp2",
        "ep_size": 8,
    },
)
model = NeMoAutoModelForCausalLM.from_pretrained(
    "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16",
    dtype=torch.bfloat16,
    distributed_setup=dist_setup,
)
print(model)
dist.destroy_process_group()

شغّل السكربت باستخدام torchrun عبر الأمر أدناه.

torchrun --nproc-per-node=8 /path/to/script

تكامل Transformers

  • يمكن إنشاء أي نموذج LLM أو VLM مدعوم في Transformers عبر NeMo Automodel. راجع التغطية الكاملة للنماذج.
  • Built on top of Hugging Face models with AutoModel.from_pretrained(), with dynamic high-performance layer swaps and support for more refined parallelisms like Expert Parallelism (EP).
  • Detects the architecture field in AutoConfig.from_pretrained() to automatically load custom implementations like Nemotron Nano V3.
  • يتبع واجهة برمجة تطبيقات Transformers عن كثب لضمان التوافق المباشر.

الموارد

Update on GitHub