Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pydantic_core._pydantic_core.ValidationError: 1 validation error for InitSchema | Windows, Python 3.11.5 #236

Open
YodaGitMaster opened this issue Aug 5, 2024 · 3 comments

Comments

@YodaGitMaster
Copy link

  1. pip install git+https://github.com/facebookresearch/nougat
  2. nougat pdfs/1.pdf -o output
    Error:
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\x\Desktop\OCR_Doc_llamaindex\.env\Scripts\nougat.exe\__main__.py", line 4, in <module>
  File "C:\Users\x\Desktop\OCR_Doc_llamaindex\.env\Lib\site-packages\predict.py", line 18, in <module>
    from nougat import NougatModel
  File "C:\Users\gamin\Desktop\OCR_Doc_llamaindex\.env\Lib\site-packages\nougat\__init__.py", line 7, in <module>
    from .model import NougatConfig, NougatModel
  File "C:\Users\x\Desktop\OCR_Doc_llamaindex\.env\Lib\site-packages\nougat\model.py", line 34, in <module>
    from nougat.transforms import train_transform, test_transform
  File "C:\Users\x\Desktop\OCR_Doc_llamaindex\.env\Lib\site-packages\nougat\transforms.py", line 146, in <module>
    alb.ElasticTransform(
  File "C:\Users\x\Desktop\OCR_Doc_llamaindex\.env\Lib\site-packages\albumentations\core\validation.py", line 35, in custom_init
    config = dct["InitSchema"](**full_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\x\Desktop\OCR_Doc_llamaindex\.env\Lib\site-packages\pydantic\main.py", line 193, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for InitSchema
alpha_affine
  Input should be None [type=none_required, input_value=1.2, input_type=float]
    For further information visit https://errors.pydantic.dev/2.8/v/none_required
@YodaGitMaster YodaGitMaster changed the title Windows, Python 3.11.5 pydantic_core._pydantic_core.ValidationError: 1 validation error for InitSchema | Windows, Python 3.11.5 Aug 5, 2024
@Halle-Astra
Copy link

same problem, it's hard to find the solution

@Halle-Astra
Copy link

File "/home/halle/programs/nougat/predict.py", line 18, in <module>
    from nougat import NougatModel
  File "/home/halle/programs/nougat/nougat/__init__.py", line 7, in <module>
    from .model import NougatConfig, NougatModel
  File "/home/halle/programs/nougat/nougat/model.py", line 34, in <module>
    from nougat.transforms import train_transform, test_transform
  File "/home/halle/programs/nougat/nougat/transforms.py", line 146, in <module>
    alb.ElasticTransform(
  File "/home/halle/miniconda3/envs/nougat/lib/python3.10/site-packages/albumentations-1.4.13-py3.10.egg/albumentations/core/validation.py", line 35, in custom_init
    config = dct["InitSchema"](**full_kwargs)
  File "/home/halle/miniconda3/envs/nougat/lib/python3.10/site-packages/pydantic/main.py", line 175, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for InitSchema
alpha_affine
  Input should be None [type=none_required, input_value=1.2, input_type=float]

Ok, it's all fine after my arbitrary trying pip install albumentations==1.0 since the problem is emitted from albumentations after thinking carefully.

(nougat) halle@halle-MECHREVO:~/programs/nougat$ nougat --help 
WARNING:root:No GPU found. Conversion on CPU is very slow.
usage: nougat [-h] [--batchsize BATCHSIZE] [--checkpoint CHECKPOINT]
              [--model MODEL] [--out OUT] [--recompute] [--full-precision]
              [--no-markdown] [--markdown] [--no-skipping] [--pages PAGES]
              pdf [pdf ...]

positional arguments:
  pdf                   PDF(s) to process.

options:
  -h, --help            show this help message and exit
  --batchsize BATCHSIZE, -b BATCHSIZE
                        Batch size to use.
  --checkpoint CHECKPOINT, -c CHECKPOINT
                        Path to checkpoint directory.
  --model MODEL, -m MODEL
                        Model tag to use.
  --out OUT, -o OUT     Output directory.
  --recompute           Recompute already computed PDF, discarding previous
                        predictions.
  --full-precision      Use float32 instead of bfloat16. Can speed up CPU
                        conversion for some setups.
  --no-markdown         Do not add postprocessing step for markdown
                        compatibility.
  --markdown            Add postprocessing step for markdown compatibility
                        (default).
  --no-skipping         Don't apply failure detection heuristic.
  --pages PAGES, -p PAGES
                        Provide page numbers like '1-4,7' for pages 1 through
                        4 and page 7. Only works for single PDF input.

@she3o
Copy link

she3o commented Aug 16, 2024

Ok, it's all fine after my arbitrary trying pip install albumentations==1.0 since the problem is emitted from albumentations after thinking carefully.

This is the answer. And it does not work with other version for me, only 1.0.

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

No branches or pull requests

3 participants