Transformers documentation
Nanotron
시작하기
기본 클래스
모델
Preprocessors
추론
Pipeline API
Generate API
최적화
모델과 대화하기
서빙
학습
하드웨어
양자화
생태계 통합
리소스
API
You are viewing main version, which requires installation from source. If you'd like
regular pip install, checkout the latest stable version (v5.22.2).
Nanotron
Nanotron은 텐서, 병렬, 데이터 병렬성(3D 병렬성)을 지원하는 분산 학습 프레임워크입니다. 수백 개의 GPU에 걸친 대규모 학습 워크로드를 위해 설계되었습니다.
convert_hf_to_nanotron.py 스크립트를 사용하여 모든 Transformers 모델을 사전 학습을 위한 최적화된 Nanotron transformer 모델 구현으로 변환합니다.
torchrun --nproc_per_node=1 examples/llama/convert_hf_to_nanotron.py \
--checkpoint_path=meta-llama/Llama-2-7b-hf \
--save_path=./llama-7b-nanotronTransformers 통합
Llama와 같은 지원되는 Transformers 모델을 from_pretrained() 함수로 로드합니다. 이 함수는 체크포인트 디렉터리에서config.json파일을 읽고 LlamaConfig를 생성합니다.- Nanotron은 LlamaConfig를 자체 설정 형식으로 매핑하고 Nanotron 모델을 생성합니다.
- Transformers 가중치를 Nanotron으로 변환합니다. 가중치 매핑은 Nanotron 파라미터 이름을 Transformers 파라미터 이름으로 매핑하는 방법을 안내합니다. 여기에는 QKV 투영 및 gate/up 투영의 병합과 같은 변환 처리가 포함됩니다.
Nanotron은 전처리 및 생성 과정에서 텍스트를 토큰 ID로 변환하는 데 AutoTokenizer를 사용합니다.
리소스
- Nanotron 저장소
- Ultrascale Playbook는 Nanotron을 사용하여 학습을 효율적으로 확장하는 방법을 설명합니다