Upload train_qwen3_telecom.py with huggingface_hub
Browse files- train_qwen3_telecom.py +11 -9
train_qwen3_telecom.py
CHANGED
|
@@ -13,22 +13,24 @@ raw_dataset = load_dataset('netop/TeleQnA', split='test')
|
|
| 13 |
|
| 14 |
def format_for_sft(example):
|
| 15 |
"""Convert TeleQnA format to chat messages format"""
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
question_with_options = f"""{example['question']}
|
| 24 |
|
| 25 |
Options:
|
| 26 |
-
{chr(10).join(
|
| 27 |
|
| 28 |
-
# Build the answer with explanation
|
|
|
|
| 29 |
answer_text = f"""{example['answer']}
|
| 30 |
|
| 31 |
-
Explanation: {
|
| 32 |
|
| 33 |
# Format as chat messages
|
| 34 |
return {
|
|
|
|
| 13 |
|
| 14 |
def format_for_sft(example):
|
| 15 |
"""Convert TeleQnA format to chat messages format"""
|
| 16 |
+
# Dataset columns: question, choices, answer, subject, explaination
|
| 17 |
+
|
| 18 |
+
# Build the question with choices
|
| 19 |
+
choices_text = []
|
| 20 |
+
if 'choices' in example and example['choices']:
|
| 21 |
+
for i, choice in enumerate(example['choices'], 1):
|
| 22 |
+
choices_text.append(f'{i}. {choice}')
|
| 23 |
|
| 24 |
question_with_options = f"""{example['question']}
|
| 25 |
|
| 26 |
Options:
|
| 27 |
+
{chr(10).join(choices_text)}"""
|
| 28 |
|
| 29 |
+
# Build the answer with explanation (note: misspelled as 'explaination' in dataset)
|
| 30 |
+
explanation = example.get('explaination', '') or example.get('explanation', '')
|
| 31 |
answer_text = f"""{example['answer']}
|
| 32 |
|
| 33 |
+
Explanation: {explanation}"""
|
| 34 |
|
| 35 |
# Format as chat messages
|
| 36 |
return {
|