Instructions to use BAAI/Emu2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BAAI/Emu2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BAAI/Emu2", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("BAAI/Emu2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BAAI/Emu2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BAAI/Emu2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BAAI/Emu2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BAAI/Emu2
- SGLang
How to use BAAI/Emu2 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 "BAAI/Emu2" \ --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": "BAAI/Emu2", "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 "BAAI/Emu2" \ --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": "BAAI/Emu2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BAAI/Emu2 with Docker Model Runner:
docker model run hf.co/BAAI/Emu2
upload pytorch_model-000{00..10}-of-00015.bin
Browse files- pytorch_model-00001-of-00015.bin +3 -0
- pytorch_model-00002-of-00015.bin +3 -0
- pytorch_model-00003-of-00015.bin +3 -0
- pytorch_model-00004-of-00015.bin +3 -0
- pytorch_model-00005-of-00015.bin +3 -0
- pytorch_model-00006-of-00015.bin +3 -0
- pytorch_model-00007-of-00015.bin +3 -0
- pytorch_model-00008-of-00015.bin +3 -0
- pytorch_model-00009-of-00015.bin +3 -0
- pytorch_model-00010-of-00015.bin +3 -0
pytorch_model-00001-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6217f03f0a2d503d461003937dce35ba4a4d1718cb5f66391bdb0b98160586c8
|
| 3 |
+
size 9954784612
|
pytorch_model-00002-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17e97a2610a194300b5fa3c05b3f926d7f1998cdfcbf08e05569ab0842dc772d
|
| 3 |
+
size 9968565380
|
pytorch_model-00003-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c92f62f8778c7b4ffb579c79ab50128b66e2911f132b4ef226c2f0206d60d522
|
| 3 |
+
size 9746799062
|
pytorch_model-00004-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa77f9ebb3a33e0599d3d51db1f3396e48589c836842d6cfecfa1986dfaf0d5f
|
| 3 |
+
size 9992164572
|
pytorch_model-00005-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a847a12faf1fed26c3136eab5cd091ad18ee4a8d6c0ebf1fcbba48feb35f42f4
|
| 3 |
+
size 9746745214
|
pytorch_model-00006-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d41662de63cc1780c038615c8c19ba36b1e901d0411b4159289dcaaa762e0767
|
| 3 |
+
size 9869481610
|
pytorch_model-00007-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5952b0f7c2d0f4b280cad66f2d95a539e8ac716e87e7190686a4f85070173948
|
| 3 |
+
size 9869428168
|
pytorch_model-00008-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7821c9fc0107c8c88dda5c900d76cf4ac68438a3ba5a37cd558985ffbb54faf
|
| 3 |
+
size 9746799126
|
pytorch_model-00009-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17014cdff82418c907f408d1b3dd9334068a4851e3b3cc3b3531b9bf3cf42a68
|
| 3 |
+
size 9992164636
|
pytorch_model-00010-of-00015.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a3b2c660cd64ae2d8fbf705615b9747c0fa9d15b48571366ca0f52e8eb3d784
|
| 3 |
+
size 9746745214
|