Instructions to use X-D-Lab/KarmaVLM-Qwen1_5-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use X-D-Lab/KarmaVLM-Qwen1_5-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="X-D-Lab/KarmaVLM-Qwen1_5-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("X-D-Lab/KarmaVLM-Qwen1_5-7B", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use X-D-Lab/KarmaVLM-Qwen1_5-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "X-D-Lab/KarmaVLM-Qwen1_5-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "X-D-Lab/KarmaVLM-Qwen1_5-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/X-D-Lab/KarmaVLM-Qwen1_5-7B
- SGLang
How to use X-D-Lab/KarmaVLM-Qwen1_5-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 "X-D-Lab/KarmaVLM-Qwen1_5-7B" \ --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": "X-D-Lab/KarmaVLM-Qwen1_5-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "X-D-Lab/KarmaVLM-Qwen1_5-7B" \ --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": "X-D-Lab/KarmaVLM-Qwen1_5-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use X-D-Lab/KarmaVLM-Qwen1_5-7B with Docker Model Runner:
docker model run hf.co/X-D-Lab/KarmaVLM-Qwen1_5-7B
π§π»ββοΈ KarmaVLM (ηΈη)
π Introduction
KarmaVLM is a family of high efficiency and powerful visual language model (VLM) pretrained with interleaved image-text data at scale, enabling content comprehension, recognition, and multi-round conversations about images.
π News
- [2024/02] KarmaVLM is released.
β‘οΈFeatures
KarmaVLM offers the following features:
High Efficiency: KarmaVLM focuses on exploring the capabilities of small parametric quantitative models on multimodal tasks. So, KarmaVLM can be efficiently deployed on most GPU cards and personal computers, and even on end devices such as mobile phones.
Multi-round text-image conversations: KarmaVLM can take both text and images as inputs and produce text outputs. Currently, it supports multi-round visual question answering with one image.
Strong image comprehension: KarmaVLM is adept at analyzing visuals, making it an efficient tool for tasks like extracting, organizing, and summarizing information from images.
π¨βπ» Quick Start
Requirements and Installation
git clone https://github.com/X-D-Lab/KarmaVLM.git
cd KarmaVLM
conda create -n karmavlm python=3.10 -y
conda activate karmavlm
pip install --upgrade pip # enable PEP 660 support
pip install -e .
pip install -e ".[train]"
pip install flash-attn --no-build-isolation
π Demo
- CLI Inference
python -m llava.serve.cli \ --model-path /path/to/karmavlm/model \ --image-file /path/to/the/test/image - Gradio Web UI
- Starting the Controller
python -m llava.serve.gradio_web_server \ --controller http://localhost:10000 \ --model-list-mode reload --share ##(optional) - Launching the Gradio Web Server
python -m llava.serve.model_worker \ --host 0.0.0.0 \ --controller http://localhost:10000 \ --port 40000 \ --worker http://localhost:40000 \ --model-path /path/to/karmavlm/model \
π License
This project utilizes certain datasets and checkpoints that are subject to their respective original licenses. Users must comply with all terms and conditions of these original licenses. The content of this project itself is licensed under the Apache license 2.0.
πβ Architecture
We build our project based on LLaVA: Large Language and Vision Assistant.
- Downloads last month
- 7