Update all files for BitDance-Tokenizer-diffusers
Browse files
README.md
CHANGED
|
@@ -28,7 +28,37 @@ Each subfolder includes:
|
|
| 28 |
- `config.json` with the autoencoder architecture
|
| 29 |
- `conversion_metadata.json` documenting the source checkpoint and config
|
| 30 |
|
| 31 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
```python
|
| 34 |
import torch
|
|
|
|
| 28 |
- `config.json` with the autoencoder architecture
|
| 29 |
- `conversion_metadata.json` documenting the source checkpoint and config
|
| 30 |
|
| 31 |
+
## Test (load tokenizer only)
|
| 32 |
+
|
| 33 |
+
This repo is self-contained: it includes `bitdance_diffusers` (copied from BitDance-14B-64x-diffusers) for the `BitDanceAutoencoder` class. Run the test to verify loading and encode/decode:
|
| 34 |
+
|
| 35 |
+
The test loads all three autoencoders and runs a quick encode/decode check with `ae_d16c32` (no full image generation).
|
| 36 |
+
|
| 37 |
+
## Loading tokenizer autoencoders
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
import sys
|
| 41 |
+
from pathlib import Path
|
| 42 |
+
|
| 43 |
+
# Self-contained: add local path so bitdance_diffusers is found
|
| 44 |
+
BASE_DIR = Path(__file__).resolve().parent
|
| 45 |
+
sys.path.insert(0, str(BASE_DIR))
|
| 46 |
+
|
| 47 |
+
from bitdance_diffusers import BitDanceAutoencoder
|
| 48 |
+
|
| 49 |
+
# Load any tokenizer autoencoder (use repo path or local path)
|
| 50 |
+
ae = BitDanceAutoencoder.from_pretrained(
|
| 51 |
+
"BiliSakura/BitDance-Tokenizer-diffusers", # or str(BASE_DIR) for local
|
| 52 |
+
subfolder="ae_d16c32",
|
| 53 |
+
)
|
| 54 |
+
# ae_d16c32: z_channels=32, patch_size=16
|
| 55 |
+
# ae_d32c128: z_channels=128, patch_size=32
|
| 56 |
+
# ae_d32c256: z_channels=256, patch_size=32
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Using with a BitDance pipeline (full inference)
|
| 60 |
+
|
| 61 |
+
To swap a tokenizer into a BitDance diffusers pipeline for image generation:
|
| 62 |
|
| 63 |
```python
|
| 64 |
import torch
|