Instructions to use hf-internal-testing/tiny-random-OPTForCausalLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hf-internal-testing/tiny-random-OPTForCausalLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hf-internal-testing/tiny-random-OPTForCausalLM")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-OPTForCausalLM") model = AutoModelForCausalLM.from_pretrained("hf-internal-testing/tiny-random-OPTForCausalLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hf-internal-testing/tiny-random-OPTForCausalLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hf-internal-testing/tiny-random-OPTForCausalLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hf-internal-testing/tiny-random-OPTForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hf-internal-testing/tiny-random-OPTForCausalLM
- SGLang
How to use hf-internal-testing/tiny-random-OPTForCausalLM 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 "hf-internal-testing/tiny-random-OPTForCausalLM" \ --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": "hf-internal-testing/tiny-random-OPTForCausalLM", "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 "hf-internal-testing/tiny-random-OPTForCausalLM" \ --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": "hf-internal-testing/tiny-random-OPTForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hf-internal-testing/tiny-random-OPTForCausalLM with Docker Model Runner:
docker model run hf.co/hf-internal-testing/tiny-random-OPTForCausalLM
Commit History
-
Adding `safetensors` variant of this model (#5)
Verified signature- Adding `safetensors` variant of this model (9fd196bb4e3f8b0face3f90b641fad06e358f68e) Co-authored-by: Safetensors convertbot <SFconvertbot@users.noreply.huggingface.co>0abea37
-
Update tokenizer files (and add tokenizer.json) (#3)
Verified signature- Update tokenizer files (and add tokenizer.json) (84ece70140c20bbac8f6f5f9b818a54ce6ffa1ac)3f3f2ee -
[Awaiting approval] Upload ONNX weights (#2)
Verified signature- [Awaiting approval] Upload ONNX weights (5f49002289f51ea48a998f81454359bc34c6b7d9)d463d7b
-
Upload tiny models for OPTForCausalLM
190d1f4 -
initial commit
10a1342