Package Details: pix2tex 0.1.2-2

Git Clone URL: https://aur.archlinux.org/pix2tex.git (read-only, click to copy)
Package Base: pix2tex
Description: Using a ViT to convert images of equations into LaTeX code
Upstream URL: https://github.com/lukas-blecher/LaTeX-OCR
Licenses: MIT
Conflicts: python-pix2tex
Provides: latexocr, pix2tex, python-pix2tex
Replaces: python-pix2tex
Submitter: AlphaJack
Maintainer: AlphaJack
Last Packager: AlphaJack
Votes: 1
Popularity: 0.001813
First Submitted: 2023-11-04 09:39 (UTC)
Last Updated: 2024-06-02 23:46 (UTC)

Latest Comments

krvkir commented on 2024-08-25 17:16 (UTC) (edited on 2024-08-26 12:20 (UTC) by krvkir)

I get an error when I run pix2tex command:

Traceback (most recent call last):
  File "/usr/bin/pix2tex", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/pix2tex/__main__.py", line 28, in main
    main(arguments)
  File "/usr/lib/python3.12/site-packages/pix2tex/cli.py", line 224, in main
    model = LatexOCR(arguments)
            ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/pix2tex/cli.py", line 84, in __init__
    self.model.load_state_dict(torch.load(self.args.checkpoint, map_location=self.args.device))
  File "/usr/lib/python3.12/site-packages/torch/nn/modules/module.py", line 2189, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Model:
Missing key(s) in state_dict: "decoder.net.token_emb.emb.weight", "decoder.net.attn_layers.layers.0.0.0.weight" 
[... long list of missing keys ...]
Unexpected key(s) in state_dict: "decoder.net.token_emb.weight", "decoder.net.attn_layers.layers.0.0.weight", "decoder.net.attn_layers.layers.0.0.bias"
[... long list of keys it didn't expect to find ...]

Seems that pytorch expects the model file in some other format than provided in the package.

Could anyone give me a clue where the problem is? Is it in AUR package or in pix2tex python package itself?

PS When I run it inside docker using the image provided by package author, everything works fine, so the model files should be correct. Maybe PyTorch version is wrong?

MarsSeed commented on 2023-07-04 14:59 (UTC)

In accordance with Python package naming rules, please change pkgname in PKGBUILD to pix2tex, and resubmit under that name to AUR. Thank you.

Freed commented on 2023-06-16 11:14 (UTC)

@lfajtak I have a long time not to use this program. I've added you to maintainer and if something cannot work, you can do some fix instantly.

lfajtak commented on 2022-12-19 11:06 (UTC) (edited on 2022-12-19 11:07 (UTC) by lfajtak)

Upon install, I noticed the following missing dependencies:

  • gnome-screenshot (optional)
  • python-screeninfo
  • python-pynput
  • python-pyqt5-webengine