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--- delimiter 로 fence 된 YAML front-matter 블록으로 시작해. 그 블록은 styling 이 아니야. machine-readable 메타데이터고 이게 결정해: 어떤 인퍼런스 위젯이 페이지에 렌더되는지, 어떤 프로바이더가 모델을 listing 하는지, 검색 인덱스가 어떻게 ranking 하는지, buy/use 위젯에 어떤 license 가 뜨는지, library_name 자동 로더가 뭘 하는지.

스킵 못 하는 필드

  • library_name — 2024 년 8월부터 필수. 어떤 로더 쓸지 알려줘. transformers, diffusers, sentence-transformers, mlx, peft, llama.cpp 등.
  • pipeline_tag — 태스크. 인퍼런스 위젯 결정. 예: text-generation, image-text-to-text, automatic-speech-recognition, feature-extraction.
  • license — SPDX identifier 또는 HF special 중 하나 (apache-2.0, mit, llama3, llama3.1, gemma). llama* license 는 다운로드를 click-through 뒤에 둬.
  • language — ISO 639-1 코드 리스트. 검색의 language facet 결정.
  • base_model, base_model_relation — 계보. relation 은 finetune | adapter | merge | quantized. Hub 가 이걸로 트리 그려줘.
  • tags — free-form facet. conversational, code, moe, 4bit 등.
  • gatedtrue | auto | manual. license 동의 또는 manual 승인 뒤에 다운로드 두기.

카드 프로그래매틱하게 읽기

README 에 curl 치지 마. model_info() 써. 파싱된 객체 돌려주는데 .cardData attribute 가 YAML 을 decode 한 dict 야. 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 를 파일에 dump. 카드 셋 나란히 비교. 어떤 필드가 셋 다 채워졌는지, 하나만 채워졌는지, README 본문과 모순되는지 체크.

Progress

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

댓글 0

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

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