Text Generation
Transformers
Safetensors
multi_modality
multimodal
lora-merged
4-bit precision
16-bit
image-understanding
image-generation
Instructions to use kiel2/Kiel-2.1-Omni with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kiel2/Kiel-2.1-Omni with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kiel2/Kiel-2.1-Omni")# Load model directly from transformers import MultiModalityCausalLM model = MultiModalityCausalLM.from_pretrained("kiel2/Kiel-2.1-Omni", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kiel2/Kiel-2.1-Omni with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kiel2/Kiel-2.1-Omni" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kiel2/Kiel-2.1-Omni", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kiel2/Kiel-2.1-Omni
- SGLang
How to use kiel2/Kiel-2.1-Omni 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 "kiel2/Kiel-2.1-Omni" \ --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": "kiel2/Kiel-2.1-Omni", "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 "kiel2/Kiel-2.1-Omni" \ --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": "kiel2/Kiel-2.1-Omni", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kiel2/Kiel-2.1-Omni with Docker Model Runner:
docker model run hf.co/kiel2/Kiel-2.1-Omni
Kiel-2.1-Omni
Kiel-2.1-Omni is a fully merged multimodal model fine-tuned from Janus-Pro-1B on a custom curriculum. It delivers dual-modality capabilities: high-fidelity Text-to-Image Generation and precise Multimodal Vision Understanding/Chat.
Deployment & Loading Instructions
Load in 16-Bit (Full Precision)
import torch
from janus.models import MultiModalityCausalLM
model = MultiModalityCausalLM.from_pretrained(
"kiel2/Kiel-2.1-Omni",
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
).eval()
Load in Memory-Efficient 4-Bit
Python
import torch
from janus.models import MultiModalityCausalLM
from transformers import BitsAndBytesConfig
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.float16,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True
)
model = MultiModalityCausalLM.from_pretrained(
"kiel2/Kiel-2.1-Omni",
quantization_config=quantization_config,
device_map="auto",
trust_remote_code=True
).eval()
Quickstart Inference Examples
1. Multimodal Image Understanding & Chat
Python
import torch
from PIL import Image
from janus.models import VLChatProcessor
# Load processor and tokenizer
processor = VLChatProcessor.from_pretrained("kiel2/Kiel-2.1-Omni", trust_remote_code=True)
tokenizer = processor.tokenizer
device = "cuda" if torch.cuda.is_available() else "cpu"
image = Image.open("path_to_image.jpg").convert("RGB")
query = "Describe the architectural style and lighting of this scene in detail."
conversation = [
{"role": "<|User|>", "content": f"<image_placeholder>\n{query}"},
{"role": "<|Assistant|>", "content": ""}
]
inputs = processor(
conversations=[conversation],
images=[image],
padding=True,
return_tensors="pt"
).to(device)
inputs_embeds = model.prepare_multimodal_embeds(**inputs)
outputs = model.language_model.generate(
inputs_embeds=inputs_embeds,
attention_mask=inputs.attention_mask,
pad_token_id=tokenizer.eos_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id,
max_new_tokens=256,
do_sample=True,
temperature=0.4,
top_p=0.9
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
2. Text-to-Image Generation
Python
import torch
import numpy as np
from PIL import Image
from janus.models import VLChatProcessor
processor = VLChatProcessor.from_pretrained("kiel2/Kiel-2.1-Omni", trust_remote_code=True)
tokenizer = processor.tokenizer
device = "cuda" if torch.cuda.is_available() else "cpu"
prompt = "A majestic cyberpunk castle overlooking a neon-lit futuristic city at sunset, cinematic lighting"
conversation = [
{"role": "<|User|>", "content": prompt},
{"role": "<|Assistant|>", "content": ""}
]
sft_format = processor.apply_sft_template_for_multi_turn_prompts(
conversations=conversation,
sft_format=processor.sft_format,
system_prompt=""
)
full_prompt = sft_format + processor.image_start_tag
input_ids = tokenizer.encode(full_prompt, return_tensors="pt").to(device)
# Generate image tokens autoregressively...
- Downloads last month
- 1,118
Model tree for kiel2/Kiel-2.1-Omni
Base model
deepseek-ai/Janus-Pro-1B