본문 바로가기
C.W.K.
Stream
Lesson 04 of 06 · published

모델 카드와 YAML Front-Matter

~32 min · hub, model-cards

Level 0스카우트
0 XP0/50 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

README가 사람과 도구를 잇는 API야

모델 저장소의 README.md는 보통 ---로 감싼 YAML front matter로 시작해. 꾸밈용 머리말이 아니라 도구가 읽는 메타데이터야. 이 값에 따라 추론 위젯, provider 목록, 검색 순위, 라이선스 표시, 자동 로더의 동작이 달라져.

반드시 확인할 필드

  • library_name은 어떤 라이브러리로 모델을 불러올지 선언해. 2024년 8월부터 필수이며 transformers, diffusers, mlx, peft 등을 적어.
  • pipeline_tag는 작업 종류와 추론 위젯을 정해. text-generation, automatic-speech-recognition 같은 값이 들어가.
  • license는 SPDX 식별자나 HF 전용 값을 사용해. 일부 라이선스는 동의 절차를 거친 뒤에야 내려받을 수 있어.
  • language는 ISO 639-1 언어 코드 목록이고 검색 필터에 쓰여.
  • base_modelbase_model_relation은 원본 모델과 finetune·adapter·merge·quantized 관계를 기록해.
  • tagsconversational, code, moe, 4bit 같은 자유 태그를 담아.
  • gatedtrue, auto, manual 가운데 하나로 내려받기 전 승인 방식을 정해.

문자열로 긁지 말고 파싱된 값을 써

README를 직접 요청해 YAML을 다시 파싱할 필요는 없어. model_info()가 돌려주는 객체의 .cardData에 이미 dict 형태로 들어 있어. 데이터셋과 Space도 각각 dataset_info(), space_info()에서 같은 방식으로 읽을 수 있어.

Code

실제 모델 카드 front-matter·yaml
---
language:
  - en
  - ko
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
tags:
  - llm
  - conversational
  - korean
base_model: meta-llama/Llama-3.1-8B
base_model_relation: finetune
datasets:
  - HuggingFaceH4/ultrachat_200k
gated: false
---
# My Korean Llama Fine-Tune
이 카드는 모델이 뭐 하는지, 어떻게 쓰는지 설명함.
가중치 다운로드 없이 카드 메타 읽기·python
from huggingface_hub import model_info

info = model_info("meta-llama/Llama-3.1-8B-Instruct")
print("library:", info.cardData.get("library_name"))
print("pipeline:", info.pipeline_tag)
print("license:", info.cardData.get("license"))
print("base_model:", info.cardData.get("base_model"))
print("tags:", info.tags[:8])
print("downloads:", info.downloads, "likes:", info.likes)
print("siblings (files):", [s.rfilename for s in info.siblings[:5]])

External links

Exercise

라이선스가 서로 다른 인기 모델 세 개(apache-2.0, llama3.1, gemma)를 골라. 각 모델에 model_info(...)를 호출하고 cardData dict를 파일로 저장해 나란히 비교해. 세 카드에 공통으로 채워진 필드, 일부에만 있는 필드, README 본문과 모순되는 값을 표시해.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.