Skip to content

Commit a8f8d7b

Browse files
using with DDPM
1 parent cefca0f commit a8f8d7b

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

scripts/convert_cogview3_to_diffusers.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import torch
55
from transformers import T5EncoderModel, T5Tokenizer
6-
from diffusers import AutoencoderKL, CogVideoXDDIMScheduler
6+
from diffusers import AutoencoderKL, DDPMScheduler
77
from diffusers.loaders.single_file_utils import convert_ldm_vae_checkpoint
88

99
from diffusers import (
@@ -185,21 +185,17 @@ def get_args():
185185
if args.vae_ckpt_path is not None:
186186
vae = convert_vae(args.vae_ckpt_path, args.scaling_factor, dtype)
187187

188-
text_encoder_id = "/share/official_pretrains/hf_home/t5-v1_1-xxl"
188+
text_encoder_id = "google/t5-v1_1-xxl"
189189
tokenizer = T5Tokenizer.from_pretrained(text_encoder_id, model_max_length=TOKENIZER_MAX_LENGTH)
190190
text_encoder = T5EncoderModel.from_pretrained(text_encoder_id, cache_dir=args.text_encoder_cache_dir)
191191

192-
scheduler = CogVideoXDDIMScheduler.from_config(
192+
scheduler = DDPMScheduler.from_config(
193193
{
194-
"beta_end": 0.012,
195-
"beta_schedule": "scaled_linear",
196-
"beta_start": 0.00085,
197-
"clip_sample": False,
198-
"num_train_timesteps": 1000,
199-
"prediction_type": "v_prediction",
200-
"rescale_betas_zero_snr": True,
201-
"set_alpha_to_one": True,
202-
"timestep_spacing": "trailing",
194+
"num_train_timesteps": 50,
195+
"beta_start": 0.0001,
196+
"beta_end": 0.02,
197+
"beta_schedule": "linear",
198+
"prediction_type": "v_prediction"
203199
}
204200
)
205201

show_model_cogview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
)
2323

2424
# 输出模型结果
25-
print("Output shape:", outputs.sample.shape)
25+
print("Output shape:", outputs.sample.shape)

0 commit comments

Comments
 (0)