Hub documentation

Hugging Face에서 fastai 사용

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Hugging Face에서 fastai 사용

fastai는 PyTorch와 Python을 활용하여 텍스트, 비전, 표 데이터에서 최첨단 결과를 내는 빠르고 정확한 신경망을 학습하기 위한 고수준 구성 요소를 제공하는 오픈소스 Deep Learning 라이브러리입니다.

Hub에서 fastai 탐색

fastai 모델은 모델 페이지 왼쪽에서 필터링하여 찾을 수 있습니다.

Hub의 모든 모델에는 다음 기능이 제공됩니다:

  1. 검색 가능성을 높이는 간략한 설명과 메타데이터 태그가 포함된 자동 생성된 모델 카드
  2. Image Classification 모델을 브라우저에서 직접 실험해 볼 수 있는 인터랙티브 위젯
  3. Image Classification에 대한 추론 요청을 수행할 수 있는 Inference Providers 위젯입니다.

기존 모델 사용

huggingface_hub 라이브러리는 Hub에서 모델을 다운로드하는 유틸리티 함수를 갖춘 경량 Python 클라이언트입니다.

pip install huggingface_hub["fastai"]

라이브러리가 설치되면 from_pretrained_fastai 메서드를 사용하면 됩니다. 이 메서드는 모델을 로드할 뿐만 아니라 모델이 저장되었을 당시의 fastai 버전도 검증합니다. 이는 재현 가능성에 있어 중요합니다.

from huggingface_hub import from_pretrained_fastai

learner = from_pretrained_fastai("espejelomar/identify-my-cat")

_,_,probs = learner.predict(img)
print(f"Probability it's a cat: {100*probs[1].item():.2f}%")

# Probability it's a cat: 100.00%

특정 모델을 로드하는 방법을 확인하려면 Use in fastai를 클릭하면 로드할 수 있는 작동하는 스니펫이 제공됩니다!

모델 공유

push_to_hub_fastai 메서드를 사용하여 fastai 모델을 공유할 수 있습니다.

from huggingface_hub import push_to_hub_fastai

push_to_hub_fastai(learner=learn, repo_id="espejelomar/identify-my-cat")

추가 리소스

Update on GitHub