Instructions to use codys12/Hunyuan-A13B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codys12/Hunyuan-A13B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codys12/Hunyuan-A13B-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("codys12/Hunyuan-A13B-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use codys12/Hunyuan-A13B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codys12/Hunyuan-A13B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codys12/Hunyuan-A13B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/codys12/Hunyuan-A13B-Instruct
- SGLang
How to use codys12/Hunyuan-A13B-Instruct 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 "codys12/Hunyuan-A13B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codys12/Hunyuan-A13B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "codys12/Hunyuan-A13B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codys12/Hunyuan-A13B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use codys12/Hunyuan-A13B-Instruct with Docker Model Runner:
docker model run hf.co/codys12/Hunyuan-A13B-Instruct
Update modeling_hunyuan.py
Browse files- modeling_hunyuan.py +0 -19
modeling_hunyuan.py
CHANGED
|
@@ -1276,10 +1276,6 @@ HUNYUAN_INPUTS_DOCSTRING = r"""
|
|
| 1276 |
"""
|
| 1277 |
|
| 1278 |
|
| 1279 |
-
@add_start_docstrings(
|
| 1280 |
-
"The bare HunYuan Model outputting raw hidden-states without any specific head on top.",
|
| 1281 |
-
HUNYUAN_START_DOCSTRING,
|
| 1282 |
-
)
|
| 1283 |
class HunYuanModel(HunYuanPreTrainedModel):
|
| 1284 |
"""
|
| 1285 |
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`HunYuanDecoderLayer`]
|
|
@@ -1647,21 +1643,6 @@ class HunYuanForCausalLM(HunYuanPreTrainedModel):
|
|
| 1647 |
return reordered_past
|
| 1648 |
|
| 1649 |
|
| 1650 |
-
@add_start_docstrings(
|
| 1651 |
-
"""
|
| 1652 |
-
The HunYuan Model transformer with a sequence classification head on top (linear layer).
|
| 1653 |
-
|
| 1654 |
-
[`HunYuanForSequenceClassification`] uses the last token in order to do the classification, as other causal models
|
| 1655 |
-
(e.g. GPT-2) do.
|
| 1656 |
-
|
| 1657 |
-
Since it does classification on the last token, it requires to know the position of the last token. If a
|
| 1658 |
-
`pad_token_id` is defined in the configuration, it finds the last token that is not a padding token in each row. If
|
| 1659 |
-
no `pad_token_id` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
|
| 1660 |
-
padding tokens when `inputs_embeds` are passed instead of `input_ids`, it does the same (take the last value in
|
| 1661 |
-
each row of the batch).
|
| 1662 |
-
""",
|
| 1663 |
-
HUNYUAN_START_DOCSTRING,
|
| 1664 |
-
)
|
| 1665 |
class HunYuanForSequenceClassification(HunYuanPreTrainedModel):
|
| 1666 |
def __init__(self, config):
|
| 1667 |
super().__init__(config)
|
|
|
|
| 1276 |
"""
|
| 1277 |
|
| 1278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1279 |
class HunYuanModel(HunYuanPreTrainedModel):
|
| 1280 |
"""
|
| 1281 |
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`HunYuanDecoderLayer`]
|
|
|
|
| 1643 |
return reordered_past
|
| 1644 |
|
| 1645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1646 |
class HunYuanForSequenceClassification(HunYuanPreTrainedModel):
|
| 1647 |
def __init__(self, config):
|
| 1648 |
super().__init__(config)
|