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

ImportError: cannot import name 'VerificationMode' from 'datasets' #844

Open
StochasticGame opened this issue Apr 25, 2024 · 3 comments
Open
Assignees
Labels

Comments

@StochasticGame
Copy link

Thanks for your error report and we appreciate it a lot.

Checklist

  • I have searched the tutorial on modelscope doc-site
  • I have searched related issues but cannot get the expected help.
  • The bug has not been fixed in the latest version.

Describe the bug

root@f3db3488eed3:/ocr/modelscope# python demo.py
2024-04-25 16:25:52,412 - modelscope - INFO - PyTorch version 1.11.0+cpu Found.
2024-04-25 16:25:52,415 - modelscope - INFO - Loading ast index from /mnt/workspace/.cache/modelscope/ast_indexer
2024-04-25 16:25:52,415 - modelscope - INFO - No valid ast index found from /mnt/workspace/.cache/modelscope/ast_indexer, generating ast index from prebuilt!
2024-04-25 16:25:52,526 - modelscope - INFO - AST-Scanning the path "/ocr/modelscope/modelscope" with the following sub folders ['models', 'metrics', 'pipelines', 'preprocessors', 'trainers', 'msdatasets', 'exporters']
2024-04-25 16:26:21,531 - modelscope - INFO - Scanning done! A number of 976 components indexed or updated! Time consumed 29.115567445755005s
2024-04-25 16:26:21,615 - modelscope - INFO - Loading done! Current index file version is 1.9.4, with md5 b2983ccde06655d34203dbe3e7355438 and a total number of 976 components indexed
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /ocr/modelscope/demo.py:1 in │
│ │
│ ❱ 1 from modelscope.pipelines import pipeline │
│ 2 from modelscope.utils.constant import Tasks │
│ 3 import cv2 │
│ 4 │
│ │
│ /ocr/modelscope/modelscope/pipelines/init.py:4 in │
│ │
│ 1 # Copyright (c) Alibaba, Inc. and its affiliates. │
│ 2 │
│ 3 from . import audio, cv, multi_modal, nlp │
│ ❱ 4 from .base import Pipeline │
│ 5 from .builder import pipeline │
│ 6 │
│ │
│ /ocr/modelscope/modelscope/pipelines/base.py:16 in │
│ │
│ 13 from packaging import version │
│ 14 │
│ 15 from modelscope.models.base import Model │
│ ❱ 16 from modelscope.msdatasets import MsDataset │
│ 17 from modelscope.outputs import TASK_OUTPUTS, ModelOutputBase │
│ 18 from modelscope.pipeline_inputs import TASK_INPUTS, check_input_type │
│ 19 from modelscope.preprocessors import Preprocessor │
│ │
│ /ocr/modelscope/modelscope/msdatasets/init.py:2 in │
│ │
│ 1 # Copyright (c) Alibaba, Inc. and its affiliates. │
│ ❱ 2 from .ms_dataset import MsDataset │
│ 3 │
│ │
│ /ocr/modelscope/modelscope/msdatasets/ms_dataset.py:24 in │
│ │
│ 21 from modelscope.msdatasets.dataset_cls.custom_datasets.builder import \ │
│ 22 │ build_custom_dataset │
│ 23 from modelscope.msdatasets.utils.delete_utils import DatasetDeleteManager │
│ ❱ 24 from modelscope.msdatasets.utils.hf_datasets_util import load_dataset_with_ctx │
│ 25 from modelscope.msdatasets.utils.upload_utils import DatasetUploadManager │
│ 26 from modelscope.preprocessors import build_preprocessor │
│ 27 from modelscope.utils.config import Config, ConfigDict │
│ │
│ /ocr/modelscope/modelscope/msdatasets/utils/hf_datasets_util.py:15 in │
│ │
│ 12 from urllib.parse import urlencode │
│ 13 │
│ 14 import requests │
│ ❱ 15 from datasets import (BuilderConfig, Dataset, DatasetBuilder, DatasetDict, │
│ 16 │ │ │ │ │ DownloadConfig, DownloadManager, DownloadMode, Features, │
│ 17 │ │ │ │ │ IterableDataset, IterableDatasetDict, Split, │
│ 18 │ │ │ │ │ VerificationMode, Version, config, data_files) │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'VerificationMode' from 'datasets' (/opt/conda/lib/python3.7/site-packages/datasets/init.py)

To Reproduce

  • What command or script did you run?
    Using docker environment: registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-py37-torch1.11.0-tf1.15.5-1.6.1
    Run python script:

      from modelscope.pipelines import pipeline
      from modelscope.utils.constant import Tasks
      import cv2
    
      ocr_recognition = pipeline(Tasks.ocr_recognition, model='damo/cv_convnextTiny_ocr-recognition-general_damo')
      
      ### 使用url
      img_url = 'http://duguang-labelling.oss-cn-shanghai.aliyuncs.com/mass_img_tmp_20220922/ocr_recognition.jpg'
      result = ocr_recognition(img_url)
      print(result)
    

Your Environments (required)

  • NAME="Ubuntu"
  • VERSION="20.04.6 LTS (Focal Fossa)"
  • ID=ubuntu
  • ID_LIKE=debian
  • PRETTY_NAME="Ubuntu 20.04.6 LTS"
  • VERSION_ID="20.04"

Please @ corresponding people according to your problem:

Model related: @wenmengzhou @tastelikefeet

Model hub related: @liuyhwangyh

Dataset releated: @wangxingjun778

Finetune related: @tastelikefeet @Jintao-Huang

Pipeline related: @Firmament-cyou @wenmengzhou

Contribute your model: @zzclynn

@wangxingjun778
Copy link
Collaborator

Please update your env settings:

modelscope==1.14.0
datasets==2.18.0

or update to the latest docker image version.

@StochasticGame
Copy link
Author

Please update your env settings:请更新您的环境设置:

modelscope==1.14.0 模型范围==1.14.0 datasets==2.18.0  数据集==2.18.0

or update to the latest docker image version.或更新到最新的 docker 镜像版本。

Using docker environment:registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-py38-torch2.0.1-tf2.13.0-1.9.5

update env settings: modelscope==1.14.0; datasets==2.18.0

Run successfully!Thanks!

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants