Instructions to use Maghrebi/abkhaz with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Maghrebi/abkhaz with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Maghrebi/abkhaz")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Maghrebi/abkhaz") model = AutoModelForSeq2SeqLM.from_pretrained("Maghrebi/abkhaz", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Maghrebi/abkhaz with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Maghrebi/abkhaz" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Maghrebi/abkhaz", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Maghrebi/abkhaz
- SGLang
How to use Maghrebi/abkhaz with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Maghrebi/abkhaz" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Maghrebi/abkhaz", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Maghrebi/abkhaz" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Maghrebi/abkhaz", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Maghrebi/abkhaz with Docker Model Runner:
docker model run hf.co/Maghrebi/abkhaz
Update config.json
Browse files- config.json +122 -1
config.json
CHANGED
|
@@ -31,4 +31,125 @@
|
|
| 31 |
"transformers_version": "4.25.1",
|
| 32 |
"use_cache": true,
|
| 33 |
"vocab_size": 250100
|
| 34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"transformers_version": "4.25.1",
|
| 32 |
"use_cache": true,
|
| 33 |
"vocab_size": 250100
|
| 34 |
+
}# coding=utf-8
|
| 35 |
+
# Copyright 2020 Mesh TensorFlow authors, T5 Authors and HuggingFace Inc. team.
|
| 36 |
+
#
|
| 37 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 38 |
+
# you may not use this file except in compliance with the License.
|
| 39 |
+
# You may obtain a copy of the License at
|
| 40 |
+
#
|
| 41 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 42 |
+
#
|
| 43 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 44 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 45 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 46 |
+
# See the License for the specific language governing permissions and
|
| 47 |
+
# limitations under the License.
|
| 48 |
+
""" PyTorch mT5 model. """
|
| 49 |
+
|
| 50 |
+
from ...utils import logging
|
| 51 |
+
from ..t5.modeling_t5 import T5EncoderModel, T5ForConditionalGeneration, T5Model
|
| 52 |
+
from .configuration_mt5 import MT5Config
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
logger = logging.get_logger(__name__)
|
| 56 |
+
|
| 57 |
+
_CONFIG_FOR_DOC = "T5Config"
|
| 58 |
+
_TOKENIZER_FOR_DOC = "T5Tokenizer"
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
[DOCS]
|
| 63 |
+
class MT5Model(T5Model):
|
| 64 |
+
r"""
|
| 65 |
+
This class overrides :class:`~transformers.T5Model`. Please check the superclass for the appropriate documentation
|
| 66 |
+
alongside usage examples.
|
| 67 |
+
|
| 68 |
+
Examples::
|
| 69 |
+
|
| 70 |
+
>>> from transformers import MT5Model, T5Tokenizer
|
| 71 |
+
>>> model = MT5Model.from_pretrained("google/mt5-small")
|
| 72 |
+
>>> tokenizer = T5Tokenizer.from_pretrained("google/mt5-small")
|
| 73 |
+
>>> article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
|
| 74 |
+
>>> summary = "Weiter Verhandlung in Syrien."
|
| 75 |
+
>>> inputs = tokenizer(article, return_tensors="pt")
|
| 76 |
+
>>> with tokenizer.as_target_tokenizer():
|
| 77 |
+
... labels = tokenizer(summary, return_tensors="pt")
|
| 78 |
+
|
| 79 |
+
>>> outputs = model(input_ids=inputs["input_ids"], decoder_input_ids=labels["input_ids"])
|
| 80 |
+
>>> hidden_states = outputs.last_hidden_state
|
| 81 |
+
"""
|
| 82 |
+
model_type = "mt5"
|
| 83 |
+
config_class = MT5Config
|
| 84 |
+
_keys_to_ignore_on_load_missing = [
|
| 85 |
+
r"encoder\.embed_tokens\.weight",
|
| 86 |
+
r"decoder\.embed_tokens\.weight",
|
| 87 |
+
r"decoder\.block\.0\.layer\.1\.EncDecAttention\.relative_attention_bias\.weight",
|
| 88 |
+
]
|
| 89 |
+
_keys_to_ignore_on_save = [
|
| 90 |
+
r"encoder\.embed_tokens\.weight",
|
| 91 |
+
r"decoder\.embed_tokens\.weight",
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
[DOCS]
|
| 98 |
+
class MT5ForConditionalGeneration(T5ForConditionalGeneration):
|
| 99 |
+
r"""
|
| 100 |
+
This class overrides :class:`~transformers.T5ForConditionalGeneration`. Please check the superclass for the
|
| 101 |
+
appropriate documentation alongside usage examples.
|
| 102 |
+
|
| 103 |
+
Examples::
|
| 104 |
+
|
| 105 |
+
>>> from transformers import MT5ForConditionalGeneration, T5Tokenizer
|
| 106 |
+
>>> model = MT5ForConditionalGeneration.from_pretrained("google/mt5-small")
|
| 107 |
+
>>> tokenizer = T5Tokenizer.from_pretrained("google/mt5-small")
|
| 108 |
+
>>> article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
|
| 109 |
+
>>> summary = "Weiter Verhandlung in Syrien."
|
| 110 |
+
>>> inputs = tokenizer(article, return_tensors="pt")
|
| 111 |
+
>>> with tokenizer.as_target_tokenizer():
|
| 112 |
+
... labels = tokenizer(summary, return_tensors="pt")
|
| 113 |
+
|
| 114 |
+
>>> outputs = model(**inputs,labels=labels["input_ids"])
|
| 115 |
+
>>> loss = outputs.loss
|
| 116 |
+
"""
|
| 117 |
+
|
| 118 |
+
model_type = "mt5"
|
| 119 |
+
config_class = MT5Config
|
| 120 |
+
_keys_to_ignore_on_load_missing = [
|
| 121 |
+
r"encoder\.embed_tokens\.weight",
|
| 122 |
+
]
|
| 123 |
+
_keys_to_ignore_on_save = [
|
| 124 |
+
r"encoder\.embed_tokens\.weight",
|
| 125 |
+
]
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
[DOCS]
|
| 131 |
+
class MT5EncoderModel(T5EncoderModel):
|
| 132 |
+
r"""
|
| 133 |
+
This class overrides :class:`~transformers.T5EncoderModel`. Please check the superclass for the appropriate
|
| 134 |
+
documentation alongside usage examples.
|
| 135 |
+
|
| 136 |
+
Examples::
|
| 137 |
+
|
| 138 |
+
>>> from transformers import MT5EncoderModel, T5Tokenizer
|
| 139 |
+
>>> model = MT5EncoderModel.from_pretrained("google/mt5-small")
|
| 140 |
+
>>> tokenizer = T5Tokenizer.from_pretrained("google/mt5-small")
|
| 141 |
+
>>> article = "UN Offizier sagt, dass weiter verhandelt werden muss in Syrien."
|
| 142 |
+
>>> input_ids = tokenizer(article, return_tensors="pt").input_ids
|
| 143 |
+
>>> outputs = model(input_ids)
|
| 144 |
+
>>> hidden_state = outputs.last_hidden_state
|
| 145 |
+
"""
|
| 146 |
+
|
| 147 |
+
model_type = "mt5"
|
| 148 |
+
config_class = MT5Config
|
| 149 |
+
_keys_to_ignore_on_load_missing = [
|
| 150 |
+
r"encoder\.embed_tokens\.weight",
|
| 151 |
+
]
|
| 152 |
+
_keys_to_ignore_on_save = [
|
| 153 |
+
r"encoder\.embed_tokens\.weight",
|
| 154 |
+
]
|
| 155 |
+
|