minimaxir / aitextgen

A robust Python tool for text-based AI training and generation using GPT-2.
https://docs.aitextgen.io
MIT License
1.84k stars 220 forks source link

Error creating aitextgen instance #151

Open metaphorz opened 3 years ago

metaphorz commented 3 years ago

I could not find this in the existing issues, but when running on colab I get the following. The file tree looks correct within colab. Should the directory "models" be changed to "model_folder" ? Also, I am using the shortcut as suggested but can easily just replicate the file tree in my Google Drive, if that would help. Here is the Colab that uses aitextgen:

https://colab.research.google.com/github/thunderclapinteractive/poetrywtf-nlp/blob/main/notebooks/generate_gpt_2_poetry_with_aitextgen.ipynb

AssertionError Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/aitextgen/aitextgen.py in init(self, model, model_folder, config, vocab_file, merges_file, tokenizer_file, schema_tokens, schema_return, cache_dir, tf_gpt2, to_gpu, to_fp16, verbose, gradient_checkpointing, bos_token, eos_token, unk_token, **kwargs) 102 if model: 103 assert not os.path.isfile(model), ( --> 104 "As of aitextgen 0.5.0, you must " 105 + "use model_folder to load an existing model." 106 )

AssertionError: As of aitextgen 0.5.0, you must use model_folder to load an existing model.

redthing1 commented 3 years ago

just change it to

ai = aitextgen(model_folder=f"{run_dir}", to_gpu=True)