Welcome to Pruna’s documentation!
Glad to have you here! At Pruna AI, we create solutions that empower developers to make their ML models smaller, cheaper, faster and greener.
Our compression toolbox pruna is made by engineers for engineers. It is designed to make your life easier. With just a few lines of code, no need for extensive re-engineering.
How it works? Let us show you.
After setting up pruna, you can start smashing your models:
import torch
from diffusers import StableDiffusionPipeline
from pruna import smash, SmashConfig
# Define the model you want to smash
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
# Initialize the SmashConfig
smash_config = SmashConfig()
smash_config['compilers'] = ['diffusers2']
# Smash the model
smashed_model = smash(
model=pipe,
token='<your-token>', # replace <your-token> with your actual token or set to None if you do not have one yet
smash_config=smash_config,
)
# Run the model on a prompt
prompt = "a photo of an astronaut riding a horse on mars"
image = smashed_model(prompt).images[0]
Now that you’ve seen what pruna can do, it’s your turn! Ready to take your models to the next level? Get started today and see how easy it is to reduce costs and boost efficiency. Whether you’re optimizing for edge devices or cutting down cloud expenses, our tools are here to help you every step of the way.