Spaces:
Runtime error
Runtime error
Merge pull request #8 from AnujPanthri/train
Browse files- .github/workflows/checking_kaggle_status.sh +10 -5
- .github/workflows/kaggle.yaml +27 -3
- README.md +12 -1
- kaggle/train-image-colorization.ipynb +1 -1
.github/workflows/checking_kaggle_status.sh
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
|
5 |
check_status(){
|
6 |
COMMAND="kaggle k status $1"
|
|
|
7 |
while true
|
8 |
do
|
9 |
-
|
10 |
-
sleep 2s
|
11 |
KERNEL_STATUS=$($COMMAND)
|
12 |
echo "OUTPUT: $KERNEL_STATUS"
|
13 |
# okay now try to exit or raise error
|
@@ -15,14 +15,19 @@ check_status(){
|
|
15 |
# error
|
16 |
echo "ERROR"
|
17 |
exit 1
|
18 |
-
|
|
|
|
|
|
|
19 |
elif [[ $KERNEL_STATUS == *"has status \"complete\""* ]]; then
|
20 |
# success
|
21 |
echo "Notebook finished running !"
|
22 |
exit 0
|
23 |
-
|
24 |
else
|
25 |
-
|
|
|
|
|
26 |
fi
|
27 |
done
|
28 |
|
|
|
4 |
|
5 |
check_status(){
|
6 |
COMMAND="kaggle k status $1"
|
7 |
+
echo "EXECUTING: $COMMAND"
|
8 |
while true
|
9 |
do
|
10 |
+
sleep 30s
|
|
|
11 |
KERNEL_STATUS=$($COMMAND)
|
12 |
echo "OUTPUT: $KERNEL_STATUS"
|
13 |
# okay now try to exit or raise error
|
|
|
15 |
# error
|
16 |
echo "ERROR"
|
17 |
exit 1
|
18 |
+
|
19 |
+
elif [[ $KERNEL_STATUS == *"has status \"running\""* ]]; then
|
20 |
+
echo "Notebook still running on kaggle..."
|
21 |
+
|
22 |
elif [[ $KERNEL_STATUS == *"has status \"complete\""* ]]; then
|
23 |
# success
|
24 |
echo "Notebook finished running !"
|
25 |
exit 0
|
26 |
+
|
27 |
else
|
28 |
+
# error
|
29 |
+
echo "ERROR"
|
30 |
+
exit 1
|
31 |
fi
|
32 |
done
|
33 |
|
.github/workflows/kaggle.yaml
CHANGED
@@ -4,19 +4,43 @@ on:
|
|
4 |
push:
|
5 |
branches:
|
6 |
- train
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
jobs:
|
9 |
deploy:
|
10 |
runs-on: ubuntu-latest
|
11 |
steps:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
- name: Push Kaggle kernel
|
13 |
run: kaggle kernels push -p kaggle/
|
14 |
|
15 |
- name: Checking Kaggle Status
|
16 |
run: |
|
17 |
-
bash .github/workflows/checking_kaggle_status.sh $KAGGLE_KERNEL_ID
|
18 |
|
19 |
- name: Download outputs
|
20 |
run: |
|
21 |
-
kaggle k output $KAGGLE_KERNEL_ID -p outputs/
|
22 |
ls outputs/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
push:
|
5 |
branches:
|
6 |
- train
|
7 |
+
paths-ignore:
|
8 |
+
- .gitignore
|
9 |
+
- README.md
|
10 |
+
- LICENSE
|
11 |
+
- outputs/
|
12 |
jobs:
|
13 |
deploy:
|
14 |
runs-on: ubuntu-latest
|
15 |
steps:
|
16 |
+
- uses: actions/checkout@v3
|
17 |
+
with:
|
18 |
+
fetch-depth: 0
|
19 |
+
lfs: true
|
20 |
+
|
21 |
+
- name: Setup Kaggle
|
22 |
+
run: |
|
23 |
+
pip install kaggle
|
24 |
+
mkdir ~/.kaggle
|
25 |
+
echo "{\"username\":\"${{secrets.KAGGLE_USERNAME}}\",\"key\":\"${{secrets.KAGGLE_KEY}}\"}" > ~/.kaggle/kaggle.json
|
26 |
+
chmod 600 /home/runner/.kaggle/kaggle.json
|
27 |
+
|
28 |
- name: Push Kaggle kernel
|
29 |
run: kaggle kernels push -p kaggle/
|
30 |
|
31 |
- name: Checking Kaggle Status
|
32 |
run: |
|
33 |
+
bash .github/workflows/checking_kaggle_status.sh ${{ secrets.KAGGLE_KERNEL_ID }}
|
34 |
|
35 |
- name: Download outputs
|
36 |
run: |
|
37 |
+
kaggle k output ${{ secrets.KAGGLE_KERNEL_ID }} -p outputs/ --quiet
|
38 |
ls outputs/
|
39 |
+
|
40 |
+
- name: add ouputs to repo
|
41 |
+
run: |
|
42 |
+
git config user.name "github-actions[bot]"
|
43 |
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
44 |
+
git add .
|
45 |
+
git commit --amend --no-edit
|
46 |
+
git push origin train --force
|
README.md
CHANGED
@@ -79,7 +79,18 @@ Kaggle API docs:- https://github.com/Kaggle/kaggle-api/blob/main/docs/README.md
|
|
79 |
## Kaggle Commands:-
|
80 |
- kaggle kernels pull anujpanthri/training-image-colorization-model -p kaggle/
|
81 |
- kaggle kernels push -p kaggle/
|
82 |
-
- echo "{\"username\":\"$
|
83 |
### Version 1:
|
84 |
|
85 |
- im gonna skip logging for now and rather use print statements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
## Kaggle Commands:-
|
80 |
- kaggle kernels pull anujpanthri/training-image-colorization-model -p kaggle/
|
81 |
- kaggle kernels push -p kaggle/
|
82 |
+
- echo "{\"username\":\"$KAGGLE_USERNAME\",\"key\":\"$KAGGLE_KEY\"}" > kaggle.json
|
83 |
### Version 1:
|
84 |
|
85 |
- im gonna skip logging for now and rather use print statements
|
86 |
+
|
87 |
+
|
88 |
+
## Dataset
|
89 |
+
|
90 |
+

|
91 |
+

|
92 |
+
|
93 |
+
## Result
|
94 |
+
|
95 |
+

|
96 |
+

|
kaggle/train-image-colorization.ipynb
CHANGED
@@ -1 +1 @@
|
|
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":["
|
|
|
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":["%cd ..\n","\n","! cp -r Image-Colorization/artifacts .\n","! rm -r artifacts/model/\n","! rm -r Image-Colorization\n","! ls"]}],"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}
|