Instructions to use AIDA-UPM/star with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AIDA-UPM/star with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="AIDA-UPM/star")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("AIDA-UPM/star") model = AutoModel.from_pretrained("AIDA-UPM/star") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -16,7 +16,8 @@ examples = ['My text 1', 'This is another text']
|
|
| 16 |
def extract_embeddings(texts):
|
| 17 |
encoded_texts = tokenizer(texts)
|
| 18 |
with torch.no_grad():
|
| 19 |
-
style_embeddings = model(encoded_texts.input_ids,
|
|
|
|
| 20 |
return style_embeddings
|
| 21 |
|
| 22 |
print(extract_embeddings(examples))
|
|
|
|
| 16 |
def extract_embeddings(texts):
|
| 17 |
encoded_texts = tokenizer(texts)
|
| 18 |
with torch.no_grad():
|
| 19 |
+
style_embeddings = model(encoded_texts.input_ids,
|
| 20 |
+
attention_mask=encoded_texts.attention_mask).pooler_output
|
| 21 |
return style_embeddings
|
| 22 |
|
| 23 |
print(extract_embeddings(examples))
|