Skip to content

Commit

Permalink
Merge pull request karpathy#82 from danielgross/master
Browse files Browse the repository at this point in the history
Missed two spots while relative pathing
  • Loading branch information
karpathy authored Jan 22, 2023
2 parents 3611338 + 2f7fd0a commit 6c40a08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions data/shakespeare/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import numpy as np

# download the tiny shakespeare dataset
if not os.path.exists('input.txt'):
input_file_path = os.path.join(os.path.dirname(__file__), 'input.txt')
if not os.path.exists(input_file_path):
data_url = 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt'
with open('input.txt', 'w') as f:
with open(input_file_path, 'w') as f:
f.write(requests.get(data_url).text)

with open('input.txt', 'r') as f:
with open(input_file_path, 'r') as f:
data = f.read()
n = len(data)
train_data = data[:int(n*0.9)]
Expand Down
7 changes: 4 additions & 3 deletions data/shakespeare_char/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
import numpy as np

# download the tiny shakespeare dataset
if not os.path.exists('input.txt'):
input_file_path = os.path.join(os.path.dirname(__file__), 'input.txt')
if not os.path.exists(input_file_path):
data_url = 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt'
with open('input.txt', 'w') as f:
with open(input_file_path, 'w') as f:
f.write(requests.get(data_url).text)

with open('input.txt', 'r') as f:
with open(input_file_path, 'r') as f:
data = f.read()
print(f"length of dataset in characters: {len(data):,}")

Expand Down

0 comments on commit 6c40a08

Please sign in to comment.