Skip to content

Commit a022d02

Browse files
authored
Merge pull request karpathy#429 from adambala/fixes
Open "shakespeare" data in UTF-8 in "prepare.py"
2 parents f68ac22 + f35dc82 commit a022d02

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ __pycache__/
88
*.pt
99
*.pyc
1010
input.txt
11+
env/
12+
venv/

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)