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

모델 저장 폴더 'ckpt' 자동 생성 코드 추가 (Update main_classificaiton.py) #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion main_regression.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import torch
import pandas as pd
import numpy as np
import os
from sklearn.metrics import mean_squared_error, mean_absolute_error

from models.train_model import Train_Test
Expand Down Expand Up @@ -139,6 +140,9 @@ def save_model(self, best_model, best_model_path):
:param best_model_path: path for saving model
:type best_model_path: str
"""

# make folder to save model
os.makedirs('./ckpt', exist_ok=True)

# save model
torch.save(best_model.state_dict(), best_model_path)
Expand Down Expand Up @@ -224,4 +228,4 @@ def get_dataloader(self, x_data, y_data, batch_size, shuffle):

# DataLoader 구축
data_loader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=shuffle)
return data_loader
return data_loader