mirror of
https://github.com/osmarks/nanogpt-experiments.git
synced 2024-12-18 14:10:28 +00:00
add relative import in shakespeare_char
This commit is contained in:
parent
3611338959
commit
bf779456f3
@ -10,12 +10,13 @@ import requests
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
# download the tiny shakespeare dataset
|
# 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'
|
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)
|
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()
|
data = f.read()
|
||||||
print(f"length of dataset in characters: {len(data):,}")
|
print(f"length of dataset in characters: {len(data):,}")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user