Skip to content

Commit

Permalink
WIP github runner
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCreator committed Aug 23, 2023
1 parent 963f988 commit 32ee3e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion notebook/github-runner/github-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ echo "# ------"
echo "# Uploading models & notebooks to HF repo"
echo "# ------"

# Get the directory of the notebook file
# Get $NOTEBOOK_FILE, without the ipynb filetype
NOTEBOOK_DIR="$(dirname "$INPUT_FILE_PATH")"
NOTEBOOK_FILE_NOEXT="${NOTEBOOK_FILE%.*}"

python3 ./hf-upload.py "$HF_REPO_SYNC" "$NOTEBOOK_FILE_NOEXT"
python3 ./hf-upload.py "$HF_REPO_SYNC" "$NOTEBOOK_DIR" "$NOTEBOOK_FILE"
9 changes: 5 additions & 4 deletions notebook/github-runner/hf-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import sys
REPO_PATH = sys.argv[1]
REPO_SUBDIR = sys.argv[2]
NOTEBOOK_FILE = sys.argv[3]

# Get the current script dir
import os

RUNNER_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
NOTEBOOK_DIR = os.path.dirname(RUNNER_SCRIPT_DIR)
PROJ_DIR = os.path.dirname(NOTEBOOK_DIR)

MODEL_DIR = os.path.join(PROJ_DIR, "model")
OUTPUT_DIR = os.path.join(PROJ_DIR, "output")

Expand All @@ -25,7 +25,7 @@
repo_type="model",
multi_commits=True,
allow_patterns=["*.pth"],
commit_message=f"[GHA] {REPO_SUBDIR}.ipynb result models"
commit_message=f"[GHA] {NOTEBOOK_FILE} result models"
)

# Upload the ipynb files
Expand All @@ -36,5 +36,6 @@
repo_type="model",
multi_commits=True,
allow_patterns=["*.ipynb"],
commit_message=f"[GHA] {REPO_SUBDIR}.ipynb result notebooks"
)
commit_message=f"[GHA] {NOTEBOOK_FILE} result notebooks"
)

0 comments on commit 32ee3e3

Please sign in to comment.