Close Menu
    Facebook X (Twitter) Instagram
    Jupiter News
    • Home
    • Technology
    • Tech Analysis
    • Tech News
    • Tech Updates
    • AI Technology
    • 5G Technology
    • More
      • Accessories
      • Computers and Laptops
      • Artificial Intelligence
      • Cyber Security
      • Gadgets & Tech
      • Internet and Networking
      • Internet of Things (IoT)
      • Machine Learning
      • Mobile Devices
      • PCs Components
      • Wearable Devices
    Jupiter News
    Home»Machine Learning»Exploring Hugging Face: Text-to-Image | by Okan Yenigün | Apr, 2024
    Machine Learning

    Exploring Hugging Face: Text-to-Image | by Okan Yenigün | Apr, 2024

    Jupiter NewsBy Jupiter NewsApril 16, 20242 Mins Read
    Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Exploring Hugging Face’s Textual content-to-Picture Fashions: A Gateway to AI-Pushed Artistry

    DevOps.dev

    Picture by Gabriel Heinzer on Unsplash

    The text-to-image activity entails producing a visible illustration (picture) from a textual description.

    The method begins with a textual enter that describes a picture. This might vary from easy descriptions like “a two-story blue home” to extra complicated and summary ideas.

    The mannequin processes the textual content to grasp the contents after which generates a picture that matches the outline. This entails understanding the semantics of the textual content, visualizing the described components, and assembling them right into a coherent picture.

    from diffusers import DiffusionPipeline
    import torch

    pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float32, use_safetensors=True)
    pipe.to("cpu")

    immediate = "An astronaut driving a inexperienced horse"

    picture = pipe(immediate=immediate).photos[0]

    picture

    Picture by the creator.
    import torch
    from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, EulerDiscreteScheduler
    from huggingface_hub import hf_hub_download
    from safetensors.torch import load_file

    base = "stabilityai/stable-diffusion-xl-base-1.0"
    repo = "ByteDance/SDXL-Lightning"
    ckpt = "sdxl_lightning_4step_unet.safetensors" # Use the right ckpt on your step setting!

    # Load mannequin and transfer to CPU with single precision
    unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cpu")
    unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), machine="cpu"))

    # Initialize pipeline with CPU and single precision
    pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float32).to("cpu")

    # Guarantee sampler makes use of "trailing" timesteps
    pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")

    # Generate picture with specified inference steps and CFG scale
    outcome = pipe("A cat skating", num_inference_steps=4, guidance_scale=0)
    picture = outcome.photos[0]
    picture.save("output.png")

    Picture by the creator.
    from diffusers import DiffusionPipeline

    pipeline = DiffusionPipeline.from_pretrained("digiplay/AbsoluteReality_v1.8.1")

    pipeline.to("cpu")

    # if utilizing torch < 2.0
    # pipe.enable_xformers_memory_efficient_attention()

    immediate = "An astronaut driving a inexperienced horse"

    photos = pipeline(immediate=immediate).photos[0]

    photos

    Picture by the creator.
    import torch
    from diffusers import LCMScheduler, AutoPipelineForText2Image

    model_id = "Lykon/dreamshaper-7"
    adapter_id = "latent-consistency/lcm-lora-sdv1-5"

    # Initialize the pipeline with single precision
    pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32)
    pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
    pipe.to("cpu")

    # Load and fuse lcm lora
    pipe.load_lora_weights(adapter_id)
    pipe.fuse_lora()

    immediate = "An astronaut driving a inexperienced horse"

    # Disable guidance_scale by passing 0
    photos = pipe(immediate=immediate, num_inference_steps=4, guidance_scale=0)
    picture= photos.photos[0]

    Picture by the creator.

    Learn Extra

    Sources

    https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0

    https://huggingface.co/digiplay/AbsoluteReality_v1.8.1

    https://huggingface.co/Lykon/dreamshaper-7



    Source link

    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Jupiter News
    • Website

    Related Posts

    Machine Learning April 16, 2024

    Add seasonal significance data to your sequential dataset. Your Recurrent Neural Network will appreciate it | by Jorge Jamsech | Apr, 2024

    Machine Learning April 16, 2024

    Why AI(Artificial Intelligence) can not replace humans. | by Dhammshil Kaninde | Apr, 2024

    Machine Learning April 16, 2024

    Reducing Hallucinations 0. 2 by MyBrandt

    Machine Learning April 16, 2024

    No-Code Deployment & Orchestration Of Open-Sourced Foundation Models | by Cobus Greyling | Apr, 2024

    Machine Learning April 16, 2024

    Research on Monge-Ampère equations part5(Machine Learning) – Monodeep Mukherjee

    Machine Learning April 16, 2024

    Building a Strong Math Foundation for Data Science: Essential Courses for Beginners | by Yugal Chambhare | Apr, 2024

    Leave A Reply Cancel Reply

    Don't Miss
    Machine Learning April 16, 2024

    Add seasonal significance data to your sequential dataset. Your Recurrent Neural Network will appreciate it | by Jorge Jamsech | Apr, 2024

    In nearly each new neural community you’re employed on, you´ll want a dataset for coaching.…

    Change Healthcare’s New Ransomware Nightmare Goes From Bad to Worse

    April 16, 2024

    Netflix’s Wednesday Adds Steve Buscemi to Its Kooky Cast

    April 16, 2024

    UK is aiming to regulate cryptocurrencies by July 2024

    April 16, 2024

    Boston Dynamics sends Atlas to the robot retirement home

    April 16, 2024

    MLCommons Announces Its First Benchmark for AI Safety

    April 16, 2024
    Categories
    • 5G Technology
    • Accessories
    • AI Technology
    • Artificial Intelligence
    • Computers and Laptops
    • Cyber Security
    • Gadgets & Tech
    • Internet and Networking
    • Internet of Things (IoT)
    • Machine Learning
    • Mobile Devices
    • PCs Components
    • Tech
    • Tech Analysis
    • Tech Updates
    • Technology
    • Wearable Devices
    About Us

    Welcome to JupiterNews.online – Your Gateway to the Tech Universe!

    At JupiterNews.online, we're on a mission to explore the vast and ever-evolving world of technology. Our blog is a digital haven for tech enthusiasts, innovators, and anyone curious about the latest trends shaping the future. With a finger on the pulse of the tech universe, we aim to inform, inspire, and connect our readers to the incredible advancements defining our digital age.

    Embark on a journey with JupiterNews.online, where the possibilities of technology are explored, celebrated, and demystified. Whether you're a tech guru or just getting started, our blog is your companion in navigating the exciting, ever-changing world of technology.

    Welcome to the future – welcome to JupiterNews.online!

    Our Picks

    Add seasonal significance data to your sequential dataset. Your Recurrent Neural Network will appreciate it | by Jorge Jamsech | Apr, 2024

    April 16, 2024

    Change Healthcare’s New Ransomware Nightmare Goes From Bad to Worse

    April 16, 2024

    Netflix’s Wednesday Adds Steve Buscemi to Its Kooky Cast

    April 16, 2024

    UK is aiming to regulate cryptocurrencies by July 2024

    April 16, 2024

    Boston Dynamics sends Atlas to the robot retirement home

    April 16, 2024

    MLCommons Announces Its First Benchmark for AI Safety

    April 16, 2024
    Categories
    • 5G Technology
    • Accessories
    • AI Technology
    • Artificial Intelligence
    • Computers and Laptops
    • Cyber Security
    • Gadgets & Tech
    • Internet and Networking
    • Internet of Things (IoT)
    • Machine Learning
    • Mobile Devices
    • PCs Components
    • Tech
    • Tech Analysis
    • Tech Updates
    • Technology
    • Wearable Devices
    • Privacy Policy
    • Disclaimer
    • Terms & Conditions
    • About us
    • Contact us
    Copyright © 2024 Jupiternews.online All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.