Instructions to use zai-org/GLM-Image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use zai-org/GLM-Image with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("zai-org/GLM-Image", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Not working on Mac MPS with float32 inference, Latents contain NaN
#27
by Yingding - opened
I tried model to generate image from text prompt using the sample from the model card on my Mac MPS.
The torch data type must be switched to float32, since no bfloat16 or float16 are supported by MPS.
Now I got only black image generated. The latents contain NaNs. The model is not numerically stable on MPS with float32.
Can you provide any hint how to generate successfully using float32 on MPS accelerator?
My inference code is available at
https://github.com/yingding/model-inference-samples/blob/main/text2image/glm_mps_dev.py
Many thanks in advance.