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
Hi, I Just Upgraded My Version From 0.15.2Rc0 To 0.16.0. In Older Version, By Using Apiclient I Was Getting Client.Tasks.Execution.Parameters, But In Newer Version. It Returns Empty Dict. I Know Hyper-Parameters Section Is Changed, But Why This Method Ret

Hi, I just upgraded my version from 0.15.2rc0 to 0.16.0. In older version, by using APIClient I was getting client.tasks.execution.parameters, but in newer version. It returns empty dict. I know hyper-parameters section is changed, but why this method returns in newer version?

  
  
Posted 4 years ago
Votes Newest

Answers 25


MysteriousBee56 the API was changed, and what the server returns depends on the API version used by the API client. In you're using an older version, the server returns the data in the old style. Since you're using the new client version, the server returns the new format, where the hyper parameters are located under the hyperparams property and not the execution.parameters property.

  
  
Posted 4 years ago

TimelyPenguin76 It is 2.1, but 2.9 files are also exist. How can I update it?

  
  
Posted 4 years ago

You're quite right - we didn't update the API for the agent... I will discuss it with the guys - I guess we'll either update it there as well or decide to instruct people to use it primarily from trains ...

  
  
Posted 4 years ago

0.16.0

  
  
Posted 4 years ago

Did you run it after Task.init() ?

  
  
Posted 4 years ago

Oh, now I see the difference... I was using the APIClient provided in trains 🙂

  
  
Posted 4 years ago

In older versions it returns:
"parameters": { "batch_size": "64", "test_batch_size": "1000", "epochs": "1", "lr": "0.01", "momentum": "0.5", "no_cuda": "False", "seed": "1", "log_interval": "10", "save_model": "True" }But, now it just returns empty dict. I think it is because of separation of hyper-parameters section on UI.

  
  
Posted 4 years ago

Hi MysteriousBee56 ,

Can you share a the code you are using with the APIClient?

  
  
Posted 4 years ago

Strange - I just tried the same with our demo server (which is also 0.16.0) and did receive the hyperparams as expected - can you please share the exact client calls you're making?

  
  
Posted 4 years ago

The api version is selected automatically, let me check that for you

  
  
Posted 4 years ago

MysteriousBee56 are you using Trains Server 0.15.1 or 0.16.0?

  
  
Posted 4 years ago

I run it already.

  
  
Posted 4 years ago

Okey, know it is 2.9, I misunderstood you.

  
  
Posted 4 years ago

Did you try task.data.hyperparams or task.hyperparams ?

  
  
Posted 4 years ago

can you try
print(task.data.hyperparams)instead of the last line?

  
  
Posted 4 years ago

When I print (task.data) there is no hyperparams in dictionary.

  
  
Posted 4 years ago

You can try simply changing the import statement since the APIClient itself is identical, it just relies on the API schema available in the package (and trains is more updated than the agent in that regard)

  
  
Posted 4 years ago

from trains_agent import APIClient client = APIClient() task = client.tasks.get_by_id(task="5b5cbdc5e7bc4cd5ba39081b5b4a0423") print(task.execution.parameters)

  
  
Posted 4 years ago

I was using APIClient inside of trains-agent and in trains-agent there is no v2.9. I think that's why I could not get hyperparams

  
  
Posted 4 years ago

Please make sure you check the api version only after you initialized the API client

  
  
Posted 4 years ago

Can you check the api version?
from trains.backend_api import Session print(Session.api_version)

  
  
Posted 4 years ago

print(task.data.hyperparams) I tried this one

  
  
Posted 4 years ago

AttributeError: 'Task' object has no attribute 'hyperparams'

  
  
Posted 4 years ago

Okey, I got it now. Thanks for help 🙂

  
  
Posted 4 years ago

Thanks and sorry for the mix-up 😄 (also kudos for figuring it out!)

  
  
Posted 4 years ago