Instructions to use CausalLM/miniG with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CausalLM/miniG with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CausalLM/miniG", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("CausalLM/miniG", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CausalLM/miniG with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CausalLM/miniG" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CausalLM/miniG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/CausalLM/miniG
- SGLang
How to use CausalLM/miniG 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 "CausalLM/miniG" \ --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": "CausalLM/miniG", "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 "CausalLM/miniG" \ --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": "CausalLM/miniG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use CausalLM/miniG with Docker Model Runner:
docker model run hf.co/CausalLM/miniG
Commit ·
2da4d79
1
Parent(s): 93f2b0f
Upload 7 files
Browse files- generation_config.json +4 -4
- modeling_chatglm.py +2 -5
generation_config.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
{
|
| 2 |
-
"do_sample": true,
|
| 3 |
"eos_token_id": [
|
| 4 |
151329,
|
| 5 |
151336,
|
| 6 |
151338
|
| 7 |
],
|
| 8 |
-
"max_length": 8192,
|
| 9 |
"pad_token_id": 151329,
|
|
|
|
| 10 |
"temperature": 0.8,
|
|
|
|
| 11 |
"top_p": 0.8,
|
| 12 |
-
"transformers_version": "4.
|
| 13 |
-
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"eos_token_id": [
|
| 3 |
151329,
|
| 4 |
151336,
|
| 5 |
151338
|
| 6 |
],
|
|
|
|
| 7 |
"pad_token_id": 151329,
|
| 8 |
+
"do_sample": true,
|
| 9 |
"temperature": 0.8,
|
| 10 |
+
"max_length": 8192,
|
| 11 |
"top_p": 0.8,
|
| 12 |
+
"transformers_version": "4.44.0"
|
| 13 |
+
}
|
modeling_chatglm.py
CHANGED
|
@@ -1082,12 +1082,9 @@ class ChatGLMForConditionalGeneration(ChatGLMPreTrainedModel):
|
|
| 1082 |
outputs: ModelOutput,
|
| 1083 |
model_kwargs: Dict[str, Any],
|
| 1084 |
is_encoder_decoder: bool = False,
|
| 1085 |
-
standardize_cache_format: bool = False,
|
| 1086 |
) -> Dict[str, Any]:
|
| 1087 |
# update past_key_values
|
| 1088 |
-
cache_name, cache = self._extract_past_from_model_output(
|
| 1089 |
-
outputs, standardize_cache_format=standardize_cache_format
|
| 1090 |
-
)
|
| 1091 |
model_kwargs[cache_name] = cache
|
| 1092 |
|
| 1093 |
# update attention mask
|
|
@@ -1329,4 +1326,4 @@ class ChatGLMForSequenceClassification(ChatGLMPreTrainedModel):
|
|
| 1329 |
past_key_values=transformer_outputs.past_key_values,
|
| 1330 |
hidden_states=transformer_outputs.hidden_states,
|
| 1331 |
attentions=transformer_outputs.attentions,
|
| 1332 |
-
)
|
|
|
|
| 1082 |
outputs: ModelOutput,
|
| 1083 |
model_kwargs: Dict[str, Any],
|
| 1084 |
is_encoder_decoder: bool = False,
|
|
|
|
| 1085 |
) -> Dict[str, Any]:
|
| 1086 |
# update past_key_values
|
| 1087 |
+
cache_name, cache = self._extract_past_from_model_output(outputs)
|
|
|
|
|
|
|
| 1088 |
model_kwargs[cache_name] = cache
|
| 1089 |
|
| 1090 |
# update attention mask
|
|
|
|
| 1326 |
past_key_values=transformer_outputs.past_key_values,
|
| 1327 |
hidden_states=transformer_outputs.hidden_states,
|
| 1328 |
attentions=transformer_outputs.attentions,
|
| 1329 |
+
)
|