Tutorial: Creating a simple chatbot with transformers: Difference between revisions

From Robowaifu Institute of Technology
Jump to navigation Jump to search
(WIP)
 
mNo edit summary
Line 13: Line 13:


=== Hello, Anon! ===
=== Hello, Anon! ===
from transformers import GPT2Tokenizer, OPTForCausalLM
<syntaxhighlight lang="python3" line="1">
from transformers import AutoTokenizer, OPTForCausalLM
</syntaxhighlight>
 
=== Next lesson ===
→ [[Tutorial: Creating a chatbot with a simple memory]]
[[Category:Tutorial]]
[[Category:Tutorial]]

Revision as of 17:57, 13 October 2022

This tutorial will show you how to create your own chatbot in Python using Hugging Face's transformers library.

Getting started

First you'll need to install Python and PyTorch. In this tutorial I will be using Python 3.10.7 and PyTorch 1.12.1+cu116.

Once Python and PyTorch are installed, install Hugging Face's transformers library.

Via Conda:

conda install -c huggingface transformers

Via Pip:

python -m pip install transformers --user

Now you're all set to do NLP with transformers.

Hello, Anon!

from transformers import AutoTokenizer, OPTForCausalLM

Next lesson

Tutorial: Creating a chatbot with a simple memory