|
--- |
|
tags: |
|
- "nlp" |
|
--- |
|
|
|
## The model for Zarakun/ukrainian_news dataset classification task |
|
This model is an instance of [XLM-RoBERTa](https://huggingface.co/FacebookAI/xlm-roberta-base) |
|
pretrained with the head with 15 classes |
|
|
|
### Loading the model |
|
Loading script that loads the model from checkpoint <checkpoint_name> |
|
``` |
|
>>> config = XLMRobertaConfig.from_pretrained("FacebookAI/xlm-roberta-base") |
|
>>> config.num_labels = 15 |
|
>>> model_pr = XLMRobertaForSequenceClassification(config) |
|
>>> api = hub.HfApi() |
|
>>> api.hf_hub_download( |
|
... repo_id="Zarakun/ukrainian_news_classification", |
|
... repo_type="model", |
|
... filename="checkpoints/{}".format(<checkpoint_name>), |
|
... local_dir="./" |
|
... ) |
|
>>> model_pr.load_state_dict(torch.load("./checkpoints/{}".format(<checkpoint_name>), map_location="cpu")) |
|
``` |