princeton-nlp / WebShop

[NeurIPS 2022] 🛒WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents
https://webshop-pnlp.github.io
MIT License
255 stars 53 forks source link

Is there a way to way to keep running the simple server 'SimServer' in background? #7

Closed sgdgp closed 1 year ago

sgdgp commented 2 years ago

Hi, I was curious to know if there is a way to launch the SimServer object in once and then retrieve that when creating new instances of WebAgentTextEnv ?

howard50b commented 2 years ago

Just to clarify. Do you mean only instantiating the SimServer instance once (like server = SimServer(...)) and use that for spawning up multiple WebAgentTextEnv?

sgdgp commented 2 years ago

Yes something like that. To clarify, I am trying to do RL training based on the provided script train_rl.py. It seems that the line train_env = WebEnv(args, split='train', id='train_') is used primarily to create the SimServer and then train_env is not used again. Rather the SimServer object is retrieved from train_env and used to spawn other such env for train, test and val.

Since the creation and loading of the server takes some time (aproximately 7-8 minutes in the machine that I am working on) I was hoping to do the train_env.... thing or just setting up SimServer in a different python script and keep that running in background. This would help me avoid the loading of products and setting up the server everytime I invoke the RL script

howard50b commented 1 year ago

Hi @sgdgp sorry for the long delay. Somehow this fell through the crack... In case this is still helpful, I think the scenario you describe is doable. One thing to note is if you plan to do it in a multi-process manner just make sure that the session_id's are properly assigned so they don't overwrite each other. If you run into any issue doing that feel free to open the issue again!