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
File size: 3,681 Bytes
cfb5e7f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | """Logging utilities for Myanmar Ghost project."""
import logging
import sys
from datetime import datetime
from pathlib import Path
from typing import Optional
from loguru import logger as _logger
def setup_logger(
name: str = "myanmar_ghost",
log_dir: Optional[str] = None,
level: str = "INFO",
format: str = None,
) -> logging.Logger:
"""Set up logger with file and console output.
Args:
name: Logger name
log_dir: Directory for log files
level: Logging level
format: Custom log format
Returns:
Configured logger
"""
if format is None:
format = (
"<green>{time:YYYY-MM-DD HH:mm:ss}</green> | "
"<level>{level: <8}</level> | "
"<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | "
"<level>{message}</level>"
)
# Remove default handler
_logger.remove()
# Console output
_logger.add(
sys.stdout,
format=format,
level=level,
colorize=True,
)
# File output
if log_dir:
log_path = Path(log_dir)
log_path.mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
log_file = log_path / f"{name}_{timestamp}.log"
_logger.add(
log_file,
format=format,
level=level,
rotation="100 MB",
retention="30 days",
compression="zip",
)
return _logger
def get_logger(name: str = None) -> logging.Logger:
"""Get logger instance.
Args:
name: Logger name (optional)
Returns:
Logger instance
"""
return _logger
class TrainingLogger:
"""Logger for training metrics and progress."""
def __init__(
self,
log_dir: str = "outputs/logs",
experiment_name: str = "experiment",
):
self.log_dir = Path(log_dir)
self.log_dir.mkdir(parents=True, exist_ok=True)
self.experiment_name = experiment_name
self.metrics_history = []
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
self.log_file = self.log_dir / f"{experiment_name}_{timestamp}.log"
def log_metrics(self, metrics: dict, step: int) -> None:
"""Log metrics at a specific step."""
entry = {
"step": step,
"timestamp": datetime.now().isoformat(),
**metrics,
}
self.metrics_history.append(entry)
log_line = f"Step {step}: " + ", ".join(
f"{k}={v:.4f}" if isinstance(v, float) else f"{k}={v}"
for k, v in metrics.items()
)
_logger.info(log_line)
def log_epoch(self, epoch: int, metrics: dict) -> None:
"""Log metrics at epoch end."""
entry = {
"epoch": epoch,
"timestamp": datetime.now().isoformat(),
**metrics,
}
self.metrics_history.append(entry)
log_line = f"Epoch {epoch}: " + ", ".join(
f"{k}={v:.4f}" if isinstance(v, float) else f"{k}={v}"
for k, v in metrics.items()
)
_logger.info(log_line)
def save_history(self) -> str:
"""Save metrics history to file."""
import json
with open(self.log_file, "w", encoding="utf-8") as f:
json.dump(self.metrics_history, f, indent=2)
return str(self.log_file)
if __name__ == "__main__":
logger = setup_logger("test_logger", "outputs/logs")
logger.info("Logger initialized successfully")
|