Ever wanted to create an AI Chat bot? This python chatbot tutorial will show you how to create a chatbot with python using deep learning .
Playlist:
Download JSON File:
Text-Based Tutorial:
References:
◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
…
📸 Instagram:
🌎 Website
📱 Twitter:
⭐ Discord:
📝 LinkedIn: …
📂 GitHub:
🔊 Podcast:
💵 One-Time Donations: …
💰 Patreon:
◾◾◾◾◾◾
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
Tags:
– Tech With Tim
– Python Chat bot
– Chat bot python tutorial
– Python chat bot tutorial
– Python Tutorials
– Create chatbot with python
Let me know what you want your chatbot to do?!
Simply work.. nobody seems to care enough to help me with my issue.. even when I offer money. I joined your discord server and honestly am very discouraged.
I want a IT Helpdesk chatbot
It is possible to download this code?
@Mark Anderson Modern problems require modern solutions
@Tech With Tim When I triy to install tflearn it doesn’t work but everything else does. I am using PyCharm linked with Anaconda on mac. How could I fix this?
Great tutorials Tim. I subscribed and will be following closely. I am getting an error “NameError: name ‘model’ is not defined” when I add the bbag_of_words and chat functions. When I call the chat function, after I type “hello”, I get the error – “NameError: name ‘model’ is not defined” .
I think I found the issue. On your website, where you have the code (Part 4 – https://techwithtim.net/tutorials/ai-chatbot/part-4/) I believe line 65, where it says “with open(“data.pickle”, “wb”) “, should not be indented. Everything works fine when it is not indented.
Hello Tim, I would like to use my chatbot to help the customers on my website. Do you know, where can I find a dataset to improve my chatbot for a marketing discussion?
If you use venv you can set a virtual environment with all of your environment settings like python version, no need to uninstall other versions.
Hey Tim, I just started programming again and was trying to follow osome of your tutorials. But as of writing this most module versions have been updated and its reallyhard to keep track of which install of whc mdule works with each other.
Again as of writing this the current combo of packages that work:
Python 3.6 !=3.7/8
nltk==1.14.0 (latest)
numpy==1.16.6 !=1.17 or above
tensorflow==1.15, !=2.x and above
tflearn==0.3.2 (latest)
Please like this if this helped you solve any problems you ran into so that others can see it 🙂
I also ran into “please install/reinstall (curses/h5py/scipy for an optimal experience”)
resolved by pip install (scipy, h5py, windows-curses)
This wasn’t a huge problem but is it possible for future vids/tuorials to specify/show which package you have installed to run the program.
Thx for the great vid tutorial.
I have installed all the packages as told but still I am getting this error
please help
(chatbot) C:UsersIOTLABDesktopkbot>python main.py
2020-02-14 11:09:40.205540: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library ‘cudart64_100.dll’; dlerror: cudart64_100.dll not found
2020-02-14 11:09:40.210738: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperssummarizer.py:9: The name tf.summary.merge is deprecated. Please use tf.compat.v1.summary.merge instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:25: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearncollections.py:13: The name tf.GraphKeys is deprecated. Please use tf.compat.v1.GraphKeys instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnconfig.py:123: The name tf.get_collection is deprecated. Please use tf.compat.v1.get_collection instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnconfig.py:129: The name tf.add_to_collection is deprecated. Please use tf.compat.v1.add_to_collection instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnconfig.py:131: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.
WARNING:tensorflow:From main.py:68: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnlayerscore.py:81: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnlayerscore.py:145: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearninitializations.py:174: calling TruncatedNormal.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnoptimizers.py:238: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnobjectives.py:66: calling reduce_sum_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnobjectives.py:70: The name tf.log is deprecated. Please use tf.math.log instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnlayersestimator.py:189: The name tf.trainable_variables is deprecated. Please use tf.compat.v1.trainable_variables instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:571: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:115: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
2020-02-14 11:09:42.065833: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library ‘nvcuda.dll’; dlerror: nvcuda.dll not found
2020-02-14 11:09:42.069888: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2020-02-14 11:09:42.075515: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-01MHI4D
2020-02-14 11:09:42.079406: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-01MHI4D
2020-02-14 11:09:42.082188: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnsummaries.py:46: The name tf.summary.scalar is deprecated. Please use tf.compat.v1.summary.scalar instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestensorflow_corepythonopsmath_grad.py:1424: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:134: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:164: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:165: The name tf.local_variables_initializer is deprecated. Please use tf.compat.v1.local_variables_initializer instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:166: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.
WARNING:tensorflow:From C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py:167: The name tf.get_collection_ref is deprecated. Please use tf.compat.v1.get_collection_ref instead.
———————————
Run id: FNADY6
Log directory: /tmp/tflearn_logs/
———————————
Training samples: 20
Validation samples: 0
—
Traceback (most recent call last):
File “main.py”, line 79, in
model.load(“model.tflearn”)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnmodelsdnn.py”, line 308, in load
self.trainer.restore(model_file, weights_only, **optargs)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py”, line 490, in restore
self.restorer.restore(self.session, model_file)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestensorflow_corepythontrainingsaver.py”, line 1282, in restore
checkpoint_prefix)
ValueError: The passed save_path is not a valid checkpoint: C:UsersIOTLABDesktopkbotmodel.tflearn
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “main.py”, line 81, in
model.fit(training, output, n_epoch=1000, batch_size=8, show_metric=True)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnmodelsdnn.py”, line 216, in fit
callbacks=callbacks)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py”, line 339, in fit
show_metric)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnhelperstrainer.py”, line 816, in _train
tflearn.is_training(True, session=self.session)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestflearnconfig.py”, line 95, in is_training
tf.get_collection(‘is_training_ops’)[0].eval(session=session)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestensorflow_corepythonframeworkops.py”, line 798, in eval
return _eval_using_default_session(self, feed_dict, self.graph, session)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestensorflow_corepythonframeworkops.py”, line 5407, in _eval_using_default_session
return session.run(tensors, feed_dict)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestensorflow_corepythonclientsession.py”, line 956, in run
run_metadata_ptr)
File “C:UsersIOTLAB.condaenvschatbotlibsite-packagestensorflow_corepythonclientsession.py”, line 1103, in _run
raise RuntimeError(‘Attempted to use a closed Session.’)
RuntimeError: Attempted to use a closed Session.
@karthik s Reinstall, maybe? Doo tensorflow BEFORE you do tflearn, however
Thank you, my holy lord and saviour!
ur a god, thank you so much
Can you do more of this using python and pycharm only? or maybe colab.research?
Thank you
awsome vid thanks again for making this stuff so incredibly accessible right now I am actually moving from my job as a junior data scientist at one company to a much higher role as a senior ML data scientist at another and I was wondering what would you recommend as the best way to push my knowledge to the level it needs to be at for that kind of jump.
Still fairly new to Machine Learning and feel I just did very well in the interview and got a bit lucky so I really want to make sure I up my game before I actually start the job in a few months so I don’t blow this opportunity. Any advice you could give would be amazing thanks.
What makes this chatbot ‘simple’ and ‘slightly intelligent’? How would you go about making it more complex?
Hey Tim, are you planning on having an updated version of a chatbot, Im completely lost as a beginner and a lot of tools are updated. Seems selfish because this video was done a year ago, but you’re a great teacher and I actually understand what you’re teaching. Thanks
For users having errors with installing tensorflow through pip,
Make sure you’re using python 64 bit and not 32 bit. that pretty much solved the trick for me
Even I faced this issue and after trying for many hours found that it was a bit issue between Python and OS. After that I have installed TensorFlow many times in different environments.
Use below command to know your Python bit version
import struct
print(struct.calcsize(“P”) * 8)
God bless you. I am despairing while writing my bachelor thesis. I cannot manage building a bot. Your instructions are very clear and helpful and for the first time i get further than installing tflearn or some other package before getting an error message. ^-^
Hi Tim I get an error message “unindent does not match any outer indentation level (, line 14) ” which you want us to write following ” words = []” – thanks for your help letting me test the code and train the chatbot
For the people wondering why when you make the amount of epochs higher the chatbot doesn’t get better: #1 the dataset is very very (very) small. Find a public dataset of q”s and a’s and use that instead. #2 it will overfit if your dataset is too small so geta dataset of at least 1000 q”s and a’s.
But otherwise, great tutorial!
For everyone who wants to follow this tutorial, make sure you have Python 64 bit instead of 32 bit, otherwise Tensorflow won’t work.
OMG thank you so much 🙏
I was wondering why it couldn’t find a matching version of tensorflow 🤨
Cheers buddy 👍🤙🤙
@Big Bogey Face You’re welcome
@Tim, this cannot be pure coincidence that EVERY time I search for something python related on youtube, one of your videos show up. I am surprised by the diversity of python applications you have covered. Be in Django (first time I found your tutorial), JavaScript, Machine Learning, Data Science, Interview tips, and now a chatbot. I have learned a lot from your videos from time to time. I’d be delighted to meet you if you ever come to Seattle again. Keep up the great work.
where is he from?
Canada 🇨🇦
If you get error with installing Tensorflow, you need to go to registry editor HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystem and set LongPathsEnabled to value 1
I’ve been doing a codecademy course on chatbots, this will be an excellent means of assistance. Thank you very much.
you can use alot of if functions to mimic it but in Python 3.9 and it would be more simple-to-write. That was for if you don’t want it to Be Open-Source and Public/for Business Purposes.
Nice example of how to create a basic chatbot in Python – thanks for taking the time to make the vid
Awesome tutorial Tim so cool get this project started finally! I’ll be here on your channel for a while working on this project learning cool stuff
PyCharm was so hard install but finally got it up and running, it looks okay but honestly I really miss my old VS Code IDE was so comfortable there (VS Code tho doesn’t seem want import our libraries and modules. It took like 2hrs to install PyCharm and get all libraries imported and errors cleared. In lower right of window reads Python Interpreter Version 3.10 what you think will run okay? I don’t know how to change and I don’t see any errors yet
Okay see you in next tutorial 🤘
I got this chat bot working eventually (recently) in a conda environment, using VS Code. I am new to creating requirement.txt files , but the versions of the packages I used are:
numpy == 1.22.3
tflearn == 0.5.0
tensorflow == 2.8.2
nltk = 3.7
python_version == 3.8.5
Not sure about the Python version. It might just work with 3.10 as well.
I had mostly difficulties in getting the Python packages to work.
Anyway, just wanted to leave a note here that you can still get this to work. For me, a beginner, it took a while, but I learned a lot from it. I also found a lot of useful tips in the comments on here as well. I hope this one helps too. Enjoy!