HuggingFace OSError: You are trying to access a gated repo.Make sure to request access at 에러

2024. 1. 24. 17:30 · Python 및 Torch 코딩 이모저모
huggingface-cli login​
Exception has occurred: OSError
You are trying to access a gated repo.
Make sure to request access at https://huggingface.co/LDCC/LDCC-Instruct-Llama-2-ko-13B-v1.4 and pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`.
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/LDCC/LDCC-Instruct-Llama-2-ko-13B-v1.4/resolve/main/tokenizer_config.json

The above exception was the direct cause of the following exception:

huggingface_hub.utils._errors.GatedRepoError: 401 Client Error. (Request ID: Root=1-65b0c2a4-2b36563c34034f1f35a70571;1e2fe910-5469-46b9-b027-fc09b3641ef8)

Cannot access gated repo for url https://huggingface.co/LDCC/LDCC-Instruct-Llama-2-ko-13B-v1.4/resolve/main/tokenizer_config.json.
Repo model LDCC/LDCC-Instruct-Llama-2-ko-13B-v1.4 is gated. You must be authenticated to access it.

The above exception was the direct cause of the following exception:
.
.
.

OSError: You are trying to access a gated repo.
Make sure to request access at https://huggingface.co/LDCC/LDCC-Instruct-Llama-2-ko-13B-v1.4 and pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`.

 

위와 같은 에러는 LLM 모델을 다운받을 때 huggingface 나 meta 등의 만든 회사 측의 승인이 필요한데 내가 승인이 안되어있거나 승인은 받았지만 huggingface 로그인이 터미널 상에서 안되어있을때 나타나는 에러이다.

 

이럴 때에는

모델마다 승인을 받는 방식이 다른데, 보통은 허깅페이스 해당 모델 사이트에서 클릭만 하면 grant 를 얻을 수 있다.

 

LDCC 모델 승인

 

이렇게 승인을 받은 후

 

HuggingFace 공식 사이트에 로그인 후 프로필 사진의 메뉴에서 Settings > Access Tokens 에 들어가면 자신의 token 을 복사할 수 있다. hf_~ 꼴이다.

이후 돌리려고 하는 python 파일에 아래와 같이 기재해주면 된다!

 

from huggingface_hub import login

login("hf_XXXXXXXXXXX")

 

https://discuss.huggingface.co/t/your-request-to-access-this-repo-has-been-successfully-submitted-and-is-pending-a-review-from-the-repos-authors/57698

 

Your request to access this repo has been successfully submitted, and is pending a review from the repo's authors

Hi, I have a Pro account of Hugging Face. But when I try to call the HuggingFace Model API, I get this error :- OSError: You are trying to access a gated repo. Make sure to request access at meta-llama/Llama-2-70b-chat-hf · Hugging Face and pass a token h

discuss.huggingface.co

 

혹은 git 에 올려야해서 token 노출이 싫다면

 

huggingface-cli login

 

터미널 창에 위처럼 치면 

 

_|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|
_|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|
_|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|
_|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|
_|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|

To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Token:
Add token as git credential? (Y/n)
Token is valid (permission: write).
Your token has been saved in your configured git credential helpers (store).
Your token has been saved to /home/wauplin/.cache/huggingface/token
Login successful

 

위와 같이 hf token 을 칠 수 있는 창이 나온다. 이렇게 할 수 도 있다..!

'Python 및 Torch 코딩 이모저모' 카테고리의 다른 글

Pdb 디버깅  (0) 2024.03.09
HuggingFace Trainer 학습이 중간에 끊겼을 때  (0) 2024.02.25
Parallelism  (0) 2023.11.07
리눅스에 파이썬 새로운 버전 설치하기!  (0) 2023.10.25
HuggingFace 실습(PEFT) : 2. Train  (0) 2023.10.17
'Python 및 Torch 코딩 이모저모' 카테고리의 다른 글
  • Pdb 디버깅
  • HuggingFace Trainer 학습이 중간에 끊겼을 때
  • Parallelism
  • 리눅스에 파이썬 새로운 버전 설치하기!
섬섬옥수수
섬섬옥수수
컴공 AI 개발자가 되기 위한 노역입니다
섬섬옥수수
아날로그 인간의 컴공 되기
섬섬옥수수
전체
오늘
어제
  • 분류 전체보기
    • 백준 단계별 코딩 테스트
    • KB 논문 정리
    • Memory network 논문 정리
    • LLM 관련 논문 정리
    • Python 및 Torch 코딩 이모저모
    • Clustering 관련 논문 정리
    • 머신러닝 이모저모
    • 암호학

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • vocabulary expansion
  • 하드웨어
  • efficient and effective vocabulary expansion towards multilingual large language models
  • 코딩테스트
  • 소프트웨어
  • 인공지능융합기반시스템개론
  • dependency tree
  • constituency tree
  • CUDA
  • PEFT
  • 문제풀이
  • e5-v
  • ragas
  • GIT
  • 심재형
  • eeve
  • 백준
  • 티스토리챌린지
  • 오블완
  • 이화여대

최근 댓글

최근 글

hELLO · Designed By 정상우.v4.2.0
섬섬옥수수
HuggingFace OSError: You are trying to access a gated repo.Make sure to request access at 에러
상단으로

티스토리툴바

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.