--- license: other license_name: circlestone-labs-non-commercial-license license_link: https://huggingface.co/circlestone-labs/Anima/blob/main/LICENSE.md language: - en pipeline_tag: text-to-image base_model: - circlestone-labs/Anima-Base-v1.0-Diffusers base_model_relation: quantized library_name: diffusers --- For more information (including how to compress models yourself), check out https://huggingface.co/DFloat11 and https://github.com/LeanModels/DFloat11 Feel free to request for other models for compression as well (for either the `diffusers` library, ComfyUI, or any other model), although models that use architectures which are unfamiliar to me might be more difficult. ### How to Use #### `diffusers` ```python import torch from diffusers import ModularPipeline, CosmosTransformer3DModel from dfloat11 import DFloat11Model from transformers.initialization import no_init_weights with no_init_weights(): transformer = CosmosTransformer3DModel.from_config( CosmosTransformer3DModel.load_config( "circlestone-labs/Anima-Base-v1.0-Diffusers", subfolder="transformer" ), torch_dtype=torch.bfloat16 ).to(torch.bfloat16) DFloat11Model.from_pretrained("mingyi456/Anima-Base-v1.0-DF11-Diffusers", device="cpu", bfloat16_model=transformer) text_encoder = DFloat11Model.from_pretrained("mingyi456/Qwen3-0.6B-Base-DF11", device = "cpu") pipe = ModularPipeline.from_pretrained("circlestone-labs/Anima-Base-v1.0-Diffusers") pipe.update_components(text_encoder=text_encoder.model) pipe.update_components(transformer=transformer) pipe.load_components(dtype=torch.bfloat16) DFloat11Model.from_pretrained( "mingyi456/Anima-Base-v1.0-text_conditioner-DF11-Diffusers", device = "cpu", bfloat16_model=pipe.text_conditioner ) pipe.to("cuda") image = pipe( prompt="masterpiece, best quality, 1girl, solo, city lights", generator=torch.Generator("cpu").manual_seed(114514), ).images[0] image.save("image anima") ``` #### ComfyUI Refer to this [model](https://huggingface.co/mingyi456/Anima-DF11-ComfyUI) instead. ### Compression details This is the `pattern_dict` for compression: ```python pattern_dict = { r"transformer_blocks\.\d+": ( "norm1.linear_1", "norm1.linear_2", "attn1.to_q", "attn1.to_k", "attn1.to_v", "attn1.to_out.0", "norm2.linear_1", "norm2.linear_2", "attn2.to_q", "attn2.to_k", "attn2.to_v", "attn2.to_out.0", "norm3.linear_1", "norm3.linear_2", "ff.net.0.proj", "ff.net.2" ), r"time_embed\.t_embedder": ( "linear_1", "linear_2", ) } ```