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

[BUG] Circular import with distilabel.distiset module #860

Closed
plaguss opened this issue Aug 7, 2024 · 0 comments · Fixed by #861
Closed

[BUG] Circular import with distilabel.distiset module #860

plaguss opened this issue Aug 7, 2024 · 0 comments · Fixed by #861
Assignees
Labels
bug Something isn't working

Comments

@plaguss
Copy link
Contributor

plaguss commented Aug 7, 2024

Describe the bug
We have a circular import problem with the distiset module

To Reproduce
Code to reproduce

>>> from distilabel.distiset import Distiset, create_distiset
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
│                                                                                                  │
│ /Users/agus/github_repos/argilla-io/distilabel/src/distilabel/distiset.py:32 in <module>         │
│                                                                                                  │
│    29 from pyarrow.lib import ArrowInvalid                                                       │
│    30 from typing_extensions import Self                                                         │
│    31                                                                                            │
│ ❱  32 from distilabel.pipeline.constants import STEP_ATTR_NAME                                   │
│    33 from distilabel.utils.card.dataset_card import (                                           │
│    34DistilabelDatasetCard,                                                                 │
│    35size_categories_parser,                                                                │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                  Any = typing.Any                                                            │ │
│ │         ArrowInvalid = <class 'pyarrow.lib.ArrowInvalid'>                                    │ │
│ │              Dataset = <class 'datasets.arrow_dataset.Dataset'>                              │ │
│ │      DatasetCardData = <class 'huggingface_hub.repocard_data.DatasetCardData'>               │ │
│ │                 Dict = typing.Dict                                                           │ │
│ │                Final = typing.Final                                                          │ │
│ │               fsspec = <module 'fsspec' from                                                 │ │
│ │                        '/Users/agus/github_repos/argilla-io/distilabel/.venv/lib/python3.11… │ │
│ │      hf_hub_download = <function hf_hub_download at 0x1376784a0>                             │ │
│ │                HfApi = <class 'huggingface_hub.hf_api.HfApi'>                                │ │
│ │ is_remote_filesystem = <function is_remote_filesystem at 0x14399cd60>                        │ │
│ │                 List = typing.List                                                           │ │
│ │         load_dataset = <function load_dataset at 0x1474579c0>                                │ │
│ │       load_from_disk = <function load_from_disk at 0x147457a60>                              │ │
│ │              logging = <module 'logging' from                                                │ │
│ │                        '/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework… │ │
│ │             Optional = typing.Optional                                                       │ │
│ │                 Path = <class 'pathlib.Path'>                                                │ │
│ │             PathLike = <class 'os.PathLike'>                                                 │ │
│ │            posixpath = <module 'posixpath' (frozen)>                                         │ │
│ │                   re = <module 're' from                                                     │ │
│ │                        '/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework… │ │
│ │                 Self = typing.Self                                                           │ │
│ │                  sys = <module 'sys' (built-in)>                                             │ │
│ │        TYPE_CHECKING = False                                                                 │ │
│ │                Union = typing.Union                                                          │ │
│ │          upload_file = <bound method HfApi.upload_file of <huggingface_hub.hf_api.HfApi      │ │
│ │                        object at 0x14203fc50>>                                               │ │
│ │                 yaml = <module 'yaml' from                                                   │ │
│ │                        '/Users/agus/github_repos/argilla-io/distilabel/.venv/lib/python3.11… │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /Users/agus/github_repos/argilla-io/distilabel/src/distilabel/pipeline/__init__.py:15 in         │
│ <module>                                                                                         │
│                                                                                                  │
│   12 # See the License for the specific language governing permissions and                       │13 # limitations under the License.                                                            │14                                                                                             │
│ ❱ 15 from distilabel.pipeline.local import Pipeline                                              │
│   16 from distilabel.pipeline.ray import RayPipeline                                             │
│   17 from distilabel.pipeline.routing_batch_function import (                                    │
│   18routing_batch_function,                                                                 │
│                                                                                                  │
│ /Users/agus/github_repos/argilla-io/distilabel/src/distilabel/pipeline/local.py:23 in <module>   │
│                                                                                                  │
│    20                                                                                            │
│    21 import tblib                                                                               │
│    22                                                                                            │
│ ❱  23 from distilabel.distiset import create_distiset                                            │
│    24 from distilabel.pipeline.base import (                                                     │
│    25BasePipeline,                                                                          │
│    26 )                                                                                          │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │           Any = typing.Any                                                                   │ │
│ │      Callable = typing.Callable                                                              │ │
│ │          cast = <function cast at 0x100dfe200>                                               │ │
│ │          Dict = typing.Dict                                                                  │ │
│ │      Iterable = typing.Iterable                                                              │ │
│ │            mp = <module 'multiprocessing' from                                               │ │
│ │                 '/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versio… │ │
│ │      Optional = typing.Optional                                                              │ │
│ │          Pool = <class 'multiprocessing.pool.Pool'>                                          │ │
│ │        signal = <module 'signal' from                                                        │ │
│ │                 '/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versio… │ │
│ │           sys = <module 'sys' (built-in)>                                                    │ │
│ │         tblib = <module 'tblib' from                                                         │ │
│ │                 '/Users/agus/github_repos/argilla-io/distilabel/.venv/lib/python3.11/site-p… │ │
│ │ TYPE_CHECKING = False                                                                        │ │
│ │         Union = typing.Union                                                                 │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'create_distiset' from partially initialized module 'distilabel.distiset' (most likely due to a circular import) (/Users/agus/github_repos/argilla-io/distilabel/src/distilabel/distiset.py)

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Package version:
  • Python version:

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant