Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align with main #74

Merged
merged 4 commits into from
Dec 6, 2023
Merged
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
4 changes: 3 additions & 1 deletion micromind/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def train(
epochs: int = 1,
datasets: Dict = {},
metrics: List[Metric] = [],
checkpointer: Optional[Checkpointer] = None, # fix type hints
checkpointer: Optional[Checkpointer] = None,
debug: Optional[bool] = False,
) -> None:
"""
Expand Down Expand Up @@ -500,6 +500,7 @@ def train(
f"Starting from epoch {self.start_epoch + 1}."
+ f" Training is scheduled for {epochs} epochs."
)

for e in range(self.start_epoch + 1, epochs + 1):
self.current_epoch = e
pbar = tqdm(
Expand All @@ -521,6 +522,7 @@ def train(
with self.accelerator.autocast():
model_out = self(batch)
loss = self.compute_loss(model_out, batch)
loss_epoch += loss.item()

self.accelerator.backward(loss)
self.opt.step()
Expand Down
1 change: 1 addition & 0 deletions micromind/utils/checkpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def __init__(
if hparams is not None and os.path.exists(self.root_dir):
with open(os.path.join(self.root_dir, "args.yaml"), "w") as args_f:
args_f.write(yaml.dump(vars(hparams)))

else:
warnings.warn(
"You did not specify the configuration to the checkpointer, \
Expand Down
1 change: 1 addition & 0 deletions recipes/image_classification/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Image classification


**Disclaimer**: we will shortly release HuggingFace checkpoints for ImageNet, CIFAR-100, and CIFAR-10 for both PhiNet and XiNet.

This image classification recipe uses the PyTorch image models library (`timm`) to augment the data. It supports most data augmentation strategies, and datasets of the original implementation. However, it is implemented using `micromind` and thus, it exploits all the exportability and functionalities of the library.
Expand Down
2 changes: 1 addition & 1 deletion recipes/object_detection/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Object Detection using YOLO

**[1 Dec 2023] Fix DDP handling and computational graph**
**[1 Dec 2023]** Fix DDP handling and computational graph

**Disclaimer**: we will shortly release HuggingFace checkpoints for COCO and VOC for both PhiNet and XiNet.

Expand Down
1 change: 1 addition & 0 deletions recipes/object_detection/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def mAP(self, pred, batch):
batch["ori_shape"][i],
)
)

batch_bboxes = torch.stack(batch_bboxes).to(self.device)
mmAP = mean_average_precision(post_predictions, batch, batch_bboxes)

Expand Down
Loading