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
| import 'dart:convert'; | |
| /// Manage conversion to and from base 64 | |
| mixin Base64Mixin { | |
| /// Converts a [dynamic] data from plain [String] to base64 | |
| String toBase64(dynamic data) => base64.encode(utf8.encode(jsonEncode(data))); | |
| /// Converts a [dynamic] data from base64 to plain [String] | |
| String fromBase64(dynamic data) => utf8.decode(base64.decode(data as String)); | |
| } |
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
| var colorArray = ['#FF6633', '#FFB399', '#FF33FF', '#FFFF99', '#00B3E6', | |
| '#E6B333', '#3366E6', '#999966', '#99FF99', '#B34D4D', | |
| '#80B300', '#809900', '#E6B3B3', '#6680B3', '#66991A', | |
| '#FF99E6', '#CCFF1A', '#FF1A66', '#E6331A', '#33FFCC', | |
| '#66994D', '#B366CC', '#4D8000', '#B33300', '#CC80CC', | |
| '#66664D', '#991AFF', '#E666FF', '#4DB3FF', '#1AB399', | |
| '#E666B3', '#33991A', '#CC9999', '#B3B31A', '#00E680', | |
| '#4D8066', '#809980', '#E6FF80', '#1AFF33', '#999933', | |
| '#FF3380', '#CCCC00', '#66E64D', '#4D80CC', '#9900B3', | |
| '#E64D66', '#4DB380', '#FF4D4D', '#99E6E6', '#6666FF']; |
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
| Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | |
| ([一-龯]) | |
| Regex for matching Hirgana or Katakana | |
| ([ぁ-んァ-ン]) | |
| Regex for matching Non-Hirgana or Non-Katakana | |
| ([^ぁ-んァ-ン]) | |
| Regex for matching Hirgana or Katakana or basic punctuation (、。’) |