Instructions to use q-future/one-align with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use q-future/one-align with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="q-future/one-align", trust_remote_code=True) pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("q-future/one-align", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_mplug_owl2.py
Browse files- modeling_mplug_owl2.py +2 -0
modeling_mplug_owl2.py
CHANGED
|
@@ -32,6 +32,8 @@ from transformers.modeling_outputs import CausalLMOutputWithPast
|
|
| 32 |
from .configuration_mplug_owl2 import MPLUGOwl2Config, MplugOwlVisionConfig, MplugOwlVisualAbstractorConfig
|
| 33 |
from .visual_encoder import MplugOwlVisionModel, MplugOwlVisualAbstractorModel
|
| 34 |
from .modeling_llama2 import replace_llama_modality_adaptive
|
|
|
|
|
|
|
| 35 |
IGNORE_INDEX = -100
|
| 36 |
IMAGE_TOKEN_INDEX = -200
|
| 37 |
DEFAULT_IMAGE_TOKEN = "<|image|>"
|
|
|
|
| 32 |
from .configuration_mplug_owl2 import MPLUGOwl2Config, MplugOwlVisionConfig, MplugOwlVisualAbstractorConfig
|
| 33 |
from .visual_encoder import MplugOwlVisionModel, MplugOwlVisualAbstractorModel
|
| 34 |
from .modeling_llama2 import replace_llama_modality_adaptive
|
| 35 |
+
from .modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
|
| 36 |
+
|
| 37 |
IGNORE_INDEX = -100
|
| 38 |
IMAGE_TOKEN_INDEX = -200
|
| 39 |
DEFAULT_IMAGE_TOKEN = "<|image|>"
|