Merge main (with #5319 patch_* fixes) into PR #5312 branch so consolidated CI cells exercise the fixed patches under continue-on-error=false.
This commit is contained in:
commit
b79ae267b6
3 changed files with 21 additions and 1 deletions
|
|
@ -2483,6 +2483,7 @@ def patch_tokenizer(model, tokenizer):
|
|||
|
||||
def patch_fast_lora():
|
||||
import peft.tuners.lora.bnb
|
||||
from ..kernels.fast_lora import fast_lora_forward
|
||||
|
||||
peft.tuners.lora.bnb.Linear4bit.forward = fast_lora_forward
|
||||
|
||||
|
|
|
|||
|
|
@ -1780,7 +1780,20 @@ def openenv_vllm_reload_weights():
|
|||
patch_target_name = "generate_rollout_completions"
|
||||
patch_target = getattr(openenv_utils, patch_target_name)
|
||||
|
||||
src = inspect.getsource(patch_target)
|
||||
# TRL 0.29.1+ ships some openenv helpers as compiled bytecode without
|
||||
# accessible source on disk; inspect.getsource raises OSError("could
|
||||
# not get source code") in that case. Skip the source-rewrite patch
|
||||
# rather than crashing -- the core unsloth weight-reload path stays
|
||||
# functional, only the wake_up tag rewrite is skipped.
|
||||
try:
|
||||
src = inspect.getsource(patch_target)
|
||||
except OSError as e:
|
||||
logger.warning(
|
||||
f"Unsloth: Could not retrieve source for trl openenv "
|
||||
f"{patch_target_name} ({e}); skipping rewrite. "
|
||||
f"Weight reload still functional."
|
||||
)
|
||||
return
|
||||
src = textwrap.dedent(src)
|
||||
original_src = src
|
||||
|
||||
|
|
|
|||
|
|
@ -1580,6 +1580,12 @@ def patch_sft_trainer_tokenizer():
|
|||
except:
|
||||
return
|
||||
all_imports = dir(trl.trainer.sft_trainer)
|
||||
# Make typing names available to the exec'd source bodies. TRL >= 1.x
|
||||
# type-hints _prepare_dataset / _prepare_non_packed_dataloader with
|
||||
# `Union[...]` and friends; without these imports in the exec namespace
|
||||
# those become NameErrors at exec time. Mirrors the pattern used in
|
||||
# unsloth/models/_utils.py:patch_linear_scaling.
|
||||
from typing import Union, Optional, List, Any, Callable, Tuple, Dict, Iterator # noqa: F401
|
||||
|
||||
for (
|
||||
function_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue