Last active
June 16, 2020 10:16
-
-
Save AlexDel/0c6a2887bef47ec5102be528b53466e1 to your computer and use it in GitHub Desktop.
RuBERT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoModelWithLMHead, AutoTokenizer | |
tokenizer = AutoTokenizer.from_pretrained("DeepPavlov/rubert-base-cased-conversational") | |
model = AutoModelWithLMHead.from_pretrained("DeepPavlov/rubert-base-cased-conversational") | |
tokens = tokenizer.tokenize('Привет, друг!') | |
input_ids = torch.tensor(tokenizer.encode(tokens, add_special_tokens=True)).unsqueeze(0) # Batch size 1 | |
outputs = model(input_ids) | |
last_hidden_states = outputs[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment