Hi, I am trying to train RL models using Vectorized method LOCALLY using Docker. Setup was successful, as I am able to access the test cases and print the variable names.
But I am getting the following error. The error occurs in the Boptest-Gym env file.
Error =>
File "boptestGymEnv.py", line 679, in compute_truncated
truncated = res['time'] >= self.start_time + self.max_episode_length
KeyError: 'time'
KeyError: 'time'
How do I solve it. I tried setting the start_time = None and 0, but nothing worked for me.
Regards.
Do you get this error when calling the step function? The payload returned from the advance api call should contain a 'time' key. Are you sure that the return from the advance call is successful (200)?
Posted by: haraldwalnum @ Sept. 4, 2024, 4:46 p.m.When printing the `res` It's printing the measurement variables including the 'time' => {'time': 9244800.0} and many variables.
BUT after some time steps, THE `res` is empty {} as shown above. How do I solve it.
Hi, Yes It's occuring when called step function.
print("\nTEST CASE INFORMATION\n---------------------")
# Get the test case name
name = requests.get(f"{URL}/name").json()["payload"]["name"]
print("\nName is:")
print(name)
OUT =>
TEST CASE INFORMATION
---------------------
Name is:
Adrenalin1_training
requests.post(f"{URL}/advance", json={}).json()
OUT=>
{'message': 'End of test case scenario time period reached.',
'payload': {},
'status': 200}
What's exactly happening here ?. Message says that the end of test case reached. Why ?
Posted by: RakeshJarupula @ Sept. 5, 2024, 6:05 a.m.This is expected. You have simulated to the end of the scenario (2 weeks), and the emulator stops
Posted by: haraldwalnum @ Sept. 5, 2024, 9:08 a.m.So, the model trained up to that ?
How can I avoid the error.
Posted by: RakeshJarupula @ Sept. 5, 2024, 2:22 p.m.I am not very familiar with the gym environment, but in general, when you are training, you should set the scenario without setting the "time_period". Then you can initialize the model at the desired time with the "initialize" endpoint. E.g.
s = {"start_time": 24*3600*7, "warmup_period": 24*3600*7}
res = requests.put("{0}/initialize".format(url), json=s)
Then you can run the emulator until the end of the year. However, I would not recommend running it through summer, as the simulation time can be very long.
Posted by: haraldwalnum @ Sept. 5, 2024, 6:07 p.m.