Spaces:
Runtime error
Runtime error
Avik Rao
commited on
Commit
·
0acf3b9
1
Parent(s):
2193f98
Add type hinting for nlp embedding function
Browse files- nlp/nlp.py +1 -1
nlp/nlp.py
CHANGED
|
@@ -11,7 +11,7 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
| 11 |
|
| 12 |
# FUNCTIONS
|
| 13 |
# create embeddings
|
| 14 |
-
def get_embeddings(text, token_length, tokenizer, model):
|
| 15 |
tokens = tokenizer(text, max_length=token_length,
|
| 16 |
padding='max_length', truncation=True)
|
| 17 |
output = model(torch.tensor(tokens.input_ids).unsqueeze(0),
|
|
|
|
| 11 |
|
| 12 |
# FUNCTIONS
|
| 13 |
# create embeddings
|
| 14 |
+
def get_embeddings(text: str, token_length: int, tokenizer, model):
|
| 15 |
tokens = tokenizer(text, max_length=token_length,
|
| 16 |
padding='max_length', truncation=True)
|
| 17 |
output = model(torch.tensor(tokens.input_ids).unsqueeze(0),
|