Skip to content

Generate characters for SillyTavern, TavernAI, TextGenerationWebUI using LLM and Stable Diffusion

License

Notifications You must be signed in to change notification settings

Hukasx0/character-factory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Character factory

version using Zephyr 7B beta: Open In Colab

version using Mistral 7b instruct 0.1: Open In Colab

This Python script is designed to help you generate characters for SillyTavern, TavernAI, TextGenerationWebUI and many more, using LLM (Large Language Model) and Stable Diffusion. The script utilizes various deep learning models to create detailed character cards, including names, summaries, personalities, greeting messages, and character avatars.

Grumpy Purrsnatch character card Lily Harper character card Arthondt Lightbringer character card Albert Einstein character card
(these four images above are valid character cards (V1), you can download them and use them in any frontend that supports character cards)

This script is designed to streamline the process of character generation for SillyTavern, TavernAI, and TextGenerationWebUI by leveraging LLM and Stable Diffusion models. It provides an easy way to create unique and imaginative characters for storytelling, chatting and other purposes.

Prerequisites

Before running the script, make sure you have Python3 and dependencies installed:

CPU:

pip install -r requirements.txt

CUDA:

pip install -r requirements-cuda.txt

When you run the script for the first time, the script will automatically download the required LLM and Stable Diffusion models

Generation options

--name This flag allows you to specify the character's name. If provided, the script will use the name you specify. If not provided, the script will use the Language Model (LLM) to generate a name for the character.

--gender Use this parameter to specify the character's gender. If provided, the script will use the specified gender. Otherwise, LLM will choose the gender.

--summary Use this flag to specify the character's summary. If you provide a summary, it will be used for the character. If not provided, the script will use LLM to generate a summary for the character.

--personality This flag lets you specify the character's personality. If you provide a personality description, it will be used. If not provided, the script will use LLM to generate a personality description for the character.

--greeting-message Use this flag to specify the character's greeting message for interacting with users. If provided, the script will use the specified greeting message. If not provided, LLM will generate a greeting message for the character.

--avatar-prompt This flag allows you to specify the prompt for generating the character's avatar. If provided, the script will use the specified prompt for avatar generation. If not provided, the script will use LLM to generate the prompt for the avatar.

--topic Specify the topic for character generation using this flag. Topics can include "Fantasy", "Anime", "Noir style detective", "Old mage master of lightning", or any other topic relevant to your character. The topic can influence the character's details and characteristics.

--negative-prompt This flag is used to provide a negative prompt for Stable Diffusion. A negative prompt can be used to guide the generation of character avatars by specifying elements that should not be included in the avatar.

--scenario Use this flag to specify the character's scenario. If you provide a scenario, it will be used for the character. If not provided, the script will use LLM to generate a scenario for the character.

--example-messages Specify example messages for the character using this flag. If you provide example messages, they will be used for the character. If not provided, the script will use LLM to generate example messages for the character.

Colab usage

  1. Open the notebook in Google Colab by clicking one of those badges:

version using Zephyr 7B beta: Open In Colab

version using Mistral 7b instruct 0.1: Open In Colab

  1. After opening the link, you will see the notebook within the Google Colab environment.
  2. Make sure to check whether a GPU is selected for your environment. Running your script on a CPU will not work. To verify the GPU selection, follow these steps:
    1. Click on "Runtime" in the top menu.
    2. Change the CPU to one of these: T4 GPU, A100 GPU, V100 GPU
    3. Click "Save."
  3. After the environment starts, you need to run each cell in turn
  4. If everything is prepared, you can just run the last cell to generate characters

Example usage:

python ./app/main-zephyr.py --topic "{{user}}'s pessimistic, monday-hating cat" --negative-prompt "human, gore, nsfw"
python ./app/main-zephyr.py --topic "{{user}}'s childhood friend, who secretly loves him" --gender "female" --negative-prompt "gore, nude, nsfw"
python ./app/main-mistral.py --topic "Old mage master of lightning" --gender "male" --negative-prompt "anime, nature, city, modern, young"
python ./app/main-mistral.py --name "Albert Einstein" --topic "science" --avatar-prompt "Albert Einstein"

License

2023 Hubert Kasperek

This script is available under the AGPL-3.0 license. Details of the license can be found in the LICENSE file.

About

Generate characters for SillyTavern, TavernAI, TextGenerationWebUI using LLM and Stable Diffusion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published