Commit
•
3953f0d
1
Parent(s):
ec360c8
add model
Browse files- README.md +42 -0
- adapter_config.json +23 -0
- head_config.json +49 -0
- pytorch_adapter.bin +3 -0
- pytorch_model_head.bin +3 -0
README.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- bert
|
4 |
+
- adapterhub:text-classification
|
5 |
+
- adapter-transformers
|
6 |
+
---
|
7 |
+
|
8 |
+
# Adapter `davanstrien/book-genre-classification` for bert-base-cased
|
9 |
+
|
10 |
+
An [adapter](https://adapterhub.ml) for the `bert-base-cased` model that was trained on the [text-classification](https://adapterhub.ml/explore/text-classification/) dataset and includes a prediction head for classification.
|
11 |
+
|
12 |
+
This adapter was created for usage with the **[adapter-transformers](https://github.com/Adapter-Hub/adapter-transformers)** library.
|
13 |
+
|
14 |
+
## Usage
|
15 |
+
|
16 |
+
First, install `adapter-transformers`:
|
17 |
+
|
18 |
+
```
|
19 |
+
pip install -U adapter-transformers
|
20 |
+
```
|
21 |
+
_Note: adapter-transformers is a fork of transformers that acts as a drop-in replacement with adapter support. [More](https://docs.adapterhub.ml/installation.html)_
|
22 |
+
|
23 |
+
Now, the adapter can be loaded and activated like this:
|
24 |
+
|
25 |
+
```python
|
26 |
+
from transformers import AutoModelWithHeads
|
27 |
+
|
28 |
+
model = AutoModelWithHeads.from_pretrained("bert-base-cased")
|
29 |
+
adapter_name = model.load_adapter("davanstrien/book-genre-classification", source="hf", set_active=True)
|
30 |
+
```
|
31 |
+
|
32 |
+
## Architecture & Training
|
33 |
+
|
34 |
+
<!-- Add some description here -->
|
35 |
+
|
36 |
+
## Evaluation results
|
37 |
+
|
38 |
+
<!-- Add some description here -->
|
39 |
+
|
40 |
+
## Citation
|
41 |
+
|
42 |
+
<!-- Add some description here -->
|
adapter_config.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"config": {
|
3 |
+
"adapter_residual_before_ln": false,
|
4 |
+
"cross_adapter": false,
|
5 |
+
"inv_adapter": null,
|
6 |
+
"inv_adapter_reduction_factor": null,
|
7 |
+
"leave_out": [],
|
8 |
+
"ln_after": false,
|
9 |
+
"ln_before": false,
|
10 |
+
"mh_adapter": false,
|
11 |
+
"non_linearity": "relu",
|
12 |
+
"original_ln_after": true,
|
13 |
+
"original_ln_before": true,
|
14 |
+
"output_adapter": true,
|
15 |
+
"reduction_factor": 16,
|
16 |
+
"residual_before_ln": true
|
17 |
+
},
|
18 |
+
"hidden_size": 768,
|
19 |
+
"model_class": "BertModelWithHeads",
|
20 |
+
"model_name": "bert-base-cased",
|
21 |
+
"model_type": "bert",
|
22 |
+
"name": "contemporary-genre"
|
23 |
+
}
|
head_config.json
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"config": {
|
3 |
+
"activation_function": "tanh",
|
4 |
+
"bias": true,
|
5 |
+
"head_type": "classification",
|
6 |
+
"label2id": {
|
7 |
+
"Arts & Photography": 12,
|
8 |
+
"Biographies & Memoirs": 22,
|
9 |
+
"Business & Money": 20,
|
10 |
+
"Calendars": 0,
|
11 |
+
"Children's Books": 30,
|
12 |
+
"Christian Books & Bibles": 26,
|
13 |
+
"Comics & Graphic Novels": 1,
|
14 |
+
"Computers & Technology": 16,
|
15 |
+
"Cookbooks, Food & Wine": 10,
|
16 |
+
"Crafts, Hobbies & Home": 11,
|
17 |
+
"Education & Teaching": 13,
|
18 |
+
"Engineering & Transportation": 9,
|
19 |
+
"Gay & Lesbian": 8,
|
20 |
+
"Health, Fitness & Dieting": 19,
|
21 |
+
"History": 23,
|
22 |
+
"Humor & Entertainment": 6,
|
23 |
+
"Law": 21,
|
24 |
+
"Literature & Fiction": 7,
|
25 |
+
"Medical Books": 17,
|
26 |
+
"Mystery, Thriller & Suspense": 3,
|
27 |
+
"Parenting & Relationships": 14,
|
28 |
+
"Politics & Social Sciences": 24,
|
29 |
+
"Reference": 25,
|
30 |
+
"Religion & Spirituality": 27,
|
31 |
+
"Romance": 5,
|
32 |
+
"Science & Math": 18,
|
33 |
+
"Science Fiction & Fantasy": 4,
|
34 |
+
"Self-Help": 15,
|
35 |
+
"Sports & Outdoors": 28,
|
36 |
+
"Teen & Young Adult": 29,
|
37 |
+
"Test Preparation": 2,
|
38 |
+
"Travel": 31
|
39 |
+
},
|
40 |
+
"layers": 2,
|
41 |
+
"num_labels": 32,
|
42 |
+
"use_pooler": false
|
43 |
+
},
|
44 |
+
"hidden_size": 768,
|
45 |
+
"model_class": "BertModelWithHeads",
|
46 |
+
"model_name": "bert-base-cased",
|
47 |
+
"model_type": "bert",
|
48 |
+
"name": "contemporary-genre"
|
49 |
+
}
|
pytorch_adapter.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e321cbe228c13a55c155347406e2e13ddf3ee171dfb9ecc4d25ce87d86797a0e
|
3 |
+
size 3594645
|
pytorch_model_head.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eed766203c5dcb0e4b8c2377d755f76952369a74ed80003413e65a2f7bd32bb6
|
3 |
+
size 2462239
|