Can you check the api version?from trains.backend_api import Session print(Session.api_version)
Oh, now I see the difference... I was using the APIClient
provided in trains
🙂
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)
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?
can you tryprint(task.data.hyperparams)
instead of the last line?
Did you try task.data.hyperparams
or task.hyperparams
?
Thanks and sorry for the mix-up 😄 (also kudos for figuring it out!)
Did you run it after Task.init()
?
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.
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
The api version is selected automatically, let me check that for you
When I print (task.data) there is no hyperparams
in dictionary.
AttributeError: 'Task' object has no attribute 'hyperparams'
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
...
Please make sure you check the api version only after you initialized the API client
Okey, I got it now. Thanks for help 🙂
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.
from trains_agent import APIClient client = APIClient() task = client.tasks.get_by_id(task="5b5cbdc5e7bc4cd5ba39081b5b4a0423") print(task.execution.parameters)
Okey, know it is 2.9, I misunderstood you.
Hi MysteriousBee56 ,
Can you share a the code you are using with the APIClient?
MysteriousBee56 are you using Trains Server 0.15.1 or 0.16.0?
TimelyPenguin76 It is 2.1, but 2.9 files are also exist. How can I update it?
print(task.data.hyperparams)
I tried this one