Spaces:
Runtime error
Runtime error
Faran Fahandezh commited on
Commit ·
3c5efcb
1
Parent(s): 044e99f
Add application file4
Browse filesFiles changed (2)
897 unmodified lines898899900901902903904897 unmodified linesbin_target = bin_target * 256 #-> [0, 256]bin_target = dec2bin(bin_target.permute([0,2,1]).round().int(), 8)bin_target = bin_target.reshape([target.shape[0], target.shape[2], 16]).permute([0,2,1])t_weights = (t<10).cuda().unsqueeze(1).unsqueeze(2)t_weights = t_weights * (t_weights.shape[0]/max(1, t_weights.sum()))bin_target[bin_target==0] = -1assert model_output_bin.shape == bin_target.shape897 unmodified lines898899900901902903904905897 unmodified linesbin_target = bin_target * 256 #-> [0, 256]bin_target = dec2bin(bin_target.permute([0,2,1]).round().int(), 8)bin_target = bin_target.reshape([target.shape[0], target.shape[2], 16]).permute([0,2,1])# t_weights = (t<10).cuda().unsqueeze(1).unsqueeze(2)t_weights = (t<10).unsqueeze(1).unsqueeze(2)t_weights = t_weights * (t_weights.shape[0]/max(1, t_weights.sum()))bin_target[bin_target==0] = -1assert model_output_bin.shape == bin_target.shape
76 unmodified lines77787980818283148 unmodified lines2322332342352362372382397 unmodified lines24724824925025125225376 unmodified linesq = q.transpose(1,2)v = v.transpose(1,2)# calculate attention using function we will define next#TODOmask = mask.to('cuda:0')scores = attention(q, k, v, self.d_k, mask, self.dropout)# concatenate heads and put through final linear layerconcat = scores.transpose(1,2).contiguous().view(bs, -1, self.d_model)148 unmodified lines# Different input embeddings (Input, Time, Conditions)#TODO---------------------------------------------------------------x = x.to('cuda:0')timesteps = timesteps.to(x.device)# print(x.device)time_emb = self.time_embed(timestep_embedding(timesteps, self.model_channels))7 unmodified lineselse:cond = th.cat((cond, kwargs[key]), 2)#TODOcond = cond.to('cuda:0')cond_emb = self.condition_emb(cond.float())# PositionalEncoding and DM model76 unmodified lines77787980818283148 unmodified lines2322332342352362372382397 unmodified lines24724824925025125225376 unmodified linesq = q.transpose(1,2)v = v.transpose(1,2)# calculate attention using function we will define next#TODO# mask = mask.to('cuda:0')scores = attention(q, k, v, self.d_k, mask, self.dropout)# concatenate heads and put through final linear layerconcat = scores.transpose(1,2).contiguous().view(bs, -1, self.d_model)148 unmodified lines# Different input embeddings (Input, Time, Conditions)#TODO---------------------------------------------------------------# x = x.to('cuda:0')# timesteps = timesteps.to(x.device)# print(x.device)time_emb = self.time_embed(timestep_embedding(timesteps, self.model_channels))7 unmodified lineselse:cond = th.cat((cond, kwargs[key]), 2)#TODO# cond = cond.to('cuda:0')cond_emb = self.condition_emb(cond.float())# PositionalEncoding and DM model
house_diffusion/gaussian_diffusion.py+2-1
house_diffusion/transformer.py+4-4