rynmurdock commited on
Commit
e819e80
1 Parent(s): 6c39b55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -116,13 +116,13 @@ pipe.to(device=DEVICE)
116
  #pipe.vae = torch.compile(pipe.vae)
117
 
118
 
119
- im_embs = torch.zeros(1, 1, 1, 1280, device=DEVICE, dtype=dtype)
120
- output = pipe(prompt='a person', guidance_scale=0, added_cond_kwargs={}, ip_adapter_image_embeds=[im_embs], num_inference_steps=STEPS)
121
- leave_im_emb, _ = pipe.encode_image(
122
- output.frames[0][len(output.frames[0])//2], DEVICE, 1, output_hidden_state
123
- )
124
- assert len(output.frames[0]) == 16
125
- leave_im_emb.detach().to('cpu')
126
 
127
 
128
  @spaces.GPU()
@@ -191,10 +191,10 @@ def get_user_emb(embs, ys):
191
  print('ys are longer than embs; popping latest rating')
192
  ys.pop(-1)
193
 
194
- feature_embs = np.array(torch.stack([embs[i].squeeze().to('cpu') for i in indices] + [leave_im_emb.to('cpu').squeeze()]).to('cpu'))
195
  #scaler = preprocessing.StandardScaler().fit(feature_embs)
196
  #feature_embs = scaler.transform(feature_embs)
197
- chosen_y = np.array([ys[i] for i in indices] + [0])
198
 
199
  print('Gathering coefficients')
200
  #lin_class = Ridge(fit_intercept=False).fit(feature_embs, chosen_y)
 
116
  #pipe.vae = torch.compile(pipe.vae)
117
 
118
 
119
+ #im_embs = torch.zeros(1, 1, 1, 1280, device=DEVICE, dtype=dtype)
120
+ #output = pipe(prompt='a person', guidance_scale=0, added_cond_kwargs={}, ip_adapter_image_embeds=[im_embs], num_inference_steps=STEPS)
121
+ #leave_im_emb, _ = pipe.encode_image(
122
+ # output.frames[0][len(output.frames[0])//2], DEVICE, 1, output_hidden_state
123
+ #)
124
+ #assert len(output.frames[0]) == 16
125
+ #leave_im_emb.detach().to('cpu')
126
 
127
 
128
  @spaces.GPU()
 
191
  print('ys are longer than embs; popping latest rating')
192
  ys.pop(-1)
193
 
194
+ feature_embs = np.array(torch.stack([embs[i].squeeze().to('cpu') for i in indices]]).to('cpu'))
195
  #scaler = preprocessing.StandardScaler().fit(feature_embs)
196
  #feature_embs = scaler.transform(feature_embs)
197
+ chosen_y = np.array([ys[i] for i in indices])
198
 
199
  print('Gathering coefficients')
200
  #lin_class = Ridge(fit_intercept=False).fit(feature_embs, chosen_y)