zkytony / thortils

Utility functions when working with Ai2-THOR. Try to do one thing once.
MIT License
42 stars 5 forks source link

Running Thortils in a Headless Setup #3

Closed Ayush8120 closed 1 year ago

Ayush8120 commented 1 year ago

Hi! Thanks for this wonderful piece of work. I was wondering if there was any way by which I could run this on a HEADLESS setup? I saw a variable called headless in launch_controller function, but couldn't make it work. Any help in this aspect would be very much appreciated!

TIA :-)

zkytony commented 1 year ago

I've definitely ran it in headless (no-display) mode before. It's been a while so I don't know why headless didn't work for you. But you may find the documentation here useful: https://github.com/zkytony/cos-pomdp#to-run-in-ai2thor

Ayush8120 commented 1 year ago

Hey! Thanks for the prompt response. I was able to get it running, but wasn't able to render the event frames and instance segmentations. I set the headless = True and x_display = ":0". But this made the event.frame as None.

Is there any way to get it running headless but with the option of saving the event frames?

zkytony commented 1 year ago

Maybe there is, but I've forgotten. Please feel free to investigate a solution.

Ayush8120 commented 1 year ago

Okay! So I've somehow kind of figured out some ways to save event frames while running a headless execution.

Method-1: Upgrade the version to 5.0 and then use the Controller definition given in the docs here:

from ai2thor.platform import CloudRendering
controller = Controller(platform=CloudRendering)

Method-2:(Kind of gets your hands dirty) There is a nice way explained in this Issue's comment link

This issue also deals with a similar problem and references to the previous link for a solution. {The basic idea is the same as how they made ai2thor executable on colab i.e by using Xorg.}