Instructions to use R-Kentaren/grok-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use R-Kentaren/grok-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="R-Kentaren/grok-2")# Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("R-Kentaren/grok-2") model = AutoModelForCausalLM.from_pretrained("R-Kentaren/grok-2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use R-Kentaren/grok-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "R-Kentaren/grok-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "R-Kentaren/grok-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/R-Kentaren/grok-2
- SGLang
How to use R-Kentaren/grok-2 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 "R-Kentaren/grok-2" \ --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": "R-Kentaren/grok-2", "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 "R-Kentaren/grok-2" \ --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": "R-Kentaren/grok-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use R-Kentaren/grok-2 with Docker Model Runner:
docker model run hf.co/R-Kentaren/grok-2
Download pytorch_model-00007-TP-007.safetensors from R-Kentaren/grok-2: direct link, hf CLI and curl.
- Browser
- Download file 17.2 GB
-
https://huggingface.co/R-Kentaren/grok-2/resolve/7d6eee45e3698fd2e008a458dae4b98df1fec842/pytorch_model-00007-TP-007.safetensors
- Command line
-
hf download hf://R-Kentaren/grok-2@7d6eee45e3698fd2e008a458dae4b98df1fec842/pytorch_model-00007-TP-007.safetensors
-
curl -L -o pytorch_model-00007-TP-007.safetensors https://huggingface.co/R-Kentaren/grok-2/resolve/7d6eee45e3698fd2e008a458dae4b98df1fec842/pytorch_model-00007-TP-007.safetensors
17.2 GB
- Xet hash:
- e5e4ab011dd9cd0ce713dedb9d2e9308394d121c2ceb9c8024b48d1db507c575
- Size of remote file:
- 17.2 GB
- SHA256:
- d890e53bae6eb64606791a70ec4055a0909eb75d704bc505050f87a8f4304776
·
Xet efficiently stores Large Files inside Git, intelligently splitting files into unique chunks and accelerating uploads and downloads. More info.