Instructions to use facebook/opt-350m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/opt-350m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="facebook/opt-350m")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m") model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use facebook/opt-350m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "facebook/opt-350m" # 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-350m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/facebook/opt-350m
- SGLang
How to use facebook/opt-350m 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-350m" \ --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-350m", "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-350m" \ --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-350m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use facebook/opt-350m with Docker Model Runner:
docker model run hf.co/facebook/opt-350m
Add tf_weights
Browse filesFiles changed (2)
- config.json+2-1
- tf_model.h5+2-2
123414 unmodified lines19202122232425{"activation_dropout": 0.0,"activation_function": "relu","architectures": [14 unmodified lines"num_hidden_layers": 24,"pad_token_id": 1,"prefix": "</s>","torch_dtype": "float16","transformers_version": "4.20.0.dev0","use_cache": true,"vocab_size": 50272,1234514 unmodified lines20212223242526{"_name_or_path": "opt-350m","activation_dropout": 0.0,"activation_function": "relu","architectures": [14 unmodified lines"num_hidden_layers": 24,"pad_token_id": 1,"prefix": "</s>","torch_dtype": "float32","transformers_version": "4.20.0.dev0","use_cache": true,"vocab_size": 50272,
123version https://git-lfs.github.com/spec/v1oid sha256:e7ff7b18669f155709566b4cbde23db917892066ec947642a9d5c7ed36706f3csize 1325196872123version https://git-lfs.github.com/spec/v1oid sha256:69f4fa78247a957ff76ae7c1ac9fffa3f9c4a6a55db1654fb3554a7bd04827absize 662804016
config.json+2-1
tf_model.h5+2-2