Upload folder using huggingface_hub

#2
README.md CHANGED
@@ -21,30 +21,52 @@ metrics:
21
 
22
  # Simply make AI models cheaper, smaller, faster, and greener!
23
 
 
 
 
 
 
 
 
 
 
 
24
  ## Results
25
 
26
  ![image info](./plots.png)
27
 
 
 
28
  ## Setup
29
 
30
- You can run the smashed model by:
31
- 1. Installing and importing the `pruna-engine` (version 0.2.9) package. Use `pip install pruna-engine==0.2.9 --extra-index-url https://pypi.nvidia.com --extra-index-url https://pypi.ngc.nvidia.com` for installation. See [Pypi](https://pypi.org/project/pruna-engine/) for details on the package.
32
- 2. Downloading the model files. This can be done using the Hugging Face CLI with the following commands:
33
  ```bash
34
- mkdir CompVis-stable-diffusion-v1-4-smashed
35
- huggingface-cli download PrunaAI/CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed --local-dir CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed --local-dir-use-symlinks False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  ```
37
- Alternatively, you can download them manually.
38
- 3. Loading the model.
39
- 4. Running the model.
40
- You can achieve this by running the following code:
41
-
42
- ```python
43
- from pruna_engine.PrunaModel import PrunaModel # Step (1): install and import `pruna-engine` package.
44
- model_path = "CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed/model" # Step (2): specify the downloaded model path.
45
- smashed_model = PrunaModel.load_model(model_path) # Step (3): load the model.
46
- y = smashed_model(prompt="a silly prune with a face in high definition", image_height=512, image_width=512)[0] # Step (4): run the model.
47
- ```
48
 
49
  ## Configurations
50
 
@@ -52,7 +74,7 @@ The configuration info are in `config.json`.
52
 
53
  ## License
54
 
55
- We follow the same license as the original model. Please check the license of the original model before using this model.
56
 
57
  ## Want to compress other models?
58
 
 
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
+ 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`.
44
+ 1. Install the `pruna-engine` available [here](https://pypi.org/project/pruna-engine/) on Pypi. It might take 15 minutes to install.
45
  ```bash
46
+ pip install pruna-engine[gpu] --extra-index-url https://pypi.nvidia.com --extra-index-url https://pypi.ngc.nvidia.com
47
+ ```
48
+ 3. Download the model files using one of these three options.
49
+ - Option 1 - Use command line interface (CLI):
50
+ ```bash
51
+ mkdir CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed
52
+ huggingface-cli download PrunaAI/CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed --local-dir CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed --local-dir-use-symlinks False
53
+ ```
54
+ - Option 2 - Use Python:
55
+ ```python
56
+ import subprocess
57
+ repo_name = "CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed"
58
+ subprocess.run(["mkdir", repo_name])
59
+ subprocess.run(["huggingface-cli", "download", 'PrunaAI/'+ repo_name, "--local-dir", repo_name, "--local-dir-use-symlinks", "False"])
60
+ ```
61
+ - Option 3 - Download them manually on the HuggingFace model page.
62
+ 3. Load & run the model.
63
+ ```python
64
+ from pruna_engine.PrunaModel import PrunaModel
65
+
66
+ model_path = "CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed/model" # Specify the downloaded model path.
67
+ smashed_model = PrunaModel.load_model(model_path) # Load the model.
68
+ smashed_model(prompt='Beautiful fruits in trees', height=1024, width=1024)[0][0] # Run the model where x is the expected input of.
69
  ```
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  ## Configurations
72
 
 
74
 
75
  ## License
76
 
77
+ We follow the same license as the original model. Please check the license of the original model ORIGINAL_CompVis-stable-diffusion-v1-4-turbo-tiny-green-smashed before using this model.
78
 
79
  ## Want to compress other models?
80
 
config.json CHANGED
@@ -1 +1 @@
1
- {"pruner": "None", "pruning_ratio": 0.0, "factorizer": "None", "quantizer": "None", "n_quantization_bits": 32, "output_deviation": 0.005, "compiler": "diffusers", "static_batch": true, "static_shape": true, "controlnet": "None", "unet_dim": 4, "max_batch_size": 1, "image_height": 512, "image_width": 512, "version": "1.4"}
 
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": 512, "image_width": 512, "version": "1.4", "task": "txt2img", "model_name": "CompVis/stable-diffusion-v1-4", "weight_name": "None", "save_load_fn": "stable_fast"}
model → model/optimized_model.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:09038b3604eac717b90a85bf1a989ef3a801d7bbecb83a1ec5be514c22f1429b
3
- size 1918309864
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:950c376291d01233f9fc7476b262f0bebe1950ed65c64b00f0a0d5dc77c93c29
3
+ size 2743389014
model/smash_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7f0574c6dbd9fe6b9bd3099a09b2ae640474eeee1bda5334f039f54bbdae188
3
+ size 742
plots.png CHANGED