File size: 2,772 Bytes
8178adc
 
a7a342f
 
8178adc
 
 
a7a342f
 
3df3d70
 
 
8178adc
 
 
 
 
 
 
 
 
 
c1a07c8
8178adc
 
 
 
 
 
 
ff2dfe4
8178adc
3df3d70
 
 
c1a07c8
6dea6c1
 
 
 
c1a07c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3df3d70
8178adc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
license: mit
language:
- ja
tags:
- generated_from_trainer
- ja_qu_ad
- bert
datasets: SkelterLabsInc/JaQuAD
widget:
- text: どこへ出かけた?
  context: 2015年9月1日、私は横浜へ車で出かけました。映画を観た後に中華街まで電車で行き、昼ご飯は重慶飯店で中華フルコースを食べました。
model-index:
- name: xlm-roberta-base-finetuned-JaQuAD
  results: []
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# xlm-roberta-base-finetuned-JaQuAD

This model is a fine-tuned version of [xlm-roberta-base](https://huggingface.co/xlm-roberta-base) on the [JaQuAD](https://huggingface.co/datasets/SkelterLabsInc/JaQuAD) dataset.
It achieves the following results on the evaluation set:
- Loss: 0.7495

## Model description

More information needed

## Intended uses

```python
import torch
from transformers import AutoModelForQuestionAnswering, AutoTokenizer

model_name = "thkkvui/xlm-roberta-base-finetuned-JaQuAD"
model = (AutoModelForQuestionAnswering.from_pretrained(model_name))
tokenizer = AutoTokenizer.from_pretrained(model_name)

text = "2015年9月1日、私は横浜へ車で出かけました。映画を観た後に中華街まで電車で行き、昼ご飯は重慶飯店で中華フルコースを食べました。"
questions= ["どこへ出かけた?", "電車に乗る前は何をしていた?", "重慶飯店で何を食べた?", "いつ横浜に出かけた?"]

for question in questions:
    
    inputs = tokenizer.encode_plus(question, text, add_special_tokens=True, return_tensors="pt")
    
    with torch.no_grad():
        output = model(**inputs)

    answer_start = torch.argmax(output.start_logits)
    answer_end = torch.argmax(output.end_logits)

    answer_tokens = inputs.input_ids[0, answer_start : answer_end + 1]
    answer = tokenizer.decode(answer_tokens)

    print(f"質問: {question} -> 回答: {answer}")
```

## Training and evaluation data

More information needed

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 6e-05
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 50
- num_epochs: 2

### Training results

| Training Loss | Epoch | Step | Validation Loss |
|:-------------:|:-----:|:----:|:---------------:|
| 0.8661        | 1.0   | 1985 | 0.8036          |
| 0.5348        | 2.0   | 3970 | 0.7495          |


### Framework versions

- Transformers 4.30.2
- Pytorch 2.0.1
- Datasets 2.13.1
- Tokenizers 0.13.3