Fix florence2_models imports: add __init__.py and use relative imports

The florence2_models directory needs an __init__.py to be a proper
Python package, and imports from py/florence2_ultra.py need to use
relative imports (..florence2_models) since it's a sibling subpackage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Gang Wen
2026-04-07 19:27:39 +02:00
co-authored by Claude Opus 4.6
parent fd34c3d5d8
commit 21549b7bfe
2 changed files with 2 additions and 2 deletions
View File
+2 -2
View File
@@ -48,9 +48,9 @@ def fixed_get_imports(filename) -> list[str]:
def _load_model_v5(model_path, attention, dtype):
"""Load Florence2 model for transformers >= 5.0.0"""
log(f"[DEBUG] _load_model_v5 called with model_path={model_path}, attention={attention}, dtype={dtype}")
from florence2_models.modeling_florence2 import Florence2ForConditionalGeneration, Florence2Config
from ..florence2_models.modeling_florence2 import Florence2ForConditionalGeneration, Florence2Config
from transformers import CLIPImageProcessor, BartTokenizerFast
from florence2_models.processing_florence2 import Florence2Processor
from ..florence2_models.processing_florence2 import Florence2Processor
from accelerate import init_empty_weights
from accelerate.utils import set_module_tensor_to_device
from comfy.utils import load_torch_file