K0nkere / DL_Dice-detection-project

DnD dice detection with CNN and transfer learning / Project for ML Bookcamp
0 stars 0 forks source link

How to: parsing arguments #6

Open K0nkere opened 1 year ago

K0nkere commented 1 year ago

Parameters

parser = argparse.ArgumentParser(description="Train model", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("-E","--nepochs", help="number of epochs") parser.add_argument("-L","--lrate", help="learning rate") parser.add_argument("-I","--isize", help="inner size") parser.add_argument("-D","--drate", help="drop rate") parser.add_argument("-O","--output", help="output file") args = parser.parse_args()

n_epochs = 50 nepochs = args.nepochs

if nepochs != None: n_epochs = int(nepochs)

- [argparse](https://docs.python.org/3/library/argparse.html)

if name == 'main':

  parser = argparse.ArgumentParser()
  parser.add_argument(
      "--data_path",
      default="./output",
      help="the location where the processed NYC taxi trip data was saved."
  )
  parser.add_argument(
      "--top_n",
      default=5,
      type=int,
      help="the top 'top_n' models will be evaluated to decide which model to promote."
  )
  args = parser.parse_args()
- with sys

import sys

def run(): taxi_type = sys.argv[1] # fhv - for-hire vehicles year = int(sys.argv[2]) # 2021 month = int(sys.argv[3]) # month of using data ...

if name == 'main':
run()