Monkey patch fixes

This commit is contained in:
oobabooga 2023-04-25 21:20:26 -03:00
parent da812600f4
commit 9b272bc8e5
3 changed files with 13 additions and 6 deletions

View file

@ -6,6 +6,7 @@ from pathlib import Path
sys.path.insert(0, str(Path("repositories/alpaca_lora_4bit")))
import autograd_4bit
from amp_wrapper import AMPWrapper
from autograd_4bit import (Autograd4bitQuantLinear,
load_llama_model_4bit_low_ram)
from monkeypatch.peft_tuners_lora_monkey_patch import (
@ -31,6 +32,10 @@ def load_model_llama(model_name):
autograd_4bit.use_new = True
autograd_4bit.auto_switch = True
model.half()
wrapper = AMPWrapper(model)
wrapper.apply_generate()
try:
tokenizer.eos_token_id = 2
tokenizer.bos_token_id = 1