{"id":50980482,"url":"https://github.com/r4ai/yomitoku-rocm","last_synced_at":"2026-06-19T13:32:59.929Z","repository":{"id":364965577,"uuid":"1268864451","full_name":"r4ai/yomitoku-rocm","owner":"r4ai","description":"ROCm on WSL2 で YomiToku を動かすための環境セットアップ","archived":false,"fork":false,"pushed_at":"2026-06-15T09:14:16.000Z","size":147,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T11:27:12.509Z","etag":null,"topics":["amd","amdgpu","ocr","radeon","rocm","yomitoku"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r4ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-14T02:58:34.000Z","updated_at":"2026-06-15T09:14:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/r4ai/yomitoku-rocm","commit_stats":null,"previous_names":["r4ai/yomitoku-rocm"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/r4ai/yomitoku-rocm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4ai%2Fyomitoku-rocm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4ai%2Fyomitoku-rocm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4ai%2Fyomitoku-rocm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4ai%2Fyomitoku-rocm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r4ai","download_url":"https://codeload.github.com/r4ai/yomitoku-rocm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4ai%2Fyomitoku-rocm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34534274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amd","amdgpu","ocr","radeon","rocm","yomitoku"],"created_at":"2026-06-19T13:32:58.432Z","updated_at":"2026-06-19T13:32:59.909Z","avatar_url":"https://github.com/r4ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yomitoku-rocm\n\nROCm on WSL2 で [YomiToku](https://github.com/kotaro-kinoshita/yomitoku) を動かすための環境セットアップ集です。AMD GPU 向けの PyTorch ROCm 依存関係、mise タスク、環境確認ツール（doctor）を備えています。\n\n## 前提条件\n\n- **GPU**: AMD RX 7000/9000 系（ROCm 対応）\n- **OS**: Windows + WSL2（Ubuntu 24.04 推奨）\n- **Windows 側**: AMD Software: Adrenalin Edition for WSL2 をインストール済み\n- **WSL 側**: ROCm 7.2.x + ROCDXG 導入済み、`rocminfo` で GPU agent が表示される状態\n\n\u003e ROCm PyTorch では AMD GPU も `cuda` デバイスとして扱われます。YomiToku 実行時は `-d cuda` を使います。\n\n参考ドキュメント:\n\n- [AMD ROCm WSL インストールガイド](https://rocm.docs.amd.com/projects/radeon-ryzen/en/latest/docs/install/installrad/wsl/howto_wsl.html)\n- [AMD PyTorch on ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/3rd-party/pytorch-install.html)\n- [uv PyTorch インテグレーション](https://docs.astral.sh/uv/guides/integration/pytorch/)\n\n## セットアップ\n\n### 1. ROCm / ROCDXG の導入（WSL）\n\nWSL 側の ROCm をまだ入れていない場合は、このリポジトリのセットアップスクリプトで一括導入できます:\n\n```bash\nmise run setup-wsl-rocm\n```\n\nこのスクリプトは `sudo` を使い、以下を行います:\n\n- AMD ROCm 7.2.4 の apt リポジトリ登録と `rocm` パッケージの導入\n- ROCDXG のビルドとインストール\n- `/etc/profile.d/rocm-rocdxg.sh` への ROCm/ROCDXG 環境変数の追加\n\n完了後は PowerShell で `wsl --shutdown` してから WSL を起動し直してください。\n\n### 2. インストール\n\n#### グローバルインストール（推奨）\n\n`uv tool install` でグローバルにインストールすると、どのディレクトリからでも `yomitoku-rocm` と `yomitoku-rocm-doctor` を呼べます。\n\n```bash\ngit clone https://github.com/r4ai/yomitoku-rocm\ncd yomitoku-rocm\nuv tool install .\n```\n\nインストール後、`~/.local/bin` にコマンドが追加されます。PATH が通っているか確認してください:\n\n```bash\nwhich yomitoku-rocm\n```\n\n通っていない場合は `~/.local/bin` を PATH に追加します:\n\n```bash\n# bash / zsh\necho 'export PATH=\"$HOME/.local/bin:$PATH\"' \u003e\u003e ~/.bashrc\n\n# fish\nfish_add_path ~/.local/bin\n```\n\nGPU 検出に必要な環境変数をシェルの設定に追加します（`mise run` を経由しない場合に必要）:\n\n```bash\n# bash / zsh\necho 'export HSA_ENABLE_DXG_DETECTION=1' \u003e\u003e ~/.bashrc\n\n# fish\nset -Ux HSA_ENABLE_DXG_DETECTION 1\n```\n\n#### 開発者向けセットアップ（mise + uv）\n\n```bash\nmise install\nmise run sync\n```\n\n### 3. 動作確認\n\n```bash\nyomitoku-rocm-doctor\n# または開発環境では:\nmise run doctor\n```\n\n以下を確認します:\n\n- `/dev/dxg` が存在する\n- `rocminfo` が使える\n- `torch.version.hip` が ROCm ビルドを示す\n- `torch.cuda.is_available()` が `True`\n- `yomitoku` の import と CLI 起動ができる\n\n## 使い方\n\n`yomitoku-rocm` は `yomitoku` CLI への透過的なラッパーです。引数はそのまま yomitoku に転送されます。\n\n```bash\nyomitoku-rocm --help\n```\n\nページ数の多い PDF には `yomitoku-pdf` を使います。PDF をデフォルト 10 ページ単位のチャンクに分けて OCR し、最後に 1 つの出力へ結合します。\n\n```bash\nyomitoku-pdf large.pdf -o results -f pdf -d cuda\n```\n\n実行中は進捗バー・完了ページ数・進捗率・経過時間・1 ページあたりの処理速度・残り時間・予想終了時刻と、直近のチャンク結果をライブ表示します。チャンク内のページ単位の進捗もサブバーで表示し、yomitoku 本体のログは末尾数行だけを枠付きエリアにまとめて表示します（画面を流れ続けません）。チャンクが失敗したときは末尾のログを表示します。途中で停止した場合は、同じ PDF・チャンクサイズ・出力形式で再実行すると `results/.yomitoku-pdf/\u003cfingerprint\u003e/manifest.json` をもとに完了済みチャンクをスキップして再開します。正常完了後はこの作業ディレクトリを自動削除します。\n\n実行中に `Ctrl+C` で中断すると、処理中の yomitoku を停止して終了します。完了済みチャンクは保存されているため、同じコマンドで再実行すれば続きから再開できます。\n\nパイプやファイルへリダイレクトした場合（非対話端末）は、1 イベント 1 行のプレーンな進捗ログへ自動で切り替わります。\n\n```bash\n# 20 ページ単位に変更\nyomitoku-pdf large.pdf --chunk-size 20 -o results -f pdf -d cuda\n\n# yomitoku の生ログをそのまま流す（進捗ダッシュボードは無効）\nyomitoku-pdf large.pdf --verbose -o results -f pdf -d cuda\n\n# デバッグ用に途中成果物を残す\nyomitoku-pdf large.pdf --keep-workdir -o results -f pdf -d cuda\n\n# 保存済み進捗を使わず最初から実行\nyomitoku-pdf large.pdf --no-resume -o results -f pdf -d cuda\n```\n\n`yomitoku-pdf` はグローバルインストール後に直接実行した場合も、子プロセスに `HSA_ENABLE_DXG_DETECTION=1` を自動で渡します。\n\n### グローバルインストール後\n\n```bash\n# searchable PDF を作成\nyomitoku-rocm sample.pdf -o results -f pdf -d cuda --combine\n\n# Markdown を作成（図も抽出）\nyomitoku-rocm sample.pdf -o results -f md -d cuda --combine --figure\n\n# CPU で動作確認（GPU なし環境）\nyomitoku-rocm sample.pdf -o results -f md --lite -d cpu\n\n# 巨大 PDF を分割処理して searchable PDF を作成\nyomitoku-pdf large.pdf -o results -f pdf -d cuda\n```\n\n### mise 経由（開発環境）\n\n```bash\nmise run ocr -- sample.pdf -o results -f pdf -d cuda --combine\nmise run ocr-pdf -- large.pdf -o results -f pdf -d cuda\n```\n\n`mise run ocr` は `uv run yomitoku` を直接呼びます。`HSA_ENABLE_DXG_DETECTION=1` も自動的に設定されます。\n\n## 依存関係について\n\nPyTorch 関連パッケージは `https://download.pytorch.org/whl/rocm7.2` から取得するよう `pyproject.toml` で明示しています。2026-06-14 時点でこの index の Python 3.12 向け互換セットとして `torch==2.11.0`、`torchvision==0.26.0`、`torchaudio==2.11.0` を固定しています。\n\n## トラブルシュート\n\n**`rocminfo` が見つからない**\n\nWSL 側の ROCm パッケージ導入が未完了です。Ubuntu 標準リポジトリの古い `rocminfo` ではなく、AMD の ROCm 7.2.x / ROCDXG 手順に沿って導入してください。\n\n**`torch.cuda.is_available()` が `False`**\n\n以下を順に確認してください:\n\n1. `/dev/dxg` が存在するか\n2. `rocminfo` で GPU agent が表示されるか\n3. Windows 側の Adrenalin Edition ドライバが正しくインストールされているか\n4. `wsl --shutdown` 後に WSL を起動し直したか\n\n**グローバルインストール後に GPU が検出されない**\n\n`HSA_ENABLE_DXG_DETECTION=1` がシェル環境に設定されているか確認してください。`mise run` 経由の場合は `mise.toml` で自動設定されますが、直接 `yomitoku-rocm` を呼ぶ場合はシェルの設定ファイルへの追加が必要です（[セットアップ手順を参照](#2-インストール)）。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr4ai%2Fyomitoku-rocm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr4ai%2Fyomitoku-rocm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr4ai%2Fyomitoku-rocm/lists"}