Skip to content

Commit

Permalink
add relative import in shakespeare_char
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgross committed Jan 22, 2023
1 parent 3611338 commit bf77945
Showing 1 changed file with 4 additions and 3 deletions.
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 bf77945

Please sign in to comment.