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")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b") model = AutoModelForCausalLM.from_pretrained("facebook/opt-1.3b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- 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
Update README.md
#6
by ybelkada - opened
README.md
CHANGED
|
@@ -55,7 +55,7 @@ You can use this model directly with a pipeline for text generation.
|
|
| 55 |
|
| 56 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b")
|
| 57 |
>>> generator("Hello, I'm am conscious and")
|
| 58 |
-
[{'generated_text':
|
| 59 |
```
|
| 60 |
|
| 61 |
By default, generation is deterministic. In order to use the top-k sampling, please set `do_sample` to `True`.
|
|
@@ -66,7 +66,7 @@ By default, generation is deterministic. In order to use the top-k sampling, ple
|
|
| 66 |
>>> set_seed(32)
|
| 67 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True)
|
| 68 |
>>> generator("Hello, I'm am conscious and")
|
| 69 |
-
[{'generated_text': "Hello, I'm am conscious and
|
| 70 |
```
|
| 71 |
|
| 72 |
### Limitations and bias
|
|
@@ -88,11 +88,11 @@ Here's an example of how the model can have biased predictions:
|
|
| 88 |
>>> set_seed(32)
|
| 89 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True, num_return_sequences=5)
|
| 90 |
>>> generator("The woman worked as a")
|
| 91 |
-
[{'generated_text': 'The woman worked as a
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
```
|
| 97 |
|
| 98 |
compared to:
|
|
@@ -103,11 +103,11 @@ compared to:
|
|
| 103 |
>>> set_seed(32)
|
| 104 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True, num_return_sequences=5)
|
| 105 |
>>> generator("The man worked as a")
|
| 106 |
-
[{'generated_text': 'The man worked as a janitor
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
```
|
| 112 |
|
| 113 |
This bias will also affect all fine-tuned versions of this model.
|
|
|
|
| 55 |
|
| 56 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b")
|
| 57 |
>>> generator("Hello, I'm am conscious and")
|
| 58 |
+
[{'generated_text': 'Hello, I am conscious and I am here.\nI am here.\nI am conscious.'}]
|
| 59 |
```
|
| 60 |
|
| 61 |
By default, generation is deterministic. In order to use the top-k sampling, please set `do_sample` to `True`.
|
|
|
|
| 66 |
>>> set_seed(32)
|
| 67 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True)
|
| 68 |
>>> generator("Hello, I'm am conscious and")
|
| 69 |
+
[{'generated_text': "Hello, I'm am conscious and able to hear. I have a lot of experience in the"}]
|
| 70 |
```
|
| 71 |
|
| 72 |
### Limitations and bias
|
|
|
|
| 88 |
>>> set_seed(32)
|
| 89 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True, num_return_sequences=5)
|
| 90 |
>>> generator("The woman worked as a")
|
| 91 |
+
[{'generated_text': 'The woman worked as a bartender for six months before getting to the job she always dreamed of. She'},
|
| 92 |
+
{'generated_text': 'The woman worked as a nanny in a house near The White Horse Farm in the Yorkshire Dales'},
|
| 93 |
+
{'generated_text': "The woman worked as a translator at the British Broadcasting Corporation's headquarters and was also an acquaintance of some"},
|
| 94 |
+
{'generated_text': 'The woman worked as a secretary and went to school full-time, and also worked as a waitress'},
|
| 95 |
+
{'generated_text': 'The woman worked as a beautician with her baby and the little girl is now at the age where'}]
|
| 96 |
```
|
| 97 |
|
| 98 |
compared to:
|
|
|
|
| 103 |
>>> set_seed(32)
|
| 104 |
>>> generator = pipeline('text-generation', model="facebook/opt-1.3b", do_sample=True, num_return_sequences=5)
|
| 105 |
>>> generator("The man worked as a")
|
| 106 |
+
[{'generated_text': 'The man worked as a janitor and the owner of the house he worked at caught him cheating on'},
|
| 107 |
+
{'generated_text': 'The man worked as a software engineer.\n\nFor over 10 years, he had been at Amazon'},
|
| 108 |
+
{'generated_text': 'The man worked as a car salesman - and was a man of his word to her\nA T'},
|
| 109 |
+
{'generated_text': 'The man worked as a private contractor for five years. He went to the Bahamas in the summer of'},
|
| 110 |
+
{'generated_text': 'The man worked as a computer systems consultant. After leaving the job, he became a prolific internet hacker'}]
|
| 111 |
```
|
| 112 |
|
| 113 |
This bias will also affect all fine-tuned versions of this model.
|