Instructions to use AiArtLab/sdxs-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AiArtLab/sdxs-1b with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("AiArtLab/sdxs-1b", dtype=torch.bfloat16, device_map="cuda") prompt = "sdxs-1b" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
2603
Browse files- girl.jpg +2 -2
- media/result_grid.jpg +2 -2
- pipeline_sdxs.py +4 -4
- samples/unet_1024x1280_0.jpg +2 -2
- samples/unet_1088x1280_0.jpg +2 -2
- samples/unet_1152x1280_0.jpg +2 -2
- samples/unet_1216x1280_0.jpg +2 -2
- samples/unet_1280x1024_0.jpg +2 -2
- samples/unet_1280x1088_0.jpg +2 -2
- samples/unet_1280x1152_0.jpg +2 -2
- samples/unet_1280x1216_0.jpg +2 -2
- samples/unet_1280x1280_0.jpg +2 -2
- samples/unet_1280x640_0.jpg +2 -2
- samples/unet_1280x704_0.jpg +2 -2
- samples/unet_1280x768_0.jpg +2 -2
- samples/unet_1280x832_0.jpg +2 -2
- samples/unet_1280x896_0.jpg +2 -2
- samples/unet_1280x960_0.jpg +2 -2
- samples/unet_640x1280_0.jpg +2 -2
- samples/unet_704x1280_0.jpg +2 -2
- samples/unet_768x1280_0.jpg +2 -2
- samples/unet_832x1280_0.jpg +2 -2
- samples/unet_896x1280_0.jpg +2 -2
- samples/unet_960x1280_0.jpg +2 -2
- test.ipynb +2 -2
- train.py +3 -3
- unet/diffusion_pytorch_model.safetensors +1 -1
girl.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
media/result_grid.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
pipeline_sdxs.py
CHANGED
|
@@ -158,7 +158,7 @@ class SdxsPipeline(DiffusionPipeline):
|
|
| 158 |
messages = [{"role": "user", "content": [{"type": "text", "text": sys_msg + p}]}]
|
| 159 |
|
| 160 |
# Используем Qwen-Instruct формат (apply_chat_template сам подставит system/user/assistant токены)
|
| 161 |
-
inputs = self.
|
| 162 |
messages,
|
| 163 |
tokenize=True,
|
| 164 |
add_generation_prompt=True,
|
|
@@ -166,15 +166,15 @@ class SdxsPipeline(DiffusionPipeline):
|
|
| 166 |
return_tensors="pt"
|
| 167 |
).to(device)
|
| 168 |
|
| 169 |
-
generated_ids = self.
|
| 170 |
-
**inputs, max_new_tokens=
|
| 171 |
)
|
| 172 |
|
| 173 |
# Обрезаем входные токены из ответа
|
| 174 |
generated_ids_trimmed = [
|
| 175 |
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 176 |
]
|
| 177 |
-
output_text = self.
|
| 178 |
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 179 |
)
|
| 180 |
refined_list.append(output_text)
|
|
|
|
| 158 |
messages = [{"role": "user", "content": [{"type": "text", "text": sys_msg + p}]}]
|
| 159 |
|
| 160 |
# Используем Qwen-Instruct формат (apply_chat_template сам подставит system/user/assistant токены)
|
| 161 |
+
inputs = self.tokenizer.apply_chat_template(
|
| 162 |
messages,
|
| 163 |
tokenize=True,
|
| 164 |
add_generation_prompt=True,
|
|
|
|
| 166 |
return_tensors="pt"
|
| 167 |
).to(device)
|
| 168 |
|
| 169 |
+
generated_ids = self.text_encoder.generate(
|
| 170 |
+
**inputs, max_new_tokens=255, do_sample=True,temperature = 0.7
|
| 171 |
)
|
| 172 |
|
| 173 |
# Обрезаем входные токены из ответа
|
| 174 |
generated_ids_trimmed = [
|
| 175 |
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 176 |
]
|
| 177 |
+
output_text = self.tokenizer.batch_decode(
|
| 178 |
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 179 |
)
|
| 180 |
refined_list.append(output_text)
|
samples/unet_1024x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1088x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1152x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1216x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x1024_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x1088_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x1152_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x1216_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x640_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x704_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x768_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x832_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x896_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_1280x960_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_640x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_704x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_768x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_832x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_896x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
samples/unet_960x1280_0.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
test.ipynb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14eeb3271e1dc39b928d1006c55c727b28b1c5c320fe8d16467b7542bef7196a
|
| 3 |
+
size 6720678
|
train.py
CHANGED
|
@@ -43,7 +43,7 @@ batch_size = local_bs * num_gpus
|
|
| 43 |
print(f"GPUs: {num_gpus}, Local BS: {local_bs}, Global BS: {local_bs * num_gpus}")
|
| 44 |
base_learning_rate = 2e-5
|
| 45 |
min_learning_rate = 3e-6
|
| 46 |
-
num_epochs = num_gpus #8 * max(1, int(num_gpus / 2))
|
| 47 |
sample_interval_share = 20
|
| 48 |
cfg_dropout = 0.10
|
| 49 |
max_length = 248
|
|
@@ -149,8 +149,8 @@ if accelerator.is_main_process:
|
|
| 149 |
|
| 150 |
# --------------------------- Загрузка моделей ---------------------------
|
| 151 |
vae = AutoencoderKL.from_pretrained("vae", torch_dtype=dtype).to(device).eval()
|
| 152 |
-
tokenizer = Qwen3_5Tokenizer.from_pretrained("
|
| 153 |
-
text_encoder = Qwen3_5ForConditionalGeneration.from_pretrained("
|
| 154 |
scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained("scheduler")
|
| 155 |
|
| 156 |
def encode_texts(texts, max_length=max_length):
|
|
|
|
| 43 |
print(f"GPUs: {num_gpus}, Local BS: {local_bs}, Global BS: {local_bs * num_gpus}")
|
| 44 |
base_learning_rate = 2e-5
|
| 45 |
min_learning_rate = 3e-6
|
| 46 |
+
num_epochs = 1 #num_gpus #8 * max(1, int(num_gpus / 2))
|
| 47 |
sample_interval_share = 20
|
| 48 |
cfg_dropout = 0.10
|
| 49 |
max_length = 248
|
|
|
|
| 149 |
|
| 150 |
# --------------------------- Загрузка моделей ---------------------------
|
| 151 |
vae = AutoencoderKL.from_pretrained("vae", torch_dtype=dtype).to(device).eval()
|
| 152 |
+
tokenizer = Qwen3_5Tokenizer.from_pretrained("tokenizer")
|
| 153 |
+
text_encoder = Qwen3_5ForConditionalGeneration.from_pretrained("text_encoder", torch_dtype=torch.float16).to(device).eval()
|
| 154 |
scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained("scheduler")
|
| 155 |
|
| 156 |
def encode_texts(texts, max_length=max_length):
|
unet/diffusion_pytorch_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 6318956752
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c2f0d7d80722dbfc05048a68068d7be8c4c8866e5890d63a6fcc5609316f538
|
| 3 |
size 6318956752
|