Skip to content

Instantly share code, notes, and snippets.

View tpritc's full-sized avatar

Tom Pritchard tpritc

View GitHub Profile
@tpritc
tpritc / transformer-by-o1-preview.md
Created September 12, 2024 20:56
I asked OpenAI's o1-preview model to design a simple language model for me, to help me learn

User: Design a simple language model based on the transformer architecture. You should include extensive comments that explain each part step by step for a newcomer to the field of machine learning.

Time: 43.49 seconds

Usage: {"prompt_tokens"=>40, "completion_tokens"=>4927, "total_tokens"=>4967, "completion_tokens_details"=>{"reasoning_tokens"=>896}}

Answer:

# Import necessary libraries
import torch             # PyTorch library, provides tensors and neural network functionalities
@tpritc
tpritc / FadeInAfterSeconds.cs
Last active July 24, 2018 08:21
Fade in GameObjects after a number of seconds. With nice curves.
using UnityEngine;
/// <summary>
/// This component fades the component in after a number of seconds. For it
/// to work, it needs to have a MeshRenderer, and the MeshRenderer needs a
/// material that lets you set the alpha, otherwise it totes won't work.
/// </summary>
[RequireComponent(typeof(MeshRenderer))]
public class FadeInAfterSeconds : MonoBehaviour {