Hub documentation
Hugging Face에서 PEFT 사용
단일 로그인(SSO) 감사 로그 스토리지 리전 비공개 데이터셋용 Data Studio 리소스 그룹(액세스 제어) 고급 컴퓨트 옵션 고급 보안 토큰 관리 서비스 계정 발행자 분석 게이팅 그룹 컬렉션 네트워크 보안 다운로드 분석 속도 제한 블로그 글
PRO 플랜 리포지토리 레포지토리 시작하기 저장소 설정 저장 용량 제한 스토리지 백엔드(Xet) 로컬 캐시 Pull Requests & Discussions 알림 컬렉션 Webhooks GitHub Actions 노트북 다음 단계 라이선스
모델 모델 허브 모델 카드 평가 결과 리더보드 데이터 게이트된 모델 모델 업로드 모델 다운로드 통합 라이브러리
데이터셋 어댑터 AllenNLP BERTopic Asteroid Diffusers ESPnet fastai Flair Keras TF-Keras (레거시) ML-Agents mlx-image MLX OpenCLIP PaddleNLP peft RL-Baselines3-Zoo Sample Factory Sentence Transformers SetFit spaCy SpanMarker SpeechBrain Stable-Baselines3 Stanza TensorBoard timm Transformers Transformers.js Unity Sentis
모델 위젯 모델 추론 모델 다운로드 통계 모델 릴리스 체크리스트 하드웨어 로컬 앱 자주 묻는 질문 고급 주제 Datasets 개요 Dataset Cards 게이트된 데이터셋 데이터셋 업로드 데이터셋 업로드 (LLM용) 데이터셋 다운로드 스트리밍 데이터셋 통합 라이브러리 Data Studio Agent Traces 데이터셋 다운로드 통계
Spaces Spaces 개요 Spaces GPU 업그레이드 Spaces ZeroGPU Spaces Dev Mode Spaces 디스크 사용량 및 저장소 Spaces 사용자 지정 도메인 MCP 서버로 사용 가능한 Spaces Spaces를 에이전트 도구로 API 엔드포인트로 사용하는 Spaces Gradio Spaces Streamlit Spaces Static HTML Spaces Docker Spaces Space 임베드하기 Docker로 Spaces 실행 Spaces 구성 참조 HF로 로그인 버튼 주요 Spaces Spaces 변경 이력 고급 주제
Storage Buckets new 컨테이너 이미지 new Jobs Jobs 개요 빠른 시작 Pricing and Billing 작업 관리 구성 Docker 이미지 사용 모델 서빙 모델 학습 예제 및 튜토리얼 대규모 데이터셋 처리 Schedule Jobs Webhook 자동화 참고
에이전트 에이전트 개요 AI 에이전트를 위한 Hugging Face CLI Hugging Face MCP 서버 Hugging Face Agent Skills HF SDK를 사용하여 에이전트 구축하기 llama.cpp를 활용한 로컬 에이전트 에이전트 라이브러리 세션 추적 형식
기타 Hugging Face에서 PEFT 사용
🤗 Parameter-Efficient Fine-Tuning (PEFT)는 모델의 모든 매개변수를 미세 조정하지 않고 사전 학습된 언어 모델을 다양한 다운스트림 작업에 효율적으로 적응시키기 위한 라이브러리입니다.
Hub에서 PEFT 탐색
모델 페이지 왼쪽에서 필터링하여 PEFT 모델을 찾을 수 있습니다.
설치
시작하려면 PEFT 문서의 빠른 가이드를 확인해 보세요. 설치하려면 PEFT 설치 가이드를 따르세요. 또는 다음 한 줄 명령으로 pip를 통해 설치할 수도 있습니다:
$ pip install peft기존 모델 사용
모든 PEFT 모델은 Hub에서 로드할 수 있습니다. PEFT 모델을 사용하려면 아래에 표시된 것처럼 fine-tuning에 사용된 base model도 로드해야 합니다. 모든 fine-tuned 모델의 model card에는 base model이 명시되어 있습니다.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel, PeftConfig
base_model = "mistralai/Mistral-7B-v0.1"
adapter_model = "dfurman/Mistral-7B-Instruct-v0.2"
model = AutoModelForCausalLM.from_pretrained(base_model)
model = PeftModel.from_pretrained(model, adapter_model)
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = model.to("cuda")
model.eval()로드가 완료되면, 입력을 토크나이저에 전달하여 준비한 후, 일반적인 transformers 방식대로 model.generate()를 호출할 수 있습니다.
inputs = tokenizer("Tell me the recipe for chocolate chip cookie", return_tensors="pt")
with torch.no_grad():
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=10)
print(tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True)[0])다음과 같이 출력됩니다:
Tell me the recipe for chocolate chip cookie dough. 1. Preheat oven to 375 degrees F (190 degrees C). 2. In a large bowl, cream together 1/2 cup (1 stick) of butter or margarine, 1/2 cup granulated sugar, and 1/2 cup packed brown sugar. 3. Beat in 1 egg and 1 teaspoon vanilla extract. 4. Mix in 1 1/4 cups all-purpose flour. 5. Stir in 1/2 teaspoon baking soda and 1/2 teaspoon salt. 6. Fold in 3/4 cup semisweet chocolate chips. 7. Drop by
특정 PEFT 모델을 로드하려면 모델 카드에서 Use in PEFT를 클릭하면 작동하는 스니펫을 받을 수 있습니다!

