id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
11,300
ray-project/ray
rllib/core/models/configs.py
rllib.core.models.configs.RecurrentEncoderConfig
from typing import Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, Union from dataclasses import dataclass, field from ray.rllib.utils.annotations import ExperimentalAPI @ExperimentalAPI @dataclass class RecurrentEncoderConfig(ModelConfig): """Configuration for an LSTM-based or a GRU-based encoder. The ...
@ExperimentalAPI @dataclass class RecurrentEncoderConfig(ModelConfig): '''Configuration for an LSTM-based or a GRU-based encoder. The encoder consists of... - Zero or one tokenizers - N LSTM/GRU layers stacked on top of each other and feeding their outputs as inputs to the respective next layer. ...
8
2
12
0
11
0
3
1.81
1
2
0
0
3
0
3
25
151
19
47
24
33
85
27
16
21
4
5
1
8
11,301
ray-project/ray
rllib/core/models/configs.py
rllib.core.models.configs._MLPConfig
from dataclasses import dataclass, field from ray.rllib.models.utils import get_activation_fn, get_initializer_fn from typing import Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, Union from ray.rllib.utils.annotations import ExperimentalAPI @ExperimentalAPI @dataclass class _MLPConfig(ModelConfig): """Gene...
@ExperimentalAPI @dataclass class _MLPConfig(ModelConfig): '''Generic configuration class for multi-layer-perceptron based Model classes. `output_dims` is reached by either the provided `output_layer_dim` setting (int) OR by the last entry of `hidden_layer_dims`. In the latter case, no special output la...
6
2
18
1
15
2
3
1.49
1
3
0
3
2
0
2
24
132
10
49
21
45
73
35
20
32
4
5
1
6
11,302
ray-project/ray
rllib/core/models/specs/specs_base.py
rllib.core.models.specs.specs_base.Spec
from ray._common.deprecation import Deprecated @Deprecated(help='The Spec checking APIs have been deprecated and cancelled without replacement.', error=True) class Spec: pass
@Deprecated(help='The Spec checking APIs have been deprecated and cancelled without replacement.', error=True) class Spec: pass
2
0
2
0
2
0
1
0
1
0
0
2
0
0
1
21
5
0
5
3
1
0
3
2
1
1
4
0
1
11,303
ray-project/ray
rllib/core/models/specs/specs_base.py
rllib.core.models.specs.specs_base.TensorSpec
from ray._common.deprecation import Deprecated @Deprecated(help='The Spec checking APIs have been deprecated and cancelled without replacement.', error=True) class TensorSpec: pass
@Deprecated(help='The Spec checking APIs have been deprecated and cancelled without replacement.', error=True) class TensorSpec: pass
2
0
8
1
7
0
3
0.01
1
8
0
0
18
5
18
39
164
30
133
50
101
1
96
37
77
7
5
3
46
11,304
ray-project/ray
rllib/core/models/specs/specs_base.py
rllib.core.models.specs.specs_base.TypeSpec
from ray._common.deprecation import Deprecated @Deprecated(help='The Spec checking APIs have been deprecated and cancelled without replacement.', error=True) class TypeSpec: pass
@Deprecated(help='The Spec checking APIs have been deprecated and cancelled without replacement.', error=True) class TypeSpec: pass
2
0
3
0
3
0
1
0
1
3
0
0
5
1
5
26
18
4
14
7
8
0
14
7
8
2
5
1
7
11,305
ray-project/ray
rllib/core/models/specs/specs_dict.py
rllib.core.models.specs.specs_dict.SpecDict
from ray._common.deprecation import Deprecated @Deprecated(help='The SpecDict API has been deprecated and cancelled without replacement.', error=True) class SpecDict: pass
@Deprecated(help='The SpecDict API has been deprecated and cancelled without replacement.', error=True) class SpecDict: pass
2
0
21
3
18
0
5
0
2
5
0
0
1
0
2
29
63
10
53
14
44
0
31
8
27
13
2
3
16
11,306
ray-project/ray
rllib/core/models/torch/base.py
rllib.core.models.torch.base.TorchModel
from ray.rllib.core.models.configs import ModelConfig from ray.rllib.core.models.base import Model from ray.rllib.utils.typing import TensorType import abc from ray.rllib.utils.annotations import override from typing import Tuple, Union class TorchModel(nn.Module, Model, abc.ABC): """Base class for RLlib's PyTorch...
class TorchModel(nn.Module, Model, abc.ABC): '''Base class for RLlib's PyTorch models. This class defines the interface for RLlib's PyTorch models. Example usage for a single Flattening layer: .. testcode:: from ray.rllib.core.models.configs import ModelConfig from ray.rllib.core.models...
7
3
10
1
6
3
1
1.48
3
4
0
0
4
0
4
24
81
19
25
16
16
37
18
12
13
2
4
2
5
11,307
ray-project/ray
rllib/core/models/torch/encoder.py
rllib.core.models.torch.encoder.TorchActorCriticEncoder
from ray.rllib.core.models.torch.base import TorchModel from ray.rllib.core.models.configs import ActorCriticEncoderConfig, CNNEncoderConfig, MLPEncoderConfig, RecurrentEncoderConfig from ray.rllib.core.models.base import Encoder, ActorCriticEncoder, StatefulActorCriticEncoder, ENCODER_OUT class TorchActorCriticEncode...
class TorchActorCriticEncoder(TorchModel, ActorCriticEncoder): '''An actor-critic encoder for torch.''' def __init__(self, config: ActorCriticEncoderConfig) -> None: pass
2
1
3
0
3
0
1
0.2
2
0
0
0
1
0
1
1
8
2
5
3
3
1
5
3
3
1
1
0
1
11,308
ray-project/ray
rllib/core/models/torch/encoder.py
rllib.core.models.torch.encoder.TorchCNNEncoder
from ray.rllib.utils.annotations import override from ray.rllib.core.models.torch.base import TorchModel from ray.rllib.core.models.base import Encoder, ActorCriticEncoder, StatefulActorCriticEncoder, ENCODER_OUT from ray.rllib.core.models.base import Model, tokenize from ray.rllib.core.columns import Columns from ray....
class TorchCNNEncoder(TorchModel, Encoder): def __init__(self, config: CNNEncoderConfig) -> None: pass @override(Model) def _forward(self, inputs: dict, **kwargs) -> dict: pass
4
0
14
2
11
2
2
0.13
2
1
0
0
2
1
2
2
30
4
23
7
19
3
12
6
9
2
1
1
3
11,309
ray-project/ray
rllib/core/models/torch/encoder.py
rllib.core.models.torch.encoder.TorchGRUEncoder
import tree from ray.rllib.core.models.torch.base import TorchModel from ray.rllib.utils.annotations import override from ray.rllib.core.models.configs import ActorCriticEncoderConfig, CNNEncoderConfig, MLPEncoderConfig, RecurrentEncoderConfig from ray.rllib.core.columns import Columns from ray.rllib.models.utils impor...
class TorchGRUEncoder(TorchModel, Encoder): '''A recurrent GRU encoder. This encoder has... - Zero or one tokenizers. - One or more GRU layers. ''' def __init__(self, config: RecurrentEncoderConfig) -> None: pass @override(Model) def get_initial_state(self): pass @o...
6
1
23
3
17
3
2
0.26
2
1
0
0
3
2
3
3
81
13
54
16
48
14
30
14
26
4
1
1
7
11,310
ray-project/ray
rllib/core/models/torch/encoder.py
rllib.core.models.torch.encoder.TorchLSTMEncoder
from ray.rllib.models.utils import get_initializer_fn from ray.rllib.core.columns import Columns import tree from ray.rllib.core.models.configs import ActorCriticEncoderConfig, CNNEncoderConfig, MLPEncoderConfig, RecurrentEncoderConfig from ray.rllib.core.models.base import Encoder, ActorCriticEncoder, StatefulActorCri...
class TorchLSTMEncoder(TorchModel, Encoder): '''A recurrent LSTM encoder. This encoder has... - Zero or one tokenizers. - One or more LSTM layers. ''' def __init__(self, config: RecurrentEncoderConfig) -> None: pass @override(Model) def get_initial_state(self): pass ...
6
1
25
3
20
3
3
0.21
2
1
0
0
3
2
3
3
88
13
62
17
56
13
33
15
29
5
1
2
8
11,311
ray-project/ray
rllib/core/models/torch/encoder.py
rllib.core.models.torch.encoder.TorchMLPEncoder
from ray.rllib.core.models.base import Model, tokenize from ray.rllib.core.columns import Columns from ray.rllib.core.models.configs import ActorCriticEncoderConfig, CNNEncoderConfig, MLPEncoderConfig, RecurrentEncoderConfig from ray.rllib.core.models.torch.primitives import TorchMLP, TorchCNN from ray.rllib.core.model...
class TorchMLPEncoder(TorchModel, Encoder): def __init__(self, config: MLPEncoderConfig) -> None: pass @override(Model) def _forward(self, inputs: dict, **kwargs) -> dict: pass
4
0
16
1
15
1
1
0.03
2
1
0
0
2
1
2
2
34
2
31
5
27
1
7
4
4
1
1
0
2
11,312
ray-project/ray
rllib/core/models/torch/encoder.py
rllib.core.models.torch.encoder.TorchStatefulActorCriticEncoder
from ray.rllib.core.models.torch.base import TorchModel from ray.rllib.core.models.configs import ActorCriticEncoderConfig, CNNEncoderConfig, MLPEncoderConfig, RecurrentEncoderConfig from ray.rllib.core.models.base import Encoder, ActorCriticEncoder, StatefulActorCriticEncoder, ENCODER_OUT class TorchStatefulActorCrit...
class TorchStatefulActorCriticEncoder(TorchModel, StatefulActorCriticEncoder): '''A stateful actor-critic encoder for torch.''' def __init__(self, config: ActorCriticEncoderConfig) -> None: pass
2
1
3
0
3
0
1
0.2
2
0
0
0
1
0
1
1
8
2
5
3
3
1
5
3
3
1
1
0
1
11,313
ray-project/ray
rllib/core/models/torch/heads.py
rllib.core.models.torch.heads.TorchCNNTransposeHead
from ray.rllib.core.models.configs import CNNTransposeHeadConfig, FreeLogStdMLPHeadConfig, MLPHeadConfig from ray.rllib.models.utils import get_initializer_fn from ray.rllib.core.models.torch.base import TorchModel from ray.rllib.core.models.base import Model from ray.rllib.core.models.torch.primitives import TorchCNNT...
class TorchCNNTransposeHead(TorchModel): def __init__(self, config: CNNTransposeHeadConfig) -> None: pass @override(Model) def _forward(self, inputs: torch.Tensor, **kwargs) -> torch.Tensor: pass
4
0
29
2
22
5
2
0.22
1
3
0
0
2
2
2
2
60
5
45
9
41
10
16
8
13
3
1
1
4
11,314
ray-project/ray
rllib/core/models/torch/heads.py
rllib.core.models.torch.heads.TorchFreeLogStdMLPHead
from ray.rllib.core.models.configs import CNNTransposeHeadConfig, FreeLogStdMLPHeadConfig, MLPHeadConfig from ray.rllib.core.models.torch.primitives import TorchCNNTranspose, TorchMLP from ray.rllib.core.models.base import Model from ray.rllib.utils.annotations import override from ray.rllib.core.models.torch.base impo...
class TorchFreeLogStdMLPHead(TorchModel): '''An MLPHead that implements floating log stds for Gaussian distributions.''' def __init__(self, config: FreeLogStdMLPHeadConfig) -> None: pass @override(Model) def _forward(self, inputs: torch.Tensor, **kwargs) -> torch.Tensor: pass
4
1
30
3
24
4
2
0.18
1
1
0
0
2
5
2
2
65
7
49
11
45
9
16
10
13
2
1
1
3
11,315
ray-project/ray
rllib/core/models/torch/heads.py
rllib.core.models.torch.heads.TorchMLPHead
from ray.rllib.core.models.torch.base import TorchModel from ray.rllib.core.models.configs import CNNTransposeHeadConfig, FreeLogStdMLPHeadConfig, MLPHeadConfig from ray.rllib.core.models.torch.primitives import TorchCNNTranspose, TorchMLP from ray.rllib.core.models.base import Model from ray.rllib.utils.annotations im...
class TorchMLPHead(TorchModel): def __init__(self, config: MLPHeadConfig) -> None: pass @override(Model) def _forward(self, inputs: torch.Tensor, **kwargs) -> torch.Tensor: pass
4
0
24
1
19
5
2
0.23
1
1
0
0
2
3
2
2
51
2
40
8
36
9
13
7
10
2
1
1
3
11,316
ray-project/ray
rllib/core/models/torch/primitives.py
rllib.core.models.torch.primitives.LayerNorm1D
class LayerNorm1D(nn.Module): def __init__(self, num_features, **kwargs): super().__init__() self.layer_norm = nn.LayerNorm(num_features, **kwargs) def forward(self, x): batch_size, channels, h, w = x.size() x = x.permute(0, 2, 3, 1).reshape(-1, channels) x = self.layer...
class LayerNorm1D(nn.Module): def __init__(self, num_features, **kwargs): pass def forward(self, x): pass
3
0
7
0
5
2
1
0.4
1
1
0
0
2
1
2
2
15
1
10
5
7
4
10
5
7
1
1
0
2
11,317
ray-project/ray
rllib/core/models/torch/primitives.py
rllib.core.models.torch.primitives.TorchCNN
from ray.rllib.models.torch.misc import same_padding, same_padding_transpose_after_stride, valid_padding from typing import Callable, Dict, List, Optional, Union, Tuple from ray.rllib.models.utils import get_activation_fn, get_initializer_fn class TorchCNN(nn.Module): """A model containing a CNN with N Conv2D laye...
class TorchCNN(nn.Module): '''A model containing a CNN with N Conv2D layers. All layers share the same activation function, bias setup (use bias or not), and LayerNorm setup (use layer normalization or not). Note that there is no flattening nor an additional dense layer at the end of the stack. The...
3
2
61
6
29
27
5
1.05
1
5
1
0
2
1
2
2
134
15
58
25
43
61
36
13
33
8
1
2
9
11,318
ray-project/ray
rllib/core/models/torch/primitives.py
rllib.core.models.torch.primitives.TorchCNNTranspose
from ray.rllib.models.utils import get_activation_fn, get_initializer_fn from typing import Callable, Dict, List, Optional, Union, Tuple from ray.rllib.models.torch.misc import same_padding, same_padding_transpose_after_stride, valid_padding from ray.rllib.core.models.torch.utils import Stride2D class TorchCNNTranspos...
class TorchCNNTranspose(nn.Module): '''A model containing a CNNTranspose with N Conv2DTranspose layers. All layers share the same activation function, bias setup (use bias or not), and LayerNormalization setup (use layer normalization or not), except for the last one, which is never activated and never...
3
2
67
6
34
28
5
0.93
1
6
1
0
2
1
2
2
146
16
68
27
53
63
35
15
32
8
1
2
9
11,319
ray-project/ray
rllib/core/models/torch/primitives.py
rllib.core.models.torch.primitives.TorchMLP
from typing import Callable, Dict, List, Optional, Union, Tuple from ray.rllib.models.utils import get_activation_fn, get_initializer_fn class TorchMLP(nn.Module): """A multi-layer perceptron with N dense layers. All layers (except for an optional additional extra output layer) share the same activation f...
class TorchMLP(nn.Module): '''A multi-layer perceptron with N dense layers. All layers (except for an optional additional extra output layer) share the same activation function, bias setup (use bias or not), and LayerNorm setup (use layer normalization or not). If `output_dim` (int) is not None, an...
3
2
76
5
41
31
7
0.84
1
6
0
0
2
2
2
2
164
13
82
32
60
69
36
13
33
13
1
3
14
11,320
ray-project/ray
rllib/core/models/torch/utils.py
rllib.core.models.torch.utils.Stride2D
class Stride2D(nn.Module): """A striding layer for doing torch Conv2DTranspose operations. Using this layer before the 0-padding (on a 3D input "image") and before the actual ConvTranspose2d allows for a padding="same" behavior that matches 100% that of a `tf.keras.layers.Conv2DTranspose` layer. E...
class Stride2D(nn.Module): '''A striding layer for doing torch Conv2DTranspose operations. Using this layer before the 0-padding (on a 3D input "image") and before the actual ConvTranspose2d allows for a padding="same" behavior that matches 100% that of a `tf.keras.layers.Conv2DTranspose` layer. Exa...
3
2
28
3
17
8
1
1
1
1
0
0
2
7
2
2
80
10
35
11
32
35
18
11
15
1
1
0
2
11,321
ray-project/ray
rllib/core/rl_module/apis/inference_only_api.py
rllib.core.rl_module.apis.inference_only_api.InferenceOnlyAPI
from ray.util.annotations import PublicAPI import abc from typing import List @PublicAPI(stability='alpha') class InferenceOnlyAPI(abc.ABC): """An API to be implemented by RLModules that have an inference-only mode. Only the `get_non_inference_attributes` method needs to get implemented for an RLModule to...
@PublicAPI(stability='alpha') class InferenceOnlyAPI(abc.ABC): '''An API to be implemented by RLModules that have an inference-only mode. Only the `get_non_inference_attributes` method needs to get implemented for an RLModule to have the following functionality: - On EnvRunners (or when self.inference_o...
4
2
44
13
1
30
1
13
1
1
0
0
1
0
1
21
57
15
3
3
0
39
2
2
0
1
4
0
1
11,322
ray-project/ray
rllib/core/rl_module/apis/q_net_api.py
rllib.core.rl_module.apis.q_net_api.QNetAPI
from ray.util.annotations import PublicAPI from typing import Dict from ray.rllib.utils.typing import TensorType import abc @PublicAPI(stability='alpha') class QNetAPI(abc.ABC): """An API to be implemented by RLModules used for (distributional) Q-learning. RLModules implementing this API must override the `co...
@PublicAPI(stability='alpha') class QNetAPI(abc.ABC): '''An API to be implemented by RLModules used for (distributional) Q-learning. RLModules implementing this API must override the `compute_q_values` and the `compute_advantage_distribution` methods. ''' @abc.abstractmethod def compute_q_values...
5
3
20
3
5
12
1
2.55
1
1
0
0
2
0
2
22
48
9
11
10
1
28
4
3
1
1
4
0
2
11,323
ray-project/ray
rllib/core/rl_module/apis/self_supervised_loss_api.py
rllib.core.rl_module.apis.self_supervised_loss_api.SelfSupervisedLossAPI
from ray.rllib.utils.typing import ModuleID, TensorType from typing import Any, Dict, TYPE_CHECKING from ray.util.annotations import PublicAPI import abc @PublicAPI(stability='alpha') class SelfSupervisedLossAPI(abc.ABC): """An API to be implemented by RLModules that bring their own self-supervised loss. Lear...
@PublicAPI(stability='alpha') class SelfSupervisedLossAPI(abc.ABC): '''An API to be implemented by RLModules that bring their own self-supervised loss. Learners will call these model's `compute_self_supervised_loss()` method instead of the Learner's own `compute_loss_for_module()` method. The call signa...
4
2
32
3
9
20
1
2.36
1
2
0
0
1
0
1
21
42
5
11
11
0
26
2
2
0
1
4
0
1
11,324
ray-project/ray
rllib/core/rl_module/apis/target_network_api.py
rllib.core.rl_module.apis.target_network_api.TargetNetworkAPI
from typing import Any, Dict, List, Tuple from ray.util.annotations import PublicAPI from ray.rllib.utils.typing import NetworkType import abc @PublicAPI(stability='alpha') class TargetNetworkAPI(abc.ABC): """An API to be implemented by RLModules for handling target networks. RLModules implementing this API m...
@PublicAPI(stability='alpha') class TargetNetworkAPI(abc.ABC): '''An API to be implemented by RLModules for handling target networks. RLModules implementing this API must override the `make_target_networks`, `get_target_network_pairs`, and the `forward_target` methods. Note that the respective Learner t...
8
4
10
2
1
7
1
4
1
2
0
0
3
0
3
23
46
11
7
7
0
28
4
4
0
1
4
0
3
11,325
ray-project/ray
rllib/core/rl_module/apis/value_function_api.py
rllib.core.rl_module.apis.value_function_api.ValueFunctionAPI
from ray.rllib.utils.typing import TensorType from typing import Any, Dict, Optional from ray.util.annotations import PublicAPI import abc @PublicAPI(stability='alpha') class ValueFunctionAPI(abc.ABC): """An API to be implemented by RLModules for handling value function-based learning. RLModules implementing ...
@PublicAPI(stability='alpha') class ValueFunctionAPI(abc.ABC): '''An API to be implemented by RLModules for handling value function-based learning. RLModules implementing this API must override the `compute_values` method. ''' @abc.abstractmethod def compute_values(self, batch: Dict[str, Any], embed...
4
2
20
2
5
13
1
2.29
1
2
0
0
1
0
1
21
27
4
7
7
0
16
2
2
0
1
4
0
1
11,326
ray-project/ray
rllib/core/rl_module/default_model_config.py
rllib.core.rl_module.default_model_config.DefaultModelConfig
from typing import Callable, List, Optional, Union from ray.util.annotations import DeveloperAPI from ray.rllib.utils.typing import ConvFilterSpec from dataclasses import dataclass, field @DeveloperAPI @dataclass class DefaultModelConfig: """Dataclass to configure all default RLlib RLModules. Users should NOT...
@DeveloperAPI @dataclass class DefaultModelConfig: '''Dataclass to configure all default RLlib RLModules. Users should NOT use this class for configuring their own custom RLModules, but use a custom `model_config` dict with arbitrary (str) keys passed into the `RLModuleSpec` used to define the custom RL...
3
1
0
0
0
0
0
4.87
0
0
0
0
0
0
0
0
195
13
31
31
30
151
31
31
30
0
0
0
0
11,327
ray-project/ray
rllib/core/rl_module/multi_rl_module.py
rllib.core.rl_module.multi_rl_module.MultiRLModule
from typing import Any, Callable, Collection, Dict, ItemsView, KeysView, List, Optional, Set, Tuple, Type, Union, ValuesView from ray.rllib.utils.typing import ModuleID, StateDict, T from ray.util.annotations import PublicAPI import gymnasium as gym import copy from ray.rllib.utils.annotations import override, Override...
@PublicAPI(stability='alpha') class MultiRLModule(RLModule): '''Base class for an RLModule that contains n sub-RLModules. This class holds a mapping from ModuleID to underlying RLModules. It provides a convenient way of accessing each individual module, as well as accessing all of them with only one API...
52
20
13
1
7
5
2
0.67
1
12
1
0
29
4
30
30
470
67
243
110
145
162
111
47
79
6
1
2
52
11,328
ray-project/ray
rllib/core/rl_module/multi_rl_module.py
rllib.core.rl_module.multi_rl_module.MultiRLModuleConfig
import dataclasses from ray._common.deprecation import Deprecated, DEPRECATED_VALUE, deprecation_warning from typing import Any, Callable, Collection, Dict, ItemsView, KeysView, List, Optional, Set, Tuple, Type, Union, ValuesView from ray.rllib.utils.typing import ModuleID, StateDict, T from ray.rllib.core.rl_module.rl...
@Deprecated(new='MultiRLModule(*, rl_module_specs={module1: [RLModuleSpec], module2: [RLModuleSpec], ..}, inference_only=..)', error=False) @dataclasses.dataclass class MultiRLModuleConfig: def to_dict(self): pass @classmethod def from_dict(cls, d) -> 'MultiRLModuleConfig': pass def ge...
7
0
6
0
6
0
1
0
0
0
0
0
2
0
3
3
25
3
22
7
17
0
9
6
5
1
0
0
3
11,329
ray-project/ray
rllib/core/rl_module/multi_rl_module.py
rllib.core.rl_module.multi_rl_module.MultiRLModuleSpec
import gymnasium as gym from ray.rllib.utils.typing import ModuleID, StateDict, T import dataclasses from ray.rllib.utils import force_list from ray._common.deprecation import Deprecated, DEPRECATED_VALUE, deprecation_warning from ray.rllib.utils.annotations import override, OverrideToImplementCustomLogic from ray.rlli...
@PublicAPI(stability='alpha') @dataclasses.dataclass class MultiRLModuleSpec: '''A utility spec class to make it constructing MultiRLModules easier. Users can extend this class to modify the behavior of base class. For example to share neural networks across the modules, the build method can be overridden t...
26
11
13
1
9
3
2
0.49
0
8
2
0
14
0
16
16
282
31
168
56
129
83
80
33
63
7
0
3
35
11,330
ray-project/ray
rllib/core/rl_module/rl_module.py
rllib.core.rl_module.rl_module.RLModule
from ray.rllib.core import DEFAULT_MODULE_ID from ray.util.annotations import PublicAPI from ray._common.deprecation import Deprecated, DEPRECATED_VALUE, deprecation_warning import gymnasium as gym from typing import Any, Collection, Dict, Optional, Type, TYPE_CHECKING, Union import abc from ray.rllib.utils.annotations...
@PublicAPI(stability='beta') class RLModule(Checkpointable, abc.ABC): '''Base class for RLlib modules. Subclasses should call `super().__init__(observation_space=.., action_space=.., inference_only=.., learner_only=.., model_config={..})` in their __init__ methods. Here is the pseudocode for how the for...
50
17
13
1
6
5
1
1.36
2
9
2
0
26
10
26
46
499
93
173
74
112
236
85
42
57
6
4
3
33
11,331
ray-project/ray
rllib/core/rl_module/rl_module.py
rllib.core.rl_module.rl_module.RLModuleConfig
from dataclasses import dataclass, field from typing import Any, Collection, Dict, Optional, Type, TYPE_CHECKING, Union import gymnasium as gym from ray.rllib.utils.serialization import gym_space_from_dict, gym_space_to_dict, serialize_type, deserialize_type from ray._common.deprecation import Deprecated, DEPRECATED_VA...
@Deprecated(old='RLModule(config=[RLModuleConfig object])', new='RLModule(observation_space=.., action_space=.., inference_only=.., model_config=.., catalog_class=..)', error=False) @dataclass class RLModuleConfig: def get_catalog(self) -> Optional['Catalog']: pass def to_dict(self): pass ...
7
0
11
0
11
0
2
0
0
2
0
0
2
0
3
3
45
3
42
13
37
0
17
12
13
2
0
1
6
11,332
ray-project/ray
rllib/core/rl_module/rl_module.py
rllib.core.rl_module.rl_module.RLModuleSpec
from ray.rllib.utils.annotations import override, OverrideToImplementCustomLogic from ray._common.deprecation import Deprecated, DEPRECATED_VALUE, deprecation_warning import gymnasium as gym import dataclasses from ray.rllib.utils.serialization import gym_space_from_dict, gym_space_to_dict, serialize_type, deserialize_...
@PublicAPI(stability='beta') @dataclass class RLModuleSpec: '''Utility spec class to make constructing RLModules (in single-agent case) easier. Args: module_class: The RLModule class to use. observation_space: The observation space of the RLModule. This may differ from the observatio...
15
6
18
1
15
2
3
0.29
0
6
1
0
7
0
9
9
210
20
147
33
129
43
70
27
58
5
0
1
23
11,333
ray-project/ray
rllib/core/rl_module/torch/torch_compile_config.py
rllib.core.rl_module.torch.torch_compile_config.TorchCompileConfig
from dataclasses import dataclass, field import sys @dataclass class TorchCompileConfig: """Configuration options for RLlib's usage of torch.compile in RLModules. # On `torch.compile` in Torch RLModules `torch.compile` invokes torch's dynamo JIT compiler that can potentially bring speedups to RL Modul...
@dataclass class TorchCompileConfig: '''Configuration options for RLlib's usage of torch.compile in RLModules. # On `torch.compile` in Torch RLModules `torch.compile` invokes torch's dynamo JIT compiler that can potentially bring speedups to RL Module's forward methods. This is a performance optimiz...
2
1
0
0
0
0
0
3.83
0
1
0
0
0
0
0
0
34
5
6
4
5
23
4
4
3
0
0
0
0
11,334
ray-project/ray
rllib/core/rl_module/torch/torch_rl_module.py
rllib.core.rl_module.torch.torch_rl_module.TorchDDPRLModule
from ray.rllib.core.distribution.torch.torch_distribution import TorchCategorical, TorchDiagGaussian, TorchDistribution from typing import Any, Collection, Dict, Optional, Union, Type from ray.rllib.core.rl_module.rl_module import RLModule from ray.rllib.utils.annotations import override, OverrideToImplementCustomLogic...
class TorchDDPRLModule(RLModule, nn.parallel.DistributedDataParallel): def __init__(self, *args, **kwargs) -> None: pass @override(RLModule) def get_inference_action_dist_cls(self, *args, **kwargs) -> Type[TorchDistribution]: pass @override(RLModule) def get_exploration_action_dist...
32
0
3
0
3
0
1
0.07
2
3
0
0
16
7
16
16
77
16
57
41
23
4
40
24
23
1
1
0
16
11,335
ray-project/ray
rllib/core/rl_module/torch/torch_rl_module.py
rllib.core.rl_module.torch.torch_rl_module.TorchRLModule
from ray.rllib.core.distribution.torch.torch_distribution import TorchCategorical, TorchDiagGaussian, TorchDistribution from ray.rllib.core.rl_module.torch.torch_compile_config import TorchCompileConfig from ray.rllib.utils.typing import StateDict from typing import Any, Collection, Dict, Optional, Union, Type from ray...
class TorchRLModule(nn.Module, RLModule): '''A base class for RLlib PyTorch RLModules. Note that the `_forward` methods of this class can be 'torch.compiled' individually: - `TorchRLModule._forward_train()` - `TorchRLModule._forward_inference()` - `TorchRLModule._forward_exploration()` ...
23
3
12
1
8
4
2
0.52
2
5
0
0
10
0
10
10
160
20
92
35
62
48
53
21
42
7
1
4
23
11,336
ray-project/ray
rllib/env/base_env.py
rllib.env.base_env.BaseEnv
from ray.rllib.utils.typing import AgentID, EnvID, EnvType, MultiEnvDict from typing import Callable, Tuple, Optional, List, Dict, Any, TYPE_CHECKING, Union, Set from ray.rllib.utils.annotations import OldAPIStack import gymnasium as gym @OldAPIStack class BaseEnv: """The lowest-level env interface used by RLlib f...
null
16
13
16
2
4
10
1
3.13
0
4
0
0
12
0
12
12
280
49
56
40
17
175
30
14
17
3
0
2
15
11,337
ray-project/ray
rllib/env/env_context.py
rllib.env.env_context.EnvContext
import copy from typing import Optional from ray.rllib.utils.typing import EnvConfigDict from ray.util.annotations import DeveloperAPI @DeveloperAPI class EnvContext(dict): """Wraps env configurations to include extra rllib metadata. These attributes can be used to parameterize environments per process. F...
@DeveloperAPI class EnvContext(dict): '''Wraps env configurations to include extra rllib metadata. These attributes can be used to parameterize environments per process. For example, one might use `worker_index` to control which data file an environment reads in on initialization. RLlib auto-sets th...
6
4
27
3
11
14
3
1.42
1
3
0
0
4
5
4
31
120
16
43
27
22
61
16
11
11
7
2
2
12
11,338
ray-project/ray
rllib/env/env_runner.py
rllib.env.env_runner.EnvRunner
from typing import Any, Dict, Optional, Tuple, TYPE_CHECKING import tree import ray from ray.rllib.utils.debug import update_global_seed_if_necessary from ray.rllib.utils.metrics import ENV_RESET_TIMER, ENV_STEP_TIMER from ray.util.annotations import PublicAPI, DeveloperAPI from ray.rllib.core import COMPONENT_RL_MODUL...
null
19
14
11
1
5
5
2
1.23
2
4
0
0
12
2
12
32
160
26
60
22
44
74
44
17
31
3
3
2
18
11,339
ray-project/ray
rllib/env/env_runner_group.py
rllib.env.env_runner_group.EnvRunnerGroup
from ray.rllib.utils.actor_manager import FaultTolerantActorManager from ray.rllib.offline import get_dataset_and_shards from ray.rllib.core.learner import LearnerGroup from ray.rllib.utils.annotations import OldAPIStack from ray.rllib.core.rl_module import validate_module_id import ray from typing import Any, Callable...
@DeveloperAPI class EnvRunnerGroup: '''Set of EnvRunners with n @ray.remote workers and zero or one local worker. Where: n >= 0. ''' def __init__(self, *, env_creator: Optional[EnvCreator]=None, validate_env: Optional[Callable[[EnvType], None]]=None, default_policy_class: Optional[Type[Policy]]=None, c...
59
31
26
2
16
9
3
0.55
0
17
2
0
38
14
39
39
1,196
133
689
221
505
376
260
91
212
14
0
4
109
11,340
ray-project/ray
rllib/env/external_env.py
rllib.env.external_env.ExternalEnv
import gymnasium as gym from ray.rllib.utils.annotations import override, OldAPIStack from ray.rllib.utils.typing import EnvActionType, EnvInfoDict, EnvObsType, EnvType, MultiEnvDict from typing import Callable, Tuple, Optional, TYPE_CHECKING from ray._common.deprecation import deprecation_warning import threading impo...
@OldAPIStack class ExternalEnv(threading.Thread): '''An environment that interfaces with external agents. Unlike simulator envs, control is inverted: The environment queries the policy to obtain actions and in return logs observations and rewards for training. This is in contrast to gym.Env, where the a...
11
10
20
3
9
8
2
1.2
1
10
2
0
9
6
9
34
219
45
79
39
51
95
48
21
38
4
1
1
17
11,341
ray-project/ray
rllib/env/external_env.py
rllib.env.external_env.ExternalEnvWrapper
from typing import Callable, Tuple, Optional, TYPE_CHECKING from ray.rllib.utils.typing import EnvActionType, EnvInfoDict, EnvObsType, EnvType, MultiEnvDict from ray.rllib.env.base_env import BaseEnv from ray.rllib.utils.annotations import override, OldAPIStack import gymnasium as gym @OldAPIStack class ExternalEnvWra...
@OldAPIStack class ExternalEnvWrapper(BaseEnv): '''Internal adapter of ExternalEnv to BaseEnv.''' def __init__(self, external_env: 'ExternalEnv', preprocessor: 'Preprocessor'=None): pass @override(BaseEnv) def poll(self) -> Tuple[MultiEnvDict, MultiEnvDict, MultiEnvDict, MultiEnvDict, MultiEnvD...
15
1
17
1
16
0
3
0.03
1
2
0
0
6
5
6
6
130
11
116
44
86
3
63
27
52
11
1
3
24
11,342
ray-project/ray
rllib/env/external_env.py
rllib.env.external_env._ExternalEnvEpisode
import queue from ray.rllib.utils.annotations import override, OldAPIStack import threading @OldAPIStack class _ExternalEnvEpisode: """Tracked state for each active episode.""" def __init__(self, episode_id: str, results_avail_condition: threading.Condition, training_enabled: bool, multiagent: bool=False): ...
@OldAPIStack class _ExternalEnvEpisode: '''Tracked state for each active episode.''' def __init__(self, episode_id: str, results_avail_condition: threading.Condition, training_enabled: bool, multiagent: bool=False): pass def get_data(self): pass def log_action(self, observation, actio...
8
1
16
0
15
1
3
0.04
0
4
0
0
6
18
6
6
104
7
93
33
80
4
70
27
63
7
0
3
17
11,343
ray-project/ray
rllib/env/external_multi_agent_env.py
rllib.env.external_multi_agent_env.ExternalMultiAgentEnv
from ray.rllib.utils.typing import MultiAgentDict import gymnasium as gym from ray.rllib.env.external_env import ExternalEnv, _ExternalEnvEpisode from typing import Optional import uuid from ray.rllib.utils.annotations import override, OldAPIStack @OldAPIStack class ExternalMultiAgentEnv(ExternalEnv): """This is t...
@OldAPIStack class ExternalMultiAgentEnv(ExternalEnv): '''This is the multi-agent version of ExternalEnv.''' def __init__(self, action_space: gym.Space, observation_space: gym.Space): '''Initializes an ExternalMultiAgentEnv instance. Args: action_space: Action space of the env. ...
14
7
20
3
9
7
2
0.69
1
5
0
0
7
1
7
7
151
29
72
39
40
50
38
14
30
6
1
2
17
11,344
ray-project/ray
rllib/env/multi_agent_env.py
rllib.env.multi_agent_env.MultiAgentEnv
from typing import Callable, Dict, List, Tuple, Optional, Union, Set, Type from ray.rllib.utils.typing import AgentID, EnvCreator, EnvID, EnvType, MultiAgentDict, MultiEnvDict from ray.util.annotations import DeveloperAPI, PublicAPI from ray._common.deprecation import Deprecated from ray.rllib.utils.annotations import ...
@PublicAPI(stability='beta') class MultiAgentEnv(gym.Env): '''An environment that hosts multiple independent agents. Agents are identified by AgentIDs (string). ''' def __init__(self): pass def reset(self, *, seed: Optional[int]=None, options: Optional[dict]=None) -> Tuple[MultiAgentDict, ...
18
6
23
3
8
12
2
1.53
1
9
1
1
11
1
11
11
298
49
99
48
58
151
52
22
38
4
1
1
22
11,345
ray-project/ray
rllib/env/multi_agent_env.py
rllib.env.multi_agent_env.MultiAgentEnvWrapper
from ray.rllib.env.base_env import BaseEnv from typing import Callable, Dict, List, Tuple, Optional, Union, Set, Type import gymnasium as gym from ray.util import log_once from ray.rllib.utils.annotations import OldAPIStack, override from ray.rllib.utils.typing import AgentID, EnvCreator, EnvID, EnvType, MultiAgentDict...
@OldAPIStack class MultiAgentEnvWrapper(BaseEnv): '''Internal adapter of MultiAgentEnv to BaseEnv. This also supports vectorization if num_envs > 1. ''' def __init__(self, make_env: Callable[[int], EnvType], existing_envs: List['MultiAgentEnv'], num_envs: int, restart_failed_sub_environments: bool=Fals...
24
3
18
1
15
2
4
0.14
1
12
2
0
11
8
11
11
221
18
178
66
132
25
109
32
97
11
1
3
40
11,346
ray-project/ray
rllib/env/multi_agent_env.py
rllib.env.multi_agent_env._MultiAgentEnvState
from typing import Callable, Dict, List, Tuple, Optional, Union, Set, Type from ray.rllib.utils.typing import AgentID, EnvCreator, EnvID, EnvType, MultiAgentDict, MultiEnvDict from ray.rllib.utils.annotations import OldAPIStack, override @OldAPIStack class _MultiAgentEnvState: def __init__(self, env: MultiAgentEn...
@OldAPIStack class _MultiAgentEnvState: def __init__(self, env: MultiAgentEnv, return_error_as_obs: bool=False): pass def poll(self) -> Tuple[MultiAgentDict, MultiAgentDict, MultiAgentDict, MultiAgentDict, MultiAgentDict]: pass def observe(self, obs: MultiAgentDict, rewards: MultiAgentDic...
6
0
28
2
26
1
5
0.04
0
5
1
0
4
8
4
4
116
9
103
44
78
4
74
23
69
8
0
3
19
11,347
ray-project/ray
rllib/env/multi_agent_env_runner.py
rllib.env.multi_agent_env_runner.MultiAgentEnvRunner
from ray.rllib.utils.metrics import ENV_TO_MODULE_CONNECTOR, EPISODE_DURATION_SEC_MEAN, EPISODE_LEN_MAX, EPISODE_LEN_MEAN, EPISODE_LEN_MIN, EPISODE_RETURN_MAX, EPISODE_RETURN_MEAN, EPISODE_RETURN_MIN, MODULE_TO_ENV_CONNECTOR, NUM_AGENT_STEPS_SAMPLED, NUM_AGENT_STEPS_SAMPLED_LIFETIME, NUM_ENV_STEPS_SAMPLED, NUM_ENV_STEP...
@PublicAPI(stability='alpha') class MultiAgentEnvRunner(EnvRunner, Checkpointable): '''The genetic environment runner for the multi-agent case.''' @override(EnvRunner) def __init__(self, config: AlgorithmConfig, **kwargs): '''Initializes a MultiAgentEnvRunner instance. Args: conf...
41
4
44
5
29
11
4
0.36
2
12
0
0
22
19
23
23
1,051
127
683
155
602
243
292
96
268
14
1
4
82
11,348
ray-project/ray
rllib/env/multi_agent_episode.py
rllib.env.multi_agent_episode.MultiAgentEpisode
from ray._common.deprecation import Deprecated from typing import Any, Callable, Collection, DefaultDict, Dict, List, Optional, Set, Union from ray.util.annotations import PublicAPI import uuid from ray.rllib.utils import force_list import time from ray.rllib.policy.sample_batch import MultiAgentBatch import copy from ...
@PublicAPI(stability='alpha') class MultiAgentEpisode: '''Stores multi-agent episode data. The central attribute of the class is the timestep mapping `self.env_t_to_agent_t` that maps AgentIDs to their specific environment steps to the agent's own scale/timesteps. Each AgentID in the `MultiAgentEpis...
60
39
49
3
26
20
4
0.78
0
18
0
0
49
20
50
50
2,579
227
1,322
370
1,088
1,032
552
185
500
25
0
4
199
11,349
ray-project/ray
rllib/env/policy_client.py
rllib.env.policy_client.PolicyClient
import time from ray.rllib.env.external_env import ExternalEnv from ray.rllib.env.external.rllink import RLlink as Commands from typing import Union, Optional import ray.cloudpickle as pickle from ray.rllib.utils.annotations import OldAPIStack from ray.rllib.utils.typing import MultiAgentDict, EnvInfoDict, EnvObsType, ...
@OldAPIStack class PolicyClient: '''REST client to interact with an RLlib policy server.''' def __init__(self, address: str, inference_mode: str='local', update_interval: float=10.0, session: Optional[requests.Session]=None): pass def start_episode(self, episode_id: Optional[str]=None, training_en...
12
2
22
2
15
5
2
0.34
0
8
0
0
10
8
10
10
236
31
153
49
119
52
70
26
59
3
0
2
22
11,350
ray-project/ray
rllib/env/policy_client.py
rllib.env.policy_client._LocalInferenceThread
from ray.rllib.policy.sample_batch import MultiAgentBatch import threading from ray.rllib.utils.annotations import OldAPIStack from ray.rllib.env.external.rllink import RLlink as Commands @OldAPIStack class _LocalInferenceThread(threading.Thread): def __init__(self, rollout_worker, send_fn): super().__ini...
@OldAPIStack class _LocalInferenceThread(threading.Thread): def __init__(self, rollout_worker, send_fn): pass def run(self): pass
4
0
16
0
16
0
3
0.03
1
2
0
0
2
3
2
27
35
2
32
9
29
1
18
8
15
4
1
3
5
11,351
ray-project/ray
rllib/env/remote_base_env.py
rllib.env.remote_base_env.RemoteBaseEnv
from ray.rllib.utils.typing import AgentID, EnvID, EnvType, MultiEnvDict import ray from typing import Callable, Dict, List, Optional, Set, Tuple, TYPE_CHECKING from ray.util import log_once from ray.rllib.env.base_env import BaseEnv, _DUMMY_AGENT_ID, ASYNC_RESET_RETURN from ray.rllib.utils.annotations import override,...
@OldAPIStack class RemoteBaseEnv(BaseEnv): '''BaseEnv that executes its sub environments as @ray.remote actors. This provides dynamic batching of inference as observations are returned from the remote simulator actors. Both single and multi-agent child envs are supported, and envs can be stepped synchro...
25
3
30
2
19
8
3
0.46
1
13
3
0
11
11
11
11
373
40
228
77
180
105
126
42
113
14
1
5
40
11,352
ray-project/ray
rllib/env/remote_base_env.py
rllib.env.remote_base_env._RemoteMultiAgentEnv
from ray.rllib.utils.typing import AgentID, EnvID, EnvType, MultiEnvDict from typing import Callable, Dict, List, Optional, Set, Tuple, TYPE_CHECKING import ray @ray.remote(num_cpus=0) class _RemoteMultiAgentEnv: """Wrapper class for making a multi-agent env a remote actor.""" def __init__(self, make_env, i):...
@ray.remote(num_cpus=0) class _RemoteMultiAgentEnv: '''Wrapper class for making a multi-agent env a remote actor.''' def __init__(self, make_env, i): pass def reset(self, *, seed: Optional[int]=None, options: Optional[dict]=None): pass def step(self, action_dict): pass de...
8
1
4
0
3
0
1
0.19
0
3
0
0
6
2
6
6
32
7
21
14
14
4
21
14
14
2
0
1
7
11,353
ray-project/ray
rllib/env/remote_base_env.py
rllib.env.remote_base_env._RemoteSingleAgentEnv
from ray.rllib.env.base_env import BaseEnv, _DUMMY_AGENT_ID, ASYNC_RESET_RETURN from typing import Callable, Dict, List, Optional, Set, Tuple, TYPE_CHECKING import ray @ray.remote(num_cpus=0) class _RemoteSingleAgentEnv: """Wrapper class for making a gym env a remote actor.""" def __init__(self, make_env, i):...
@ray.remote(num_cpus=0) class _RemoteSingleAgentEnv: '''Wrapper class for making a gym env a remote actor.''' def __init__(self, make_env, i): pass def reset(self, *, seed: Optional[int]=None, options: Optional[dict]=None): pass def step(self, action): pass def observatio...
7
1
5
1
4
0
1
0.14
0
2
0
0
5
1
5
5
34
10
21
15
15
3
21
15
15
1
0
0
5
11,354
ray-project/ray
rllib/env/single_agent_env_runner.py
rllib.env.single_agent_env_runner.SingleAgentEnvRunner
from ray.rllib.core.columns import Columns from gymnasium.wrappers.vector import DictInfoToList from ray.rllib.env.utils import _gym_env_creator from ray.rllib.utils.checkpoints import Checkpointable from ray.rllib.utils.spaces.space_utils import unbatch from ray.rllib.env.env_context import EnvContext import gymnasium...
@PublicAPI(stability='alpha') class SingleAgentEnvRunner(EnvRunner, Checkpointable): '''The generic environment runner for the single agent case.''' @override(EnvRunner) def __init__(self, *, config: AlgorithmConfig, **kwargs): '''Initializes a SingleAgentEnvRunner instance. Args: ...
38
6
36
3
25
8
3
0.3
2
12
0
0
21
20
21
21
792
92
538
118
476
164
240
75
218
20
1
4
72
11,355
ray-project/ray
rllib/env/single_agent_episode.py
rllib.env.single_agent_episode.SingleAgentEpisode
from ray.rllib.core.columns import Columns import copy from ray.rllib.policy.sample_batch import SampleBatch import gymnasium as gym import functools from ray.rllib.utils.serialization import gym_space_from_dict, gym_space_to_dict from typing import Any, Dict, List, Optional, SupportsFloat, Union from ray.rllib.utils.t...
@PublicAPI(stability='alpha') class SingleAgentEpisode: '''A class representing RL environment episodes for individual agents. SingleAgentEpisode stores observations, info dicts, actions, rewards, and all module outputs (e.g. state outs, action logp, etc..) for an individual agent within some single-age...
51
31
42
4
16
22
3
1.53
0
15
0
0
38
20
39
39
1,842
203
648
194
503
991
268
88
228
19
0
3
98
11,356
ray-project/ray
rllib/env/utils/infinite_lookback_buffer.py
rllib.env.utils.infinite_lookback_buffer.InfiniteLookbackBuffer
from ray.rllib.utils.numpy import LARGE_INTEGER, one_hot, one_hot_multidiscrete from typing import Any, Dict, List, Optional, Union from ray.util.annotations import DeveloperAPI from ray.rllib.utils.serialization import gym_space_from_dict, gym_space_to_dict import numpy as np from ray.rllib.utils.spaces.space_utils im...
@DeveloperAPI class InfiniteLookbackBuffer: @property def space(self): pass @space.setter def space(self): pass def __init__(self, data: Optional[Union[List, np.ndarray]]=None, lookback: int=0, space: Optional[gym.Space]=None): pass def __eq__(self, other: 'InfiniteLoo...
35
13
23
1
16
5
4
0.33
0
14
0
0
26
5
27
27
702
67
476
111
391
159
244
56
213
20
0
4
116
11,357
ray-project/ray
rllib/env/vector_env.py
rllib.env.vector_env.VectorEnv
from ray.rllib.utils.typing import EnvActionType, EnvID, EnvInfoDict, EnvObsType, EnvType, MultiEnvDict, AgentID from ray.rllib.utils.annotations import Deprecated, OldAPIStack, override from typing import Callable, List, Optional, Tuple, Union, Set import numpy as np import gymnasium as gym @OldAPIStack class VectorE...
null
16
10
16
1
6
9
1
1.56
0
8
2
1
10
3
11
11
196
27
66
49
21
103
26
16
14
1
0
0
11
11,358
ray-project/ray
rllib/env/vector_env.py
rllib.env.vector_env.VectorEnvWrapper
from ray.rllib.utils.annotations import Deprecated, OldAPIStack, override from ray.rllib.utils.typing import EnvActionType, EnvID, EnvInfoDict, EnvObsType, EnvType, MultiEnvDict, AgentID import gymnasium as gym from ray.rllib.env.base_env import BaseEnv, _DUMMY_AGENT_ID from typing import Callable, List, Optional, Tupl...
@OldAPIStack class VectorEnvWrapper(BaseEnv): '''Internal adapter of VectorEnv to BaseEnv. We assume the caller will always send the full vector of actions in each call to send_actions(), and that they call reset_at() on all completed environments before calling send_actions(). ''' def __init__...
24
2
12
1
9
2
2
0.2
1
7
1
0
11
10
11
11
157
20
114
58
73
23
72
33
57
3
1
1
17
11,359
ray-project/ray
rllib/env/vector_env.py
rllib.env.vector_env._VectorizedGymEnv
from ray.rllib.utils.annotations import Deprecated, OldAPIStack, override from ray.rllib.utils.typing import EnvActionType, EnvID, EnvInfoDict, EnvObsType, EnvType, MultiEnvDict, AgentID import gymnasium as gym from ray.util import log_once from typing import Callable, List, Optional, Tuple, Union, Set @OldAPIStack cl...
@OldAPIStack class _VectorizedGymEnv(VectorEnv): '''Internal wrapper to translate any gym.Envs into a VectorEnv object.''' def __init__(self, make_env: Optional[Callable[[int], EnvType]]=None, existing_envs: Optional[List[gym.Env]]=None, num_envs: int=1, *, observation_space: Optional[gym.Space]=None, action_s...
15
2
21
1
16
3
3
0.21
1
9
0
0
7
3
7
18
160
16
119
53
82
25
73
21
65
5
1
3
22
11,360
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.ClipRewardEnv
from ray.rllib.utils.annotations import PublicAPI import numpy as np import gymnasium as gym @PublicAPI class ClipRewardEnv(gym.RewardWrapper): def __init__(self, env): gym.RewardWrapper.__init__(self, env) def reward(self, reward): """Bin reward to {+1, 0, -1} by its sign.""" return ...
@PublicAPI class ClipRewardEnv(gym.RewardWrapper): def __init__(self, env): pass def reward(self, reward): '''Bin reward to {+1, 0, -1} by its sign.''' pass
4
1
3
0
2
1
1
0.2
1
0
0
0
2
0
2
2
7
1
5
3
2
1
5
3
2
1
1
0
2
11,361
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.EpisodicLifeEnv
from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class EpisodicLifeEnv(gym.Wrapper): def __init__(self, env): """Make end-of-life == end-of-episode, but only reset on true game over. Done by DeepMind for the DQN and co. since it helps value estimation. "...
@PublicAPI class EpisodicLifeEnv(gym.Wrapper): def __init__(self, env): '''Make end-of-life == end-of-episode, but only reset on true game over. Done by DeepMind for the DQN and co. since it helps value estimation. ''' pass def step(self, action): pass def reset(se...
5
2
11
0
6
4
2
0.65
1
0
0
0
3
2
3
3
35
2
20
10
16
13
19
10
15
2
1
1
5
11,362
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.FireResetEnv
from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class FireResetEnv(gym.Wrapper): def __init__(self, env): """Take action on reset. For environments that are fixed until firing.""" gym.Wrapper.__init__(self, env) assert env.unwrapped.get_action_...
@PublicAPI class FireResetEnv(gym.Wrapper): def __init__(self, env): '''Take action on reset. For environments that are fixed until firing.''' pass def reset(self, **kwargs): pass def step(self, ac): pass
5
1
6
0
5
1
2
0.13
1
0
0
0
3
0
3
3
21
3
16
6
12
2
16
6
12
3
1
1
5
11,363
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.FrameStack
from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym from gymnasium import spaces import numpy as np from collections import deque @PublicAPI class FrameStack(gym.Wrapper): def __init__(self, env, k): """Stack k last frames.""" gym.Wrapper.__init__(self, env) self.k = ...
@PublicAPI class FrameStack(gym.Wrapper): def __init__(self, env, k): '''Stack k last frames.''' pass def reset(self, *, seed=None, options=None): pass def step(self, action): pass def _get_ob(self): pass
6
1
6
0
6
0
1
0.04
1
1
0
0
4
3
4
4
28
3
24
12
19
1
19
12
14
2
1
1
5
11,364
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.FrameStackTrajectoryView
from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym import numpy as np from gymnasium import spaces @PublicAPI class FrameStackTrajectoryView(gym.ObservationWrapper): def __init__(self, env): """No stacking. Trajectory View API takes care of this.""" gym.Wrapper.__init__(self...
@PublicAPI class FrameStackTrajectoryView(gym.ObservationWrapper): def __init__(self, env): '''No stacking. Trajectory View API takes care of this.''' pass def observation(self, observation): pass
4
1
5
0
5
1
1
0.1
1
0
0
0
2
1
2
2
12
1
10
5
7
1
8
5
5
1
1
0
2
11,365
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.MaxAndSkipEnv
import numpy as np from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class MaxAndSkipEnv(gym.Wrapper): def __init__(self, env, skip=4): """Return only every `skip`-th frame""" gym.Wrapper.__init__(self, env) self._obs_buffer = np.zeros((2,) + env.observat...
@PublicAPI class MaxAndSkipEnv(gym.Wrapper): def __init__(self, env, skip=4): '''Return only every `skip`-th frame''' pass def step(self, action): '''Repeat action, sum reward, and max over last observations.''' pass def reset(self, **kwargs): pass
5
2
9
0
7
2
2
0.22
1
1
0
0
3
2
3
3
31
3
23
11
19
5
21
11
17
5
1
2
7
11,366
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.MonitorEnv
from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class MonitorEnv(gym.Wrapper): def __init__(self, env=None): """Record episodes stats prior to EpisodicLifeEnv, etc.""" gym.Wrapper.__init__(self, env) self._current_reward = None self._num_steps =...
@PublicAPI class MonitorEnv(gym.Wrapper): def __init__(self, env=None): '''Record episodes stats prior to EpisodicLifeEnv, etc.''' pass def reset(self, **kwargs): pass def step(self, action): pass def get_episode_rewards(self): pass def get_episode_length...
9
1
6
1
5
0
1
0.03
1
1
0
0
7
7
7
7
48
10
37
18
29
1
37
18
29
3
1
1
10
11,367
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.NoopResetEnv
import gymnasium as gym from ray.rllib.utils.annotations import PublicAPI @PublicAPI class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0. """ gym.Wrapper.__init__...
@PublicAPI class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): '''Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0. ''' pass def reset(self, **kwargs): '''Do no-op action for a number of steps in [1, no...
5
2
10
0
8
2
2
0.28
1
2
0
0
3
3
3
3
34
2
25
11
21
7
24
11
20
5
1
2
7
11,368
ray-project/ray
rllib/env/wrappers/atari_wrappers.py
rllib.env.wrappers.atari_wrappers.NormalizedImageEnv
import numpy as np from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class NormalizedImageEnv(gym.ObservationWrapper): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.observation_space = gym.spaces.Box(-1.0, 1.0, shape=self.observation...
@PublicAPI class NormalizedImageEnv(gym.ObservationWrapper): def __init__(self, *args, **kwargs): pass def observation(self, observation): pass
4
0
5
0
5
0
1
0.18
1
1
0
0
2
1
2
2
14
1
11
4
8
2
6
4
3
1
1
0
2
11,369
ray-project/ray
rllib/env/wrappers/dm_control_wrapper.py
rllib.env.wrappers.dm_control_wrapper.DMCEnv
import gymnasium as gym import numpy as np from ray.rllib.utils.annotations import DeveloperAPI, PublicAPI @PublicAPI class DMCEnv(gym.Env): def __init__(self, domain_name, task_name, task_kwargs=None, visualize_reward=False, from_pixels=False, height=64, width=64, camera_id=0, frame_skip=2, environment_kwargs=No...
@PublicAPI class DMCEnv(gym.Env): def __init__(self, domain_name, task_name, task_kwargs=None, visualize_reward=False, from_pixels=False, height=64, width=64, camera_id=0, frame_skip=2, environment_kwargs=None, channels_first=True, preprocess=True): pass def __getattr__(self, name): pass ...
15
0
13
1
12
0
2
0.02
1
2
0
0
10
13
10
10
144
16
125
53
97
3
78
36
67
6
1
2
20
11,370
ray-project/ray
rllib/env/wrappers/dm_env_wrapper.py
rllib.env.wrappers.dm_env_wrapper.DMEnv
from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class DMEnv(gym.Env): """A `gym.Env` wrapper for the `dm_env` API.""" metadata = {'render.modes': ['rgb_array']} def __init__(self, dm_env): super(DMEnv, self).__init__() self._env = dm_env self._p...
@PublicAPI class DMEnv(gym.Env): '''A `gym.Env` wrapper for the `dm_env` API.''' def __init__(self, dm_env): pass def step(self, action): pass def reset(self, *, seed=None, options=None): pass def render(self, mode='rgb_array'): pass @property def action_s...
12
1
6
1
6
0
2
0.02
1
5
0
0
7
2
7
7
59
12
46
20
35
1
34
17
26
3
1
1
12
11,371
ray-project/ray
rllib/env/wrappers/group_agents_wrapper.py
rllib.env.wrappers.group_agents_wrapper.GroupAgentsWrapper
from typing import Dict, List, Optional from ray.rllib.env.multi_agent_env import MultiAgentEnv from collections import OrderedDict from ray.rllib.utils.typing import AgentID from ray.rllib.utils.annotations import DeveloperAPI import gymnasium as gym @DeveloperAPI class GroupAgentsWrapper(MultiAgentEnv): """Wraps...
@DeveloperAPI class GroupAgentsWrapper(MultiAgentEnv): '''Wraps a MultiAgentEnv environment with agents grouped as specified. See multi_agent_env.py for the specification of groups. This API is experimental. ''' def __init__(self, env: MultiAgentEnv, groups: Dict[str, List[AgentID]], obs_space: Opt...
8
2
24
1
18
4
5
0.28
1
8
0
0
5
5
5
5
131
14
93
30
81
26
61
24
55
7
1
4
23
11,372
ray-project/ray
rllib/env/wrappers/multi_agent_env_compatibility.py
rllib.env.wrappers.multi_agent_env_compatibility.MultiAgentEnvCompatibility
from ray.rllib.utils.typing import MultiAgentDict from ray.rllib.env.multi_agent_env import MultiAgentEnv from typing import Optional, Tuple class MultiAgentEnvCompatibility(MultiAgentEnv): """A wrapper converting MultiAgentEnv from old gym API to the new one. "Old API" refers to step() method returning (obse...
class MultiAgentEnvCompatibility(MultiAgentEnv): '''A wrapper converting MultiAgentEnv from old gym API to the new one. "Old API" refers to step() method returning (observation, reward, done, info), and reset() only retuning the observation. "New API" refers to step() method returning (observation, rew...
6
2
10
2
6
2
1
0.63
1
4
0
0
5
7
5
5
67
15
32
23
20
20
26
17
20
3
1
1
7
11,373
ray-project/ray
rllib/env/wrappers/open_spiel.py
rllib.env.wrappers.open_spiel.OpenSpielEnv
from typing import Optional import numpy as np from ray.rllib.env.multi_agent_env import MultiAgentEnv import gymnasium as gym class OpenSpielEnv(MultiAgentEnv): def __init__(self, env): super().__init__() self.env = env self.agents = self.possible_agents = list(range(self.env.num_players(...
class OpenSpielEnv(MultiAgentEnv): def __init__(self, env): pass def reset(self, *, seed: Optional[int]=None, options: Optional[dict]=None): pass def step(self, action): pass def render(self, mode=None) -> None: pass def _get_obs(self): pass def _so...
7
0
19
2
14
4
2
0.27
1
9
0
0
6
7
6
6
119
14
83
24
76
22
52
24
45
4
1
2
13
11,374
ray-project/ray
rllib/env/wrappers/pettingzoo_env.py
rllib.env.wrappers.pettingzoo_env.ParallelPettingZooEnv
from typing import Optional from ray.rllib.env.multi_agent_env import MultiAgentEnv from ray.rllib.utils.annotations import PublicAPI import gymnasium as gym @PublicAPI class ParallelPettingZooEnv(MultiAgentEnv): def __init__(self, env): super().__init__() self.par_env = env self.par_env.r...
@PublicAPI class ParallelPettingZooEnv(MultiAgentEnv): def __init__(self, env): pass def reset(self, *, seed: Optional[int]=None, options: Optional[dict]=None): pass def step(self, action_dict): pass def close(self): pass def render(self): pass @prope...
9
0
4
0
4
0
1
0
1
4
0
0
6
4
6
6
33
6
27
14
19
0
22
13
15
1
1
0
6
11,375
ray-project/ray
rllib/env/wrappers/pettingzoo_env.py
rllib.env.wrappers.pettingzoo_env.PettingZooEnv
import gymnasium as gym from ray.rllib.env.multi_agent_env import MultiAgentEnv from typing import Optional from ray.rllib.utils.annotations import PublicAPI @PublicAPI class PettingZooEnv(MultiAgentEnv): """An interface to the PettingZoo MARL environment library. See: https://github.com/Farama-Foundation/Pet...
@PublicAPI class PettingZooEnv(MultiAgentEnv): '''An interface to the PettingZoo MARL environment library. See: https://github.com/Farama-Foundation/PettingZoo Inherits from MultiAgentEnv and exposes a given AEC (actor-environment-cycle) game from the PettingZoo project via the MultiAgentEnv public ...
9
1
9
1
8
0
1
1.55
1
4
0
0
6
4
6
6
169
39
51
21
43
79
39
20
32
3
1
2
8
11,376
ray-project/ray
rllib/evaluation/collectors/agent_collector.py
rllib.evaluation.collectors.agent_collector.AgentCollector
from gymnasium.spaces import Space import tree import numpy as np from ray.rllib.policy.view_requirement import ViewRequirement import copy from typing import Any, Dict, List, Optional from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.utils.annotations import OldAPIStack from ray.rllib.utils.spaces.s...
@OldAPIStack class AgentCollector: '''Collects samples for one agent in one trajectory (episode). The agent may be part of a multi-agent environment. Samples are stored in lists including some possible automatic "shift" buffer at the beginning to be able to save memory when storing things like NEXT_OBS,...
17
12
44
4
25
15
5
0.64
0
10
0
0
14
14
14
14
638
71
347
110
304
221
217
81
202
20
0
4
76
11,377
ray-project/ray
rllib/evaluation/collectors/sample_collector.py
rllib.evaluation.collectors.sample_collector.SampleCollector
from ray.rllib.policy.policy_map import PolicyMap from ray.rllib.utils.annotations import OldAPIStack from typing import TYPE_CHECKING, Dict, List, Optional, Union from ray.rllib.policy.sample_batch import MultiAgentBatch, SampleBatch from abc import ABCMeta, abstractmethod from ray.rllib.utils.typing import AgentID, E...
@OldAPIStack class SampleCollector(metaclass=ABCMeta): '''Collects samples for all policies and agents from a multi-agent env. This API is controlled by RolloutWorker objects to store all data generated by Environments and Policies/Models during rollout and postprocessing. It's purposes are to a) make d...
19
10
28
3
6
19
1
2.86
1
5
0
0
9
6
9
29
279
36
63
55
14
180
24
16
14
1
3
0
9
11,378
ray-project/ray
rllib/evaluation/collectors/simple_list_collector.py
rllib.evaluation.collectors.simple_list_collector.SimpleListCollector
from ray.rllib.utils.annotations import OldAPIStack, override from ray.rllib.policy.policy_map import PolicyMap from ray.rllib.utils.spaces.space_utils import get_dummy_batch_for_space from ray.rllib.evaluation.collectors.agent_collector import AgentCollector from ray.rllib.evaluation.collectors.sample_collector import...
@OldAPIStack class SimpleListCollector(SampleCollector): '''Util to build SampleBatches for each policy in a multi-agent env. Input data is per-agent, while output data is per-policy. There is an M:N mapping between agents and policies. We retain one local batch builder per agent. When an agent is done,...
22
4
46
5
33
8
6
0.26
1
14
2
0
12
11
12
12
585
69
410
118
354
106
215
73
201
24
1
5
76
11,379
ray-project/ray
rllib/evaluation/collectors/simple_list_collector.py
rllib.evaluation.collectors.simple_list_collector._PolicyCollector
from ray.rllib.policy.policy import Policy from ray.rllib.utils.annotations import OldAPIStack, override from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch, concat_samples from ray.rllib.utils.typing import AgentID, EpisodeID, EnvID, PolicyID, TensorType, ViewRequirementsDict @OldAPIStack class _Po...
@OldAPIStack class _PolicyCollector: '''Collects already postprocessed (single agent) samples for one policy. Samples come in through already postprocessed SampleBatches, which contain single episode/trajectory data for a single agent and are then appended to this policy's buffers. ''' def __in...
5
4
18
2
6
10
2
1.79
0
0
0
0
3
3
3
3
63
10
19
11
13
34
17
9
13
3
0
2
5
11,380
ray-project/ray
rllib/evaluation/collectors/simple_list_collector.py
rllib.evaluation.collectors.simple_list_collector._PolicyCollectorGroup
class _PolicyCollectorGroup: def __init__(self, policy_map): self.policy_collectors = {} self.env_steps = 0 self.agent_steps = 0
class _PolicyCollectorGroup: def __init__(self, policy_map): pass
2
0
7
0
4
3
1
0.6
0
0
0
0
1
3
1
1
8
0
5
5
3
3
5
5
3
1
0
0
1
11,381
ray-project/ray
rllib/evaluation/env_runner_v2.py
rllib.evaluation.env_runner_v2.EnvRunnerV2
from ray.rllib.env.base_env import ASYNC_RESET_RETURN, BaseEnv from ray.rllib.evaluation.collectors.simple_list_collector import _PolicyCollectorGroup from ray.rllib.evaluation.episode_v2 import EpisodeV2 from ray.rllib.utils.typing import ActionConnectorDataType, AgentConnectorDataType, AgentID, EnvActionType, EnvID, ...
@OldAPIStack class EnvRunnerV2: '''Collect experiences from user environment using Connectors.''' def __init__(self, worker: 'RolloutWorker', base_env: BaseEnv, multiple_episodes_in_batch: bool, callbacks: 'RLlibCallback', perf_stats: _PerfStats, rollout_fragment_length: int=200, count_steps_by: str='env_steps...
20
16
55
6
33
16
4
0.51
0
13
2
0
17
12
17
17
985
117
576
184
500
295
270
123
250
19
0
4
80
11,382
ray-project/ray
rllib/evaluation/env_runner_v2.py
rllib.evaluation.env_runner_v2._NewDefaultDict
from collections import defaultdict from ray.rllib.utils.annotations import OldAPIStack @OldAPIStack class _NewDefaultDict(defaultdict): def __missing__(self, env_id): ret = self[env_id] = self.default_factory(env_id) return ret
@OldAPIStack class _NewDefaultDict(defaultdict): def __missing__(self, env_id): pass
3
0
3
0
3
0
1
0
1
0
0
0
1
0
1
1
4
0
4
3
2
0
4
3
2
1
1
0
1
11,383
ray-project/ray
rllib/evaluation/env_runner_v2.py
rllib.evaluation.env_runner_v2._PerfStats
from ray.rllib.utils.annotations import OldAPIStack from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Set, Tuple, Union @OldAPIStack class _PerfStats: """Sampler perf stats that will be included in rollout metrics.""" def __init__(self, ema_coef: Optional[float]=None): self.ema_coef = ...
@OldAPIStack class _PerfStats: '''Sampler perf stats that will be included in rollout metrics.''' def __init__(self, ema_coef: Optional[float]=None): pass def incr(self, field: str, value: Union[int, float]): pass def _get_avg(self): pass def _get_ema(self): pass ...
7
1
12
0
8
4
2
0.51
0
3
0
0
5
7
5
5
69
7
41
14
35
21
25
14
19
3
0
1
8
11,384
ray-project/ray
rllib/evaluation/episode_v2.py
rllib.evaluation.episode_v2.EpisodeV2
from ray.rllib.evaluation.collectors.simple_list_collector import _PolicyCollector, _PolicyCollectorGroup from ray.rllib.policy.sample_batch import SampleBatch from ray.rllib.env.base_env import _DUMMY_AGENT_ID from ray.rllib.policy.policy_map import PolicyMap from collections import defaultdict from ray.rllib.evaluati...
@OldAPIStack class EpisodeV2: '''Tracks the current state of a (possibly multi-agent) episode.''' def __init__(self, env_id: EnvID, policies: PolicyMap, policy_mapping_fn: Callable[[AgentID, 'EpisodeV2', 'RolloutWorker'], PolicyID], *, worker: Optional['RolloutWorker']=None, callbacks: Optional['RLlibCallback'...
18
10
23
3
13
7
2
0.53
0
8
0
0
15
25
15
15
356
54
199
81
153
105
117
52
100
10
0
2
32
11,385
ray-project/ray
rllib/evaluation/observation_function.py
rllib.evaluation.observation_function.ObservationFunction
from ray.rllib.evaluation import RolloutWorker from ray.rllib.env import BaseEnv from typing import Dict from ray.rllib.utils.typing import AgentID, PolicyID from ray.rllib.utils.annotations import OldAPIStack from ray.rllib.utils.framework import TensorType from ray.rllib.policy import Policy @OldAPIStack class Obser...
@OldAPIStack class ObservationFunction: '''Interceptor function for rewriting observations from the environment. These callbacks can be used for preprocessing of observations, especially in multi-agent scenarios. Observation functions can be specified in the multi-agent config by specifying ``{"obse...
3
2
63
14
10
39
1
4.27
0
0
0
0
1
0
1
1
76
18
11
10
1
47
3
2
1
1
0
0
1
11,386
ray-project/ray
rllib/evaluation/postprocessing.py
rllib.evaluation.postprocessing.Postprocessing
from ray.rllib.utils.annotations import DeveloperAPI, OldAPIStack @DeveloperAPI class Postprocessing: """Constant definitions for postprocessing.""" ADVANTAGES = 'advantages' VALUE_TARGETS = 'value_targets'
@DeveloperAPI class Postprocessing: '''Constant definitions for postprocessing.''' pass
2
1
0
0
0
0
0
0.33
0
0
0
0
0
0
0
0
5
1
3
3
2
1
3
3
2
0
0
0
0
11,387
ray-project/ray
rllib/evaluation/rollout_worker.py
rllib.evaluation.rollout_worker.RolloutWorker
import importlib.util from ray.rllib.env.external_multi_agent_env import ExternalMultiAgentEnv from ray.util.iter import ParallelIteratorWorker from ray.rllib.evaluation.metrics import RolloutMetrics from ray.rllib.utils.filter import Filter, NoFilter import ray from ray.tune.registry import registry_contains_input, re...
@OldAPIStack class RolloutWorker(ParallelIteratorWorker, EnvRunner): '''Common experience collection class. This class wraps a policy instance and an environment class to collect experiences from the environment. You can create many replicas of this class as Ray actors to scale RL training. This cla...
66
39
32
4
18
10
4
0.64
2
17
0
0
47
32
47
53
1,849
256
970
281
795
624
480
168
418
35
2
3
196
11,388
ray-project/ray
rllib/evaluation/sample_batch_builder.py
rllib.evaluation.sample_batch_builder.MultiAgentSampleBatchBuilder
from ray.rllib.env.base_env import _DUMMY_AGENT_ID from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch from ray._common.deprecation import deprecation_warning from typing import List, Any, Dict, TYPE_CHECKING from ray.rllib.utils.debug import summarize from ray.rllib.utils.typing import PolicyID, Age...
@OldAPIStack class MultiAgentSampleBatchBuilder: '''Util to build SampleBatches for each policy in a multi-agent env. Input data is per-agent, while output data is per-policy. There is an M:N mapping between agents and policies. We retain one local batch builder per agent. When an agent is done, then it...
9
7
26
3
15
7
3
0.53
0
6
1
0
7
7
7
7
194
29
108
32
94
57
63
27
54
11
0
2
24
11,389
ray-project/ray
rllib/evaluation/sample_batch_builder.py
rllib.evaluation.sample_batch_builder.SampleBatchBuilder
from typing import List, Any, Dict, TYPE_CHECKING import numpy as np from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch import collections from ray.rllib.utils.annotations import OldAPIStack @OldAPIStack class SampleBatchBuilder: """Util to build a SampleBatch incrementally. For efficiency...
@OldAPIStack class SampleBatchBuilder: '''Util to build a SampleBatch incrementally. For efficiency, SampleBatches hold values in column form (as arrays). However, it is useful to add data one row (dict) at a time. ''' def __init__(self): pass def add_values(self, **values: Any) -> Non...
6
4
7
1
5
1
2
0.35
0
3
0
0
4
2
4
4
39
9
23
11
18
8
21
11
16
2
0
1
7
11,390
ray-project/ray
rllib/evaluation/sampler.py
rllib.evaluation.sampler.SamplerInput
from ray.rllib.policy.sample_batch import concat_samples from ray.rllib.utils.typing import SampleBatchType from ray.rllib.utils.annotations import OldAPIStack, override from ray.rllib.evaluation.metrics import RolloutMetrics from typing import TYPE_CHECKING, Any, List, Optional, Type, Union from abc import ABCMeta, ab...
@OldAPIStack class SamplerInput(InputReader, metaclass=ABCMeta): '''Reads input experiences from an existing sampler.''' @override(InputReader) def next(self) -> SampleBatchType: pass @abstractmethod def get_data(self) -> SampleBatchType: '''Called by `self.next()` to return the next...
10
4
10
2
3
6
1
1.41
2
2
0
1
4
0
4
24
51
10
17
10
8
24
13
6
8
2
3
1
5
11,391
ray-project/ray
rllib/evaluation/sampler.py
rllib.evaluation.sampler.SyncSampler
from ray.rllib.evaluation.metrics import RolloutMetrics from ray.rllib.utils.typing import SampleBatchType from ray.rllib.evaluation.collectors.simple_list_collector import SimpleListCollector from typing import TYPE_CHECKING, Any, List, Optional, Type, Union from ray.rllib.evaluation.env_runner_v2 import EnvRunnerV2, ...
@OldAPIStack class SyncSampler(SamplerInput): '''Sync SamplerInput that collects experiences when `get_data()` is called.''' def __init__(self, *, worker: 'RolloutWorker', env: BaseEnv, clip_rewards: Union[bool, float], rollout_fragment_length: int, count_steps_by: str='env_steps', callbacks: 'RLlibCallback', ...
9
2
34
1
24
9
5
0.38
1
5
0
0
4
9
4
28
146
7
101
43
70
38
52
17
47
11
4
2
20
11,392
ray-project/ray
rllib/evaluation/sampler.py
rllib.evaluation.sampler._NewEpisodeDefaultDict
from collections import defaultdict, namedtuple class _NewEpisodeDefaultDict(defaultdict): def __missing__(self, env_id): if self.default_factory is None: raise KeyError(env_id) else: ret = self[env_id] = self.default_factory(env_id) return ret
class _NewEpisodeDefaultDict(defaultdict): def __missing__(self, env_id): pass
2
0
6
0
6
0
2
0
1
1
0
0
1
0
1
1
7
0
7
3
5
0
6
3
4
2
1
1
2
11,393
ray-project/ray
rllib/examples/_old_api_stack/models/action_mask_model.py
rllib.examples._old_api_stack.models.action_mask_model.ActionMaskModel
from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from ray.rllib.models.tf.fcnet import FullyConnectedNetwork from ray.rllib.models.torch.fcnet import FullyConnectedNetwork as TorchFC from gymnasium.spaces import Dict class ActionMaskModel(TFModelV2): """Model that handles simple discrete action masking. T...
class ActionMaskModel(TFModelV2): '''Model that handles simple discrete action masking. This assumes the outputs are logits for a single Categorical action dist. Getting this to work with a more complex output (e.g., if the action space is a tuple of several distributions) is also possible but left as ...
4
1
14
3
9
2
1
0.41
1
1
0
0
3
2
3
3
53
12
29
13
23
12
17
11
13
2
1
1
4
11,394
ray-project/ray
rllib/examples/_old_api_stack/models/action_mask_model.py
rllib.examples._old_api_stack.models.action_mask_model.TorchActionMaskModel
from ray.rllib.models.torch.fcnet import FullyConnectedNetwork as TorchFC from ray.rllib.models.torch.torch_modelv2 import TorchModelV2 from ray.rllib.utils.torch_utils import FLOAT_MIN from gymnasium.spaces import Dict class TorchActionMaskModel(TorchModelV2, nn.Module): """PyTorch version of above ActionMaskingM...
class TorchActionMaskModel(TorchModelV2, nn.Module): '''PyTorch version of above ActionMaskingModel.''' def __init__(self, obs_space, action_space, num_outputs, model_config, name, **kwargs): pass def forward(self, input_dict, state, seq_lens): pass def value_function(self): ...
4
1
17
2
13
2
2
0.17
2
0
0
0
3
2
3
3
57
10
40
19
28
7
20
11
16
2
1
1
5
11,395
ray-project/ray
rllib/examples/_old_api_stack/models/autoregressive_action_dist.py
rllib.examples._old_api_stack.models.autoregressive_action_dist.BinaryAutoregressiveDistribution
from ray.rllib.models.tf.tf_action_dist import Categorical, ActionDistribution class BinaryAutoregressiveDistribution(ActionDistribution): """Action distribution P(a1, a2) = P(a1) * P(a2 | a1)""" def deterministic_sample(self): a1_dist = self._a1_distribution() a1 = a1_dist.deterministic_sampl...
class BinaryAutoregressiveDistribution(ActionDistribution): '''Action distribution P(a1, a2) = P(a1) * P(a2 | a1)''' def deterministic_sample(self): pass def sample(self): pass def logp(self, actions): pass def sampled_action_logp(self): pass def entropy(sel...
11
1
6
1
5
1
1
0.18
1
0
0
0
8
1
9
9
66
14
45
35
34
8
44
34
34
1
1
0
9
11,396
ray-project/ray
rllib/examples/_old_api_stack/models/autoregressive_action_dist.py
rllib.examples._old_api_stack.models.autoregressive_action_dist.TorchBinaryAutoregressiveDistribution
from ray.rllib.models.torch.torch_action_dist import TorchCategorical, TorchDistributionWrapper class TorchBinaryAutoregressiveDistribution(TorchDistributionWrapper): """Action distribution P(a1, a2) = P(a1) * P(a2 | a1)""" def deterministic_sample(self): a1_dist = self._a1_distribution() a1 =...
class TorchBinaryAutoregressiveDistribution(TorchDistributionWrapper): '''Action distribution P(a1, a2) = P(a1) * P(a2 | a1)''' def deterministic_sample(self): pass def sample(self): pass def logp(self, actions): pass def sampled_action_logp(self): pass def ...
11
1
6
1
5
1
1
0.17
1
0
0
0
8
1
9
9
69
14
48
36
37
8
45
35
35
1
1
0
9
11,397
ray-project/ray
rllib/examples/_old_api_stack/models/autoregressive_action_model.py
rllib.examples._old_api_stack.models.autoregressive_action_model.AutoregressiveActionModel
from ray.rllib.models.tf.misc import normc_initializer from ray.rllib.models.torch.misc import normc_initializer as normc_init_torch from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from gymnasium.spaces import Discrete, Tuple class AutoregressiveActionModel(TFModelV2): """Implements the `.action_model` branch...
class AutoregressiveActionModel(TFModelV2): '''Implements the `.action_model` branch required above.''' def __init__(self, obs_space, action_space, num_outputs, model_config, name): pass def forward(self, input_dict, state, seq_lens): pass def value_function(self): pass
4
1
23
2
17
4
1
0.23
1
2
0
0
3
3
3
3
74
10
52
16
48
12
23
16
19
2
1
1
4
11,398
ray-project/ray
rllib/examples/_old_api_stack/models/autoregressive_action_model.py
rllib.examples._old_api_stack.models.autoregressive_action_model.TorchAutoregressiveActionModel
from ray.rllib.models.torch.misc import SlimFC from ray.rllib.models.torch.torch_modelv2 import TorchModelV2 from ray.rllib.models.torch.misc import normc_initializer as normc_init_torch from gymnasium.spaces import Discrete, Tuple class TorchAutoregressiveActionModel(TorchModelV2, nn.Module): """PyTorch version o...
class TorchAutoregressiveActionModel(TorchModelV2, nn.Module): '''PyTorch version of the AutoregressiveActionModel above.''' def __init__(self, obs_space, action_space, num_outputs, model_config, name): pass class _ActionModel(nn.Module): def __init__(self, obs_space, action_space, num_o...
7
1
17
2
14
2
1
0.17
2
2
1
0
3
5
3
3
72
11
52
16
45
9
25
16
18
2
1
1
6
11,399
ray-project/ray
rllib/examples/_old_api_stack/models/centralized_critic_models.py
rllib.examples._old_api_stack.models.centralized_critic_models.CentralizedCriticModel
from ray.rllib.models.tf.tf_modelv2 import TFModelV2 from ray.rllib.models.tf.fcnet import FullyConnectedNetwork from ray.rllib.models.torch.fcnet import FullyConnectedNetwork as TorchFC from ray.rllib.models.modelv2 import ModelV2 from ray.rllib.utils.annotations import override class CentralizedCriticModel(TFModelV2...
class CentralizedCriticModel(TFModelV2): '''Multi-agent model that implements a centralized value function.''' def __init__(self, obs_space, action_space, num_outputs, model_config, name): pass @override(ModelV2) def forward(self, input_dict, state, seq_lens): pass def central_val...
7
1
9
0
8
1
1
0.12
1
1
0
0
4
2
4
4
42
5
34
15
27
4
17
13
12
1
1
0
4