--- license: apache-2.0 language: - en base_model: - black-forest-labs/FLUX.1-dev pipeline_tag: text-to-image tags: - lora - flux - flux-dev - realism - character - portrait library_name: diffusers --- ## LORA FLUX.1-dev example Lora for [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) **ohwx woman** trigger word required ## ๐ŸŒŸ About FlyMy.AI Agentic Infra for GenAI. FlyMy.AI is a B2B infrastructure for building and running GenAI Media agents. **๐Ÿ”— Useful Links:** - ๐ŸŒ [Official Website](https://flymy.ai) - ๐Ÿ“š [Documentation](https://docs.flymy.ai/intro) - ๐Ÿ’ฌ [Discord Community](https://discord.com/invite/t6hPBpSebw) - ๐Ÿค— [LoRA Training Repository](https://github.com/FlyMyAI/flymyai-lora-trainer) - ๐Ÿฆ [X (Twitter)](https://x.com/flymyai) - ๐Ÿ’ผ [LinkedIn](https://linkedin.com/company/flymyai) - ๐Ÿ“บ [YouTube](https://youtube.com/@flymyai) - ๐Ÿ“ธ [Instagram](https://www.instagram.com/flymy_ai) # ๐Ÿงช Usage --- ### ๐Ÿ”ง Initialization ```python from diffusers import DiffusionPipeline import torch model_name = "black-forest-labs/FLUX.1-dev" # Load the pipeline if torch.cuda.is_available(): torch_dtype = torch.bfloat16 device = "cuda" else: torch_dtype = torch.float32 device = "cpu" pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype) pipe = pipe.to(device) ``` ### ๐Ÿ”Œ Load LoRA Weights ```python # Load LoRA weights pipe.load_lora_weights('flux_anne_hathaway.safetensors', adapter_name="lora") ``` ### ๐ŸŽจ Generate Image with lora trained on person ```python prompt = '''Portrait of ohwx woman, professional headshot, studio lighting, elegant pose, looking at camera, soft shadows, high quality, detailed facial features, cinematic lighting, 85mm lens, shallow depth of field''' negative_prompt = "blurry, low quality, distorted, bad anatomy" image = pipe( prompt=prompt, negative_prompt=negative_prompt, width=1024, height=1024, num_inference_steps=30, guidance_scale=3.5, generator=torch.Generator(device="cuda").manual_seed(346346) ) # Display the image (in Jupyter or save to file) image.show() # or image.save("output.png") ``` ### ๐Ÿ–ผ๏ธ Sample Output ![Sample Output](./assets/flux_anne_hathaway.png) ## ๐ŸŽ›๏ธ Using with ComfyUI We provide a ready-to-use ComfyUI workflow that works with our trained LoRA models. Follow these steps to set up and use the workflow: ### Setup Instructions 1. **Download the latest ComfyUI**: - Visit the [ComfyUI GitHub repository](https://github.com/comfyanonymous/ComfyUI) - Clone or download the latest version 2. **Install ComfyUI**: - Follow the installation instructions from the [ComfyUI repository](https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file#installing) - Make sure all dependencies are properly installed 3. **Download FLUX.1-dev model weights**: - Go to [FLUX.1-dev model](https://huggingface.co/black-forest-labs/FLUX.1-dev) - Download all the model files 4. **Place FLUX.1-dev weights in ComfyUI**: - Copy the downloaded FLUX.1-dev model files to the appropriate folders in `ComfyUI/models/` - Follow the folder structure as specified in the model repository 5. **Download our pre-trained LoRA weights**: - Visit [flymy-ai/flux-anne-hathaway-lora](https://huggingface.co/flymy-ai/flux-anne-hathaway-lora) - Download the LoRA `.safetensors` files 6. **Place LoRA weights in ComfyUI**: - Copy the LoRA file `flymy-ai/flux-anne-hathaway-lora/pytorch_lora_weights.safetensors` to `ComfyUI/models/loras/` 7. **Load the workflow**: - Open ComfyUI in your browser - Load the workflow file `flux_anne_hathaway_lora_example.json` located in this repository - The workflow is pre-configured to work with our LoRA models ### Workflow Features - โœ… Pre-configured for FLUX.1-dev + LoRA inference - โœ… Optimized settings for best quality output - โœ… Easy prompt and parameter adjustment - โœ… Compatible with all our trained LoRA models The ComfyUI workflow provides a user-friendly interface for generating images with our trained LoRA models without needing to write Python code. ### ๐Ÿ–ผ๏ธ Workflow Screenshot ![ComfyUI Workflow](./assets/comfyui_workflow.png) ## ๐ŸŽจ Generation Examples Below are examples of images generated with our Anne Hathaway LoRA model: ### Casual Portrait Selfie **Prompt**: *"ohwx woman portrait selfie"* ![Casual Portrait Selfie](./assets/1.png) ### Artistic Double Exposure **Prompt**: *"ohwx woman perfectly symmetrical young female face close-up, presented with double exposure overlay blending nature textures like leaves and water"* ![Artistic Double Exposure](./assets/2.png) ### Golden Hour Macro Portrait **Prompt**: *"ohwx woman Macro photography style close-up of female face with light makeup, focused on eyes and lips, illuminated by golden hour sunlight for warm tones"* ![Golden Hour Macro Portrait](./assets/3.png) ### Cozy Portrait with Panda **Prompt**: *"Close-up of ohwx woman in brown knitted turtleneck sweater. Sitting with big black and white panda, hugging it, looking at camera"* ![Cozy Portrait with Panda](./assets/4.png) ## ๐Ÿš€ Try it Online Test this LoRA model directly in your browser: - ๐ŸŒ [Try on FlyMy.AI Platform](https://app.flymy.ai/models/flymyai/flux-lora-trainer-fast) ## ๐Ÿค Support If you have questions or suggestions, join our community: - ๐ŸŒ [FlyMy.AI](https://flymy.ai) - ๐Ÿ“š [Documentation](https://docs.flymy.ai) - ๐Ÿ’ป [GitHub](https://github.com/flymy-ai) - ๐Ÿ’ฌ [Discord Community](https://discord.com/invite/t6hPBpSebw) - ๐Ÿฆ [Follow us on X](https://x.com/flymyai) - ๐Ÿ’ผ [Connect on LinkedIn](https://linkedin.com/company/flymyai) - ๐Ÿ“ง [Support](mailto:support@flymy.ai) **โญ Don't forget to star the repository if you like it!** --- license: apache-2.0 ---