Skip to content

Commit f35dc82

Browse files
committed
fix: prepare.py - added input file opening in UTF-8 encoding
1 parent b7e194a commit f35dc82

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

data/shakespeare/prepare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
input_file_path = os.path.join(os.path.dirname(__file__), 'input.txt')
88
if not os.path.exists(input_file_path):
99
data_url = 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt'
10-
with open(input_file_path, 'w') as f:
10+
with open(input_file_path, 'w', encoding='utf-8') as f:
1111
f.write(requests.get(data_url).text)
1212

13-
with open(input_file_path, 'r') as f:
13+
with open(input_file_path, 'r', encoding='utf-8') as f:
1414
data = f.read()
1515
n = len(data)
1616
train_data = data[:int(n*0.9)]

0 commit comments

Comments
 (0)