Update README.md
Browse files
README.md
CHANGED
@@ -55,6 +55,26 @@ It achieves the following results on the evaluation set:
|
|
55 |
- Loss: 0.1905
|
56 |
- F1: 0.7058
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
## Model description
|
59 |
|
60 |
This classifies one or more **genre** labels in a **multi-label** setting for a given book **description**.
|
|
|
55 |
- Loss: 0.1905
|
56 |
- F1: 0.7058
|
57 |
|
58 |
+
## Usage
|
59 |
+
|
60 |
+
```python
|
61 |
+
# pip install -q transformers accelerate optimum
|
62 |
+
from transformers import pipeline
|
63 |
+
|
64 |
+
pipe = pipeline(
|
65 |
+
"text-classification",
|
66 |
+
model="BEE-spoke-data/albert-xxlarge-v2-description2genre"
|
67 |
+
)
|
68 |
+
pipe.model = pipe.model.to_bettertransformer()
|
69 |
+
|
70 |
+
description = "On the Road is a 1957 novel by American writer Jack Kerouac, based on the travels of Kerouac and his friends across the United States. It is considered a defining work of the postwar Beat and Counterculture generations, with its protagonists living life against a backdrop of jazz, poetry, and drug use." # @param {type:"string"}
|
71 |
+
|
72 |
+
result = pipe(description, return_all_scores=True)[0]
|
73 |
+
print(result)
|
74 |
+
```
|
75 |
+
|
76 |
+
> usage of BetterTransformer (via `optimum`) is optional, but recommended unless you enjoy waiting.
|
77 |
+
|
78 |
## Model description
|
79 |
|
80 |
This classifies one or more **genre** labels in a **multi-label** setting for a given book **description**.
|