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