Image-Text-to-Text
Transformers
Safetensors
Habana
English
llava
LLM
Intel
conversational
Eval Results (legacy)
Instructions to use Intel/llava-gemma-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Intel/llava-gemma-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Intel/llava-gemma-2b") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Intel/llava-gemma-2b") model = AutoModelForMultimodalLM.from_pretrained("Intel/llava-gemma-2b", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Intel/llava-gemma-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Intel/llava-gemma-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Intel/llava-gemma-2b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Intel/llava-gemma-2b
- SGLang
How to use Intel/llava-gemma-2b 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 "Intel/llava-gemma-2b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Intel/llava-gemma-2b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "Intel/llava-gemma-2b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Intel/llava-gemma-2b", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Intel/llava-gemma-2b with Docker Model Runner:
docker model run hf.co/Intel/llava-gemma-2b
Upload LICENSE.md
Browse filesintel-research-use-license
- LICENSE.md +68 -0
LICENSE.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Intel Research Use License Agreement
|
| 2 |
+
|
| 3 |
+
By using or distributing any portion or element of the Material, You agree to be
|
| 4 |
+
bound by this Agreement.
|
| 5 |
+
|
| 6 |
+
1.Definitions.
|
| 7 |
+
“Agreement” means the terms and conditions for use, reproduction and
|
| 8 |
+
distribution of the Material set forth herein. “Material” means model weights or
|
| 9 |
+
other software Intel makes available to you under this Agreement. “You” or
|
| 10 |
+
“Your” means you, or your employer or any other person or entity (if you are
|
| 11 |
+
entering into this Agreement on such person or entity’s behalf), of the age
|
| 12 |
+
required under applicable laws, rules or regulations to provide legal consent
|
| 13 |
+
and that has legal authority to bind your employer or such other person or
|
| 14 |
+
entity if you are entering in this Agreement on their behalf.
|
| 15 |
+
|
| 16 |
+
2. License.
|
| 17 |
+
Intel grants to You, a limited, non-transferable, non-sublicensable,
|
| 18 |
+
non-exclusive, worldwide, royalty-free, license under Intel’s copyrights in the
|
| 19 |
+
Material, to use, reproduce, display, and distribute the Material solely for
|
| 20 |
+
research purposes.
|
| 21 |
+
|
| 22 |
+
2.1 Restrictions.
|
| 23 |
+
Except as authorized above, You will not: (a) use Material in any other way; (b)
|
| 24 |
+
reverse engineer, decompile, or disassemble the Material, or (c) use Material to
|
| 25 |
+
violate or aid in the violation of any international human right.
|
| 26 |
+
|
| 27 |
+
2.2 No Implied License.
|
| 28 |
+
Except for the express license in Section 2, Intel does not grant You any
|
| 29 |
+
express or implied license under any legal theory. Any other licenses from Intel
|
| 30 |
+
require additional consideration. Nothing in this Agreement requires Intel to
|
| 31 |
+
grant any additional license.
|
| 32 |
+
|
| 33 |
+
3. Third party programs.
|
| 34 |
+
Your use of certain third-party software with or within the Material is subject
|
| 35 |
+
to your compliance with licensing you obtain directly from that third-party. A
|
| 36 |
+
listing of any such third-party software may accompany the Material.
|
| 37 |
+
|
| 38 |
+
4. No Warranty.
|
| 39 |
+
The Material is provided “as is,” without any express or implied warranty of any
|
| 40 |
+
kind including warranties of merchantability, non-infringement, title, or
|
| 41 |
+
fitness for a particular purpose. The Material may be pre-release and may not be
|
| 42 |
+
fully functional. Intel is not required to maintain, update, or support any
|
| 43 |
+
Material. You are solely responsible for determining the appropriateness of
|
| 44 |
+
using or distributing the Material and assume any risks associated with Your use
|
| 45 |
+
of the Material.
|
| 46 |
+
|
| 47 |
+
5. Limitation on Liability.
|
| 48 |
+
IN NO EVENT WILL INTEL BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY
|
| 49 |
+
LOST PROFITS OR DAMAGES (INCLUDING BUT NOT LIMITED TO DIRECT, INDIRECT,
|
| 50 |
+
SPECULATIVE, SPECIAL OR CONSEQUENTIAL DAMAGES) WHATSOEVER ARISING OUT OF OR IN
|
| 51 |
+
CONNECTION WITH THIS AGREEMENT (EVEN IF INTEL HAS BEEN ADVISED OF THE
|
| 52 |
+
POSSIBILITY OF SUCH LOSSES OR DAMAGES).
|
| 53 |
+
|
| 54 |
+
6. Term and Termination.
|
| 55 |
+
The term of this Agreement will commence upon Your acceptance of this Agreement
|
| 56 |
+
or access to the Material and will continue in full force and effect until
|
| 57 |
+
terminated in accordance with the terms and conditions herein. Intel may
|
| 58 |
+
terminate this Agreement if You are in breach of any term or condition of this
|
| 59 |
+
Agreement. Upon termination of this Agreement, You shall delete and cease use of
|
| 60 |
+
the Material. Sections 4, 5 and 7 will survive the termination of this
|
| 61 |
+
Agreement.
|
| 62 |
+
|
| 63 |
+
7. Governing Law and Jurisdiction.
|
| 64 |
+
All disputes will be governed by the laws of the United States of America and
|
| 65 |
+
the State of Delaware without reference to conflict of law principles and
|
| 66 |
+
subject to the exclusive jurisdiction of the state or federal courts sitting in
|
| 67 |
+
the State of Delaware, and each party agrees that it submits to the personal
|
| 68 |
+
jurisdiction and venue of those courts and waives any objections.
|