0

I want to override the args of a model in the "comp1" folder by passing the parameters to the main file in the "component" folder and hence need some mechanism to pass the override args.

I've run it before in wsl2 and it worked.I want it to work in windows cmd and hence need some workaround or an alternate of echo to be able to pass the override parameters to the main file.

Adding project folder structure for reference: Folder Component1 Folder comp1

Adding the MLproject file(Used for wsl2) for reference:

name: KNN
conda_env: conda.yml

entry_points:
  main:
    parameters:
      hydra_options:
        description: Hydra parameters to override
          type: str
          default: ''
    command: >-
      python main.py $(echo {hydra_options})

I've tried the set command in windows to assign a variable to the override params(passed through cmd) and then use it to concatenate with the python main.py file to incorporate the hydra override parameters but it doesn't seem to work as well.

Adding for reference:

name: KNN_main
conda_env: conda.yml

entry_points:
  main:
    parameters:
      hydra_options:
        description: Hydra values to override
        type: str
        default: " "
    command: >-
      @echo off
      set command = "python main.py" and %{hydra_options}%
      echo %command%

Tech stack: MLflow==1.29.0 Hydra==1.2.0

OS: Windows 10

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

According to this answer, you shouldn't place space before and after = in the set command.

It would work if you rewrote the MLproject into this:

name: KNN_main
conda_env: conda.yml

entry_points:
  main:
    parameters:
      hydra_options:
        description: Hydra values to override
        type: str
        default: " "
    command: >-
      @echo off
      set command="python main.py %{hydra_options}%"
      echo %command%

Also, I'm not sure but I think you don't need echo and this command will work.

    command: >-
      python main.py %{hydra_options}%
Matin Zivdar
  • 593
  • 5
  • 20