diambra / arena

DIAMBRA Arena: a New Reinforcement Learning Platform for Research and Experimentation
https://docs.diambra.ai
Other
313 stars 22 forks source link

How to render the environment? #40

Closed 77asadian closed 1 year ago

77asadian commented 1 year ago

Hi,

I want to render the base code that I performed here:

image

Can you please help me with this?

alexpalms commented 1 year ago

Thank you for opening this @77asadian. So, you are running this inside a jupyter notebook right?

77asadian commented 1 year ago

Thank you for opening this @77asadian. So, you are running this inside a jupyter notebook right?

Yes, I'm running this in jupyter notebook.

alexpalms commented 1 year ago

Can you share your OS version and a screenshot of the shell where you started jupyter notebook?

77asadian commented 1 year ago

I'm using Windows Home 21H1. Here is the screenshot you asked for:

image

alexpalms commented 1 year ago

I just tested it and in my configuration it works:

Screenshot from 2022-10-22 16-32-09

I am using the python notebook example file provided in our repo: https://github.com/diambra/arena/blob/main/examples/diambra_arena_gist.ipynb

alexpalms commented 1 year ago

I'm using Windows Home 21H1. Here is the screenshot you asked for:

image

It seems there are problems with the widget control, let me check.

alexpalms commented 1 year ago

But no, I have the same message/warning here and everything works. Can you please comment the rendering and see if, on this same console, it prints out logs demonstrating it is proceeding?

alexpalms commented 1 year ago

You should be seeing something like this: Screenshot from 2022-10-22 16-40-22 Screenshot from 2022-10-22 16-40-08

77asadian commented 1 year ago

There was no rendering window opening for me. I commented the render line and there is no output log. image

alexpalms commented 1 year ago

There was no rendering window opening for me. I commented the render line and there is no output log. image

Two things: 1) be careful with that comment since it is not indented and can give problems, just to be sure, remove the line

2) I am referring to comments in the shell/console where you launched jupyter notebook (where you typed diambra run ...)

77asadian commented 1 year ago

I'm seeing this:

image

image

alexpalms commented 1 year ago

I'm seeing this:

image

image

Looks all good. Please at the bottom confirm there is something like "Waiting for fight to start"

Don't mind that thing where you put an arrow, it's normal

77asadian commented 1 year ago

I'm seeing this: image image

Looks all good. Please at the bottom confirm there is something like "Waiting for fight to start"

Don't mind about that thing where you put an arrow, it's normal

Is it this?

image

alexpalms commented 1 year ago

Yes, but please share also the most recent logs/outputs

77asadian commented 1 year ago

image

image

There are so many codes here. I hope this would help.

alexpalms commented 1 year ago

everything seems to be executed properly. Add print("Reward = ", reward) before the if done: condition in the script

then run the script again and let's see if it is correctly running

77asadian commented 1 year ago

print("Reward = ", reward)

image

We have some rewards here.

alexpalms commented 1 year ago

yes, so everything is working.

It is strange you are not able to see the rendered screen. Need to check it on Win. You're not using a virtual machine or a headless configuration right?

77asadian commented 1 year ago

yes, so everything is working.

It is strange you are not able to see the rendered screen. Need to check it on Win. You're not using a virtual machine or a headless configuration right?

No, my OS is not running on a virtual machine. I'm using a Lenovo Legion 5 laptop.

alexpalms commented 1 year ago

Can you do the following test? Add the following lines at the top of your jupyter script:

import os
print(os.getenv("DISPLAY"))

and past here the output

77asadian commented 1 year ago

image

It seems there is no display.

alexpalms commented 1 year ago

Ok so that is the problem, cause we use that check to decide if showing or not the render image. But it could be we need a different check for windows, I'll carry out some tests and let you know.

In the meantime you can use it without rendering.

77asadian commented 1 year ago

Ok so that is the problem, cause we use that check to decide if showing or not the render image. But it could be we need a different check for windows, I'll carry out some tests and let you know.

In the meantime you can use it without rendering.

Thank you for your help. I'm looking forward to your response.

alexpalms commented 1 year ago

Hey @77asadian, just pushed a new diambra-arena version (https://pypi.org/project/diambra-arena/ v2.0.0rc8) implementing the fix that solves this (tested on Win), this is the commit: https://github.com/diambra/arena/commit/35bde2bf91de89a4cf48d62f5f436e278cbb9a39

You should update your python environment installing the latest version with pip install -U diambra-arena and re-run the simplest example (diambra_gym_gist.py) with env.render() active.

Please confirm that you're able to see the rendering so that we can close the issue