ucsahin commited on
Commit
7cf98e3
1 Parent(s): 8b5b63b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -8
README.md CHANGED
@@ -31,7 +31,7 @@ should probably proofread and complete it, then remove this comment. -->
31
 
32
  # mT5-base-turkish-qa
33
 
34
- This model is a fine-tuned version of [google/mt5-base](https://huggingface.co/google/mt5-base) on the None dataset.
35
  It achieves the following results on the evaluation set:
36
  - Loss: 0.5109
37
  - Rouge1: 79.3283
@@ -48,21 +48,41 @@ mT5-base model is trained with manually curated Turkish dataset consisting of 65
48
  The intended use of the model is extractive question answering.
49
 
50
  In order to use the inference widget, enter your input in the format:
51
- """
52
  Soru: question_text
53
  Metin: context_text
54
- """
55
 
56
  Generated response by the model:
57
- """
58
  Cevap: answer_text
59
- """
60
 
61
- ## Training and evaluation data
 
 
 
62
 
63
- More information needed
 
64
 
65
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  ### Training hyperparameters
68
 
 
31
 
32
  # mT5-base-turkish-qa
33
 
34
+ This model is a fine-tuned version of [google/mt5-base](https://huggingface.co/google/mt5-base) on the [ucsahin/TR-Extractive-QA-82K](https://huggingface.co/datasets/ucsahin/TR-Extractive-QA-82K) dataset.
35
  It achieves the following results on the evaluation set:
36
  - Loss: 0.5109
37
  - Rouge1: 79.3283
 
48
  The intended use of the model is extractive question answering.
49
 
50
  In order to use the inference widget, enter your input in the format:
51
+ ```
52
  Soru: question_text
53
  Metin: context_text
54
+ ```
55
 
56
  Generated response by the model:
57
+ ```
58
  Cevap: answer_text
59
+ ```
60
 
61
+ Use with Transformers:
62
+ ```python
63
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
64
+ from datasets import load_dataset
65
 
66
+ # Load the dataset
67
+ qa_tr_datasets = load_dataset("ucsahin/TR-Extractive-QA-82K")
68
 
69
+ # Load model and tokenizer
70
+ model_checkpoint = "ucsahin/mT5-base-turkish-qa"
71
+ tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
72
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
73
+
74
+ inference_dataset = qa_tr_datasets["test"].select(range(10))
75
+
76
+ for input in inference_dataset:
77
+ input_question = "Soru: " + input["question"]
78
+ input_context = "Metin: " + input["context"]
79
+
80
+ tokenized_inputs = tokenizer(input_question, input_context, max_length=512, truncation=True, return_tensors="pt")
81
+ outputs = model.generate(input_ids=tokenized_inputs["input_ids"], max_new_tokens=32)
82
+ output_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
83
+
84
+ print(f"Reference answer: {input['answer']}, Model Answer: {output_text}")
85
+ ```
86
 
87
  ### Training hyperparameters
88