Skip to content

Commit db2a358

Browse files
authored
add peft install back since it doesn't get installed by setup.py (axolotl-ai-cloud#331)
1 parent 6c9a87c commit db2a358

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

docker/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update && \
1111

1212
WORKDIR /workspace
1313

14+
RUN pip3 install --force-reinstall "peft @ git+https://github.com/huggingface/peft.git@main"
1415
RUN git clone --depth=1 https://github.com/OpenAccess-AI-Collective/axolotl.git
1516
# If AXOLOTL_EXTRAS is set, append it in brackets
1617
RUN cd axolotl && \

src/axolotl/utils/models.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,17 @@ def load_model(
147147
LOG.exception(err)
148148
raise err
149149

150-
try:
151-
from peft import prepare_model_for_kbit_training
152-
except ImportError:
153-
# For backward compatibility
154-
from peft import (
155-
prepare_model_for_int8_training as prepare_model_for_kbit_training,
156-
)
150+
if not cfg.gptq and (
151+
(cfg.adapter == "lora" and load_in_8bit)
152+
or (cfg.adapter == "qlora" and cfg.load_in_4bit)
153+
):
154+
try:
155+
from peft import prepare_model_for_kbit_training
156+
except ImportError:
157+
# For backward compatibility
158+
from peft import (
159+
prepare_model_for_int8_training as prepare_model_for_kbit_training,
160+
)
157161

158162
model_kwargs = {}
159163
if cfg.model_revision:

0 commit comments

Comments
 (0)