Skip to content

Commit

Permalink
🎨 refactor: update type alias to TextLLMModel and add COLORS_LLM list
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoskys committed Sep 26, 2024
1 parent c2d266e commit f4af2e6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/novelai_python/_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,32 @@ class TextTokenizerGroup(object):
TextLLMModel.ERATO: TextTokenizerGroup.LLAMA3,
}

COLORS_LLM = [
TextLLMModel.BLUE,
TextLLMModel.RED,
TextLLMModel.GREEN,
TextLLMModel.PURPLE,
TextLLMModel.PINK,
TextLLMModel.YELLOW,
TextLLMModel.WHITE,
TextLLMModel.BLACK,
]

def get_llm_group(model: TextLLMModelTypeAlias) -> Optional[TextTokenizerGroup]:

def get_llm_group(model: TextLLMModel) -> Optional[TextTokenizerGroup]:
if isinstance(model, str):
model = TextLLMModel(model)
return TOKENIZER_MODEL_MAP.get(model, None)


def get_tokenizer_model(model: TextLLMModelTypeAlias) -> str:
def get_tokenizer_model(model: TextLLMModel) -> str:
if isinstance(model, str):
model = TextLLMModel(model)
group = TOKENIZER_MODEL_MAP.get(model, TextTokenizerGroup.GPT2)
return group


def get_tokenizer_model_url(model: TextLLMModelTypeAlias) -> str:
def get_tokenizer_model_url(model: TextLLMModel) -> str:
model_name = get_tokenizer_model(model)
if not model_name.endswith(".def"):
model_name = f"{model_name}.def"
Expand Down

0 comments on commit f4af2e6

Please sign in to comment.