Until I get a proper training environment (since graphic card prices are through the roof) all development is paused.
A text adventure game example based on custom pretrained GPT2. 한국어 매뉴얼은 README_KR.md를 참조해 주세요.
This program is developed actively, and may not be stable.
Pre-requisites : Working python install
Recommended : python 3.8.5 and a nvidia graphics card(supports CUDA 10.1) with more than 6GB VRAM
- clone this repo
python3 -m venv aitasource aita/bin/activatepip install -r requirements.txt- (only for macOS 12.0+) Install tensorflow from here.
python3 main.py
Edit the following files at your leisure -
actions.pyfor custom action callsconstants.pyfor project-wide constants (i.e. API Endpoint)customclass.pyfor python classes used in-game (i.e. characters)errors.pyfor custom error handlinggenerator.pyfor text generation (HuggingFace transformers & KoGPT compatible)interface.pyfor user interface (terminal)translation.pyfor translationsutils.pyfor utility functions (i.e. custom sort)
In translation.py, Each language has class of string constants for translation. Ideally, you copy the template and change the word, word order, etc.
To make a custom translation, edit the initialize_translation() of translation.py to return the language class when a standard language code (en/ko/...) is input.
When adding another language, make sure the appropriate model is added in main.py! The program will not load properly without it!
Modify the below template for your model.
if flags.LANG == LANG_CODE:
flags.model_path = os.path.join(SCRIPT_PATH,'model',LANG_CODE)
if os.path.exists(os.path.join(SCRIPT_PATH,'model',LANG_CODE,YOUR_MODEL_FILENAME)):
flags.model_type = 'pt' # If model is trained using HF transformers
NO_MODEL = False
elif os.path.exists(os.path.join(SCRIPT_PATH,'model',LANG_CODE,YOUR_MODEL_FILENAME)):
flags.model_type = 'tf' # If model is trained using the KoGPT2-train script(https://github.com/ksjae/KoGPT2-train)
NO_MODEL = False
Any use of resources in this repository is possible, as long as it's for non-commercial purposes. This does not override other licenses set to parts of this repository such as corpora or initial story generator contents.
The Korean GPT2: Public Domain
Initial Story Generator(EN): Non-commercial
Initial Story Generator (Korean Translation): Non-commercial, Attribution