Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/boltz/model/models/boltz1.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def training_step(self, batch: dict[str, Tensor], batch_idx: int) -> Tensor:
)
else:
confidence_loss_dict = {
"loss": torch.tensor(0.0).to(batch["token_index"].device),
"loss": torch.tensor(0.0, device=batch["token_index"].device),
"loss_breakdown": {},
}

Expand Down
6 changes: 4 additions & 2 deletions src/boltz/model/modules/confidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,10 @@ def forward(
pred_distogram_prob = nn.functional.softmax(
pred_distogram_logits, dim=-1
).repeat_interleave(multiplicity, 0)
contacts = torch.zeros((1, 1, 1, 64), dtype=pred_distogram_prob.dtype).to(
pred_distogram_prob.device
contacts = torch.zeros(
(1, 1, 1, 64),
dtype=pred_distogram_prob.dtype,
device=pred_distogram_prob.device,
)
contacts[:, :, :, :20] = 1.0
prob_contact = (pred_distogram_prob * contacts).sum(-1)
Expand Down
6 changes: 4 additions & 2 deletions src/boltz/model/modules/confidencev2.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,10 @@ def forward(
pred_distogram_prob = nn.functional.softmax(
pred_distogram_logits, dim=-1
).repeat_interleave(multiplicity, 0)
contacts = torch.zeros((1, 1, 1, 64), dtype=pred_distogram_prob.dtype).to(
pred_distogram_prob.device
contacts = torch.zeros(
(1, 1, 1, 64),
dtype=pred_distogram_prob.dtype,
device=pred_distogram_prob.device,
)
contacts[:, :, :, :20] = 1.0
prob_contact = (pred_distogram_prob * contacts).sum(-1)
Expand Down
8 changes: 6 additions & 2 deletions src/boltz/model/modules/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,13 @@ def sample(

with torch.no_grad():
atom_coords_denoised = torch.zeros_like(atom_coords_noisy)
token_a = torch.zeros(token_repr_shape).to(atom_coords_noisy)
token_a = torch.zeros(
token_repr_shape,
device=atom_coords_noisy.device,
dtype=atom_coords_noisy.dtype,
)

sample_ids = torch.arange(multiplicity).to(atom_coords_noisy.device)
sample_ids = torch.arange(multiplicity, device=atom_coords_noisy.device)
sample_ids_chunks = sample_ids.chunk(
multiplicity % max_parallel_samples + 1
)
Expand Down
2 changes: 1 addition & 1 deletion src/boltz/model/modules/diffusionv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def sample(

with torch.no_grad():
atom_coords_denoised = torch.zeros_like(atom_coords_noisy)
sample_ids = torch.arange(multiplicity).to(atom_coords_noisy.device)
sample_ids = torch.arange(multiplicity, device=atom_coords_noisy.device)
sample_ids_chunks = sample_ids.chunk(
multiplicity % max_parallel_samples + 1
)
Expand Down
2 changes: 1 addition & 1 deletion src/boltz/model/modules/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def forward(
# only here the multiplicity kicks in because we use the different positions r
q = q.repeat_interleave(multiplicity, 0)
r_input = torch.cat(
[r, torch.zeros((B * multiplicity, N, 7)).to(r)],
[r, torch.zeros((B * multiplicity, N, 7), device=r.device, dtype=r.dtype)],
dim=-1,
)
r_to_q = self.r_to_q_trans(r_input)
Expand Down