Zarakun commited on
Commit
198f241
1 Parent(s): d06b449

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +15 -2
README.md CHANGED
@@ -4,8 +4,21 @@ tags:
4
  ---
5
 
6
  ## The model for Zarakun/ukrainian_news dataset classification task
 
 
7
 
8
- Loading script:
 
9
  ```
10
- >>> <not ready>
 
 
 
 
 
 
 
 
 
 
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
  ```