Skip to content

[ BUG ] Import issues with transformers > 5 #70

Description

@WardLT

There appears to be a version conflict with safe and transformers v5.

  File ".../autohyp/molgen/genmol/utils.py", line 6, in <module>
    import safe as sf
          ^^^^^^^^^^^^
  File ".../env/lib/python3.12/site-packages/safe/__init__.py", line 4, in <module>
    from .sample import SAFEDesign
          ^^^^^^^^^^^^^^^^^
  File ".../env/lib/python3.12/site-packages/safe/sample.py", line 17, in <module>
    from transformers.generation import DisjunctiveConstraint, PhrasalConstraint
          ^^^^^^^^^^^^^^^^^
ImportError: cannot import name 'DisjunctiveConstraint' from 'transformers.generation' (.../env/lib/python3.12/site-packages/transformers/generation/__init__.py)

It can be fixed by reducing the transformers version to "transformers<5", and I'd suggest updating the pyproject.toml accordingly. I haven't yet worked out what changes to make to the imports within safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions