Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
-
# Templates-
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
-
##
|
| 9 |
|
| 10 |
|Prompt: A meme with a happy expression.|Prompt: A meme with a sleepy expression.|Prompt: A meme with a surprised expression.|
|
| 11 |
|-|-|-|
|
| 12 |
||||
|
| 13 |
|
| 14 |
-
##
|
| 15 |
|
| 16 |
-
*
|
| 17 |
|
| 18 |
```
|
| 19 |
git clone https://github.com/modelscope/DiffSynth-Studio.git
|
|
@@ -21,12 +21,13 @@ cd DiffSynth-Studio
|
|
| 21 |
pip install -e .
|
| 22 |
```
|
| 23 |
|
| 24 |
-
*
|
| 25 |
|
| 26 |
```python
|
| 27 |
from diffsynth.diffusion.template import TemplatePipeline
|
| 28 |
from diffsynth.pipelines.flux2_image import Flux2ImagePipeline, ModelConfig
|
| 29 |
import torch
|
|
|
|
| 30 |
|
| 31 |
pipe = Flux2ImagePipeline.from_pretrained(
|
| 32 |
torch_dtype=torch.bfloat16,
|
|
@@ -69,13 +70,14 @@ image = template(
|
|
| 69 |
image.save("image_PandaMeme_surprised.jpg")
|
| 70 |
```
|
| 71 |
|
| 72 |
-
*
|
| 73 |
|
| 74 |
```python
|
| 75 |
from diffsynth.diffusion.template import TemplatePipeline
|
| 76 |
from diffsynth.pipelines.flux2_image import Flux2ImagePipeline, ModelConfig
|
| 77 |
import torch
|
| 78 |
|
|
|
|
| 79 |
vram_config = {
|
| 80 |
"offload_dtype": "disk",
|
| 81 |
"offload_device": "disk",
|
|
@@ -129,9 +131,9 @@ image = template(
|
|
| 129 |
image.save("image_PandaMeme_surprised.jpg")
|
| 130 |
```
|
| 131 |
|
| 132 |
-
##
|
| 133 |
|
| 134 |
-
|
| 135 |
|
| 136 |
```shell
|
| 137 |
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "flux2/Template-KleinBase4B-PandaMeme/*" --local_dir ./data/diffsynth_example_dataset
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
+
# Templates-PandaMeme (FLUX.2-klein-base-4B)
|
| 5 |
|
| 6 |
+
This model is part of the first batch of Diffusion Templates series models open-sourced by [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio). It's an Easter egg model capable of generating various quirky panda-head meme images.
|
| 7 |
|
| 8 |
+
## Demo
|
| 9 |
|
| 10 |
|Prompt: A meme with a happy expression.|Prompt: A meme with a sleepy expression.|Prompt: A meme with a surprised expression.|
|
| 11 |
|-|-|-|
|
| 12 |
||||
|
| 13 |
|
| 14 |
+
## Inference Code
|
| 15 |
|
| 16 |
+
* Install [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio)
|
| 17 |
|
| 18 |
```
|
| 19 |
git clone https://github.com/modelscope/DiffSynth-Studio.git
|
|
|
|
| 21 |
pip install -e .
|
| 22 |
```
|
| 23 |
|
| 24 |
+
* Direct inference (requires 40G GPU memory)
|
| 25 |
|
| 26 |
```python
|
| 27 |
from diffsynth.diffusion.template import TemplatePipeline
|
| 28 |
from diffsynth.pipelines.flux2_image import Flux2ImagePipeline, ModelConfig
|
| 29 |
import torch
|
| 30 |
+
```
|
| 31 |
|
| 32 |
pipe = Flux2ImagePipeline.from_pretrained(
|
| 33 |
torch_dtype=torch.bfloat16,
|
|
|
|
| 70 |
image.save("image_PandaMeme_surprised.jpg")
|
| 71 |
```
|
| 72 |
|
| 73 |
+
* Enable lazy loading and memory management, requires 24G GPU memory
|
| 74 |
|
| 75 |
```python
|
| 76 |
from diffsynth.diffusion.template import TemplatePipeline
|
| 77 |
from diffsynth.pipelines.flux2_image import Flux2ImagePipeline, ModelConfig
|
| 78 |
import torch
|
| 79 |
|
| 80 |
+
```python
|
| 81 |
vram_config = {
|
| 82 |
"offload_dtype": "disk",
|
| 83 |
"offload_device": "disk",
|
|
|
|
| 131 |
image.save("image_PandaMeme_surprised.jpg")
|
| 132 |
```
|
| 133 |
|
| 134 |
+
## Training Code
|
| 135 |
|
| 136 |
+
After installing DiffSynth-Studio, use the following script to start training. For more information, please refer to the [DiffSynth-Studio Documentation](https://diffsynth-studio-doc.readthedocs.io/zh-cn/latest/).
|
| 137 |
|
| 138 |
```shell
|
| 139 |
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "flux2/Template-KleinBase4B-PandaMeme/*" --local_dir ./data/diffsynth_example_dataset
|