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"], )# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("q-future/one-align", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload modeling_mplug_owl2.py with huggingface_hub
Browse files- modeling_mplug_owl2.py +1 -1
modeling_mplug_owl2.py
CHANGED
|
@@ -256,7 +256,7 @@ class MPLUGOwl2LlamaForCausalLM(LlamaForCausalLM, MPLUGOwl2MetaForCausalLM):
|
|
| 256 |
|
| 257 |
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 258 |
self.preferential_ids_ = [id_[1] for id_ in self.tokenizer(["excellent","good","fair","poor","bad"])["input_ids"]]
|
| 259 |
-
self.weight_tensor = torch.Tensor([5.,4.,3.,2.,1.]).half().to(
|
| 260 |
|
| 261 |
# Initialize weights and apply final processing
|
| 262 |
self.post_init()
|
|
|
|
| 256 |
|
| 257 |
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
|
| 258 |
self.preferential_ids_ = [id_[1] for id_ in self.tokenizer(["excellent","good","fair","poor","bad"])["input_ids"]]
|
| 259 |
+
self.weight_tensor = torch.Tensor([5.,4.,3.,2.,1.]).half().to(self.device)
|
| 260 |
|
| 261 |
# Initialize weights and apply final processing
|
| 262 |
self.post_init()
|