dotnet --version
dotnet --version
dotnet --version
# Create a new console application
dotnet new console -n MicroGPT -f net10.0 # Move into the project directory
cd MicroGPT
# Create a new console application
dotnet new console -n MicroGPT -f net10.0 # Move into the project directory
cd MicroGPT
# Create a new console application
dotnet new console -n MicroGPT -f net10.0 # Move into the project directory
cd MicroGPT
# Linux / macOS
curl -o input.txt https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt # Windows (PowerShell)
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt" -OutFile "input.txt"
# Linux / macOS
curl -o input.txt https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt # Windows (PowerShell)
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt" -OutFile "input.txt"
# Linux / macOS
curl -o input.txt https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt # Windows (PowerShell)
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt" -OutFile "input.txt"
<!-- --- MicroGPT.csproj (add inside the <Project> element) --- --> <ItemGroup> <None Update="input.txt"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>
</ItemGroup>
<!-- --- MicroGPT.csproj (add inside the <Project> element) --- --> <ItemGroup> <None Update="input.txt"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>
</ItemGroup>
<!-- --- MicroGPT.csproj (add inside the <Project> element) --- --> <ItemGroup> <None Update="input.txt"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None>
</ItemGroup>
# Linux / macOS
touch Value.cs GradientCheck.cs Tokenizer.cs BigramModel.cs Helpers.cs Model.cs AdamOptimiser.cs FullTraining.cs # Windows (PowerShell)
"Value.cs", "GradientCheck.cs", "Tokenizer.cs", "BigramModel.cs", "Helpers.cs", "Model.cs", "AdamOptimiser.cs", "FullTraining.cs" | ForEach-Object { New-Item -ItemType File -Name $_ }
# Linux / macOS
touch Value.cs GradientCheck.cs Tokenizer.cs BigramModel.cs Helpers.cs Model.cs AdamOptimiser.cs FullTraining.cs # Windows (PowerShell)
"Value.cs", "GradientCheck.cs", "Tokenizer.cs", "BigramModel.cs", "Helpers.cs", "Model.cs", "AdamOptimiser.cs", "FullTraining.cs" | ForEach-Object { New-Item -ItemType File -Name $_ }
# Linux / macOS
touch Value.cs GradientCheck.cs Tokenizer.cs BigramModel.cs Helpers.cs Model.cs AdamOptimiser.cs FullTraining.cs # Windows (PowerShell)
"Value.cs", "GradientCheck.cs", "Tokenizer.cs", "BigramModel.cs", "Helpers.cs", "Model.cs", "AdamOptimiser.cs", "FullTraining.cs" | ForEach-Object { New-Item -ItemType File -Name $_ }
dotnet run -- ch1 # runs Chapter1Exercise.Run()
dotnet run -- ch7 # runs Chapter7Exercise.Run()
dotnet run -- full # runs the final training + inference
dotnet run # same as "full"
dotnet run -- ch1 # runs Chapter1Exercise.Run()
dotnet run -- ch7 # runs Chapter7Exercise.Run()
dotnet run -- full # runs the final training + inference
dotnet run # same as "full"
dotnet run -- ch1 # runs Chapter1Exercise.Run()
dotnet run -- ch7 # runs Chapter7Exercise.Run()
dotnet run -- full # runs the final training + inference
dotnet run # same as "full"
// --- Program.cs --- namespace MicroGPT; public static class Program
{ public static void Main(string[] args) { string chapter = args.Length > 0 ? args[0].ToLowerInvariant() : ""; switch (chapter) { // Uncomment each case as you complete the corresponding chapter. // case "gradcheck": // GradientCheck.RunAll(); // break; // case "ch1": // Chapter1Exercise.Run(); // break; // case "ch2": // Chapter2Exercise.Run(); // break; // case "ch3": // Chapter3Exercise.Run(); // break; // case "ch4": // Chapter4Exercise.Run(); // break; // case "ch5": // Chapter5Exercise.Run(); // break; // case "ch6": // Chapter6Exercise.Run(); // break; // case "ch7": // Chapter7Exercise.Run(); // break; // case "ch8": // Chapter8Exercise.Run(); // break; // case "ch9": // Chapter9Exercise.Run(); // break; // case "ch10": // Chapter10Exercise.Run(); // break; // case "full": // FullTraining.Run(); // break; default: Console.WriteLine("MicroGPT project is ready."); Console.WriteLine($"Dataset exists: {File.Exists("input.txt")}"); if (File.Exists("input.txt")) { int lineCount = File.ReadAllLines("input.txt").Length; Console.WriteLine($"Dataset lines: {lineCount}"); } break; } }
}
// --- Program.cs --- namespace MicroGPT; public static class Program
{ public static void Main(string[] args) { string chapter = args.Length > 0 ? args[0].ToLowerInvariant() : ""; switch (chapter) { // Uncomment each case as you complete the corresponding chapter. // case "gradcheck": // GradientCheck.RunAll(); // break; // case "ch1": // Chapter1Exercise.Run(); // break; // case "ch2": // Chapter2Exercise.Run(); // break; // case "ch3": // Chapter3Exercise.Run(); // break; // case "ch4": // Chapter4Exercise.Run(); // break; // case "ch5": // Chapter5Exercise.Run(); // break; // case "ch6": // Chapter6Exercise.Run(); // break; // case "ch7": // Chapter7Exercise.Run(); // break; // case "ch8": // Chapter8Exercise.Run(); // break; // case "ch9": // Chapter9Exercise.Run(); // break; // case "ch10": // Chapter10Exercise.Run(); // break; // case "full": // FullTraining.Run(); // break; default: Console.WriteLine("MicroGPT project is ready."); Console.WriteLine($"Dataset exists: {File.Exists("input.txt")}"); if (File.Exists("input.txt")) { int lineCount = File.ReadAllLines("input.txt").Length; Console.WriteLine($"Dataset lines: {lineCount}"); } break; } }
}
// --- Program.cs --- namespace MicroGPT; public static class Program
{ public static void Main(string[] args) { string chapter = args.Length > 0 ? args[0].ToLowerInvariant() : ""; switch (chapter) { // Uncomment each case as you complete the corresponding chapter. // case "gradcheck": // GradientCheck.RunAll(); // break; // case "ch1": // Chapter1Exercise.Run(); // break; // case "ch2": // Chapter2Exercise.Run(); // break; // case "ch3": // Chapter3Exercise.Run(); // break; // case "ch4": // Chapter4Exercise.Run(); // break; // case "ch5": // Chapter5Exercise.Run(); // break; // case "ch6": // Chapter6Exercise.Run(); // break; // case "ch7": // Chapter7Exercise.Run(); // break; // case "ch8": // Chapter8Exercise.Run(); // break; // case "ch9": // Chapter9Exercise.Run(); // break; // case "ch10": // Chapter10Exercise.Run(); // break; // case "full": // FullTraining.Run(); // break; default: Console.WriteLine("MicroGPT project is ready."); Console.WriteLine($"Dataset exists: {File.Exists("input.txt")}"); if (File.Exists("input.txt")) { int lineCount = File.ReadAllLines("input.txt").Length; Console.WriteLine($"Dataset lines: {lineCount}"); } break; } }
}
MicroGPT project is ready.
Dataset exists: True
Dataset lines: 32033
MicroGPT project is ready.
Dataset exists: True
Dataset lines: 32033
MicroGPT project is ready.
Dataset exists: True
Dataset lines: 32033