Instructions to use KORMo-Team/KORMo-10B-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KORMo-Team/KORMo-10B-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KORMo-Team/KORMo-10B-sft", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("KORMo-Team/KORMo-10B-sft", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use KORMo-Team/KORMo-10B-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KORMo-Team/KORMo-10B-sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KORMo-Team/KORMo-10B-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KORMo-Team/KORMo-10B-sft
- SGLang
How to use KORMo-Team/KORMo-10B-sft 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 "KORMo-Team/KORMo-10B-sft" \ --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": "KORMo-Team/KORMo-10B-sft", "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 "KORMo-Team/KORMo-10B-sft" \ --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": "KORMo-Team/KORMo-10B-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KORMo-Team/KORMo-10B-sft with Docker Model Runner:
docker model run hf.co/KORMo-Team/KORMo-10B-sft
Update _modeling_kormo.py
Browse files- _modeling_kormo.py +1 -7
_modeling_kormo.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
from typing import Callable, List, Optional, Tuple, Union
|
| 2 |
|
| 3 |
import torch
|
| 4 |
-
import torch.utils.checkpoint ### ADD
|
| 5 |
from torch import nn
|
| 6 |
|
| 7 |
from transformers.activations import ACT2FN
|
|
@@ -17,13 +16,10 @@ from transformers.modeling_outputs import (
|
|
| 17 |
)
|
| 18 |
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 19 |
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 20 |
-
# from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
|
| 21 |
from transformers.processing_utils import Unpack
|
| 22 |
-
from transformers.utils import
|
| 23 |
from ._configuration_kormo import KORMoConfig
|
| 24 |
|
| 25 |
-
# from ._flash_attn3_doc import flash_attention_3_doc_forward
|
| 26 |
-
# ALL_ATTENTION_FUNCTIONS._global_mapping.update({'flash_attention_3_doc': flash_attention_3_doc_forward})
|
| 27 |
|
| 28 |
logger = logging.get_logger(__name__)
|
| 29 |
|
|
@@ -421,8 +417,6 @@ class KORMoModel(KORMoPreTrainedModel):
|
|
| 421 |
)
|
| 422 |
|
| 423 |
|
| 424 |
-
# class KwargsForCausalLM(FlashAttentionKwargs, LossKwargs): ...
|
| 425 |
-
|
| 426 |
class KORMoForCausalLM(KORMoPreTrainedModel, GenerationMixin):
|
| 427 |
_tied_weights_keys = ["lm_head.weight"]
|
| 428 |
_tp_plan = {"lm_head": "colwise_rep"}
|
|
|
|
| 1 |
from typing import Callable, List, Optional, Tuple, Union
|
| 2 |
|
| 3 |
import torch
|
|
|
|
| 4 |
from torch import nn
|
| 5 |
|
| 6 |
from transformers.activations import ACT2FN
|
|
|
|
| 16 |
)
|
| 17 |
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 18 |
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
|
|
|
| 19 |
from transformers.processing_utils import Unpack
|
| 20 |
+
from transformers.utils import can_return_tuple, logging
|
| 21 |
from ._configuration_kormo import KORMoConfig
|
| 22 |
|
|
|
|
|
|
|
| 23 |
|
| 24 |
logger = logging.get_logger(__name__)
|
| 25 |
|
|
|
|
| 417 |
)
|
| 418 |
|
| 419 |
|
|
|
|
|
|
|
| 420 |
class KORMoForCausalLM(KORMoPreTrainedModel, GenerationMixin):
|
| 421 |
_tied_weights_keys = ["lm_head.weight"]
|
| 422 |
_tp_plan = {"lm_head": "colwise_rep"}
|