Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 87ac9de

Browse files
committed
text: use first file if multiple given and print warning
1 parent 34e1fe5 commit 87ac9de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nmtpytorch/datasets/text.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
import warnings
23
from pathlib import Path
34

45
from torch.utils.data import Dataset
@@ -28,7 +29,8 @@ def __init__(self, fname, vocab, bos=False):
2829
if len(self.fnames) == 0:
2930
raise RuntimeError('{} does not exist.'.format(self.path))
3031
elif len(self.fnames) > 1:
31-
raise RuntimeError("Multiple source files not supported.")
32+
warnings.warn('Multiple files found, using first: {}'.format(
33+
self.fnames[0]))
3234

3335
# Read the sentences and map them to vocabulary
3436
self.data, self.lengths = read_sentences(

0 commit comments

Comments
 (0)