Downloads · 30 days
9
13% of all-time downloads
er6y/LongCat-Image-Edit-Turbo-MNN-int8
LongCat-Image-Edit-Turbo-MNN-int8 is a machine learning model from er6y. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
LongCat-Image-Edit-Turbo-MNN-int8 is an MNN diffusion resource package for LongCat-Image-Edit-Turbo, to be used with the MNN C++ diffusiondemo binary for both Text-to-Image (T2I) and Image Editing tasks.
Downloads · 30 days
9
13% of all-time downloads
All-time downloads
69
Public
Repo size
12.7 GB
Likes
1
Public
Click a slice to open those files.
.weight11.4 GB · 90%
From the Hugging Face model README
LongCat-Image-Edit-Turbo-MNN-int8 is an MNN diffusion resource package for LongCat-Image-Edit-Turbo, to be used with the MNN C++ diffusion_demo binary for both Text-to-Image (T2I) and Image Editing tasks.
Supported Modes:
Note: LongCat uses model_type=3 for both modes. The mode is automatically determined by whether an input image is provided.
LongCat-Image-Edit is a state-of-the-art bilingual (Chinese-English) multimodal model that supports:
text_encoder/ directory containing:
visual.mnn / visual.mnn.weight (vision encoder for image understanding, int8 quantized)llm.mnn / llm.mnn.weight (language model for text processing, int4 quantized)embeddings_bf16.bin (text embeddings)tokenizer.txt (tokenizer vocabulary)config.json (text encoder configuration with model metadata and precision info)unet.mnn / unet.mnn.weight (diffusion transformer, int8 quantized)vae_encoder.mnn / vae_decoder.mnn (VAE for image encoding/decoding, fp16)config.json: resource description (filenames, precision labels, default inference parameters, etc.)configuration.json: generic task descriptionscheduler_config.json: FlowMatchEulerDiscreteScheduler configThe directory name LongCat-Image-Edit-Turbo-MNN-int8 denotes the primary quantization level. The actual bit-widths are:
Bit-width is set via MNNConvert --weightQuantBits. Treat config.json as the source of truth.
visual.onnx, llm.onnx, unet.onnx, vae_encoder.onnx, vae_decoder.onnxpixel_values; output image_embedsinput_ids, attention_mask, image_embeds; output last_hidden_statesample, timestep (float), encoder_hidden_states, image_latents; output out_samplesample; output latent_samplelatent_sample; output sample
MNNConvert -f ONNX --modelFile unet.onnx --MNNModel unet.mnn --weightQuantBits 8
MNNConvert -f ONNX --modelFile vae_encoder.onnx --MNNModel vae_encoder.mnn --weightQuantBits 16
MNNConvert -f ONNX --modelFile vae_decoder.onnx --MNNModel vae_decoder.mnn --weightQuantBits 16
longcat-image-edit.batThe script automatically detects whether to use T2I mode or Edit mode based on the arguments:
T2I Mode (Text-to-Image):
# Generate single image
.\longcat-image-edit.bat "一个年轻的亚裔女性,身穿黄色针织衫,搭配白色项链。她的双手放在膝盖上,表情恬静。背景是一堵粗糙的砖墙,午后的阳光温暖地洒在她身上,营造出一种宁静而温馨的氛围。镜头采用中距离视角,突出她的神态和服饰的细节。光线柔和地打在她的脸上,强调她的五官和饰品的质感,增加画面的层次感与亲和力。整个画面构图简洁,砖墙的纹理与阳光的光影效果相得益彰,突显出人物的优雅与从容。"
# Generate multiple images (batch)
.\longcat-image-edit.bat "一个年轻的亚裔女性,身穿黄色针织衫,搭配白色项链。她的双手放在膝盖上,表情恬静。背景是一堵粗糙的砖墙,午后的阳光温暖地洒在她身上,营造出一种宁静而温馨的氛围。镜头采用中距离视角,突出她的神态和服饰的细节。光线柔和地打在她的脸上,强调她的五官和饰品的质感,增加画面的层次感与亲和力。整个画面构图简洁,砖墙的纹理与阳光的光影效果相得益彰,突显出人物的优雅与从容。" 10
Edit Mode (Image Editing):
# Edit single image
.\longcat-image-edit.bat "将亚裔女性的黄色针织衫换成红色,白色项链换成金色项链,表情微笑" "input.jpg"
# Edit with multiple variations (batch)
.\longcat-image-edit.bat "将亚裔女性的黄色针织衫换成红色,白色项链换成金色项链,表情微笑" "input.jpg" 10
Auto-detection logic:
Arguments passed to diffusion_demo.exe:
resource_path model_type memory_mode backend_type iteration_num random_seed output_image_name [image_size] [cfg_scale] [cfg_mode] [gpu_mem_mode] [precision_mode] [te_on_cpu] [vae_on_cpu] <prompt_text> [input_image]
Script parameters (modifiable at top of longcat-image-edit.bat):
MODEL_DIR (default .): model directory (relative or absolute)MEMORY_TYPE (0/1/2): Diffusion memory mode (0=memory lack, 1=memory enough, 2=balance)BACKEND (0=cpu, 3=opencl, 7=vulkan)STEPS: diffusion steps (4–20 recommended; default 8)SEED: 0=auto random; non-0=fixed seedSIZE: 512/640/768/896/1024 (default 1024)CFG: classifier-free guidance scale
CFG_MODE: CFG sigma range for dual-UNet models (LongCat only)
GPU_MEM_MODE (OpenCL only): 0=auto, 1=buffer, 2=imagePRECISION (0=auto, 1=FP16, 2=FP32 normal, 3=FP32 high)TE_ON_CPU (0 same as UNet, 1 forces text_encoder on CPU; default 1)VAE_ON_CPU (0 same as UNet, 1 forces VAE on CPU for GPU memory saving; default 0)longcat-image-edit.shSame auto-detection logic as Windows:
T2I Mode:
# Generate single image
./longcat-image-edit.sh "一个年轻的亚裔女性,身穿黄色针织衫,搭配白色项链。她的双手放在膝盖上,表情恬静。背景是一堵粗糙的砖墙,午后的阳光温暖地洒在她身上,营造出一种宁静而温馨的氛围。镜头采用中距离视角,突出她的神态和服饰的细节。光线柔和地打在她的脸上,强调她的五官和饰品的质感,增加画面的层次感与亲和力。整个画面构图简洁,砖墙的纹理与阳光的光影效果相得益彰,突显出人物的优雅与从容。"
# Generate multiple images (batch)
./longcat-image-edit.sh "一个年轻的亚裔女性,身穿黄色针织衫,搭配白色项链。她的双手放在膝盖上,表情恬静。背景是一堵粗糙的砖墙,午后的阳光温暖地洒在她身上,营造出一种宁静而温馨的氛围。镜头采用中距离视角,突出她的神态和服饰的细节。光线柔和地打在她的脸上,强调她的五官和饰品的质感,增加画面的层次感与亲和力。整个画面构图简洁,砖墙的纹理与阳光的光影效果相得益彰,突显出人物的优雅与从容。" 10
Edit Mode:
# Edit single image
./longcat-image-edit.sh "将亚裔女性的黄色针织衫换成红色,白色项链换成金色项链,表情微笑" "input.jpg"
# Edit with multiple variations (batch)
./longcat-image-edit.sh "将亚裔女性的黄色针织衫换成红色,白色项链换成金色项链,表情微笑" "input.jpg" 10
Script parameters mirror the Windows script:
MODEL_DIRMEMORY_TYPEBACKEND (default 3=OpenCL on Linux/macOS)STEPS (default 8)SEEDSIZE (default 1024)CFG (T2I: 1, Edit: 1, auto-adjusted)CFG_MODE (default 0=auto)GPU_MEM_MODEPRECISIONTE_ON_CPU (default 1)VAE_ON_CPU (default 0)For detailed Windows build instructions, see BUILD_WINDOWS.md.
Quick summary:
cd MNN\build
cmake .. -DCMAKE_BUILD_TYPE=Release -DMNN_USE_SSE=ON -DMNN_AVX2=ON -DMNN_AVX512=ON -DMNN_AVX512_VNNI=ON -DMNN_OPENCL=ON -DMNN_VULKAN=ON -DMNN_VULKAN_IMAGE=ON -DMNN_SUPPORT_TRANSFORMER_FUSE=ON -DMNN_BUILD_CONVERTER=ON -DMNN_OPENMP=ON -DMNN_BUILD_DIFFUSION=ON -DMNN_BUILD_LLM=ON -DMNN_BUILD_OPENCV=ON -DMNN_LOW_MEMORY=ON -DMNN_USE_THREAD_POOL=ON
cmake --build . --config Release --target diffusion_demo -j 8
Then copy diffusion_demo.exe and MNN.dll from MNN\build\Release\ to the bin\ directory.
The scripts use model_type=3 for all operations. The diffusion_demo binary automatically detects whether to perform T2I or image editing based on the presence of the input_image parameter.
.mnn.weight) are large; use Git LFS/external storage when sharing.