This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //The context compressor, author M.Smirnov. | |
| //The source also can be found at | |
| //http://compression.graphicon.ru/ | |
| //usage: | |
| //c infile outfile //encoding | |
| //d infile outfile //decoding | |
| #include <time.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct bc7_block | |
| { | |
| uint8_t m_bytes[16]; | |
| }; | |
| static void write_bits(uint32_t val, uint32_t num_bits, uint8_t* pDst, uint32_t& bit_ofs) | |
| { | |
| assert((num_bits <= 25) && (val < (1U << num_bits))); | |
| *(uint32_t*)(pDst + (bit_ofs >> 3)) |= (val << (bit_ofs & 7)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* PROG1.C */ | |
| /* Simple Hashing LZ77 Sliding Dictionary Compression Program */ | |
| /* By Rich Geldreich, Jr. October, 1993 */ | |
| /* Originally compiled with QuickC v2.5 in the small model. */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| /* set this to 1 for a greedy encoder */ |