thkkvui commited on
Commit
c1a07c8
1 Parent(s): 3df3d70

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -1
README.md CHANGED
@@ -20,7 +20,7 @@ should probably proofread and complete it, then remove this comment. -->
20
 
21
  # xlm-roberta-base-finetuned-JaQuAD
22
 
23
- This model is a fine-tuned version of [xlm-roberta-base](https://huggingface.co/xlm-roberta-base) on the ja_qu_ad dataset.
24
  It achieves the following results on the evaluation set:
25
  - Loss: 0.7495
26
 
@@ -33,6 +33,24 @@ More information needed
33
  ```python
34
  import torch
35
  from transformers import AutoModelForQuestionAnswering, AutoTokenizer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  ```
37
 
38
  ## Training and evaluation data
 
20
 
21
  # xlm-roberta-base-finetuned-JaQuAD
22
 
23
+ 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.
24
  It achieves the following results on the evaluation set:
25
  - Loss: 0.7495
26
 
 
33
  ```python
34
  import torch
35
  from transformers import AutoModelForQuestionAnswering, AutoTokenizer
36
+
37
+ text = "2015年9月1日、私は横浜へ車で出かけました。映画を観た後に中華街まで電車で行き、昼ご飯は重慶飯店で中華フルコースを食べました。"
38
+ questions= ["どこへ出かけた?", "電車に乗る前は何をしていた?", "重慶飯店で何を食べた?", "いつ横浜に出かけた?"]
39
+
40
+ for question in questions:
41
+
42
+ inputs = tokenizer.encode_plus(question, text, add_special_tokens=True, return_tensors="pt")
43
+
44
+ with torch.no_grad():
45
+ output = model(**inputs)
46
+
47
+ answer_start = torch.argmax(output.start_logits)
48
+ answer_end = torch.argmax(output.end_logits)
49
+
50
+ answer_tokens = inputs.input_ids[0, answer_start : answer_end + 1]
51
+ answer = tokenizer.decode(answer_tokens)
52
+
53
+ print(f"質問: {question} -> 回答: {answer}")
54
  ```
55
 
56
  ## Training and evaluation data