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

_pickle.UnpicklingError: invalid load key, 'v'. 错误 #90

Open
724852499 opened this issue Aug 15, 2024 · 13 comments
Open

_pickle.UnpicklingError: invalid load key, 'v'. 错误 #90

724852499 opened this issue Aug 15, 2024 · 13 comments

Comments

@724852499
Copy link

root@ca9782e90bf9:/home/pdf/PDF-Extract-Kit# python pdf_extract.py --pdf /home/pdf/test.pdf
Namespace(pdf='/home/pdf/test.pdf', output='output', vis=False, render=False)
2024-08-15 17:08:10
Started!
Traceback (most recent call last):
File "/home/pdf/PDF-Extract-Kit/pdf_extract.py", line 98, in
mfd_model = mfd_model_init(model_configs['model_args']['mfd_weight'])
File "/home/pdf/PDF-Extract-Kit/pdf_extract.py", line 31, in mfd_model_init
mfd_model = YOLO(weight)
File "/usr/local/lib/python3.10/site-packages/ultralytics/models/yolo/model.py", line 23, in init
super().init(model=model, task=task, verbose=verbose)
File "/usr/local/lib/python3.10/site-packages/ultralytics/engine/model.py", line 142, in init
self._load(model, task=task)
File "/usr/local/lib/python3.10/site-packages/ultralytics/engine/model.py", line 294, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
File "/usr/local/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 "/usr/local/lib/python3.10/site-packages/ultralytics/nn/tasks.py", line 781, in torch_safe_load
ckpt = torch.load(file, map_location="cpu")
File "/usr/local/lib/python3.10/site-packages/ultralytics/utils/patches.py", line 86, in torch_load
return _torch_load(*args, **kwargs)
File "/usr/local/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 "/usr/local/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'.
执行命令报错,什么原因呢

@myhloli
Copy link
Collaborator

myhloli commented Aug 15, 2024

模型下载不完整,请检查模型文件大小和网页上是否一致,如果大小一致,可以进一步通过sha256确认是否下载完整。

@724852499
Copy link
Author

重新删除 下载还是有这个问题,能告知是哪个模型出错呢

@myhloli
Copy link
Collaborator

myhloli commented Aug 15, 2024

重新删除 下载还是有这个问题,能告知是哪个模型出错呢

通过文件大小比对一下呢?大小不一致的就是有问题的

@724852499
Copy link
Author

image

@myhloli
Copy link
Collaborator

myhloli commented Aug 15, 2024

image

大小太小了,确认下自己是不是没安装git lfs

@724852499
Copy link
Author

可以下载了,下载下来有点大啊,磁盘都装不下了,模型有多大呢,是必须全不下载还是可以选择一部分模型呢

@myhloli
Copy link
Collaborator

myhloli commented Aug 15, 2024

约6GB,需要全部下载

@724852499
Copy link
Author

image
image
模型下载下来了,但提取这个错呢,是下载的模型有问题呢?

@ouyanglinke
Copy link
Collaborator

你看看你下载的这个模型多大,可能没下载完整

@724852499
Copy link
Author

下完整了,后面发现是内存不够加载模型报的错误信息

@724852499
Copy link
Author

如果只想使用cpu,不使用gpu,需要怎么操作呢

@myhloli
Copy link
Collaborator

myhloli commented Aug 21, 2024

如果只想使用cpu,不使用gpu,需要怎么操作呢

参考这个文档:https://github.com/opendatalab/PDF-Extract-Kit/blob/main/docs/Install_in_Windows_zh_cn.md#3修改config-使用cpu推理
修改两个地方的cuda为cpu

@724852499
Copy link
Author

好的,十分感谢

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