axiomofmind/Moss-image-anime-lora

来源:🤗text-to-imageapache-2.0257 MBother✓ 23 个校验和今天更新
或提交种子

MOSS Image Anime LoRA

A high-energy seinen-inspired anime style LoRA for MOSS-Image. It emphasizes dramatic action, cinematic lighting, expressive adult characters, strong silhouettes, dense environments, and energetic compositions.

The adapter was trained against MOSS-Image-Base. Local evaluation favored MOSS-Image-SFT for inference.

Included checkpoints

This repository deliberately includes the two strongest checkpoint candidates:

Checkpoint Weight file Recommended scale Prompt recommendation
2,000 steps (canonical/default) pytorch_lora_weights.safetensors 1.0 Omit the trigger; use natural anime character wording
1,500 steps (alternate) checkpoints/step-1500/pytorch_lora_weights.safetensors 0.7 or 1.0 Omit the trigger; use natural anime character wording

Checkpoint 2000 at scale 0.7 with moss_seinen_style was also a decent secondary evaluation result. The three preferred configurations were checkpoint 2000 at scale 1.0 without the trigger and checkpoint 1500 at scales 0.7 and 1.0 without the trigger.

The registered training trigger is moss_seinen_style, but it is optional for inference. In the final local comparison, natural prompts containing anime character or anime characters generally performed better without the trigger. If the trigger is used, place it at the beginning of the prompt.

ComfyUI compatibility

The root pytorch_lora_weights.safetensors uses Diffusers / PEFT keys such as transformer.layers.0.proj.q.lora_A.weight. ComfyUI's native MOSS-Image loader addresses the same modules under diffusion_model.layers..., so loading the root file directly can report lora key not loaded.

Use the native ComfyUI variant for the canonical step-2000 checkpoint:

File Size Tensors SHA-256
MOSS-Image-Anime-LoRA-ComfyUI.safetensors 70.93 MiB 504 6661F88183757C7BE9044578D3907335D6ABE83A736995BD502B78DB2C5B83CF
  1. Update ComfyUI to a version with native MOSS-Image support; commit b1a247c or newer contains the required loader code.
  2. Put MOSS-Image-Anime-LoRA-ComfyUI.safetensors in ComfyUI/models/loras/.
  3. Use ComfyUI's standard LoRA loader with model strength 1.0 and clip strength 0.0.
  4. Prefer natural prompts containing anime character or anime characters without the trigger. The secondary tested configuration uses model strength 0.7 with moss_seinen_style at the beginning of the prompt.

Download only this variant with:

hf download axiomofmind/Moss-image-anime-lora \
  MOSS-Image-Anime-LoRA-ComfyUI.safetensors \
  --local-dir ./ComfyUI/models/loras

The conversion is namespace-only: transformer. becomes diffusion_model.. Tensor values, shapes, dtypes, rank, and alpha behavior are unchanged. All 504 converted tensors were checked against the 252 corresponding MOSS-Image-SFT modules. The reproducible converter is scripts/convert_moss_lora_for_comfyui.py.

This ComfyUI file corresponds to the canonical step-2000 root weight. The alternate step-1500 checkpoint remains available in its original Diffusers / PEFT layout under checkpoints/step-1500/.

Recommended settings

  • Underlying model: OpenMOSS-Team/MOSS-Image-SFT
  • Inference steps: 50
  • Guidance scale: 3.0
  • Negative prompt: empty
  • Typical resolution: 1024 × 1024; other aspect ratios should be validated for the intended scene
  • Prompt wording: describe adult anime characters naturally, including clothing, action, setting, lighting, and composition when useful

Evaluation samples

The samples below use identical content prompts and seeds across configurations. Stock SFT has no LoRA. The no-trigger LoRA prompts do not contain moss_seinen_style; the triggered checkpoint-2000 scale-0.7 column prepends it.

Scene Stock SFT Step 1500, no trigger, 0.7 Step 1500, no trigger, 1.0 Step 2000, no trigger, 1.0 Step 2000, triggered, 0.7
Flight-suit action
Weathered green coat
Motorcycle pursuit
Braided-white-hair repair

Prompts:

  1. an adult woman anime character in a charcoal flight suit sliding beneath a closing blast door as blue warning lights streak across a damaged orbital hangar
  2. an adult man anime character with copper hair and a weathered green coat standing knee-deep in a river while holding a cracked ceremonial mask beneath cold morning fog
  3. two adult anime characters riding the same motorcycle through a narrow tunnel, the driver leaning into a turn while the passenger fires a flare toward pursuing drones
  4. an adult woman anime character with braided white hair repairing a mechanical arm at a cluttered night workshop lit by welding sparks and hanging red lamps

All displayed images were generated with MOSS-Image-SFT, 50 inference steps, guidance 3.0, 1024 × 1024 resolution, an empty negative prompt, and the prompt-specific seeds recorded in checkpoint_manifest.json.

Loading either checkpoint

MOSS-Image uses a custom Diffusers pipeline. Select the desired repository filename, attach the adapter to the transformer with PEFT, and set the LoRA scale explicitly.

import json

import torch
from diffusers import DiffusionPipeline
from huggingface_hub import hf_hub_download
from peft import LoraConfig, inject_adapter_in_model, set_peft_model_state_dict
from peft.tuners.lora.layer import LoraLayer
from safetensors.torch import load_file

repo_id = "axiomofmind/Moss-image-anime-lora"

# Default checkpoint 2000:
weight_file = "pytorch_lora_weights.safetensors"
lora_scale = 1.0

# Alternate checkpoint 1500:
# weight_file = "checkpoints/step-1500/pytorch_lora_weights.safetensors"
# lora_scale = 0.7  # 1.0 also tested well

config_path = hf_hub_download(repo_id, "adapter_config.json")
weights_path = hf_hub_download(repo_id, weight_file)

with open(config_path, encoding="utf-8") as file:
    config = json.load(file)

pipe = DiffusionPipeline.from_pretrained(
    "OpenMOSS-Team/MOSS-Image-SFT",
    custom_pipeline="pipeline_moss_image",
    trust_remote_code=True,
    torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
)
pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)

inject_adapter_in_model(
    LoraConfig(
        r=config["r"],
        lora_alpha=config["lora_alpha"],
        target_modules=config["target_modules"],
    ),
    pipe.transformer,
)

state = {
    key.removeprefix("transformer."): value
    for key, value in load_file(weights_path, device="cpu").items()
}
_, unexpected = set_peft_model_state_dict(pipe.transformer, state)
if unexpected:
    raise RuntimeError(f"Unexpected LoRA tensors: {unexpected[:5]}")

for layer in pipe.transformer.modules():
    if isinstance(layer, LoraLayer):
        layer.set_scale("default", lora_scale)

pipe.transformer.to(torch.bfloat16)
pipe.to("cuda")

prompt = (
    "an adult woman anime character in a red coat sprinting across a "
    "rain-slick rooftop as neon signs reflect in puddles"
)

image = pipe(
    prompt,
    negative_prompt="",
    width=1024,
    height=1024,
    num_inference_steps=50,
    guidance_scale=3.0,
    uncond_skip_layers=[22],
    generator=torch.Generator("cpu").manual_seed(42),
).images[0]

image.save("moss_anime_style.png")

Training details

  • Training base model: OpenMOSS-Team/MOSS-Image-Base
  • Preferred inference model: OpenMOSS-Team/MOSS-Image-SFT
  • Training images: 79
  • Captions: approved natural-language captions with registered trigger moss_seinen_style
  • Resolution: 1024 with aspect-ratio buckets
  • Total training steps: 2,000
  • Included checkpoints: 1,500 and 2,000
  • LoRA rank / alpha: 16 / 16
  • Target modules: transformer attention q/k/v/o projections and feed-forward up/down projections
  • Optimizer: AdamW
  • Learning rate: 1e-4
  • Scheduler: constant with warmup
  • Batch size / gradient accumulation: 1 / 1
  • Weight decay: 0.01
  • Caption dropout: 0
  • Random horizontal flip: disabled
  • Training seed: 42
  • Training environment: local hardware

Intended use and limitations

This adapter is intended for lawful creative image generation involving fictional adult anime characters and related environments. It may produce malformed anatomy, hands, faces, text, mechanical objects, or multi-character relationships. Higher scale can increase the learned treatment while also increasing rigidity or artifacts. Results vary with checkpoint, prompt construction, seed, aspect ratio, and the underlying MOSS model.

Do not use the adapter for unlawful, abusive, deceptive, or privacy-violating content. Do not present generated people as real or use the model to impersonate identifiable individuals. Review outputs before publication.

The training images are not included. Users are responsible for checking that their use of the adapter and outputs complies with applicable licenses, laws, and platform policies.

License

Apache 2.0, matching MOSS-Image. This is an independent community LoRA and is not an official OpenMOSS release.