Anuj-Panthri commited on
Commit
534e265
·
1 Parent(s): f32ba3d

should work

Browse files
kaggle/kernel-metadata.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
  "id": "anujpanthri/train-image-colorization",
3
- "title": "training-image-colorization-model",
4
  "code_file": "train-image-colorization.ipynb",
5
  "language": "python",
6
  "kernel_type": "notebook",
7
  "is_private": "true",
8
- "enable_gpu": "true",
9
  "enable_tpu": "false",
10
  "enable_internet": "true",
11
  "dataset_sources": [],
 
1
  {
2
  "id": "anujpanthri/train-image-colorization",
3
+ "title": "Train Image Colorization",
4
  "code_file": "train-image-colorization.ipynb",
5
  "language": "python",
6
  "kernel_type": "notebook",
7
  "is_private": "true",
8
+ "enable_gpu": "false",
9
  "enable_tpu": "false",
10
  "enable_internet": "true",
11
  "dataset_sources": [],
kaggle/train-image-colorization.ipynb CHANGED
@@ -1 +1 @@
1
- {"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":30698,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!git clone https://github.com/AnujPanthri/Image-Colorization.git\n%cd Image-Colorization","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:57:35.422571Z","iopub.execute_input":"2024-05-07T05:57:35.423893Z","iopub.status.idle":"2024-05-07T05:57:37.744423Z","shell.execute_reply.started":"2024-05-07T05:57:35.423838Z","shell.execute_reply":"2024-05-07T05:57:37.743082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# %cd ..\n# !rm -r Image-Colorization","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:57:38.982736Z","iopub.execute_input":"2024-05-07T05:57:38.983147Z","iopub.status.idle":"2024-05-07T05:57:38.989575Z","shell.execute_reply.started":"2024-05-07T05:57:38.983115Z","shell.execute_reply":"2024-05-07T05:57:38.987925Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install -r requirements.txt --quiet\n!pip install -e .","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:57:39.454444Z","iopub.execute_input":"2024-05-07T05:57:39.454828Z","iopub.status.idle":"2024-05-07T05:58:13.154377Z","shell.execute_reply.started":"2024-05-07T05:57:39.4548Z","shell.execute_reply":"2024-05-07T05:58:13.152964Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from kaggle_secrets import UserSecretsClient\nuser_secrets = UserSecretsClient()\nCOMET_API_KEY = user_secrets.get_secret(\"comet_api_key\")\n\n!export COMET_API_KEY={COMET_API_KEY}","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:58:13.157513Z","iopub.execute_input":"2024-05-07T05:58:13.15798Z","iopub.status.idle":"2024-05-07T05:58:14.401676Z","shell.execute_reply.started":"2024-05-07T05:58:13.157935Z","shell.execute_reply":"2024-05-07T05:58:14.400055Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\n\nos.environ[\"COMET_API_KEY\"]=COMET_API_KEY\nconfig_file = \"configs/experiment1.yaml\"","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:58:14.412023Z","iopub.execute_input":"2024-05-07T05:58:14.412388Z","iopub.status.idle":"2024-05-07T05:58:14.422002Z","shell.execute_reply.started":"2024-05-07T05:58:14.41236Z","shell.execute_reply":"2024-05-07T05:58:14.420946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python3 src/scripts/prepare_dataset.py {config_file}","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:58:14.423359Z","iopub.execute_input":"2024-05-07T05:58:14.423858Z","iopub.status.idle":"2024-05-07T05:58:20.695681Z","shell.execute_reply.started":"2024-05-07T05:58:14.423828Z","shell.execute_reply":"2024-05-07T05:58:20.694312Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !cat src/utils/data_utils.py","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:58:20.697592Z","iopub.execute_input":"2024-05-07T05:58:20.697948Z","iopub.status.idle":"2024-05-07T05:58:20.703728Z","shell.execute_reply.started":"2024-05-07T05:58:20.697915Z","shell.execute_reply":"2024-05-07T05:58:20.702527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !python3 src/scripts/visualize_dataset.py {config_file}","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:58:24.072343Z","iopub.execute_input":"2024-05-07T05:58:24.072758Z","iopub.status.idle":"2024-05-07T05:58:27.518713Z","shell.execute_reply.started":"2024-05-07T05:58:24.072725Z","shell.execute_reply":"2024-05-07T05:58:27.517194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python3 src/scripts/train.py {config_file}","metadata":{"execution":{"iopub.status.busy":"2024-05-07T05:58:41.523307Z","iopub.execute_input":"2024-05-07T05:58:41.523718Z","iopub.status.idle":"2024-05-07T06:03:03.088039Z","shell.execute_reply.started":"2024-05-07T05:58:41.523683Z","shell.execute_reply":"2024-05-07T06:03:03.086519Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !python3 src/scripts/visualize_results.py {config_file}","metadata":{"execution":{"iopub.status.busy":"2024-05-07T06:03:34.594725Z","iopub.execute_input":"2024-05-07T06:03:34.595185Z","iopub.status.idle":"2024-05-07T06:03:46.842693Z","shell.execute_reply.started":"2024-05-07T06:03:34.595147Z","shell.execute_reply":"2024-05-07T06:03:46.841521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}
 
1
+ {"cells":[{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:57:35.423893Z","iopub.status.busy":"2024-05-07T05:57:35.422571Z","iopub.status.idle":"2024-05-07T05:57:37.744423Z","shell.execute_reply":"2024-05-07T05:57:37.743082Z","shell.execute_reply.started":"2024-05-07T05:57:35.423838Z"},"trusted":true},"outputs":[],"source":["!git clone https://github.com/AnujPanthri/Image-Colorization.git\n","%cd Image-Colorization"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:57:38.983147Z","iopub.status.busy":"2024-05-07T05:57:38.982736Z","iopub.status.idle":"2024-05-07T05:57:38.989575Z","shell.execute_reply":"2024-05-07T05:57:38.987925Z","shell.execute_reply.started":"2024-05-07T05:57:38.983115Z"},"trusted":true},"outputs":[],"source":["# %cd ..\n","# !rm -r Image-Colorization"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:57:39.454828Z","iopub.status.busy":"2024-05-07T05:57:39.454444Z","iopub.status.idle":"2024-05-07T05:58:13.154377Z","shell.execute_reply":"2024-05-07T05:58:13.152964Z","shell.execute_reply.started":"2024-05-07T05:57:39.4548Z"},"trusted":true},"outputs":[],"source":["!pip install -r requirements.txt --quiet\n","!pip install -e ."]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:58:13.15798Z","iopub.status.busy":"2024-05-07T05:58:13.157513Z","iopub.status.idle":"2024-05-07T05:58:14.401676Z","shell.execute_reply":"2024-05-07T05:58:14.400055Z","shell.execute_reply.started":"2024-05-07T05:58:13.157935Z"},"trusted":true},"outputs":[],"source":["from kaggle_secrets import UserSecretsClient\n","user_secrets = UserSecretsClient()\n","COMET_API_KEY = user_secrets.get_secret(\"comet_api_key\")\n","\n","# !export COMET_API_KEY={COMET_API_KEY}"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:58:14.412388Z","iopub.status.busy":"2024-05-07T05:58:14.412023Z","iopub.status.idle":"2024-05-07T05:58:14.422002Z","shell.execute_reply":"2024-05-07T05:58:14.420946Z","shell.execute_reply.started":"2024-05-07T05:58:14.41236Z"},"trusted":true},"outputs":[],"source":["import os\n","\n","os.environ[\"COMET_API_KEY\"]=COMET_API_KEY\n","config_file = \"configs/experiment1.yaml\""]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:58:14.423858Z","iopub.status.busy":"2024-05-07T05:58:14.423359Z","iopub.status.idle":"2024-05-07T05:58:20.695681Z","shell.execute_reply":"2024-05-07T05:58:20.694312Z","shell.execute_reply.started":"2024-05-07T05:58:14.423828Z"},"trusted":true},"outputs":[],"source":["!python3 src/scripts/prepare_dataset.py {config_file}"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:58:20.697948Z","iopub.status.busy":"2024-05-07T05:58:20.697592Z","iopub.status.idle":"2024-05-07T05:58:20.703728Z","shell.execute_reply":"2024-05-07T05:58:20.702527Z","shell.execute_reply.started":"2024-05-07T05:58:20.697915Z"},"trusted":true},"outputs":[],"source":["# !cat src/utils/data_utils.py"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:58:24.072758Z","iopub.status.busy":"2024-05-07T05:58:24.072343Z","iopub.status.idle":"2024-05-07T05:58:27.518713Z","shell.execute_reply":"2024-05-07T05:58:27.517194Z","shell.execute_reply.started":"2024-05-07T05:58:24.072725Z"},"trusted":true},"outputs":[],"source":["# !python3 src/scripts/visualize_dataset.py {config_file}"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T05:58:41.523718Z","iopub.status.busy":"2024-05-07T05:58:41.523307Z","iopub.status.idle":"2024-05-07T06:03:03.088039Z","shell.execute_reply":"2024-05-07T06:03:03.086519Z","shell.execute_reply.started":"2024-05-07T05:58:41.523683Z"},"trusted":true},"outputs":[],"source":["!python3 src/scripts/train.py {config_file}"]},{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-05-07T06:03:34.595185Z","iopub.status.busy":"2024-05-07T06:03:34.594725Z","iopub.status.idle":"2024-05-07T06:03:46.842693Z","shell.execute_reply":"2024-05-07T06:03:46.841521Z","shell.execute_reply.started":"2024-05-07T06:03:34.595147Z"},"trusted":true},"outputs":[],"source":["# !python3 src/scripts/visualize_results.py {config_file}"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":[]}],"metadata":{"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":30698,"isGpuEnabled":false,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.12.1"}},"nbformat":4,"nbformat_minor":4}
src/scripts/train.py CHANGED
@@ -1,4 +1,4 @@
1
- import os
2
  import argparse
3
  from comet_ml import Experiment
4
  from src.utils.config_loader import Config
@@ -28,6 +28,8 @@ def train(args):
28
  os.makedirs(model_dir,exist_ok=True)
29
  model_save_path = os.path.join(model_dir,"model.weights.h5")
30
 
 
 
31
 
32
  experiment = Experiment(
33
  api_key=os.environ["COMET_API_KEY"],
 
1
+ import os,shutil
2
  import argparse
3
  from comet_ml import Experiment
4
  from src.utils.config_loader import Config
 
28
  os.makedirs(model_dir,exist_ok=True)
29
  model_save_path = os.path.join(model_dir,"model.weights.h5")
30
 
31
+ # save config to exported model folder
32
+ shutil.copy(config_file_path,model_dir)
33
 
34
  experiment = Experiment(
35
  api_key=os.environ["COMET_API_KEY"],