Update README.md
Browse files
README.md
CHANGED
@@ -4,8 +4,21 @@ tags:
|
|
4 |
---
|
5 |
|
6 |
## The model for Zarakun/ukrainian_news dataset classification task
|
|
|
|
|
7 |
|
8 |
-
Loading
|
|
|
9 |
```
|
10 |
-
>>>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
```
|
|
|
4 |
---
|
5 |
|
6 |
## The model for Zarakun/ukrainian_news dataset classification task
|
7 |
+
This model is an instance of [XLM-RoBERTa](https://huggingface.co/FacebookAI/xlm-roberta-base)
|
8 |
+
pretrained with the head with 15 classes
|
9 |
|
10 |
+
### Loading the model
|
11 |
+
Loading script that loads the model from checkpoint <checkpoint_name>
|
12 |
```
|
13 |
+
>>> config = XLMRobertaConfig.from_pretrained("FacebookAI/xlm-roberta-base")
|
14 |
+
>>> config.num_labels = 15
|
15 |
+
>>> model_pr = XLMRobertaForSequenceClassification(config)
|
16 |
+
>>> api = hub.HfApi()
|
17 |
+
>>> api.hf_hub_download(
|
18 |
+
... repo_id="Zarakun/ukrainian_news_classification",
|
19 |
+
... repo_type="model",
|
20 |
+
... filename="checkpoints/{}".format(<checkpoint_name>),
|
21 |
+
... local_dir="./"
|
22 |
+
... )
|
23 |
+
>>> model_pr.load_state_dict(torch.load("./checkpoints/{}".format(<checkpoint_name>), map_location="cpu"))
|
24 |
```
|