Beispiel #1
0
 def _check_checkpoint(self: TrainerType,
                       ckpt: Optional[str]) -> Optional[str]:
     if ckpt is None:
         return ckpt
     if system.is_url(ckpt):
         ckpt = system.download_url(cast(str, ckpt), self.checkpoint_dir)
     ckpt = os.path.join(self.checkpoint_dir, ckpt)
     return ckpt
Beispiel #2
0
    def __init__(self, directory, transforms=None):
        dest = download_url(MOVIECORPUS_URL, directory)
        with ZipFile(dest, 'r') as zipfd:
            zipfd.extractall(directory)

        self.transforms = transforms
        new_dir = os.path.join(directory, 'cornell movie-dialogs corpus')
        self.file_lines = os.path.join(new_dir, 'movie_lines.txt')
        self.file_convs = os.path.join(new_dir, 'movie_conversations.txt')

        self.pairs = self.getdata(new_dir)
        self.word2count = {}
Beispiel #3
0
    def __init__(self, directory, transforms=None, train=True):
        dest = download_url(MOVIECORPUS_URL, directory)
        with ZipFile(dest, 'r') as zipfd:
            zipfd.extractall(directory)
        self._file_lines = os.path.join(directory, 'cornell '
                                                           'movie-dialogs '
                                                           'corpus',
                                        'movie_lines.txt')

        self._file_convs = os.path.join(directory, 'cornell '
                                                           'movie-dialogs '
                                                           'corpus',
                                        'movie_conversations.txt')

        self.transforms = transforms
        self.pairs = self.get_metadata()
        self.transforms = transforms
Beispiel #4
0
 def _check_checkpoint(self: TrainerType,
                       ckpt: Optional[str]) -> Optional[str]:
     if system.is_url(ckpt):
         ckpt = system.download_url(cast(str, ckpt), self.checkpoint_dir)
     return ckpt