Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions frameworks/MLNet/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ def run(dataset: Dataset, config: TaskConfig):
log.info(f'test dataset: {test_dataset_path}')

cmd = (f"{mlnet} {sub_command}"
f" --dataset {train_dataset_path} --test-dataset {test_dataset_path} --train-time {train_time_in_seconds}"
f" --dataset {train_dataset_path} --train-time {train_time_in_seconds}"
f" --label-col {label} --output {os.path.dirname(output_dir)} --name {config.fold}"
f" --verbosity q --log-file-path {log_path}")
f" --verbosity diag --log-file-path {log_path}")

with Timer() as training:
run_cmd(cmd)
try:
run_cmd(cmd, _live_output_='line')
except Exception as e:
log.error(e, exc_info=e)
with open(log_path, 'r') as f:
for line in f:
log.info(line)
raise

train_result_json = os.path.join(output_dir, '{}.mbconfig'.format(config.fold))
if not os.path.exists(train_result_json):
Expand Down
13 changes: 8 additions & 5 deletions frameworks/MLNet/setup.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
HERE=$(dirname "$0")
MLNET='mlnet'
MLNET_PACKAGE='mlnet-linux-x64'
VERSION=${1:-"latest"}

DOTNET_INSTALL_DIR="$HERE/lib"
MLNET="$DOTNET_INSTALL_DIR/mlnet"
DOTNET="$DOTNET_INSTALL_DIR/dotnet"
SOURCE="https://mlnetcli.blob.core.windows.net/mlnetcli/index.json"
SOURCE="https://api.nuget.org/v3/index.json"

export DOTNET_CLI_HOME="$DOTNET_INSTALL_DIR"

Expand All @@ -21,13 +21,16 @@ if [[ ! -x "$MLNET" ]]; then
if [[ ! -x "$DOTNET" ]]; then
wget -P "$DOTNET_INSTALL_DIR" https://dot.net/v1/dotnet-install.sh
chmod +x "$DOTNET_INSTALL_DIR/dotnet-install.sh"
"$DOTNET_INSTALL_DIR/dotnet-install.sh" -c Current --install-dir "$DOTNET_INSTALL_DIR" -Channel 3.1 --verbose
"$DOTNET_INSTALL_DIR/dotnet-install.sh" -c Current --install-dir "$DOTNET_INSTALL_DIR" -Channel 6.0 --verbose
fi
$DOTNET tool install mlnet --add-source "$SOURCE" --version "$VERSION" --tool-path "$DOTNET_INSTALL_DIR"
$DOTNET tool install $MLNET_PACKAGE --add-source "$SOURCE" --version "$VERSION" --tool-path "$DOTNET_INSTALL_DIR"
else
$DOTNET tool update mlnet --add-source "$SOURCE" --version "$VERSION" --tool-path "$DOTNET_INSTALL_DIR"
$DOTNET tool update $MLNET_PACKAGE --add-source "$SOURCE" --version "$VERSION" --tool-path "$DOTNET_INSTALL_DIR"
fi

export DOTNET_ROOT="$DOTNET_INSTALL_DIR"

# enable predict command in mlnet
export MLNetCLIEnablePredict=True

$MLNET --version | grep + | sed -e "s/\(.?*\)+.*/\1/" >> "${HERE}/.setup/installed"