Image-Text-to-Text
Transformers
Safetensors
GGUF
gemma3
turkish
türkiye
english
ai
lamapi
next
next-x1
efficient
text-generation
open-source
4b
huggingface
large-language-model
llm
causal
transformer
artificial-intelligence
machine-learning
ai-research
natural-language-processing
language
multilingual
multimodal
nlp
finetuned
lightweight
creative
summarization
question-answering
chat
generative-ai
optimized
unsloth
trl
sft
chemistry
code
biology
finance
legal
music
art
state-of-the-art
climate
medical
agent
text-generation-inference
Merge
dense
conversational
Instructions to use thelamapi/next-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thelamapi/next-4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="thelamapi/next-4b") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("thelamapi/next-4b") model = AutoModelForMultimodalLM.from_pretrained("thelamapi/next-4b", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use thelamapi/next-4b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf thelamapi/next-4b:F16 # Run inference directly in the terminal: llama cli -hf thelamapi/next-4b:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf thelamapi/next-4b:F16 # Run inference directly in the terminal: llama cli -hf thelamapi/next-4b:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf thelamapi/next-4b:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf thelamapi/next-4b:F16
Use Docker
docker model run hf.co/thelamapi/next-4b:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use thelamapi/next-4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thelamapi/next-4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thelamapi/next-4b", "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/thelamapi/next-4b:F16
- SGLang
How to use thelamapi/next-4b 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 "thelamapi/next-4b" \ --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": "thelamapi/next-4b", "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 "thelamapi/next-4b" \ --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": "thelamapi/next-4b", "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" } } ] } ] }' - Ollama
How to use thelamapi/next-4b with Ollama:
ollama run hf.co/thelamapi/next-4b:F16
- Unsloth Desktop
- Docker Model Runner
How to use thelamapi/next-4b with Docker Model Runner:
docker model run hf.co/thelamapi/next-4b:F16
- Lemonade
How to use thelamapi/next-4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull thelamapi/next-4b:F16
Run and chat with the model
lemonade run user.next-4b-F16
List all available models
lemonade list
- Atomic Chat
Update README.md
Browse files
README.md
CHANGED
|
@@ -143,45 +143,9 @@ This model is ideal for **researchers, developers, and organizations** who need
|
|
| 143 |
|
| 144 |
---
|
| 145 |
|
| 146 |
-
## 🎯 Goals
|
| 147 |
-
|
| 148 |
-
1. **Multimodal Intelligence:** Understand and reason over images and text.
|
| 149 |
-
2. **Efficiency:** Run on modest GPUs using 8-bit quantization.
|
| 150 |
-
3. **Accessibility:** Open-source availability for research and applications.
|
| 151 |
-
4. **Cultural Relevance:** Optimized for Turkish language and context while remaining multilingual.
|
| 152 |
-
|
| 153 |
-
---
|
| 154 |
-
|
| 155 |
-
## ✨ Key Features
|
| 156 |
-
|
| 157 |
-
| Feature | Description |
|
| 158 |
-
| --------------------------------- | ----------------------------------------------------------------------- |
|
| 159 |
-
| 🔋 Efficient Architecture | Optimized for low VRAM; supports 8-bit quantization for consumer GPUs. |
|
| 160 |
-
| 🖼️ Vision-Language Capable | Understands images, captions them, and performs visual reasoning tasks. |
|
| 161 |
-
| 🇹🇷 Multilingual & Turkish-Ready | Handles complex Turkish text with high accuracy. |
|
| 162 |
-
| 🧠 Advanced Reasoning | Supports logical and analytical reasoning for both text and images. |
|
| 163 |
-
| 📊 Consistent & Reliable Outputs | Reproducible responses across multiple runs. |
|
| 164 |
-
| 🌍 Open Source | Transparent, community-driven, and research-friendly. |
|
| 165 |
-
|
| 166 |
-
---
|
| 167 |
-
|
| 168 |
-
## 📐 Model Specifications
|
| 169 |
-
|
| 170 |
-
| Specification | Details |
|
| 171 |
-
| ------------------ | ---------------------------------------------------------------------------------- |
|
| 172 |
-
| Base Model | Gemma 3 |
|
| 173 |
-
| Parameter Count | 4 Billion |
|
| 174 |
-
| Architecture | Transformer, causal LLM + Vision Encoder |
|
| 175 |
-
| Fine-Tuning Method | Instruction & multimodal fine-tuning (SFT) on Turkish and multilingual datasets |
|
| 176 |
-
| Optimizations | Q8_0, F16, F32 quantizations for low VRAM and high VRAM usage |
|
| 177 |
-
| Modalities | Text & Image |
|
| 178 |
-
| Use Cases | Image captioning, multimodal QA, text generation, reasoning, creative storytelling |
|
| 179 |
-
|
| 180 |
-
---
|
| 181 |
-
|
| 182 |
## 🚀 Installation & Usage
|
| 183 |
|
| 184 |
-
###
|
| 185 |
|
| 186 |
```python
|
| 187 |
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoProcessor
|
|
@@ -189,26 +153,23 @@ from PIL import Image
|
|
| 189 |
import torch
|
| 190 |
|
| 191 |
model_id = "Lamapi/next-4b"
|
|
|
|
| 192 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 193 |
processor = AutoProcessor.from_pretrained(model_id) # For vision.
|
| 194 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 195 |
-
```
|
| 196 |
-
|
| 197 |
-
### Using the vision.
|
| 198 |
|
| 199 |
-
```python
|
| 200 |
# Read image
|
| 201 |
image = Image.open("image.jpg")
|
| 202 |
|
| 203 |
# Create a message in chat format
|
| 204 |
messages = [
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
]
|
| 213 |
|
| 214 |
# Prepare input with Tokenizer
|
|
@@ -221,28 +182,86 @@ print(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
| 221 |
|
| 222 |
|
| 223 |
```
|
| 224 |
-
<div style='
|
| 225 |
-
<
|
| 226 |
-
<
|
| 227 |
Who is in this image?
|
| 228 |
</div>
|
| 229 |
-
<div style='background-color:rgba(
|
| 230 |
The image shows <strong>Mustafa Kemal Atatürk</strong>, the founder and first President of the Republic of Turkey.
|
| 231 |
</div>
|
| 232 |
</div>
|
| 233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
---
|
| 236 |
|
| 237 |
-
##
|
| 238 |
|
| 239 |
-
|
|
| 240 |
-
| ------------------
|
| 241 |
-
|
|
| 242 |
-
|
|
| 243 |
-
|
|
| 244 |
-
|
|
| 245 |
-
|
|
|
|
|
|
|
|
| 246 |
|
| 247 |
---
|
| 248 |
|
|
|
|
| 143 |
|
| 144 |
---
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
## 🚀 Installation & Usage
|
| 147 |
|
| 148 |
+
### Use with vision:
|
| 149 |
|
| 150 |
```python
|
| 151 |
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoProcessor
|
|
|
|
| 153 |
import torch
|
| 154 |
|
| 155 |
model_id = "Lamapi/next-4b"
|
| 156 |
+
|
| 157 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 158 |
processor = AutoProcessor.from_pretrained(model_id) # For vision.
|
| 159 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
|
|
|
|
|
|
|
|
| 160 |
|
|
|
|
| 161 |
# Read image
|
| 162 |
image = Image.open("image.jpg")
|
| 163 |
|
| 164 |
# Create a message in chat format
|
| 165 |
messages = [
|
| 166 |
+
{"role": "system","content": [{"type": "text", "text": "You are Next-X1, a smart and concise AI assistant trained by Lamapi. Always respond in the user's language. Proudly made in Turkey."}]},
|
| 167 |
+
|
| 168 |
+
{
|
| 169 |
+
"role": "user","content": [{"type": "image", "image": image},
|
| 170 |
+
{"type": "text", "text": "Who is in this image?"}
|
| 171 |
+
]
|
| 172 |
+
}
|
| 173 |
]
|
| 174 |
|
| 175 |
# Prepare input with Tokenizer
|
|
|
|
| 182 |
|
| 183 |
|
| 184 |
```
|
| 185 |
+
<div style='width:700px;'>
|
| 186 |
+
<img src='/Lamapi/next-4b/resolve/main/assets/image.jpg' style='height:192px;border-radius:16px;margin-left:225px;'>
|
| 187 |
+
<div style='background-color:rgba(0,140,255,0.5);border-radius:16px;border-bottom-right-radius:0px;padding:3px 10px;width:fit-content;max-width:400px;margin-left:250px;margin-top:-25px;margin-bottom:10px;'>
|
| 188 |
Who is in this image?
|
| 189 |
</div>
|
| 190 |
+
<div style='background-color:rgba(42,42,40,0.7);border-radius:16px;border-bottom-left-radius:0px;padding:3px 10px;width:fit-content;max-width:400px;'>
|
| 191 |
The image shows <strong>Mustafa Kemal Atatürk</strong>, the founder and first President of the Republic of Turkey.
|
| 192 |
</div>
|
| 193 |
</div>
|
| 194 |
|
| 195 |
+
### Use without vision:
|
| 196 |
+
|
| 197 |
+
```python
|
| 198 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 199 |
+
import torch
|
| 200 |
+
|
| 201 |
+
model_id = "Lamapi/next-4b"
|
| 202 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 203 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 204 |
+
|
| 205 |
+
# Chat message
|
| 206 |
+
messages = [
|
| 207 |
+
{"role": "system", "content": "You are Next-X1, a smart and concise AI assistant trained by Lamapi. Always respond in the user's language. Proudly made in Turkey."},
|
| 208 |
+
{"role": "user", "content": "Hello, how are you?"}
|
| 209 |
+
]
|
| 210 |
+
|
| 211 |
+
# Prepare input with Tokenizer
|
| 212 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 213 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 214 |
+
|
| 215 |
+
# Output from the model
|
| 216 |
+
output = model.generate(**inputs, max_new_tokens=50)
|
| 217 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
| 218 |
+
|
| 219 |
+
```
|
| 220 |
+
|
| 221 |
+
<div style='width:700px;'>
|
| 222 |
+
<div style='background-color:rgba(0,140,255,0.5);border-radius:16px;border-bottom-right-radius:0px;padding:3px 10px;width:fit-content;max-width:400px;margin-left:250px;margin-top:-15px;margin-bottom:10px;'>
|
| 223 |
+
Hello, how are you?
|
| 224 |
+
</div>
|
| 225 |
+
<div style='background-color:rgba(42,42,40,0.7);border-radius:16px;border-bottom-left-radius:0px;padding:3px 10px;width:fit-content;max-width:400px;'>
|
| 226 |
+
I'm fine, thank you. How are you?
|
| 227 |
+
</div>
|
| 228 |
+
</div>
|
| 229 |
+
|
| 230 |
+
---
|
| 231 |
+
|
| 232 |
+
## 🎯 Goals
|
| 233 |
+
|
| 234 |
+
1. **Multimodal Intelligence:** Understand and reason over images and text.
|
| 235 |
+
2. **Efficiency:** Run on modest GPUs using 8-bit quantization.
|
| 236 |
+
3. **Accessibility:** Open-source availability for research and applications.
|
| 237 |
+
4. **Cultural Relevance:** Optimized for Turkish language and context while remaining multilingual.
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
+
|
| 241 |
+
## ✨ Key Features
|
| 242 |
+
|
| 243 |
+
| Feature | Description |
|
| 244 |
+
| --------------------------------- | ----------------------------------------------------------------------- |
|
| 245 |
+
| 🔋 Efficient Architecture | Optimized for low VRAM; supports 8-bit quantization for consumer GPUs. |
|
| 246 |
+
| 🖼️ Vision-Language Capable | Understands images, captions them, and performs visual reasoning tasks. |
|
| 247 |
+
| 🇹🇷 Multilingual & Turkish-Ready | Handles complex Turkish text with high accuracy. |
|
| 248 |
+
| 🧠 Advanced Reasoning | Supports logical and analytical reasoning for both text and images. |
|
| 249 |
+
| 📊 Consistent & Reliable Outputs | Reproducible responses across multiple runs. |
|
| 250 |
+
| 🌍 Open Source | Transparent, community-driven, and research-friendly. |
|
| 251 |
|
| 252 |
---
|
| 253 |
|
| 254 |
+
## 📐 Model Specifications
|
| 255 |
|
| 256 |
+
| Specification | Details |
|
| 257 |
+
| ------------------ | ---------------------------------------------------------------------------------- |
|
| 258 |
+
| Base Model | Gemma 3 |
|
| 259 |
+
| Parameter Count | 4 Billion |
|
| 260 |
+
| Architecture | Transformer, causal LLM + Vision Encoder |
|
| 261 |
+
| Fine-Tuning Method | Instruction & multimodal fine-tuning (SFT) on Turkish and multilingual datasets |
|
| 262 |
+
| Optimizations | Q8_0, F16, F32 quantizations for low VRAM and high VRAM usage |
|
| 263 |
+
| Modalities | Text & Image |
|
| 264 |
+
| Use Cases | Image captioning, multimodal QA, text generation, reasoning, creative storytelling |
|
| 265 |
|
| 266 |
---
|
| 267 |
|