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

使用magic-pdf pdf-command 转换时报错 #143

Closed
anfernees-iphone opened this issue Jul 14, 2024 · 2 comments
Closed

使用magic-pdf pdf-command 转换时报错 #143

anfernees-iphone opened this issue Jul 14, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@anfernees-iphone
Copy link

Description of the bug | 错误描述

Traceback (most recent call last):
File "/mnt/gpt/anaconda3/envs/py310/bin/magic-pdf", line 8, in
sys.exit(cli())
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/magic_pdf/cli/magicpdf.py", line 325, in pdf_command
do_parse(
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/magic_pdf/cli/magicpdf.py", line 111, in do_parse
pipe.pipe_analyze()
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/magic_pdf/pipe/UNIPipe.py", line 29, in pipe_analyze
self.model_list = doc_analyze(self.pdf_bytes, ocr=False)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 69, in doc_analyze
custom_model = CustomPEKModel(ocr=ocr, show_log=show_log, models_dir=local_models_dir, device=device)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/magic_pdf/model/pdf_extract_kit.py", line 106, in init
self.mfd_model = mfd_model_init(str(os.path.join(models_dir, self.configs["weights"]["mfd"])))
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/magic_pdf/model/pdf_extract_kit.py", line 29, in mfd_model_init
mfd_model = YOLO(weight)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/ultralytics/models/yolo/model.py", line 23, in init
super().init(model=model, task=task, verbose=verbose)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/ultralytics/engine/model.py", line 149, in init
self._load(model, task=task)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/ultralytics/engine/model.py", line 230, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/ultralytics/nn/tasks.py", line 855, in attempt_load_one_weight
ckpt, weight = torch_safe_load(weight) # load ckpt
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/ultralytics/nn/tasks.py", line 781, in torch_safe_load
ckpt = torch.load(file, map_location="cpu")
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/torch/serialization.py", line 1040, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/mnt/gpt/anaconda3/envs/py310/lib/python3.10/site-packages/torch/serialization.py", line 1262, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.

How to reproduce the bug | 如何复现

magic-pdf pdf-command --pdf "test.pdf" --inside_model true

Operating system | 操作系统

Linux

Python version | Python 版本

3.10

Device mode | 设备模式

cpu

@anfernees-iphone anfernees-iphone added the bug Something isn't working label Jul 14, 2024
@WyHy
Copy link

WyHy commented Jul 14, 2024

我也出现了相同的错误,我是 cuda 模式

@WyHy
Copy link

WyHy commented Jul 15, 2024

@anfernees-iphone 找见问题了,应该是下载的模型文件有问题,你用git lfs或者huggingface-cli download重新下载模型文件试试

@myhloli myhloli closed this as completed Jul 15, 2024
@dt-yy dt-yy added the enhancement New feature or request label Jul 15, 2024
@myhloli myhloli added documentation Improvements or additions to documentation and removed bug Something isn't working enhancement New feature or request labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants