gattaplayer's picture
Model card auto-generated by SimpleTuner
c2fe852 verified
metadata
license: other
base_model: black-forest-labs/FLUX.1-dev
tags:
  - flux
  - flux-diffusers
  - text-to-image
  - diffusers
  - simpletuner
  - not-for-all-audiences
  - lora
  - template:sd-lora
  - lycoris
inference: true
widget:
  - text: unconditional (blank prompt)
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_0_0.png
  - text: >-
      A dynamic scene featuring f312b Formula race car action on a race track,
      bright red Ferrari 312B with the number 3 prominently displayed on the
      front and sides, and various sponsor logos including Shell and Firestone,
      racing down a mountain road at night, features wide rear tires, a large
      rear wing, and a distinctive aerodynamic design, driver is wearing a red
      and white helmet and a racing suit, is visible in the open cockpit, scene
      captures the car in mid-drift, with motion lines emphasizing its speed and
      movement, background shows a winding road lined with trees and rocky
      cliffs, overall atmosphere is intense and thrilling, capturing the
      excitement of night racing in a detailed manner
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_1_0.png
  - text: >-
      f312b, photograph with sharp clarity capturing a close-up of a helmeted
      driver in a red Formula car marked with number 6, focusing on the driver's
      determined eyes, intricate sponsor decals, and the car's glossy red paint,
      with reflections on the mirror and bodywork, set against a blurred
      backdrop featuring people and racing equipment, showcasing the intense
      atmosphere and detailed elements of the car and driver
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_2_0.png
  - text: >-
      a futuristic race car with sleek curves and aggressive design with the
      number 26 and Shell branding, featuring visible mechanics, driven by a
      helmeted driver with a blue helmet, three-quarter view perspective, the
      car is racing along a straight track section marked by a yellow line,
      showcasing its streamlined and aerodynamic design against the textured
      asphalt, adding to the sense of speed and precision, the car's aerodynamic
      body displays intricate detailing with transparent overlays showcasing
      internal structure and components, tight upward shot frames a geometric
      canopy of reflective glass panels, mirroring the sky above. Sharp,
      crystalline s create a textured mosaic that merges with soft clouds,
      producing a vibrant contrast of cool metallic blues and gentle grays. The
      play of natural light enhances the ethereal glow, creating an atmosphere
      of modern elegance and innovation. The seamless relationship between the
      sharp architectural lines and the soft sky evokes a sense of wonder and
      harmonious craftsmanship, blending nature with human creativity
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_3_0.png
  - text: >-
      a red formula car marked with number 5 and gold wheels from a side view,
      driven by a helmeted driver, speeding on a racetrack with a crowd of
      spectators and palm trees in the background, highlighting the car's
      aerodynamic body, intricate mechanical details, captures the sweeping
      horizon at sunset, featuring a sleek, futuristic  with its clean, curved
      lines and smooth surfaces, highlighted by a warm, glowing red and orange
      light, The expansive, tiled foreground leads the eye to a distant
      cityscape with silhouetted s against the soft, pastel sky, The scene is
      bathed in a serene, ambient light, enhancing the tranquil atmosphere, as
      the urban skyline in the background provides subtle depth and contrast
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_4_0.png
  - text: >-
      sharp focus capturing a detailed view of a red Formula car's engine,
      exhaust pipes, and rear tire, showcasing the mesh-covered intakes,
      metallic components, and the car's aerodynamic body, set against an indoor
      exhibition space with bright lighting that highlights the intricate
      engineering, polished surfaces, and complex mechanical details, enhancing
      the vivid colors and textures of the car's design
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_5_0.png
  - text: >-
      three quarter front view slightly from above, a futuristic race car, with
      a prominent number 5, with sleek curves and aggressive design, featuring
      visible mechanics, driven by a helmeted driver, leaping off a racetrack
      with trailing from the underside, highlighting the car's aerodynamic body,
      intricate engine exposed at the rear, massive black tires, reflective
      metal elements, subtle shadows, and a textured gray asphalt track with
      motion blur effect, giving a sense of high speed and mechanical precision,
      highlighted by the warm, pink and orange hues of the surrounding twilight
      sky, creating a vibrant contrast
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_6_0.png
  - text: >-
      three-quarter front view, f312b formula car with a prominent number 26 and
      shell and firestone branding, with sleek curves and aggressive design,
      featuring visible mechanics, highlighting the car's aerodynamic body,
      intricate engine exposed at the rear, massive black tires, reflective
      metal elements, subtle shadows, and a textured gray asphalt track with
      motion blur effect, giving a sense of high speed, in the background a blue
      sky create a harmonious composition, warm tones of the setting sun
      highlight the structure's sleek design
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_7_0.png
  - text: >-
      three-quarter view wide shot slightly from above, f312b formula car with
      number 23 and shell branding and firestone branding, with a young man with
      helmet as driver, with sleek curves and aggressive design, highlighting
      the car's aerodynamic body, intricate engine exposed at the rear, massive
      black tires, reflective metal elements, subtle shadows, and a bright
      racing track, with motion blur effect, giving a sense of high speed,
      highlighted by the warm, pink and orange hues of the surrounding twilight
      sky, creating a vibrant contrast
    parameters:
      negative_prompt: blurry, cropped, ugly
    output:
      url: ./assets/image_8_0.png

formula-f312b-flux-lokr-1e-5-bs12_bs2-ga3_v03

This is a LyCORIS adapter derived from black-forest-labs/FLUX.1-dev.

No validation prompt was used during training.

None

Validation settings

  • CFG: 3.0
  • CFG Rescale: 0.0
  • Steps: 20
  • Sampler: FlowMatchEulerDiscreteScheduler
  • Seed: 42
  • Resolution: 1024x1024
  • Skip-layer guidance:

Note: The validation settings are not necessarily the same as the training settings.

You can find some example images in the following gallery:

Prompt
unconditional (blank prompt)
Negative Prompt
blurry, cropped, ugly
Prompt
A dynamic scene featuring f312b Formula race car action on a race track, bright red Ferrari 312B with the number 3 prominently displayed on the front and sides, and various sponsor logos including Shell and Firestone, racing down a mountain road at night, features wide rear tires, a large rear wing, and a distinctive aerodynamic design, driver is wearing a red and white helmet and a racing suit, is visible in the open cockpit, scene captures the car in mid-drift, with motion lines emphasizing its speed and movement, background shows a winding road lined with trees and rocky cliffs, overall atmosphere is intense and thrilling, capturing the excitement of night racing in a detailed manner
Negative Prompt
blurry, cropped, ugly
Prompt
f312b, photograph with sharp clarity capturing a close-up of a helmeted driver in a red Formula car marked with number 6, focusing on the driver's determined eyes, intricate sponsor decals, and the car's glossy red paint, with reflections on the mirror and bodywork, set against a blurred backdrop featuring people and racing equipment, showcasing the intense atmosphere and detailed elements of the car and driver
Negative Prompt
blurry, cropped, ugly
Prompt
a futuristic race car with sleek curves and aggressive design with the number 26 and Shell branding, featuring visible mechanics, driven by a helmeted driver with a blue helmet, three-quarter view perspective, the car is racing along a straight track section marked by a yellow line, showcasing its streamlined and aerodynamic design against the textured asphalt, adding to the sense of speed and precision, the car's aerodynamic body displays intricate detailing with transparent overlays showcasing internal structure and components, tight upward shot frames a geometric canopy of reflective glass panels, mirroring the sky above. Sharp, crystalline s create a textured mosaic that merges with soft clouds, producing a vibrant contrast of cool metallic blues and gentle grays. The play of natural light enhances the ethereal glow, creating an atmosphere of modern elegance and innovation. The seamless relationship between the sharp architectural lines and the soft sky evokes a sense of wonder and harmonious craftsmanship, blending nature with human creativity
Negative Prompt
blurry, cropped, ugly
Prompt
a red formula car marked with number 5 and gold wheels from a side view, driven by a helmeted driver, speeding on a racetrack with a crowd of spectators and palm trees in the background, highlighting the car's aerodynamic body, intricate mechanical details, captures the sweeping horizon at sunset, featuring a sleek, futuristic with its clean, curved lines and smooth surfaces, highlighted by a warm, glowing red and orange light, The expansive, tiled foreground leads the eye to a distant cityscape with silhouetted s against the soft, pastel sky, The scene is bathed in a serene, ambient light, enhancing the tranquil atmosphere, as the urban skyline in the background provides subtle depth and contrast
Negative Prompt
blurry, cropped, ugly
Prompt
sharp focus capturing a detailed view of a red Formula car's engine, exhaust pipes, and rear tire, showcasing the mesh-covered intakes, metallic components, and the car's aerodynamic body, set against an indoor exhibition space with bright lighting that highlights the intricate engineering, polished surfaces, and complex mechanical details, enhancing the vivid colors and textures of the car's design
Negative Prompt
blurry, cropped, ugly
Prompt
three quarter front view slightly from above, a futuristic race car, with a prominent number 5, with sleek curves and aggressive design, featuring visible mechanics, driven by a helmeted driver, leaping off a racetrack with trailing from the underside, highlighting the car's aerodynamic body, intricate engine exposed at the rear, massive black tires, reflective metal elements, subtle shadows, and a textured gray asphalt track with motion blur effect, giving a sense of high speed and mechanical precision, highlighted by the warm, pink and orange hues of the surrounding twilight sky, creating a vibrant contrast
Negative Prompt
blurry, cropped, ugly
Prompt
three-quarter front view, f312b formula car with a prominent number 26 and shell and firestone branding, with sleek curves and aggressive design, featuring visible mechanics, highlighting the car's aerodynamic body, intricate engine exposed at the rear, massive black tires, reflective metal elements, subtle shadows, and a textured gray asphalt track with motion blur effect, giving a sense of high speed, in the background a blue sky create a harmonious composition, warm tones of the setting sun highlight the structure's sleek design
Negative Prompt
blurry, cropped, ugly
Prompt
three-quarter view wide shot slightly from above, f312b formula car with number 23 and shell branding and firestone branding, with a young man with helmet as driver, with sleek curves and aggressive design, highlighting the car's aerodynamic body, intricate engine exposed at the rear, massive black tires, reflective metal elements, subtle shadows, and a bright racing track, with motion blur effect, giving a sense of high speed, highlighted by the warm, pink and orange hues of the surrounding twilight sky, creating a vibrant contrast
Negative Prompt
blurry, cropped, ugly

The text encoder was not trained. You may reuse the base model text encoder for inference.

Training settings

  • Training epochs: 30
  • Training steps: 11244
  • Learning rate: 1e-05
    • Learning rate schedule: polynomial
    • Warmup steps: 100
  • Max grad norm: 0.01
  • Effective batch size: 12
    • Micro-batch size: 2
    • Gradient accumulation steps: 3
    • Number of GPUs: 2
  • Gradient checkpointing: True
  • Prediction type: flow-matching (extra parameters=['flux_schedule_auto_shift', 'shift=0.0', 'flux_guidance_mode=constant', 'flux_guidance_value=1.0', 'flow_matching_loss=compatible'])
  • Optimizer: optimi-lionweight_decay=1e-3
  • Trainable parameter precision: Pure BF16
  • Caption dropout probability: 10.0%

LyCORIS Config:

{
    "bypass_mode": true,
    "algo": "lokr",
    "multiplier": 1.0,
    "full_matrix": true,
    "linear_dim": 10000,
    "linear_alpha": 1,
    "factor": 12,
    "apply_preset": {
        "target_module": [
            "Attention",
            "FeedForward"
        ],
        "module_algo_map": {
            "FeedForward": {
                "factor": 12
            },
            "Attention": {
                "factor": 6
            }
        }
    }
}

Datasets

FORMULA-F312B-ORIGINAL_1024-FLUX-V03-512

  • Repeats: 2
  • Total number of images: ~48
  • Total number of aspect buckets: 9
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-ORIGINAL_1024-FLUX-V03-768

  • Repeats: 2
  • Total number of images: ~48
  • Total number of aspect buckets: 11
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-ORIGINAL_1024-FLUX-V03-1024

  • Repeats: 2
  • Total number of images: ~48
  • Total number of aspect buckets: 4
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-ORIGINAL_1024_CLOSEUP-FLUX-V03-512

  • Repeats: 5
  • Total number of images: ~8
  • Total number of aspect buckets: 3
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-ORIGINAL_1024_CLOSEUP-FLUX-V03-768

  • Repeats: 5
  • Total number of images: ~8
  • Total number of aspect buckets: 3
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-ORIGINAL_1024_CLOSEUP-FLUX-V03-1024

  • Repeats: 5
  • Total number of images: ~10
  • Total number of aspect buckets: 4
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-F312B_1024-FLUX-V03-512

  • Repeats: 2
  • Total number of images: ~42
  • Total number of aspect buckets: 9
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-F312B_1024-FLUX-V03-768

  • Repeats: 2
  • Total number of images: ~46
  • Total number of aspect buckets: 11
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-F312B_1024-FLUX-V03-1024

  • Repeats: 2
  • Total number of images: ~42
  • Total number of aspect buckets: 7
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-F312B_1024_CLOSEUP-FLUX-V03-512

  • Repeats: 5
  • Total number of images: ~18
  • Total number of aspect buckets: 4
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-F312B_1024_CLOSEUP-FLUX-V03-768

  • Repeats: 5
  • Total number of images: ~18
  • Total number of aspect buckets: 4
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-F312B_1024_CLOSEUP-FLUX-V03-1024

  • Repeats: 5
  • Total number of images: ~18
  • Total number of aspect buckets: 3
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-LANDSCAPE-V03-512

  • Repeats: 0
  • Total number of images: ~74
  • Total number of aspect buckets: 4
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-LANDSCAPE-V03-768

  • Repeats: 0
  • Total number of images: ~72
  • Total number of aspect buckets: 5
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-LANDSCAPE-V03-1024

  • Repeats: 0
  • Total number of images: ~70
  • Total number of aspect buckets: 4
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-CITY-V03-512

  • Repeats: 0
  • Total number of images: ~170
  • Total number of aspect buckets: 5
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-CITY-V03-768

  • Repeats: 0
  • Total number of images: ~168
  • Total number of aspect buckets: 5
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-CITY-V03-1024

  • Repeats: 0
  • Total number of images: ~166
  • Total number of aspect buckets: 1
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-FUTURE-V03-512

  • Repeats: 0
  • Total number of images: ~178
  • Total number of aspect buckets: 3
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-FUTURE-V03-768

  • Repeats: 0
  • Total number of images: ~178
  • Total number of aspect buckets: 3
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-FUTURE-V03-1024

  • Repeats: 0
  • Total number of images: ~178
  • Total number of aspect buckets: 2
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-RENDER-FLUX-V03-512

  • Repeats: 2
  • Total number of images: ~24
  • Total number of aspect buckets: 1
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-RENDER-FLUX-V03-768

  • Repeats: 2
  • Total number of images: ~22
  • Total number of aspect buckets: 2
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-RENDER-FLUX-V03-1024

  • Repeats: 2
  • Total number of images: ~22
  • Total number of aspect buckets: 2
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-MOVIE-FLUX-V03-512

  • Repeats: 2
  • Total number of images: ~48
  • Total number of aspect buckets: 1
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-MOVIE-FLUX-V03-768

  • Repeats: 2
  • Total number of images: ~48
  • Total number of aspect buckets: 1
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-MOVIE-FLUX-V03-1024

  • Repeats: 2
  • Total number of images: ~48
  • Total number of aspect buckets: 1
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-LOGOS-FLUX-V03-512

  • Repeats: 5
  • Total number of images: ~24
  • Total number of aspect buckets: 9
  • Resolution: 0.262144 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-LOGOS-FLUX-V03-768

  • Repeats: 5
  • Total number of images: ~24
  • Total number of aspect buckets: 9
  • Resolution: 0.589824 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

FORMULA-F312B-LOGOS-FLUX-V03-1024

  • Repeats: 5
  • Total number of images: ~24
  • Total number of aspect buckets: 9
  • Resolution: 1.048576 megapixels
  • Cropped: True
  • Crop style: random
  • Crop aspect: closest
  • Used for regularisation data: No

Inference

import torch
from diffusers import DiffusionPipeline
from lycoris import create_lycoris_from_weights


def download_adapter(repo_id: str):
    import os
    from huggingface_hub import hf_hub_download
    adapter_filename = "pytorch_lora_weights.safetensors"
    cache_dir = os.environ.get('HF_PATH', os.path.expanduser('~/.cache/huggingface/hub/models'))
    cleaned_adapter_path = repo_id.replace("/", "_").replace("\\", "_").replace(":", "_")
    path_to_adapter = os.path.join(cache_dir, cleaned_adapter_path)
    path_to_adapter_file = os.path.join(path_to_adapter, adapter_filename)
    os.makedirs(path_to_adapter, exist_ok=True)
    hf_hub_download(
        repo_id=repo_id, filename=adapter_filename, local_dir=path_to_adapter
    )

    return path_to_adapter_file
    
model_id = 'black-forest-labs/FLUX.1-dev'
adapter_repo_id = 'gattaplayer/formula-f312b-flux-lokr-1e-5-bs12_bs2-ga3_v03'
adapter_filename = 'pytorch_lora_weights.safetensors'
adapter_file_path = download_adapter(repo_id=adapter_repo_id)
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
lora_scale = 1.0
wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_file_path, pipeline.transformer)
wrapper.merge_to()

prompt = "An astronaut is riding a horse through the jungles of Thailand."


## Optional: quantise the model to save on vram.
## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
from optimum.quanto import quantize, freeze, qint8
quantize(pipeline.transformer, weights=qint8)
freeze(pipeline.transformer)
    
pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
image = pipeline(
    prompt=prompt,
    num_inference_steps=20,
    generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
    width=1024,
    height=1024,
    guidance_scale=3.0,
).images[0]
image.save("output.png", format="PNG")

Exponential Moving Average (EMA)

SimpleTuner generates a safetensors variant of the EMA weights and a pt file.

The safetensors file is intended to be used for inference, and the pt file is for continuing finetuning.

The EMA model may provide a more well-rounded result, but typically will feel undertrained compared to the full model as it is a running decayed average of the model weights.