suppport for alpaca-like instruction datasets without inputs
Browse files- scripts/finetune.py +2 -2
- src/axolotl/prompt_tokenizers.py +3 -2
scripts/finetune.py
CHANGED
|
@@ -102,8 +102,8 @@ def load_model(base_model, base_model_config, model_type, tokenizer_type, cfg, a
|
|
| 102 |
base_model_config if base_model_config else base_model,
|
| 103 |
model_path,
|
| 104 |
device_map=cfg.device_map,
|
| 105 |
-
groupsize
|
| 106 |
-
is_v1_model=True,
|
| 107 |
)
|
| 108 |
load_in_8bit = False
|
| 109 |
elif "llama" in base_model:
|
|
|
|
| 102 |
base_model_config if base_model_config else base_model,
|
| 103 |
model_path,
|
| 104 |
device_map=cfg.device_map,
|
| 105 |
+
groupsize=cfg.gptq_groupsize if cfg.gptq_groupsize else -1,
|
| 106 |
+
is_v1_model=cfg.gptq_model_v1 if cfg.gptq_model_v1 is not None else True,
|
| 107 |
)
|
| 108 |
load_in_8bit = False
|
| 109 |
elif "llama" in base_model:
|
src/axolotl/prompt_tokenizers.py
CHANGED
|
@@ -37,7 +37,8 @@ class AlpacaPromptTokenizingStrategy(PromptTokenizingStrategy):
|
|
| 37 |
tokenized_full_prompt = self._tokenize(full_prompt)
|
| 38 |
if not self.train_on_inputs:
|
| 39 |
user_prompt = self.prompter.build_prompt(
|
| 40 |
-
prompt["instruction"],
|
|
|
|
| 41 |
)
|
| 42 |
tokenized_user_prompt = self._tokenize(user_prompt, add_eos_token=False)
|
| 43 |
user_prompt_len = len(tokenized_user_prompt["input_ids"])
|
|
@@ -51,7 +52,7 @@ class AlpacaPromptTokenizingStrategy(PromptTokenizingStrategy):
|
|
| 51 |
def _tokenize_full_prompt(self, prompt):
|
| 52 |
return self.prompter.build_prompt(
|
| 53 |
prompt["instruction"],
|
| 54 |
-
prompt["input"],
|
| 55 |
prompt["output"],
|
| 56 |
)
|
| 57 |
|
|
|
|
| 37 |
tokenized_full_prompt = self._tokenize(full_prompt)
|
| 38 |
if not self.train_on_inputs:
|
| 39 |
user_prompt = self.prompter.build_prompt(
|
| 40 |
+
prompt["instruction"],
|
| 41 |
+
prompt["input"] if "input" in prompt else "",
|
| 42 |
)
|
| 43 |
tokenized_user_prompt = self._tokenize(user_prompt, add_eos_token=False)
|
| 44 |
user_prompt_len = len(tokenized_user_prompt["input_ids"])
|
|
|
|
| 52 |
def _tokenize_full_prompt(self, prompt):
|
| 53 |
return self.prompter.build_prompt(
|
| 54 |
prompt["instruction"],
|
| 55 |
+
prompt["input"] if "input" in prompt else "",
|
| 56 |
prompt["output"],
|
| 57 |
)
|
| 58 |
|