Comments (8)
Hi, the lab does not have this capability now, contributions are certainly welcome! If you'd like to work on it, I'd suggest a minimal method insertion like the one done for rendering here, just to ensure API consistency and simplicity.
from slm-lab.
I was able to get it working — the commit is here: colllin@b7d70cd
Example usage:
$ RECORD=true python run_lab.py data/dqn_cartpole_2019_123/dqn_cartpole_spec.json dqn_cartpole enjoy@dqn_cartpole_t0_s0_ckpt-best
I have some open questions that prevent me from submitting as a PR:
- I can’t get the “enjoy” mode to work. I get an error about eval_df being empty. Should “enjoy” be able to read the eval_df from the data? That doesn’t seem to be working right now, or I’m doing it wrong. I commented out a few lines while I was testing the video recording.
- Do you have a script or procedure for testing changes across environments? I should test video recording on vector envs and unity envs. I have no idea if the
gym.wrappers.Monitor
will work universally across envs.
Alternatively, if the integration is too complex, we could close this issue and you could point other people here to merge my commit into their project if they want to record video.
Thank you for your help & attention!
from slm-lab.
Hey, this looks good! It is also simple enough to integrate nicely in. We'd be more than happy to accept a PR; this will be a wonderful addition to the lab.
The enjoy mode thing is probably complaining about a specific eval_frequency
. If you run say 10000 max_frame
and set eval_frequency
to 1000, it will have populated the eval_df
with 10 rows. If something else is causing that issue, I can take a look at the CI test and help fix the error.
That said, it suffices to test just on a gym environment now since unity tests are mostly excluded. Most tests are located in test files while directly mirror the original file structure. Feel free to add just 1 simple test.
from slm-lab.
Thanks @kengz, I’d be happy to write a test, add some docs, and submit a PR. Can you help me with something though? When I run the following commands (basically right out of the docs), enjoy
mode seems to fail for me:
$ python run_lab.py slm_lab/spec/demo.json dqn_cartpole train
...
$ python run_lab.py data/dqn_cartpole_2019_.../dqn_cartpole_spec.json dqn_cartpole enjoy@dqn_cartpole_t0_s1
Traceback (most recent call last):
File "run_lab.py", line 84, in <module>
main()
File "run_lab.py", line 73, in main
read_spec_and_run(*args)
File "run_lab.py", line 57, in read_spec_and_run
run_spec(spec, lab_mode)
File "run_lab.py", line 42, in run_spec
Session(spec).run()
File "/home/ubuntu/SLM-Lab/slm_lab/experiment/control.py", line 115, in run
metrics = analysis.analyze_session(self.spec, self.agent.body.eval_df, 'eval')
File "/home/ubuntu/SLM-Lab/slm_lab/experiment/analysis.py", line 232, in analyze_session
assert len(session_df) > 1, f'Need more than 1 datapoint to calculate metrics'
AssertionError: Need more than 1 datapoint to calculate metrics
Am I missing something? It seems that self.agent.body.eval_df
hasn’t been populated as expected.
from slm-lab.
Hey, pretty sure you added code is not causing that since it doesnt have any side effects.
Could u double check that you're on the latest commit? git log
would show the latest SHA starting with 89edebc
I suspect your demo.json
has an eval_frequency
that is too big so it never got to collect that many eval checkpoint data rows.
from slm-lab.
hi @colllin are you still facing the issue?
from slm-lab.
from slm-lab.
test it under the module of that added method; doing so might be cleaner. Just get an test_env
from the conf test to get an example environment and step it through with random action as done here
SLM-Lab/slm_lab/spec/random_baseline.py
Lines 87 to 88 in ac2e5b3
however, if it's problematic, just add a minimal invocation test or no test, since the addition is short.
from slm-lab.
Related Issues (20)
- Are there any benchmarks for SIL? HOT 2
- Empty Multi trial Graph in 'search' mode HOT 1
- Crashing with seccomp-bpf failure in syscall 2030 HOT 2
- RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED on Pong HOT 1
- Cannot open shared object file: No such file or directory when running demo HOT 2
- Book branch problem, need your help HOT 2
- Installation on MacOs 11.6.1 fails HOT 2
- IndexError: list index out of range
- ModuleNotFoundError: No module named 'cv2' HOT 4
- subprocess.CalledProcessError: Command '['git', 'rev-parse', 'HEAD']' returned non-zero exit status 128. HOT 4
- How to add a non-gym envrinment? HOT 6
- I have encounter one problem, maybe a bug. HOT 1
- How to run the code on multiple GPUs? HOT 1
- how to improve the convergence performance of training loss?
- python setup.py test
- `optimizer.step()` before `lr_scheduler.step()` Warning Occurred
- Docker build fails on environment.yml installation HOT 1
- How to add a custom gym environment in json spec file.
- Exception: pyglet 2.0.0 requires Python 3.8 or newer HOT 1
- Docker build failed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slm-lab.