Instructions to use hpcai-tech/grok-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hpcai-tech/grok-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hpcai-tech/grok-1", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("hpcai-tech/grok-1", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hpcai-tech/grok-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hpcai-tech/grok-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hpcai-tech/grok-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hpcai-tech/grok-1
- SGLang
How to use hpcai-tech/grok-1 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 "hpcai-tech/grok-1" \ --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": "hpcai-tech/grok-1", "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 "hpcai-tech/grok-1" \ --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": "hpcai-tech/grok-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hpcai-tech/grok-1 with Docker Model Runner:
docker model run hf.co/hpcai-tech/grok-1
add config
Browse files- config.json +33 -0
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Grok1ModelForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoConfig": "configuration_grok1.Grok1Config",
|
| 7 |
+
"AutoModel": "modeling_grok1.Grok1Model",
|
| 8 |
+
"AutoModelForCausalLM": "modeling_grok1.Grok1ModelForCausalLM"
|
| 9 |
+
},
|
| 10 |
+
"vocab_size": 131072,
|
| 11 |
+
"hidden_size": 6144,
|
| 12 |
+
"intermediate_size": 32768,
|
| 13 |
+
"num_hidden_layers": 64,
|
| 14 |
+
"num_attention_heads": 48,
|
| 15 |
+
"num_key_value_heads": 8,
|
| 16 |
+
"attn_output_multiplier": 0.08838834764831845,
|
| 17 |
+
"embedding_multiplier_scale": 78.38367176906169,
|
| 18 |
+
"output_multiplier_scale": 0.5773502691896257,
|
| 19 |
+
"max_attn_value": 30.0,
|
| 20 |
+
"max_position_embeddings": 8192,
|
| 21 |
+
"rms_norm_eps": 1e-5,
|
| 22 |
+
"use_cache": true,
|
| 23 |
+
"pad_token_id": 0,
|
| 24 |
+
"bos_token_id": 1,
|
| 25 |
+
"eos_token_id": 2,
|
| 26 |
+
"tie_word_embeddings": true,
|
| 27 |
+
"num_experts_per_tok": 2,
|
| 28 |
+
"num_experts": 8,
|
| 29 |
+
"output_router_logits": false,
|
| 30 |
+
"router_aux_loss_coef": 0.001,
|
| 31 |
+
"torch_dtype": "float16",
|
| 32 |
+
"transformers_version": "4.35.0"
|
| 33 |
+
}
|