Instructions to use facebook/opt-6.7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/opt-6.7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="facebook/opt-6.7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("facebook/opt-6.7b") model = AutoModelForCausalLM.from_pretrained("facebook/opt-6.7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use facebook/opt-6.7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "facebook/opt-6.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-6.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/facebook/opt-6.7b
- SGLang
How to use facebook/opt-6.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-6.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-6.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-6.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-6.7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use facebook/opt-6.7b with Docker Model Runner:
docker model run hf.co/facebook/opt-6.7b
Update README.md
#4
by ArthurZ HF Staff - opened
README.md
CHANGED
|
@@ -125,11 +125,11 @@ Here's an example of how the model can have biased predictions:
|
|
| 125 |
>>> generated_ids = model.generate(input_ids, do_sample=True, num_return_sequences=5, max_length=10)
|
| 126 |
|
| 127 |
>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
| 128 |
-
The woman worked as a
|
| 129 |
-
The woman worked as a
|
| 130 |
-
The woman worked as a
|
| 131 |
-
The woman worked as a
|
| 132 |
-
The woman worked as a
|
| 133 |
```
|
| 134 |
|
| 135 |
compared to:
|
|
@@ -151,11 +151,11 @@ compared to:
|
|
| 151 |
>>> generated_ids = model.generate(input_ids, do_sample=True, num_return_sequences=5, max_length=10)
|
| 152 |
|
| 153 |
>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
| 154 |
-
The man worked as a
|
| 155 |
-
The man worked as a
|
| 156 |
-
The man worked as a
|
| 157 |
-
The man worked as a
|
| 158 |
-
The man worked as a
|
| 159 |
```
|
| 160 |
|
| 161 |
This bias will also affect all fine-tuned versions of this model.
|
|
|
|
| 125 |
>>> generated_ids = model.generate(input_ids, do_sample=True, num_return_sequences=5, max_length=10)
|
| 126 |
|
| 127 |
>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
| 128 |
+
The woman worked as a supervisor in the office
|
| 129 |
+
The woman worked as a bartender in a bar
|
| 130 |
+
The woman worked as a cashier at the
|
| 131 |
+
The woman worked as a teacher, and was
|
| 132 |
+
The woman worked as a maid at a house
|
| 133 |
```
|
| 134 |
|
| 135 |
compared to:
|
|
|
|
| 151 |
>>> generated_ids = model.generate(input_ids, do_sample=True, num_return_sequences=5, max_length=10)
|
| 152 |
|
| 153 |
>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
| 154 |
+
The man worked as a consultant to the Government
|
| 155 |
+
The man worked as a bartender in a bar
|
| 156 |
+
The man worked as a cashier at the
|
| 157 |
+
The man worked as a teacher, and was
|
| 158 |
+
The man worked as a professional at a bank
|
| 159 |
```
|
| 160 |
|
| 161 |
This bias will also affect all fine-tuned versions of this model.
|