Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
I'M Using

I'm using
from argparse import ArgumentParserto parse my hyperparameters and won't get anything on trains-server any Idea how to fix that?

  
  
Posted 4 years ago
Votes Newest

Answers 9


MagnificentPig49 I was not aware of jsonargparse from what I understand it's a nicer way to parse json configuration files, with argparser alike interface. Did I get that correctly?
Regrading the missing argparser, you are correct, the auto-magic is not working since jsonargparse is calling an internal ArgParser function and not the external one (hence we miss it).
The quickest fix is adding the following line before you call parse_args() :
task.connect(parent_parser)

  
  
Posted 4 years ago

AgitatedDove14 thanks but I’m not using argparse , I’m using jsonargparse
you can see the simplified snippet here
from jsonargparse import ArgumentParser from trains import Task model_snapshots_path = 'mnt/trains' task = Task.init(project_name='examples', task_name='test argparser', output_uri=model_snapshots_path) logger = task.get_logger() def main(args): print('Got args: %s' % args) if __name__ == '__main__': parent_parser = ArgumentParser(add_help=False) parent_parser.add_argument('--num_workers', help='integer value', type=int, default=1) parent_parser.add_argument('--gpus', help='integer value', type=int, default=0) parent_parser.add_argument('--max_epochs', help='integer value', type=int, default=1) parent_parser.add_argument('--visdom', action='store_true') main(parent_parser.parse_args())

  
  
Posted 4 years ago

Thanks AgitatedDove14 yes task.connect worked. about jsonargparse not sure how popular it is but in our case regular argparse didn’t work and we find out jsonargparse is working perfect. I guess will be beneficial to support that as well.

  
  
Posted 4 years ago

thanks SuccessfulKoala55 , sorry that I can’t share the whole code but here is my main part
` import faulthandler
import logging

import torch
from argparse import ArgumentParser
from pytorch_lightning.callbacks import ModelCheckpoint

...

import os

from trains import Task
model_snapshots_path = 'mnt/trains'
if not os.path.exists(model_snapshots_path):
os.makedirs(model_snapshots_path)

task = Task.init(project_name='xl_trainer',
task_name='extending automagical Trains xl trianer',
output_uri=model_snapshots_path)

logger = task.get_logger()

def main(args):

 ` ` ('Got args: %s', args)

model = XLModelFactory().create_or_load(args)

...

if name == 'main':
parent_parser = ArgumentParser(add_help=False)
main(ResnetCIFAR10Model.add_model_specific_args(parent_parser).parse_args(nested=True)) `

  
  
Posted 4 years ago

MagnificentPig49 I'll look into it, if it's very simple, it should not be a problem.

  
  
Posted 4 years ago

MagnificentPig49 is jsonargparse popular, should we fix the auto-magic ?

  
  
Posted 4 years ago

I simplified the code, just so I could test it, this one seems to work, feel free to add the missing argparser parts :)
` from argparse import ArgumentParser
from trains import Task
model_snapshots_path = 'mnt/trains'
task = Task.init(project_name='examples', task_name='test argparser', output_uri=model_snapshots_path)
logger = task.get_logger()

def main(args):
print('Got args: %s' % args)

if name == 'main':
parent_parser = ArgumentParser(add_help=False)
parent_parser.add_argument('--argparser_int_value', help='integer value', type=int, default=1)
main(parent_parser.parse_args()) `

  
  
Posted 4 years ago

Hi MagnificentPig49 ,
Can you share a little bit more of your initial code? Where exactly do you call http://Task.in

  
  
Posted 4 years ago

Hi MagnificentPig49 I suspect it's the ResnetCIFAR10Model wrapper, is it your module ?

  
  
Posted 4 years ago
966 Views
9 Answers
4 years ago
one year ago
Tags