Image-to-Text
Transformers
Safetensors
qwen2_5_vl
image-text-to-text
OCR
vision-language
VLM
Reasoning
document-to-markdown
qwen2.5
markdown
extraction
RAG
text-generation-inference
Instructions to use numind/NuMarkdown-8B-Thinking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use numind/NuMarkdown-8B-Thinking with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="numind/NuMarkdown-8B-Thinking")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("numind/NuMarkdown-8B-Thinking") model = AutoModelForMultimodalLM.from_pretrained("numind/NuMarkdown-8B-Thinking", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -194,15 +194,20 @@ base64_image = encode_image("invoice.png")
|
|
| 194 |
|
| 195 |
chat_response = client.chat.completions.create(
|
| 196 |
model="numind/NuMarkdown-8B-reasoning",
|
| 197 |
-
temperature=0.
|
| 198 |
messages=[
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
],
|
| 204 |
-
|
| 205 |
-
]
|
| 206 |
)
|
| 207 |
|
| 208 |
reasoning = chat_response.choices[0].message.content.split("<thining>")[1].split("</thining>")[0]
|
|
@@ -222,7 +227,8 @@ model_id = "numind/NuMarkdown-8B-reasoning"
|
|
| 222 |
|
| 223 |
processor = AutoProcessor.from_pretrained(
|
| 224 |
model_id,
|
| 225 |
-
trust_remote_code=True,
|
|
|
|
| 226 |
)
|
| 227 |
|
| 228 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
@@ -244,7 +250,7 @@ prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_
|
|
| 244 |
enc = processor(text=prompt, images=[img], return_tensors="pt").to(model.device)
|
| 245 |
|
| 246 |
with torch.no_grad():
|
| 247 |
-
out = model.generate(**enc, max_new_tokens=5000)
|
| 248 |
|
| 249 |
print(processor.decode(out[0].split("<answer>")[1].split("</answer>")[0], skip_special_tokens=True))
|
| 250 |
```
|
|
|
|
| 194 |
|
| 195 |
chat_response = client.chat.completions.create(
|
| 196 |
model="numind/NuMarkdown-8B-reasoning",
|
| 197 |
+
temperature=0.7,
|
| 198 |
messages=[
|
| 199 |
+
{
|
| 200 |
+
"role": "user",
|
| 201 |
+
"content": [
|
| 202 |
+
{"type": "image_url",
|
| 203 |
+
"image_url": {"url": data_url},
|
| 204 |
+
"min_pixels": 100 * 28 * 28,
|
| 205 |
+
"max_pixels": 5000 * 28 * 28,},
|
| 206 |
+
|
| 207 |
+
],
|
| 208 |
+
},
|
| 209 |
],
|
| 210 |
+
|
|
|
|
| 211 |
)
|
| 212 |
|
| 213 |
reasoning = chat_response.choices[0].message.content.split("<thining>")[1].split("</thining>")[0]
|
|
|
|
| 227 |
|
| 228 |
processor = AutoProcessor.from_pretrained(
|
| 229 |
model_id,
|
| 230 |
+
trust_remote_code=True,
|
| 231 |
+
min_pixels=100*28*28, max_pixels=5000*28*28
|
| 232 |
)
|
| 233 |
|
| 234 |
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
|
|
| 250 |
enc = processor(text=prompt, images=[img], return_tensors="pt").to(model.device)
|
| 251 |
|
| 252 |
with torch.no_grad():
|
| 253 |
+
out = model.generate(**enc, temperature = 0.7, max_new_tokens=5000)
|
| 254 |
|
| 255 |
print(processor.decode(out[0].split("<answer>")[1].split("</answer>")[0], skip_special_tokens=True))
|
| 256 |
```
|