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

importblock: resolve circular import issue #153

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/instructlab/sdg/importblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from datasets import Dataset

# Local
from . import pipeline
from .block import Block
from .logger_config import setup_logger

Expand All @@ -30,6 +29,21 @@ def __init__(
"""
super().__init__(ctx, pipe, block_name)
self.path = path

# FIXME: find a better fix for this circular import error:
#
# src/instructlab/sdg/__init__.py:29: in <module>
# from .importblock import ImportBlock
# src/instructlab/sdg/importblock.py:6: in <module>
# from . import pipeline
# src/instructlab/sdg/pipeline.py:102: in <module>
# "ImportBlock": importblock.ImportBlock,
# E AttributeError: partially initialized module 'src.instructlab.sdg.importblock' has no attribute 'ImportBlock' (most likely due to a circular import)
#
# pylint: disable=C0415
# Local
from . import pipeline

self.pipeline = pipeline.Pipeline.from_file(self.ctx, self.path)

def generate(self, samples) -> Dataset:
Expand Down