Instructions to use facebook/opt-1.3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/opt-1.3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="facebook/opt-1.3b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b") model = AutoModelForCausalLM.from_pretrained("facebook/opt-1.3b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use facebook/opt-1.3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "facebook/opt-1.3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "facebook/opt-1.3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/facebook/opt-1.3b
- SGLang
How to use facebook/opt-1.3b 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 "facebook/opt-1.3b" \ --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": "facebook/opt-1.3b", "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 "facebook/opt-1.3b" \ --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": "facebook/opt-1.3b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use facebook/opt-1.3b with Docker Model Runner:
docker model run hf.co/facebook/opt-1.3b
Revert config modifications
Browse files- config.json +8 -8
config.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "facebook/opt-1.3b",
|
| 3 |
"activation_dropout": 0.0,
|
| 4 |
"activation_function": "relu",
|
| 5 |
"architectures": [
|
| 6 |
-
"
|
| 7 |
],
|
| 8 |
"attention_dropout": 0.0,
|
| 9 |
"bos_token_id": 2,
|
|
|
|
| 10 |
"do_layer_norm_before": true,
|
| 11 |
"dropout": 0.1,
|
| 12 |
"eos_token_id": 2,
|
| 13 |
"ffn_dim": 8192,
|
| 14 |
-
|
| 15 |
"init_std": 0.02,
|
| 16 |
"layerdrop": 0.0,
|
| 17 |
"max_position_embeddings": 2048,
|
| 18 |
-
"model_type": "opt",
|
| 19 |
"num_attention_heads": 32,
|
| 20 |
"num_hidden_layers": 24,
|
| 21 |
"pad_token_id": 1,
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
|
| 25 |
"use_cache": true,
|
| 26 |
"vocab_size": 50272,
|
| 27 |
-
"word_embed_proj_dim": 2048
|
|
|
|
| 28 |
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"activation_dropout": 0.0,
|
| 3 |
"activation_function": "relu",
|
| 4 |
"architectures": [
|
| 5 |
+
"OPTForCausalLM"
|
| 6 |
],
|
| 7 |
"attention_dropout": 0.0,
|
| 8 |
"bos_token_id": 2,
|
| 9 |
+
"hidden_size": 2048,
|
| 10 |
"do_layer_norm_before": true,
|
| 11 |
"dropout": 0.1,
|
| 12 |
"eos_token_id": 2,
|
| 13 |
"ffn_dim": 8192,
|
| 14 |
+
|
| 15 |
"init_std": 0.02,
|
| 16 |
"layerdrop": 0.0,
|
| 17 |
"max_position_embeddings": 2048,
|
|
|
|
| 18 |
"num_attention_heads": 32,
|
| 19 |
"num_hidden_layers": 24,
|
| 20 |
"pad_token_id": 1,
|
| 21 |
+
"torch_dtype": "float16",
|
| 22 |
+
"transformers_version": "4.19.0.dev0",
|
| 23 |
+
|
| 24 |
"use_cache": true,
|
| 25 |
"vocab_size": 50272,
|
| 26 |
+
"word_embed_proj_dim": 2048,
|
| 27 |
+
"prefix": "</s>"
|
| 28 |
}
|