mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-06 03:20:52 +00:00
[misc] update pre-commit and run all files (#4752)
* [misc] update pre-commit * [misc] run pre-commit * [misc] remove useless configuration files * [misc] ignore cuda for clang-format
This commit is contained in:
@@ -1,28 +1,18 @@
|
||||
import os
|
||||
import sys
|
||||
from copy import deepcopy
|
||||
|
||||
import yaml
|
||||
from datetime import datetime
|
||||
|
||||
from diffusers import StableDiffusionPipeline
|
||||
import torch
|
||||
|
||||
from main import get_parser
|
||||
import yaml
|
||||
from diffusers import StableDiffusionPipeline
|
||||
from ldm.modules.diffusionmodules.openaimodel import UNetModel
|
||||
|
||||
if __name__ == "__main__":
|
||||
with torch.no_grad():
|
||||
yaml_path = "../../train_colossalai.yaml"
|
||||
with open(yaml_path, 'r', encoding='utf-8') as f:
|
||||
with open(yaml_path, "r", encoding="utf-8") as f:
|
||||
config = f.read()
|
||||
base_config = yaml.load(config, Loader=yaml.FullLoader)
|
||||
unet_config = base_config['model']['params']['unet_config']
|
||||
unet_config = base_config["model"]["params"]["unet_config"]
|
||||
diffusion_model = UNetModel(**unet_config).to("cuda:0")
|
||||
|
||||
pipe = StableDiffusionPipeline.from_pretrained(
|
||||
"/data/scratch/diffuser/stable-diffusion-v1-4"
|
||||
).to("cuda:0")
|
||||
pipe = StableDiffusionPipeline.from_pretrained("/data/scratch/diffuser/stable-diffusion-v1-4").to("cuda:0")
|
||||
dif_model_2 = pipe.unet
|
||||
|
||||
random_input_ = torch.rand((4, 4, 32, 32)).to("cuda:0")
|
||||
@@ -35,4 +25,4 @@ if __name__ == "__main__":
|
||||
out_1 = diffusion_model(random_input_, time_stamp, context_)
|
||||
out_2 = dif_model_2(random_input_2, time_stamp2, context_2)
|
||||
print(out_1.shape)
|
||||
print(out_2['sample'].shape)
|
||||
print(out_2["sample"].shape)
|
||||
|
Reference in New Issue
Block a user