Skip to content

Update finetune.py #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
sys.path.append(os.path.join(os.getcwd(), "peft/src/"))
from peft import ( # noqa: E402
LoraConfig,
BottleneckConfig,
PrefixTuningConfig,
get_peft_model,
get_peft_model_state_dict,
Expand Down Expand Up @@ -48,14 +47,6 @@ def train(
lora_alpha: int = 16,
lora_dropout: float = 0.05,
lora_target_modules: List[str] = None,
# bottleneck adapter hyperparams
bottleneck_size: int = 256,
non_linearity: str = "tanh",
adapter_dropout: float = 0.0,
use_parallel_adapter: bool = False,
use_adapterp: bool = False,
target_modules: List[str] = None,
scaling: Union[float, str] = 1.0,
# prefix tuning hyperparams
num_virtual_tokens: int = 30,
# llm hyperparams
Expand Down Expand Up @@ -203,18 +194,7 @@ def generate_and_tokenize_prompt(data_point):
bias="none",
task_type="CAUSAL_LM",
)
elif adapter_name == "bottleneck":
config = BottleneckConfig(
bottleneck_size=bottleneck_size,
non_linearity=non_linearity,
adapter_dropout=adapter_dropout,
use_parallel_adapter=use_parallel_adapter,
use_adapterp=use_adapterp,
target_modules=target_modules,
scaling=scaling,
bias="none",
task_type="CAUSAL_LM",
)

elif adapter_name == "prefix-tuning":
config = PrefixTuningConfig(
num_virtual_tokens=num_virtual_tokens,
Expand Down