2c04f283d5f0695dd7d235bf6590cb885b3fb1d0384d349a5af1f1ef82733b02
Browse files- README.md +87 -0
- config.json +1 -0
- model/smash_config.json +1 -0
- plots.png +0 -0
README.md
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
library_name: pruna-engine
|
4 |
+
thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
|
5 |
+
metrics:
|
6 |
+
- memory_disk
|
7 |
+
- memory_inference
|
8 |
+
- inference_latency
|
9 |
+
- inference_throughput
|
10 |
+
- inference_CO2_emissions
|
11 |
+
- inference_energy_consumption
|
12 |
+
---
|
13 |
+
<!-- header start -->
|
14 |
+
<!-- 200823 -->
|
15 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
16 |
+
<a href="https://www.pruna.ai/" target="_blank" rel="noopener noreferrer">
|
17 |
+
<img src="https://i.imgur.com/eDAlcgk.png" alt="PrunaAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
18 |
+
</a>
|
19 |
+
</div>
|
20 |
+
<!-- header end -->
|
21 |
+
|
22 |
+
[![Twitter](https://img.shields.io/twitter/follow/PrunaAI?style=social)](https://twitter.com/PrunaAI)
|
23 |
+
[![GitHub](https://img.shields.io/github/followers/PrunaAI?label=Follow%20%40PrunaAI&style=social)](https://github.com/PrunaAI)
|
24 |
+
[![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue)](https://www.linkedin.com/company/93832878/admin/feed/posts/?feedType=following)
|
25 |
+
[![Discord](https://img.shields.io/badge/Discord-Join%20Us-blue?style=social&logo=discord)](https://discord.gg/CP4VSgck)
|
26 |
+
|
27 |
+
# Simply make AI models cheaper, smaller, faster, and greener!
|
28 |
+
|
29 |
+
- Give a thumbs up if you like this model!
|
30 |
+
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
31 |
+
- Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
32 |
+
- Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
|
33 |
+
- Join Pruna AI community on Discord [here](https://discord.gg/CP4VSgck) to share feedback/suggestions or get help.
|
34 |
+
|
35 |
+
## Results
|
36 |
+
|
37 |
+
![image info](./plots.png)
|
38 |
+
|
39 |
+
**Important remarks:**
|
40 |
+
- The quality of the model output might slightly vary compared to the base model. There might be minimal quality loss.
|
41 |
+
- These results were obtained on NVIDIA A100-PCIE-40GB with configuration described in config.json and are obtained after a hardware warmup. Efficiency results may vary in other settings (e.g. other hardware, image size, batch size, ...).
|
42 |
+
- You can request premium access to more compression methods and tech support for your specific use-cases [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
43 |
+
|
44 |
+
## Setup
|
45 |
+
|
46 |
+
You can run the smashed model with these steps:
|
47 |
+
|
48 |
+
0. Check cuda, torch, packaging requirements are installed. For cuda, check with `nvcc --version` and install with `conda install nvidia/label/cuda-12.1.0::cuda`. For packaging and torch, run `pip install packaging torch`.
|
49 |
+
1. Install the `pruna-engine` available [here](https://pypi.org/project/pruna-engine/) on Pypi. It might take 15 minutes to install.
|
50 |
+
```bash
|
51 |
+
pip install pruna-engine[gpu] --extra-index-url https://pypi.nvidia.com --extra-index-url https://pypi.ngc.nvidia.com --extra-index-url https://prunaai.pythonanywhere.com/
|
52 |
+
```
|
53 |
+
3. Download the model files using one of these three options.
|
54 |
+
- Option 1 - Use command line interface (CLI):
|
55 |
+
```bash
|
56 |
+
mkdir Linaqruf-animagine-xl-turbo-tiny-green-smashed
|
57 |
+
huggingface-cli download PrunaAI/Linaqruf-animagine-xl-turbo-tiny-green-smashed --local-dir Linaqruf-animagine-xl-turbo-tiny-green-smashed --local-dir-use-symlinks False
|
58 |
+
```
|
59 |
+
- Option 2 - Use Python:
|
60 |
+
```python
|
61 |
+
import subprocess
|
62 |
+
repo_name = "Linaqruf-animagine-xl-turbo-tiny-green-smashed"
|
63 |
+
subprocess.run(["mkdir", repo_name])
|
64 |
+
subprocess.run(["huggingface-cli", "download", 'PrunaAI/'+ repo_name, "--local-dir", repo_name, "--local-dir-use-symlinks", "False"])
|
65 |
+
```
|
66 |
+
- Option 3 - Download them manually on the HuggingFace model page.
|
67 |
+
3. Load & run the model.
|
68 |
+
```python
|
69 |
+
from pruna_engine.PrunaModel import PrunaModel
|
70 |
+
|
71 |
+
model_path = "Linaqruf-animagine-xl-turbo-tiny-green-smashed/model" # Specify the downloaded model path.
|
72 |
+
smashed_model = PrunaModel.load_model(model_path) # Load the model.
|
73 |
+
smashed_model(prompt='Beautiful fruits in trees', height=1024, width=1024)[0][0] # Run the model where x is the expected input of.
|
74 |
+
```
|
75 |
+
|
76 |
+
## Configurations
|
77 |
+
|
78 |
+
The configuration info are in `config.json`.
|
79 |
+
|
80 |
+
## Credits & License
|
81 |
+
|
82 |
+
We follow the same license as the original model. Please check the license of the original model Linaqruf/animagine-xl before using this model which provided the base model.
|
83 |
+
|
84 |
+
## Want to compress other models?
|
85 |
+
|
86 |
+
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
87 |
+
- Request access to easily compress your own AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
|
config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"pruners": "None", "pruning_ratio": "None", "factorizers": "None", "quantizers": "None", "n_quantization_bits": 32, "output_deviation": 0.0, "compilers": "['step_caching', 'tiling', 'diffusers2']", "static_batch": true, "static_shape": false, "controlnet": "None", "unet_dim": 4, "device": "cuda", "batch_size": 1, "max_batch_size": 1, "image_height": 1024, "image_width": 1024, "version": "xl-1.0", "scheduler": "DDIM", "task": "txt2imgxl", "weight_name": "None", "model_name": "Linaqruf/animagine-xl", "save_load_fn": "stable_fast"}
|
model/smash_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"api_key": "pruna_c4c77860c62a2965f6bc281841ee1d7bd3", "verify_url": "http://johnrachwan.pythonanywhere.com", "smash_config": {"pruners": "None", "pruning_ratio": "None", "factorizers": "None", "quantizers": "None", "n_quantization_bits": 32, "output_deviation": 0.0, "compilers": "['step_caching', 'tiling', 'diffusers2']", "static_batch": true, "static_shape": false, "controlnet": "None", "unet_dim": 4, "device": "cuda", "cache_dir": ".models/optimized_model", "batch_size": 1, "max_batch_size": 1, "image_height": 1024, "image_width": 1024, "version": "xl-1.0", "scheduler": "DDIM", "task": "txt2imgxl", "weight_name": "None", "model_name": "Linaqruf/animagine-xl", "save_load_fn": "stable_fast"}}
|
plots.png
ADDED