Instructions to use poolside-laguna-hackathon/laguna-vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use poolside-laguna-hackathon/laguna-vision with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="poolside-laguna-hackathon/laguna-vision", device_map="auto")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("poolside-laguna-hackathon/laguna-vision", dtype="auto", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add Torch flex attention endpoint compatibility shim
Browse files
lagunavision/backbones/hf_causal.py
CHANGED
|
@@ -83,6 +83,17 @@ def _install_torch_compat_shims() -> None:
|
|
| 83 |
except Exception:
|
| 84 |
pass
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
def _install_huggingface_hub_dataclasses_shim() -> None:
|
| 88 |
"""Provide compatibility for Laguna remote code on HF Endpoint runtimes."""
|
|
|
|
| 83 |
except Exception:
|
| 84 |
pass
|
| 85 |
|
| 86 |
+
try:
|
| 87 |
+
import torch.nn.attention.flex_attention as flex_attention
|
| 88 |
+
|
| 89 |
+
if not hasattr(flex_attention, "AuxRequest"):
|
| 90 |
+
class AuxRequest: # noqa: N801 - mirrors PyTorch internal name
|
| 91 |
+
pass
|
| 92 |
+
|
| 93 |
+
flex_attention.AuxRequest = AuxRequest
|
| 94 |
+
except Exception:
|
| 95 |
+
pass
|
| 96 |
+
|
| 97 |
|
| 98 |
def _install_huggingface_hub_dataclasses_shim() -> None:
|
| 99 |
"""Provide compatibility for Laguna remote code on HF Endpoint runtimes."""
|