Skip to content

Commit

Permalink
🎨 Format Python code with psf/black
Browse files Browse the repository at this point in the history
  • Loading branch information
codingwithsurya authored and github-actions committed Oct 13, 2023
1 parent 5cbbaf0 commit 5fadf7f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions training/training/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(
self.train_transform = train_transform or transforms.Compose(
[transforms.ToTensor()]
)

self.test_transform = test_transform or transforms.Compose(
[transforms.ToTensor()]
)
Expand All @@ -139,10 +139,10 @@ def __init__(

# Ensure the directory exists
os.makedirs(self.dataset_dir, exist_ok=True)
print(f'train transform: {train_transform}')
print(f'test transform: {test_transform}')
print(f"train transform: {train_transform}")
print(f"test transform: {test_transform}")
# Load the datasets

self.train_set = datasets.__dict__[dataset_name](
root=self.dataset_dir,
train=True,
Expand Down Expand Up @@ -182,7 +182,7 @@ def createTrainDataset(self) -> DataLoader:
shuffle=self.shuffle,
drop_last=True,
)
self.delete_datasets_from_directory() # Delete datasets after loading
self.delete_datasets_from_directory() # Delete datasets after loading
return train_loader

def createTestDataset(self) -> DataLoader:
Expand All @@ -192,7 +192,7 @@ def createTestDataset(self) -> DataLoader:
shuffle=self.shuffle,
drop_last=True,
)
self.delete_datasets_from_directory() # Delete datasets after loading
self.delete_datasets_from_directory() # Delete datasets after loading
return test_loader

def getCategoryList(self) -> list[str]:
Expand Down
2 changes: 1 addition & 1 deletion training/training/core/dl_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DLModel(nn.Module):
"SIGMOID": nn.Sigmoid,
"LOGSOFTMAX": nn.LogSoftmax,
"CONV2D": nn.Conv2d,
"DROPOUT": nn.Dropout
"DROPOUT": nn.Dropout,
}

def __init__(self, layer_list: list[nn.Module]):
Expand Down
6 changes: 2 additions & 4 deletions training/training/routes/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
@router.post("", auth=FirebaseAuth())
def imageTrain(request: HttpRequest, imageParams: ImageParams):
if imageParams.default:
dataCreator = ImageDefaultDatasetCreator.fromDefault(
imageParams.default
)
dataCreator = ImageDefaultDatasetCreator.fromDefault(imageParams.default)
print(vars(dataCreator))
train_loader = dataCreator.createTrainDataset()
test_loader = dataCreator.createTestDataset()
Expand All @@ -37,7 +35,7 @@ def imageTrain(request: HttpRequest, imageParams: ImageParams):
# )

model = DLModel.fromLayerParamsList(imageParams.user_arch)
print(f'model is: {model}')
print(f"model is: {model}")
optimizer = getOptimizer(model, imageParams.optimizer_name, 0.05)
criterionHandler = getCriterionHandler(imageParams.criterion)
if imageParams.problem_type == "CLASSIFICATION":
Expand Down
1 change: 1 addition & 0 deletions training/training/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from training.routes.datasets.default.columns import router as default_dataset_router
from training.routes.tabular.tabular import router as tabular_router
from training.routes.image.image import router as image_router

# from training.routes.datasets.default import get_default_datasets_router
# from training.routes.tabular import get_tabular_router
# from training.routes.image import image_router
Expand Down

0 comments on commit 5fadf7f

Please sign in to comment.