Skip to content

Commit

Permalink
visualwebarena massage (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
gasse authored Nov 7, 2024
1 parent d53fd5e commit 8712f8d
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import logging
import os
from typing import Literal

import gymnasium as gym
import numpy as np

from browsergym.experiments.loop import SEED_MAX, EnvArgs

logger = logging.getLogger(__name__)


def make_env_args_list_from_workarena_curriculum(
level: Literal["l1", "l2", "l3"],
Expand Down Expand Up @@ -122,6 +126,32 @@ def prepare_backend(backend: str):
default_instance = VisualWebArenaInstance()
default_instance.full_reset()

vwa_massage_task_ids = [
0, # classifieds
33, # classifieds
150, # classifieds
253, # reddit
325, # reddit
390, # reddit
444, # shopping
555, # shopping
666, # shopping
]
for task_id in vwa_massage_task_ids:
gym_id = f"browsergym/visualwebarena.{task_id}"
logger.info(
f"VisualWebArena instance massaging {task_id} / {len(vwa_massage_task_ids)} ({gym_id} reset)"
)
env = gym.make(gym_id)
try:
env.reset() # task setup and logging
except Exception as e:
logger.warning(
f"Error during VisualWebArena instance massaging ({gym_id} reset): {e}"
)
finally:
env.close()

case "workarena":
# register environments
import browsergym.workarena
Expand Down

0 comments on commit 8712f8d

Please sign in to comment.