Update README.md
Browse files
README.md
CHANGED
|
@@ -1,97 +1,55 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 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 |
-
|
| 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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|