Changed steps in diffusion model

This commit is contained in:
Victor Mylle
2024-01-20 09:44:14 +00:00
parent c6fa17fa40
commit acaad2710a
6 changed files with 106 additions and 25 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@@ -31,7 +31,7 @@
"from datetime import datetime\n",
"import torch.nn as nn\n",
"from src.models.time_embedding_layer import TimeEmbedding\n",
"from src.models.diffusion_model import SimpleDiffusionModel\n",
"from src.models.diffusion_model import SimpleDiffusionModel, GRUDiffusionModel\n",
"from src.trainers.diffusion_trainer import DiffusionTrainer\n",
"from torchinfo import summary\n",
"\n",
@@ -62,30 +62,99 @@
"\n",
"data_config.NOMINAL_NET_POSITION = True\n",
"\n",
"data_processor = DataProcessor(data_config, path=\"../../\")\n",
"data_processor = DataProcessor(data_config, path=\"../../\", lstm=True)\n",
"data_processor.set_batch_size(1024)\n",
"data_processor.set_full_day_skip(True)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ClearML Task: created new task id=b71216825809432682ea3c7841c07612\n",
"ClearML results page: http://192.168.1.182:8080/projects/2e46d4af6f1e4c399cf9f5aa30bc8795/experiments/b71216825809432682ea3c7841c07612/output/log\n"
"torch.Size([1024, 96, 96])\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"500 model found when searching for `file:///workspaces/Thesis/src/notebooks/checkpoint.pt`\n",
"Selected model `Autoregressive Non Linear Quantile Regression + Quarter + DoW + Net` (id=bc0cb0d7fc614e2e8b0edf5b85348646)\n"
"/opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py:536: UserWarning: Using a target size (torch.Size([1024, 96])) that is different to the input size (torch.Size([2, 1024, 96])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.\n",
" return F.mse_loss(input, target, reduction=self.reduction)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"torch.Size([556, 96, 96])\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py:536: UserWarning: Using a target size (torch.Size([556, 96])) that is different to the input size (torch.Size([2, 556, 96])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.\n",
" return F.mse_loss(input, target, reduction=self.reduction)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n",
"torch.Size([1024, 96, 96])\n",
"torch.Size([556, 96, 96])\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"KeyboardInterrupt\n",
"\n"
]
}
],
@@ -95,14 +164,15 @@
"epochs=150\n",
"\n",
"#### Model ####\n",
"model = SimpleDiffusionModel(96, [512, 512, 512], other_inputs_dim=inputDim[1], time_dim=64)\n",
"# model = SimpleDiffusionModel(96, [512, 512, 512], other_inputs_dim=inputDim[1], time_dim=64)\n",
"model = GRUDiffusionModel(96, [256, 256], other_inputs_dim=inputDim[2], time_dim=64, gru_hidden_size=128)\n",
"\n",
"#### ClearML ####\n",
"task = clearml_helper.get_task(task_name=\"Diffusion Model\")\n",
"# task = clearml_helper.get_task(task_name=\"Diffusion Model\")\n",
"\n",
"#### Trainer ####\n",
"trainer = DiffusionTrainer(model, data_processor, \"cuda\")\n",
"trainer.train(epochs, learningRate, task)"
"trainer.train(epochs, learningRate, None)"
]
},
{
@@ -246,7 +316,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.10.8"
}
},
"nbformat": 4,