Skip to content

Commit

Permalink
successful running mnist on cometml
Browse files Browse the repository at this point in the history
  • Loading branch information
YuyangXueEd committed Nov 9, 2023
1 parent fad5dbe commit c675ad5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code-quality-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3

- name: Run pre-commits
uses: pre-commit/action@v2.0.3
uses: pre-commit/action@v3.0.0
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ configs/local/default.yaml

# Aim logging
.aim

.env.example
8 changes: 4 additions & 4 deletions configs/train.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ defaults:
- data: mnist
- model: mnist
- callbacks: default
- logger: null # set logger here or use command line (e.g. `python train.py logger=tensorboard`)
- trainer: default
- logger: comet # set logger here or use command line (e.g. `python train.py logger=tensorboard`)
- trainer: gpu
- paths: default
- extras: default
- hydra: default
Expand All @@ -18,7 +18,7 @@ defaults:
- experiment: null

# config for hyperparameter optimization
- hparams_search: null
- hparams_search: mnist_optuna

# optional local config for machine/user specific settings
# it's optional since it doesn't need to exist and is excluded from version control
Expand Down Expand Up @@ -46,4 +46,4 @@ test: True
ckpt_path: null

# seed for random number generators in pytorch, numpy and python.random
seed: null
seed: 42
5 changes: 4 additions & 1 deletion src/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any, Dict, List, Optional, Tuple

import hydra
import comet_ml
import lightning as L
import rootutils
import torch
Expand Down Expand Up @@ -41,7 +42,8 @@

@task_wrapper
def train(cfg: DictConfig) -> Tuple[Dict[str, Any], Dict[str, Any]]:
"""Trains the model. Can additionally evaluate on a testset, using best weights obtained during
"""
Trains the model. Can additionally evaluate on a testset, using best weights obtained during
training.
This method is wrapped in optional @task_wrapper decorator, that controls the behavior during
Expand Down Expand Up @@ -114,6 +116,7 @@ def main(cfg: DictConfig) -> Optional[float]:
"""
# apply extra utilities
# (e.g. ask for tags if none are provided in cfg, print cfg tree, etc.)

extras(cfg)

# train the model
Expand Down

0 comments on commit c675ad5

Please sign in to comment.