Image-Text-to-Text
Transformers
PyTorch
Safetensors
English
llama
text-generation
Merge
conversational
custom_code
text-generation-inference
Instructions to use GoofyLM/N2.3-Eye-1.3B-DEV with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GoofyLM/N2.3-Eye-1.3B-DEV with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="GoofyLM/N2.3-Eye-1.3B-DEV", trust_remote_code=True) 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 AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("GoofyLM/N2.3-Eye-1.3B-DEV", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("GoofyLM/N2.3-Eye-1.3B-DEV", trust_remote_code=True) 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 = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GoofyLM/N2.3-Eye-1.3B-DEV with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GoofyLM/N2.3-Eye-1.3B-DEV" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GoofyLM/N2.3-Eye-1.3B-DEV", "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/GoofyLM/N2.3-Eye-1.3B-DEV
- SGLang
How to use GoofyLM/N2.3-Eye-1.3B-DEV 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 "GoofyLM/N2.3-Eye-1.3B-DEV" \ --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": "GoofyLM/N2.3-Eye-1.3B-DEV", "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 "GoofyLM/N2.3-Eye-1.3B-DEV" \ --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": "GoofyLM/N2.3-Eye-1.3B-DEV", "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 GoofyLM/N2.3-Eye-1.3B-DEV with Docker Model Runner:
docker model run hf.co/GoofyLM/N2.3-Eye-1.3B-DEV
Create config.json
Browse files- config.json +42 -0
config.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "llama",
|
| 3 |
+
"architectures": ["MultimodalLFM2Model"],
|
| 4 |
+
|
| 5 |
+
"_name_or_path": "GoofyLM/N2.2-Eye-1.3B",
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoModelForCausalLM": "modeling_n2_eye.MultimodalLFM2Model",
|
| 8 |
+
"AutoConfig": "modeling_n2_eye.MultimodalLFM2Config"
|
| 9 |
+
},
|
| 10 |
+
|
| 11 |
+
"lfm2_model_name": "LiquidAI/LFM2-1.2B",
|
| 12 |
+
"clip_model_name": "google/siglip2-so400m-patch14-384",
|
| 13 |
+
"vision_projection_dim": 512,
|
| 14 |
+
|
| 15 |
+
"language_model_config": {
|
| 16 |
+
"model_type": "lfm2",
|
| 17 |
+
"hidden_size": 1536,
|
| 18 |
+
"vocab_size": 50257,
|
| 19 |
+
"max_position_embeddings": 2048
|
| 20 |
+
},
|
| 21 |
+
|
| 22 |
+
"vision_encoder_config": {
|
| 23 |
+
"model_type": "clip_vision_model",
|
| 24 |
+
"hidden_size": 768
|
| 25 |
+
},
|
| 26 |
+
|
| 27 |
+
"projection_config": {
|
| 28 |
+
"vision_hidden_size": 768,
|
| 29 |
+
"vision_projection_dim": 512,
|
| 30 |
+
"language_hidden_size": 1536,
|
| 31 |
+
"dropout": 0.1
|
| 32 |
+
},
|
| 33 |
+
|
| 34 |
+
"image_token": "<image>",
|
| 35 |
+
"max_length": 2048,
|
| 36 |
+
|
| 37 |
+
"torch_dtype": "bfloat16",
|
| 38 |
+
"transformers_version": "4.46.0",
|
| 39 |
+
"use_cache": true,
|
| 40 |
+
|
| 41 |
+
"chat_template": "{% set system_message = 'You are a helpful assistant trained by Liquid AI. You can see and understand images.' %}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% endif %}<|im_start|>system\n{{ system_message }}<|im_end|>\n<image>\n{% for message in loop_messages %}<|im_start|>{{ message['role'] }}\n{{ message['content'] }}<|im_end|>\n{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
|
| 42 |
+
}
|