patrickloeber / pytorch-chatbot Goto Github PK
View Code? Open in Web Editor NEWSimple chatbot implementation with PyTorch.
License: MIT License
Simple chatbot implementation with PyTorch.
License: MIT License
added requirement.txt and added one command in readme.md for requirements
Wow helpful
File "C:\Users\Haitham\PycharmProjects\pytorch_project\train.py", line 83, in
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
File "C:\Users\Haitham\PycharmProjects\pytorch_project\venv\lib\site-packages\torch\optim\adam.py", line 33, in init
super().init(params, defaults)
File "C:\Users\Haitham\PycharmProjects\pytorch_project\venv\lib\site-packages\torch\optim\optimizer.py", line 187, in init
raise ValueError("optimizer got an empty parameter list")
ValueError: optimizer got an empty parameter list
why my loss is never below 1.5, and the answer is always I don't understand
I've made it to 12:54 in the 3rd part of his series, and I have come to a roadblock in the code. I cannot find a way to work around it. Any advice or potential fixes help. Thanks!
Output
[nltk_data] Downloading package punkt to
[nltk_data] C:\Users\AlienUser\AppData\Roaming\nltk_data...
[nltk_data] Package punkt is already up-to-date!
Traceback (most recent call last):
File "c:\Users\AlienUser\Documents\PyTorchBot\train.py", line 85, in
outputs = model(words)
File "C:\Users\AlienUser\Documents\PyTorchBot\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\AlienUser\Documents\PyTorchBot\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "c:\Users\AlienUser\Documents\PyTorchBot\model.py", line 15, in forward
out = self.l2(out)
File "C:\Users\AlienUser\Documents\PyTorchBot\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "C:\Users\AlienUser\Documents\PyTorchBot\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\AlienUser\Documents\PyTorchBot\venv\lib\site-packages\torch\nn\modules\linear.py", line 116, in forward
return F.linear(input, self.weight, self.bias)
TypeError: linear(): argument 'input' (position 1) must be Tensor, not ReLU
Link to Video: https://www.youtube.com/watch?v=Da-iHgrmHYg
I've just got an error after creating .pth file
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
[... some tracing logs ...]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1468: character maps to
I added some parameters encoding='utf-8' to the funtions connected with files, but it still doesn't work
Pycharm encoding is also set by default to UTF8
The chat bot is really good, basic nevertheless. Any plans on adapting a pre-trained language model perhaps?
Can I implement it with a Transformer model?
Python : 3.7
Pytorch : latest
Traceback (most recent call last):
File "", line 1, in
File "C:\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Python37\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "C:\Python37\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
File "C:\Python37\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Acer\Documents\GitHub\PyTorch-Chatbot-Basic\train.py", line 97, in
for (words, labels) in train_loader:
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 279, in iter
return _MultiProcessingDataLoaderIter(self)
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 719, in init
w.start()
File "C:\Python37\lib\multiprocessing\process.py", line 112, in start
Traceback (most recent call last):
File "", line 1, in
File "C:\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Python37\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "C:\Python37\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Python37\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
File "C:\Python37\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
self._popen = self._Popen(self) File "C:\Python37\lib\runpy.py", line 96, in _run_module_code
File "C:\Python37\lib\multiprocessing\context.py", line 223, in _Popen
mod_name, mod_spec, pkg_name, script_name)
File "C:\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Acer\Documents\GitHub\PyTorch-Chatbot-Basic\train.py", line 97, in
for (words, labels) in train_loader:
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 279, in iter
return _MultiProcessingDataLoaderIter(self)
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 719, in init
w.start()
File "C:\Python37\lib\multiprocessing\process.py", line 112, in start
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Python37\lib\multiprocessing\context.py", line 322, in _Popen
self._popen = self._Popen(self)
File "C:\Python37\lib\multiprocessing\context.py", line 223, in _Popen
return Popen(process_obj)
File "C:\Python37\lib\multiprocessing\popen_spawn_win32.py", line 46, in init
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Python37\lib\multiprocessing\popen_spawn_win32.py", line 46, in init
prep_data = spawn.get_preparation_data(process_obj._name)prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
File "C:\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
_check_not_importing_main()
_check_not_importing_main() File "C:\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
File "C:\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.''')
RuntimeErroris not going to be frozen to produce an executable.'''):
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.RuntimeError
:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 761, in _try_get_data
data = self._data_queue.get(timeout=timeout)
File "C:\Python37\lib\multiprocessing\queues.py", line 105, in get
raise Empty
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 97, in
for (words, labels) in train_loader:
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 345, in next
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 841, in _next_data
idx, data = self._get_data()
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 808, in _get_data
success, data = self._try_get_data()
File "C:\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 774, in _try_get_data
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))
RuntimeError: DataLoader worker (pid(s) 13208, 10108) exited unexpectedly
How do I execute a function for a specific tag? for example if the tag is 'goodbye' I want the chatbot to stop the program using sys.exit(0)
I tried this:
if prob.item() > 0.75:
for intent in intents['intents']:
if tag == intent["tag"]:
speak(f"{random.choice(intent['responses'])}")
if tag == "goodbye":
speak(f"{random.choice(intent['responses'])}")
sys.exit(0)
But the chatbot does not respond with a response from that specific tag
hello , I'm having some issues with the output it doesn't let me write anything and get response of the chatbot. it looks like it's in reading mode but I didn't change a thing in the code. can somebody help? also I have installed everything that was needed.
raise RuntimeError('DataLoader worker (pid(s) {}) exited unexpectedly'.format(pids_str))
RuntimeError: DataLoader worker (pid(s) 21184, 8440) exited unexpectedly
when i try to print no of epoch and loss rate, I faced this issue that tells "Not Implemented Error"
I installed PyTorch as you mentioned. i type import torch in the cmd, its works perfectly. but i try to run train.py in vscode terminal, its shows No module named 'torch'. please help me
when i tried to run train.py after activating virtual environment.
I got this error: (venv) PS M:\WorkSpace\GitHUB\pytorch-chatbot\myproject> python train.py
Traceback (most recent call last):
File "M:\WorkSpace\GitHUB\pytorch-chatbot\myproject\train.py", line 5, in
import torch
ModuleNotFoundError: No module named 'torch'
i then tried to install torch library, but I still couldn't solve the error.
now what should I do?
C:\Users\lukky\PycharmProjects\jarvis2.0>C:/Users/lukky/AppData/Local/Programs/Python/Python39/python.exe c:/Users/lukky/PycharmProjects/jarvis2.0/chatbot.py
Traceback (most recent call last):
File "c:\Users\lukky\PycharmProjects\jarvis2.0\chatbot.py", line 4, in
import torch
File "C:\Users\lukky\AppData\Local\Programs\Python\Python39\lib\site-packages\torch_init_.py", line 118, in
raise err
OSError: [WinError 193] %1 is not a valid Win32 application. Error loading "C:\Users\lukky\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.
i run it on cmd but it write
D:\code\chatbot\pytorch-chatbot-master\pytorch-chatbot-master\train.py:86: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xe . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem . (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
Traceback (most recent call last):
File "D:\code\chatbot\pytorch-chatbot-master\pytorch-chatbot-master\train.py", line 96, in
for (words, labels) in train_loader:
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data\dataloader.py", line 633, in next
data = self._next_data()
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data\dataloader.py", line 677, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\fetch.py", line 54, in fetch
return self.collate_fn(data)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\collate.py", line 265, in default_collate
return collate(batch, collate_fn_map=default_collate_fn_map)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\collate.py", line 142, in collate
return [collate(samples, collate_fn_map=collate_fn_map) for samples in transposed] # Backwards compatibility.
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\collate.py", line 142, in
return [collate(samples, collate_fn_map=collate_fn_map) for samples in transposed] # Backwards compatibility.
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\collate.py", line 119, in collate
return collate_fn_map[elem_type](batch, collate_fn_map=collate_fn_map)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\collate.py", line 171, in collate_numpy_array_fn
return collate([torch.as_tensor(b) for b in batch], collate_fn_map=collate_fn_map)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\collate.py", line 171, in
return collate([torch.as_tensor(b) for b in batch], collate_fn_map=collate_fn_map)
RuntimeError: Could not infer dtype of numpy.float32
When I try to run train.py, I run into this error:
Traceback (most recent call last):
File "C:\Users\Lucy\Documents\Chatbot maybe\train.py", line 83, in <module>
loss = criterion(outputs, labels)
File "C:\Users\Lucy\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Users\Lucy\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\loss.py", line 1174, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "C:\Users\Lucy\anaconda3\envs\pytorch\lib\site-packages\torch\nn\functional.py", line 3029, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: expected scalar type Long but found Int
I just started learning on how to make chatbot and this repository will be use full for me to learn more about making chatbot.
Thank you
RuntimeError: mat1 and mat2 shapes cannot be multiplied (8x8 and 54x8)
I am building a simple text classification system which could take in input then classify it with a tag then output the response as a command which will be executed. This is more like a text-to-automation system. The problem is I have a very big dataset json file and no matter how much I play with the hyper-parameters and how long I train the model, the model never classifies the test sentences properly.
Hi, I learned from your playlist how to make a chatbot for some commercial purpose. I am making one web app related to tourism using Django.
I want to add a chatbot on my website. Could you tell me how can I add chatbot on my website?
I tried to download punkt using
Import nltk
nltk.download('punkt')
getting the common error :
import nltk
nltk.download('punkt')
[nltk_data] Error loading punkt: <urlopen error [WinError 10060] A
[nltk_data] connection attempt failed because the connected party
[nltk_data] did not properly respond after a period of time, or
[nltk_data] established connection failed because connected host
[nltk_data] has failed to respond>
False
pls help me out with the following error
Traceback (most recent call last):
File "d:/coding/belajar pyton/pertama/chatbot/train.py", line 12, in
with open('intents.json', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'intents.json'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.