microsoft / unilm

Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities
https://aka.ms/GeneralAI
MIT License
20.1k stars 2.55k forks source link

Example run_xfun_re.py doesn't work #954

Open MichalTurski opened 1 year ago

MichalTurski commented 1 year ago

Describe the bug Model I am using (UniLM, MiniLM, LayoutLM ...): probably LayoutXLM, but I don't think it matters.

The problem arises when using:

Example script does not run:

$ python run_xfun_re.py
Traceback (most recent call last):
  File "run_xfun_re.py", line 11, in <module>
    import layoutlmft.data.datasets.xfun
  File "/data/mturski/projects/unilm/layoutlmft/layoutlmft/__init__.py", line 3, in <module>
    from transformers import CONFIG_MAPPING, MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING, MODEL_NAMES_MAPPING, TOKENIZER_MAPPING
  File "/data/mturski/anaconda3/envs/layoutlmft/lib/python3.7/site-packages/transformers/__init__.py", line 43, in <module>
    from . import dependency_versions_check
  File "/data/mturski/anaconda3/envs/layoutlmft/lib/python3.7/site-packages/transformers/dependency_versions_check.py", line 41, in <module>
    require_version_core(deps[pkg])
  File "/data/mturski/anaconda3/envs/layoutlmft/lib/python3.7/site-packages/transformers/utils/versions.py", line 101, in require_version_core
    return require_version(requirement, hint)
  File "/data/mturski/anaconda3/envs/layoutlmft/lib/python3.7/site-packages/transformers/utils/versions.py", line 92, in require_version
    if want_ver is not None and not ops[op](version.parse(got_ver), version.parse(want_ver)):
  File "/data/mturski/anaconda3/envs/layoutlmft/lib/python3.7/site-packages/packaging/version.py", line 52, in parse
    return Version(version)
  File "/data/mturski/anaconda3/envs/layoutlmft/lib/python3.7/site-packages/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '0.10.1,<0.11'

I wanted to reproduce runs on XFUND relation extraction to see how training samples are created. However, example script doesn't work.

To Reproduce Steps to reproduce the behavior:

  1. Follow instructions in layoutlmft to install it.
  2. Run example script python run_xfun_re.py (I'm not sure if running without any arguments is correct, but there is a problem in imports, so arguments shouldn't matter).

Expected behavior Example script does not fail and does train the model.

huntekah commented 1 year ago

I have the same problem. Afaik its related to the wrong tokenizers version, but didn't manage to fix it yet ;)

tuan-vmt commented 1 year ago

I reinstalled python 3.6.it worked for me

hoangnv173908 commented 1 year ago

I reinstalled python 3.6.it worked for me

thanks a lot

hoangnv173908 commented 1 year ago

pip install packaging==20.9 sloved this problem above