Text Generation
Transformers
Burmese
English
myanmar
burmese
llm
chat
instruction-following
conversational
autoregressive
Instructions to use amkyawdev/myanmar-ghost with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amkyawdev/myanmar-ghost with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amkyawdev/myanmar-ghost") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("amkyawdev/myanmar-ghost", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use amkyawdev/myanmar-ghost with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amkyawdev/myanmar-ghost" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amkyawdev/myanmar-ghost", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amkyawdev/myanmar-ghost
- SGLang
How to use amkyawdev/myanmar-ghost with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "amkyawdev/myanmar-ghost" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amkyawdev/myanmar-ghost", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "amkyawdev/myanmar-ghost" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amkyawdev/myanmar-ghost", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amkyawdev/myanmar-ghost with Docker Model Runner:
docker model run hf.co/amkyawdev/myanmar-ghost
Add tests
Browse files- test_audio_processor.py +69 -0
- test_verifier.py +91 -0
test_audio_processor.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Test audio processor module."""
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
from src.data_processing.audio_processor import AudioProcessor
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_audio_processor_init():
|
| 13 |
+
"""Test AudioProcessor initialization."""
|
| 14 |
+
processor = AudioProcessor(sample_rate=16000)
|
| 15 |
+
assert processor.sample_rate == 16000
|
| 16 |
+
print("β AudioProcessor init test passed")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def test_normalize_audio():
|
| 20 |
+
"""Test audio normalization."""
|
| 21 |
+
processor = AudioProcessor()
|
| 22 |
+
|
| 23 |
+
audio = np.array([0.5, -0.5, 1.0, -1.0])
|
| 24 |
+
normalized = processor.normalize_audio(audio)
|
| 25 |
+
|
| 26 |
+
assert np.abs(normalized).max() <= 1.0
|
| 27 |
+
print("β Normalize audio test passed")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_remove_silence():
|
| 31 |
+
"""Test silence removal."""
|
| 32 |
+
processor = AudioProcessor()
|
| 33 |
+
|
| 34 |
+
# Create audio with silence
|
| 35 |
+
audio = np.concatenate([
|
| 36 |
+
np.zeros(1000), # silence
|
| 37 |
+
np.random.randn(5000), # speech
|
| 38 |
+
np.zeros(500), # silence
|
| 39 |
+
])
|
| 40 |
+
|
| 41 |
+
cleaned = processor.remove_silence(audio, threshold_db=40)
|
| 42 |
+
|
| 43 |
+
assert len(cleaned) < len(audio)
|
| 44 |
+
print("β Remove silence test passed")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def test_prosody_extraction():
|
| 48 |
+
"""Test prosody feature extraction."""
|
| 49 |
+
processor = AudioProcessor()
|
| 50 |
+
|
| 51 |
+
# Generate synthetic audio
|
| 52 |
+
duration = 1.0
|
| 53 |
+
sample_rate = 16000
|
| 54 |
+
t = np.linspace(0, duration, int(sample_rate * duration))
|
| 55 |
+
audio = np.sin(2 * np.pi * 200 * t) * 0.5 # 200Hz tone
|
| 56 |
+
|
| 57 |
+
prosody = processor.extract_prosody_features(audio)
|
| 58 |
+
|
| 59 |
+
assert "mean_pitch" in prosody
|
| 60 |
+
assert "mean_energy" in prosody
|
| 61 |
+
print("β Prosody extraction test passed")
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if __name__ == "__main__":
|
| 65 |
+
test_audio_processor_init()
|
| 66 |
+
test_normalize_audio()
|
| 67 |
+
test_remove_silence()
|
| 68 |
+
test_prosody_extraction()
|
| 69 |
+
print("\nβ
All audio processor tests passed!")
|
test_verifier.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Test verification module."""
|
| 2 |
+
|
| 3 |
+
import sys
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
| 7 |
+
|
| 8 |
+
from src.annotation.automatic_verifier import (
|
| 9 |
+
AutomaticVerifier,
|
| 10 |
+
TextLengthRule,
|
| 11 |
+
SentimentConsistencyRule,
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_verifier_init():
|
| 16 |
+
"""Test verifier initialization."""
|
| 17 |
+
verifier = AutomaticVerifier()
|
| 18 |
+
assert len(verifier.rules) > 0
|
| 19 |
+
print("β Verifier init test passed")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_text_length_rule():
|
| 23 |
+
"""Test text length verification rule."""
|
| 24 |
+
rule = TextLengthRule(min_length=5, max_length=100)
|
| 25 |
+
|
| 26 |
+
# Test too short
|
| 27 |
+
passed, msg = rule.verify({"text": "Hi"})
|
| 28 |
+
assert not passed
|
| 29 |
+
|
| 30 |
+
# Test valid
|
| 31 |
+
passed, msg = rule.verify({"text": "Valid length text"})
|
| 32 |
+
assert passed
|
| 33 |
+
|
| 34 |
+
print("β Text length rule test passed")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_sentiment_consistency():
|
| 38 |
+
"""Test sentiment consistency rule."""
|
| 39 |
+
rule = SentimentConsistencyRule()
|
| 40 |
+
|
| 41 |
+
# Positive text with positive label
|
| 42 |
+
passed, msg = rule.verify({
|
| 43 |
+
"text": "αα»α±αΈαα°αΈαα«",
|
| 44 |
+
"sentiment": "positive",
|
| 45 |
+
})
|
| 46 |
+
assert passed
|
| 47 |
+
|
| 48 |
+
print("β Sentiment consistency rule test passed")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def test_dataset_verification():
|
| 52 |
+
"""Test full dataset verification."""
|
| 53 |
+
verifier = AutomaticVerifier()
|
| 54 |
+
|
| 55 |
+
samples = [
|
| 56 |
+
{"id": "utt_001", "text": "αα»α±αΈαα°αΈαα«", "sentiment": "positive"},
|
| 57 |
+
{"id": "utt_002", "text": "ααα»α±αααΊ", "sentiment": "negative"},
|
| 58 |
+
]
|
| 59 |
+
|
| 60 |
+
results = verifier.verify_dataset(samples)
|
| 61 |
+
|
| 62 |
+
assert results["total_samples"] == 2
|
| 63 |
+
assert "statistics" in results
|
| 64 |
+
|
| 65 |
+
print("β Dataset verification test passed")
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def test_sample_filtering():
|
| 69 |
+
"""Test sample filtering based on verification."""
|
| 70 |
+
verifier = AutomaticVerifier()
|
| 71 |
+
|
| 72 |
+
samples = [
|
| 73 |
+
{"id": "utt_001", "text": "αα»α±αΈαα°αΈαα«", "sentiment": "positive"},
|
| 74 |
+
{"id": "utt_002", "text": "", "sentiment": "negative"}, # Invalid
|
| 75 |
+
]
|
| 76 |
+
|
| 77 |
+
kept, removed = verifier.filter_samples(samples)
|
| 78 |
+
|
| 79 |
+
assert len(kept) == 1
|
| 80 |
+
assert len(removed) == 1
|
| 81 |
+
|
| 82 |
+
print("β Sample filtering test passed")
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
if __name__ == "__main__":
|
| 86 |
+
test_verifier_init()
|
| 87 |
+
test_text_length_rule()
|
| 88 |
+
test_sentiment_consistency()
|
| 89 |
+
test_dataset_verification()
|
| 90 |
+
test_sample_filtering()
|
| 91 |
+
print("\nβ
All verifier tests passed!")
|