Ошибка ОС: мета-лама/Llama-2-7b-chat-hf не является локальной папкой ⇐ Python

Программы на Python
Anonymous
Ошибка ОС: мета-лама/Llama-2-7b-chat-hf не является локальной папкой

Сообщение Anonymous »

Я пытаюсь ответить на код из этого блога Hugging Face. Сначала я установил трансформеры и создал токен для входа в Hug Face Hub:

Код: Выделить всё

pip install transformers
huggingface-cli login
После этого говорят, что используется use_auth_token=True, когда вы установили токен. К сожалению, после запуска кода я получаю сообщение об ошибке:

Код: Выделить всё

from transformers import AutoTokenizer
import transformers
import torch

model = "meta-llama/Llama-2-7b-chat-hf"

tokenizer = AutoTokenizer.from_pretrained(model, use_auth_token=True)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)

sequences = pipeline(
'I liked "Breaking Bad" and "Band of Brothers". Do you have any recommendations of other shows I might like?\n',
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
Ошибка:

Код: Выделить всё

OSError: meta-llama/Llama-2-7b-chat-hf is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass `use_auth_token=True`.
Там написано, что модель не найдена, но вы можете найти ее в списке моделей по обнимающемуся лицу здесь.
Это версия пакета трансформаторов, который я использую:

Код: Выделить всё

> pip show transformers

Name: transformers
Version: 4.33.0.dev0
Summary: State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow
Home-page: https://github.com/huggingface/transformers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)
Author-email: transformers@huggingface.co
License: Apache 2.0 License
Location: /Users/quinten/opt/miniconda3/lib/python3.9/site-packages
Requires: filelock, huggingface-hub, numpy, packaging, pyyaml, regex, requests, safetensors, tokenizers, tqdm
Required-by: spacy-transformers
Кто-нибудь знает, как исправить эту ошибку?

Подробнее здесь: https://stackoverflow.com/questions/770 ... cal-folder

Вернуться в «Python»