File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/envs/browsergym_env/server Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 88- WorkArena: Enterprise task automation
99"""
1010
11+ import importlib
1112from typing import Any , Dict , Optional
1213from uuid import uuid4
1314
@@ -66,6 +67,25 @@ def __init__(
6667 else :
6768 self .env_id = f"browsergym/{ benchmark } "
6869
70+ # force import the benchmark module
71+ benchmark_modules = {
72+ "miniwob" : "browsergym.envs.miniwob" ,
73+ "webarena" : "browsergym.envs.webarena" ,
74+ "visualwebarena" : "browsergym.envs.visualwebarena" ,
75+ "workarena" : "browsergym.envs.workarena" ,
76+ }
77+ module_path = benchmark_modules .get (benchmark )
78+ try :
79+ if module_path :
80+ importlib .import_module (module_path )
81+ else :
82+ importlib .import_module ("browsergym" )
83+ except ModuleNotFoundError as import_error :
84+ raise ValueError (
85+ f"Failed to import BrowserGym benchmark '{ benchmark } ': { import_error } \n "
86+ f"Make sure the package browsergym-{ benchmark } is installed."
87+ ) from import_error
88+
6989 # Create the BrowserGym environment
7090 try :
7191 self .gym_env = gym .make (
You can’t perform that action at this time.
0 commit comments