tf2 transformer chatbot
1.0.0
Build an end-to-end chatbot with Transformer in TensorFlow 2. Checkout my tutorial on blog.tensorflow.org.
setup.sh
script to install Apple Silicon version of TensorFlow 2.9 (only use this if you're feeling adventurous).PositionalEncoding
and MultiHeadAttentionLayer
, to allow model saving via model.save()
or tf.keras.models.save_model()
.train.py
showcase how to call model.save()
and tf.keras.models.load_model()
.chatbot
conda create -n chatbot python=3.8
conda activate chatbot
sh setup.sh
tensorflow-metal
for devices with Apple Silicon (Note that there are tons of bugs with TensorFlow on Apple Silicon GPU, e.g. Adam optimizer does not work).max_samples
conversation pairs into list of questions
and answers
.start_token
and end_token
to indicate the start and end of each sentence.max_length
tokens.max_length
python main.py --help
python train.py --output_dir runs/save_model --batch_size 256 --epochs 50 --max_samples 50000
runs/save_model
.input: where have you been?
output: i m not talking about that .
input: it's a trap!
output: no , it s not .