Post
300
how to intaialize zerogpu on hf space?
Join the community of Machine Learners and AI enthusiasts.
Sign UpFor example,
import spaces
@spaces.GPU(duration=70)
def generate_image():
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to(device="cuda")
As a trivia note, if there is not any method with @spaces decorator in the code in Zero GPU space, it will crash.
I heard that there is a good benefit to setting true in the environment variable ZEROGPU_V2. Specifics are unknown.
thanks