토니의 연습장

Model workflow 본문

AI 일반/모델, 아키텍처, 구현

Model workflow

bellmake 2025. 1. 14. 16:25

 


1. Data (preparing and loading)

 

 

2. Build model


3. Train model

 

PyTorch training loop

 

PyTorch testing loop

 

4. Inference

# 1. Set the model in evaluation mode
model_0.eval()

# 2. Setup the inference mode context manager
with torch.inference_mode():
  # 3. Make sure the calculations are done with the model and data on the same device
  # in our case, we haven't setup device-agnostic code yet so our data and model are
  # on the CPU by default.
  # model_0.to(device)
  # X_test = X_test.to(device)
  y_preds = model_0(X_test)
y_preds

 

5. Saving and loading a PyTorch model

 

'AI 일반 > 모델, 아키텍처, 구현' 카테고리의 다른 글

LayerNorm 과 BatchNorm  (1) 2025.05.28
causal mask  (1) 2025.05.28
loss 값 저장 및 출력  (5) 2025.01.14
출력 정밀도 변환 클래스 정의 (CastOutputToFloat)  (5) 2024.11.14
Conv2d / ConvTranspose2d  (0) 2024.09.19