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