Views
No views yet

The image features a man standing confidently, wearing a simple t-shirt with a humorous and quirky message printed across the front. The t-shirt reads: "I de-distilled FLUX schnell into a slow, ugly model and all I got was this stupid t-shirt." The man’s expression suggests a mix of pride and irony, as if he's aware of the complexity behind the statement, yet amused by the underwhelming reward. The background is neutral, keeping the focus on the man and his t-shirt, which pokes fun at the frustrating and often anticlimactic nature of technical processes or complex problem-solving, distilled into a comically understated punchline.
diffusers==0.30.3 and will be updated to the latest diffusers soon. The model works best with a CFG scale of 2.0 to 5.0, so if you are getting images with a blur or strange shadows try turning down your CFG scale (guidance_scale in diffusers). Alternatively, you can also use higher CFG scales if you turn it off during the first couple of timesteps (no_cfg_until_timestep=2 in the custom pipeline).1# ! pip install diffusers==0.30.3
2import torch
3from diffusers import DiffusionPipeline
4
5pipe = DiffusionPipeline.from_pretrained(
6 "jimmycarter/LibreFLUX",
7 custom_pipeline="jimmycarter/LibreFLUX",
8 use_safetensors=True,
9 torch_dtype=torch.bfloat16,
10 trust_remote_code=True,
11)
12
13# High VRAM
14prompt = "Photograph of a chalk board on which is written: 'I thought what I'd do was, I'd pretend I was one of those deaf-mutes.'"
15negative_prompt = "blurry"
16images = pipe(
17 prompt=prompt,
18 negative_prompt=negative_prompt,
19 return_dict=False,
20 # guidance_scale=3.5,
21 # num_inference_steps=28,
22 # generator=torch.Generator().manual_seed(42),
23 # no_cfg_until_timestep=0,
24)
25images[0][0].save('chalkboard.png')
26
27# If you have <=24 GB VRAM, try:
28# ! pip install optimum-quanto
29# Then
30from optimum.quanto import freeze, quantize, qint8
31# quantize and freeze will take a short amount of time, so be patient.
32quantize(
33 pipe.transformer,
34 weights=qint8,
35 exclude=[
36 "*.norm", "*.norm1", "*.norm2", "*.norm2_context",
37 "proj_out", "x_embedder", "norm_out", "context_embedder",
38 ],
39)
40freeze(pipe.transformer)
41pipe.enable_model_cpu_offload()
42
43images = pipe(
44 prompt=prompt,
45 negative_prompt=negative_prompt,
46 device=None,
47 return_dict=False,
48 do_batch_cfg=False, # https://github.com/huggingface/optimum-quanto/issues/327
49 # guidance_scale=3.5,
50 # num_inference_steps=28,
51 # generator=torch.Generator().manual_seed(42),
52 # no_cfg_until_timestep=0,
53)
54images[0][0].save('chalkboard.png')--flux_attention_masked_training training option and the model found in jimmycarter/LibreFlux-SimpleTuner. This is the same model with the custom pipeline removed, which currently interferes with the ability for SimpleTuner to finetune with it. SimpleTuner has extensive support for parameter-efficient fine-tuning via LyCORIS, in addition to full-rank fine-tuning. For inference, use the custom pipline from this repo and follow the example in SimpleTuner to patch in your LyCORIS weights.1from lycoris import create_lycoris_from_weights
2
3pipe = DiffusionPipeline.from_pretrained(
4 "jimmycarter/LibreFLUX",
5 custom_pipeline="jimmycarter/LibreFLUX",
6 use_safetensors=True,
7 torch_dtype=torch.bfloat16,
8 trust_remote_code=True,
9)
10
11lycoris_safetensors_path = 'pytorch_lora_weights.safetensors'
12wrapper, _ = create_lycoris_from_weights(1.0, lycoris_safetensors_path, pipe.transformer)
13wrapper.merge_to()
14del wrapper
15
16prompt = "Photograph of a chalk board on which is written: 'I thought what I'd do was, I'd pretend I was one of those deaf-mutes.'"
17negative_prompt = "blurry"
18images = pipe(
19 prompt=prompt,
20 negative_prompt=negative_prompt,
21 return_dict=False,
22)
23images[0][0].save('chalkboard.png')
24
25# optionally, save a merged pipeline containing the LyCORIS baked-in:
26# pipe.save_pretrained('/path/to/output/pipeline')
1def approximate_normal_tensor(inp, target, scale=1.0):
2 tensor = torch.randn_like(target)
3 desired_norm = inp.norm()
4 desired_mean = inp.mean()
5 desired_std = inp.std()
6
7 current_norm = tensor.norm()
8 tensor = tensor * (desired_norm / current_norm)
9 current_std = tensor.std()
10 tensor = tensor * (desired_std / current_std)
11 tensor = tensor - tensor.mean() + desired_mean
12 tensor.mul_(scale)
13
14 target.copy_(tensor)
15
16
17def init_lokr_network_with_perturbed_normal(lycoris, scale=1e-3):
18 with torch.no_grad():
19 for lora in lycoris.loras:
20 lora.lokr_w1.fill_(1.0)
21 approximate_normal_tensor(lora.org_weight, lora.lokr_w2, scale=scale)scale=1e-3. The LoKr weights I trained in bfloat16, with the adamw_bf16 optimizer that I elementwise_affine=False). When you fine-tune and look at what changes these layers are one of the big ones that seems to change.1from scipy.stats import beta as sp_beta
2
3alpha = 2.0
4beta = 1.6
5num_processes = self.accelerator.num_processes
6process_index = self.accelerator.process_index
7total_bsz = num_processes * bsz
8start_idx = process_index * bsz
9end_idx = (process_index + 1) * bsz
10indices = torch.arange(start_idx, end_idx, dtype=torch.float64)
11u = torch.rand(bsz)
12p = (indices + u) / total_bsz
13sigmas = torch.from_numpy(
14 sp_beta.ppf(p.numpy(), a=alpha, b=beta)
15).to(device=self.accelerator.device)1first_checkpoint_file = checkpoint_files[0]
2ema_state_dict = load_file(first_checkpoint_file)
3for checkpoint_file in checkpoint_files[1:]:
4 new_state_dict = load_file(checkpoint_file)
5 for k in ema_state_dict.keys():
6 ema_state_dict[k] = torch.lerp(
7 ema_state_dict[k],
8 new_state_dict[k],
9 alpha,
10 )
11
12output_file = os.path.join(output_folder, f"alpha_linear_{alpha}.safetensors")
13save_file(ema_state_dict, output_file)[0.2, 0.4, 0.6, 0.8, 0.9, 0.95, 0.975, 0.99, 0.995, 0.999], I ended up settling on alpha 0.9 using the power of my eyeballs. If I am being frank, many of the EMA models looked remarkably similar and had the same kind of "rolling around various minima" qualities that training does in general.
A cinematic style shot of a polar bear standing confidently in the center of a vibrant nightclub. The bear is holding a large sign that reads 'Open Source! Apache 2.0' in one arm and giving a thumbs up with the other arm. Around him, the club is alive with energy as colorful lasers and disco lights illuminate the scene. People are dancing all around him, wearing glowsticks and candy bracelets, adding to the fun and electric atmosphere. The polar bear's white fur contrasts against the dark, neon-lit background, and the entire scene has a surreal, festive vibe, blending technology activism with a lively party environment.

widescreen, vintage style from 1970s, Extreme realism in a complex, highly detailed composition featuring a woman with extremely long flowing rainbow-colored hair. The glowing background, with its vibrant colors, exaggerated details, intricate textures, and dynamic lighting, creates a whimsical, dreamy atmosphere in photorealistic quality. Threads of light that float and weave through the air, adding movement and intrigue. Patterns on the ground or in the background that glow subtly, adding a layer of complexity.Rainbows that appear faintly in the background, adding a touch of color and wonder.Butterfly wings that shimmer in the light, adding life and movement to the scene.Beams of light that radiate softly through the scene, adding focus and direction. The woman looks away from the camera, with a soft, wistful expression, her hair framing her face.

a highly detailed and atmospheric, painted western movie poster with the title text "Once Upon a Lime in the West" in a dark red western-style font and the tagline text "There were three men ... and one very sour twist", with movie credits at the bottom, featuring small white text detailing actor and director names and production company logos, inspired by classic western movie posters from the 1960s, an oversized lime is the central element in the middle ground of a rugged, sun-scorched desert landscape typical of a western, the vast expanse of dry, cracked earth stretches toward the horizon, framed by towering red rock formations, the absurdity of the lime is juxtaposed with the intense gravitas of the stoic, iconic gunfighters, as if the lime were as formidable an adversary as any seasoned gunslinger, in the foreground, the silhouettes of two iconic gunfighters stand poised, facing the lime and away from the viewer, the lime looms in the distance like a final showdown in the classic western tradition, in the foreground, the gunfighters stand with long duster coats flowing in the wind, and wide-brimmed hats tilted to cast shadows over their faces, their stances are tense, as if ready for the inevitable draw, and the weapons they carry glint, the background consists of the distant town, where the sun is casting a golden glow, old wooden buildings line the sides, with horses tied to posts and a weathered saloon sign swinging gently in the wind, in this poster, the lime plays the role of the silent villain, an almost mythical object that the gunfighters are preparing to confront, the tension of the scene is palpable, the gunfighters in the foreground have faces marked by dust and sweat, their eyes narrowed against the bright sunlight, their expressions are serious and resolute, as if they have come a long way for this final duel, the absurdity of the lime is in stark contrast with their stoic demeanor, a wide, panoramic shot captures the entire scene, with the gunfighters in the foreground, the lime in the mid-ground, and the town on the horizon, the framing emphasizes the scale of the desert and the dramatic standoff taking place, while subtly highlighting the oversized lime, the camera is positioned low, angled upward from the dusty ground toward the gunfighters, with the distant lime looming ahead, this angle lends the figures an imposing presence, while still giving the lime an absurd grandeur in the distance, the perspective draws the viewerâs eye across the desert, from the silhouettes of the gunfighters to the bizarre focal point of the lime, amplifying the tension, the lighting is harsh and unforgiving, typical of a desert setting, with the evening sun casting deep shadows across the ground, dust clouds drift subtly across the ground, creating a hazy effect, while the sky above is a vast expanse of pale blue, fading into golden hues near the horizon where the sun begins to set, the poster is shot as if using classic anamorphic lenses to capture the wide, epic scale of the desert, the color palette is warm and saturated, evoking the look of a classic spaghetti western, the lime looms unnaturally in the distance, as if conjured from the land itself, casting an absurdly grand shadow across the rugged landscape, the texture and detail evoke hand-painted, weathered posters from the golden age of westerns, with slightly frayed edges and faint creases mimicking the wear of vintage classics

A boxed action figure of a beautiful elf girl witch wearing a skimpy black leotard, black thigh highs, black armlets, and a short black cloak. Her hair is pink and shoulder-length. Her eyes are green. She is a slim and attractive elf with small breasts. The accessories include an apple, magic wand, potion bottle, black cat, jack o lantern, and a book. The box is orange and black with a logo near the bottom of it that says "BAD WITCH". The box is on a shelf on the toy aisle.

A cute blonde woman in bikini and her doge are sitting on a couch cuddling and the expressive, stylish living room scene with a playful twist. The room is painted in a soothing turquoise color scheme, stylish living room scene bathed in a cool, textured turquoise blanket and adorned with several matching turquoise throw pillows. The room's color scheme is predominantly turquoise, relaxed demeanor. The couch is covered in a soft, reflecting light and adding to the vibrant blue hue., dark room with a sleek, spherical gold decorations, This photograph captures a scene that is whimsically styled in a vibrant, reflective cyan sunglasses. The dog's expression is cheerful, metallic fabric sofa. The dog, soothing atmosphere.

Selfie of a woman in front of the eiffel tower, a man is standing next to her and giving a thumbs up

An image contains three motivational phrases, all in capitalized stylized text on a colorful background: 1. At the top: "PAIN HEALS" 2. In the middle, bold and slightly larger: "CHICKS DIG SCARS" 3. At the bottom: "GLORY LASTS FOREVER"

An illustration featuring a McDonald's on the moon. An anthropomorphic cat in a pink top and blue jeans is ordering McDonald's, while a zebra cashier stands behind the counter. The moon's surface is visible outside the windows, with craters and a distant view of Earth. The interior of the McDonald's is similar to those on Earth but adapted to the lunar environment, with vibrant colors and futuristic design elements. The overall scene is whimsical and imaginative, blending everyday life with a fantastical setting.
1e-5. I realized this when looking at the results of EMA on the final FLUX.1-dev. The H100s really came out of nowhere as I just got an IP address to shell into late one night around 10PM and ended up staying up all night to get everything running, so in the future I'm sure I would be more prepared.
@misc{libreflux,
author = {James Carter},
title = {LibreFLUX: A free, de-distilled FLUX model},
year = {2024},
publisher = {Huggingface},
journal = {Huggingface repository},
howpublished = {\url{https://huggingface.co/datasets/jimmycarter/libreflux}},
}