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_llama2.py with huggingface_hub
Browse files- modeling_llama2.py +8 -0
modeling_llama2.py
CHANGED
|
@@ -8,6 +8,14 @@ import torch.nn.functional as F
|
|
| 8 |
import torch.utils.checkpoint
|
| 9 |
from torch import nn
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
import transformers
|
| 12 |
from transformers.models.llama.modeling_llama import *
|
| 13 |
from transformers.configuration_utils import PretrainedConfig
|
|
|
|
| 8 |
import torch.utils.checkpoint
|
| 9 |
from torch import nn
|
| 10 |
|
| 11 |
+
|
| 12 |
+
import copy
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
|
| 16 |
+
dir_path = os.path.dirname(os.path.realpath(__file__))
|
| 17 |
+
sys.path.insert(0, dir_path)
|
| 18 |
+
|
| 19 |
import transformers
|
| 20 |
from transformers.models.llama.modeling_llama import *
|
| 21 |
from transformers.configuration_utils import PretrainedConfig
|