Files changed (1) hide show
  1. README.md +55 -97
README.md CHANGED
@@ -1,97 +1,55 @@
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://docs.pruna.ai/en/latest/setup/pip.html" target="_blank" rel="noopener noreferrer">
17
- <img src="https://imgur.com/rVAgqMY.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/rskEr4BZJx)
26
-
27
-
28
- <div style="color: #9B1DBE; font-size: 2em; font-weight: bold;">
29
- Deprecation Notice: This model is deprecated and will no longer receive updates.
30
- </div>
31
- <br><br>
32
-
33
- # Simply make AI models cheaper, smaller, faster, and greener!
34
-
35
- - Give a thumbs up if you like this model!
36
- - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
37
- - Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
38
- - Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
39
- - Join Pruna AI community on Discord [here](https://discord.gg/rskEr4BZJx) to share feedback/suggestions or get help.
40
-
41
- ## Results
42
-
43
- ![image info](./plots.png)
44
-
45
- **Frequently Asked Questions**
46
- - ***How does the compression work?*** The model is compressed by combining xformers, triton, jit, cuda graphs, tiling, and step caching.
47
- - ***How does the model quality change?*** The quality of the model output might slightly vary compared to the base model.
48
- - ***How is the model efficiency evaluated?*** These results were obtained on NVIDIA A100-PCIE-40GB with configuration described in `model/smash_config.json` and are obtained after a hardware warmup. The smashed model is directly compared to the original base model. Efficiency results may vary in other settings (e.g. other hardware, image size, batch size, ...). We recommend to directly run them in the use-case conditions to know if the smashed model can benefit you.
49
- - ***What is the model format?*** We used a custom Pruna model format based on pickle to make models compatible with the compression methods. We provide a tutorial to run models in dockers in the documentation [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/) if needed.
50
- - ***What is the naming convention for Pruna Huggingface models?*** We take the original model name and append "turbo", "tiny", or "green" if the smashed model has a measured inference speed, inference memory, or inference energy consumption which is less than 90% of the original base model.
51
- - ***How to compress my own models?*** 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).
52
- - ***What are "first" metrics?*** Results mentioning "first" are obtained after the first run of the model. The first run might take more memory or be slower than the subsequent runs due cuda overheads.
53
-
54
- ## Setup
55
-
56
- You can run the smashed model with these steps:
57
-
58
- 0. Check that you have linux, python 3.10, and cuda 12.1.0 requirements installed. For cuda, check with `nvcc --version` and install with `conda install nvidia/label/cuda-12.1.0::cuda`.
59
- 1. Install the `pruna-engine` available [here](https://pypi.org/project/pruna-engine/) on Pypi. It might take up to 15 minutes to install.
60
- ```bash
61
- pip install pruna-engine[gpu]==0.6.0 --extra-index-url https://pypi.nvidia.com --extra-index-url https://pypi.ngc.nvidia.com --extra-index-url https://prunaai.pythonanywhere.com/
62
- ```
63
- 3. Download the model files using one of these three options.
64
- - Option 1 - Use command line interface (CLI):
65
- ```bash
66
- mkdir runwayml-stable-diffusion-v1-5-turbo-tiny-green-smashed
67
- huggingface-cli download PrunaAI/runwayml-stable-diffusion-v1-5-turbo-tiny-green-smashed --local-dir runwayml-stable-diffusion-v1-5-turbo-tiny-green-smashed --local-dir-use-symlinks False
68
- ```
69
- - Option 2 - Use Python:
70
- ```python
71
- import subprocess
72
- repo_name = "runwayml-stable-diffusion-v1-5-turbo-tiny-green-smashed"
73
- subprocess.run(["mkdir", repo_name])
74
- subprocess.run(["huggingface-cli", "download", 'PrunaAI/'+ repo_name, "--local-dir", repo_name, "--local-dir-use-symlinks", "False"])
75
- ```
76
- - Option 3 - Download them manually on the HuggingFace model page.
77
- 3. Load & run the model.
78
- ```python
79
- from pruna_engine.PrunaModel import PrunaModel
80
-
81
- model_path = "runwayml-stable-diffusion-v1-5-turbo-tiny-green-smashed/model" # Specify the downloaded model path.
82
- smashed_model = PrunaModel.load_model(model_path) # Load the model.
83
- smashed_model(prompt='Beautiful fruits in trees', height=512, width=512)[0][0] # Run the model where x is the expected input of.
84
- ```
85
-
86
- ## Configurations
87
-
88
- The configuration info are in `config.json`.
89
-
90
- ## Credits & License
91
-
92
- We follow the same license as the original model. Please check the license of the original model runwayml/stable-diffusion-v1-5 before using this model which provided the base model.
93
-
94
- ## Want to compress other models?
95
-
96
- - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
97
- - Request access to easily compress your own AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
 
1
+ from transformers import pipeline
2
+
3
+ # 加载模型
4
+ generator = pipeline("text-to-image", model="runwayml/stable-diffusion-v1-5")
5
+
6
+ # 定义提示词
7
+ prompt = " 海报设计概念
8
+
9
+ 标题
10
+
11
+ 声扬
12
+ 放大你的频道影响力
13
+
14
+ 视觉元素
15
+
16
+ 背景:使用渐变色彩,代表音乐的多样性和活力,如蓝色到紫色的渐变。
17
+
18
+ 图像:加入音波图形或音乐符号,象征声音的传播与影响力。
19
+
20
+ 插图:可以添加一些社交媒体图标,表示与平台的连接。
21
+
22
+ 文案
23
+
24
+ 主打口号:
25
+ “让音乐为你的频道增添力量!”
26
+
27
+ 服务介绍:
28
+
29
+ 定制专属频道音乐
30
+
31
+ 提升观众参与感
32
+
33
+ 增强品牌识别度
34
+
35
+ 联系方式
36
+
37
+ 二维码:扫描获取更多信息或试听样品。
38
+
39
+ 公司名称和联系方式:清晰展示在底部。
40
+
41
+ 色彩方案
42
+
43
+ 主色调:蓝色、紫色、白色,传达现代感和专业性。
44
+
45
+ 字体选择:选择简洁、现代的无衬线字体,确保易读性。
46
+
47
+ 布局建议
48
+
49
+ 标题居中放置,视觉中心突出。
50
+
51
+ 服务介绍和联系方式在海报底部,确保观众容易找到。 "
52
+
53
+ # 生成图像
54
+ image = generator(prompt, num_inference_steps=50, guidance_scale=7.5)
55
+ image[0].save("my_image.png")