sharpenb commited on
Commit
8e8da05
1 Parent(s): f6d4ca5

f1530c7b10484077b6e4c363aac74e3be2ec023c1aca7fd80c20dc8d98ace0fa

Browse files
Files changed (4) hide show
  1. README.md +83 -0
  2. config.json +1 -0
  3. model/smash_config.json +1 -0
  4. plots.png +0 -0
README.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Simply make AI models cheaper, smaller, faster, and greener!
23
+
24
+ [![Twitter](https://img.shields.io/twitter/follow/PrunaAI?style=social)](https://twitter.com/PrunaAI)
25
+ [![GitHub](https://img.shields.io/github/followers/PrunaAI?label=Follow%20%40PrunaAI&style=social)](https://github.com/PrunaAI)
26
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue)](https://www.linkedin.com/company/93832878/admin/feed/posts/?feedType=following)
27
+
28
+ - Give a thumbs up if you like this model!
29
+ - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
30
+ - Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
31
+ - Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
32
+ - Share feedback and suggestions on the Slack of Pruna AI (Coming soon!).
33
+
34
+ ## Results
35
+
36
+ ![image info](./plots.png)
37
+
38
+ These results were obtained on NVIDIA A100-PCIE-40GB with configuration described in config.json. Results may vary in other settings (e.g. other hardware, image size, batch size, ...).
39
+
40
+ ## Setup
41
+
42
+ You can run the smashed model with these steps:
43
+
44
+ 0. Check that you have cuda installed. You can do this by running `nvcc --version` or `conda install nvidia/label/cuda-12.1.0::cuda`.
45
+ 1. Install the `pruna-engine` available [here](https://pypi.org/project/pruna-engine/) on Pypi. It might take 15 minutes to install.
46
+ ```bash
47
+ pip install pruna-engine[gpu] --extra-index-url https://pypi.nvidia.com --extra-index-url https://pypi.ngc.nvidia.com
48
+ ```
49
+ 3. Download the model files using one of these three options.
50
+ - Option 1 - Use command line interface (CLI):
51
+ ```bash
52
+ mkdir stabilityai-stable-diffusion-2-1-turbo-tiny-green-smashed
53
+ huggingface-cli download PrunaAI/stabilityai-stable-diffusion-2-1-turbo-tiny-green-smashed --local-dir stabilityai-stable-diffusion-2-1-turbo-tiny-green-smashed --local-dir-use-symlinks False
54
+ ```
55
+ - Option 2 - Use Python:
56
+ ```python
57
+ import subprocess
58
+ repo_name = "stabilityai-stable-diffusion-2-1-turbo-tiny-green-smashed"
59
+ subprocess.run(["mkdir", repo_name])
60
+ subprocess.run(["huggingface-cli", "download", 'PrunaAI/'+ repo_name, "--local-dir", repo_name, "--local-dir-use-symlinks", "False"])
61
+ ```
62
+ - Option 3 - Download them manually on the HuggingFace model page.
63
+ 3. Load & run the model.
64
+ ```python
65
+ from pruna_engine.PrunaModel import PrunaModel
66
+
67
+ model_path = "stabilityai-stable-diffusion-2-1-turbo-tiny-green-smashed/model" # Specify the downloaded model path.
68
+ smashed_model = PrunaModel.load_model(model_path) # Load the model.
69
+ smashed_model(prompt='Beautiful fruits in trees', height=1024, width=1024)[0][0] # Run the model where x is the expected input of.
70
+ ```
71
+
72
+ ## Configurations
73
+
74
+ The configuration info are in `config.json`.
75
+
76
+ ## License
77
+
78
+ We follow the same license as the original model. Please check the license of the original model ORIGINAL_stabilityai-stable-diffusion-2-1-turbo-tiny-green-smashed before using this model.
79
+
80
+ ## Want to compress other models?
81
+
82
+ - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
83
+ - 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": 0.0, "factorizers": "None", "quantizers": "None", "n_quantization_bits": 32, "output_deviation": 0.005, "compilers": "['diffusers2']", "static_batch": true, "static_shape": false, "controlnet": "None", "unet_dim": 4, "device": "cuda", "save_dir": "/ceph/hdd/staff/charpent/models/.models/optimized_model", "batch_size": 1, "max_batch_size": 1, "image_height": 768, "image_width": 768, "version": "2.1", "task": "txt2img", "model_name": "stabilityai/stable-diffusion-2-1", "weight_name": "None", "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": 0.0, "factorizers": "None", "quantizers": "None", "n_quantization_bits": 32, "output_deviation": 0.005, "compilers": "['diffusers2']", "static_batch": true, "static_shape": false, "controlnet": "None", "unet_dim": 4, "device": "cuda", "cache_dir": "/ceph/hdd/staff/charpent/.cache/models", "save_dir": "/ceph/hdd/staff/charpent/models/.models/optimized_model", "batch_size": 1, "max_batch_size": 1, "image_height": 768, "image_width": 768, "version": "2.1", "task": "txt2img", "model_name": "stabilityai/stable-diffusion-2-1", "weight_name": "None", "save_load_fn": "stable_fast"}}
plots.png ADDED