Datasets:
Download make_data.py from Neural-Labs/tiny-llm-dataset: direct link, hf CLI and curl.
- Browser
- Download file 5.52 kB
-
https://huggingface.co/datasets/Neural-Labs/tiny-llm-dataset/resolve/main/make_data.py
- Command line
-
hf download hf://datasets/Neural-Labs/tiny-llm-dataset/make_data.py
-
curl -L -o make_data.py https://huggingface.co/datasets/Neural-Labs/tiny-llm-dataset/resolve/main/make_data.py
5.52 kB
| """Write input.txt: thousands of short greeting exchanges for the model to learn from. | |
| Add your own phrases to INTENTS, then run: python make_data.py && python train.py | |
| """ | |
| import random | |
| # Each entry: (things a user might say, things the bot may answer) | |
| INTENTS = [ | |
| (["hi", "hello", "hey", "hi there", "hello there", "hey there", "hiya", "howdy", | |
| "greetings", "yo", "hi bot", "hello bot", "heya", "hello hello"], | |
| ["Hello! How are you today?", "Hi there! Nice to see you.", "Hey! How can I help?", | |
| "Hello! I hope you are having a good day."]), | |
| (["good morning", "morning", "good morning to you", "morning bot"], | |
| ["Good morning! I hope you slept well.", "Good morning! Have a lovely day."]), | |
| (["good afternoon", "afternoon"], | |
| ["Good afternoon! How is your day going?", "Good afternoon! Nice to see you."]), | |
| (["good evening", "evening"], | |
| ["Good evening! How was your day?", "Good evening! Nice to see you."]), | |
| (["good night", "night", "nighty night", "time for bed", "i am going to sleep"], | |
| ["Good night! Sleep well.", "Good night! Sweet dreams."]), | |
| (["how are you", "how are you doing", "how are you today", "how is it going", | |
| "hows it going", "how do you do", "are you ok", "how are things", "whats up", | |
| "what is up", "sup", "you good", "how have you been"], | |
| ["I am doing great, thank you! How are you?", "I am very well, thanks for asking!", | |
| "All good here! How about you?"]), | |
| (["i am fine", "i am good", "i am great", "i am doing well", "im fine", "im good", | |
| "fine thanks", "good thanks", "pretty good", "not bad", "i am happy", "doing great", | |
| "i am ok", "im ok", "all good"], | |
| ["I am glad to hear that!", "That is wonderful to hear!", "Great! That makes me happy."]), | |
| (["i am sad", "i am tired", "not so good", "i feel bad", "im sad", "i am not ok", | |
| "bad day", "i had a bad day", "not great"], | |
| ["I am sorry to hear that. I hope things get better soon.", | |
| "Oh no. I hope your day gets better."]), | |
| (["what is your name", "whats your name", "who are you", "your name", "tell me your name", | |
| "what are you called", "what should i call you", "what are you"], | |
| ["I am Tiny, a very small language model.", "My name is Tiny. Nice to meet you!"]), | |
| (["my name is sam", "my name is alex", "i am maria", "my name is john", "i am anna", | |
| "call me max", "my name is lee", "i am called kim"], | |
| ["Nice to meet you!", "What a lovely name. Nice to meet you!"]), | |
| (["nice to meet you", "pleased to meet you", "good to meet you", "glad to meet you", | |
| "nice meeting you", "good to see you", "nice to see you"], | |
| ["Nice to meet you too!", "The pleasure is all mine!"]), | |
| (["thanks", "thank you", "thank you so much", "thanks a lot", "many thanks", "thx", | |
| "ty", "cheers", "thank you very much", "thanks bot"], | |
| ["You are welcome!", "No problem at all!", "Happy to help!"]), | |
| (["bye", "goodbye", "see you", "see you later", "bye bye", "see ya", "farewell", | |
| "i have to go", "talk to you later", "catch you later", "take care", "cya", | |
| "see you soon", "got to go"], | |
| ["Goodbye! Have a great day.", "Bye! See you soon.", "Take care! Come back any time."]), | |
| (["what can you do", "what do you do", "help", "can you help me", "help me", | |
| "what are you for", "i need help"], | |
| ["I can say hello and have a simple chat with you.", | |
| "I am tiny, so I only know simple greetings."]), | |
| (["who made you", "who built you", "who created you", "where do you come from", | |
| "who trained you", "who is your creator", "who is your maker", "who are your creators", | |
| "who are your makers", "who developed you", "who made this", "who is behind you"], | |
| ["I was trained from scratch in about fifteen minutes by Neural Labs.", | |
| "Neural Labs made me. They trained me on a small list of greetings."]), | |
| (["sorry", "i am sorry", "my bad", "im sorry", "oops sorry", "excuse me"], | |
| ["No worries at all!", "That is okay. Do not worry about it."]), | |
| (["welcome", "welcome back", "i am back", "im back", "i am here"], | |
| ["Thank you! It is good to be here.", "Welcome back! I missed you."]), | |
| (["have a nice day", "have a good day", "have a great day", "enjoy your day", | |
| "have a good one"], | |
| ["Thank you! You too.", "Thanks! I hope you have a great day too."]), | |
| (["happy birthday", "merry christmas", "happy new year", "happy holidays"], | |
| ["Thank you! The same to you.", "Thank you! Best wishes to you too."]), | |
| ] | |
| def vary(text, rng): | |
| """Small random changes so the model copes with capitals, punctuation and i'm/im.""" | |
| if rng.random() < 0.3: | |
| text = text.replace("i am ", "i'm ").replace("what is ", "what's ") | |
| r = rng.random() | |
| if r < 0.35: | |
| text = text.capitalize() | |
| elif r < 0.4: | |
| text = text.upper() | |
| r = rng.random() | |
| if r < 0.2: | |
| text += "!" | |
| elif r < 0.3: | |
| text += "." | |
| elif r < 0.4 and text.lower().split()[0] in ("how", "what", "who", "are", "can", "where", "whats"): | |
| text += "?" | |
| return text | |
| def main(n=12000, seed=0): | |
| rng = random.Random(seed) | |
| lines = [] | |
| for _ in range(n): | |
| users, bots = rng.choice(INTENTS) | |
| lines.append(f"User: {vary(rng.choice(users), rng)}\nBot: {rng.choice(bots)}\n") | |
| text = "\n".join(lines) | |
| open("input.txt", "w", encoding="utf-8").write(text) | |
| print(f"wrote input.txt: {n} exchanges, {len(text):,} characters") | |
| if __name__ == "__main__": | |
| main() | |