Skip to content

chronos-enzh-50m-sft driver fix to dev: certifi CAs, refuse before loading - #52

Merged
FonaTech merged 1 commit into
devfrom
model-enzh-50m-sft-fix-dev
Nov 8, 2026
Merged

FonaTech merged 1 commit into
devfrom
model-enzh-50m-sft-fix-dev

Conversation

@FonaTech

@FonaTech FonaTech commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Summary

Two driver fixes, found while testing translate.py from a fresh directory after the enzh-50m-sft-v1 release.

  • --download on python.org macOS Python. That build ships no system CA bundle, so urlretrieve failed with CERTIFICATE_VERIFY_FAILED. The fix:
    • download() now uses certifi's CA bundle when it is installed. certifi comes in through the transformers → huggingface_hub → httpx dependency chain.
    • A failed download removes the partial file.
    • The error message says how to fetch the weights by hand.
  • Refusing input before loading. Chinese input was previously reported as "weights not found" whenever the weights were absent. The CLI now runs the language check before it builds the Translator, so out-of-boundary input is refused with exit code 2 and nothing is loaded or downloaded.

Test plan

  • ruff==0.17.4 and flake8 --select=E9,F63,F7,F82 are clean.
  • CI simulation, no MLX: 264 passed / 49 skipped on main, 410 passed / 67 skipped on dev.
  • There are 2 new tests:
    • Chinese input is refused when the weights are absent.
    • A failed download leaves no .part file.
  • The driver was run from a fresh directory. GitHub release assets resolve to ::1 on the test machine, so a localhost server provided the weights:
    • The download passes the SHA-256 check, and a file with a wrong hash is rejected.
    • MLX and torch-CPU translations work.
    • zh and --direction zh_en exit with code 2.
    • The first 120 FLORES+ devtest outputs match the published run exactly.
  • The release assets' GitHub digests equal the local SHA-256 57c59a14…fab4b7.

🤖 Generated with Claude Code

- download() uses certifi's CA bundle when installed. python.org macOS
  builds ship no system CAs, so urlretrieve failed with
  CERTIFICATE_VERIFY_FAILED. A failed download now removes the partial
  file and says how to fetch the weights by hand.
- The CLI runs the language check before building the Translator, so
  Chinese input is refused (exit 2) even when the weights are absent,
  instead of failing with "weights not found".
- Two tests cover both paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c550537)
@FonaTech
FonaTech merged commit c83ed56 into dev Nov 8, 2026
2 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