This might be a very basic question, I am kind of new to this.
I am trying to run ru dall e in a space and I keep getting the ““LayerNormKernelImpl” not implemented for ‘Half’” error when I run the model on gradio. I am pretty sure that it is because the model is in fp16 and my device is a CPU instead of cuda.
This is my script:
device = "cuda" if torch.cuda.is_available() else "cpu"
print('Using device:', device)
dalle = get_rudalle_model('Malevich', pretrained=True, fp16=True, device=device)
tokenizer = get_tokenizer()
vae = get_vae(dwt=True).to(device)
realesrgan = get_realesrgan('x2', device=device)
clip, processor = ruclip.load('ruclip-vit-base-patch32-384', device=device)
clip_predictor = ruclip.Predictor(clip, processor, device, bs=8)
def model(text, tokenizer=tokenizer, dalle=dalle, vae=vae, top_k=2048, images_num=1, bs=8, top_p=0.995):
pil_images = generate_images(text, tokenizer, dalle, vae, top_k=top_k, images_num=images_num, bs=8, top_p=top_p)
pil_images = pil_images[0]
return pil_images[0]
seed_everything(42)
pil_images = []
iface = gr.Interface(fn=model, title="V1",
inputs=[gr.inputs.Textbox(label="Text prompt")],
outputs=[gr.outputs.Image(type="pil", label="Generated Image")]).launch()
Any advice on what I should do? Any way to get a GPU in a huggingface space?