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
Upload modeling_mplug_owl2.py with huggingface_hub
Browse files- modeling_mplug_owl2.py +7 -0
modeling_mplug_owl2.py
CHANGED
|
@@ -19,6 +19,13 @@ import torch
|
|
| 19 |
import torch.nn as nn
|
| 20 |
from torch.nn import CrossEntropyLoss
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
from transformers import AutoConfig, AutoModelForCausalLM, LlamaConfig, LlamaModel, LlamaForCausalLM
|
| 23 |
from transformers.modeling_outputs import CausalLMOutputWithPast
|
| 24 |
|
|
|
|
| 19 |
import torch.nn as nn
|
| 20 |
from torch.nn import CrossEntropyLoss
|
| 21 |
|
| 22 |
+
import copy
|
| 23 |
+
import os
|
| 24 |
+
import sys
|
| 25 |
+
|
| 26 |
+
dir_path = os.path.dirname(os.path.realpath(__file__))
|
| 27 |
+
sys.path.insert(0, dir_path)
|
| 28 |
+
|
| 29 |
from transformers import AutoConfig, AutoModelForCausalLM, LlamaConfig, LlamaModel, LlamaForCausalLM
|
| 30 |
from transformers.modeling_outputs import CausalLMOutputWithPast
|
| 31 |
|