mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 06:52:07 +08:00
dd778596b7
date: 2025-03-15T21:10:51 master commit: fb7b9c0f9420d228f03362970ebcfb7237095cf3
14 lines
565 B
Python
14 lines
565 B
Python
from tinygrad.helpers import fetch, Timing
|
|
from tinygrad.device import Device
|
|
from tinygrad.nn.state import torch_load, load_state_dict
|
|
from examples.stable_diffusion import StableDiffusion
|
|
|
|
# run "sudo purge" before testing on OS X to avoid the memory cache
|
|
|
|
if __name__ == "__main__":
|
|
fn = fetch('https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt', 'sd-v1-4.ckpt')
|
|
model = StableDiffusion()
|
|
with Timing():
|
|
load_state_dict(model, torch_load(fn)['state_dict'], strict=False)
|
|
Device[Device.DEFAULT].synchronize()
|