SPECTER2 is a family of models that succeeds
SPECTER
and is capable of generating task specific embeddings for scientific tasks when paired with
adapters
.
Given the combination of title and abstract of a scientific paper or a short texual query, the model can be used to generate effective embeddings to be used in downstream applications.
To get the best performance on a downstream task type please load the associated adapter () with the base model as in the example below.
Dec 2023 Update:
Model usage updated to be compatible with latest versions of transformers and adapters (newly released update to adapter-transformers) libraries.
******Update******
This update introduces a new set of SPECTER2 models with the base transformer encoder pre-trained on an extended citation dataset containing more recent papers.
For benchmarking purposes please use the existing SPECTER2
models
w/o the
aug2023refresh
suffix.
Adapter
allenai/specter2_aug2023refresh
for
allenai/specter2_aug2023refresh_base
This adapter was created for usage with the
adapters
library.
Usage
First, install
adapters
:
pip install -U adapters
Note: adapters is built as an add-on to transformers that acts as a drop-in replacement with adapter support.
More
Now, the adapter can be loaded and activated like this:
from adapters import AutoAdapterModel
model = AutoAdapterModel.from_pretrained("allenai/specter2_aug2023refresh_base")
adapter_name = model.load_adapter("allenai/specter2_aug2023refresh", source="hf", set_active=True)
Model Details
Model Description
SPECTER2 has been trained on over 6M triplets of scientific paper citations, which are available
here
.
Post that it is trained with additionally attached task format specific adapter modules on all the
SciRepEval
training tasks.
Task Formats trained on:
Classification
Regression
Proximity
Adhoc Search
This is a retrieval specific adapter. For tasks where given a paper query, other relevant papers have to be retrieved from a corpus, use this adapter to generate the embeddings.
Encode papers to feed into linear regressors as features
*Proximity model should suffice for downstream task types not mentioned above
from transformers import AutoTokenizer
from adapters import AutoAdapterModel
# load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained('allenai/specter2_aug2023refresh_base')
#load base model
model = AutoAdapterModel.from_pretrained('allenai/specter2_aug2023refresh_base')
#load the adapter(s) as per the required task, provide an identifier for the adapter in load_as argument and activate it
model.load_adapter("allenai/specter2_aug2023refresh", source="hf", load_as="specter2_proximity", set_active=True)
papers = [{'title': 'BERT', 'abstract': 'We introduce a new language representation model called BERT'},
{'title': 'Attention is all you need', 'abstract': ' The dominant sequence transduction models are based on complex recurrent or convolutional neural networks'}]
# concatenate title and abstract
text_batch = [d['title'] + tokenizer.sep_token + (d.get('abstract') or'') for d in papers]
# preprocess the input
inputs = self.tokenizer(text_batch, padding=True, truncation=True,
return_tensors="pt", return_token_type_ids=False, max_length=512)
output = model(**inputs)
# take the first token in the batch as the embedding
embeddings = output.last_hidden_state[:, 0, :]
The base model is trained on citation links between papers and the adapters are trained on 8 large scale tasks across the four formats.
All the data is a part of SciRepEval benchmark and is available
here
.
consisting of a query paper, a positive citation and a negative which can be from the same/different field of study as the query or citation of a citation.
Adapters: Thereafter, task format specific adapters are trained on the SciRepEval training tasks, where 600K triplets are sampled from above and added to the training data as well.
We evaluate the model on
SciRepEval
, a large scale eval benchmark for scientific embedding tasks which which has [SciDocs] as a subset.
We also evaluate and establish a new SoTA on
MDCR
, a large scale citation recommendation benchmark.
@inproceedings{specter2020cohan,
title={{SPECTER: Document-level Representation Learning using Citation-informed Transformers}},
author={Arman Cohan and Sergey Feldman and Iz Beltagy and Doug Downey and Daniel S. Weld},
booktitle={ACL},
year={2020}
}
@inproceedings{Singh2022SciRepEvalAM,
title={SciRepEval: A Multi-Format Benchmark for Scientific Document Representations},
author={Amanpreet Singh and Mike D'Arcy and Arman Cohan and Doug Downey and Sergey Feldman},
booktitle={Conference on Empirical Methods in Natural Language Processing},
year={2022},
url={https://api.semanticscholar.org/CorpusID:254018137}
}
Runs of allenai specter2_aug2023refresh on huggingface.co
2.0K
Total runs
0
24-hour runs
-13
3-day runs
13
7-day runs
-2.5K
30-day runs
More Information About specter2_aug2023refresh huggingface.co Model
specter2_aug2023refresh huggingface.co
specter2_aug2023refresh huggingface.co is an AI model on huggingface.co that provides specter2_aug2023refresh's model effect (), which can be used instantly with this allenai specter2_aug2023refresh model. huggingface.co supports a free trial of the specter2_aug2023refresh model, and also provides paid use of the specter2_aug2023refresh. Support call specter2_aug2023refresh model through api, including Node.js, Python, http.
specter2_aug2023refresh huggingface.co is an online trial and call api platform, which integrates specter2_aug2023refresh's modeling effects, including api services, and provides a free online trial of specter2_aug2023refresh, you can try specter2_aug2023refresh online for free by clicking the link below.
allenai specter2_aug2023refresh online free url in huggingface.co:
specter2_aug2023refresh is an open source model from GitHub that offers a free installation service, and any user can find specter2_aug2023refresh on GitHub to install. At the same time, huggingface.co provides the effect of specter2_aug2023refresh install, users can directly use specter2_aug2023refresh installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
specter2_aug2023refresh install url in huggingface.co: