Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Как запустить модель с Hugging Face? #4

Open
SergShulga opened this issue Dec 13, 2021 · 1 comment
Open

Как запустить модель с Hugging Face? #4

SergShulga opened this issue Dec 13, 2021 · 1 comment

Comments

@SergShulga
Copy link

Увидел ссылку на модель, но карточка пуста, а в имплементации только инит с AutoModel. Подскажите, как запустить на предикт модель на своих данных?
Пытался так:
tokenizer = AutoTokenizer.from_pretrained("cimm-kzn/rudr-bert")
model = AutoModel.from_pretrained("cimm-kzn/rudr-bert")

example = "Мне прописали Ингверин как имуномодулятор."

nlp = pipeline("ner", model=model, tokenizer=tokenizer)
ner_results = nlp(example)
print(ner_results)

Но это не работает.
Вручную получаю выход с модели, но дальше не понимаю, что делать:
with torch.no_grad():
out = model(**tokenizer(example, return_tensors='pt').to(model.device))

@tutubalinaev
Copy link
Collaborator

In Examples (see readme), you can find a Colab notebook on how to use NER models for the detection of named entities such as drugs and adverse drug reactions. Hugging Face models are language models, so need to train on your target data additionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants