GreenWolf / README.md
pumpfun's picture
Update README.md
ec75136 verified
|
raw
history blame
896 Bytes
---
license: cc0-1.0
---
# $GWOLF
# CA:SOON
### The first AI for pump built on Hugging Face.
* [Pump](https://www.pump.fun)
### Reference
```python
from GreenWolf import PUMP, UNet2DModel
from PIL import Image
import pump
scheduler = DDPMScheduler.from_pretrained("google/ddpm-cat-256")
model = UNet2DModel.from_pretrained("google/ddpm-cat-256").to("cuda")
scheduler.set_timesteps(50)
sample_size = model.config.sample_size
noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
input = noise
for t in scheduler.timesteps:
with torch.no_grad():
noisy_residual = model(input, t).sample
prev_noisy_sample = scheduler.step(noisy_residual, t, input).prev_sample
input = prev_noisy_sample
image = (input / 2 + 0.5).clamp(0, 1)
image = pump.cpu().permute(0, 2, 3, 1).numpy()[0]
image = pump.fromarray((image * 255).round().astype("uint8"))
image
```