tensorflow / tensorflow/datasets

`tfds.load('huggingface:conll2003')` failed with `AttributeError: module 'datasets' has no attribute 'logging'`

Open
#3,712 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug contributions welcome
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

Short description
tfds.load('huggingface:conll2003') will fails with:

/usr/local/lib/python3.7/dist-packages/tensorflow_datasets/core/load.py in load(name, split, data_dir, batch_size, shuffle_files, download, as_supervised, decoders, read_config, with_info, builder_kwargs, download_and_prepare_kwargs, as_dataset_kwargs, try_gcs)
    320     builder_kwargs = {}
    321 
--> 322   dbuilder = builder(name, data_dir=data_dir, try_gcs=try_gcs, **builder_kwargs)
    323   if download:
    324     download_and_prepare_kwargs = download_and_prepare_kwargs or {}

/usr/local/lib/python3.7/dist-packages/tensorflow_datasets/core/load.py in builder(name, try_gcs, **builder_kwargs)
    149   # First check whether code exists or not
    150   try:
--> 151     cls = builder_cls(str(name))
    152   except registered.DatasetNotFoundError as e:
    153     cls = None  # Class not found

/usr/local/lib/python3.7/dist-packages/tensorflow_datasets/core/load.py in builder_cls(name)
     90       # `namespace:dataset` are loaded from the community register
     91       if visibility.DatasetType.COMMUNITY_PUBLIC.is_available():
---> 92         return community.community_register.builder_cls(ds_name)
     93       else:
     94         raise ValueError(

/usr/local/lib/python3.7/dist-packages/tensorflow_datasets/core/community/register_package.py in builder_cls(self, name)
    245 
    246     # Load the dataset from the module
--> 247     return load.builder_cls_from_module(installed_dataset.module_name)
    248 
    249   def builder(

/usr/local/lib/python3.7/dist-packages/tensorflow_datasets/core/community/load.py in builder_cls_from_module(module_name)
     44     with registered.skip_registration(),\
     45          huggingface_wrapper.mock_huggingface_import():
---> 46       importlib.import_module(module_name)
     47       # TODO(tfds): For community-installed modules, we should raise cleaner
     48       # error if there is additional missing dependency. E.g. Parsing all

/usr/lib/python3.7/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

/usr/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/usr/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)

/usr/lib/python3.7/importlib/_bootstrap_external.py in exec_module(self, module)

/usr/lib/python3.7/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

/root/.cache/tensorflow_datasets/modules/tfds_community/huggingface/conll2003/e29e078fa45753a86b4e437516e29eefc9d895074159c67c80f7c927f162b478/conll2003.py in <module>()
     22 
     23 
---> 24 logger = datasets.logging.get_logger(__name__)
     25 
     26 

AttributeError: module 'datasets' has no attribute 'logging'

Environment information

  • Operating System: Ubuntu 18.04.5 LTS

  • Python version: 3.7.12

  • tensorflow-datasets/tfds-nightly version: 4.5.0

  • tensorflow/tf-nightly version: 2.7.0

  • Does the issue still exists with the last tfds-nightly package (pip install --upgrade tfds-nightly) ? Yes

Reproduction instructions

See this Colab: https://colab.research.google.com/drive/1ocgFGN3xRkwbt7afmjyhjRuHCZcJO5-L?usp=sharing

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Colab reproduction and inspect tensorflow_datasets/core/community/load.py, tensorflow_datasets/core/community/register_package.py, and the conll2003.py stack-trace entry. Trace the Hugging Face datasets dependency and verify that tfds.load('huggingface:conll2003') completes without the AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python, tensorflow
Domain
data, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.