Update README.md
Browse files
README.md
CHANGED
@@ -10,7 +10,11 @@ datasets:
|
|
10 |
|
11 |
An [adapter](https://adapterhub.ml) for the [`allenai/specter2_base`](https://huggingface.co/allenai/specter2_base) model that was trained on the [allenai/scirepeval](https://huggingface.co/datasets/allenai/scirepeval/) dataset.
|
12 |
|
13 |
-
This adapter was created for usage with the **[
|
|
|
|
|
|
|
|
|
14 |
|
15 |
**Aug 2023 Update:**
|
16 |
1. **The SPECTER2 Base and proximity adapter models have been renamed in Hugging Face based upon usage patterns as follows:**
|
@@ -38,17 +42,17 @@ Given the combination of title and abstract of a scientific paper or a short tex
|
|
38 |
|
39 |
## Usage
|
40 |
|
41 |
-
First, install `
|
42 |
|
43 |
```
|
44 |
-
pip install -U
|
45 |
```
|
46 |
-
_Note:
|
47 |
|
48 |
Now, the adapter can be loaded and activated like this:
|
49 |
|
50 |
```python
|
51 |
-
from
|
52 |
|
53 |
model = AutoAdapterModel.from_pretrained("allenai/specter2_base")
|
54 |
adapter_name = model.load_adapter("allenai/specter2_adhoc_query", source="hf", set_active=True)
|
@@ -106,13 +110,14 @@ It builds on the work done in [SciRepEval: A Multi-Format Benchmark for Scientif
|
|
106 |
*Proximity model should suffice for downstream task types not mentioned above
|
107 |
|
108 |
```python
|
109 |
-
from transformers import AutoTokenizer
|
|
|
110 |
|
111 |
# load model and tokenizer
|
112 |
tokenizer = AutoTokenizer.from_pretrained('allenai/specter2_base')
|
113 |
|
114 |
#load base model
|
115 |
-
model =
|
116 |
|
117 |
#load the adapter(s) as per the required task, provide an identifier for the adapter in load_as argument and activate it
|
118 |
model.load_adapter("allenai/specter2_adhoc_query", source="hf", load_as="specter2_adhoc_query", set_active=True)
|
|
|
10 |
|
11 |
An [adapter](https://adapterhub.ml) for the [`allenai/specter2_base`](https://huggingface.co/allenai/specter2_base) model that was trained on the [allenai/scirepeval](https://huggingface.co/datasets/allenai/scirepeval/) dataset.
|
12 |
|
13 |
+
This adapter was created for usage with the **[adapters](https://github.com/adapter-hub/adapters)** library.
|
14 |
+
|
15 |
+
**Dec 2023 Update:**
|
16 |
+
|
17 |
+
Model usage updated to be compatible with latest versions of transformers and adapters (newly released update to adapter-transformers) libraries.
|
18 |
|
19 |
**Aug 2023 Update:**
|
20 |
1. **The SPECTER2 Base and proximity adapter models have been renamed in Hugging Face based upon usage patterns as follows:**
|
|
|
42 |
|
43 |
## Usage
|
44 |
|
45 |
+
First, install `adapters`:
|
46 |
|
47 |
```
|
48 |
+
pip install -U adapters
|
49 |
```
|
50 |
+
_Note: adapters is built as an add-on to transformers that acts as a drop-in replacement with adapter support. [More](https://docs.adapterhub.ml/installation.html)_
|
51 |
|
52 |
Now, the adapter can be loaded and activated like this:
|
53 |
|
54 |
```python
|
55 |
+
from adapters import AutoAdapterModel
|
56 |
|
57 |
model = AutoAdapterModel.from_pretrained("allenai/specter2_base")
|
58 |
adapter_name = model.load_adapter("allenai/specter2_adhoc_query", source="hf", set_active=True)
|
|
|
110 |
*Proximity model should suffice for downstream task types not mentioned above
|
111 |
|
112 |
```python
|
113 |
+
from transformers import AutoTokenizer
|
114 |
+
from adapters import AutoAdapterModel
|
115 |
|
116 |
# load model and tokenizer
|
117 |
tokenizer = AutoTokenizer.from_pretrained('allenai/specter2_base')
|
118 |
|
119 |
#load base model
|
120 |
+
model = AutoAdapterModel.from_pretrained('allenai/specter2_base')
|
121 |
|
122 |
#load the adapter(s) as per the required task, provide an identifier for the adapter in load_as argument and activate it
|
123 |
model.load_adapter("allenai/specter2_adhoc_query", source="hf", load_as="specter2_adhoc_query", set_active=True)
|