file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
python/ray/tune/suggest/nevergrad.py
Python
import logging import pickle try: import nevergrad as ng except ImportError: ng = None from ray.tune.suggest.suggestion import SuggestionAlgorithm logger = logging.getLogger(__name__) class NevergradSearch(SuggestionAlgorithm): """A wrapper around Nevergrad to provide trial suggestions. Requires Ne...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/suggest/search.py
Python
class SearchAlgorithm: """Interface of an event handler API for hyperparameter search. Unlike TrialSchedulers, SearchAlgorithms will not have the ability to modify the execution (i.e., stop and pause trials). Trials added manually (i.e., via the Client API) will also notify this class upon new eve...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/suggest/sigopt.py
Python
import copy import os import logging import pickle try: import sigopt as sgo except ImportError: sgo = None from ray.tune.suggest.suggestion import SuggestionAlgorithm logger = logging.getLogger(__name__) class SigOptSearch(SuggestionAlgorithm): """A wrapper around SigOpt to provide trial suggestions. ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/suggest/skopt.py
Python
import logging import pickle try: import skopt as sko except ImportError: sko = None from ray.tune.suggest.suggestion import SuggestionAlgorithm logger = logging.getLogger(__name__) def _validate_warmstart(parameter_names, points_to_evaluate, evaluated_rewards): if points_to_eval...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/suggest/suggestion.py
Python
import itertools import copy from ray.tune.error import TuneError from ray.tune.experiment import convert_to_experiment_list from ray.tune.config_parser import make_parser, create_trial_from_spec from ray.tune.suggest.search import SearchAlgorithm from ray.tune.suggest.variant_generator import format_vars, resolve_nes...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/suggest/variant_generator.py
Python
import copy import logging import numpy import random import types from ray.tune import TuneError from ray.tune.sample import sample_from logger = logging.getLogger(__name__) def generate_variants(unresolved_spec): """Generates variants from a spec (dict) with unresolved values. There are two types of unre...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/sync_client.py
Python
import distutils import distutils.spawn import logging import subprocess import tempfile import types from shlex import quote from ray.tune.error import TuneError logger = logging.getLogger(__name__) S3_PREFIX = "s3://" GS_PREFIX = "gs://" ALLOWED_REMOTE_PREFIXES = (S3_PREFIX, GS_PREFIX) noop_template = ": {target...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/syncer.py
Python
import distutils import logging import os import time from shlex import quote from ray import services from ray.tune.cluster_info import get_ssh_key, get_ssh_user from ray.tune.sync_client import (CommandBasedClient, get_sync_client, get_cloud_sync_client, NOOP) logger = logging.get...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/example.py
Python
# flake8: noqa # This is an example quickstart for Tune. # To connect to a cluster, uncomment below: # import ray # import argparse # parser = argparse.ArgumentParser() # parser.add_argument("--address") # args = parser.parse_args() # ray.init(address=args.address) # __quick_start_begin__ import torch.optim as optim...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_actor_reuse.py
Python
import unittest import ray from ray.tune import Trainable, run_experiments from ray.tune.error import TuneError from ray.tune.schedulers.trial_scheduler import FIFOScheduler, TrialScheduler class FrequentPausesScheduler(FIFOScheduler): def on_trial_result(self, trial_runner, trial, result): return TrialS...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_api.py
Python
import shutil import copy import os import time import unittest from unittest.mock import patch import ray from ray.rllib import _register_all from ray import tune from ray.tune import DurableTrainable, Trainable, TuneError from ray.tune import register_env, register_trainable, run_experiments from ray.tune.schedule...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_automl_searcher.py
Python
import random import unittest from ray.tune import register_trainable from ray.tune.automl import SearchSpace, DiscreteSpace, GridSearch class AutoMLSearcherTest(unittest.TestCase): def setUp(self): def dummy_train(config, reporter): reporter(timesteps_total=100, done=True) register_...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_checkpoint_manager.py
Python
# coding: utf-8 import random import sys import unittest from unittest.mock import patch from ray.tune.checkpoint_manager import Checkpoint, CheckpointManager, logger class CheckpointManagerTest(unittest.TestCase): @staticmethod def mock_result(i): return {"i": i} def checkpoint_manager(self, ke...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_cluster.py
Python
import inspect import json import time import os import pytest import shutil import sys from unittest.mock import MagicMock, patch import ray from ray import tune from ray.rllib import _register_all from ray.cluster_utils import Cluster from ray.test_utils import run_string_as_driver_nonblocking from ray.tune import r...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_commands.py
Python
import click import os import pytest import subprocess import sys import time try: from cStringIO import StringIO except ImportError: from io import StringIO import ray from ray import tune from ray.rllib import _register_all from ray.tune import commands from ray.tune.result import CONFIG_PREFIX class Captu...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_dependency.py
Python
#!/usr/bin/env python import sys import ray from ray.tune import register_trainable, run_experiments def f(config, reporter): reporter(timesteps_total=1) if __name__ == "__main__": ray.init() register_trainable("my_class", f) run_experiments({ "test": { "run": "my_class", ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_experiment.py
Python
import unittest import ray from ray.rllib import _register_all from ray.tune import register_trainable from ray.tune.experiment import Experiment, convert_to_experiment_list from ray.tune.error import TuneError class ExperimentTest(unittest.TestCase): def tearDown(self): ray.shutdown() _register_...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_experiment_analysis.py
Python
import unittest import shutil import tempfile import random import os import pandas as pd import ray from ray.tune import run, sample_from from ray.tune.examples.async_hyperband_example import MyTrainableClass class ExperimentAnalysisSuite(unittest.TestCase): def setUp(self): ray.init(local_mode=False) ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_experiment_analysis_mem.py
Python
import unittest import shutil import tempfile import random import pandas as pd import ray from ray.tune import run, Trainable, sample_from, Analysis, grid_search from ray.tune.examples.async_hyperband_example import MyTrainableClass class ExperimentAnalysisInMemorySuite(unittest.TestCase): def setUp(self): ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_logger.py
Python
from collections import namedtuple import unittest import tempfile import shutil from ray.tune.logger import tf2_compat_logger, JsonLogger, CSVLogger, TBXLogger Trial = namedtuple("MockTrial", ["evaluated_params", "trial_id"]) def result(t, rew): return dict( time_total_s=t, episode_reward_mean=...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_progress_reporter.py
Python
import collections import time import unittest from unittest.mock import MagicMock from ray.tune.trial import Trial from ray.tune.progress_reporter import _fair_filter_trials class ProgressReporterTest(unittest.TestCase): def mock_trial(self, status, start_time): mock = MagicMock() mock.status = ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_ray_trial_executor.py
Python
# coding: utf-8 import json import unittest import ray from ray.rllib import _register_all from ray.tune import Trainable from ray.tune.ray_trial_executor import RayTrialExecutor from ray.tune.registry import _global_registry, TRAINABLE_CLASS from ray.tune.suggest import BasicVariantGenerator from ray.tune.trial impor...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_run_experiment.py
Python
import os import unittest import ray from ray.rllib import _register_all from ray.tune.result import TIMESTEPS_TOTAL from ray.tune import Trainable, TuneError from ray.tune import register_trainable, run_experiments from ray.tune.logger import Logger from ray.tune.experiment import Experiment from ray.tune.trial impo...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_sync.py
Python
import glob import os import shutil import sys import tempfile import unittest from unittest.mock import patch import ray from ray.rllib import _register_all from ray import tune from ray.tune import TuneError from ray.tune.syncer import CommandBasedClient class TestSyncFunctionality(unittest.TestCase): def set...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_track.py
Python
import os import pandas as pd import unittest import ray from ray import tune from ray.tune import track from ray.tune.result import EXPR_PARAM_FILE, EXPR_RESULT_FILE def _check_json_val(fname, key, val): with open(fname, "r") as f: df = pd.read_json(f, typ="frame", lines=True) return key in df.c...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_trainable_util.py
Python
import os import pickle import shutil import unittest from ray.tune.trainable import TrainableUtil class TrainableUtilTest(unittest.TestCase): def setUp(self): self.checkpoint_dir = "/tmp/tune/MyTrainable123" TrainableUtil.make_checkpoint_dir(self.checkpoint_dir) def tearDown(self): ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_trial_runner.py
Python
import sys import unittest import ray from ray.rllib import _register_all from ray import tune from ray.tune import TuneError, register_trainable from ray.tune.ray_trial_executor import RayTrialExecutor from ray.tune.schedulers import TrialScheduler, FIFOScheduler from ray.tune.trial import Trial from ray.tune.trial_...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_trial_runner_2.py
Python
import os import sys import unittest from unittest.mock import patch import ray from ray.rllib import _register_all from ray.tune import TuneError from ray.tune.schedulers import FIFOScheduler from ray.tune.result import DONE from ray.tune.registry import _global_registry, TRAINABLE_CLASS from ray.tune.trial import T...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_trial_runner_3.py
Python
import os import shutil import sys import tempfile import unittest import ray from ray.rllib import _register_all from ray.tune import TuneError from ray.tune.schedulers import TrialScheduler, FIFOScheduler from ray.tune.experiment import Experiment from ray.tune.trial import Trial from ray.tune.trial_runner import T...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_trial_scheduler.py
Python
import os import json import random import unittest import numpy as np import sys import tempfile import shutil from unittest.mock import MagicMock import ray from ray.tune.result import TRAINING_ITERATION from ray.tune.schedulers import (HyperBandScheduler, AsyncHyperBandScheduler, Po...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_tune_restore.py
Python
# coding: utf-8 import os import shutil import tempfile import unittest import skopt import numpy as np from hyperopt import hp from nevergrad.optimization import optimizerlib import ray from ray import tune from ray.test_utils import recursive_fnmatch from ray.rllib import _register_all from ray.tune.suggest.hyperopt...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_tune_save_restore.py
Python
# coding: utf-8 import os import pickle import shutil import tempfile import unittest import ray from ray import tune from ray.rllib import _register_all from ray.tune import Trainable class SerialTuneRelativeLocalDirTest(unittest.TestCase): local_mode = True prefix = "Serial" class MockTrainable(Traina...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_tune_server.py
Python
import unittest import socket import subprocess import json import ray from ray.rllib import _register_all from ray.tune.trial import Trial, Resources from ray.tune.web_server import TuneClient from ray.tune.trial_runner import TrialRunner def get_valid_port(): port = 4321 while True: try: ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/test_var.py
Python
import os import numpy as np import unittest import ray from ray.rllib import _register_all from ray import tune from ray.tune.result import DEFAULT_RESULTS_DIR from ray.tune.experiment import Experiment from ray.tune.suggest import grid_search, BasicVariantGenerator from ray.tune.suggest.suggestion import _MockSugge...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tests/tutorial.py
Python
# flake8: noqa # Original Code: https://github.com/pytorch/examples/blob/master/mnist/main.py # yapf: disable # __tutorial_imports_begin__ import numpy as np import torch import torch.optim as optim from torchvision import datasets from ray import tune from ray.tune import track from ray.tune.schedulers import ASHASc...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/track/__init__.py
Python
import logging from ray.tune.track.session import TrackSession logger = logging.getLogger(__name__) _session = None def get_session(): global _session if not _session: raise ValueError("Session not detected. Try `track.init()`?") return _session def init(ignore_reinit_error=True, **session_kw...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/track/session.py
Python
import os from datetime import datetime from ray.tune.trial import Trial from ray.tune.result import DEFAULT_RESULTS_DIR, TRAINING_ITERATION from ray.tune.logger import UnifiedLogger, Logger class _ReporterHook(Logger): def __init__(self, tune_reporter): self.tune_reporter = tune_reporter def on_res...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/trainable.py
Python
from datetime import datetime import copy import io import logging import glob import os import pickle import pandas as pd from six import string_types import shutil import tempfile import time import uuid import ray from ray.tune.logger import UnifiedLogger from ray.tune.result import (DEFAULT_RESULTS_DIR, TIME_THIS...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/trial.py
Python
import ray.cloudpickle as cloudpickle import copy from datetime import datetime import logging import shutil import uuid import time import tempfile import os from numbers import Number from ray.tune import TuneError from ray.tune.checkpoint_manager import Checkpoint, CheckpointManager from ray.tune.durable_trainable i...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/trial_executor.py
Python
# coding: utf-8 import logging from ray.tune.trial import Trial, Checkpoint from ray.tune.error import TuneError logger = logging.getLogger(__name__) class TrialExecutor: """Manages platform-specific details such as resource handling and starting/stopping trials. """ def __init__(self, queue_trials...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/trial_runner.py
Python
import click from datetime import datetime import json import logging import os import time import traceback import types import ray.cloudpickle as cloudpickle from ray.tune import TuneError from ray.tune.progress_reporter import trial_progress_str from ray.tune.ray_trial_executor import RayTrialExecutor from ray.tune...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/tune.py
Python
import logging import time import six from ray.tune.error import TuneError from ray.tune.experiment import convert_to_experiment_list, Experiment from ray.tune.analysis import ExperimentAnalysis from ray.tune.suggest import BasicVariantGenerator from ray.tune.trial import Trial, DEBUG_PRINT_INTERVAL from ray.tune.trai...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/utils/__init__.py
Python
from ray.tune.utils.util import (deep_update, flatten_dict, get_pinned_object, merge_dicts, pin_in_object_store, UtilMonitor, validate_save_restore, warn_if_slow) __all__ = [ "deep_update", "flatten_dict", "get_pinned_object", "merge_dicts", "pi...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/utils/mock.py
Python
import os from ray.rllib.agents.mock import _MockTrainer from ray.tune import DurableTrainable from ray.tune.sync_client import get_sync_client from ray.tune.syncer import NodeSyncer MOCK_REMOTE_DIR = "/tmp/mock-tune-remote/" # Sync and delete templates that operate on local directories. LOCAL_SYNC_TEMPLATE = "mkdir ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/utils/util.py
Python
import copy import logging import threading import time from collections import defaultdict from threading import Thread import numpy as np import ray logger = logging.getLogger(__name__) try: import psutil except ImportError: psutil = None try: import GPUtil except ImportError: GPUtil = None _pinn...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/utils/visual_utils.py
Python
import pandas as pd from pandas.api.types import is_string_dtype, is_numeric_dtype import logging import os import os.path as osp import numpy as np import json from ray.tune.utils import flatten_dict logger = logging.getLogger(__name__) logger.warning("This module will be deprecated in a future version of Tune.") ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tune/web_server.py
Python
import json import logging import threading from urllib.parse import urljoin, urlparse from http.server import SimpleHTTPRequestHandler, HTTPServer import ray.cloudpickle as cloudpickle from ray.tune import TuneError from ray.tune.suggest import BasicVariantGenerator from ray.utils import binary_to_hex, hex_to_binary...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/utils.py
Python
import binascii import errno import hashlib import inspect import logging import numpy as np import os import six import subprocess import sys import threading import time import uuid import ray.gcs_utils import ray.ray_constants as ray_constants def _random_string(): id_hash = hashlib.sha1() id_hash.update(...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/worker.py
Python
from contextlib import contextmanager import colorama import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import signal from six.moves import queue import sys import threading import time import traceback import random # Ray modules import ray.clo...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/workers/default_worker.py
Python
import argparse import json import ray import ray.actor import ray.node import ray.ray_constants as ray_constants import ray.utils from ray.parameter import RayParams parser = argparse.ArgumentParser( description=("Parse addresses for the worker " "to connect to.")) parser.add_argument( "--no...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/setup.py
Python
from itertools import chain import os import re import shutil import subprocess import sys from setuptools import setup, find_packages, Distribution import setuptools.command.build_ext as _build_ext # Ideally, we could include these files by putting them in a # MANIFEST.in or using the package_data argument to setup,...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/__init__.py
Python
import logging # Note: do not introduce unnecessary library dependencies here, e.g. gym. # This file is imported from the tune module in order to register RLlib agents. from ray.rllib.env.base_env import BaseEnv from ray.rllib.env.external_env import ExternalEnv from ray.rllib.env.multi_agent_env import MultiAgentEnv ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/__init__.py
Python
from ray.rllib.agents.trainer import Trainer, with_common_config from ray.rllib.agents.agent import Agent __all__ = ["Agent", "Trainer", "with_common_config"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/a3c/__init__.py
Python
from ray.rllib.agents.a3c.a3c import A3CTrainer, DEFAULT_CONFIG from ray.rllib.agents.a3c.a2c import A2CTrainer from ray.rllib.utils import renamed_agent A2CAgent = renamed_agent(A2CTrainer) A3CAgent = renamed_agent(A3CTrainer) __all__ = [ "A2CAgent", "A3CAgent", "A2CTrainer", "A3CTrainer", "DEFAULT_CONFIG" ]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/a3c/a2c.py
Python
from ray.rllib.agents.a3c.a3c import DEFAULT_CONFIG as A3C_CONFIG, \ validate_config, get_policy_class from ray.rllib.optimizers import SyncSamplesOptimizer, MicrobatchOptimizer from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.util...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/a3c/a3c.py
Python
from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy from ray.rllib.agents.trainer import with_common_config from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.optimizers import AsyncGradientsOptimizer # yapf: disable # __sphinx_doc_begin__ DEFAULT_CONFIG = with_common_config({ # Size...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/a3c/a3c_tf_policy.py
Python
"""Note: Keep in sync with changes to VTraceTFPolicy.""" import ray from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.utils.explained_variance import explained_variance from ray.rllib.evaluation.postprocessing import compute_advantages, \ Postprocessing from ray.rllib.policy.tf_policy_template i...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/a3c/a3c_torch_policy.py
Python
import ray from ray.rllib.evaluation.postprocessing import compute_advantages, \ Postprocessing from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.policy.torch_policy_template import build_torch_policy from ray.rllib.utils.framework import try_import_torch torch, nn = try_import_torch() F = nn.fu...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/agent.py
Python
from ray.rllib.agents.trainer import Trainer from ray.rllib.utils import renamed_agent Agent = renamed_agent(Trainer)
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ars/__init__.py
Python
from ray.rllib.agents.ars.ars import (ARSTrainer, DEFAULT_CONFIG) from ray.rllib.utils import renamed_agent ARSAgent = renamed_agent(ARSTrainer) __all__ = ["ARSAgent", "ARSTrainer", "DEFAULT_CONFIG"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ars/ars.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter and from # https://github.com/modestyachts/ARS from collections import namedtuple import logging import numpy as np import time import ray from ray.rllib.agents import Trainer, with_common_config from ray.rllib.ag...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ars/optimizers.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. import numpy as np class Optimizer: def __init__(self, policy): self.policy = policy self.dim = policy.num_params self.t = 0 def update(self, globalg): self.t += 1 ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ars/policies.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. import gym import numpy as np import ray import ray.experimental.tf_utils from ray.rllib.evaluation.sampler import _unbatch_tuple_actions from ray.rllib.utils.filter import get_filter from ray.rllib.models import ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ars/utils.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. import numpy as np from ray.rllib.utils import try_import_tf tf = try_import_tf() def compute_ranks(x): """Returns ranks in [0, len(x)) Note: This is different from scipy.stats.rankdata, which returns r...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ddpg/__init__.py
Python
from ray.rllib.agents.ddpg.apex import ApexDDPGTrainer from ray.rllib.agents.ddpg.ddpg import DDPGTrainer, DEFAULT_CONFIG from ray.rllib.agents.ddpg.td3 import TD3Trainer from ray.rllib.utils import renamed_agent ApexDDPGAgent = renamed_agent(ApexDDPGTrainer) DDPGAgent = renamed_agent(DDPGTrainer) __all__ = [ "DD...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ddpg/apex.py
Python
from ray.rllib.agents.dqn.apex import APEX_TRAINER_PROPERTIES from ray.rllib.agents.ddpg.ddpg import DDPGTrainer, \ DEFAULT_CONFIG as DDPG_CONFIG from ray.rllib.utils import merge_dicts APEX_DDPG_DEFAULT_CONFIG = merge_dicts( DDPG_CONFIG, # see also the options in ddpg.py, which are also supported { ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ddpg/ddpg.py
Python
from ray.rllib.agents.trainer import with_common_config from ray.rllib.agents.dqn.dqn import GenericOffPolicyTrainer, \ update_worker_explorations from ray.rllib.agents.ddpg.ddpg_policy import DDPGTFPolicy from ray.rllib.utils.schedules import ConstantSchedule, LinearSchedule # yapf: disable # __sphinx_doc_begin__...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ddpg/ddpg_policy.py
Python
from gym.spaces import Box import numpy as np import ray import ray.experimental.tf_utils from ray.rllib.agents.dqn.dqn_policy import _postprocess_dqn from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.evaluation.metrics import LEARNER_STATS_KEY from ray.rllib.models import ModelCatalog from ray.rlli...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ddpg/noop_model.py
Python
from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from ray.rllib.utils.annotations import override from ray.rllib.utils import try_import_tf tf = try_import_tf() class NoopModel(TFModelV2): """Trivial model that just returns the obs flattened. This is the model used if use_state_preprocessor=False.""" ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ddpg/td3.py
Python
"""A more stable successor to TD3. By default, this uses a near-identical configuration to that reported in the TD3 paper. """ from ray.rllib.agents.ddpg.ddpg import DDPGTrainer, \ DEFAULT_CONFIG as DDPG_CONFIG from ray.rllib.utils import merge_dicts TD3_DEFAULT_CONFIG = merge_dicts( DDPG_CONFIG, { ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/__init__.py
Python
from ray.rllib.agents.dqn.apex import ApexTrainer from ray.rllib.agents.dqn.dqn import DQNTrainer, SimpleQTrainer, DEFAULT_CONFIG from ray.rllib.utils import renamed_agent DQNAgent = renamed_agent(DQNTrainer) ApexAgent = renamed_agent(ApexTrainer) __all__ = [ "DQNAgent", "ApexAgent", "ApexTrainer", "DQNTrainer", ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/apex.py
Python
from ray.rllib.agents.dqn.dqn import DQNTrainer, DEFAULT_CONFIG as DQN_CONFIG from ray.rllib.optimizers import AsyncReplayOptimizer from ray.rllib.utils import merge_dicts # yapf: disable # __sphinx_doc_begin__ APEX_DEFAULT_CONFIG = merge_dicts( DQN_CONFIG, # see also the options in dqn.py, which are also support...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/distributional_q_model.py
Python
import numpy as np from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from ray.rllib.utils import try_import_tf tf = try_import_tf() class DistributionalQModel(TFModelV2): """Extension of standard TFModel to provide distributional Q values. It also supports options for noisy nets and parameter space nois...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/dqn.py
Python
import logging from ray.rllib.agents.trainer import with_common_config from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.agents.dqn.dqn_policy import DQNTFPolicy from ray.rllib.agents.dqn.simple_q_policy import SimpleQPolicy from ray.rllib.optimizers import SyncReplayOptimizer from ray.rllib.p...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/dqn_policy.py
Python
from gym.spaces import Discrete import numpy as np from scipy.stats import entropy import ray from ray.rllib.agents.dqn.distributional_q_model import DistributionalQModel from ray.rllib.agents.dqn.simple_q_policy import ExplorationStateMixin, \ TargetNetworkMixin from ray.rllib.policy.sample_batch import SampleBat...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/simple_q_model.py
Python
from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from ray.rllib.utils import try_import_tf tf = try_import_tf() class SimpleQModel(TFModelV2): """Extension of standard TFModel to provide Q values. Data flow: obs -> forward() -> model_out model_out -> get_q_values() -> Q(s, a) Note t...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/dqn/simple_q_policy.py
Python
"""Basic example of a DQN policy without any optimizations.""" from gym.spaces import Discrete import logging import ray from ray.rllib.agents.dqn.simple_q_model import SimpleQModel from ray.rllib.policy.policy import Policy from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.models import ModelCatal...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/es/__init__.py
Python
from ray.rllib.agents.es.es import (ESTrainer, DEFAULT_CONFIG) from ray.rllib.utils import renamed_agent ESAgent = renamed_agent(ESTrainer) __all__ = ["ESAgent", "ESTrainer", "DEFAULT_CONFIG"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/es/es.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. from collections import namedtuple import logging import numpy as np import time import ray from ray.rllib.agents import Trainer, with_common_config from ray.rllib.agents.es import optimizers from ray.rllib.agent...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/es/optimizers.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. import numpy as np class Optimizer: def __init__(self, pi): self.pi = pi self.dim = pi.num_params self.t = 0 def update(self, globalg): self.t += 1 step = self._co...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/es/policies.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. import gym import numpy as np import ray import ray.experimental.tf_utils from ray.rllib.evaluation.sampler import _unbatch_tuple_actions from ray.rllib.models import ModelCatalog from ray.rllib.utils.filter impor...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/es/utils.py
Python
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. import numpy as np from ray.rllib.utils import try_import_tf tf = try_import_tf() def compute_ranks(x): """Returns ranks in [0, len(x)) Note: This is different from scipy.stats.rankdata, which returns r...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/impala/__init__.py
Python
from ray.rllib.agents.impala.impala import ImpalaTrainer, DEFAULT_CONFIG from ray.rllib.utils import renamed_agent ImpalaAgent = renamed_agent(ImpalaTrainer) __all__ = ["ImpalaAgent", "ImpalaTrainer", "DEFAULT_CONFIG"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/impala/impala.py
Python
from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy from ray.rllib.agents.impala.vtrace_policy import VTraceTFPolicy from ray.rllib.agents.trainer import Trainer, with_common_config from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.optimizers import AsyncSamplesOptimizer from ray.rllib.o...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/impala/vtrace.py
Python
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/impala/vtrace_policy.py
Python
"""Adapted from A3CTFPolicy to add V-trace. Keep in sync with changes to A3CTFPolicy and VtraceSurrogatePolicy.""" import numpy as np import logging import gym import ray from ray.rllib.agents.impala import vtrace from ray.rllib.models.tf.tf_action_dist import Categorical from ray.rllib.policy.sample_batch import Sa...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/impala/vtrace_test.py
Python
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/marwil/__init__.py
Python
from ray.rllib.agents.marwil.marwil import MARWILTrainer, DEFAULT_CONFIG __all__ = ["MARWILTrainer", "DEFAULT_CONFIG"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/marwil/marwil.py
Python
from ray.rllib.agents.trainer import with_common_config from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.agents.marwil.marwil_policy import MARWILPolicy from ray.rllib.optimizers import SyncBatchReplayOptimizer # yapf: disable # __sphinx_doc_begin__ DEFAULT_CONFIG = with_common_config({ #...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/marwil/marwil_policy.py
Python
import ray from ray.rllib.models import ModelCatalog from ray.rllib.evaluation.postprocessing import compute_advantages, \ Postprocessing from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.evaluation.metrics import LEARNER_STATS_KEY from ray.rllib.utils.annotations import override from ray.rllib.p...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/mock.py
Python
import os import pickle import numpy as np from ray.tune import result as tune_result from ray.rllib.agents.trainer import Trainer, with_common_config class _MockTrainer(Trainer): """Mock trainer for use in tests""" _name = "MockTrainer" _default_config = with_common_config({ "mock_error": False...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/pg/__init__.py
Python
from ray.rllib.agents.pg.pg import PGTrainer, DEFAULT_CONFIG from ray.rllib.agents.pg.pg_tf_policy import pg_tf_loss, \ post_process_advantages from ray.rllib.agents.pg.pg_torch_policy import pg_torch_loss __all__ = ["PGTrainer", "pg_tf_loss", "pg_torch_loss", "post_process_advantages", "DEFAULT_CONFIG"...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/pg/pg.py
Python
from ray.rllib.agents.trainer import with_common_config from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.agents.pg.pg_tf_policy import PGTFPolicy # yapf: disable # __sphinx_doc_begin__ DEFAULT_CONFIG = with_common_config({ # No remote workers by default. "num_workers": 0, # Learni...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/pg/pg_tf_policy.py
Python
import ray from ray.rllib.evaluation.postprocessing import Postprocessing, \ compute_advantages from ray.rllib.policy.tf_policy_template import build_tf_policy from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.utils import try_import_tf tf = try_import_tf() def post_process_advantages(policy, ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/pg/pg_torch_policy.py
Python
import ray from ray.rllib.agents.pg.pg_tf_policy import post_process_advantages from ray.rllib.evaluation.postprocessing import Postprocessing from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.policy.torch_policy_template import build_torch_policy from ray.rllib.utils.framework import try_import_torc...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/pg/tests/test_pg.py
Python
import numpy as np import unittest import ray import ray.rllib.agents.pg as pg from ray.rllib.evaluation.postprocessing import Postprocessing from ray.rllib.models.tf.tf_action_dist import Categorical from ray.rllib.models.torch.torch_action_dist import TorchCategorical from ray.rllib.policy.sample_batch import Sample...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ppo/__init__.py
Python
from ray.rllib.agents.ppo.ppo import PPOTrainer, DEFAULT_CONFIG from ray.rllib.agents.ppo.appo import APPOTrainer from ray.rllib.utils import renamed_agent PPOAgent = renamed_agent(PPOTrainer) __all__ = ["PPOAgent", "APPOTrainer", "PPOTrainer", "DEFAULT_CONFIG"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ppo/appo.py
Python
from ray.rllib.agents.ppo.appo_policy import AsyncPPOTFPolicy from ray.rllib.agents.trainer import with_base_config from ray.rllib.agents.ppo.ppo import update_kl from ray.rllib.agents import impala # yapf: disable # __sphinx_doc_begin__ DEFAULT_CONFIG = with_base_config(impala.DEFAULT_CONFIG, { # Whether to use V...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ppo/appo_policy.py
Python
"""Adapted from VTraceTFPolicy to use the PPO surrogate loss. Keep in sync with changes to VTraceTFPolicy.""" import numpy as np import logging import gym from ray.rllib.agents.impala import vtrace from ray.rllib.agents.impala.vtrace_policy import _make_time_major, \ BEHAVIOUR_LOGITS, clip_gradients, validat...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
rllib/agents/ppo/ppo.py
Python
import logging from ray.rllib.agents import with_common_config from ray.rllib.agents.ppo.ppo_policy import PPOTFPolicy from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.optimizers import SyncSamplesOptimizer, LocalMultiGPUOptimizer from ray.rllib.utils import try_import_tf tf = try_import_tf(...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta