Skip to content

Commit

Permalink
Merge pull request #153 from markmc/circular-import
Browse files Browse the repository at this point in the history
importblock: resolve circular import issue
  • Loading branch information
markmc authored Jul 16, 2024
2 parents 2a57fc0 + 919f6e9 commit d6fd987
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit d6fd987

Please sign in to comment.