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 inference 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
| Types::FoosType = GraphQL::ObjectType.define do | |
| field :foos, !types[Types::FooType] do | |
| timed true # enable New Relic trace_execution_scoped | |
| description "Returns foos" | |
| argument :per, types.Int, default_value: 20 | |
| argument :page, types.Int, default_value: 1 | |
| # Moving to cursor pagination would be better | |
| resolve(...) | |
| end | |
| end |
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
| class ChangeValidator < ActiveModel::EachValidator | |
| # Enforce/prevent attribute change | |
| # | |
| # Example: Make attribute immutable once saved | |
| # validates :attribute, change: false, on: :update | |
| # | |
| # Example: Force attribute change on every save | |
| # validates :attribute, change: true | |
| def initialize(options) |