Skip to content

Fix launch blockers for PLaMo 3: direction, first download, memory, platforms, license - #38

Merged
mitmul merged 1 commit into
mainfrom
fix/plamo3-launch-blockers
Nov 6, 2026
Merged

mitmul merged 1 commit into
mainfrom
fix/plamo3-launch-blockers

Conversation

@mitmul

@mitmul mitmul commented Nov 5, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the five problems that a pre-release audit rated as must-fix before promoting PLaMo 3 Translate support. Each was reproduced before fixing.

1. Automatic direction echoed Japanese that names commands or products

With the default --from English|Japanese, inputs such as PLaMo 3 Translate を試してみました。 and GitHub の README を読んでください。 came back unchanged on both backends. The target was chosen by comparing Japanese characters with Latin letters, so identifiers outweighed the Japanese.

The new rule works by grammar. When there is hiragana outside quotes, it is weighed against twice the number of English function words (the, to, with, ...). Without hiragana, characters decide as before; this covers Chinese and English with Japanese names. A --from of English or Japanese decides the target directly; other or unrecognized source languages still use the text.

The rule was checked on labeled repository paragraphs plus crafted code-mixed and Japanese-quoting sentences:

Rule Japanese misdirected English misdirected
Old character rule 20 / 45 0 / 2,357
New rule 1 / 45 1 / 2,357

The two remaining misses are ambiguous: a mostly English heading, and "Konnichiwa means こんにちは". On the real models, the cases above now translate to English, and Meeting with 山田部長 and 佐藤課長 tomorrow still goes to Japanese.

2. First run downloaded 5.8 GB silently inside the 600 s server wait

Progress bars were disabled globally, and the download ran inside the server process, so it counted against the 600 s startup wait. Now:

  • Before the server starts, the CLI downloads original PLaMo 3 checkpoints and prints Downloading pfnet/plamo-3-translate-2b (5.8 GB) into the Hugging Face cache... with progress bars.
  • Cached snapshots are checked for completeness; a cache holding only config.json is downloaded.
  • Ctrl+C exits at once with a message.
  • The server loads cached checkpoints without a Hub request, so cached interactive and server starts print nothing on stderr.

A real first run with an empty cache took 11 min 10 s and then translated; the old code would have timed out at 600 s.

3. MLX load used 7.2 GB at peak

Converting and quantizing every weight in one evaluation peaked at 7.2 GB and left 5.3 GB in MLX's buffer cache. Loading one layer at a time, then calling mx.clear_cache(), gives:

Before After
Peak 7.2 GB 2.6 GB
Max RSS 6.1 GB 1.5 GB
Load time 3.6 s 3.6 s

Fixture translations are byte-identical at 4bit and bf16.

4. Platforms

  • MLX and numba now install only on Apple Silicon. numba is used only by PLaMo's tokenizer code on the MLX path, and it has no current Intel Mac wheels.
  • Elsewhere the default backend is llama.cpp. --backend-type mlx stops with a one-line error.
  • Without TMPDIR, as usual on Linux, state goes to a private per-user directory (/tmp/plamo-translate-<uid>, mode 0700, owner checked).
  • On Windows the CLI exits with a message pointing to WSL.
  • scripts/deploy.sh publishes the pure-Python py3-none-any wheel instead of retagging it for macOS arm64. It refuses to run for a version already on PyPI, because PyPI would accept a new file under an existing version.
  • Binary-only resolution of the built wheel:
    • Linux x86_64 and aarch64 and Intel macOS, Python 3.10 to 3.14: resolves, without MLX or numba.
    • Apple Silicon with macOS 14: gets MLX.
    • Apple Silicon with macOS 13: does not resolve, because MLX needs macOS 14, so pip falls back to an old release. The README says so.
  • A new real-model CI test runs on Linux with no --backend-type and no TMPDIR.

5. Model license

The README now has a License section. The CLI code is Apache-2.0. The 2B checkpoint, the 2B GGUF, the 0.8B draft GGUF and the PLaMo 2 models it downloads are under the PLaMo Community License. The section summarizes:

  • non-commercial use;
  • commercial-use registration, which applies when the revenue of the user or its affiliates is 1 billion yen or less, and which the license says also covers use within an organization;
  • the output-marking condition (Article 5);
  • the three redistribution conditions (Article 4).

"Built with PLaMo" is added to the README, which shows model translations, and to the PLaMo 3 benchmark summaries.

Validation

  • pytest unit and mock suites: 157 passed. tests/test_llama_cpp_integration.py: 3 passed locally, and the new Linux-only test is skipped on Apple Silicon.
  • ruff check src tests: clean. uv lock --check: up to date, with lockfile revision 3 kept.
  • Simulated Linux, with platform.machine set to x86_64 and TMPDIR unset: the default llama.cpp translation works, and /tmp/plamo-translate-501 is created with mode 0700.
  • A multi-agent review (behavior, packaging, docs, each finding checked by an independent verifier) confirmed 22 findings, all addressed here. Among them:
    • Intel Mac installs failing on numba/llvmlite;
    • test_cli_rejects_draft_for_mlx failing on Linux CI;
    • the first direction rule flipping English that names Japanese people or places;
    • incomplete cached snapshots;
    • Ctrl+C during the download;
    • the license threshold missing affiliates;
    • deploy.sh able to add files to an existing PyPI version.

Notes

  • The version is still 1.1.1.post1. Bump it (pyproject.toml, src/plamo_translate/__init__.py, uv.lock) before running deploy.sh, which now refuses otherwise.
  • Not in this PR, from the same audit:
    • README restructuring around PLaMo 3, and languages beyond the 16 accepted by --from/--to;
    • release notes;
    • [project.urls];
    • long-input handling;
    • the HTTP_PROXY hang and the client hang when a server dies.
  • Intel Macs were checked by dependency resolution and code paths only, not on hardware; Homebrew on Linux is untested. The README says so.

…latforms, license

- Direction: Japanese naming commands or products, such as
  "PLaMo 3 Translate を試してみました。", was sent to Japanese and echoed. With
  hiragana outside quotes, the automatic target now weighs it against twice
  the English function words; without hiragana, characters decide as before.
  A --from of English or Japanese decides. On labeled repository paragraphs
  and crafted sentences, misdirected Japanese dropped from 20 of 45 to 1, and
  English stayed at 1 of 2,357 or better.
- First run: the 5.8 GB default checkpoint was downloaded silently inside the
  600 s server startup wait. The CLI now downloads original PLaMo 3
  checkpoints before starting the server, with its size and progress bars
  (no longer disabled globally), checks that cached snapshots are complete,
  exits promptly on Ctrl+C, and the server loads cached checkpoints without
  a Hub request. A real first run took 11 min 10 s and translated.
- Memory: converting and quantizing all weights in one evaluation peaked at
  7.2 GB and left 5.3 GB cached. One layer at a time peaks at 2.6 GB (max RSS
  6.1 to 1.5 GB) with byte-identical fixture translations and the same load
  time.
- Platforms: MLX and numba install on Apple Silicon only (numba has no
  current Intel Mac wheels); elsewhere the default backend is llama.cpp, and
  --backend-type mlx stops with a one-line error. Without TMPDIR, state goes
  to a private per-user directory. Windows exits with a message. deploy.sh
  publishes the pure-Python wheel and refuses versions already on PyPI.
- README: platform table, Linux and Intel Mac setup, macOS 14 requirement,
  a License section for the PLaMo Community License models the CLI
  downloads, "Built with PLaMo" in the README and PLaMo 3 benchmark
  summaries.
@mitmul
mitmul merged commit c70e3a1 into main Nov 6, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant