Mokuro: Read Japanese manga with selectable text inside a browser

Although I didn’t use the benchmark tool, here’s what the stats are looking like for me, running the same set of volumes through:

If my math isn’t off, that’s 32.3 minutes versus 7.2 minutes in 40px-Menu_HOME_0399’s favor.

that looks like CUDA to me, im getting ~3it/s on mine most of the time xddd

oh well, i don’t know if i should try to merge it upstream knowing it’s optimized for only a specific class of devices and other devices might choke on it, or should i just leave it as a “if you can afford to run a faster mokuro, here’s one”.

Yup! And the speed-up is crazy (as you can see with the totals I gave).

If your fork doesn’t add anything that strays from the base Mokuro’s purpose, I’d recommend filing a PR for it.

I’m not certain the best way to go about this (AI will), but essentially I figure it’d be a PR for the code changes without touching the readme (much).

honestly curious about trying this but the thought of getting another version of mokuro installed (forked or not) given the past hassle makes me too nervous to try :scream:

the risk of messing up the existing install along with having nothing working :cry:

speed is nice but not mokuring (verb? haha) large quantities of stuff and not in that much of a hurry

If you’re comfortable with the wait and don’t use Mokuro often, I’d say there’s certainly no harm in keeping what you currently have in place.

On my end, I use it enough that it can make a big impact…except that everything I run through Mokuro I then run through Ichiran, and Ichiran is the bottleneck. So running Mokuro faster won’t actually have a big impact on my typical workflow.

This is in no way a trap!

NO :man_gesturing_no:

:rofl::rofl::rofl::rofl:

What is Ichiran? I can’t find it anywhere on the internet, I’d be curious to look at it something something high score in DeepSWE models :eyes:

now you have done it…
time for you to build out the word/freq counts

more late nights for you :wink:

It’s what powers the ichi.moe website:

I (and I think @Phryne as well) use it to take Japanese sentences (output from Mokuro) and split them out into individual words (plus additional info that I don’t utilize beyond the JMDict ID).

sounds like what you might need is not more intelligence, but a loooooot more tokens to burn:

the endpoint i have for deepseek v4 flash has no limits on the daily usage, and deepseek harness is self-healing, so it always keeps converging until all tests are green, so i could leave it to run for a few days, but i’m definitely scared of rewrites where the result is -50,000 +100,000 lines of code, especially on the tools i don’t know :sob:

If your nickname is the same as on WaniKani, then I might have sent you a Discord invite, I have a promising update that could be fun to look into before I’d make a proper git tree/locate other optimizations, but if you’d like to stay here, that’s okay too ^^

image

(ps. real talk, i’d love for a japanese sentence tokenizer like this to be added to either MaruDex or Yomitan.......)

I mentioned your Mokuro fork on the Mokuro Reader Discord as well:

Still mulling over Ichiran to load everything to RAM (might take more RAM than my laptop has to support all the improvements), but in the meantime, a yet another version of the Mokuro fork has been released, and now it’s huge leagues of improvements:


This time, it’s been work of @Gnathonic, a developer of mokuro-reader, that I’m also interested in contributing to one day. A lot of improvements and a huge change to the OCRing engine that results in the exact same output as the kha-white’s original Mokuro.

Here you can download it for now:

But I’ve made a pull request into the original kha-white’s mokuro:

Of course, it’s insanely unfair to force them to read that much code and give up on their own implementation of manga-ocr in favor of a more performant one, so I could be happy maintaining the faster fork for a while, but we’ll see what kha-white says :eyes:

so many forks and spoons

I’m so confused … :man_shrugging:

Apologies if this is not the right thread for this, but I’m having a little trouble getting your mokuro-bridge installed properly for the bookwalker downloader (which is SO awesome by the way. Just super cool!!). When I run pip install -r requirements.txt I eventually get the below

install error
##prior to this install goes as it should
Building wheels for collected packages: unidic_lite, yattag
  Building wheel for unidic_lite (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for unidic_lite (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      /tmp/pip-build-env-cglimja4/overlay/lib/python3.13/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: MIT License
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        self._finalize_license_expression()
      error: could not write to 'build/lib/unidic_lite/dicdir/matrix.bin': No space left on device
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for unidic_lite
  Building wheel for yattag (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for yattag (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      /tmp/pip-build-env-rsece9uc/overlay/lib/python3.13/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
      
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
      
              License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
      
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
      
      !!
        self._finalize_license_expression()
      error: could not write to 'build/lib/yattag/simpledoc.py': No space left on device
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for yattag
Failed to build unidic_lite yattag
ERROR: Failed to build installable wheels for some pyproject.toml based projects (unidic_lite, yattag)

I have free space on my machine so I’m not sure why it says I don’t. When I try to just run the bridge anyway I get this

run error
Traceback (most recent call last):
  File "/home/gigazol/mokuro-bridge/server.py", line 41, in <module>
    from mokuro_bridge.api import app
  File "/home/gigazol/mokuro-bridge/mokuro_bridge/api.py", line 11, in <module>
    from fastapi import FastAPI, File, Form, HTTPException, UploadFile
ModuleNotFoundError: No module named 'fastapi'


I went and installed fastapi separately to see if that helped but no dice. Any thoughts? And thanks again for the downloader, it’s great!

I’ll try looking into this and updating you tomorrow, it’s pretty late today, but I’ll keep you in mind, thank you for reaching out!

No worries and totally no rush, thank you!!

The error you’ve highlighted has two lines to it:

error: could not write to 'build/lib/unidic_lite/dicdir/matrix.bin': No space left on device
error: could not write to 'build/lib/yattag/simpledoc.py': No space left on device

because the bridge is also relying on Mokuro and is accelerating its processing by feeing it data as quickly as possible, it also pulls Mokuro dependencies:

torch                    2.14.0         554.6 MB
triton                   3.8.0          248.0 MB
cuda-bindings            13.4.1           6.9 MB
nvidia-cudnn-cu13        9.26.0.51      519.2 MB
nvidia-cusparselt-cu13   0.9.1          171.5 MB
nvidia-nccl-cu13         2.31.2         252.4 MB
nvidia-nvshmem-cu13      3.7.2          135.4 MB
nvidia-cublas            13.7.0.27      440.5 MB
nvidia-cuda-runtime      13.4.49          2.5 MB
nvidia-cuda-nvrtc        13.4.59         53.3 MB
nvidia-cufft             12.4.0.34      161.8 MB
nvidia-cusolver          12.3.2.15      265.6 MB
nvidia-cusparse          12.8.6.49      170.5 MB
nvidia-curand            10.4.4.49       61.5 MB
nvidia-nvjitlink         13.4.52         42.5 MB
nvidia-nvtx              13.4.49          0.2 MB
nvidia-cufile            1.19.0.109       1.5 MB
nvidia-cuda-cupti        13.4.58         13.1 MB

those are the same dependencies you would be using if you were using a CUDA fork of Mokuro, also in this thread above. The dependencies are dependencies of a library called torch, at the top, which is used for OCR. If you don’t have CUDA acceleration on your device and you know you’ll never hit the CUDA-accelerated path of mokuro scraping, you could avoid fetching all of the nvidia dependencies by using:

pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

instead of installing dependencies with an automated script.

Also, rel, I’m also always living on the edge and then freeing up like 20GB and then making it come back once again :sob:
image

ok, successfully installed torch and torchvision, but still got a similar error when trying to install:

error
Building wheels for collected packages: unidic_lite, yattag
Building wheel for unidic_lite (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for unidic_lite (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
/tmp/pip-build-env-damycjfg/overlay/lib/python3.13/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

          ********************************************************************************
          Please consider removing the following classifiers in favor of a SPDX license expression:
  
          License :: OSI Approved :: MIT License
  
          See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
          ********************************************************************************
  
  !!
    self._finalize_license_expression()
  error: could not write to 'build/lib/unidic_lite/dicdir/matrix.bin': No space left on device
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for unidic_lite
Building wheel for yattag (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for yattag (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
/tmp/pip-build-env-6uh0fwxx/overlay/lib/python3.13/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

          ********************************************************************************
          Please consider removing the following classifiers in favor of a SPDX license expression:
  
          License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
  
          See 
 for details.
          ********************************************************************************
  
  !!
    self._finalize_license_expression()
  error: could not write to 'build/lib/yattag/simpledoc.py': No space left on device
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for yattag
Failed to build unidic_lite yattag
ERROR: Failed to build installable wheels for some pyproject.toml based projects (unidic_lite, yattag)

On my other laptop I like to play the storage game, but this one is new to me so I haven’t had time to fill it up yet!

Hello, I’m also sorry if this is a bad place to post this but I am ALSO completely stuck on trying to get your fork of mokuro working. I have tried for about. 5 hours. over a couple of days and I am out of ideas. It appears that I am connected fine to the server but if I try and ping it it returns a 403 forbidden error. The bookwalker native downloader does not recognise that I’m connected to the server and I also can’t run mokuro on a local file using the bridge (it gives me the same forbidden error).


^ server connected but not recognised by plugin (the plugin works great just for downloading with no OCR though, amazing)

If I try and ping the server myself, I get some more info:

For completion’s sake, if I try and run mokuro via bridge locally:

ANY clue what I’m doing wrong here? I would loooove to be able to use this tool. Sorry to bother.