當前位置: 首頁>>代碼示例>>Python>>正文


Python universe.runtime_spec方法代碼示例

本文整理匯總了Python中universe.runtime_spec方法的典型用法代碼示例。如果您正苦於以下問題:Python universe.runtime_spec方法的具體用法?Python universe.runtime_spec怎麽用?Python universe.runtime_spec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在universe的用法示例。


在下文中一共展示了universe.runtime_spec方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: CropObservations

# 需要導入模塊: import universe [as 別名]
# 或者: from universe import runtime_spec [as 別名]
def CropObservations(env):
    """"
    Crops the visual observations of an environment so that they only contain the game screen.
    Removes anything outside the game that usually belongs to universe (browser borders and so on).
    """
    if env.spec.tags.get('flashgames', False):
        spec = runtime_spec('flashgames').server_registry[env.spec.id]
        return _CropObservations(env, x=18, y=84, height=spec["height"], width=spec["width"])
    elif (env.spec.tags.get('atari', False) and env.spec.tags.get('vnc', False)):
        return _CropObservations(env, height=194, width=160)
    else:
        # if unknown environment (or local atari), do nothing
        return env 
開發者ID:openai,項目名稱:universe,代碼行數:15,代碼來源:observation.py

示例2: create_flash_env

# 需要導入模塊: import universe [as 別名]
# 或者: from universe import runtime_spec [as 別名]
def create_flash_env(env_id, client_id, remotes, **_):
    env = gym.make(env_id)
    env = Vision(env)
    env = Logger(env)
    env = BlockingReset(env)

    reg = universe.runtime_spec('flashgames').server_registry
    height = reg[env_id]["height"]
    width = reg[env_id]["width"]
    env = CropScreen(env, height, width, 84, 18)
    env = FlashRescale(env)

    keys = ['left', 'right', 'up', 'down', 'x']
    if env_id == 'flashgames.NeonRace-v0':
        # Better key space for this game.
        keys = ['left', 'right', 'up', 'left up', 'right up', 'down', 'up x']
    logger.info('create_flash_env(%s): keys=%s', env_id, keys)

    env = DiscreteToFixedKeysVNCActions(env, keys)
    env = EpisodeID(env)
    env = DiagnosticsInfo(env)
    env = Unvectorize(env)
    env.configure(fps=5.0, remotes=remotes, start_timeout=15 * 60, client_id=client_id,
                  vnc_driver='go', vnc_kwargs={
                    'encoding': 'tight', 'compress_level': 0,
                    'fine_quality_level': 50, 'subsample_level': 3})
    return env 
開發者ID:openai,項目名稱:universe-starter-agent,代碼行數:29,代碼來源:envs.py

示例3: create_flash_env

# 需要導入模塊: import universe [as 別名]
# 或者: from universe import runtime_spec [as 別名]
def create_flash_env(env_id, client_id, remotes, **_):
    env = gym.make(env_id)
    env = Vision(env)
    env = Logger(env)
    env = BlockingReset(env)

    reg = universe.runtime_spec('flashgames').server_registry
    height = reg[env_id]["height"]
    width = reg[env_id]["width"]
    env = CropScreen(env, height, width, 84, 18)
    env = FlashRescale(env)

    keys = ['left', 'right', 'up', 'down', 'x']
    if env_id == 'flashgames.NeonRace-v0':
        # Better key space for this game.
        keys = ['left', 'right', 'up', 'left up', 'right up', 'down', 'up x']
    logger.info('create_flash_env(%s): keys=%s', env_id, keys)

    env = DiscreteToFixedKeysVNCActions(env, keys)
    env = EpisodeID(env)
    env = DiagnosticsInfo(env)
    env = Unvectorize(env)
    env.configure(
        fps=5.0,
        remotes=remotes,
        start_timeout=15 * 60,
        client_id=client_id,
        vnc_driver='go',
        vnc_kwargs={
            'encoding': 'tight',
            'compress_level': 0,
            'fine_quality_level': 50,
            'subsample_level': 3
        })
    return env 
開發者ID:gsastry,項目名稱:human-rl,代碼行數:37,代碼來源:envs.py


注:本文中的universe.runtime_spec方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。