Pytorch Chatbot Tutorial problem: How can I slove List Index Out of Range
up vote
-3
down vote
favorite
I’m new to pytorch and have been following the many tutorials available.
But, When I did The CHATBOT TUTORIAL is not work.
Like the figure below

What should I do and what is causing this?
python nlp pytorch chatbot
add a comment |
up vote
-3
down vote
favorite
I’m new to pytorch and have been following the many tutorials available.
But, When I did The CHATBOT TUTORIAL is not work.
Like the figure below

What should I do and what is causing this?
python nlp pytorch chatbot
1
Please do not put your error messages in the image, but rather paste the text to the actual post instead.
– dennlinger
Nov 11 at 13:01
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I’m new to pytorch and have been following the many tutorials available.
But, When I did The CHATBOT TUTORIAL is not work.
Like the figure below

What should I do and what is causing this?
python nlp pytorch chatbot
I’m new to pytorch and have been following the many tutorials available.
But, When I did The CHATBOT TUTORIAL is not work.
Like the figure below

What should I do and what is causing this?
python nlp pytorch chatbot
python nlp pytorch chatbot
edited Nov 11 at 12:58
Al Fahad
755821
755821
asked Nov 11 at 9:43
眠咖啡
1
1
1
Please do not put your error messages in the image, but rather paste the text to the actual post instead.
– dennlinger
Nov 11 at 13:01
add a comment |
1
Please do not put your error messages in the image, but rather paste the text to the actual post instead.
– dennlinger
Nov 11 at 13:01
1
1
Please do not put your error messages in the image, but rather paste the text to the actual post instead.
– dennlinger
Nov 11 at 13:01
Please do not put your error messages in the image, but rather paste the text to the actual post instead.
– dennlinger
Nov 11 at 13:01
add a comment |
3 Answers
3
active
oldest
votes
up vote
0
down vote
Are you running Windows? Currently most Pytorch tutorial requires Pytorch 1.0 which is currently unavailable on Windows, I'm trying it in a different OS.
Will edit the answer as soon as I get it running on Ubuntu 18.
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
add a comment |
up vote
0
down vote
def filter_pair(self, p):
try:
return len(p[0].split(' ')) < self.MAX_LENGTH and len(p[1].split(' '))< self.MAX_LENGTH
except:
return False
This is because some of pairs are empty list
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
add a comment |
up vote
0
down vote
I think the problem is the way the lines are read in resulting in blank lines. You can get over the problem rather crudely by filtering out blank lines. Here is such a crude solution in the readVocs routine.
# Read query/response pairs and return a voc object
def readVocs(datafile, corpus_name):
print("Reading lines...")
# Read the file and split into lines
lines = open(datafile, encoding='utf-8').
read().strip().split('n')
#Now on windows you seem to get alternate blank lines so filter them out.
lines2=
for l in lines:
if len(l)>0:
lines2.append(l)
#And as a check just print the first 10
for index, line in enumerate(lines2[:10]):
print(index,' - ',line)
# Split every line into pairs and normalize
pairs = [[normalizeString(s) for s in l.split('t')] for l in lines2]
voc = Voc(corpus_name)
return voc, pair
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Are you running Windows? Currently most Pytorch tutorial requires Pytorch 1.0 which is currently unavailable on Windows, I'm trying it in a different OS.
Will edit the answer as soon as I get it running on Ubuntu 18.
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
add a comment |
up vote
0
down vote
Are you running Windows? Currently most Pytorch tutorial requires Pytorch 1.0 which is currently unavailable on Windows, I'm trying it in a different OS.
Will edit the answer as soon as I get it running on Ubuntu 18.
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
add a comment |
up vote
0
down vote
up vote
0
down vote
Are you running Windows? Currently most Pytorch tutorial requires Pytorch 1.0 which is currently unavailable on Windows, I'm trying it in a different OS.
Will edit the answer as soon as I get it running on Ubuntu 18.
Are you running Windows? Currently most Pytorch tutorial requires Pytorch 1.0 which is currently unavailable on Windows, I'm trying it in a different OS.
Will edit the answer as soon as I get it running on Ubuntu 18.
answered Nov 12 at 13:28
Kapil Pawar
12
12
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
add a comment |
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
Yes,i run it on windows, but I import torch without any question. python 3.6 package: pip,CUDA:9.0 it seems some data processing have question.Because Errormessage show:IndexError: list index out of range I'm trying it in a different OS. "Will edit the answer as soon as I get it running on Ubuntu 18. " Ah, It was exhilarating, I will try it as soon as possible. the error seems happens in : def filterPair(p): def filterPairs(pairs): I am very confused about this.
– 眠咖啡
Nov 15 at 23:30
add a comment |
up vote
0
down vote
def filter_pair(self, p):
try:
return len(p[0].split(' ')) < self.MAX_LENGTH and len(p[1].split(' '))< self.MAX_LENGTH
except:
return False
This is because some of pairs are empty list
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
add a comment |
up vote
0
down vote
def filter_pair(self, p):
try:
return len(p[0].split(' ')) < self.MAX_LENGTH and len(p[1].split(' '))< self.MAX_LENGTH
except:
return False
This is because some of pairs are empty list
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
add a comment |
up vote
0
down vote
up vote
0
down vote
def filter_pair(self, p):
try:
return len(p[0].split(' ')) < self.MAX_LENGTH and len(p[1].split(' '))< self.MAX_LENGTH
except:
return False
This is because some of pairs are empty list
def filter_pair(self, p):
try:
return len(p[0].split(' ')) < self.MAX_LENGTH and len(p[1].split(' '))< self.MAX_LENGTH
except:
return False
This is because some of pairs are empty list
edited Nov 15 at 19:33
pushkin
3,779102450
3,779102450
answered Nov 15 at 19:24
Bibhas
1
1
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
add a comment |
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
Thanks, But the corpus are cornell movie-dialogs corpus.Corpus <cs.cornell.edu/~cristian/… is a rich dataset of movie character dialog: 220,579 conversational exchanges between 10,292 pairs of movie characters 9,035 characters from 617 movies 304,713 total utterances I am not understanding of the empty list in training data,but it showed Start preparing training data ... Reading lines... Read 442563 sentence pairs
– 眠咖啡
Nov 15 at 23:10
add a comment |
up vote
0
down vote
I think the problem is the way the lines are read in resulting in blank lines. You can get over the problem rather crudely by filtering out blank lines. Here is such a crude solution in the readVocs routine.
# Read query/response pairs and return a voc object
def readVocs(datafile, corpus_name):
print("Reading lines...")
# Read the file and split into lines
lines = open(datafile, encoding='utf-8').
read().strip().split('n')
#Now on windows you seem to get alternate blank lines so filter them out.
lines2=
for l in lines:
if len(l)>0:
lines2.append(l)
#And as a check just print the first 10
for index, line in enumerate(lines2[:10]):
print(index,' - ',line)
# Split every line into pairs and normalize
pairs = [[normalizeString(s) for s in l.split('t')] for l in lines2]
voc = Voc(corpus_name)
return voc, pair
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
add a comment |
up vote
0
down vote
I think the problem is the way the lines are read in resulting in blank lines. You can get over the problem rather crudely by filtering out blank lines. Here is such a crude solution in the readVocs routine.
# Read query/response pairs and return a voc object
def readVocs(datafile, corpus_name):
print("Reading lines...")
# Read the file and split into lines
lines = open(datafile, encoding='utf-8').
read().strip().split('n')
#Now on windows you seem to get alternate blank lines so filter them out.
lines2=
for l in lines:
if len(l)>0:
lines2.append(l)
#And as a check just print the first 10
for index, line in enumerate(lines2[:10]):
print(index,' - ',line)
# Split every line into pairs and normalize
pairs = [[normalizeString(s) for s in l.split('t')] for l in lines2]
voc = Voc(corpus_name)
return voc, pair
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
add a comment |
up vote
0
down vote
up vote
0
down vote
I think the problem is the way the lines are read in resulting in blank lines. You can get over the problem rather crudely by filtering out blank lines. Here is such a crude solution in the readVocs routine.
# Read query/response pairs and return a voc object
def readVocs(datafile, corpus_name):
print("Reading lines...")
# Read the file and split into lines
lines = open(datafile, encoding='utf-8').
read().strip().split('n')
#Now on windows you seem to get alternate blank lines so filter them out.
lines2=
for l in lines:
if len(l)>0:
lines2.append(l)
#And as a check just print the first 10
for index, line in enumerate(lines2[:10]):
print(index,' - ',line)
# Split every line into pairs and normalize
pairs = [[normalizeString(s) for s in l.split('t')] for l in lines2]
voc = Voc(corpus_name)
return voc, pair
I think the problem is the way the lines are read in resulting in blank lines. You can get over the problem rather crudely by filtering out blank lines. Here is such a crude solution in the readVocs routine.
# Read query/response pairs and return a voc object
def readVocs(datafile, corpus_name):
print("Reading lines...")
# Read the file and split into lines
lines = open(datafile, encoding='utf-8').
read().strip().split('n')
#Now on windows you seem to get alternate blank lines so filter them out.
lines2=
for l in lines:
if len(l)>0:
lines2.append(l)
#And as a check just print the first 10
for index, line in enumerate(lines2[:10]):
print(index,' - ',line)
# Split every line into pairs and normalize
pairs = [[normalizeString(s) for s in l.split('t')] for l in lines2]
voc = Voc(corpus_name)
return voc, pair
answered Nov 18 at 9:42
Mike Sharp
11
11
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
add a comment |
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
I tried the above with the tutorial mentioned and it runs all the way through quite happily on Windows with Torch version 0.4.1
– Mike Sharp
Nov 19 at 18:55
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247475%2fpytorch-chatbot-tutorial-problem-how-can-i-slove-list-index-out-of-range%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please do not put your error messages in the image, but rather paste the text to the actual post instead.
– dennlinger
Nov 11 at 13:01