Instructions to use allenai/specter2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Adapters
How to use allenai/specter2 with Adapters:
from adapters import AutoAdapterModel model = AutoAdapterModel.from_pretrained("allenai/specter_plus_plus") model.load_adapter("allenai/specter2", set_active=True) - Notebooks
- Google Colab
- Kaggle
Update README.md
#2
by timbmg - opened
README.md
CHANGED
|
@@ -127,7 +127,7 @@ papers = [{'title': 'BERT', 'abstract': 'We introduce a new language representat
|
|
| 127 |
# concatenate title and abstract
|
| 128 |
text_batch = [d['title'] + tokenizer.sep_token + (d.get('abstract') or '') for d in papers]
|
| 129 |
# preprocess the input
|
| 130 |
-
inputs =
|
| 131 |
return_tensors="pt", return_token_type_ids=False, max_length=512)
|
| 132 |
output = model(**inputs)
|
| 133 |
# take the first token in the batch as the embedding
|
|
|
|
| 127 |
# concatenate title and abstract
|
| 128 |
text_batch = [d['title'] + tokenizer.sep_token + (d.get('abstract') or '') for d in papers]
|
| 129 |
# preprocess the input
|
| 130 |
+
inputs = tokenizer(text_batch, padding=True, truncation=True,
|
| 131 |
return_tensors="pt", return_token_type_ids=False, max_length=512)
|
| 132 |
output = model(**inputs)
|
| 133 |
# take the first token in the batch as the embedding
|