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.

حدد تشغيل التدريب الخاص بك في ملف إعدادات بصيغة YAML (انظر ملف الإعدادات الكامل).

# Instantiate a Nemotron V3 Nano model
model:
  _target_: nemo_automodel.NeMoAutoModelForCausalLM.from_pretrained
  pretrained_model_name_or_path: nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16

# Run SFT on HellaSwag
dataset:
  _target_: nemo_automodel.components.datasets.llm.hellaswag.HellaSwag
  path_or_dataset: rowan/hellaswag
  split: train

# Train PEFT adapters
peft:
  _target_: nemo_automodel.components._peft.lora.PeftConfig
  exclude_modules: ["*.out_proj"]  # mamba layers use custom kernels that take in the out_proj.weight directly, thus lora doesn't work here.
  dim: 8
  alpha: 32
  use_triton: True

# Use EP + FSDP2 for training
distributed:
  strategy: fsdp2
  dp_size: none
  tp_size: 1
  cp_size: 1
  ep_size: 4

# ... other parameters

ابدأ التدريب باستخدام torchrun عبر الأمر أدناه.

torchrun --nproc-per-node=4 examples/llm_finetune/finetune.py -c /path/to/yaml

تكامل 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