Pipeline eval
Encapsulating the call to the users evaluate_pipeline.
EvaluatePipelineReturn
module-attribute
#
EvaluatePipelineReturn: TypeAlias = (
Exception | UserResultDict | dict
)
The type of things evaluate_pipeline can return.
Exception: The evaluation failed.Mapping[str, Any]: A dict which follows the layout ofUserResultDict.
UserResult
dataclass
#
UserResult(
objective_to_minimize: float | None = None,
cost: float | None = None,
learning_curve: (
list[float] | list[list[float]] | None
) = None,
extra: dict[str, Any] = dict(),
exception: Exception | None = None,
inference_cost: float | None = None,
downstream_performances: dict[str, float] = dict(),
n_params: float | None = None,
n_data: float | None = None,
)
The parsed values out of the possibilities the user can return
from the evaluate_pipeline_function().
See UserResultDict for the
possibilities.
parse
classmethod
#
parse(
user_result: EvaluatePipelineReturn,
*,
default_objective_to_minimize_value: float | None,
default_cost_value: float | None = None,
default_learning_curve: (
Literal["objective_to_minimize"]
| list[float]
| None
) = None
) -> UserResult
Parse the return type a user can provide from evaluate_pipeline.
Source code in scalefm/state/pipeline_eval.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 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 265 266 267 268 269 270 271 272 273 274 275 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 341 342 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 | |
UserResultDict
#
Bases: TypedDict
The type of things you can include when returning
a dictionary from evaluate_pipeline.
objective_to_minimize and cost are required, the other fields are optional.
If an exception is provided, we count the trial as having failed.
cost
instance-attribute
#
cost: float | None
The training cost of the evaluation, e.g. its FLOPs. Required, unless a
cost_estimator is passed to scalefm.acquire().
downstream_performances
instance-attribute
#
The model's performance on downstream tasks, by name, e.g.
{"hellaswag_acc": 0.41}. The scaling plots draw each of them over the cost.
inference_cost
instance-attribute
#
inference_cost: float | None
The cost of using the trained model once, e.g. the FLOPs of one forward pass. The scaling plots are also drawn over it.
info_dict
instance-attribute
#
Extra information that will be stored with the trials result.
learning_curve
instance-attribute
#
The learning curve for this configuration: the loss at each checkpoint, or
rows of (n_data, flops, loss), which Chinchilla approach 1 and the power law
fit on.
evaluate_trial
#
evaluate_trial(
trial: Trial,
*,
evaluation_fn: Callable[..., Any],
default_report_values: DefaultReportValues
) -> tuple[Trial, Report | None]
Evaluates a trial from a user and parses the results into a Report.