Skip to content

Commit

Permalink
Run black
Browse files Browse the repository at this point in the history
  • Loading branch information
melihyilmaz committed Nov 1, 2023
1 parent 9ffbc97 commit 9b4d06c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions casanovo/casanovo.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ def setup_model(
try:
model = _get_model_weights()
except github.RateLimitExceededException:

logger.error(
"GitHub API rate limit exceeded while trying to download the "
"model weights. Please download compatible model weights "
Expand Down
6 changes: 4 additions & 2 deletions casanovo/denovo/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def __init__(
max_charge=max_charge,
)
self.softmax = torch.nn.Softmax(2)
self.celoss = torch.nn.CrossEntropyLoss(ignore_index=0, label_smoothing=train_label_smoothing)
self.celoss = torch.nn.CrossEntropyLoss(
ignore_index=0, label_smoothing=train_label_smoothing
)
self.val_celoss = torch.nn.CrossEntropyLoss(ignore_index=0)
# Optimizer settings.
self.warmup_iters = warmup_iters
Expand Down Expand Up @@ -727,7 +729,7 @@ def training_step(
"""
pred, truth = self._forward_step(*batch)
pred = pred[:, :-1, :].reshape(-1, self.decoder.vocab_size + 1)
if mode=="train":
if mode == "train":
loss = self.celoss(pred, truth.flatten())
else:
loss = self.val_celoss(pred, truth.flatten())
Expand Down
1 change: 1 addition & 0 deletions casanovo/denovo/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(
self.trainer = None
self.model = None
self.loaders = None

self.writer = None

# Configure checkpoints.
Expand Down

0 comments on commit 9b4d06c

Please sign in to comment.