Image-Text-to-Text
Transformers
Safetensors
English
qwen2_vl
latex
vLM
Vision
Codec
conversational
text-generation-inference
Instructions to use prithivMLmods/LatexMind-2B-Codec with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/LatexMind-2B-Codec with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/LatexMind-2B-Codec") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("prithivMLmods/LatexMind-2B-Codec") model = AutoModelForImageTextToText.from_pretrained("prithivMLmods/LatexMind-2B-Codec") 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 prithivMLmods/LatexMind-2B-Codec with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/LatexMind-2B-Codec" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/LatexMind-2B-Codec", "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/prithivMLmods/LatexMind-2B-Codec
- SGLang
How to use prithivMLmods/LatexMind-2B-Codec 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 "prithivMLmods/LatexMind-2B-Codec" \ --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": "prithivMLmods/LatexMind-2B-Codec", "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 "prithivMLmods/LatexMind-2B-Codec" \ --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": "prithivMLmods/LatexMind-2B-Codec", "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 prithivMLmods/LatexMind-2B-Codec with Docker Model Runner:
docker model run hf.co/prithivMLmods/LatexMind-2B-Codec
Update README.md
Browse files
README.md
CHANGED
|
@@ -37,6 +37,8 @@ This model is particularly effective in **retrieving mathematical notations and
|
|
| 37 |
|
| 38 |

|
| 39 |
|
|
|
|
|
|
|
| 40 |
# Use it with Transformers
|
| 41 |
|
| 42 |
|
|
@@ -102,7 +104,7 @@ output_text = processor.batch_decode(
|
|
| 102 |
)
|
| 103 |
print(output_text)
|
| 104 |
```
|
| 105 |
-
#
|
| 106 |
```python
|
| 107 |
buffer = ""
|
| 108 |
for new_text in streamer:
|
|
@@ -111,5 +113,30 @@ print(output_text)
|
|
| 111 |
buffer = buffer.replace("<|im_end|>", "")
|
| 112 |
yield buffer
|
| 113 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
|
|
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |

|
| 39 |
|
| 40 |
+
Demo: https://huggingface.co/prithivMLmods/LatexMind-2B-Codec/blob/main/latexmind/latexmind-codec.ipynb
|
| 41 |
+
|
| 42 |
# Use it with Transformers
|
| 43 |
|
| 44 |
|
|
|
|
| 104 |
)
|
| 105 |
print(output_text)
|
| 106 |
```
|
| 107 |
+
# Buf
|
| 108 |
```python
|
| 109 |
buffer = ""
|
| 110 |
for new_text in streamer:
|
|
|
|
| 113 |
buffer = buffer.replace("<|im_end|>", "")
|
| 114 |
yield buffer
|
| 115 |
```
|
| 116 |
+
Hereโs the **Intended Use & Limitations** section for **LatexMind-2B-Codec**:
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
# Intended Use
|
| 121 |
+
|
| 122 |
+
**LatexMind-2B-Codec** is designed for tasks that require **image-based text recognition**, **math equation extraction**, and **multi-modal understanding**. It is particularly useful in the following scenarios:
|
| 123 |
+
|
| 124 |
+
๐น **Optical Character Recognition (OCR)** โ Extracting printed and handwritten text from images, documents, and scanned pages.
|
| 125 |
+
๐น **Math Expression Recognition** โ Converting mathematical notations into structured **LaTeX format** for further computation and documentation.
|
| 126 |
+
๐น **Image-to-Text Conversion** โ Generating accurate descriptions for text-rich and math-heavy images.
|
| 127 |
+
๐น **Document and Academic Processing** โ Assisting researchers, students, and professionals in digitizing handwritten notes and extracting structured content from books, PDFs, and whiteboards.
|
| 128 |
+
๐น **Automated Educational Support** โ Enabling AI-powered tutors, content summarization, and interactive learning for subjects involving complex equations.
|
| 129 |
+
๐น **Multi-Language OCR** โ Recognizing text inside images across multiple languages, including English, Chinese, Japanese, Korean, Arabic, and various European languages.
|
| 130 |
+
๐น **Video-Based Question Answering** โ Understanding long-duration videos for content summarization, question answering, and structured data extraction.
|
| 131 |
+
|
| 132 |
+
# Limitations
|
| 133 |
|
| 134 |
+
Despite its capabilities, **LatexMind-2B-Codec** has some inherent limitations:
|
| 135 |
|
| 136 |
+
โ **Handwritten Text Accuracy** โ While it can recognize handwritten equations, performance may degrade with highly unstructured or messy handwriting.
|
| 137 |
+
โ **Complex LaTeX Formatting** โ The model may struggle with deeply nested or ambiguous LaTeX expressions, requiring manual corrections for precise formatting.
|
| 138 |
+
โ **Low-Resolution Images** โ Extracting accurate text from blurry or low-resolution images can lead to misinterpretations or OCR errors.
|
| 139 |
+
โ **Contextual Understanding in Multi-Step Equations** โ While it recognizes math expressions, solving multi-step problems autonomously may be limited.
|
| 140 |
+
โ **Limited Support for Rare Mathematical Notations** โ Some specialized or domain-specific symbols may not be recognized with high accuracy.
|
| 141 |
+
โ **Processing Speed for Large Documents** โ Performance may slow down when handling extremely large documents or dense mathematical content in real-time applications.
|
| 142 |
+
โ **Language-Specific OCR Variability** โ While it supports multiple languages, OCR accuracy may vary depending on the script complexity and font style.
|