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
Hello, All. I’Ve Recently Started Experiencing A Weird Issue With Arg Parsing Where Any String Values Are Being Repeated As Lists Of Strings When The Values Are Sent To The Clearml Server (See Attached Screenshot). I Believe This Issue Started Around The

Hello, all. I’ve recently started experiencing a weird issue with arg parsing where any string values are being repeated as lists of strings when the values are sent to the ClearML server (see attached screenshot). I believe this issue started around the time that I upgraded to the clearml python package 1.11, though I’m not 100% certain of this. I do know that I have not made any changes to my code that calls Task.init() and this used to work correctly for me. Any ideas?
image

  
  
Posted 11 months ago
Votes Newest

Answers 9


Found the issue: my bad practice for import 😛
You need to import clearml before doing argument parser. Bad way:

import argparse

def handleArgs():

    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--config-file', type=str, default='train_config.yaml',
                        help='train config file')   
    parser.add_argument('--device', type=int, default=0,
                        help='cuda device index to run the training')

    args = parser.parse_args()
    return args

if __name__ == "__main__":
    args=handleArgs()

    from clearml import Task
    task = Task.init(project_name='bugs', task_name='argparse',reuse_last_task_id=False)
    print("Done.")

Should be:

import argparse
from clearml import Task

def handleArgs():

    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--config-file', type=str, default='train_config.yaml',
                        help='train config file')   
    parser.add_argument('--device', type=int, default=0,
                        help='cuda device index to run the training')

    args = parser.parse_args()
    return args

if __name__ == "__main__":
    args=handleArgs()


    task = Task.init(project_name='bugs', task_name='argparse',reuse_last_task_id=False)
    print("Done.")
  
  
Posted 10 months ago

@<1576381444509405184:profile|ManiacalLizard2> ,that’s interesting. So you actually need the imports to be in a certain order. That’s definitely new and a bit of an anti-pattern as it goes against recommended import statement order (built-in packages imported first) but if it works, that’s good news at least. I’ll try that as well. Thanks!

  
  
Posted 10 months ago

Solved @<1533620191232004096:profile|NuttyLobster9> . In my case:
I need to from clearml import Task very early in the code (like first line), before importing argparse
And not calling task.connect(parser)

  
  
Posted 10 months ago

I also have the same issue. Default argument are fine but all supplied argument in command line become duplicated !

  
  
Posted 10 months ago

image

  
  
Posted 10 months ago

like for dataset_dir I would expect a single path, not an array of 2 paths duplicated

  
  
Posted 10 months ago

Hi @<1523701070390366208:profile|CostlyOstrich36> , I would expect the loss_func parameter to be FocalLoss instead of ['FocalLoss', 'FocalLoss', 'FocalLoss', 'FocalLoss'] (and same for the validation_split_name parameter. I will try to put together an example, though it might take a little time before I can do it.

  
  
Posted 11 months ago

Hi @<1533620191232004096:profile|NuttyLobster9> , can you please elaborate on what you were expecting to get? Can you provide a self contained snippet that reproduces this?

  
  
Posted 11 months ago

my code looks like this :

    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--config-file', type=str, default='train_config.yaml',
                        help='train config file')
    parser.add_argument('-t', '--train-times', type=int, default=1,
                        help='train the same model several times')
    parser.add_argument('--dataset_dir', help='path to folder containing the preped dataset.', required=True)
    parser.add_argument('--backup', action='store_true', help='store the config file')
       
    parser.add_argument('--device', type=int, default=0,
                        help='cuda device index to run the training')

    task.connect(parser)

    args = parser.parse_args()
  
  
Posted 10 months ago
593 Views
9 Answers
11 months ago
10 months ago
Tags