1、layoutlm系列的预训练权重全都是放在huggingface上面,安装官方教程如果下载失败,可以在linux系统下载,然后将下载的缓存文件保存。或者在官网上下载并保存。需要下载的文件如下图。
2、将官方提供的xfun数据集下载,结果如下:
│── data
│ ├── zh.train.json
│ ├── zh.val.json
│ └── images
│ ├── zh_train_*.jpg
│ └── zh_val_*.jpg
3、按照官方教程安装,但是layoutlmv3的requirements里面的安装包版本过低,会报错‘No huggingface_hub attribute hf_api’,需要改为一下版本后安装:
datasets==2.3.2
evaluate==0.1.2
huggingface-hub==0.8.1
response==0.5.0
tokenizers==0.10.1
transformers==4.12.5
seqeval==1.2.2
deepspeed==0.5.7(有GPU才需要安装,没有GPU不需要安装)
tensorboard==2.7.0
seqeval==1.2.2
sentencepiece
timm==0.4.12
Pillow
einops
textdistance
shapely
4、Detectron2 如果最后set up失败,需要按照官网提供的一下方式安装Detectron2 :
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
# (add --user if you don't have permission)
# Or, to install it from a local clone:(本人用此方法解决)
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
# On macOS, you may need to prepend the above commands with a few environment variables:
CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install ...
5、报错出现 'gbk' codec can't decode byte
找到对应的位置xfun.py加上 encoding='utf-8' 即可。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)