Instructions to use DataCanvas/MMAlaya with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DataCanvas/MMAlaya 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="DataCanvas/MMAlaya", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("DataCanvas/MMAlaya", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload mmalaya_arch.py
Browse files- mmalaya_arch.py +1 -0
mmalaya_arch.py
CHANGED
|
@@ -14,6 +14,7 @@ class BLIP2VisionTower(nn.Module):
|
|
| 14 |
self.vision_tower = Blip2Model(self.cfg_only)
|
| 15 |
del self.vision_tower.language_model
|
| 16 |
del self.vision_tower.language_projection
|
|
|
|
| 17 |
self.image_processor = Blip2Processor.from_pretrained(self.vision_tower_name)
|
| 18 |
|
| 19 |
def feature_select(self, image_forward_outs):
|
|
|
|
| 14 |
self.vision_tower = Blip2Model(self.cfg_only)
|
| 15 |
del self.vision_tower.language_model
|
| 16 |
del self.vision_tower.language_projection
|
| 17 |
+
self.vision_tower.to(dtype=torch.float16)
|
| 18 |
self.image_processor = Blip2Processor.from_pretrained(self.vision_tower_name)
|
| 19 |
|
| 20 |
def feature_select(self, image_forward_outs):
|