Skip to content

Commit

Permalink
Merge branch 'main' into fsd50K_speech_model_finetuning
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Jul 23, 2024
2 parents 9794cfc + 49d57e9 commit 1577e9e
Show file tree
Hide file tree
Showing 122 changed files with 1,370 additions and 1,950 deletions.
11 changes: 0 additions & 11 deletions .actions/README.md

This file was deleted.

338 changes: 228 additions & 110 deletions .actions/assistant.py

Large diffs are not rendered by default.

15 changes: 5 additions & 10 deletions .actions/git-diff-sync.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/bin/bash

set -e
set -ex
printf "Detect changes for: $1 >> $2\n\n"

b1="${1//'/'/'_'}"
printf "Branch alias: $b1\n"
# list all dirs in source branch
python .actions/assistant.py list_dirs > "dirs-$b1.txt"
cat "dirs-$b1.txt"
printf "Branch alias: $b1\n" && cat "dirs-$b1.txt"

head=$(git rev-parse origin/$2)
git diff --name-only $head --output=target-diff.txt
Expand All @@ -19,19 +18,15 @@ cp -r .actions/ _TEMP/.actions/

git checkout $2
b2="${2//'/'/'_'}"
printf "Branch alias: $b2\n"
# recover the original CLI
#rm -rf .actions && mv _TEMP/.actions .actions
# list all dirs in target branch
python _TEMP/.actions/assistant.py list_dirs ".notebooks" --include_file_ext=".ipynb" > "dirs-$b2.txt"
cat "dirs-$b2.txt"
printf "Branch alias: $b2\n" && cat "dirs-$b2.txt"

printf "\n\n"
git merge --ff -s resolve origin/$1

python _TEMP/.actions/assistant.py group-folders target-diff.txt --fpath_actual_dirs "['dirs-$b1.txt', 'dirs-$b2.txt']"
printf "\n\nChanged folders:\n"
cat changed-folders.txt
printf "\n\nDropped folders:\n"
cat dropped-folders.txt
printf "\n"
printf "\n================\nChanged folders:\n----------------\n" && cat changed-folders.txt
printf "\n================\nDropped folders:\n----------------\n" && cat dropped-folders.txt
2 changes: 1 addition & 1 deletion .actions/requires.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Fire
tqdm
PyYAML
PyYAML <5.4 # todo: racing issue with cython compile
wcmatch
requests
pip
32 changes: 20 additions & 12 deletions .actions/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,33 @@
_PATH_ROOT = os.path.dirname(os.path.dirname(__file__))
_PATH_TEMPLATES = os.path.join(_PATH_ROOT, "templates")
_PATH_DIR_SIMPLE = os.path.join(_PATH_TEMPLATES, "simple")
_PATH_DIR_TITANIC = os.path.join(_PATH_TEMPLATES, "titanic")
# _PATH_DIR_TITANIC = os.path.join(_PATH_TEMPLATES, "titanic")


def _path_in_dir(fname: str, folder: str = _PATH_ROOT) -> str:
return os.path.join(folder, fname)


@pytest.mark.parametrize(
"cmd,args",
"cmd,kwargs",
[
("list_dirs", []),
("list_dirs", [".", ".ipynb"]),
("bash_render", [_PATH_DIR_SIMPLE]),
("bash_test", [_PATH_DIR_SIMPLE]),
("group_folders", [_path_in_dir("master-diff.txt"), _path_in_dir("dirs-b1.txt"), _path_in_dir("dirs-b2.txt")]),
("convert_ipynb", [_PATH_DIR_SIMPLE]),
("copy_notebooks", [_PATH_ROOT]),
("update_env_details", [_PATH_DIR_SIMPLE]),
("list_dirs", {}),
("list_dirs", dict(folder=".", include_file_ext=".ipynb")),
("bash_render", dict(folder=_PATH_DIR_SIMPLE)),
("bash_validate", dict(folder=_PATH_DIR_SIMPLE)),
(
"group_folders",
dict(
fpath_gitdiff=_path_in_dir("master-diff.txt"),
fpath_change_folders=_path_in_dir("dirs-b1.txt"),
fpath_drop_folders=_path_in_dir("dirs-b2.txt"),
root_path=_PATH_ROOT,
),
),
("convert_ipynb", dict(folder=_PATH_DIR_SIMPLE)),
("copy_notebooks", dict(path_root=_PATH_ROOT)),
("update_env_details", dict(folder=_PATH_DIR_SIMPLE)),
],
)
def test_assistant_commands(cmd: str, args: list):
AssistantCLI().__getattribute__(cmd)(*args)
def test_assistant_commands(cmd: str, kwargs: dict):
AssistantCLI().__getattribute__(cmd)(**kwargs)
Loading

0 comments on commit 1577e9e

Please sign in to comment.