Instructions to use pfnet/plamo-3-translate-8b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use pfnet/plamo-3-translate-8b-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use pfnet/plamo-3-translate-8b-GGUF with Ollama:
ollama run hf.co/pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use pfnet/plamo-3-translate-8b-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "pfnet/plamo-3-translate-8b-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use pfnet/plamo-3-translate-8b-GGUF with Docker Model Runner:
docker model run hf.co/pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
- Lemonade
How to use pfnet/plamo-3-translate-8b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.plamo-3-translate-8b-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use pfnet/plamo-3-translate-8b-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
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:9931/v1 hermes config set model.default pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use pfnet/plamo-3-translate-8b-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf pfnet/plamo-3-translate-8b-GGUF:Q4_K_M
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:9931/v1 \ --custom-model-id "pfnet/plamo-3-translate-8b-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
|
Download README_ja.md from pfnet/plamo-3-translate-8b-GGUF: direct link, hf CLI and curl.
- Browser
- Download file 48.4 kB
-
https://huggingface.co/pfnet/plamo-3-translate-8b-GGUF/resolve/main/README_ja.md
- Command line
-
hf download hf://pfnet/plamo-3-translate-8b-GGUF/README_ja.md
-
curl -L -o README_ja.md https://huggingface.co/pfnet/plamo-3-translate-8b-GGUF/resolve/main/README_ja.md
48.4 kB
| license: "other" | |
| license_name: "plamo-community-license" | |
| license_link: "https://plamo.preferredai.jp/info/plamo-community-license-en" | |
| base_model: pfnet/plamo-3-translate-8b | |
| base_model_relation: quantized | |
| model_name: "PLaMo 3 Translate 8B GGUF" | |
| library_name: gguf | |
| language: | |
| - ar | |
| - az | |
| - be | |
| - bg | |
| - bn | |
| - ca | |
| - ceb | |
| - de | |
| - en | |
| - es | |
| - et | |
| - eu | |
| - fa | |
| - fr | |
| - gu | |
| - he | |
| - hi | |
| - hr | |
| - hu | |
| - hy | |
| - id | |
| - it | |
| - ja | |
| - jv | |
| - ka | |
| - kk | |
| - km | |
| - ko | |
| - lt | |
| - lv | |
| - ml | |
| - mr | |
| - ms | |
| - my | |
| - ne | |
| - nl | |
| - pa | |
| - pl | |
| - ru | |
| - si | |
| - sk | |
| - sl | |
| - sr | |
| - sw | |
| - ta | |
| - te | |
| - th | |
| - tl | |
| - ur | |
| - uz | |
| - vi | |
| - zh | |
| pipeline_tag: translation | |
| tags: | |
| - translation | |
| - multilingual | |
| - plamo | |
| - gguf | |
| - llama.cpp | |
| # PLaMo 3 Translate 8B GGUF | |
| PFN™ translate model | |
| [English README](README.md) | |
| PLaMo 3 Translate 8B GGUFは、[PLaMo 3 Translate 8B](https://huggingface.co/pfnet/plamo-3-translate-8b/blob/main/README_ja.md)を[llama.cpp](https://github.com/ggml-org/llama.cpp)向けにGGUF形式へ変換・量子化したモデルです。他の配布形式との比較は[配布形式の選び方](#配布形式の選び方)を参照してください。 | |
| PLaMo 3 Translate 8Bは、Preferred Networks(PFN)が開発した、世界最高クラスの翻訳特化LLMです。 | |
| PFNと国立研究開発法人情報通信研究機構(NICT)の共同研究で得られた事前学習モデル「PLaMo 3 NICT」を基盤としています。 | |
| この基盤モデルに対し、数十Bトークン規模の翻訳特化の学習を行いました。 | |
| 開発詳細については[テックブログ](https://www.preferred.jp/ja/blog/tech/plamo-3-translate-weight-release)をご参照ください。 | |
| PLaMo 3 Translate 8Bは53言語の多言語翻訳に対応しています ([対応言語](#対応言語)のセクションを参照)。 | |
| 翻訳の周辺文脈、用語集、日本語における常体・敬体のスタイル指定にも対応しています。 | |
| 学習時の最大長は、入力と出力を合わせて32,768トークンです。長い文章もまとめて翻訳できますが、さらに長い文章は、入力と出力の合計がこの範囲に収まるように分割してください。 | |
| PLaMo 3 Translate 8Bのライセンスは[PLaMo Community License](https://plamo.preferredai.jp/info/plamo-community-license-ja)です。個人での学習や趣味などの私的な用途や、学術用途を含む非商用利用では、事前の登録なしに無償で自由にご利用いただけます。商用利用の条件は[ライセンス](#ライセンス)を参照してください。 | |
| ## ベンチマーク結果 | |
| PLaMo 3 Translateは、日英翻訳と多言語翻訳の双方で世界最高クラスの性能を示します。2Bモデルの時点で、下図のすべての指標において、比較した翻訳特化LLMを上回っています。 | |
|  | |
| 上段は日英翻訳の品質で、PFTB、SaaS、WMT24++ COMET-22の平均です。中段は日本語と他の14言語、下段は英語と他の14言語との間の翻訳品質で、FLORES+ chrF++を双方向で平均したものです。いずれも高いほど良いスコアです。 | |
| FLORES+による多言語評価では、対応する53言語のうち、次の15言語を対象にしました。日本語または英語を中心に、それぞれ残りの14言語との翻訳を双方向で評価しています。 | |
| - 日本語、英語、アラビア語、インドネシア語、イタリア語、オランダ語、韓国語、スペイン語、タイ語、中国語(簡体字・繁体字)、ドイツ語、フランス語、ベトナム語、ロシア語 | |
| 詳細については[テックブログ](https://www.preferred.jp/ja/blog/tech/plamo-3-translate-weight-release)をご参照ください。 | |
| ## モデルの選び方 | |
| ### モデル一覧 | |
| PLaMo 3 Translateには、0.8B、2B、8B、31Bの4つのサイズがあります。 | |
| それぞれのサイズについて、量子化やフォーマット変換を行ったモデルを別のリポジトリに用意しています。 | |
| | サイズ | BF16 | FP8 | W4A16 | W4AFP8 | NVFP4 | GGUF | MLX | | |
| | --- | --- | --- | --- | --- | --- | --- | --- | | |
| | 0.8B | [BF16](https://huggingface.co/pfnet/plamo-3-translate-0.8b/blob/main/README_ja.md) | [FP8](https://huggingface.co/pfnet/plamo-3-translate-0.8b-FP8/blob/main/README_ja.md) | [W4A16](https://huggingface.co/pfnet/plamo-3-translate-0.8b-W4A16/blob/main/README_ja.md) | [W4AFP8](https://huggingface.co/pfnet/plamo-3-translate-0.8b-W4AFP8/blob/main/README_ja.md) | [NVFP4](https://huggingface.co/pfnet/plamo-3-translate-0.8b-NVFP4/blob/main/README_ja.md) | [GGUF](https://huggingface.co/pfnet/plamo-3-translate-0.8b-GGUF/blob/main/README_ja.md) | [MLX-4bit](https://huggingface.co/pfnet/plamo-3-translate-0.8b-MLX-4bit/blob/main/README_ja.md) | | |
| | 2B | [BF16](https://huggingface.co/pfnet/plamo-3-translate-2b/blob/main/README_ja.md) | [FP8](https://huggingface.co/pfnet/plamo-3-translate-2b-FP8/blob/main/README_ja.md) | [W4A16](https://huggingface.co/pfnet/plamo-3-translate-2b-W4A16/blob/main/README_ja.md) | [W4AFP8](https://huggingface.co/pfnet/plamo-3-translate-2b-W4AFP8/blob/main/README_ja.md) | [NVFP4](https://huggingface.co/pfnet/plamo-3-translate-2b-NVFP4/blob/main/README_ja.md) | [GGUF](https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF/blob/main/README_ja.md) | [MLX-4bit](https://huggingface.co/pfnet/plamo-3-translate-2b-MLX-4bit/blob/main/README_ja.md) | | |
| | 8B | [BF16](https://huggingface.co/pfnet/plamo-3-translate-8b/blob/main/README_ja.md) | [FP8](https://huggingface.co/pfnet/plamo-3-translate-8b-FP8/blob/main/README_ja.md) | [W4A16](https://huggingface.co/pfnet/plamo-3-translate-8b-W4A16/blob/main/README_ja.md) | [W4AFP8](https://huggingface.co/pfnet/plamo-3-translate-8b-W4AFP8/blob/main/README_ja.md) | [NVFP4](https://huggingface.co/pfnet/plamo-3-translate-8b-NVFP4/blob/main/README_ja.md) | [GGUF](https://huggingface.co/pfnet/plamo-3-translate-8b-GGUF/blob/main/README_ja.md) | [MLX-4bit](https://huggingface.co/pfnet/plamo-3-translate-8b-MLX-4bit/blob/main/README_ja.md) | | |
| | 31B | [BF16](https://huggingface.co/pfnet/plamo-3-translate-31b/blob/main/README_ja.md) | [FP8](https://huggingface.co/pfnet/plamo-3-translate-31b-FP8/blob/main/README_ja.md) | [W4A16](https://huggingface.co/pfnet/plamo-3-translate-31b-W4A16/blob/main/README_ja.md) | [W4AFP8](https://huggingface.co/pfnet/plamo-3-translate-31b-W4AFP8/blob/main/README_ja.md) | [NVFP4](https://huggingface.co/pfnet/plamo-3-translate-31b-NVFP4/blob/main/README_ja.md) | [GGUF](https://huggingface.co/pfnet/plamo-3-translate-31b-GGUF/blob/main/README_ja.md) | [MLX-4bit](https://huggingface.co/pfnet/plamo-3-translate-31b-MLX-4bit/blob/main/README_ja.md) | | |
| <details> | |
| <summary>量子化による精度変化</summary> | |
| モデルサイズごとに、BF16と各配布形式の翻訳精度を比較します。各スコアの下の括弧内は、同じサイズのBF16との差です(マイナスは精度の低下を示します)。いずれも高いほど良いスコアです。 | |
| 評価指標の詳細については[テックブログ](https://www.preferred.jp/ja/blog/tech/plamo-3-translate-weight-release)をご参照ください。 | |
| 全体として、`GGUF Q2_K`では一部の指標で翻訳精度の低下が見られますが、他の形式ではBF16に近い精度を維持しています。 | |
| 容量は重みファイルの合計です。 | |
| #### 31B | |
| | 形式 | 容量(GB) | PFTB(英↔日) | SaaS(英→日) | WMT24++ COMET-22(英→日) | FLORES+ chrF++(日本語↔多言語) | FLORES+ chrF++(英語↔多言語) | | |
| | --- | ---: | ---: | ---: | ---: | ---: | ---: | | |
| | **BF16** | 63.51 | 0.6244 | 0.5786 | 0.8799 | 37.81 | 56.61 | | |
| | FP8 | 32.31 | 0.6240<br>(-0.0004) | 0.5803<br>(+0.0017) | 0.8799<br>(0.0000) | 37.79<br>(-0.02) | 56.60<br>(-0.01) | | |
| | W4A16 | 17.19 | 0.6258<br>(+0.0014) | 0.5777<br>(-0.0009) | 0.8805<br>(+0.0006) | 37.74<br>(-0.07) | 56.49<br>(-0.12) | | |
| | W4AFP8 | 17.19 | 0.6223<br>(-0.0021) | 0.5716<br>(-0.0070) | 0.8813<br>(+0.0014) | 37.71<br>(-0.10) | 56.53<br>(-0.08) | | |
| | NVFP4 | 18.66 | 0.6258<br>(+0.0014) | 0.5748<br>(-0.0038) | 0.8809<br>(+0.0010) | 37.70<br>(-0.11) | 56.49<br>(-0.12) | | |
| | GGUF BF16 | 63.52 | 0.6241<br>(-0.0003) | 0.5793<br>(+0.0007) | 0.8799<br>(0.0000) | 37.82<br>(+0.01) | 56.59<br>(-0.02) | | |
| | GGUF Q4_K_M | 19.53 | 0.6237<br>(-0.0007) | 0.5770<br>(-0.0016) | 0.8810<br>(+0.0011) | 37.84<br>(+0.03) | 56.55<br>(-0.06) | | |
| | GGUF Q3_K_M | 15.86 | 0.6223<br>(-0.0021) | 0.5780<br>(-0.0006) | 0.8813<br>(+0.0014) | 37.78<br>(-0.03) | 56.54<br>(-0.07) | | |
| | GGUF Q2_K | 12.61 | 0.6126<br>(-0.0118) | 0.5745<br>(-0.0041) | 0.8801<br>(+0.0002) | 37.36<br>(-0.45) | 56.16<br>(-0.45) | | |
| | MLX 4bit | 18.66 | 0.6222<br>(-0.0022) | 0.5779<br>(-0.0007) | 0.8800<br>(+0.0001) | 37.82<br>(+0.01) | 56.58<br>(-0.03) | | |
| #### 8B | |
| | 形式 | 容量(GB) | PFTB(英↔日) | SaaS(英→日) | WMT24++ COMET-22(英→日) | FLORES+ chrF++(日本語↔多言語) | FLORES+ chrF++(英語↔多言語) | | |
| | --- | ---: | ---: | ---: | ---: | ---: | ---: | | |
| | **BF16** | 17.06 | 0.6119 | 0.5750 | 0.8805 | 37.45 | 56.22 | | |
| | FP8 | 9.41 | 0.6123<br>(+0.0004) | 0.5764<br>(+0.0014) | 0.8805<br>(0.0000) | 37.40<br>(-0.05) | 56.17<br>(-0.05) | | |
| | W4A16 | 5.71 | 0.6114<br>(-0.0005) | 0.5749<br>(-0.0001) | 0.8789<br>(-0.0016) | 37.36<br>(-0.09) | 56.19<br>(-0.03) | | |
| | W4AFP8 | 5.71 | 0.6174<br>(+0.0055) | 0.5759<br>(+0.0009) | 0.8794<br>(-0.0011) | 37.34<br>(-0.11) | 56.12<br>(-0.10) | | |
| | NVFP4 | 6.07 | 0.6040<br>(-0.0079) | 0.5783<br>(+0.0033) | 0.8792<br>(-0.0013) | 37.26<br>(-0.19) | 56.10<br>(-0.12) | | |
| | GGUF BF16 | 17.07 | 0.6110<br>(-0.0009) | 0.5755<br>(+0.0005) | 0.8802<br>(-0.0003) | 37.46<br>(+0.01) | 56.22<br>(0.00) | | |
| | GGUF Q4_K_M | 5.28 | 0.6100<br>(-0.0019) | 0.5765<br>(+0.0015) | 0.8802<br>(-0.0003) | 37.39<br>(-0.06) | 56.18<br>(-0.04) | | |
| | GGUF Q3_K_M | 4.31 | 0.6019<br>(-0.0100) | 0.5707<br>(-0.0043) | 0.8826<br>(+0.0021) | 37.20<br>(-0.25) | 55.93<br>(-0.29) | | |
| | GGUF Q2_K | 3.45 | 0.5989<br>(-0.0130) | 0.5676<br>(-0.0074) | 0.8791<br>(-0.0014) | 36.54<br>(-0.91) | 55.31<br>(-0.91) | | |
| | MLX 4bit | 6.07 | 0.6102<br>(-0.0017) | 0.5751<br>(+0.0001) | 0.8796<br>(-0.0009) | 37.41<br>(-0.04) | 56.19<br>(-0.03) | | |
| #### 2B | |
| | 形式 | 容量(GB) | PFTB(英↔日) | SaaS(英→日) | WMT24++ COMET-22(英→日) | FLORES+ chrF++(日本語↔多言語) | FLORES+ chrF++(英語↔多言語) | | |
| | --- | ---: | ---: | ---: | ---: | ---: | ---: | | |
| | **BF16** | 5.76 | 0.6061 | 0.5612 | 0.8780 | 37.02 | 55.74 | | |
| | FP8 | 3.43 | 0.6067<br>(+0.0006) | 0.5613<br>(+0.0001) | 0.8776<br>(-0.0004) | 36.98<br>(-0.04) | 55.76<br>(+0.02) | | |
| | W4A16 | 2.30 | 0.6032<br>(-0.0029) | 0.5594<br>(-0.0018) | 0.8783<br>(+0.0003) | 36.96<br>(-0.06) | 55.69<br>(-0.05) | | |
| | W4AFP8 | 2.30 | 0.6022<br>(-0.0039) | 0.5612<br>(0.0000) | 0.8772<br>(-0.0008) | 36.95<br>(-0.07) | 55.71<br>(-0.03) | | |
| | NVFP4 | 2.41 | 0.6032<br>(-0.0029) | 0.5626<br>(+0.0014) | 0.8783<br>(+0.0003) | 36.82<br>(-0.20) | 55.64<br>(-0.10) | | |
| | GGUF BF16 | 5.76 | 0.6062<br>(+0.0001) | 0.5619<br>(+0.0007) | 0.8782<br>(+0.0002) | 37.02<br>(0.00) | 55.75<br>(+0.01) | | |
| | GGUF Q4_K_M | 1.81 | 0.6062<br>(+0.0001) | 0.5602<br>(-0.0010) | 0.8774<br>(-0.0006) | 37.00<br>(-0.02) | 55.76<br>(+0.02) | | |
| | GGUF Q4_0 | 1.70 | 0.6069<br>(+0.0008) | 0.5604<br>(-0.0008) | 0.8791<br>(+0.0011) | 36.12<br>(-0.90) | 55.62<br>(-0.12) | | |
| | GGUF Q3_K_M | 1.50 | 0.6053<br>(-0.0008) | 0.5644<br>(+0.0032) | 0.8789<br>(+0.0009) | 36.81<br>(-0.21) | 55.59<br>(-0.15) | | |
| | GGUF Q2_K | 1.23 | 0.5977<br>(-0.0084) | 0.5610<br>(-0.0002) | 0.8777<br>(-0.0003) | 36.45<br>(-0.57) | 55.02<br>(-0.72) | | |
| | MLX 4bit | 2.41 | 0.6040<br>(-0.0021) | 0.5624<br>(+0.0012) | 0.8777<br>(-0.0003) | 36.99<br>(-0.03) | 55.64<br>(-0.10) | | |
| #### 0.8B | |
| | 形式 | 容量(GB) | PFTB(英↔日) | SaaS(英→日) | WMT24++ COMET-22(英→日) | FLORES+ chrF++(日本語↔多言語) | FLORES+ chrF++(英語↔多言語) | | |
| | --- | ---: | ---: | ---: | ---: | ---: | ---: | | |
| | **BF16** | 1.78 | 0.5862 | 0.5530 | 0.8724 | 36.08 | 54.44 | | |
| | FP8 | 1.22 | 0.5846<br>(-0.0016) | 0.5491<br>(-0.0039) | 0.8726<br>(+0.0002) | 36.00<br>(-0.08) | 54.60<br>(+0.16) | | |
| | W4A16 | 0.95 | 0.5847<br>(-0.0015) | 0.5439<br>(-0.0091) | 0.8711<br>(-0.0013) | 35.78<br>(-0.30) | 53.95<br>(-0.49) | | |
| | W4AFP8 | 0.95 | 0.5783<br>(-0.0079) | 0.5456<br>(-0.0074) | 0.8718<br>(-0.0006) | 35.75<br>(-0.33) | 54.38<br>(-0.06) | | |
| | NVFP4 | 0.98 | 0.5787<br>(-0.0075) | 0.5436<br>(-0.0094) | 0.8702<br>(-0.0022) | 35.54<br>(-0.54) | 54.20<br>(-0.24) | | |
| | GGUF BF16 | 1.78 | 0.5873<br>(+0.0011) | 0.5533<br>(+0.0003) | 0.8727<br>(+0.0003) | 36.10<br>(+0.02) | 54.45<br>(+0.01) | | |
| | GGUF Q4_K_M | 0.57 | 0.5832<br>(-0.0030) | 0.5451<br>(-0.0079) | 0.8716<br>(-0.0008) | 35.90<br>(-0.18) | 54.47<br>(+0.03) | | |
| | GGUF Q4_0 | 0.55 | 0.5853<br>(-0.0009) | 0.5500<br>(-0.0030) | 0.8723<br>(-0.0001) | 34.97<br>(-1.11) | 54.11<br>(-0.33) | | |
| | GGUF Q3_K_M | 0.49 | 0.5798<br>(-0.0064) | 0.5520<br>(-0.0010) | 0.8710<br>(-0.0014) | 35.32<br>(-0.76) | 54.15<br>(-0.29) | | |
| | GGUF Q2_K | 0.41 | 0.5620<br>(-0.0242) | 0.5397<br>(-0.0133) | 0.8659<br>(-0.0065) | 33.56<br>(-2.52) | 51.15<br>(-3.29) | | |
| | MLX 4bit | 0.98 | 0.5773<br>(-0.0089) | 0.5476<br>(-0.0054) | 0.8724<br>(0.0000) | 35.82<br>(-0.26) | 54.41<br>(-0.03) | | |
| </details> | |
| ### 配布形式の選び方 | |
| PLaMo 3 Translateの各サイズには、用途とハードウェアに応じて次の配布形式があります。 | |
| | 形式 | 主な対象環境 | 推論エンジン | 用途の目安 | | |
| | --- | --- | --- | --- | | |
| | BF16 | BF16対応GPU | Transformers/vLLM | 量子化なしの精度を優先。メモリに余裕がある場合 | | |
| | FP8 | NVIDIA Ada Lovelace/Hopper/Blackwell | vLLM | 精度と省メモリ・速度のバランスを重視 | | |
| | W4A16 | NVIDIA Ampere以降 | vLLM | 4bit重みでGPUメモリを抑えて実行 | | |
| | W4AFP8 | NVIDIA Hopper | vLLM | 4bit重みとFP8演算で、省メモリと処理量の両立を狙う | | |
| | NVFP4 | NVIDIA Blackwell | vLLM | FP4演算を活用し、省メモリ・高速化を狙う | | |
| | **GGUF** | CPU/各種GPU | llama.cpp | 手元のPCで実行。CPUとGPUの併用も可能 | | |
| | MLX-4bit | Apple silicon | mlx-lm | Macで省メモリに実行 | | |
| ## 使い方 | |
| ### llama.cpp | |
| [llama.cpp](https://github.com/ggml-org/llama.cpp)をインストールします。 | |
| | ファイル | 容量 | 用途の目安 | | |
| | --- | ---: | --- | | |
| | `plamo-3-translate-8b-Q4_K_M.gguf` | 5.28 GB | 標準。精度と容量のバランスがよく、まずこれを選んでください | | |
| | `plamo-3-translate-8b-Q3_K_M.gguf` | 4.31 GB | 容量を抑えたいとき。精度は少し低下します | | |
| | `plamo-3-translate-8b-Q2_K.gguf` | 3.45 GB | 最小容量。精度は他の形式より低めです | | |
| 容量を抑えたい場合は、精度を多少犠牲にしてQ3_K_MやQ2_Kを選べます。各形式の精度は上の「量子化による精度変化」を参照してください(表のGGUF BF16は比較用の参照値で、配布していません)。以下の例ではQ4_K_Mを使います。別の形式を使う場合は、ファイル名を置き換えてください。 | |
| 使うGGUFファイルをダウンロードし、そのディレクトリに移動します。以降の例はこのディレクトリで実行します。 | |
| ```bash | |
| pip install -U huggingface_hub | |
| hf download pfnet/plamo-3-translate-8b-GGUF plamo-3-translate-8b-Q4_K_M.gguf --local-dir plamo-3-translate-8b-GGUF | |
| cd plamo-3-translate-8b-GGUF | |
| ``` | |
| 保存したGGUFファイルを指定してサーバーを起動します。チャットテンプレートはGGUFファイルに埋め込まれています。 | |
| ```bash | |
| llama-server -m plamo-3-translate-8b-Q4_K_M.gguf -c 16384 --port 8000 --alias plamo-3-translate --jinja --no-prefill-assistant | |
| ``` | |
| この例では、`-c 16384`で入力と出力を合わせた最大長を16,384トークンに設定しています。メモリに合わせて調整してください。 | |
| GPUを利用する場合は、GPU対応のllama.cppをインストールしてください。最近のllama.cppは既定でモデルをGPUへ自動的に配置します。層数を指定するときは`-ngl`を使います。`--alias`には、APIでモデルを指定するときの名前を設定します。 | |
| 続いて、下の[APIで翻訳する](#apiで翻訳する)の手順で翻訳をリクエストします。 | |
| ### APIで翻訳する | |
| 原文を送るChat Completions APIの使い方を説明します。PFML3プロンプトを直接送る場合は、[Completions APIの例](#completions-apiで翻訳する)を参照してください。 | |
| Pythonの例ではOpenAIクライアントを使います。 | |
| ```bash | |
| pip install -U openai | |
| ``` | |
| #### Chat Completions APIで翻訳する | |
| 手軽に翻訳を試せるよう、チャットテンプレートを用意しています。原文と翻訳先を指定すると、PFML3形式のプロンプトを作成できます。 | |
| アプリケーションへの組み込みなど、本格的に活用する場合は、[PFML3形式](#pfml3プロンプト形式)でプロンプトを直接組み立て、起動したサーバーの[Completions API](#completions-apiで翻訳する)に渡す方法をおすすめします。 | |
| Chat Completions APIでは、最後の`user`メッセージに今回の原文を入れ、翻訳オプションを`chat_template_kwargs`で渡します。LM StudioやOllamaのように`chat_template_kwargs`を指定できないクライアントでは、先頭の`system`メッセージで指定します([systemメッセージで翻訳設定を指定する](#systemメッセージで翻訳設定を指定する))。 | |
| `source_lang`を省略すると、モデルが原文から言語を判断して翻訳します。明示する場合は、`chat_template_kwargs`に`"source_lang": "en"`のように追加してください。 | |
| ```bash | |
| curl http://localhost:8000/v1/chat/completions \ | |
| -H 'Content-Type: application/json' \ | |
| -d '{ | |
| "model": "plamo-3-translate", | |
| "messages": [{"role": "user", "content": "The meeting has been rescheduled to next Monday."}], | |
| "chat_template_kwargs": {"target_lang": "ja"}, | |
| "temperature": 0, | |
| "max_tokens": 512, | |
| "stop": ["<|plamo:tag|>", "<|plamo:bos|>"] | |
| }' | |
| ``` | |
| `max_tokens`は訳文の生成上限です。この例では512トークンに設定しています。長文を翻訳する場合は、入力全体(原文・履歴・参考文脈・用語集など)と出力の合計が実行環境の上限に収まるように、生成上限を調整してください。 | |
| 翻訳例: | |
| > 会議は来週の月曜日に変更されました。 | |
| 訳文は`choices[0].message.content`に入ります。`target_lang`を省略すると、原文が日本語か英語かをモデルが判断し、もう一方の言語に翻訳します(詳細と日英以外の原文については[systemメッセージで翻訳設定を指定する](#systemメッセージで翻訳設定を指定する)を参照)。 | |
| **複数の文章をまとめて翻訳する場合** | |
| 複数の文章を翻訳するときは、文章ごとにリクエストを送り、並列に実行できます。以下の例では、最大4件のリクエストを並列に送ります。`target_lang`などの翻訳オプションは、`translate()`内で指定したものがすべての文章に適用されます。 | |
| ```python | |
| from concurrent.futures import ThreadPoolExecutor | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| texts = [ | |
| "The meeting has been rescheduled to next Monday.", | |
| "Please open the project dashboard.", | |
| ] | |
| def translate(text): | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[{"role": "user", "content": text}], | |
| temperature=0, | |
| max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| extra_body={"chat_template_kwargs": {"target_lang": "ja"}}, | |
| ) | |
| return response.choices[0].message.content | |
| with ThreadPoolExecutor(max_workers=4) as executor: | |
| translations = list(executor.map(translate, texts)) | |
| for source, translation in zip(texts, translations): | |
| print(f"{source} → {translation}") | |
| ``` | |
| **対訳履歴を使ってChat Completions APIで翻訳する場合** | |
| 翻訳済みの原文・訳文を`user`/`assistant`のペアで渡します。最後の`user`だけが今回の翻訳対象です。 | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| messages = [ | |
| {"role": "user", "content": "Open the project dashboard."}, | |
| {"role": "assistant", "content": "プロジェクトの管理画面を開きます。"}, | |
| {"role": "user", "content": "It lists all active tasks."}, | |
| {"role": "assistant", "content": "進行中のタスクがすべて表示されます。"}, | |
| {"role": "user", "content": "You can also filter them by owner."}, | |
| ] | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=messages, | |
| temperature=0, | |
| max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| extra_body={"chat_template_kwargs": {"source_lang": "en", "target_lang": "ja"}}, | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| #### systemメッセージで翻訳設定を指定する | |
| 日英の切り替えに設定は要りません。`chat_template_kwargs`にも`system`メッセージにも`target_lang`がない場合、チャットテンプレートは原文が日本語か英語かをモデルに判断させ、もう一方の言語に翻訳します。チャットに対訳履歴が残っている場合も同様です。以下の設定は、翻訳先を固定したり、オプションを追加したりするためのものです。既定の切り替えは日本語と英語を想定しています。それ以外の言語の原文は、`target_lang`を明示してください(例:中国語やフランス語から日本語へは`target_lang=ja`)。明示しない場合、訳文の言語は定まりません。`source_lang`には`auto`以外の`target_lang`、`form`には`target_lang=ja`が必要です。 | |
| 2026-11-08の変更:それまでは`target_lang`を省略すると日本語に翻訳していました。従来どおりにするには`target_lang=ja`を指定してください。`source_lang`には具体的な`target_lang`が、`form`には`target_lang=ja`が必要になりました。この更新より前にダウンロードしたGGUFファイルは、ダウンロードし直して(Ollamaは`ollama pull`をやり直し、LM Studio・PocketPalはファイルを入れ直して)、新しいチャットを開始してください。 | |
| 対訳履歴がある場合、このチャットテンプレートはすべての原文に`ja/en`を同じ順序で付け、参考文脈も渡します(ローカルでの推論確認に基づく動作です)。[PFML3形式](#pfml3プロンプト形式)のセグメント形式そのものでは、今回の原文の言語を先頭に書き、切り替え指定と文脈は併用しません。通常の1対の形式では順序は自由で、文脈も併用できます。翻訳方向を確実に固定したい場合は`target_lang`を指定してください。 | |
| LM StudioやOllamaなど、`chat_template_kwargs`を渡せないクライアントでは、先頭の`system`メッセージで翻訳設定を指定します。1行目を`[plamo-translate]`とし、2行目以降に`key=value`を1行ずつ書きます。使えるキーは`target_lang`、`source_lang`、`form`、`glossary`で、`form`は`target_lang=ja`のときだけ指定できます。用語集は`glossary=原語 => 訳語`を1組ずつ書きます。`glossary`だけは複数行書くことができ、`=>`の前後の空白は省略できます。 | |
| `---`の行より後ろは`context`として扱われます。`[plamo-translate]`で始まらない`system`メッセージは、全文が`context`になります。同じ項目を`chat_template_kwargs`でも指定した場合は`chat_template_kwargs`が優先されます。 | |
| `target_lang`・`source_lang`・`form`は、`[plamo-translate]`と同じ行に空白区切りで書くこともできます(例:`[plamo-translate] target_lang=en source_lang=ja`。`=`の前後に空白は入れません)。キー名と、`target_lang`・`source_lang`・`form`の値は、ASCIIの大文字と小文字を区別しません。1行目の`[plamo-translate]`はそのまま書きます。 | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[ | |
| {"role": "system", "content": "[plamo-translate]\ntarget_lang=ja"}, | |
| {"role": "user", "content": "The meeting has been rescheduled to next Monday."}, | |
| ], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > 会議は来週の月曜日に変更されました。 | |
| 翻訳先を英語に固定する場合は、`target_lang=en`を指定します。`target_lang=auto`と書くと、既定の日英自動切り替えを明示できます。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[ | |
| {"role": "system", "content": "[plamo-translate]\ntarget_lang=en"}, | |
| {"role": "user", "content": "会議は来週の月曜日に変更されました。"}, | |
| ], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > The meeting has been rescheduled for next Monday. | |
| `form`と`context`は、次のように`---`の前後に書きます。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[ | |
| {"role": "system", "content": "[plamo-translate]\ntarget_lang=ja\nform=polite\n---\nThey were walking beside a river after heavy rain."}, | |
| {"role": "user", "content": "The bank was muddy."}, | |
| ], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > 川岸はぬかるんでいました。 | |
| 用語集は、次のように1組ずつ書きます。用語集は原語 => 訳語の方向を持ち、既定の日英自動切り替えでもそのまま渡されるため、想定する方向で書いてください。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[ | |
| {"role": "system", "content": "[plamo-translate]\ntarget_lang=ja\nglossary=dashboard => 管理画面\nglossary=project => プロジェクト"}, | |
| {"role": "user", "content": "Please open the project dashboard."}, | |
| ], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > プロジェクトの管理画面を開いてください。 | |
| LM Studioでは、`base_url="http://localhost:1234/v1"`と、`model`にロードしたモデルの識別子(例:`plamo-3-translate-8b`)を指定します。 | |
| Ollamaでは、`base_url="http://localhost:11434/v1"`と、`model`に`hf.co/pfnet/plamo-3-translate-8b-GGUF:Q4_K_M`(`ollama pull hf.co/pfnet/plamo-3-translate-8b-GGUF:Q4_K_M`で取得)を指定します。Ollamaでは`/v1/completions`にもチャットテンプレートが適用されるため、[PFML3形式](#pfml3プロンプト形式)のプロンプトを直接渡す場合は`/api/generate`に`"raw": true`を付けて送ってください。 | |
| チャット画面で使う場合、日英を自動で切り替えるにはシステムプロンプトを空にし、翻訳先を固定するにはシステムプロンプト欄にこの内容だけを設定します。設定を変えるときは新しいチャットを開始してください。 | |
| #### チャットにPFML3を直接入力する | |
| チャット画面やChat Completions APIの`user`メッセージに、[PFML3形式](#pfml3プロンプト形式)のプロンプト全体をそのまま書くこともできます。最後の`user`メッセージが`<|plamo:tag|>dataset<|plamo:msg|>translation`で始まる場合、チャットテンプレートはそのメッセージだけをそのままモデルに渡し、`system`メッセージ・過去のやり取り・`chat_template_kwargs`は使いません。参考文脈・用語集・対訳履歴が必要な場合は、プロンプトの中に書き、毎回プロンプト全体を送ってください。先頭に空白やコード囲みを付けず、末尾は`output`要素の`<|plamo:msg|>`で終え、後ろに改行を付けません。 | |
| 次の内容をそのまま送ると、日本語の原文を英語に翻訳します。 | |
| ```text | |
| <|plamo:tag|>dataset<|plamo:msg|>translation<|plamo:tag|>input<|plamo:msg|>会議は来週の月曜日に変更されました。<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|> | |
| ``` | |
| 翻訳例: | |
| > The meeting has been rescheduled for next Monday. | |
| 通常の原文入力に戻すときは、新しいチャットを開始してください。 | |
| ### これまでの訳文を参考に、続きを翻訳する | |
| 文書を段落ごとに翻訳するときは、これまでの原文・訳文のペアを履歴として渡せます。前の訳語や文体を参考にしながら、続きの文章を翻訳するための方法です。 | |
| チャットテンプレートを使う場合は、原文を`user`、その訳文を`assistant`として交互に並べ、最後の`user`に今回の原文を渡します。履歴は自動では保存されないため、次のリクエストにも必要なペアを含めてください。 | |
| `auto`以外の`target_lang`を指定した場合、翻訳方向はリクエスト全体で共通です。`source_lang`はすべての原文、`target_lang`はすべての訳文に適用されます。`target_lang`を省略した場合と`auto`の場合は原文ごとにもう一方の言語へ翻訳されるため、履歴に両方向が混在していても構いません。 | |
| 履歴も入力トークン数に含まれます。入力全体と生成する訳文が、32,768トークンおよび実行環境の上限に収まるようにしてください。履歴が長くなった場合は、古い原文・訳文のペアから順に外し、直近の履歴を残すことをおすすめします。 | |
| ### PFML3プロンプト形式 | |
| PFML3は、翻訳する文章や翻訳先などを特殊トークンで区切って表すPLaMoのプロンプト形式です。上のChat Completions APIの例では、チャットテンプレートが原文と翻訳先をPFML3に変換しています。ここでは変換結果の見方と、プロンプトを手書きするときの使い方を説明します。 | |
| 本格的な活用には、PFML3でプロンプトを直接組み立て、起動したサーバーの[Completions API](#completions-apiで翻訳する)に渡す方法をおすすめします。 | |
| 英語の会議日程を日本語に翻訳するリクエストをPFML3に変換すると、次のようになります。ここでは文頭トークンを省略し、Pythonの文字列を分割して示しています。実際のプロンプトには改行は入りません。 | |
| ```python | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>input" | |
| "<|plamo:msg|>The meeting has been rescheduled to next Monday." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>" | |
| ) | |
| ``` | |
| - `dataset`の`translation`は翻訳タスクを表します。このモデルは翻訳専用のため、`dataset`には必ず`translation`を指定します。 | |
| - `input`の`<|plamo:msg|>`に続く部分が翻訳する原文です。 | |
| - `output`の`<|plamo:key|>lang<|plamo:val|>ja`は、翻訳先が日本語であることを表します。最後の`<|plamo:msg|>`の直後から訳文が生成されます。 | |
| `<|plamo:tag|>`は各要素の始まりを、`<|plamo:msg|>`はその本文の始まりを表します。言語や文体などを指定するときは、要素名に続けて`<|plamo:key|>`の後に属性名、`<|plamo:val|>`の後に値を書きます。例えば、`output`に`<|plamo:key|>form<|plamo:val|>plain`を追加すると、常体を指定できます。 | |
| 参考文脈や用語集はオプショナルです。使う場合は、`dataset`と`input`の間に`context`、`glossary`の順で追加します。対訳履歴も使う場合は、`context`を`dataset`の直後に置き、過去の`input`・`output`の組を並べた後、今回の`input`の直前に`glossary`を置きます。用語集には、`<|plamo:index|>`の後に原語、`<|plamo:item|>`の後に訳語を書き、この組を用語の数だけ並べます。具体例は[翻訳オプション](#翻訳オプション)を参照してください。 | |
| #### Completions APIで翻訳する | |
| PFML3を手書きするときは、`dataset`を`translation`に指定して始め、`output`要素の末尾を`<|plamo:msg|>`で終えます。モデルは訳文の生成後、`<|plamo:tag|>`または`<|plamo:bos|>`を出力して停止します。 | |
| 上の手書き例では、文頭を示す`<|plamo:bos|>`を省略しています。llama.cppが自動で付けるため、手書きのプロンプトの先頭には追加しません。 | |
| 手書きのプロンプトは、起動したサーバーのCompletions APIに`prompt`として渡します。 | |
| `prompt`には、各翻訳例に掲載したPFML3プロンプトを渡します。 | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>input" | |
| "<|plamo:msg|>The meeting has been rescheduled to next Monday." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>" | |
| ) | |
| response = client.completions.create( | |
| model="plamo-3-translate", | |
| prompt=prompt, | |
| temperature=0, | |
| max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| print(response.choices[0].text) | |
| ``` | |
| 訳文は`choices[0].text`に入ります。 | |
| **複数の文章をまとめて翻訳する場合** | |
| PFML3プロンプトを直接使う場合も、文章ごとにリクエストを並列に送れます。 | |
| ```python | |
| from concurrent.futures import ThreadPoolExecutor | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| texts = [ | |
| "The meeting has been rescheduled to next Monday.", | |
| "Please open the project dashboard.", | |
| ] | |
| def translate(text): | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>input<|plamo:msg|>" | |
| f"{text}" | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>" | |
| ) | |
| response = client.completions.create( | |
| model="plamo-3-translate", | |
| prompt=prompt, | |
| temperature=0, | |
| max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| return response.choices[0].text | |
| with ThreadPoolExecutor(max_workers=4) as executor: | |
| translations = list(executor.map(translate, texts)) | |
| for source, translation in zip(texts, translations): | |
| print(f"{source} → {translation}") | |
| ``` | |
| #### 対訳履歴をPFML3で指定する | |
| 対訳履歴は手書きのPFML3でも指定できます。翻訳済みの`input`と`output`を文書の順に並べ、最後に今回の原文と、本文が空の`output`を置きます。次の例では、2組の対訳を参考にして、最後の「You can also filter them by owner.」だけを翻訳します。 | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>input<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|>Open the project dashboard." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>プロジェクトの管理画面を開きます。" | |
| "<|plamo:tag|>input<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|>It lists all active tasks." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>進行中のタスクがすべて表示されます。" | |
| "<|plamo:tag|>input<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|>You can also filter them by owner." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>" | |
| ) | |
| response = client.completions.create( | |
| model="plamo-3-translate", | |
| prompt=prompt, | |
| temperature=0, | |
| max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| ) | |
| print(response.choices[0].text) | |
| ``` | |
| 続きを訳すときは、今回の原文と生成された訳文の組を履歴に追加します。その後に、次の原文を入れた`input`と、本文が空の`output`を続けます。 | |
| 履歴には訳文の本文だけを残します。上の例で受け取った訳文は、そのまま使えます。 | |
| 訳文の末尾に`<|plamo:tag|>`や`<|plamo:bos|>`が残っている場合は取り除き、次の`input`との間の`<|plamo:tag|>`が1つになるようにしてください。 | |
| ### 翻訳オプション | |
| 翻訳先や文体、参考文脈、用語集などは、`system`メッセージや原文には書かず、Chat Completions APIの`chat_template_kwargs`で指定します。 | |
| ただし、GGUF版では、`chat_template_kwargs`を渡せないクライアント向けに、`target_lang`・`source_lang`・`form`・`glossary`と`context`を`system`メッセージでも指定できます([systemメッセージで翻訳設定を指定する](#systemメッセージで翻訳設定を指定する))。 | |
| 以下の例は、サーバーを起動した状態で実行します。 | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| ``` | |
| | 引数 | 内容 | | |
| | --- | --- | | |
| | `target_lang` | 翻訳先の言語コード。省略時または`auto`は、日本語と英語の自動切り替え。 | | |
| | `source_lang` | 原文の言語コード。省略可能。指定する場合は`auto`以外の`target_lang`も指定します。 | | |
| | `context` | 原文を解釈するための参考文脈(前後の文章や場面など)。 | | |
| | `glossary` | `{"source": "原語", "target": "訳語"}`のリスト。 | | |
| | `form` | 常体`plain`/敬体`polite`を指定(`target_lang="ja"`のみ)。 | | |
| 対訳履歴と併用する場合、`context`は全体の参考文脈として渡し、`glossary`と`form`は今回の翻訳に適用されます。過去の訳文自体は変更しません。 | |
| #### 用語集で訳語を指定する | |
| `glossary`に原語と訳語の組を渡して、用語の訳し方を指定します。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[{"role": "user", "content": "Please open the project dashboard."}], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| extra_body={ | |
| "chat_template_kwargs": { | |
| "target_lang": "ja", | |
| "glossary": [ | |
| {"source": "dashboard", "target": "管理画面"}, | |
| {"source": "project", "target": "プロジェクト"} | |
| ] | |
| } | |
| }, | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > プロジェクトの管理画面を開いてください。 | |
| <details> | |
| <summary>この例のPFML3プロンプト</summary> | |
| ```python | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>glossary" | |
| "<|plamo:index|>dashboard<|plamo:item|>管理画面" | |
| "<|plamo:index|>project<|plamo:item|>プロジェクト" | |
| "<|plamo:tag|>input<|plamo:msg|>Please open the project dashboard." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>" | |
| ) | |
| ``` | |
| </details> | |
| #### 参考文脈を渡す | |
| `context`に前後の文章や場面を伝えます。この例では、川辺を歩いているという文脈を添えています。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[{"role": "user", "content": "The bank was muddy."}], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| extra_body={ | |
| "chat_template_kwargs": { | |
| "target_lang": "ja", | |
| "context": "They were walking beside a river after heavy rain." | |
| } | |
| }, | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > 川岸はぬかるんでいた。 | |
| <details> | |
| <summary>この例のPFML3プロンプト</summary> | |
| ```python | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>context" | |
| "<|plamo:msg|>They were walking beside a river after heavy rain." | |
| "<|plamo:tag|>input<|plamo:msg|>The bank was muddy." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>" | |
| ) | |
| ``` | |
| </details> | |
| #### 常体・敬体を指定する | |
| 日本語への翻訳では、`form="plain"`で常体(だ・である調)、`form="polite"`で敬体(です・ます調)を指定できます。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[{"role": "user", "content": "This system is convenient."}], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| extra_body={ | |
| "chat_template_kwargs": { | |
| "target_lang": "ja", | |
| "form": "plain" | |
| } | |
| }, | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 同じ原文に対する翻訳例: | |
| | 文体 | 指定 | 訳文 | | |
| | --- | --- | --- | | |
| | 常体 | `form="plain"` | このシステムは便利だ。 | | |
| | 敬体 | `form="polite"` | このシステムは便利です。 | | |
| <details> | |
| <summary>この例のPFML3プロンプト</summary> | |
| 常体: | |
| ```python | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>input<|plamo:msg|>This system is convenient." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja" | |
| "<|plamo:key|>form<|plamo:val|>plain<|plamo:msg|>" | |
| ) | |
| ``` | |
| 敬体: | |
| ```python | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>input<|plamo:msg|>This system is convenient." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja" | |
| "<|plamo:key|>form<|plamo:val|>polite<|plamo:msg|>" | |
| ) | |
| ``` | |
| </details> | |
| #### すべてのオプションを同時に指定する | |
| 対訳履歴、参考文脈、用語集、文体は同時に指定できます。次の例では、2組の対訳履歴に続けて3文目を翻訳し、参考文脈にページの種類、用語集に`owner`の訳語、文体に敬体を指定しています。`context`は全体の参考文脈として渡され、`glossary`と`form`は今回の翻訳に適用されます。 | |
| ```python | |
| response = client.chat.completions.create( | |
| model="plamo-3-translate", | |
| messages=[ | |
| {"role": "user", "content": "Open the project dashboard."}, | |
| {"role": "assistant", "content": "プロジェクトの管理画面を開きます。"}, | |
| {"role": "user", "content": "It lists all active tasks."}, | |
| {"role": "assistant", "content": "進行中のタスクがすべて表示されます。"}, | |
| {"role": "user", "content": "You can also filter them by owner."}, | |
| ], | |
| temperature=0, max_tokens=512, | |
| stop=["<|plamo:tag|>", "<|plamo:bos|>"], | |
| extra_body={ | |
| "chat_template_kwargs": { | |
| "source_lang": "en", | |
| "target_lang": "ja", | |
| "context": "Help page of a project management tool.", | |
| "glossary": [ | |
| {"source": "owner", "target": "オーナー"} | |
| ], | |
| "form": "polite" | |
| } | |
| }, | |
| ) | |
| print(response.choices[0].message.content) | |
| ``` | |
| 翻訳例: | |
| > また、オーナー別に絞り込むこともできます。 | |
| <details> | |
| <summary>この例のPFML3プロンプト</summary> | |
| ```python | |
| prompt = ( | |
| "<|plamo:tag|>dataset<|plamo:msg|>translation" | |
| "<|plamo:tag|>context<|plamo:msg|>Help page of a project management tool." | |
| "<|plamo:tag|>input<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|>Open the project dashboard." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>プロジェクトの管理画面を開きます。" | |
| "<|plamo:tag|>input<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|>It lists all active tasks." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:msg|>進行中のタスクがすべて表示されます。" | |
| "<|plamo:tag|>glossary<|plamo:index|>owner<|plamo:item|>オーナー" | |
| "<|plamo:tag|>input<|plamo:key|>lang<|plamo:val|>en<|plamo:msg|>You can also filter them by owner." | |
| "<|plamo:tag|>output<|plamo:key|>lang<|plamo:val|>ja<|plamo:key|>form<|plamo:val|>polite<|plamo:msg|>" | |
| ) | |
| ``` | |
| </details> | |
| ## 対応言語 | |
| 日本語・英語を含む53言語に対応しています。中国語は簡体字と繁体字をそれぞれ1言語として数えています。Hugging Faceの言語表示では中国語が1言語にまとめられるため、52言語と表示されます。 | |
| <details> | |
| <summary>対応言語と言語コードの一覧</summary> | |
| | 言語 | コード | 言語 | コード | | |
| |---|---|---|---| | |
| | 日本語 | `ja` | 英語 | `en` | | |
| | 中国語(簡体字) | `zh-hans` | 中国語(繁体字) | `zh-hant` | | |
| | 韓国語 | `ko` | アラビア語 | `ar` | | |
| | アゼルバイジャン語 | `az` | ベラルーシ語 | `be` | | |
| | ブルガリア語 | `bg` | ベンガル語 | `bn` | | |
| | カタルーニャ語 | `ca` | セブアノ語 | `ceb` | | |
| | ドイツ語 | `de` | スペイン語 | `es` | | |
| | エストニア語 | `et` | バスク語 | `eu` | | |
| | ペルシャ語 | `fa` | フランス語 | `fr` | | |
| | グジャラート語 | `gu` | ヘブライ語 | `he` | | |
| | ヒンディー語 | `hi` | クロアチア語 | `hr` | | |
| | ハンガリー語 | `hu` | アルメニア語 | `hy` | | |
| | インドネシア語 | `id` | イタリア語 | `it` | | |
| | ジャワ語 | `jv` | ジョージア語 | `ka` | | |
| | カザフ語 | `kk` | クメール語 | `km` | | |
| | リトアニア語 | `lt` | ラトビア語 | `lv` | | |
| | マラヤーラム語 | `ml` | マラーティー語 | `mr` | | |
| | マレー語 | `ms` | ミャンマー語 | `my` | | |
| | ネパール語 | `ne` | オランダ語 | `nl` | | |
| | パンジャーブ語 | `pa` | ポーランド語 | `pl` | | |
| | ロシア語 | `ru` | シンハラ語 | `si` | | |
| | スロバキア語 | `sk` | スロベニア語 | `sl` | | |
| | セルビア語 | `sr` | スワヒリ語 | `sw` | | |
| | タミル語 | `ta` | テルグ語 | `te` | | |
| | タイ語 | `th` | タガログ語 | `tl` | | |
| | ウルドゥー語 | `ur` | ウズベク語 | `uz` | | |
| | ベトナム語 | `vi` | | | | |
| </details> | |
| ## ライセンス | |
| PLaMo 3 Translate 8B GGUFは、[PLaMo Community License](https://plamo.preferredai.jp/info/plamo-community-license-en)のもとで公開されています。 | |
| - [英語版](https://plamo.preferredai.jp/info/plamo-community-license-en) | |
| - [日本語版](https://plamo.preferredai.jp/info/plamo-community-license-ja) | |
| **私的な用途・非商用利用** | |
| 個人での学習や趣味など、私的な用途であれば、モデルを無償でダウンロードし、自由にご利用いただけます。学術用途を含む非商用利用でも、収入や売上の規模による制限はなく、PFNへの事前の利用登録も不要です。 | |
| **商用利用(収入または売上が10億円以下の場合)** | |
| 利用者またはその関係会社の直近事業年度の収入または売上が10億円以下であれば、[PLaMo商用利用登録フォーム](https://forms.gle/mTL8tBLrMYXKNZD56)で利用用途を登録することで、送信した時点から無償で商用利用できます。 | |
| **商用利用(収入または売上が10億円を超える場合)** | |
| 別途ライセンス契約が必要です。上記の登録フォームではなく、[PLaMo翻訳モデルに関するお問い合わせ](https://translate.preferredai.jp/llm/contact/)からPFNまでご相談ください。 | |
| 詳細はPLaMo Community Licenseの本文をご確認ください。 | |
| ## Preferred NetworksグループのAIポリシー | |
| - [日本語](https://www.preferred.jp/ja/company/aipolicy/) | |
| - [English](https://www.preferred.jp/en/company/aipolicy/) | |