初始化项目,由ModelHub XC社区提供模型

Model: BennyDaBall/LFM2.5-1.2B-Z-Image-Engineer-V4
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-15 15:52:04 +08:00
commit 8ada55da87
18 changed files with 328218 additions and 0 deletions

44
.gitattributes vendored Normal file
View File

@@ -0,0 +1,44 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-F16.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
LFM2.5-1.2B-Z-Image-Engineer-V4-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a58e8967de598181c86cee9ce9377ece2a8d57d86e073c03f5f7f3a1f2b72920
size 2343325696

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bd26a3ba6cea5a35e01478d11a5df2fb5bdbd20e96f000a4e254819818b5018f
size 635473920

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c8e9c4f66b1cb6f2f809d6f3f2551e3e6b1009f3fe56a645d9e3dd409f4971e0
size 600346624

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d299e98d23ba99771f327fbda1f0274c3fcd756b7293488121e38acfad8bf890
size 730894336

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ece417c02830f28fc5edf4bce4dfa4bb2b1ea52f012a5b4a2d24419eb10f27d5
size 700469248

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e0121baa5874950ec0b24be867bb8ed131bf143acc13cdf5254f94860d3bcabe
size 843354112

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d1b024a6dd08d55b4fe00e139114b3655b63dae6f44b496a04a77e54b89b76d8
size 825249792

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2efb4dc17c6f082e92e95699710a4bc68f8f73c5b41421e35d8466847346a1a7
size 962842624

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8dcaf41188ebc66f33c07413737fef0a74bc9d012f5ca451fbbb94ca830152f0
size 1246253056

159
README.md Normal file
View File

@@ -0,0 +1,159 @@
---
license: apache-2.0
language:
- en
library_name: transformers
tags:
- text-generation
- prompt-engineering
- image-generation
- lfm
- liquid
- gguf
pipeline_tag: text-generation
---
# 🚀 LFM2.5-1.2B-Z-Image-Engineer-V4
The **Z-Engineer** goes *liquid*—smaller, faster, and ready to drink.
This is Z-Engineer V4 built on **Liquid Foundation Model 2.5 (LFM2.5)**—a 1.2B parameter model that punches way above its weight class. Perfect for batch workflows where you need prompt engineering at *warp speed*.
---
## 🧠 What is this?
LFM2.5-1.2B-Z-Image-Engineer-V4 is a fully fine-tuned version of [LiquidAI/LFM2.5-1.2B-Base](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Base). It's been specifically trained to understand the nuances of AI Image Generation workflows.
**It excels at:**
- **Expanding Concepts**: Turn "neon samurai" into a full cinematic sequence with lighting, lens choices, and atmosphere.
- **Technical Precision**: Understands camera terminology, lighting setups, and film aesthetics.
- **Blazing Speed**: At 1.2B parameters, it's ~3x faster than the Qwen3-4B version while maintaining quality.
---
## 🔑 Key Use Cases
-**High-Throughput Workflows**: When you need to expand hundreds or thousands of prompts, LFM2.5's speed shines.
- 💾 **Low VRAM Deployments**: Runs comfortably on minimal hardware—perfect for embedded or edge use cases.
- 🛡️ **Local & Private**: Runs entirely on your machine. No API fees, no data logging.
- 🔌 **ComfyUI Ready**: Works with the same [ComfyUI-Z-Engineer](https://github.com/BennyDaBall930/ComfyUI-Z-Engineer) node as the Qwen3 version.
---
## 🧬 SMART Training: Adapted for LFM2.5's Hybrid Architecture
This version uses **SMART Training** (Smart Mode with Adaptive Regularization Topologer)—the same methodology used for Qwen3-4B-Z-Engineer-V4, but adapted for LFM2.5's unique hybrid architecture.
**LFM2.5's Challenge**: Unlike traditional transformers, LFM2.5 uses a *hybrid* architecture mixing attention layers with recurrent (liquid) layers. The standard SMART regularizers needed significant adaptation:
| Adaptation | What Changed | Why |
|------------|--------------|-----|
| **Attention-Only Filtering** | Regularizers only process attention layer outputs, skipping recurrent layers | Recurrent layer hidden states have different statistical properties |
| **Layer Pooling** | Last 4 attention layers are mean-pooled for topology regularization | Provides stable representation despite sparser attention placement |
| **Reduced Regularizer Weights** | Entropic: 0.003, Holographic: 0.01, Topology: 0.02/0.02 | LFM2.5's smaller capacity needs gentler regularization |
| **Superfluid-Inspired Damping** | "SmartGate" auto-reduces aux loss contribution on gradient instability | Prevents training collapse when hybrid layers produce non-finite gradients |
**The result?** Stable training on a fundamentally different architecture while still benefiting from diversity, coherence, and depth regularization.
---
## 📉 Why Choose LFM2.5 Over Qwen3-4B?
| Aspect | LFM2.5-1.2B | Qwen3-4B |
|--------|-------------|----------|
| **Parameters** | 1.2B | 4B |
| **Speed** | ~3x faster | Baseline |
| **VRAM** | ~1-2 GB (Q4) | ~2.5 GB (Q4) |
| **Quality** | Good for most use cases | Highest quality |
| **Best For** | Batch processing, edge deployment, speed-critical workflows | Maximum quality, complex scenes |
**Choose LFM2.5 when**: You're processing large batches, running on limited hardware, or speed matters more than marginal quality gains.
**Choose Qwen3-4B when**: You want the absolute best quality and can afford the extra compute.
---
## 🔌 ComfyUI Integration
Works with the same custom node as the Qwen3 version:
- **Get it here**: [ComfyUI-Z-Engineer](https://github.com/BennyDaBall930/ComfyUI-Z-Engineer)
---
## 📝 Recommended System Prompt
For best results, use this system prompt:
> Interpret the user seed as production intent, then build a definitive 200-250 word single-paragraph image prompt that preserves every explicit constraint while intelligently expanding missing details. First infer the core subject, action, setting, and emotional tone; treat these as non-negotiable anchors. Then enhance with precise visual staging (explicit foreground, midground, background), clear visual hierarchy and eye path, physically plausible lighting (source, direction, softness, color temperature), and optical strategy (if lens/aperture are provided, preserve exactly; if absent, choose fitting lens and aperture and imply their depth-of-field effect). Integrate organic, manufactured, and environmental textures with realistic material behavior, add motion/atmospheric cues only when they support the scene, and apply a coherent color grade consistent with mood and environment. Keep the prose vivid but controlled: no contradictions, no overstuffing, no generic filler. Do not mention camera body brands. Output one polished paragraph only, no bullets, no line breaks, no meta commentary.
---
## 💻 Training Facts
I believe in open science. Here's exactly how this was built:
**Hardware:**
- Trained locally on an AMD Strix Halo system (Ryzen AI Max+ 395, 128GB Unified RAM)
- AMD Radeon 8060S Graphics (ROCm/HIP)
**Dataset:**
- Size: **55,000** high-quality examples (same dataset as Qwen3-4B version)
- **25,000 Vision-Grounded Samples**: Real professional photographs transcribed using Qwen3-VL-30B-A3B
- **30,000 Synthetic Samples**: Generated prompt enhancement pairs
**Training Configuration:**
| Parameter | Value |
|-----------|-------|
| Method | Full Fine-Tune (not LoRA) |
| Base Model | [LiquidAI/LFM2.5-1.2B-Base](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Base) |
| Optimizer Steps | 3,500 |
| Batch Size | 8 × 3 accumulation = 24 effective |
| Learning Rate | 5e-6 (cosine decay with 5% warmup) |
| Precision | BFloat16 |
| Sequence Length | 640 tokens |
---
## 📦 GGUF & Quantization
I provide a full suite of GGUF quantizations for use with `llama.cpp`, Ollama, and LM Studio:
| Quantization | Size | Notes |
|--------------|------|-------|
| F16 | 2.2 GB | Full precision, maximum quality |
| Q8_0 | 1.2 GB | Near-lossless, recommended |
| Q6_K | 918 MB | Great balance |
| Q5_K_M | 804 MB | Good quality |
| Q5_K_S | 787 MB | Slightly smaller |
| Q4_K_M | 697 MB | Solid 4-bit |
| Q4_K_S | 668 MB | Smaller 4-bit |
| Q3_K_L | 606 MB | Lower quality |
| Q3_K_M | 573 MB | Medium 3-bit |
---
## 🎯 Quick Start
**With LM Studio:**
1. Download the GGUF of your choice
2. Load it in LM Studio
3. Use the ComfyUI node or chat directly
---
## ⚠️ Disclaimer
This model generates text for image prompts. While I have filtered the dataset to the best of my ability, users should exercise their own judgment. I am not responsible for the content you generate.
---
## 🙏 Acknowledgements
- **LiquidAI** for the excellent LFM2.5 architecture
- **Qwen Team** for the VL model used in dataset creation
- The **open source AI community** for making this kind of work possible
---
*Built with ❤️ and liquid courage by BennyDaBall*

View File

@@ -0,0 +1,7 @@
{{- bos_token -}}{%- set system_prompt = "" -%}{%- set ns = namespace(system_prompt="") -%}{%- if messages[0]["role"] == "system" -%} {%- set ns.system_prompt = messages[0]["content"] -%} {%- set messages = messages[1:] -%}{%- endif -%}{%- if tools -%} {%- set ns.system_prompt = ns.system_prompt + ("
" if ns.system_prompt else "") + "List of tools: <|tool_list_start|>[" -%} {%- for tool in tools -%} {%- if tool is not string -%} {%- set tool = tool | tojson -%} {%- endif -%} {%- set ns.system_prompt = ns.system_prompt + tool -%} {%- if not loop.last -%} {%- set ns.system_prompt = ns.system_prompt + ", " -%} {%- endif -%} {%- endfor -%} {%- set ns.system_prompt = ns.system_prompt + "]<|tool_list_end|>" -%}{%- endif -%}{%- if ns.system_prompt -%} {{- "<|im_start|>system
" + ns.system_prompt + "<|im_end|>
" -}}{%- endif -%}{%- for message in messages -%} {{- "<|im_start|>" + message["role"] + "
" -}} {%- set content = message["content"] -%} {%- if content is not string -%} {%- set content = content | tojson -%} {%- endif -%} {%- if message["role"] == "tool" -%} {%- set content = "<|tool_response_start|>" + content + "<|tool_response_end|>" -%} {%- endif -%} {{- content + "<|im_end|>
" -}}{%- endfor -%}{%- if add_generation_prompt -%} {{- "<|im_start|>assistant
" -}}{%- endif -%}

57
safetensors/config.json Normal file
View File

@@ -0,0 +1,57 @@
{
"architectures": [
"Lfm2ForCausalLM"
],
"block_auto_adjust_ff_dim": true,
"block_dim": 2048,
"block_ff_dim": 12288,
"block_ffn_dim_multiplier": 1.0,
"block_mlp_init_scale": 1.0,
"block_multiple_of": 256,
"block_norm_eps": 1e-05,
"block_out_init_scale": 1.0,
"block_use_swiglu": true,
"block_use_xavier_init": true,
"bos_token_id": 1,
"conv_L_cache": 3,
"conv_bias": false,
"conv_dim": 2048,
"conv_use_xavier_init": true,
"dtype": "bfloat16",
"eos_token_id": 7,
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 12288,
"layer_types": [
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"full_attention",
"conv",
"full_attention",
"conv",
"full_attention",
"conv"
],
"max_position_embeddings": 128000,
"model_type": "lfm2",
"norm_eps": 1e-05,
"num_attention_heads": 32,
"num_heads": 32,
"num_hidden_layers": 16,
"num_key_value_heads": 8,
"pad_token_id": 0,
"rope_theta": 1000000.0,
"tie_embedding": true,
"transformers_version": "4.57.1",
"use_cache": false,
"use_pos_enc": true,
"vocab_size": 65536
}

View File

@@ -0,0 +1,7 @@
{
"_from_model_config": true,
"bos_token_id": 1,
"eos_token_id": 7,
"pad_token_id": 0,
"transformers_version": "4.57.1"
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d501277976f49ba255b99b01382354111e7092626033798e545dde57f563ee71
size 2340697936

View File

@@ -0,0 +1,23 @@
{
"bos_token": {
"content": "<|startoftext|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"eos_token": {
"content": "<|im_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"pad_token": {
"content": "<|pad|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

323812
safetensors/tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff