Florence-2-base-ft-compat
This is a compatibility-patched version of Microsoft's Florence-2-base-ft model.
It contains patches in modeling_florence2.py to allow the model to load and generate text out-of-the-box using newer versions of the Hugging Face transformers library (specifically version 4.42.0 up to the latest 4.57.x) without triggering common errors.
Patches Applied
_supports_sdpaAttributeError Fix: Prevents model load crashes on newertransformersversions that inspect attention properties before the nested language model is initialized.KV Cache
NoneType/shapeTypeError Fix: Resolves the crash during generation:TypeError: expected Tensor as element 0 in argument 0, but got NoneType(or'NoneType' object has no attribute 'shape'). This happens because moderntransformerscaches initialize with empty placeholders (None) which the original custom code attempted to perform.shapeandtorch.caton. The patch adds checks to bypass empty cache slots.
Usage
You can load this model directly using standard transformers code:
from transformers import AutoModelForCausalLM, AutoProcessor
model = AutoModelForCausalLM.from_pretrained(
"topguy/Florence-2-base-ft-compat",
trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(
"topguy/Florence-2-base-ft-compat",
trust_remote_code=True
)
Attribution
All model weights and base architecture belong to Microsoft. Please refer to the original microsoft/Florence-2-base-ft repository for license terms and model cards.
- Downloads last month
- 36
Model tree for topguy/Florence-2-base-ft-compat
Base model
microsoft/Florence-2-base-ft