简体   繁体   English

如何让我的深度学习聊天机器人使用正确的数据集路径?

[英]How can I make my deeplearning chatbot use the correct path to my dataset?

I am trying to get the code from a deeplearning chatbot to work.我正在尝试从深度学习聊天机器人中获取代码以使其工作。 This chatbot uses pytorch and the dataset from Cornell movie corpus.这个聊天机器人使用 pytorch 和来自康奈尔电影语料库的数据集。 But the code can't seem to find the path to the dataset, and I don't know how to code it in. This is the source for the deeplearning chatbot code [https://colab.research.google.com/github/pytorch/tutorials/blob/gh-pages/_downloads/chatbot_tutorial.ipynb][1]但是代码好像找不到数据集的路径,也不知道怎么写进去。这是deeplearning chatbot代码的来源[https://colab.research.google.com/github /pytorch/tutorials/blob/gh-pages/_downloads/chatbot_tutorial.ipynb][1]

This is as far as I've gotten with it.这就是我所掌握的。

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import torch
from torch.jit import script, trace
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
import csv
import random
import re
import os
import unicodedata
import codecs
from io import open
import itertools
import math


USE_CUDA = torch.cuda.is_available()
device = torch.device("cuda" if USE_CUDA else "cpu")

corpus_name = "cornell movie-dialogs corpus"
corpus = os.path.join("data", corpus_name)

def printLines(file, n=10):
    with open(file, 'rb') as datafile:
        lines = datafile.readlines()
    for line in lines[:n]:
        print(line)

printLines(os.path.join(corpus, "movie_lines.txt"))

And this is my error log这是我的错误日志

D:\Documents\Python\python pycharm files\pythonProject4\3.9 Chatbot.py:26: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
  corpus = "D:\Documents\Python\intents\cornell_movie_dialogs_corpus.zip\cornell movie-dialogs corpus\\"("data", corpus_name)
Traceback (most recent call last):
  File "D:\Documents\Python\python pycharm files\pythonProject4\3.9 Chatbot.py", line 26, in <module>
    corpus = "D:\Documents\Python\intents\cornell_movie_dialogs_corpus.zip\cornell movie-dialogs corpus\\"("data", corpus_name)
TypeError: 'str' object is not callable

I hope there is a solution that doesn't alter the source code too much, but any tips or help are welcome.我希望有一个不会过多改变源代码的解决方案,但欢迎任何提示或帮助。

I solved my problem by removing anything but the cornell movie-dialogs corpus map.我通过删除除康奈尔电影对话语料库地图之外的任何内容来解决我的问题。 And then replacing the word "data" in line 26 with the directory of that map.然后用该地图的目录替换第 26 行中的“数据”一词。 This fixed it for me这为我修好了

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何减少使用deeplearning4j(内存映射文件和WorkspaceConfiguration)的程序中的RAM利用率? - How can I reduce the RAM utilization in my program that use deeplearning4j (Memory-mapped files and WorkspaceConfiguration)? 无法指定我在我的谷歌合作实验室的谷歌驱动器中上传的训练图像的路径以进行深度学习 - Can't specify path to training images which I have uploaded in my google drive in my google colaboratory for deeplearning 如何在 Deeplearning4j 中使用自定义数据模型? - How can I use a custom data model with Deeplearning4j? 如何在我的计算机上设置管理 CelebA 数据集的路径以让 pytorch 使用它? - How do I set manage the path of CelebA dataset on my computer to let pytorch work with it? 我应该如何改变加载数据集的方式,以便可以利用 kaggles TPU - How should I change the way I load my dataset so I can take advantage of kaggles TPU 如何在不同分辨率下使用经过训练的深度学习模型? - How to use a trained deeplearning model at different resolutions? 如何在 pytorch 中更新我的 ImageFolder 数据集? - How do I update my ImageFolder dataset in pytorch? 如何在Facebook / Deepmask上训练自己的数据集? - How do I train my own dataset on facebook/deepmask? 如何通过测试我的面罩 rcnn model 来纠正此错误 - How can I correct this error from testing of my mask rcnn model 如何使用deeplearning4j将混合类型的输入连接到多层网络中? - How can I concatenate mixed type input into multi layer network with deeplearning4j?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM