Skip to content

Florence2ForConditionalGeneration not found in any transformers version #77

Closed

Description

@elmailutil-tech

Hi, I'm getting this error when trying to run the app on Windows:
ImportError: cannot import name 'Florence2ForConditionalGeneration' from 'transformers'
I've tried transformers versions 4.44.2, 4.48.3, 4.49.0, 4.50.0 and none of them include Florence2 in the models folder. The folder is always empty for florence.
What is the correct transformers version that includes Florence2ForConditionalGeneration?
Windows 10/11, Python 3.12.7

Thanks in advance

Activity

  1. xSoczek commented on Jun 19, 2026

    @xSoczek

    You need to install another vesrion of transfoemers:

    \python\python.exe -m pip install "transformers>=4.50,<5"
  2. added
    area: inference
    bug
    dependencies
    needs-info
    on Sep 16, 2026
  3. D-Ogi commented on Sep 16, 2026

    @D-Ogi
    Owner

    Keeping this as a Florence-2 import compatibility report, linked to #48. The lower bound in requirements.txt is not evidence that every permitted Transformers version provides the imported API.

    Please include the full traceback and the exact interpreter path, installed Transformers version and package path from the environment that launches the application. The installer uses a project-local interpreter on Windows, so changing another Python environment may not affect the app. A fix needs a validated Transformers constraint and an import smoke test in the complete application environment; the suggested version ranges in this thread have not been established as a supported configuration.

  4. D-Ogi commented on Sep 16, 2026

    @D-Ogi
    Owner

    Fixed in #88 and validated again with the dependency migration in #89. The application now requires transformers>=4.56.0,<5 for the native Florence2ForConditionalGeneration API. The previously suggested 4.50 lower bound was insufficient.

    Fresh full application environments resolve to Transformers 4.57.6 and pass imports on Windows/Linux/macOS. Full offline CLI processing with actual Florence-2 and LaMA weights also completed on Windows Python 3.12 on both CPU and RTX 4090 CUDA.

    For an existing IOPaint installation, use the documented fresh-environment migration so old constraints do not remain installed: https://github.com/D-Ogi/WatermarkRemover-AI/blob/main/docs/lama-runtime.md#installation-and-migration . Closing this import compatibility report as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: inferencebugdependenciesneeds-info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions