Transformers documentation
NeMo Automodel
Bắt đầu
Lớp cơ sở
Mô hình
Bộ tiền xử lý
Suy luận
Pipeline API
Tạo API
Tối ưu hóa
Trò chuyện với các model
Serving
Huấn luyện
Phần cứng
Lượng tử hóa
Tích hợp hệ sinh thái
Tài nguyên
API
NeMo Automodel
NeMo Automodel là thư viện huấn luyện mã nguồn mở, hỗ trợ PyTorch DTensor-native từ NVIDIA. Nó hỗ trợ tiền huấn luyện và tinh chỉnh ở quy mô lớn và nhỏ cho LLMs và VLMs để thử nghiệm nhanh trong môi trường nghiên cứu và sản xuất, với các chiến lược song song bao gồm FSDP2, tensor, pipeline, expert và context parallelism. Để đạt thông lượng cao, nó tích hợp các kernel từ DeepEP và TransformerEngine.
Định nghĩa phiên huấn luyện của bạn trong một tệp cấu hình YAML (xem tệp cấu hình đầy đủ).
# 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 parametersKhởi động huấn luyện bằng torchrun bằng lệnh bên dưới.
torchrun --nproc-per-node=4 examples/llm_finetune/finetune.py -c /path/to/yaml
Tích hợp Transformers
- Bất kỳ LLM hoặc VLM nào được hỗ trợ trong Transformers cũng có thể được khởi tạo thông qua NeMo Automodel. Xem phạm vi hỗ trợ mô hình đầy đủ.
- Được xây dựng dựa trên các mô hình Hugging Face với AutoModel.from_pretrained(), cùng với khả năng thay thế lớp hiệu năng cao động và hỗ trợ các dạng song song hóa tinh vi hơn như Expert Parallelism (EP).
- Phát hiện trường architecture trong AutoConfig.from_pretrained() để tự động nạp các cài đặt tùy chỉnh như Nemotron Nano V3.
- Tuân thủ chặt chẽ API của Transformers để đảm bảo khả năng tương thích thay thế trực tiếp.
Tài nguyên
- NeMo Automodel
- NeMo Transformers API
- Các mô hình dense và Mixture-of-Expert (MoE) của NeMo Automodel cùng với các benchmark
- Xem hướng dẫn tiền huấn luyện của NeMo để tìm hiểu cách sử dụng NeMo cho tiền huấn luyện