Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# n_jobs = -1 # to use all available cores


if __name__ == "__main__": # necessary for dask backend
if __name__ == "__main__": # necessary for multiprocessing backends

if reproducibility_mode:
[a.set_reproducibility_mode() for a in agent_args]
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ classifiers = [
]
dependencies = [
"pydantic~=2.9",
"dask",
"distributed",
"browsergym>=0.7.1",
"joblib>=1.2.0",
"openai>=1.7,<2",
Expand Down
43 changes: 1 addition & 42 deletions src/agentlab/experiments/exp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
from pathlib import Path
from time import sleep, time

from tqdm import tqdm

from agentlab.experiments.loop import ExpArgs, yield_all_exp_results
from agentlab.experiments.loop import ExpArgs

logger = logging.getLogger(__name__) # Get logger based on module name

Expand Down Expand Up @@ -150,42 +148,3 @@ def run(self):
sleep(3) # Simulate task execution time
self.end_time = time()
return self


def make_seeds(n, offset=42):
raise DeprecationWarning("This function will be removed. Comment out this error if needed.")
return [seed + offset for seed in range(n)]


def order(exp_args_list: list[ExpArgs]):
raise DeprecationWarning("This function will be removed. Comment out this error if needed.")
"""Store the order of the list of experiments to be able to sort them back.

This is important for progression or ablation studies.
"""
for i, exp_args in enumerate(exp_args_list):
exp_args.order = i
return exp_args_list


# This was an old function for filtering some issue with the experiments.
def hide_some_exp(base_dir, filter: callable, just_test):
"""Move all experiments that match the filter to a new name."""
raise DeprecationWarning("This function will be removed. Comment out this error if needed.")
exp_list = list(yield_all_exp_results(base_dir, progress_fn=None))

msg = f"Searching {len(exp_list)} experiments to move to _* expriments where `filter(exp_args)` is True."
if just_test:
msg += "\nNote: This is a just a test, no experiments will be moved. Set `just_test=False` to move them."

logging.info(msg)

exp_list = tqdm(exp_list, desc="Filtering experiments.")

filtered_out = []
for exp in exp_list:
if filter(exp):
if not just_test:
_move_old_exp(exp.exp_dir)
filtered_out.append(exp)
return filtered_out
11 changes: 1 addition & 10 deletions src/agentlab/experiments/launch_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def run_experiments(
"""Run a list of ExpArgs in parallel.

To ensure optimal parallelism, make sure ExpArgs.depend_on is set correctly
and the backend is set to dask.
and the backend is set to ray.

Args:
n_jobs: int
Expand Down Expand Up @@ -70,15 +70,6 @@ def run_experiments(
for exp_args in exp_args_list
)

# dask will be deprecated, as there was issues. use ray instead
# elif parallel_backend == "dask":
# from agentlab.experiments.graph_execution_dask import (
# execute_task_graph,
# make_dask_client,
# )

# with make_dask_client(n_worker=n_jobs):
# execute_task_graph(exp_args_list)
elif parallel_backend == "ray":
from agentlab.experiments.graph_execution_ray import execute_task_graph, ray

Expand Down
33 changes: 0 additions & 33 deletions src/agentlab/llm/chat_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,39 +160,6 @@ def make_model(self):
raise ValueError(f"Backend {self.backend} is not supported")


@dataclass
class ChatModelArgs(BaseModelArgs):
"""Object added for backward compatibility with the old ChatModelArgs."""

model_path: str = None
model_url: str = None
model_size: str = None
training_total_tokens: int = None
hf_hosted: bool = False
is_model_operational: str = False
sliding_window: bool = False
n_retry_server: int = 4
infer_tokens_length: bool = False
vision_support: bool = False
shard_support: bool = True
extra_tgi_args: dict = None
tgi_image: str = None
info: dict = None

def __post_init__(self):
import warnings

warnings.simplefilter("always", DeprecationWarning)
warnings.warn(
"ChatModelArgs is deprecated and used only for xray. Use one of the specific model args classes instead.",
DeprecationWarning,
)
warnings.simplefilter("default", DeprecationWarning)

def make_model(self):
pass


def _extract_wait_time(error_message, min_retry_wait_time=60):
"""Extract the wait time from an OpenAI RateLimitError message."""
match = re.search(r"try again in (\d+(\.\d+)?)s", error_message)
Expand Down
2 changes: 1 addition & 1 deletion tutorials/2_eval_on_miniwob/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
## Number of parallel jobs
n_jobs = 4 # Make sure to use 1 job when debugging in VSCode

if __name__ == "__main__": # necessary for dask backend
if __name__ == "__main__": # necessary for multiprocessing backends

# A study evaluates multiple agents on a benchmark
study = Study(agent_configs, benchmark)
Expand Down
Loading
Loading