chineseocr / trocr-chinese

transformers ocr for chinese
337 stars 53 forks source link

onnx模型转化问题 #52

Open HGZH990 opened 1 month ago

HGZH990 commented 1 month ago

(pytorch2.0.1zh) zh@inspur:~/TrOCR$ python -m transformers.onnx --model ./cust-data/weights/ --feature=vision2seq-lm --framework=pt --preprocessor=tokenizer --atol 1e-4 hand-write-onnx usage: Hugging Face Transformers ONNX exporter [-h] -m MODEL [--feature {causal-lm,causal-lm-with-past,default,default-with-past,image-classification,masked-im,masked-lm,multiple-choice,question-answering,seq2seq-lm,seq2seq-lm-with-past,sequence-classification,token-classification}] [--opset OPSET] [--atol ATOL] [--framework {pt,tf}] [--cache_dir CACHE_DIR] [--preprocessor {auto,tokenizer,feature_extractor,processor}] output Hugging Face Transformers ONNX exporter: error: argument --feature: invalid choice: 'vision2seq-lm' (choose from 'causal-lm', 'causal-lm-with-past', 'default', 'default-with-past', 'image-classification', 'masked-im', 'masked-lm', 'multiple-choice', 'question-answering', 'seq2seq-lm', 'seq2seq-lm-with-past', 'sequence-classification', 'token-classification')

transformers.onnx的--feature里面没有vision2seq-lm,如何解决

HGZH990 commented 1 month ago

我的环境是这样的 accelerate 0.32.1 aiohttp 3.9.5 aiosignal 1.3.1 async-timeout 4.0.3 attrs 23.2.0 certifi 2024.6.2 charset-normalizer 2.0.4 click 8.1.7 cmake 3.30.0 datasets 2.20.0 dill 0.3.8 filelock 3.13.1 frozenlist 1.4.1 fsspec 2024.5.0 huggingface-hub 0.23.4 idna 3.7 Jinja2 3.1.4 jiwer 2.3.0 joblib 1.4.2 lit 18.1.8 MarkupSafe 2.1.3 mpmath 1.3.0 multidict 6.0.5 multiprocess 0.70.16 networkx 3.3 numpy 1.23.5 opencv-python 4.10.0.84 packaging 24.1 pandas 2.2.2 pillow 10.4.0 pip 24.0 psutil 6.0.0 pyarrow 16.1.0 pyarrow-hotfix 0.6 python-dateutil 2.9.0.post0 python-Levenshtein 0.12.2 pytz 2024.1 PyYAML 6.0.1 regex 2024.5.15 requests 2.32.3 sacremoses 0.1.1 safetensors 0.4.3 scikit-learn 1.5.1 scipy 1.14.0 sentencepiece 0.1.96 setuptools 69.5.1 six 1.16.0 sympy 1.12.1 threadpoolctl 3.5.0 tokenizers 0.12.1 torch 2.0.1+cu118 torchaudio 2.0.2+cu118 torchvision 0.15.2+cu118 tqdm 4.66.4 transformers 4.20.0 triton 2.0.0 typing_extensions 4.11.0 tzdata 2024.1 urllib3 2.2.2 wheel 0.43.0 xxhash 3.4.1 yarl 1.9.4