Please Provide main.py script for lightning.ai or notebook to google colab

#474
by ShintaroNippon - opened

First of all, great job here...

I want to run this model, but I don't have NVIDIA (CUDA) resources, I would say.

In that order, I'm using Google Colab and lightning.ai to run a GPU for a specific time.

Can someone provide a main.py for one of these platforms to run the model?
Or a notebook for Google Colab?
And specifying how I can handle it

Because currently I'm trying new approaches, but all day without success...

Thanks in advance
Carlos Vieira

Since its a gated model, you have to do
hf auth login and use an access token (its under settings), then do pip install -U diffusers transformers accelerate to ensure you have the librarys.
the script would look something like this-
import torch
from diffusers import DiffusionPipeline

switch to "mps" for apple devices

pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", dtype=torch.bfloat16, device_map="cuda")#device map would be mps for apple

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"#default prompt
image = pipe(prompt).images[0]

Sign up or log in to comment