Upload folder using huggingface_hub (#1)
Browse files- 92d2cb062d08da9b45575288ef886a3fdebd88d0cdd69429564f003aa089d29c (56154400a782872bd801c681c6fcfc2ee915af77)
- 36404d5c0b21aa6d98a806ded210e649b7ce63b375f069a37caca72154f5e56f (a66dc4dc0529ea5bc269312fdbb7849325428f0c)
- README.md +86 -0
- config.json +1 -0
- model/optimized_model.pkl +3 -0
- model/smash_config.json +1 -0
- plots.png +0 -0
README.md
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
**Important remarks:**
|
39 |
+
- The quality of the model output might slightly vary compared to the base model. There might be minimal quality loss.
|
40 |
+
- 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, ...).
|
41 |
+
- 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).
|
42 |
+
|
43 |
+
## Setup
|
44 |
+
|
45 |
+
You can run the smashed model with these steps:
|
46 |
+
|
47 |
+
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`.
|
48 |
+
1. Install the `pruna-engine` available [here](https://pypi.org/project/pruna-engine/) on Pypi. It might take 15 minutes to install.
|
49 |
+
```bash
|
50 |
+
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/
|
51 |
+
```
|
52 |
+
3. Download the model files using one of these three options.
|
53 |
+
- Option 1 - Use command line interface (CLI):
|
54 |
+
```bash
|
55 |
+
mkdir prompthero-openjourney-turbo-green-smashed
|
56 |
+
huggingface-cli download PrunaAI/prompthero-openjourney-turbo-green-smashed --local-dir prompthero-openjourney-turbo-green-smashed --local-dir-use-symlinks False
|
57 |
+
```
|
58 |
+
- Option 2 - Use Python:
|
59 |
+
```python
|
60 |
+
import subprocess
|
61 |
+
repo_name = "prompthero-openjourney-turbo-green-smashed"
|
62 |
+
subprocess.run(["mkdir", repo_name])
|
63 |
+
subprocess.run(["huggingface-cli", "download", 'PrunaAI/'+ repo_name, "--local-dir", repo_name, "--local-dir-use-symlinks", "False"])
|
64 |
+
```
|
65 |
+
- Option 3 - Download them manually on the HuggingFace model page.
|
66 |
+
3. Load & run the model.
|
67 |
+
```python
|
68 |
+
from pruna_engine.PrunaModel import PrunaModel
|
69 |
+
|
70 |
+
model_path = "prompthero-openjourney-turbo-green-smashed/model" # Specify the downloaded model path.
|
71 |
+
smashed_model = PrunaModel.load_model(model_path) # Load the model.
|
72 |
+
smashed_model(prompt='Beautiful fruits in trees', height=512, width=512)[0][0] # Run the model where x is the expected input of.
|
73 |
+
```
|
74 |
+
|
75 |
+
## Configurations
|
76 |
+
|
77 |
+
The configuration info are in `config.json`.
|
78 |
+
|
79 |
+
## License
|
80 |
+
|
81 |
+
We follow the same license as the original model. Please check the license of the original model prompthero/openjourney before using this model.
|
82 |
+
|
83 |
+
## Want to compress other models?
|
84 |
+
|
85 |
+
- Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
|
86 |
+
- 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": 512, "image_width": 512, "version": "1.5", "task": "txt2img", "model_name": "prompthero/openjourney", "weight_name": "None", "save_load_fn": "stable_fast"}
|
model/optimized_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cbc091314a0a90b0e43a6d7bca40059921b9ea15d833857d879d13348493bf83
|
3 |
+
size 2743389033
|
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": 512, "image_width": 512, "version": "1.5", "task": "txt2img", "model_name": "prompthero/openjourney", "weight_name": "None", "save_load_fn": "stable_fast"}}
|
plots.png
ADDED