Wandb Sweep Config Dataclasses¤
Wandb Sweep Config Dataclasses.
Weights & Biases just provide a JSON Schema, so we've converted here to dataclasses.
Controller
dataclass
¤
Controller.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
164 165 166 167 168 |
|
ControllerType
¤
Bases: LowercaseStrEnum
Controller Type.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
CLOUD = auto()
class-attribute
instance-attribute
¤
Weights & Biases cloud controller.
Utilizes Weights & Biases as the sweep controller, enabling launching of multiple nodes that all communicate with the Weights & Biases cloud service to coordinate the sweep.
LOCAL = auto()
class-attribute
instance-attribute
¤
Local controller.
Manages the sweep operation locally, without the need for cloud-based coordination or external services.
Distribution
¤
Bases: LowercaseStrEnum
Sweep Distribution.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
BETA = auto()
class-attribute
instance-attribute
¤
Beta distribution.
Utilizes the Beta distribution, a family of continuous probability distributions defined on the interval [0, 1], for parameter sampling.
CATEGORICAL = auto()
class-attribute
instance-attribute
¤
Categorical distribution.
Employs a categorical distribution for discrete variable sampling, where each category has an equal probability of being selected.
CATEGORICAL_W_PROBABILITIES = auto()
class-attribute
instance-attribute
¤
Categorical distribution with probabilities.
Similar to categorical distribution but allows assigning different probabilities to each category.
CONSTANT = auto()
class-attribute
instance-attribute
¤
Constant distribution.
Uses a constant value for the parameter, ensuring it remains the same across all runs.
INT_UNIFORM = auto()
class-attribute
instance-attribute
¤
Integer uniform distribution.
Samples integer values uniformly across a specified range.
INV_LOG_UNIFORM = auto()
class-attribute
instance-attribute
¤
Inverse log-uniform distribution.
Samples values according to an inverse log-uniform distribution, useful for parameters that span several orders of magnitude.
INV_LOG_UNIFORM_VALUES = auto()
class-attribute
instance-attribute
¤
Inverse log-uniform values distribution.
Similar to the inverse log-uniform distribution but allows specifying exact values to be sampled.
Goal
¤
Bases: LowercaseStrEnum
Goal.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
MAXIMIZE = auto()
class-attribute
instance-attribute
¤
Maximization goal.
Sets the objective of the hyperparameter tuning process to maximize a specified metric.
MINIMIZE = auto()
class-attribute
instance-attribute
¤
Minimization goal.
Aims to minimize a specified metric during the hyperparameter tuning process.
HyperbandStopping
dataclass
¤
Hyperband Stopping Config.
Speed up hyperparameter search by killing off runs that appear to have lower performance than successful training runs.
Example
HyperbandStopping(type=HyperbandStoppingType.HYPERBAND) HyperbandStopping(type=hyperband)
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
eta: float | None = None
class-attribute
instance-attribute
¤
ETA.
Specify the bracket multiplier schedule (default: 3).
maxiter: int | None = None
class-attribute
instance-attribute
¤
Max Iterations.
Specify the maximum number of iterations. Note this is number of times the metric is logged, not the number of activations.
miniter: int | None = None
class-attribute
instance-attribute
¤
Min Iterations.
Set the first epoch to start trimming runs, and hyperband will automatically calculate the subsequent epochs to trim runs.
s: float | None = None
class-attribute
instance-attribute
¤
Set the number of steps you trim runs at, working backwards from the max_iter.
strict: bool | None = None
class-attribute
instance-attribute
¤
Use a more aggressive condition for termination, stops more runs.
__repr__()
¤
Representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
224 225 226 227 |
|
__str__()
¤
String representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
211 212 213 214 215 216 217 218 219 220 221 222 |
|
HyperbandStoppingType
¤
Bases: LowercaseStrEnum
Hyperband Stopping Type.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
31 32 33 34 35 36 37 38 39 |
|
HYPERBAND = auto()
class-attribute
instance-attribute
¤
Hyperband algorithm.
Implements the Hyperband stopping algorithm, an adaptive resource allocation and early-stopping method to efficiently tune hyperparameters.
Impute
¤
Bases: LowercaseStrEnum
Metric value to use in bayes search for runs that fail, crash, or are killed.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
96 97 98 99 100 101 |
|
ImputeWhileRunning
¤
Bases: LowercaseStrEnum
Appends a calculated metric even when epochs are in a running state.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
104 105 106 107 108 109 110 |
|
Kind
¤
Bases: LowercaseStrEnum
Kind.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
42 43 44 45 |
|
Method
¤
Bases: LowercaseStrEnum
Method.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
BAYES = auto()
class-attribute
instance-attribute
¤
Bayesian optimization.
Employs Bayesian optimization for hyperparameter tuning, a probabilistic model-based approach for finding the optimal set of parameters.
CUSTOM = auto()
class-attribute
instance-attribute
¤
Custom method.
Allows for a user-defined custom method for hyperparameter tuning, providing flexibility in the sweep process.
GRID = auto()
class-attribute
instance-attribute
¤
Grid search.
Utilizes a grid search approach for hyperparameter tuning, systematically working through multiple combinations of parameter values.
RANDOM = auto()
class-attribute
instance-attribute
¤
Random search.
Implements a random search strategy for hyperparameter tuning, exploring the parameter space randomly.
Metric
dataclass
¤
Metric to optimize.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
impute: Impute | None = None
class-attribute
instance-attribute
¤
Metric value to use in bayes search for runs that fail, crash, or are killed
imputewhilerunning: ImputeWhileRunning | None = None
class-attribute
instance-attribute
¤
Appends a calculated metric even when epochs are in a running state.
name: str
instance-attribute
¤
Name of metric.
target: float | None = None
class-attribute
instance-attribute
¤
The sweep will finish once any run achieves this value.
__repr__()
¤
Representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
261 262 263 264 |
|
__str__()
¤
String representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
248 249 250 251 252 253 254 255 256 257 258 259 |
|
NestedParameter
dataclass
¤
Bases: ABC
Nested Parameter.
Example
from dataclasses import field @dataclass(frozen=True) ... class MyNestedParameter(NestedParameter): ... a: int = field(default=Parameter(1)) ... b: int = field(default=Parameter(2)) MyNestedParameter().to_dict() {'parameters': {'a': {'value': 1}, 'b': {'value': 2}}}
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
|
__dict__()
¤
Return dict representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
378 379 380 |
|
to_dict()
¤
Return dict representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
|
Parameter
dataclass
¤
Bases: Generic[ParamType]
Sweep Parameter.
https://docs.wandb.ai/guides/sweeps/define-sweep-configuration#parameters
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
distribution: Distribution | None = None
class-attribute
instance-attribute
¤
Distribution
If not specified, will default to categorical if values is set, to int_uniform if max and min are set to integers, to uniform if max and min are set to floats, or to constant if value is set.
max: ParamType | None = None
class-attribute
instance-attribute
¤
Maximum value.
min: ParamType | None = None
class-attribute
instance-attribute
¤
Minimum value.
mu: float | None = None
class-attribute
instance-attribute
¤
Mean for normal or lognormal distributions
probabilities: list[float] | None = None
class-attribute
instance-attribute
¤
Probability of each value
q: float | None = None
class-attribute
instance-attribute
¤
Quantization parameter.
Quantization step size for quantized hyperparameters.
sigma: float | None = None
class-attribute
instance-attribute
¤
Std Dev for normal or lognormal distributions
value: ParamType | None = None
class-attribute
instance-attribute
¤
Single value.
Specifies the single valid value for this hyperparameter. Compatible with grid.
values: list[ParamType] | None = None
class-attribute
instance-attribute
¤
Discrete values.
Specifies all valid values for this hyperparameter. Compatible with grid.
__repr__()
¤
Representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
337 338 339 340 |
|
__str__()
¤
String representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
324 325 326 327 328 329 330 331 332 333 334 335 |
|
Parameters
dataclass
¤
Parameters
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
383 384 385 |
|
WandbSweepConfig
dataclass
¤
Weights & Biases Sweep Configuration.
Example
config = WandbSweepConfig( ... parameters={"lr": Parameter(value=1e-3)}, ... method=Method.BAYES, ... metric=Metric(name="loss"), ... ) print(config.to_dict()["parameters"]) {'lr': {'value': 0.001}}
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
|
command: list[Any] | None = None
class-attribute
instance-attribute
¤
Command used to launch the training script
description: str | None = None
class-attribute
instance-attribute
¤
Short package description
entity: str | None = None
class-attribute
instance-attribute
¤
The entity for this sweep
imageuri: str | None = None
class-attribute
instance-attribute
¤
Sweeps on Launch will use this uri instead of a job.
job: str | None = None
class-attribute
instance-attribute
¤
Launch Job to run.
method: Method
instance-attribute
¤
Method (search strategy).
metric: Metric
instance-attribute
¤
Metric to optimize
name: str | None = None
class-attribute
instance-attribute
¤
The name of the sweep, displayed in the W&B UI.
program: str | None = None
class-attribute
instance-attribute
¤
Training script to run.
project: str | None = None
class-attribute
instance-attribute
¤
The project for this sweep.
__dict__()
¤
Return dict representation of this object.
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
491 492 493 |
|
to_dict()
¤
Return dict representation of this object.
Recursively removes all None values. Handles special cases of dataclass
instances and values that are NestedParameter
instances.
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: The dict representation of the object. |
Source code in sparse_autoencoder/train/utils/wandb_sweep_types.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|