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
Hey, I Have Many Python Files. In The First Python File I Use The Following Line. Parameters = Task.Connect(Input) Now I Change The Hyperparameters On The Graphical Interface. But Now I Need The Hyperparameters In Every Python File. How Do I Have Access T

hey,
I have many python files.
In the first python file I use the following line.
parameters = task.connect(input)
Now I change the hyperparameters on the graphical interface.
But now I need the hyperparameters in every python file.
How do I have access to the hyperparameters?

  
  
Posted 3 years ago
Votes Newest

Answers 14


Say I have a more complicated, nested dict of params, and I only want to send some of the nested keys to the GUI. I also want each one of those to be a "hyper parameters" field in the ClearML GUI. How do I connect each of these fields as such and return the correct types?

example:
config: field1: dict(param1=123, param2='text') field2: dict(param1=123, param2='text') field3: dict(param1=123, param2='text')
If I understand what you suggested above, doing task.connect(base_params on this nested dict will dump everything into one field and won't allow filtering.

  
  
Posted 3 years ago

Well, I connected a dictionary of params that needed to be accessible in the GUI via task.connect using a loop, where I was filtering that dictionary:

for k, v in config_dict.items(): if k not in ['element1', 'element2']: task.connect(v, name=k.lower())
It seemed more logical to return the params with a single call:

task_parameters = task.get_parameters_as_dict()

  
  
Posted 3 years ago

Oh :)
task.get_parameters_as_dict()

  
  
Posted 3 years ago

Hi UnsightlySeagull42

But now I need the hyperparameters in every python file.

You can always get the Task from anywhere?
main_task = Task.current_task()

  
  
Posted 3 years ago

No worries, let's assume we have:
base_params = dict( field1=dict(param1=123, param2='text'), field2=dict(param1=123, param2='text'), ... )Now let's just connect field1:
task.connect(base_params['field1'], name='field1')That's it 🙂

  
  
Posted 3 years ago

task.connect is two way, it does everything for you:
base_params = dict(param1=123, param2='text') task.connect(base_params) print(base_params)If you run this code manually, then print is exactly what you initialized base_params with. But when the agent is running it, it will take the values from the UI (including casting to the correct type), so print will result in values/types from the UI.
Make sense ?

  
  
Posted 3 years ago

you can also get it flattened with:
task.get_parameters()Type in both cases is string

  
  
Posted 3 years ago

Great!

  
  
Posted 3 years ago

Hi ProudChicken98
task.connect(input) preserves the types based on the "input" dict types, on the flip side get_parameters returns the string representation (as stored on the clearml-server).
Is there a specific reason for using get_parameters over connect ?

  
  
Posted 3 years ago

I would expect consistency in types I connected with those I retrieved.

  
  
Posted 3 years ago

That seems to work. Thanks!

  
  
Posted 3 years ago

ok
but how can I get the hyperparameters from the current task?

  
  
Posted 3 years ago

What is the advantage to returning only string types?

  
  
Posted 3 years ago

How do I preserve types when using task.get_parameters_as_dict() or task.get_parameters() ?

If I connect the params via task.connect(input) , change via the GUI, and use one of the methods above, all int and float values turn into strings. This doesn't work very well for hyperparameters that are numerical.

  
  
Posted 3 years ago
1K Views
14 Answers
3 years ago
one year ago
Tags
Similar posts