Implementation of ideas from generative agents using the power of LLM, T2S, and S2T networks.
You can install the package locally with poetry. This allows fast iteration and experimentation.
-
Setup SSH for access to the repository.
-
Install
pyenv- a really nice way to manage/install specific Python versions on Linux systems.i) Make sure you install the build dependencies for your system.
ii) Run
curl https://pyenv.run | bashiii) Restart your shell so the path changes take effect.
exec $SHELLiv) Install a specific Python version (e.g. 3.8.3) with
pyenv install 3.8.3 -
Install
poetryfor your OS. -
Install package
git clone git@github.com:dzermas/generative-dungeon-master.git cd generative-dungeon-master pyenv install $(cat .python-version) poetry install -
Set up
pre-committo ensure all commits to adhere to black and PEP8 style conventions.poetry run pre-commit install
To see all options, simply use the CLI from the poetry environment and run:
poetry run generativedm --help
The world generation with the default parameters can be executed as:
poetry run generativedm generate-world
The default docker image supports a CPU deplyment with a lightweight python:3.8-slim-buster (less than 3GB).
If an NVidia GPU with CUDA is available, the nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04 is usualy a good image choice (~8GB) to start from. The Dockerfile will need to change and the lines
# Install package:
RUN poetry install
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
will have to be replaced by
# Install package:
RUN poetry install -E pytorch
Build with
docker build -t gdm-image .
from within the repo root folder.
Use the docker image with
docker run --rm -ti gdm-image poetry run generativedm generate-world
Note that since the text-generation model needs to be downloaded, using docker will have to download the model each time the image is opened. Maybe you should avoid using the --rm and have a persistent container or add a presistent volume.
The code can either use an OpenAI account for inference with ChatGPT4, or HuggingFace for local inference with an open network like Alpaca. The OpenAI account charges real money for inferences and it can start getting expensive especially when the code base is not efficient enough. By default, the use_openai parameter in the main.py script is set to False. The HuggingFace model is downloaded locally in the ~/.cache/hub/ folder the first time it is called by the generate() function and every subsequent use happens by loading that local model. We can experiment with other models based on the inference capabilities of the local machines. The model selection is exposed for easy experimentation.
Look into the Alpaca models, an open source small model that is supposed to rival ChatGPT3:
https://medium.com/@martin-thissen/llama-alpaca-chatgpt-on-your-local-computer-tutorial-17adda704c23
https://github.com/cocktailpeanut/dalai
HuggingFace has a lot of models we can try before we need to train and finetune anything:
https://huggingface.co/models?pipeline_tag=text-generation&sort=downloads