Replies: 4 comments 7 replies
-
The error appears to occur during the cloudpickle operation of loading. ERROR OCCURS W/ "INPUTS'
Error:
ERROR NO LONGER OCCURS - NO 'INPUTS' sim = client.create_reinforcement_learning(get_configuration(client.configuration_template)) CODE:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply.
Can you please share your code for creating successful stock game policy
and the policy? How did you check the policy and it's performance?
Best,
Tomer
…On Mon, May 2, 2022, 19:13 negodfre ***@***.***> wrote:
I stopped trying to get multiprocessing to work.
I want to get back to see if I can figure it out.
I was able to get the stock game to train and my own simulation.
However, for my own simulation, I use doubles and I believe I had to add
that data type to the file.
I still run into some odd errors, and sometimes trying to run it multiple
times it will eventually run.
—
Reply to this email directly, view it on GitHub
<https://github.com/t-wolfeadam/Alpyne/discussions/15#discussioncomment-2674837>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AW4MNQ6F4RYKUELUOKGYM33VH75KZANCNFSM5ODOXN5A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi, I am still having difficulties getting a successful training for the
stock game (single process). I have tried to normalize the action and the
reward, but still I get random policy behavior.
@negodfre I would appreciate it if you could share your code for creating
a successful training and its test.
Best,
Tomer
…On Tue, May 3, 2022 at 7:05 PM negodfre ***@***.***> wrote:
Yeah, sorry, to clarify, I got it to run. I'm not quite sure how
successful the policy was. I won't have access to my PC till next week and
I can take a look.
In my own example, I needed to normalize both the input and the reward to
get successful training. I used tensorboard support in stable-baslelines3
to see how the model progressed. I looked at cumulative reward along with
percent variation explained. Followed by that, I looked at specific cases
to see if the learned behavior is as expected. But that was for my own
example not the stock example.
There are some pre-written scripts for stable-baselines3 that handle
normalization as a wrapper. Those didn't seem to work and I didn't spend a
ton of time trying to figure out why. Instead I created my own
normalization procedure in the custom environment.
—
Reply to this email directly, view it on GitHub
<https://github.com/t-wolfeadam/Alpyne/discussions/15#discussioncomment-2681388>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AW4MNQ6TCQBAXXAYHLPJUWTVIFFENANCNFSM5ODOXN5A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
This was the playthrough with a model trained on 50,000 iterations. Note: I used pypeline to get the prediction from the trained PPO model. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Has anyone been able to run the stock game using multiprocessing?
The default for make_vec_env is to use DummyVecEnv which doesn't actually perform multiprocessing.
I altered the rltrain_policy.py file to try and get it the program to run.
I created multiple sims but only kept the one client.
I also tried one sim that was used to instantiate multiple environments.
However, each of these approaches resulted in a broken pipe error.
Specifically, the error occurs when SubprocVecEnv attempts to send 'get_spaces' and then receive it.
sub_proc_vec_env.py within stable_baselines3
CODE:
rlpolicy_train.py
CODE:
ERROR:
`2022-02-11 03:12:27,659 - sLogger - INFO: Starting model in \Alpyne-main\examples\Stock Management Game\Exported
2022-02-11 03:12:27,674 - sLogger - DEBUG: Executing:
java -cp \anylogic\lib\site-packages\alpyne\resources*;\anylogic\lib\site-packages\alpyne\resources\alpyne_lib*;*;lib*;StockManagementGame*;lib\database*;lib\sa*;lib\database\querydsl*;lib\sa\jackson*;lib\sa\spark* com.anylogic.alpyne.AlpyneServer -p 51150 -o \Alpyne-main\examples\Stock Management Game -l WARNING .
2022-02-11 03:12:27,752 - sLogger - INFO: Started app | PID = 26328
2022-02-11 03:12:37,762 - alpyne.client.http_client - DEBUG: GET /versions/number/0: None
2022-02-11 03:12:38,103 - alpyne.client.http_client - DEBUG: => 200 (OK) [('Content-Type', 'application/json'), ('Connection', 'close'), ('Content-Length', '1568')] {'version': 0, 'experimentTemplate': {'outputs': [{'name': 'stockValueDS', 'type': 'DATA_SET', 'value': None, 'units': None}, {'name': 'orderRateDS', 'type': 'DATA_SET', 'value': None, 'units': None}, {'name': 'demandRateDS', 'type': 'DATA_SET', 'value': None, 'units': None}, {'name': 'fullnessDistribution', 'type': 'HISTOGRAM_DATA', 'value': None, 'units': None}, {'name': 'amountSold', 'type': 'DOUBLE'}, {'name': 'amountWasted', 'type': 'DOUBLE'}], 'reinforcement_learning': {'action': [{'name': 'order_rate', 'type': 'DOUBLE'}], 'configuration': [{'name': 'acquisition_lag_days', 'type': 'INTEGER'}, {'name': '{START_TIME}', 'type': 'DOUBLE', 'value': 0.0, 'units': 'DAY'}, {'name': '{START_DATE}', 'type': 'DATE_TIME', 'value': '2020-01-01T05:00:00Z', 'units': None}, {'name': '{STOP_TIME}', 'type': 'DOUBLE', 'value': 731.0, 'units': 'DAY'}, {'name': '{STOP_DATE}', 'type': 'DATE_TIME', 'value': '2022-01-01T05:00:00Z', 'units': None}, {'name': '{RANDOM_SEED}', 'type': 'LONG'}], 'observation': [{'name': 'stock_amount', 'type': 'DOUBLE'}, {'name': 'recent_stock_amounts', 'type': 'DOUBLE_ARRAY'}, {'name': 'last_order_rate', 'type': 'DOUBLE'}, {'name': 'time_days', 'type': 'DOUBLE'}]}, 'inputs': [{'name': 'inRLMode', 'type': 'BOOLEAN'}, {'name': 'acquisitionLag', 'type': 'DOUBLE'}, {'name': 'maxHoldingAmount', 'type': 'DOUBLE'}, {'name': '{START_TIME}', 'type': 'DOUBLE', 'value': 0.0, 'units': 'DAY'}, {'name': '{START_DATE}', 'type': 'DATE_TIME', 'value': '2020-01-01T05:00:00Z', 'units': None}, {'name': '{STOP_TIME}', 'type': 'DOUBLE', 'value': 731.0, 'units': 'DAY'}, {'name': '{STOP_DATE}', 'type': 'DATE_TIME', 'value': '2022-01-01T05:00:00Z', 'units': None}, {'name': '{RANDOM_SEED}', 'type': 'LONG'}]}}
What is self.remotes type: <class 'multiprocessing.connection.PipeConnection'>
About to do cloud pickle wrapper...
About to start process...
About to do cloud pickle wrapper...
About to start process...
About to do cloud pickle wrapper...
About to start process...
About to do cloud pickle wrapper...
About to start process...
About to send get spaces...
Sent the get_spaces to pipe connection...
Traceback (most recent call last):
Traceback (most recent call last):
File "", line 1, in
File "\Python\Python38\lib\multiprocessing\connection.py", line 312, in _recv_bytes
File "\Python\Python38\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "Programs\Python\Python38\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
File "anylogic\lib\site-packages\stable_baselines3\common\vec_env\base_vec_env.py", line 374, in setstate
self.var = cloudpickle.loads(var)
TypeError: 'dict' object is not callable
nread, err = ov.GetOverlappedResult(True)
BrokenPipeError: [WinError 109] The pipe has been ended
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Alpyne-main/examples/Stock Management Game/rlpolicy_train.py", line 171, in
envs = SubprocVecEnv([lambda: elem for elem in envs])
File "\anylogic\lib\site-packages\stable_baselines3\common\vec_env\subproc_vec_env.py", line 116, in init
observation_space, action_space = self.remotes[0].recv()
File "\Python38\lib\multiprocessing\connection.py", line 250, in recv
buf = self._recv_bytes()
File "\Python38\lib\multiprocessing\connection.py", line 321, in _recv_bytes
raise EOFError
EOFError
2022-02-11 03:12:41,745 - alpyne.client.http_client - DEBUG: DELETE /: None
2022-02-11 03:12:41,752 - alpyne.client.http_client - DEBUG: => 202 (Accepted) [('Connection', 'close'), ('Content-Length', '0')] None`
Beta Was this translation helpful? Give feedback.
All reactions