MCPcopy
hub / github.com/huggingface/transformers / pop_callback

Method pop_callback

src/transformers/trainer.py:4384–4398  ·  view source on GitHub ↗

Remove a callback from the current list of [`~transformers.TrainerCallback`] and returns it. If the callback is not found, returns `None` (and no error is raised). Args: callback (`type` or [`~transformers.TrainerCallback]`): A [`~transformers.Tra

(self, callback: type[TrainerCallback] | TrainerCallback)

Source from the content-addressed store, hash-verified

4382 self.callback_handler.add_callback(callback)
4383
4384 def pop_callback(self, callback: type[TrainerCallback] | TrainerCallback) -> TrainerCallback | None:
4385 """
4386 Remove a callback from the current list of [`~transformers.TrainerCallback`] and returns it.
4387
4388 If the callback is not found, returns `None` (and no error is raised).
4389
4390 Args:
4391 callback (`type` or [`~transformers.TrainerCallback]`):
4392 A [`~transformers.TrainerCallback`] class or an instance of a [`~transformers.TrainerCallback`]. In the
4393 first case, will pop the first member of that class found in the list of callbacks.
4394
4395 Returns:
4396 [`~transformers.TrainerCallback`]: The callback removed, if found.
4397 """
4398 return self.callback_handler.pop_callback(callback)
4399
4400 def remove_callback(self, callback: type[TrainerCallback] | TrainerCallback) -> None:
4401 """

Callers 3

_objectiveFunction · 0.45
run_hp_search_rayFunction · 0.45

Calls

no outgoing calls

Tested by 1