Upload folder using huggingface_hub
Browse files- README.md +38 -31
- app.py +97 -0
- configs/dataset_config.yaml +3 -24
- configs/reasoning_prompts.yaml +3 -42
- data/brain/conversations.jsonl +3 -3
- data/brain/metadata.json +3 -10
- data/brain/reasoning_steps.jsonl +3 -3
- data/responses.jsonl +3 -0
- data/validation/validation.jsonl +3 -1
README.md
CHANGED
|
@@ -1,49 +1,56 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
```
|
| 15 |
Amkyaw-Core-L3/
|
|
|
|
| 16 |
├── data/
|
|
|
|
| 17 |
│ ├── brain/
|
| 18 |
-
│ │ ├── reasoning_steps.jsonl
|
| 19 |
-
│ │ ├── conversations.jsonl
|
| 20 |
-
│ │ └── metadata.json
|
| 21 |
-
│
|
| 22 |
-
│
|
| 23 |
-
│ └── raw_logs/
|
| 24 |
-
│ └── logs-*.jsonl # Raw logs from Gradio Space
|
| 25 |
├── scripts/
|
| 26 |
-
│
|
| 27 |
-
│ ├── validate_data.py
|
| 28 |
-
│ ├── push_to_hub.py
|
| 29 |
-
│ └── augment_reasoning.py
|
| 30 |
└── configs/
|
| 31 |
-
|
| 32 |
-
└── reasoning_prompts.yaml
|
| 33 |
```
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|
| 37 |
```python
|
| 38 |
from datasets import load_dataset
|
| 39 |
-
|
| 40 |
dataset = load_dataset("amkyawdev/Amkyaw-Core-L3")
|
| 41 |
```
|
| 42 |
|
| 43 |
## License
|
| 44 |
|
| 45 |
-
MIT License
|
| 46 |
-
|
| 47 |
-
## Citation
|
| 48 |
-
|
| 49 |
-
Please cite this dataset if used in research.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Amkyaw Core L3
|
| 3 |
+
emoji: 🧠
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 6.12.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
short_description: '3-Step Reasoning Chat System'
|
| 12 |
+
tags:
|
| 13 |
+
- chat
|
| 14 |
+
- reasoning
|
| 15 |
+
- gradio
|
| 16 |
+
- burmese
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# 🧠 Amkyaw Core L3 - ၃ ဆင့်တွေးခေါ်မှု System
|
| 20 |
+
|
| 21 |
+
This is a 3-step reasoning system that uses keyword matching to provide structured responses.
|
| 22 |
+
|
| 23 |
+
## Features
|
| 24 |
+
- Step 1: Perception (အခြေအနေ ပိုင်းခြား)
|
| 25 |
+
- Step 2: Logical Sequence (ယုတ္တိအစဉ်)
|
| 26 |
+
- Step 3: Verification & Output (အတည်ပြု + အဖြေထုတ်)
|
| 27 |
+
|
| 28 |
+
## Dataset Structure
|
| 29 |
|
| 30 |
```
|
| 31 |
Amkyaw-Core-L3/
|
| 32 |
+
├── app.py # Gradio app
|
| 33 |
├── data/
|
| 34 |
+
│ ├── responses.jsonl # Response data
|
| 35 |
│ ├── brain/
|
| 36 |
+
│ │ ├── reasoning_steps.jsonl
|
| 37 |
+
│ │ ├── conversations.jsonl
|
| 38 |
+
│ │ └── metadata.json
|
| 39 |
+
│ └── validation/
|
| 40 |
+
│ └── validation.jsonl
|
|
|
|
|
|
|
| 41 |
├── scripts/
|
| 42 |
+
│ └── *.py
|
|
|
|
|
|
|
|
|
|
| 43 |
└── configs/
|
| 44 |
+
└── *.yaml
|
|
|
|
| 45 |
```
|
| 46 |
|
| 47 |
## Usage
|
| 48 |
|
| 49 |
```python
|
| 50 |
from datasets import load_dataset
|
|
|
|
| 51 |
dataset = load_dataset("amkyawdev/Amkyaw-Core-L3")
|
| 52 |
```
|
| 53 |
|
| 54 |
## License
|
| 55 |
|
| 56 |
+
MIT License
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from difflib import SequenceMatcher
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# JSONL ဖိုင်ကို တစ်ခါဖတ်ပြီး memory ထဲထား
|
| 8 |
+
DATA_PATH = Path(__file__).parent / "data" / "responses.jsonl"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
with open(DATA_PATH, "r", encoding="utf-8") as f:
|
| 12 |
+
responses = [json.loads(line) for line in f]
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def three_step_reasoning(user_message, history):
|
| 16 |
+
"""
|
| 17 |
+
သုံးဆင့်တွေးခေါ်မှု System
|
| 18 |
+
Step 1: Perception (အခြေအနေ ပိုင်းခြား)
|
| 19 |
+
Step 2: Logical Sequence (ယုတ္တိအစဉ်)
|
| 20 |
+
Step 3: Verification & Output (အတည်ပြု + အဖြေထုတ်)
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
# ----- အဆင့် ၁: Perception (ဖမ်းယူခြင်း) -----
|
| 24 |
+
print(f"[Step 1 - Perception] User: {user_message}")
|
| 25 |
+
|
| 26 |
+
# JSONL ထဲက အကောင်းဆုံး match ကို ရှာ
|
| 27 |
+
best_match = None
|
| 28 |
+
best_score = 0
|
| 29 |
+
|
| 30 |
+
for resp in responses:
|
| 31 |
+
score = 0
|
| 32 |
+
for kw in resp["keywords"]:
|
| 33 |
+
if kw in user_message:
|
| 34 |
+
# keyword တစ်လုံးချင်းစီအတွက် အချိုးကျပုံ
|
| 35 |
+
score += SequenceMatcher(None, user_message, kw).ratio()
|
| 36 |
+
|
| 37 |
+
# စုစုပေါင်း score ကို keyword အရေအတွက်နဲ့ စား
|
| 38 |
+
if resp["keywords"]:
|
| 39 |
+
score = score / len(resp["keywords"])
|
| 40 |
+
|
| 41 |
+
if score > best_score:
|
| 42 |
+
best_score = score
|
| 43 |
+
best_match = resp
|
| 44 |
+
|
| 45 |
+
# ----- အဆင့် ၂: Logical Sequence (ယုတ္တိအစဉ်တန်း) -----
|
| 46 |
+
if best_match and best_score > 0.3: # threshold 0.3
|
| 47 |
+
print(f"[Step 2 - Logical Sequence] Matched: {best_match['keywords']} (score: {best_score:.2f})")
|
| 48 |
+
reasoning = best_match["step2"]
|
| 49 |
+
else:
|
| 50 |
+
print(f"[Step 2 - Logical Sequence] No good match found")
|
| 51 |
+
reasoning = "ကျေးဇူးပြု၍ ပိုရှင်းလင်းအောင် မေးပေးပါ။"
|
| 52 |
+
|
| 53 |
+
# ----- အဆင့် ၃: Verification & Output (အတည်ပြု + အဖြေထုတ်) -----
|
| 54 |
+
if best_match and best_score > 0.3:
|
| 55 |
+
print(f"[Step 3 - Verification] {best_match['step3']}")
|
| 56 |
+
print(f"[Step 3 - Output] {best_match['answer']}")
|
| 57 |
+
|
| 58 |
+
final_output = f"""🧠 **အဆင့် ၁ - Perception (ခံယူချက်)**
|
| 59 |
+
{best_match['step1']}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
⚙️ **အဆင့် ၂ - Logical Sequence (ယုတ္တိအစဉ်)**
|
| 63 |
+
{reasoning}
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
✅ **အဆင့် ၃ - Verification & Output (အတည်ပြုခြင်းနှင့် အဖြေ)**
|
| 67 |
+
{best_match['step3']}
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
✨ **အဖြေ:** {best_match['answer']}"""
|
| 72 |
+
else:
|
| 73 |
+
final_output = f"""🧠 **အဆင့် ၁ - Perception (ခံယူချက်)**
|
| 74 |
+
မေးခွန်းကို နားလည်ရန် ကြိုးစားနေပါတယ်။
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
⚙️ **အဆင့် ၂ - Logical Sequence (ယုတ္တိအစဉ်)**
|
| 78 |
+
{reasoning}
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
✅ **အဆင့် ၃ - Verification & Output (အတည်ပြုခြင်းနှင့် အဖြေ)**
|
| 82 |
+
ကျေးဇူးပြု၍ ထပ်မေးပေးပါ။"""
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
return final_output
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# Gradio Interface
|
| 89 |
+
demo = gr.ChatInterface(
|
| 90 |
+
fn=three_step_reasoning,
|
| 91 |
+
title="🧠 Amkyaw Core L3 - ၃ ဆင့်တွေးခေါ်မှု System",
|
| 92 |
+
description="3-Step Reasoning System with keyword matching",
|
| 93 |
+
theme=gr.themes.Soft(),
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# Launch
|
| 97 |
+
demo.launch()
|
configs/dataset_config.yaml
CHANGED
|
@@ -1,24 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
# Data configuration
|
| 6 |
-
data:
|
| 7 |
-
brain:
|
| 8 |
-
reasoning_steps: data/brain/reasoning_steps.jsonl
|
| 9 |
-
conversations: data/brain/conversations.jsonl
|
| 10 |
-
metadata: data/brain/metadata.json
|
| 11 |
-
validation:
|
| 12 |
-
path: data/validation/validation.jsonl
|
| 13 |
-
|
| 14 |
-
# Processing
|
| 15 |
-
processing:
|
| 16 |
-
num_reasoning_steps: 3
|
| 17 |
-
languages:
|
| 18 |
-
- en
|
| 19 |
-
tasks:
|
| 20 |
-
- reasoning
|
| 21 |
-
- math
|
| 22 |
-
|
| 23 |
-
# License
|
| 24 |
-
license: MIT
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d30d311ed796982363e60062c52adb741042fa5f42185188506c8e410f430f1c
|
| 3 |
+
size 469
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
configs/reasoning_prompts.yaml
CHANGED
|
@@ -1,42 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
step1:
|
| 5 |
-
name: "Problem Understanding"
|
| 6 |
-
description: "Break down and understand the problem"
|
| 7 |
-
prompt: |
|
| 8 |
-
Step 1: Understand the problem
|
| 9 |
-
- Identify what is being asked
|
| 10 |
-
- Determine the operation needed
|
| 11 |
-
- Extract relevant numbers
|
| 12 |
-
|
| 13 |
-
step2:
|
| 14 |
-
name: "Solution Derivation"
|
| 15 |
-
description: "Apply the operation to find the answer"
|
| 16 |
-
prompt: |
|
| 17 |
-
Step 2: Derive the solution
|
| 18 |
-
- Apply the operation step by step
|
| 19 |
-
- Show intermediate calculations
|
| 20 |
-
- Get the final result
|
| 21 |
-
|
| 22 |
-
step3:
|
| 23 |
-
name: "Verification"
|
| 24 |
-
description: "Verify the answer is correct"
|
| 25 |
-
prompt: |
|
| 26 |
-
Step 3: Verify
|
| 27 |
-
- Check by doing the reverse operation
|
| 28 |
-
- Confirm the answer makes sense
|
| 29 |
-
|
| 30 |
-
# Example prompts
|
| 31 |
-
examples:
|
| 32 |
-
math_add: |
|
| 33 |
-
Let me solve this step by step:
|
| 34 |
-
Step 1: Add {a} + {b}
|
| 35 |
-
Step 2: Compute the sum
|
| 36 |
-
Step 3: Verify by subtracting
|
| 37 |
-
|
| 38 |
-
math_multiply: |
|
| 39 |
-
Let me solve this step by step:
|
| 40 |
-
Step 1: Break down the problem
|
| 41 |
-
Step 2: Multiply step by step
|
| 42 |
-
Step 3: Verify by dividing
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b54cc18534c55c4fb06240a1e9f2b54ad562e6801841e8b14efda6c958ce86b
|
| 3 |
+
size 1089
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/brain/conversations.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7117aed582e7a34fb64856ef52eb3b747a64eb4b23a8a678b7eeeb5f919bf1b
|
| 3 |
+
size 566
|
data/brain/metadata.json
CHANGED
|
@@ -1,10 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
"description": "3-step reasoning training data",
|
| 5 |
-
"num_samples": 3,
|
| 6 |
-
"languages": ["en"],
|
| 7 |
-
"tasks": ["reasoning", "math"],
|
| 8 |
-
"created_date": "2026-04-14",
|
| 9 |
-
"license": "MIT"
|
| 10 |
-
}
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f75ceedf58a80e225bd3181014b52cd0370f192c69bc35bb5e53ff854f53e2d
|
| 3 |
+
size 240
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/brain/reasoning_steps.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:73e01c6d31d16d2206ba3f9092befa65dac2128910277d13bc9d657d23a3c28f
|
| 3 |
+
size 861
|
data/responses.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5ef90a3b83d746c34f77fb805738b88c482aa3e6654c04aa61d00a6431cb541
|
| 3 |
+
size 2107
|
data/validation/validation.jsonl
CHANGED
|
@@ -1 +1,3 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:70733a9aebbe45683042ba6895ea9acede5644693ce6a5aac0608bd3e507669c
|
| 3 |
+
size 269
|