0

I have a python program which I run in Linux with a lot of parameters. In Unix I use \ to separate each line.

How can I format those same paths in Windows?

Here is the command I am using in Linux:

python -m bin.train \
  --config_paths="
      ./example_configs/nmt_small.yml,
      ./example_configs/train_seq2seq.yml,
      ./example_configs/text_metrics_bpe.yml" \
  --model_params "
      vocab_source: $VOCAB_SOURCE
      vocab_target: $VOCAB_TARGET" \
  --input_pipeline_train "
    class: ParallelTextInputPipeline
    params:
      source_files:
        - $TRAIN_SOURCES
      target_files:
        - $TRAIN_TARGETS" \

I want to do this in Windows. How can I do that in a single line (or) can I simply keep this as is and run it?

Enthus3d
  • 1,727
  • 12
  • 26
ML learner
  • 67
  • 10

2 Answers2

1

Open your notepad, write it all on a single line, save it with a .bat extension. You can save it anywhere and run it when you need to.

My naive attempt at making it all in one line is here:

python -m bin.train --config_paths="./example_configs/nmt_small.yml,./example_configs/train_seq2seq.yml,./example_configs/text_metrics_bpe.yml" --model_params "vocab_source: $VOCAB_SOURCE vocab_target: $VOCAB_TARGET" --input_pipeline_train "class: ParallelTextInputPipeline params: source_files: - $TRAIN_SOURCES target_files: - $TRAIN_TARGETS"

If that's somehow messed up you can probably fix it, I have no context to do any better

Ofer Sadan
  • 11,391
  • 5
  • 38
  • 62
1

As referenced here, in Windows command line you can separate one long line into many lines with the '^' caret operator:

eg.

python -m bin.train ^
  --config_paths="
      ./example_configs/nmt_small.yml,
      ./example_configs/train_seq2seq.yml,
      ./example_configs/text_metrics_bpe.yml" ^
  --model_params "
      vocab_source: $VOCAB_SOURCE
      vocab_target: $VOCAB_TARGET" ^
  --input_pipeline_train "
    class: ParallelTextInputPipeline
    params:
      source_files:
        - $TRAIN_SOURCES
      target_files:
        - $TRAIN_TARGETS" ^
Enthus3d
  • 1,727
  • 12
  • 26
  • Tested mine out using a powershell command, currently not sure if it is working. – Enthus3d Sep 13 '19 at 20:50
  • The caret command only works for when it is not in the middle of the string. Perhaps you can use it between strings to make your code more legible. – Enthus3d Sep 13 '19 at 21:02