-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into etosch-patch-1
- Loading branch information
Showing
12 changed files
with
273 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ tensorflow | |
gym[atari] | ||
tensorboard | ||
pygame | ||
cffi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// from https://github.com/getsentry/milksnake | ||
extern crate cbindgen; | ||
|
||
use std::env; | ||
|
||
fn main() { | ||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
let mut config: cbindgen::Config = Default::default(); | ||
config.language = cbindgen::Language::C; | ||
cbindgen::generate_with_config(&crate_dir, config) | ||
.unwrap() | ||
.write_to_file("../target/ctoybox.h"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
# From https://github.com/getsentry/milksnake | ||
from setuptools import setup | ||
|
||
setup(name='openai_shim', | ||
version='0.0.1', | ||
install_requires=['gym'] # And any other dependencies foo needs | ||
) | ||
def build_native(spec): | ||
# build an example rust library | ||
build = spec.add_external_build( | ||
cmd=['cargo', 'build', '--release'], | ||
path='.' | ||
) | ||
|
||
spec.add_cffi_module( | ||
module_path='toybox._native', | ||
dylib=lambda: build.find_dylib('ctoybox', in_path='../../target/release'), | ||
header_filename=lambda: build.find_header('ctoybox.h', in_path='../../target'), | ||
rtld_flags=['NOW', 'NODELETE'] | ||
) | ||
|
||
setup( | ||
name='toybox', | ||
version='0.1.0', | ||
packages=['toybox', 'toybox.envs', 'toybox.interventions', 'toybox.sample_tests'], | ||
zip_safe=False, | ||
platforms='any', | ||
setup_requires=['milksnake'], | ||
install_requires=['milksnake'], | ||
milksnake_tasks=[ | ||
build_native | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
from gym.envs.registration import register | ||
import toybox.toybox as toybox | ||
import toybox.envs as envs | ||
import toybox.interventions as interventions | ||
import toybox.sample_tests as sample_tests | ||
|
||
# Updated to use v4 to be analogous with the ALE versioning | ||
register( | ||
id='BreakoutToyboxNoFrameskip-v4', | ||
entry_point='toybox.envs.atari:BreakoutEnv', | ||
nondeterministic=True | ||
) | ||
try: | ||
from gym.envs.registration import register | ||
|
||
register( | ||
id='AmidarToyboxNoFrameskip-v4', | ||
entry_point='toybox.envs.atari:AmidarEnv', | ||
nondeterministic=False | ||
) | ||
# Updated to use v4 to be analogous with the ALE versioning | ||
register( | ||
id='BreakoutToyboxNoFrameskip-v4', | ||
entry_point='toybox.envs.atari:BreakoutEnv', | ||
nondeterministic=True | ||
) | ||
|
||
register( | ||
id='SpaceInvadersToyboxNoFrameskip-v4', | ||
entry_point='toybox.envs.atari:SpaceInvadersEnv', | ||
nondeterministic=False | ||
) | ||
register( | ||
id='AmidarToyboxNoFrameskip-v4', | ||
entry_point='toybox.envs.atari:AmidarEnv', | ||
nondeterministic=False | ||
) | ||
|
||
print("Loaded Toybox environments.") | ||
register( | ||
id='SpaceInvadersToyboxNoFrameskip-v4', | ||
entry_point='toybox.envs.atari:SpaceInvadersEnv', | ||
nondeterministic=False | ||
) | ||
|
||
print("Registered Toybox environments with gym.") | ||
|
||
except: | ||
# ModuleNotFoundError only in 3.6 and above | ||
print("Loaded Toybox environments.") |
Oops, something went wrong.