-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nano-GPT train for letter sorting #12
Comments
I am a newbie in AI and want to try it myself, but I find it is still a bit difficult. |
I generated some training data and then replaced the Shakespeare_char demo to train a char sorting model. import itertools
import random
# Set the number of samples you want
num_samples = 10000
# Generate the dataset
data = []
for _ in range(num_samples):
# Create a random string using ABC characters
string = ''.join(random.choice('ABC') for _ in range(random.randint(1, 5)))
# Sort the string to get the correct answer
sorted_string = ''.join(sorted(string))
# Add the unsorted and sorted pair to the dataset
data.append(f"{string}|{sorted_string}")
# Save the dataset to a file
with open('sorting_dataset.txt', 'w') as f:
for line in data:
f.write(line + "\n") |
@gitzhangzhao |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great project! I would like to know how to train the letter sorting model mentioned in the nano-GPT visualization project? I think the visualization here is more clear when combined with the nano-GPT project code? So is it convenient to provide training documents for the alphabetical sorting model? Thank you so much!
The text was updated successfully, but these errors were encountered: