Priceless

[RL] Do it 강화 학습 입문 3장 - 알파고 도전을 위한 첫걸음 본문

AI/RL

[RL] Do it 강화 학습 입문 3장 - 알파고 도전을 위한 첫걸음

Hyun__ 2024. 7. 30. 10:51

3-1. 게임을 스스로 플레이하는 에이전트 만들기

강화 학습을 게임 환경에서 공부하는 이유

현실에서는 환경 통제가 거의 불가능하다

게임 환경을 통해 에이전트, 환경, 보상을 통제하도록 한다

 

OpenAI Gym 레트로를 위한 환경 준비(환경 설정 문제로 추후 수정)

OS에 맞는 conda 환경을 설정한다

 

Ubuntu 

Not windows

 

준비가 되었으면

git clone

 

 

environment.yml에서 

channels and dependencies를 수정한다

가상환경이 생성된 이후 GL에서 문제가 발생하는데

구글링 해본 결과 pyglet 1.5.11 버전으로 해결한다고 하여

pyglet 버전도 수정한다 

name: rl-gym-retro
channels:
  - defaults
dependencies:
  - ca-certificates=2020.1.1=0
  - certifi=2019.11.28=py37_1
  - libcxx=14.0.6 #=hcfea43d_1
  - libcxxabi=14.0.6 #=hcfea43d_1
  - libedit=3.1.20181209 #=hb402a30_0
  - libffi=3.2.1 #=h475c297_4
  - ncurses=6.2 #=h0a44026_0
  - openssl=1.1.1e #=h1de35cc_0
  - pip=20.0.2=py37_1
  - python=3.7.7 #=hc70fcce_0_cpython
  - readline=8.0 #=h1de35cc_0
  - setuptools=46.1.1=py37_0
  - sqlite=3.31.1 #=ha441bb4_0
  - tk=8.6.8 #=ha441bb4_0
  - wheel=0.34.2=py37_0
  - xz=5.2.4 #=h1de35cc_4
  - zlib=1.2.11 #=h1de35cc_3
  
  
  ...
  
  
      - pyglet==1.5.11

 

 

 

issue about pyglet

conda-forge를 install 하면 해결된다는 후기가 있는데 잘 되지 않는다

그래픽 카드를 사용하여 발생한 문제일 수 있다

https://github.com/mmatl/pyrender/issues/13

 

pyglet.gl.ContextException: Could not create GL context · Issue #13 · mmatl/pyrender

Hi, I'm trying to run the following code: import trimesh import pyrender tm = trimesh.load('/home/henry/Downloads/fuze.obj') pymesh = pyrender.Mesh.from_trimesh(tm) scene = pyrender.Scene() scene.a...

github.com

 

이 게시글에서는 test는 실패했지만

실제 사용에서는 문제가 없다고 한다

하지만 여전히 같은 문제가 발생한다

https://liger82.github.io/rl/rl/2021/05/12/error-pyglet.html

 

[Import Error] gym render error; Error occurred while running `from pyglet.gl import *` | Stuarting...

Error 맥에서 gym 설치만 하면 모든 기능을 쓸 수 있을 줄 알았는데 다음과 같은 에러가 났습니다. Traceback (most recent call last): File "/Users/stuartkim/.pyenv/versions/3.7.7/envs/deepRL/lib/python3.7/site-packages/gym/envs/

liger82.github.io