PatchRL
This commit is contained in:
parent
f921d34bf8
commit
eea3fe103d
2 changed files with 6 additions and 4 deletions
|
|
@ -20,3 +20,4 @@ from .mistral import FastMistralModel
|
|||
from .qwen2 import FastQwen2Model
|
||||
from .dpo import PatchDPOTrainer, PatchKTOTrainer
|
||||
from ._utils import is_bfloat16_supported
|
||||
from .rl import PatchRL
|
||||
|
|
|
|||
|
|
@ -13,14 +13,15 @@
|
|||
# limitations under the License.
|
||||
|
||||
__all__ = [
|
||||
"patch_rl",
|
||||
"PatchRL",
|
||||
]
|
||||
|
||||
from trl.models.utils import unwrap_model_for_generation
|
||||
from contextlib import contextmanager
|
||||
|
||||
def PatchRL(FastLanguageModel):
|
||||
|
||||
def patch_rl(FastLanguageModel):
|
||||
from trl.models.utils import unwrap_model_for_generation
|
||||
from contextlib import contextmanager
|
||||
|
||||
@contextmanager
|
||||
def unsloth_unwrap_model_for_generation(model, *args, **kwargs):
|
||||
FastLanguageModel.for_inference(model)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue