Instructions to use facebook/opt-2.7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/opt-2.7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="facebook/opt-2.7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("facebook/opt-2.7b") model = AutoModelForCausalLM.from_pretrained("facebook/opt-2.7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use facebook/opt-2.7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "facebook/opt-2.7b" # 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-2.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/facebook/opt-2.7b
- SGLang
How to use facebook/opt-2.7b 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-2.7b" \ --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-2.7b", "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-2.7b" \ --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-2.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use facebook/opt-2.7b with Docker Model Runner:
docker model run hf.co/facebook/opt-2.7b
Commit ·
a5227ab
1
Parent(s): 4153458
correct checkpoints see: https://github.com/facebookresearch/metaseq/pull/164
Browse files- config.json +2 -1
- flax_model.msgpack +2 -2
- pytorch_model.bin +2 -2
- tf_model.h5 +2 -2
config.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"_name_or_path": "facebook/opt-2.7b",
|
|
|
|
| 3 |
"activation_dropout": 0.0,
|
| 4 |
"activation_function": "relu",
|
| 5 |
"architectures": [
|
|
@@ -21,7 +22,7 @@
|
|
| 21 |
"pad_token_id": 1,
|
| 22 |
"prefix": "</s>",
|
| 23 |
"torch_dtype": "float16",
|
| 24 |
-
"transformers_version": "4.
|
| 25 |
"use_cache": true,
|
| 26 |
"vocab_size": 50272,
|
| 27 |
"word_embed_proj_dim": 2560
|
|
|
|
| 1 |
{
|
| 2 |
"_name_or_path": "facebook/opt-2.7b",
|
| 3 |
+
"_remove_final_layer_norm": false,
|
| 4 |
"activation_dropout": 0.0,
|
| 5 |
"activation_function": "relu",
|
| 6 |
"architectures": [
|
|
|
|
| 22 |
"pad_token_id": 1,
|
| 23 |
"prefix": "</s>",
|
| 24 |
"torch_dtype": "float16",
|
| 25 |
+
"transformers_version": "4.21.0.dev0",
|
| 26 |
"use_cache": true,
|
| 27 |
"vocab_size": 50272,
|
| 28 |
"word_embed_proj_dim": 2560
|
flax_model.msgpack
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:38e0e85e60f355645ec49cf1e5a09582ccfea00e3d6208447e8548f9401c6b8e
|
| 3 |
+
size 5303211551
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:476391562b9b2635c672d15bd69cfa881c5c824ebe89b00fee6c58947541e6e4
|
| 3 |
+
size 5303359381
|
tf_model.h5
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e7d5426456bd68a48b383bac08b81d4ff834ed8fd86dd4d1a0f668b74f5e03ae
|
| 3 |
+
size 10606949680
|