thewhole commited on
Commit
981e791
1 Parent(s): 15af40f

Update shape.py

Browse files
Files changed (1) hide show
  1. shape.py +19 -1
shape.py CHANGED
@@ -8,4 +8,22 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
8
  xm = load_model('transmitter', device=device)
9
  model = load_model('text300M', device=device)
10
  # model.load_state_dict(torch.load('./load/shapE_finetuned_with_330kdata.pth', map_location=device)['model_state_dict'])
11
- diffusion = diffusion_from_config_shape(load_config('diffusion'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  xm = load_model('transmitter', device=device)
9
  model = load_model('text300M', device=device)
10
  # model.load_state_dict(torch.load('./load/shapE_finetuned_with_330kdata.pth', map_location=device)['model_state_dict'])
11
+ diffusion = diffusion_from_config_shape(load_config('diffusion'))
12
+ del xm
13
+ del model
14
+ del diffusion
15
+
16
+ from diffusers import DDIMScheduler, DDPMScheduler, StableDiffusionPipeline
17
+
18
+
19
+ pipe_kwargs = {
20
+ "tokenizer": None,
21
+ "safety_checker": None,
22
+ "feature_extractor": None,
23
+ "requires_safety_checker": False,
24
+ "torch_dtype": torch.float16 ,
25
+ }
26
+ self.pipe = StableDiffusionPipeline.from_pretrained(
27
+ "stabilityai/stable-diffusion-2-1-base",
28
+ **pipe_kwargs,
29
+ )