Lint alpaca_chat
Browse files
src/axolotl/prompt_strategies/alpaca_chat.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
from axolotl.prompt_tokenizers import (
|
2 |
AlpacaPromptTokenizingStrategy,
|
3 |
InstructionPromptTokenizingStrategy,
|
@@ -7,7 +10,7 @@ from axolotl.prompters import AlpacaPrompter, PromptStyle
|
|
7 |
|
8 |
def load(tokenizer, cfg):
|
9 |
return AlpacaPromptTokenizingStrategy(
|
10 |
-
AlpacaPrompter(PromptStyle.
|
11 |
tokenizer,
|
12 |
cfg.train_on_inputs,
|
13 |
cfg.sequence_len,
|
@@ -15,7 +18,11 @@ def load(tokenizer, cfg):
|
|
15 |
|
16 |
|
17 |
class AlpacaQAPromptTokenizingStrategy(InstructionPromptTokenizingStrategy):
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
return (
|
20 |
prompt["question"],
|
21 |
"",
|
@@ -25,7 +32,7 @@ class AlpacaQAPromptTokenizingStrategy(InstructionPromptTokenizingStrategy):
|
|
25 |
|
26 |
def load_qa(tokenizer, cfg):
|
27 |
return AlpacaQAPromptTokenizingStrategy(
|
28 |
-
AlpacaPrompter(PromptStyle.
|
29 |
tokenizer,
|
30 |
cfg.train_on_inputs,
|
31 |
cfg.sequence_len,
|
|
|
1 |
+
"""Module containing the AlpacaQAPromptTokenizingStrategy class"""
|
2 |
+
|
3 |
+
from typing import Tuple
|
4 |
from axolotl.prompt_tokenizers import (
|
5 |
AlpacaPromptTokenizingStrategy,
|
6 |
InstructionPromptTokenizingStrategy,
|
|
|
10 |
|
11 |
def load(tokenizer, cfg):
|
12 |
return AlpacaPromptTokenizingStrategy(
|
13 |
+
AlpacaPrompter(PromptStyle.CHAT.value),
|
14 |
tokenizer,
|
15 |
cfg.train_on_inputs,
|
16 |
cfg.sequence_len,
|
|
|
18 |
|
19 |
|
20 |
class AlpacaQAPromptTokenizingStrategy(InstructionPromptTokenizingStrategy):
|
21 |
+
"""
|
22 |
+
Tokenizing strategy for AlpacaQA
|
23 |
+
"""
|
24 |
+
|
25 |
+
def parse_instruction_fields(self, prompt) -> Tuple[str, str, str]:
|
26 |
return (
|
27 |
prompt["question"],
|
28 |
"",
|
|
|
32 |
|
33 |
def load_qa(tokenizer, cfg):
|
34 |
return AlpacaQAPromptTokenizingStrategy(
|
35 |
+
AlpacaPrompter(PromptStyle.CHAT.value),
|
36 |
tokenizer,
|
37 |
cfg.train_on_inputs,
|
38 |
cfg.sequence_len,
|