Instructions to use opendiffusionai/sd15vae-texttuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use opendiffusionai/sd15vae-texttuned with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("opendiffusionai/sd15vae-texttuned", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +37 -0
- bookimg_16.step_069000.webp +3 -0
- config.json +38 -0
- diffusion_pytorch_model.safetensors +3 -0
- vae_sample_14pt.webp +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
bookimg_16.step_069000.webp filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# sd 1.5 vae, text trained demo
|
| 2 |
+
|
| 3 |
+
It has been said that the sd vae is not capable of faithful text rendering,
|
| 4 |
+
at a fundamental level.
|
| 5 |
+
I decided to test that and it turns out to not exactly be true.
|
| 6 |
+
|
| 7 |
+
This 4channel vae can render a 16pt font with almost perfect fidelity.
|
| 8 |
+
|
| 9 |
+
This is a TECH DEMO ONLY. I have trained it exclusively on text, so
|
| 10 |
+
normal rendering has drastically suffered as a result.
|
| 11 |
+
|
| 12 |
+
# Training details
|
| 13 |
+
This started with the original sd vae.
|
| 14 |
+
I generated an initial dataset of 14pt-only text images, with
|
| 15 |
+
https://github.com/ppbrown/ai-training/blob/main/trainer/vae/gen_glyph_dataset.py
|
| 16 |
+
( around 4000 of them)
|
| 17 |
+
I then trained the vae at LR 1e-5 for 28000 steps, batchsize 1,
|
| 18 |
+
using my standard settings of lpips/vgg weights 0.08, LAP 0.02
|
| 19 |
+
and "rawvgg" enabled, with my train_vae.py in that same repo
|
| 20 |
+
|
| 21 |
+
I then generated a MIXED size font dataset,ranging across 14,16,18, and 20pt
|
| 22 |
+
total images around 8000
|
| 23 |
+
This time I chose batch size 2, LR 2e-5.
|
| 24 |
+
|
| 25 |
+
14pt text seems to have a capacity limit for the 4channel vae.
|
| 26 |
+
16pt, however, renders almost indistinguishable from original.
|
| 27 |
+
The specific font used across all images, was
|
| 28 |
+
Libertinus Serif
|
| 29 |
+
|
| 30 |
+
!(clean 16pt)[bookimg_16.step_069000.webp]
|
| 31 |
+
|
| 32 |
+
If you want to try it out for yourself, you can use the tools in my repo,
|
| 33 |
+
such as
|
| 34 |
+
|
| 35 |
+
trainer/cache-utils/create_imgcache_sdvae.py --vae --previewonly \
|
| 36 |
+
--model opendiffusionai/sd15vae-texttrained --data_root someimgdir
|
| 37 |
+
|
bookimg_16.step_069000.webp
ADDED
|
Git LFS Details
|
config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "AutoencoderKL",
|
| 3 |
+
"_diffusers_version": "0.36.0",
|
| 4 |
+
"_name_or_path": "sd15_text_14pt-1e-5/step_028000",
|
| 5 |
+
"act_fn": "silu",
|
| 6 |
+
"block_out_channels": [
|
| 7 |
+
128,
|
| 8 |
+
256,
|
| 9 |
+
512,
|
| 10 |
+
512
|
| 11 |
+
],
|
| 12 |
+
"down_block_types": [
|
| 13 |
+
"DownEncoderBlock2D",
|
| 14 |
+
"DownEncoderBlock2D",
|
| 15 |
+
"DownEncoderBlock2D",
|
| 16 |
+
"DownEncoderBlock2D"
|
| 17 |
+
],
|
| 18 |
+
"force_upcast": true,
|
| 19 |
+
"in_channels": 3,
|
| 20 |
+
"latent_channels": 4,
|
| 21 |
+
"latents_mean": null,
|
| 22 |
+
"latents_std": null,
|
| 23 |
+
"layers_per_block": 2,
|
| 24 |
+
"mid_block_add_attention": true,
|
| 25 |
+
"norm_num_groups": 32,
|
| 26 |
+
"out_channels": 3,
|
| 27 |
+
"sample_size": 512,
|
| 28 |
+
"scaling_factor": 0.18215,
|
| 29 |
+
"shift_factor": null,
|
| 30 |
+
"up_block_types": [
|
| 31 |
+
"UpDecoderBlock2D",
|
| 32 |
+
"UpDecoderBlock2D",
|
| 33 |
+
"UpDecoderBlock2D",
|
| 34 |
+
"UpDecoderBlock2D"
|
| 35 |
+
],
|
| 36 |
+
"use_post_quant_conv": true,
|
| 37 |
+
"use_quant_conv": true
|
| 38 |
+
}
|
diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7150edb510d8cafaf97e061d01ba1bfda5dbcf2b7a70384a65c27560db9cb235
|
| 3 |
+
size 334643268
|
vae_sample_14pt.webp
ADDED
|