Skip to content

Commit

Permalink
Release: 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BobaZooba committed Nov 15, 2023
1 parent 3e07291 commit 88b26b2
Show file tree
Hide file tree
Showing 8 changed files with 16,115 additions and 16,102 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,17 @@ from xllm.datasets import GeneralDataset
from xllm.experiments import Experiment

# Init Config which controls the internal logic of xllm
config = Config(model_name_or_path="HuggingFaceH4/zephyr-7b-beta")
# QLoRA example
config = Config(
model_name_or_path="HuggingFaceH4/zephyr-7b-beta",
stabilize=True,
apply_lora=True,
load_in_4bit=True,
push_to_hub=True,
hub_private_repo=True,
hub_model_id="BobaZooba/SupaDupaZephyr-7B-LoRA",
save_steps=1_000,
)

# Prepare the data
train_data = ["Hello!"] * 100
Expand Down

Large diffs are not rendered by default.

5,366 changes: 2,683 additions & 2,683 deletions examples/notebooks/🦖_X—LLM_Prototyping.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
# Setup
setup(
name="xllm",
version="0.0.10",
version="0.1.0",
description="Simple & Cutting Edge LLM Finetuning",
license_files=["LICENSE"],
long_description=open("README.md", "r", encoding="utf-8").read(),
Expand Down
2 changes: 1 addition & 1 deletion src/xllm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# ruff: noqa: F401

__version__ = "0.0.10"
__version__ = "0.1.0"

from . import enums, types
from .cli.fuse import cli_run_fuse
Expand Down
11 changes: 9 additions & 2 deletions src/xllm/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ class Config:
"help": "Device map for loading the model",
},
)
prepare_model_for_kbit_training: bool = field(
default=True,
prepare_model_for_kbit_training: Optional[bool] = field(
default=None,
metadata={
"help": "Prepare or not for kbit training",
},
Expand Down Expand Up @@ -1069,3 +1069,10 @@ def lora_model_name_or_path_for_fusing(self) -> str:
return self.lora_model_local_path
else:
raise ValueError("Please set lora_hub_model_id or lora_model_local_path for fusing")

@property
def need_to_prepare_model_for_kbit_training(self) -> bool:
if self.prepare_model_for_kbit_training is not None:
return self.prepare_model_for_kbit_training
else:
return self.from_gptq or self.load_in_4bit or self.load_in_8bit
2 changes: 1 addition & 1 deletion src/xllm/core/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def build_model(
)
model.config.pretraining_tp = 1

if quantization_config is not None and config.prepare_model_for_kbit_training:
if quantization_config is not None and config.need_to_prepare_model_for_kbit_training:
model = prepare_model_for_kbit_training(
model=model, use_gradient_checkpointing=config.use_gradient_checkpointing
)
Expand Down
2 changes: 1 addition & 1 deletion src/xllm/experiments/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def bnb_quantization(self) -> None:
)
self.model.is_loaded_in_4bit = self.config.load_in_4bit
self.model.is_loaded_in_8bit = self.config.load_in_8bit
if self.config.prepare_model_for_kbit_training:
if self.config.need_to_prepare_model_for_kbit_training:
self.model = prepare_model_for_kbit_training(
model=self.model, use_gradient_checkpointing=self.config.use_gradient_checkpointing
)
Expand Down

0 comments on commit 88b26b2

Please sign in to comment.