N2-Eye is a multimodal language model that combines the power of LiquidAI's LFM2-1.2B language model with OpenAI's CLIP vision encoder to enable image understanding and conversation capabilities.
Model Details
Base Language Model: LiquidAI/LFM2-1.2B (1.26B parameters)
Vision Encoder: OpenAI CLIP-ViT-Base-Patch32
Model Type: Image-Text-to-Text (Multimodal Conversational)
Training Dataset: CRAG-MM Multi-Turn Public Dataset
License: MIT
Framework: PyTorch + Transformers
Architecture
N2-Eye uses a modular architecture that combines:
Language Model: LFM2-1.2B for text generation and conversation
Vision Encoder: CLIP for image understanding (frozen during training)
Projection Layer: A trainable MLP that maps CLIP features to the language model's embedding space
The model processes images by:
Encoding images with CLIP to extract visual features
Projecting these features through a learnable projection layer
Integrating projected features into the language model at special <image> token positions
Training Details
Dataset
Source: CRAG-MM Multi-Turn Public Dataset (v0.1.1)
Format: Multi-turn conversations with images
Preprocessing: Conversations formatted with ChatML-style tokens
Training Configuration
Batch Size: 2 per device (with gradient accumulation steps: 4)
Learning Rate: 2e-5
Training Length: 1 epoch on validation split
Precision: bfloat16
Max Sequence Length: 2048 tokens
Optimization: Gradient checkpointing enabled
Special Tokens
<image>: Placeholder for image embeddings in conversation
System prompt: "You are a helpful assistant trained by Liquid AI. You can see and understand images."
Usage
Basic Inference
python
1# Load model directly2from transformers import AutoTokenizer, AutoModelForCausalLM
34tokenizer = AutoTokenizer.from_pretrained("GoofyLM/N2.1-Eye-1.3B", trust_remote_code=True)5model = AutoModelForCausalLM.from_pretrained("GoofyLM/N2.1-Eye-1.3B", trust_remote_code=True)6messages =[7{8"role":"user",9"content":[10{"type":"image","url":"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},11{"type":"text","text":"What animal is on the candy?"}12]13},14]15inputs = tokenizer.apply_chat_template(16 messages,17 add_generation_prompt=True,18 tokenize=True,19 return_dict=True,20 return_tensors="pt",21).to(model.device)2223outputs = model.generate(**inputs, max_new_tokens=40)24print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Chat Template
N2-Eye uses an advanced ChatML-based format with support for tools and multimodal content. The model includes a sophisticated Jinja2 template that handles:
System prompts: Automatically formatted with <|im_start|>system tags
Tool integration: Special <|tool_list_start|> and <|tool_list_end|> markers for tool definitions
Tool responses: Wrapped with <|tool_response_start|> and <|tool_response_end|> markers
Multimodal content: JSON serialization for complex message content including images
Basic conversation format:
<|im_start|>system
You are a helpful assistant trained by Liquid AI. You can see and understand images.<|im_end|>
<image>
<|im_start|>user
{user_message}<|im_end|>
<|im_start|>assistant
{assistant_response}<|im_end|>
For tool-enabled conversations:
<|im_start|>system
{system_prompt}
List of tools: <|tool_list_start|>[{tool_definitions}]<|tool_list_end|><|im_end|>
<|im_start|>user
{user_message}<|im_end|>
<|im_start|>assistant
{assistant_response}<|im_end|>
<|im_start|>tool
<|tool_response_start|>{tool_output}<|tool_response_end|><|im_end|>
Capabilities
N2-Eye can:
Visual Understanding: Understand and describe images in detail
Visual Q&A: Answer questions about visual content
Multi-turn Conversations: Engage in extended conversations that reference images
Tool Integration: Support for tool calling and structured responses
Multimodal Reasoning: Combine visual and textual information for comprehensive responses
Structured Output: Handle complex message formats including JSON content
Limitations
Image Token Handling: Requires specific placement of <image> tokens in conversation format
Single Image: Currently optimized for single image per conversation
Training Scale: Trained on a limited dataset (validation split only)
Frozen Vision: CLIP encoder is frozen, limiting adaptation to new visual domains
Technical Implementation
Model Architecture Classes
The implementation includes several key components:
MultimodalLFM2Model: Main model class combining language and vision
CRAGMMDataset: Dataset handler for CRAG-MM format
MultimodalTrainer: Custom trainer for multimodal inputs