Text Generation
MLX
Safetensors
Japanese
qwen3
osaka
kansai
dialect
japanese
qlora
conversational
4-bit precision
Instructions to use TeoHug/Osaka-Swallow-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use TeoHug/Osaka-Swallow-8B with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("TeoHug/Osaka-Swallow-8B") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use TeoHug/Osaka-Swallow-8B with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TeoHug/Osaka-Swallow-8B"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "TeoHug/Osaka-Swallow-8B" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use TeoHug/Osaka-Swallow-8B with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "TeoHug/Osaka-Swallow-8B"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "TeoHug/Osaka-Swallow-8B" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TeoHug/Osaka-Swallow-8B", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use TeoHug/Osaka-Swallow-8B with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TeoHug/Osaka-Swallow-8B"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default TeoHug/Osaka-Swallow-8B
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use TeoHug/Osaka-Swallow-8B with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "TeoHug/Osaka-Swallow-8B"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "TeoHug/Osaka-Swallow-8B" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
metadata
language:
- ja
license: apache-2.0
base_model: tokyotech-llm/Qwen3-Swallow-8B-SFT-v0.2
tags:
- osaka
- kansai
- dialect
- japanese
- mlx
- qlora
- qwen3
datasets:
- kunishou/databricks-dolly-15k-ja
- shi3z/alpaca_cleaned_ja
pipeline_tag: text-generation
library_name: mlx
🏯 Osaka-Swallow-8B — 大阪弁特化LLM
関西弁、主に大阪弁での会話にフィーチャーした小型特化LLMです。 標準語で質問しても、常に大阪弁で返答してくれる気さくなアシスタントを目指しています。
開発手法: 本モデルは Claude Opus 4.6 によるvibe coding で開発されました。
モデル詳細
| 項目 | 詳細 |
|---|---|
| ベースモデル | tokyotech-llm/Qwen3-Swallow-8B-SFT-v0.2 |
| アーキテクチャ | Qwen3 8B (36層, hidden_size 4096) |
| 学習手法 | QLoRA (rank=8, scale=20.0) via mlx-lm |
| 量子化 | 4bit (MLX形式) |
| 学習データ | 1,714件の大阪弁合成データ |
| ライセンス | Apache License 2.0 |
特徴
- 🗣️ 大阪弁に特化 — 京都弁・神戸弁を明示的に除外し、大阪弁の語尾・語彙を忠実に再現
- 🎯 大阪弁純度100% — 評価20問すべてで大阪弁のみの応答を達成(標準語汚染ゼロ)
- 📝 語尾多様性10種 — やで / やねん / やな / ねん / やろ / やんか 等の自然な使い分け
- 🍎 Apple Silicon最適化 — MLXフレームワークで学習・推論
使い方
mlx-lmで推論
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler
model, tokenizer = load("TeoHug/Osaka-Swallow-8B")
sampler = make_sampler(temp=0.6, top_p=0.95, top_k=20)
messages = [
{"role": "system", "content": "あんたは大阪弁で話す気さくなアシスタントやで。どんな質問にも大阪弁で答えてな。 /no_think"},
{"role": "user", "content": "自己紹介してください"}
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
response = generate(model, tokenizer, prompt=prompt, sampler=sampler, max_tokens=512)
print(response)
推奨生成パラメータ
| パラメータ | 推奨値 |
|---|---|
| Temperature | 0.6 |
| Top-P | 0.95 |
| Top-K | 20 |
| Repetition Penalty | 1.2 |
| Max Tokens | 512 |
システムプロンプト
あんたは大阪弁で話す気さくなアシスタントやで。どんな質問にも大阪弁で答えてな。 /no_think
学習
学習データ
ベースモデル(Qwen3-Swallow-8B 4bit)自身を用いて、日本語会話データセットのassistant応答を大阪弁に変換した合成データで学習。 ITA_KANSAI_CORPUSから抽出した大阪弁パターン辞書をプロンプトに組み込むことで、変換品質を担保しています。
| パラメータ | 値 |
|---|---|
| データ件数 | train: 1,714 / valid: 214 / test: 215 |
| バッチサイズ | 2(grad-accum 4 → 実効8) |
| 学習率 | 1e-5 |
| イテレーション | 2,000 |
| 最大系列長 | 2,048 |
| LoRA rank | 8 (scale=20.0, dropout=0.0) |
| 学習可能パラメータ | 9.699M(全体の0.118%) |
| ピークメモリ | 11.3GB |
評価結果
| 指標 | ベースモデル | ファインチューン後 |
|---|---|---|
| 大阪弁純度 | 42.5% | 100% |
| 標準語汚染 | 23件/20問 | 0件 |
| 語尾多様性 | — | 10種 |
| 平均応答長 | 677字 | 94字 |
| パープレキシティ | 12.1 | 8.0 |
既知の課題
- 語尾に「だわ」(名古屋弁寄り)が出力されることがある → GitHub Issue #1
- 応答長が短め(平均94字)
ライセンス・帰属
ベースモデル
- tokyotech-llm/Qwen3-Swallow-8B-SFT-v0.2 — Apache License 2.0
ソースデータセット
| データセット | ライセンス |
|---|---|
| kunishou/databricks-dolly-15k-ja | CC BY-SA 3.0 |
| shi3z/alpaca_cleaned_ja | Apache License 2.0 |
参照コーパス
ITA_KANSAI_CORPUS
MIT License
Copyright (c) 2024 おふとんP, あみたろの声素材工房, Nacl_E
http://opensource.org/licenses/mit-license.php
リンク
- GitHub: TateoKohara/LLM_kansai
- 開発ツール: mlx-lm, Claude Opus 4.6