我在脚本环境中很新奇,这一定是个愚蠢的问题,但我找不到答案。
我想用一个github存储库中的几个参数编译一个.py程序。他们解释了如何编译它,但我不知道如何将这样的许多参数传递到命令行。
export scale=6
export TRAIN_FILE=sample_data/pre/100.txt
export TEST_FILE=sample_data/pre/100.txt
export SOURCE=PATH_TO_REPO
export OUTPUT_PATH=output$scale
python run_train.py \
--output_dir $OUTPUT_PATH \
--model_type=dna \
--name=triq$scale \
--config_name=$SOURCE/src/config.json \
--do_train \
--train_data_file=$TRAIN_FILE \
--do_eval \
--eval_data_file=$TEST_FILE \
--gradient_accumulation_steps 25 \
--per_gpu_train_batch_size 10 \
--per_gpu_eval_batch_size 6 \我不知道如何传递/编译这些输入。一些暗示?
一切都会感激的!
发布于 2022-05-11 13:32:05
import argparse
def get_inputs():
parser = argparse.ArgumentParser(description="The script is used for extracting cell info from the lib!")
parser.add_argument('--output_dir',help="This switch is used to fetch the grepped raw data file\n")
args = parser.parse_args()
return args
args=get_inputs()
a = '''[WARN] : No sufficient inputs!!!
usage: post_process.py [-h] [--output_dir OUTPUT_PATH]
The script is used for extracting cell info from the lib!
optional arguments:
-h, --help show this help message and exit
--output_dir OUTPUT_PATH
'''
if args.output_dir is None:
print(a)
exit()若要在脚本中使用路径:
rawdata_path=args.output_dir
您可以阅读更多关于You解析的内容。
https://stackoverflow.com/questions/72201858
复制相似问题