George Hotz | Documentation | building a ramp for tinygrad (with empathy) | tinycorp.myshopify.com

Procesado:

💭 Hacer Pregunta

📊 Análisis

Resumen del video de George Hotz

RESUMEN

Introducción y objetivos

George Hotz inicia su stream con saludos y felicitaciones a sus suscriptores. Menciona una conversación con Andrej Karpathy, quien le indicó que sus tutoriales de TinyGrad son confusos y divagan demasiado. El objetivo de este stream es crear un tutorial ("ramp") para TinyGrad, enfocándose en la claridad y la concisión, involucrando activamente a la audiencia para mantenerlo en tema.

Creación de un tutorial básico ("ramp.py")

George crea un nuevo archivo llamado "ramp.py" e instala TinyGrad. Explica conceptos fundamentales como UOPs (Unitary Operations), tensores y el sistema de detección automática de dispositivos de TinyGrad. Desarrolla un ejemplo sencillo mostrando la creación de un tensor, su realización ("realize") y la ejecución de operaciones, explicando el concepto de "lazy computation" (cálculo perezoso).

Profundización en la arquitectura de TinyGrad

El stream continúa con una explicación de la estructura interna de TinyGrad incluyendo el concepto de caché global para evitar cálculos duplicados. George demuestra cómo el sistema optimiza las operaciones al detectar y reutilizar cálculos idénticos. Discute brevemente el motor de reescritura de grafos ("graph rewrite engine").

Filosofía y enfoque de TinyGrad

George se aparta del tutorial para discutir su filosofía sobre TinyGrad, enfáticamente destacando que no busca "vender" el proyecto, sino explicar su funcionamiento para que los usuarios puedan tomar una decisión informada. Utiliza la parábola del agricultor chino para ilustrar la importancia de considerar el largo plazo frente a las soluciones aparentemente atractivas a corto plazo, criticando la mentalidad de consumo pasivo y promoviendo la comprensión y la participación activa del usuario.

Debugging y Visualización

Se retoma el tutorial con ejemplos de debugging, mostrando cómo visualizar el proceso de compilación y ejecución del código generado. George explica el sistema de colores en la visualización, aclarando el significado de cada código de color utilizado para representar diferentes aspectos de la ejecución.

Conclusión

El stream concluye con una discusión sobre la simplicidad y mantenibilidad de TinyGrad comparándolo con librerías grandes y complejas como PyTorch o Jax. George enfatiza la importancia de construir herramientas accesibles y comprensibles, promocionando la independencia y evitando la dependencia de grandes corporaciones. Responde preguntas de la audiencia sobre diferentes aspectos de TinyGrad, incluyendo la portabilidad de modelos PyTorch, el rendimiento y el futuro del proyecto.

IDEAS

  • Tutoriales simplificados y enfocados para facilitar el aprendizaje de TinyGrad.
  • Énfasis en la comprensión profunda de los fundamentos en lugar de una mera utilización superficial.
  • Desarrollo de herramientas de visualización más intuitivas para el debugging.
  • Construcción de una comunidad activa que promueva la colaboración y el intercambio de conocimientos.
  • Promoción de una mentalidad independiente y de autosuficiencia en el desarrollo de software.

INSIGHTS

  • La complejidad innecesaria dificulta el aprendizaje y la adopción de nuevas tecnologías.
  • Una buena documentación y tutoriales son esenciales para el éxito de un proyecto de código abierto.
  • La mentalidad de consumo pasivo puede ser perjudicial a largo plazo, promoviendo la dependencia en lugar de la autosuficiencia.
  • La simplicidad y la mantenibilidad son factores cruciales para la viabilidad de un proyecto a largo plazo.
  • La transparencia y la claridad en la comunicación son fundamentales para construir una comunidad sólida y comprometida.

🎯 Sabiduría

Análisis de la Transcripción de George Hotz

RESUMEN

George Hotz presenta una introducción ("rampa") a Tinygrad, enfatizando la comprensión profunda sobre la simpleza y evitando la manipulación vía marketing.

IDEAS

  • George Hotz busca enseñar Tinygrad con empatía y enfoque.
  • El tamaño de la fuente influye en la comprensión del tutorial.
  • La meditación es crucial para el enfoque y la enseñanza efectiva.
  • Andrej Karpathy critica la falta de enfoque en los tutoriales de George.
  • Tinygrad prioriza la comprensión profunda sobre la usabilidad superficial.
  • El objetivo no es vender Tinygrad, sino explicarlo para una decisión informada.
  • La parábola del granjero chino ilustra la importancia del horizonte temporal.
  • La manipulación en el marketing crea consumidores dependientes.
  • La auto-diferenciación en Tinygrad sigue los mismos principios de reescritura.
  • La atención al cliente de Tinygrad se enfoca en problemas concretos, no emocionales.
  • El código generado en C es compilado y ejecutado por Tinygrad.
  • El sistema de codificación por colores facilita la comprensión del código.
  • La biblioteca Tinygrad es mantenible por un pequeño equipo de expertos.
  • La simplicidad de Tinygrad permite el entendimiento y extensión por parte del usuario.
  • Tinygrad tiene pocas dependencias, promoviendo la autosuficiencia.
  • La portabilidad de modelos PyTorch a Tinygrad facilita el aprendizaje.
  • Tinygrad busca un desempeño comparable o superior a PyTorch en ciertos casos.
  • La autosuficiencia del usuario es un objetivo fundamental de Tinygrad.
  • El código de Tinygrad (13,667 líneas) incluye un driver AMD completo.
  • George Hotz promueve la creación sobre el consumo de tecnología.
  • El enfoque en la comprensión reduce el ciclo de consumo-dependencia.
  • La filosofía de Tinygrad se extiende a otros proyectos de George Hotz.
  • El consumo irreflexivo de tecnología lleva a la esclavitud del usuario.
  • El cambio individual es esencial para un futuro mejor.

INSIGHTS

  • La empatía es fundamental para una enseñanza efectiva.
  • La simplicidad aparente puede ocultar una complejidad profunda.
  • El horizonte temporal define la percepción del valor.
  • La autosuficiencia tecnológica promueve la libertad individual.
  • La transparencia es clave para una toma de decisiones informada.
  • El marketing manipulador crea dependencia y limita la autonomía.
  • La comprensión profunda precede a la aplicación efectiva.
  • La mantenibilidad reduce la dependencia de proveedores externos.
  • La tecnología debe empoderar al usuario, no esclavizarlo.
  • El cambio individual es el motor del cambio colectivo.

CITAS

  • "George, I try to watch your uh Tiny Grad tutorial videos and what happens in your Tiny Grad tutorial videos is you start out trying to explain things, but then you go off on absolutely tangents uh and go start fixing bugs and go doing things that are unrelated to the tutorial video and none of this makes sense even to me."
  • "So I I need you I need you all here with me paying attention. And if I start to make no sense, I need you to be like, 'George, this shit doesn't make any sense.'"
  • "Step one, increase font size."
  • "No Child Left Behind is a great sentiment by a brilliant man."
  • "Why do I care about teaching others?"
  • "People in general don't make good decisions. They like being sold something shiny."
  • "If you don't retain an ability to independently evaluate, it will be a complete ratcheting up until very powerful forces have entirely manipulated you."
  • "I'm not trying to sell you on using Tiny. I'm trying to tell you what Tiny is."
  • "Tiny consumes nothing. Tiny is yours."
  • "if you can't you can't break out of slavery by using the master's tools."
  • "You as an individual can use the library but then you are a consumer."
  • "The world needs to change or we're all going to die."
  • "Stop being a consumer."
  • "If you are a consumer now, you're going to be a consumer the rest of your life."
  • "But I'm not here to cater to that mentality either."
  • "I don't want to grow up to be a slave. I don't want my kids to grow up to be slaves."
  • "But I'm not telling you to make a different choice because you got to find your own path."
  • "There's no path to not be a consumer."

HÁBITOS

  • Prioriza la meditación para mejorar el enfoque.
  • Utiliza un tamaño de fuente grande para facilitar la comprensión.
  • Busca la comprensión profunda sobre la mera aplicación superficial.
  • Se enfoca en la claridad y la transparencia en la enseñanza.
  • Evita la manipulación y el marketing en su enfoque de enseñanza.
  • Valora y fomenta la participación activa del auditorio.
  • Emplea la parábola para ilustrar conceptos complejos.
  • Prioriza la construcción sobre el consumo de tecnología.
  • Promueve la autosuficiencia tecnológica como clave para la libertad.
  • Fomenta la toma de decisiones independientes y reflexivas.

HECHOS

  • Tinygrad tiene aproximadamente 13,667 líneas de código.
  • Incluye controladores completos para AMD y Nvidia (próximamente).
  • Tinygrad descarga y analiza registros AMD desde internet.
  • Permite la ejecución de código sobre USB.
  • En ciertas situaciones, Tinygrad es más rápido que PyTorch.
  • El código de Tinygrad es mantenible por un pequeño equipo.
  • Tinygrad tiene pocas dependencias (casi ninguna).
  • George Hotz aboga por una filosofía de construcción sobre consumo.
  • El consumo pasivo lleva a la dependencia y la esclavitud tecnológica.
  • El cambio individual es esencial para un futuro mejor.

REFERENCIAS

  • Tinygrad
  • PyTorch
  • Jax
  • React
  • Kubernetes
  • LLVM
  • AMD
  • Nvidia
  • John Deere
  • Parábola del granjero chino
  • Perfetto (herramienta de Google)
  • Haskell
  • Emnest
  • Karpathy
  • Visual Studio Code
  • Jupyter
  • GitHub

CONCLUSIÓN EN UNA FRASE

Domina la tecnología; no seas un consumidor pasivo, crea y comprende.

RECOMENDACIONES

  • Prioriza la comprensión profunda de las herramientas tecnológicas.
  • Fomenta el autoaprendizaje y la autosuficiencia tecnológica.
  • Evita el consumo irreflexivo y promueve la creación consciente.
  • Busca la transparencia y la claridad en la información.
  • Analiza críticamente las estrategias del marketing tecnológico.
  • Desarrolla habilidades de pensamiento crítico e independiente.
  • Utiliza la tecnología para empoderarte, no para esclavizarte.
  • Cultiva la empatía y el enfoque en la comunicación y enseñanza
  • Refuerza la capacidad de evaluación independiente y objetiva.
  • Reconoce la importancia del horizonte temporal en la toma de decisiones.

🔮 Sabiduría PRO

Powered by SOLUTORIA AI

mykyta_1: hey<br>lumma119: sup<br>whiterunknight: good morning<br>Shourikan: Yelo<br>hakobyte: yo<br>optionalflag: lets goo<br>moriartyblen: helo<br>lukasf6: Hello<br>sarah99___: 😎 here before submode (loser mode)<br>cantaim3: hi George<br>480i: hello Mr. Hotz<br>whiterunknight: did you buy the 5MW dam<br>obelixx0: obelixx0 gifted a Tier 1 sub to sarah99___! This is their first Gift Sub in the channel!<br>bojosos: Hello<br>sarah99___: Certified loser now BigSad<br>whiterunknight: hahahaha<br>sarah99___: ty 4 sub<br>RickAndMoreTea: how we doing yall<br>bojosos: Well he is absolutely right<br>MrKerow: alkXD<br>pepebruari: wrangle it in Georgie<br>madebyollin: sounds like it's time to refactor the linearizer<br>kalelite: Step 1: increase font size<br>sarah99___: Another certified George Hotz (noob) lesson Kappa . I.e chat will be lost after 10 mins<br>colonizethemoon: yo<br>djcodered__: lmaoooo<br>whiterunknight: :D<br>jjccccccj: Can you teach us react native?<br>bojosos: Good font size<br>whiterunknight: it’s a great font size<br>djcodered__: extra nice George ...<br>djcodered__: lmaooo<br>MrKerow: why you care about teaching others george ?<br>sarah99___: Karpathy era. I remember "Karpathy tries to actually teach you something, I just want to prove I'm smarter than you" GeoHotz<br>whiterunknight: George w hotz<br>jjccccccj: Meditation time?<br>bojosos: ratirlAlfred<br>bojosos: And we are already off HypeKEKW<br>djcodered__: I had a social studies teacher like that<br>jjccccccj: Those were the best classes tbh<br>sarah99___: she sounds 40+ so no<br>MrKerow: alkXD<br>alexberd24: peak content<br>bojosos: ratirlMeditate<br>sarah99___: BigSad we got GeoHotz Meditation before GTA 6 😭<br>whiterunknight: Namaste<br>sarah99___: you have to say the Namaste! It's what seals the calmness<br>bojosos: Gonna need that video in another 10 minutes<br>itsamarcos: meditation may be more effective than overcaffeination, guess I'll never find out though<br>sarah99___: Will captain throw us overboard (ban) ?<br>cuddles2000: cuddles2000 subscribed with Prime.<br>MrKerow: that's a name<br>itsamarcos: is there a goal for the tutorial? like fine tuning or running inference on a specific toy model?<br>kalelite: i didn't know we would go that noob<br>gliched_robot: gliched_robot subscribed at Tier 1. They've subscribed for 34 months! Looking forward to Tinycloud, how was your trip to find 1MW power stations?<br>cuddles2000: Nice outfit George. Looking the oppositie of disheveled. Shelved?<br>whiterunknight: I asked him that @gliched_robot he said to not get him started lol<br>gliched_robot: @whiterunknight thanks! Sorry for repeating!<br>MustiFreak: hello<br>ABeautifuIDeath: hi<br>cuddles2000: What do you mean by "not computed yet" for the static data you set?<br>stoddlabs: stoddlabs subscribed at Tier 1.<br>stoddlabs: what is the benefit of Tinygrad being lazy?<br>gliched_robot: @cuddles2000 Because the ops are lazy. will run when they are needed. think similar to the python datetypes, it will assigned when needed to.<br>cuddles2000: So the lazy part in this case isn't "computing" as in math, it's about copying from memory to TPU<br>radon_90: radon_90 subscribed with Prime. They've subscribed for 3 months!<br>ABeautifuIDeath: ABeautifuIDeath subscribed with Prime. They've subscribed for 2 months, currently on a 1 month streak!<br>landepbs: and tag<br>TamagotchiCoder: hello dude<br>bojosos: This is a very tutorially tutorial<br>cuddles2000: Do duplicate calls do realize throw exceptions or is it a no-op?<br>IceLeo: IceLeo is gifting 10 Tier 1 Subs to georgehotz's community! They've gifted a total of 111 in the channel!<br>IceLeo: IceLeo gifted a Tier 1 sub to timichiban!<br>IceLeo: IceLeo gifted a Tier 1 sub to slouck!<br>IceLeo: IceLeo gifted a Tier 1 sub to 480i!<br>IceLeo: IceLeo gifted a Tier 1 sub to dfdx2!<br>IceLeo: IceLeo gifted a Tier 1 sub to lyrareturns!<br>IceLeo: IceLeo gifted a Tier 1 sub to thatjuandev!<br>IceLeo: IceLeo gifted a Tier 1 sub to brun2302!<br>IceLeo: IceLeo gifted a Tier 1 sub to kaljr!<br>IceLeo: IceLeo gifted a Tier 1 sub to Xewl!<br>IceLeo: IceLeo gifted a Tier 1 sub to jasondavies0!<br>TamagotchiCoder: Does it support Metal?<br>itsamarcos: I would just recommend having a clear goal for the tutorial, so that there is an end result to look forward to makes the knowledge stickier too<br>itsamarcos: oops newline got removed there<br>dfdx2: @IceLeo Thanks for the gift sub!<br>smurfd0: <3<br>stoddlabs: If Pytorch isn't lazy, why is tinygrad? What benefits and trade offs are there?<br>itsamarcos: > what is the benefit of Tinygrad being lazy? @stoddlabs it's so you can optimize the computation graph instead of executing every instruction greedily<br>bojosos: Torch has lazy stuff you just have to use them explicitly<br>stoddlabs: @itsamarcos so the idea would be to get all the context/steps for the job, then optimize form there instead of trying to optimize each step without the full context?<br>Mohaidoss: Mohaidoss subscribed with Prime.<br>Mohaidoss: Devtools pprint doesn't help make it prettier ?<br>firejjb1: if 2 UOp have the same src how is that printed<br>nuttyodin1: nuttyodin1 subscribed at Tier 1. They've subscribed for 26 months!<br>cuddles2000: That's super cool. It sounds like it would only copute t*4 once<br>smurfd0: print on line 95 you dont have the output for?<br>dontcrysomuch21: dontcrysomuch21 subscribed with Prime.<br>cuddles2000: I wonder how much CPU/memory gets spent trying to match operations to the global list to prevent duplicate compute<br>bojosos: What python is so magical<br>nuttyodin1: what are we doing today<br>stoddlabs: maybe it wouldn't be appropriate here, but maybe put why using Tinygrad makes sense over other libraries?<br>bojosos: But people in general don't make good decisions, they like being sold something shiny<br>itsamarcos: @stoddlabs exactly<br>cuddles2000: Is George threatening to break our leg?<br>def_stimulatedreceptors: def_stimulatedreceptors subscribed at Tier 2.<br>def_stimulatedreceptors: George, I am about to purchase tbox reds. I'm concerned on shipping internationally, especially to Aus. Have you had experience with shipping expensive large items to aus?<br>bambikapelo: x^2<br>cuddles2000: Yes<br>bojosos: yes<br>cuddles2000: AI support bot? Sometimes they don't suck now<br>djcodered__: lmaoooo I swear my friend thinks<br>djcodered__: If Im his CTO... he can text and email about random shit<br>djcodered__: koggin1Lynn2<br>smurfd0: maby keep output within """ """ comments<br>jjccccccj: what is a ramp<br>whiterunknight: a ramp for the noobs<br>cuddles2000: Is the generated C code just a reference or does it actually compile snippets of C as you run it?<br>def_stimulatedreceptors: Okay, that was all. I wanted to see the success rate of landing w/o damage. I have no trust issues w/ Tinygrad, just with shipping companies I've had bad experiences relating to expensive, hard to get hardware. Thanks, good point. No I'm not looking for tinygrad to hold my hand and make me feel warm and fuzzy through each stage of the transaction. :)<br>whiterunknight: intel powered forklift<br>bojosos: Tiny customer service<br>boop322: boop322 subscribed with Prime.<br>def_stimulatedreceptors: It's not a money thing for me, I have a thing for freight handling morons breaking precious chips.. In Aus, our suppliers cut margins thin on consumer grade GPU's, so we have a limited market. How that relates to my point, I suppose I have an phobia of GPU's being broken and wasted lol<br>whiterunknight: Hi<br>nuttyodin1: Hi, who is this now<br>whiterunknight: He needs his supplements<br>cuddles2000: George has gotten so zen<br>def_stimulatedreceptors: @cuddles2000 he has hasn't he<br>def_stimulatedreceptors: I think its called perspective<br>nuttyodin1: karpathy "empathy"<br>firejjb1: this is making sense so far<br>whiterunknight: Looking for shiny objects<br>nuttyodin1: who is the gurl<br>Ke_0: we don't<br>gliched_robot: Never ask chat!<br>cuddles2000: Ok so I actually have found this very straightforward and I've never worked with any of these libraries before, but I've been a software engineer for many years<br>def_stimulatedreceptors: Let sleeping dogs lie<br>0tt_1: Hello<br>whiterunknight: Very interesting podcast episode<br>gliched_robot: Increasingly, software has been abstracting away things. example torch! I think tinygrad is a breath of fresh air!<br>codingfisch: A fastai-like frontend would help...to attract script kiddies<br>gliched_robot: I have an Idea, bring in karpathy to stream for 1 hour and show him step by step. Good tutorial and stream.<br>whiterunknight: Your cam is still big, not that im complaining, but for the tutorial<br>cuddles2000: Does caching occur with the kernelized operations too? Like if two different operations produce the same kernel, is that computation run once? Like t+2+3 and t+1+4<br>wirtuosis: wassousu subscribed at Tier 1.<br>smurfd0: a good thing is that you can compare the output of prints to see that you do the same<br>stoddlabs: is the c code generated on the fly, and that's why the function name is E4n2()...?<br>stoddlabs: that explanation makes sense, ty<br>himynameischungus: I think VIZ is much more intuitive<br>smurfd0: nice to know the colors and the letters :)<br>himynameischungus: How stable is tinygrad's API? My perception is that multi is still fairly unstable<br>takeuchi_satomi: Ohhhh shiiii George is Streaminnnngggg lets gooooo. I was running out of george hotz archive vids on youtube to run in the background as I work XD<br>gliched_robot: I think I tweeted that it's crazy how derivative algebra is just 300 lines of code.<br>stoddlabs: so that means you could hypothetically create your own dag with all the ops and pass it to tinygrad to execute?<br>banceman: maybe add # %% to make each specific section runnable?<br>banceman: You need to end it too, I think.<br>banceman: No, just starting is enough. Sorry about that.<br>smurfd0: isnt this like one of those, i loose the name of them. ipython ehh<br>majorwho: had the same problem a week ago haha<br>majorwho: resolved it by using a venv<br>bojosos: This is a venv free strema<br>whiterunknight: I gave up on jupyter because of this kernel shit<br>majorwho: we love the Python undefined.undefined.undefined<br>smurfd0: jupiter playbooks what i was meaning<br>smurfd0: https://code.visualstudio.com/docs/python/jupyter-support-py<br>banceman: Do you have Jupiter installed via pip?<br>banceman: jupyter*<br>krakendmp: krakendmp subscribed at Tier 1. They've subscribed for 41 months!<br>majorwho: so ramp is like a tutorial/introduction i suppose?<br>whiterunknight: Yes<br>majorwho: nice<br>ForLoopInBash: ForLoopInBash subscribed with Prime.<br>hellscape48: coat makes him look like Chamath<br>gliched_robot: tiny box helping people hit SOTA https://x.com/jsuarez5341/status/1931369293536534572?s=12<br>majorwho: i think yeah<br>majorwho: its pretty simple<br>bambikapelo: this looks like haskell as a python dsl<br>gliched_robot: Did you also write about the graph view and debugging or that is a different tutorial ?<br>banceman: auto detect the best device is so nice<br>codingfisch: The pleb wants a short frontend. Something like "trainer.fit(...)"<br>himynameischungus: What do you mean by "time-based" visualisation? Like a profiler?<br>stoddlabs: this kind of reminds me of the Spark UI<br>jof343: If I cant probe once in a while how i'm I suppose to know i'm not talking to a brick wall?<br>whiterunknight: Damm the cops are outside<br>runnamucker4: WutFace<br>runnamucker4: manja manja, enjoy!<br>takeuchi_satomi: baiiiii<br>gliched_robot: bye boys!<br>majorwho: Have a good meal<br>takeuchi_satomi: When does the tinygrad and tinybox get to the level where company number 3 AI girlfriends becomes a reality Kappa<br>Giully3_14: Hi George, hope you are doing well. Thanks for sharing these, a lot to learn, have a nice day!<br>majorwho: Thank you for doing this!<br>whiterunknight: Made the font large and almost used a venv<br>takeuchi_satomi: On a more serious note seriously huge thanks for the stream and teachings!<br>rivetingco: conceptually simple?<br>dantedante33: "to commoditize the petaflop." i like your word choice herr<br>gliched_robot: There is no way anyone we can maintain torch code.<br>lsteacke: so you're john deere?<br>Zeevo: you just dont like dependencies<br>takeuchi_satomi: Smart people make things simple :)<br>n00n00n: You are wrong, King Terry can<br>ibarres: why is WMMA not a rewrite rule<br>banceman: I will go through the ramp. If I have any pointers, I will talk about it in Discord<br>stoddlabs: what is a warp?<br>govert72: Nice intro, thank you. Is trying to port an existing PyTorch-based model to tinygrad a good way to learn more? Should we expect better performance some day, or what other beniefits from doing this?<br>bojosos: @stoddlabs You should listen to his noob gpu tutorial<br>stoddlabs: @bojosos will look for it, I know nothing about GPUs<br>whiterunknight: @stoddlabs https://modal.com/gpu-glossary/device-software/warp<br>stoddlabs: @whiterunknight tyty<br>bojosos: I still remember the days of the 1000 line rule<br>pratikshit08: do tiinygrad make money<br>codingfisch: How many lines would be needed for tinygrad if solomonoff induction would be computable? 🤓<br>Zeevo: @georgehotz what excites you about python's future?<br>rivetingco: o7<br>majorwho: see ya<br>whiterunknight: Byeee<br>Gameplayer0618: o7<br>OetziOfficial: have a good one<br>takeuchi_satomi: See yaaas<br>runnamucker4: epic strim thank you!<br>def_stimulatedreceptors: thanks brother<br>SpongyBread: Thanks George!<br>malateman: what food?<br>pupscub: Will miss you<br>pupscub: have a great lunch<br>runnamucker4: what fodo?<br>def_stimulatedreceptors: When's new blog?<br>rivetingco: i love the heart, big heart<br>mokert2: Hi George, I played a little bit around with torch.linalg, unfortunately so far my impression is that it is not in good shape<br>def_stimulatedreceptors: no just new blog<br>majorwho: lex?<br>pratikshit08: what do think about software nowadays<br>robin_2723: are you gonna rub your belly after the lunch<br>21benzen: maybe we can upgrade you someday to a leather jacket<br>jjccccccj: has dwarkesh invited you?<br>bojosos: tiny.linalg?<br>FatherOfFamilyValues: ❤️<br>def_stimulatedreceptors: ResidentSleeper<br>runnamucker4: feel like i need that as a slogan on a tshirt, merch incoming soon?<br>waena_: At what age did you stop being a consumer?<br>pupscub: Don't consume it use it to build!<br>itsamarcos: we're heading towards a two-class society<br>itsamarcos: whatever incentives created youtube shorts and tiktok are not going away<br>ibarres: best asmr<br>def_stimulatedreceptors: just don't be a drone, have some spark<br>dantedante33: we need to clip that.<br>runnamucker4: vswedHi<br>whiterunknight: signed All<br>right, let's see If anyone's actually<br>here this morning, happy<br>Saturday. Um, check out my check out my<br>founders fun<br>jacket.<br>Um, so yeah, there was no stream last<br>weekend.<br>Uh, whoa, whoa, whoa, whoa, whoa. Subs<br>are better people, but don't trigger me<br>this morning because we got real shit to<br>do today. Okay. Got real shit to do<br>today. No, no triggering. We got We got<br>to go to sub mode right now, actually.<br>And congratulations, Sarah 999. You're<br>the<br>reason. Um, no, I didn't buy it. Damn, I<br>found a lot of Don't get me started on<br>that. You're really trying to trigger me<br>this morning. You're really really all<br>trying to trigger me. But we can't get<br>triggered because we got stuff to do<br>today.<br>Um, so<br>uh, let's see. I talked with Carpathy<br>last<br>weekend<br>and wow wow wow wow X. Wow. Thank you<br>for Thank you for gifting subs. Your<br>choice of who to gift the sub to. I<br>might question a little bit, but you're<br>right. All right.<br>Um, so I was talking with Carpathy last<br>weekend<br>and you know, he's obviously a very<br>smart person and he's like, "Yeah,<br>George, I try to watch your uh Tiny Grad<br>tutorial<br>videos and what happens in your Tiny<br>Grad tutorial videos is you start out<br>trying to explain things, but then you<br>go off on absolutely tangents uh and go<br>start fixing bugs and go doing things<br>that are unrelated to the tutorial video<br>and none of this makes sense even to me.<br>So I'm like if I'm not even making<br>tutorial content content that Andre<br>Carpathy can watch, what hope do the<br>rest of you have? Uh so we're going to<br>really try today. Uh and if I if I go<br>off topic, if I So I I need you I need<br>you all here with me paying attention.<br>And if I start to make no sense, I need<br>you to be like, "George, this shit<br>doesn't make any sense." Okay. We need<br>everybody. This is a team effort today.<br>Okay. All right. So, everyone, I'm sure,<br>is familiar with with with a UOP, a JIT,<br>a tensor, what graph compilers? No. See,<br>that's the problem. We're going to<br>start Yeah, he's absolutely right. Okay,<br>we're going to start with absolutely<br>nothing.<br>Okay. So, we're going to create a new<br>file called<br>ramp.py. And we're going to try as hard<br>as we possibly can to keep everybody,<br>even everyone who's a subscriber. We got<br>to make a bar somewhere.<br>Okay. We got to make a bar somewhere.<br>Uh, so these are the tiny docs. You can<br>install Tiny with that<br>command. All right. Great. We've<br>installed Tiny<br>Grad. Step one, increase font size.<br>Thank you. Thank you. Because we need<br>empathy today. Okay, we're going to make<br>the font size big because if I can't<br>teach you guys with a big font size,<br>what hope do we have? Okay, is that a<br>good font size for people? Can everybody<br>see? Is that a good font<br>size? You know, if the font's big, I'm<br>really trying, guys.<br>Can you teach us react native? Get out<br>of<br>here. Okay, we're really we're really<br>gonna try. You know, you know, have you<br>heard of No Child Left Beh? Oh, that's a<br>bullet. No, no, no, no. We're not We're<br>not<br>getting No Child Left Behind is a great<br>sentiment by a brilliant man. No, no,<br>no, no. I'm triggering myself here. No,<br>we got to we got to stay focused. Right.<br>Right. A brilliant man. George W. No,<br>no, no, no, no, no, no, no. It's No,<br>it's not worth it. It's not worth it. We<br>got to stay focused. Why do I care about<br>teaching others? Oh my god. Yeah, I'm<br>like that teacher who you just like, All<br>right. And today we're going to finally<br>get around to that quiz. But but but Mr.<br>Scarpone, could you tell us about that<br>time back in high school when you were<br>Oh, yeah. That time back in and then<br>that's the class, right? You know. All<br>right. Meditation time. That's That's a<br>good place to start. Let's start with<br>some meditation. All<br>right. Yeah. Yeah, I know. Those are the<br>best classes. You really learned some<br>shit. Now, I had this great teacher, Mr.<br>We Yeah, you're getting me. You're<br>getting me. I had this great teacher,<br>Mr. Williams. Mr. Williams told us about<br>this one time when he worked on this<br>boat, but it wasn't like a real boat cuz<br>he couldn't drive it places. It was<br>always anchored. And this lady asked<br>where the exit was and he was like,<br>"Well, you know, yeah, where where are<br>we now? You got to wait. You got to wait<br>for it to come back." And she's like,<br>"Okay, all right. Let's take a minute<br>and find some peace. Close your eyes,<br>and we'll take a few moments to calm<br>your mind and body.<br>One minute is too short. This is too<br>short of a meditation. You can't<br>meditate in one minute. We need<br>two." Now we're talking.<br>Hi, I'm Rosalie and welcome to this<br>twominut meditation. You think she's<br>hot? Find a comfortable position and<br>allow your eyes to blink<br>clos. Now take a deep breath<br>in and let it go with a<br>sigh. And again, deep breath<br>in and side<br>[Music]<br>out. Breathing in<br>again. And as you exhale, let go of any<br>worries, any<br>concerns, any niggling thoughts.<br>With every exhale, allowing any tension<br>to melt away from your<br>shoulders, your neck, your<br>jaw, just for this<br>moment, letting go of any worries, any<br>concerns, knowing that you can always<br>come back and take care of these later.<br>Now settle into this space of ease and<br>comfort where there's nothing to do<br>except to<br>relax and enjoy this<br>[Music]<br>feeling. And it's time now to come fully<br>back into your<br>body, feeling<br>relaxed,<br>serene, and ready for whatever lies<br>ahead.<br>Namaste. All right. I'm coming to you<br>from a place of<br>empathy.<br>I am You are First officer Blunt and I<br>am Captain Allers. First officer Blunt<br>speaks what's on his mind and Captain<br>Allers listens and tries to understand.<br>Yeah, we'll come back to that video if<br>we need it. It's a good<br>video. Okay, I'm going to put chat down<br>here because I don't need you right now.<br>Okay, so we've pip installed tiny<br>It's very easy to work on Tiny while<br>you're using Tiny and before 1.0 it's<br>kind of encouraged to be used like that<br>but it is fully usable as just a library<br>where you can install it and don't have<br>to think about it. We still recommend<br>installing from master. You know, it's<br>easy to just you can just get pull in<br>that directory.<br>So maybe we should start with the<br>concept of a device. Um so from tinyrad<br>import<br>device and we can print<br>device.default. Tiny auto detects<br>the pest device on your<br>system and makes it the default.<br>Okay. So we have a device. This device<br>is called metal.<br>Now let's create a tensor.<br>Uh, this tensor has not<br>been<br>computed yet.<br>Okay.<br>The lazy<br>data<br>property on<br>tensor<br>contains the chain contains the<br>specification of how to<br>uh compute it.<br>As you can see,<br>uh, it's<br>specifying copy<br>from the Python device,<br>which is where<br>the array<br>lives. Very chill stream today. We're<br>doing simple<br>tutorials. You're off camera if you go<br>over there, too, by the way.<br>Um, so you can see that this is a buffer<br>on the Python device. This arg four<br>means that it has size four and it's<br>just a zero with buffer because buffers<br>are unique.<br>UOPS are the core or the specific<br>specification<br>specification language in<br>tiny. They are<br>immutable and<br>form a deck.<br>They have an<br>optal sources<br>parents and an<br>arc. Right? So everyone see the uops ops<br>dt type arg source you can see that<br>source is like this buffer u has a<br>unique and a device as a<br>source we<br>want to realize a tensor<br>we can<br>with the realize<br>method.<br>Now when we<br>look at the lazy<br>data, it's changed.<br>Copy<br>was actually run.<br>And<br>now the lazy data of the<br>tensor is<br>just a buffer.<br>If you run with debug equals<br>2, this script with debug equals 2 in<br>the<br>environment. See the copy happen.<br>Okay. Does this make sense to<br>people? Let's check in with chat and see<br>if you guys are following.<br>Ice Leo, thank you for gifting<br>subs. Uh, do duplicate calls do realize<br>throw exceptions or is it a noop? So, we<br>can get to what duplicate calls do in a<br>minute.<br>Um, now let's do<br>some compute.<br>Um, t * 2 = t * 2.<br>It's interesting that const has a view.<br>from above is<br>being multiplied.<br>I<br>uh see and now is when I like I don't<br>like the way the shape tracker<br>printed. It's expanded.<br>It's<br>[Music]<br>reshaped and<br>expanded to<br>broadcast the<br>const to the buffer.<br>The lazy data to see the specification.<br>specification.<br>UOPS UOPS<br>are<br>both immutable and globally<br>unique.<br>Multiply<br>tensor by four.<br>twice. These<br>result tensors will<br>be have the same<br>isn't just the<br>same. It's the exact same Python object.<br>Okay. Does this stuff make sense to<br>people? We've done some some very<br>basic like is this<br>readable? If two u ops have the same<br>source, oh it's like dduped. You can try<br>it. Yeah, it would only compute t equals<br>4 once,<br>right? If we realize<br>Just<br>Oh, I don't have the output for that.<br>Yeah, I should try it.<br>Cool. Okay. So you can see that in<br>between there there's only the copy. The<br>compute is done up here and you can see<br>the compute<br>uh match operations very little very<br>little. It's a so you can it's simple<br>how it works. It's a uh it's a global<br>cache. So like we have a metaclass here<br>which does the dduping here and it just<br>checks to see in this ukash if it<br>matches and if it matches it just<br>returns the existing one in the cache<br>and it's done op by op. So it's<br>extremely<br>fast.<br>Okay. What should we do next?<br>like that gives you a basic<br>understanding. I think maybe next we<br>should play with the graph rewrite<br>engine.<br>What's above<br>gives you enough of<br>an understanding to<br>go use Tiny Grad as a library.<br>Um, maybe we should just do uh<br>um maybe put why using tiny grid makes<br>sense over other libraries. So, I I<br>don't like doing things like that. And<br>not to go off into the weeds into like<br>philosophy,<br>but I'm not trying to tell you why Tiny<br>is right for you. That's what<br>advertising is. That's a form of<br>manipulation and it doesn't go<br>anywhere. It's a race to nowhere. it<br>will end up<br>with. Okay, we're not going to speculate<br>too much, but my point is we don't do<br>that. I'm not trying to sell you on<br>using Tiny. I'm trying to tell you what<br>Tiny is. The best I can do is tell you<br>what it is so you understand that and<br>then you fundamentally have to make your<br>own decision about whether you want to<br>use it or not.<br>So, you know, I explain this philosophy<br>to people and people think that I will<br>lose because of it. And if I do lose<br>because of it, well, so be because the<br>minute you start doing the other thing,<br>you've already lost. You've lost the<br>minute you started<br>playing. Uh because that will end up<br>only<br>with<br>everybody. People in general don't make<br>good decisions. They like being sold.<br>something shiny. So, um do you know the<br>parable of the Chinese<br>farmer? There's a Chinese farmer and his<br>son uh breaks his leg and everybody in<br>the community is, "Oh, that's so<br>terrible. Oh, your son has a broken leg.<br>He can't go work in the field."<br>But it all comes down to time horizons<br>because a month later the conscription<br>officer comes around and drags away all<br>the young men to go fight in the army<br>and the son with the broken leg doesn't<br>have to go because he has a broken leg<br>and then all the town's people change<br>their tune. Wow, it's such a blessing<br>that your son broke his leg and he<br>didn't have to go off and die in<br>Mongolia. So it comes down to time<br>horizons.<br>People might like being sold something<br>shiny over a short time horizon, but if<br>the world continues trying to just sell<br>shiny things to people, the people who<br>fall for the shiny things are going to<br>end up wire-headed. If you don't retain<br>an ability to independently<br>evaluate, it will be a complete<br>ratcheting up<br>until very powerful forces have entirely<br>manipulated you. If you've played the<br>paperclip game, it's like the hypno<br>drones. Uh so the parable of the Chinese<br>farmer shows that what is preferable in<br>the short term may not be what's<br>preferable in the long term. And I'm a<br>man of God. And fundamentally, you have<br>to have faith in human nature. Because<br>if you don't have faith in human nature,<br>oh, I don't know what to tell you. Do<br>you think that the manipulators have<br>your best interest in mind? And of<br>course they don't because manipulators<br>with your best interest in mind will<br>lose in a competitive manipulation game<br>to manipulators that have only their<br>best interests in<br>mind.<br>Uh, tiny also<br>has an<br>auto<br>differentiation that<br>operates<br>according to<br>these<br>same princip<br>Um,<br>This would require me to more deeply<br>understand<br>how I don't actually really understand<br>like what gradients<br>So what's the derivative of<br>x? What's the thing with like the<br>simplest derivative?<br>like log two. I mean, not some<br>anymore. Yeah. Okay. So, the derivative<br>is 1 /x. Is that<br>true? It's also not going to work<br>because no floating points are actually<br>like accurate.<br>Uh due to<br>how<br>[Music]<br>the due to how log<br>is implemented<br>This gradient<br>contains that should actually be able to<br>cancel out. All right. And now we're<br>off. And now we're off on the tangent<br>where we go where we go and fix<br>things. Right. So that should that<br>should cancel out.<br>run. If debug equals 4 can see the<br>generated line of<br>Uh, you're concerned on shipping<br>internationally. We ship tiny boxes all<br>over the world.<br>Uh, I mean, like I want you to like<br>think that through and think about where<br>your concerns really come<br>from. Um, so like obviously if you buy<br>from<br>us,<br>like I'm not going to ship you a bunk<br>box,<br>right? So sometimes I feel that like in<br>general, you know, tiny you can email<br>support tiny.org org and you get no<br>reply. Uh, anybody who has a custom<br>request, completely<br>ignored. My philosophy about this stuff<br>is that there's maybe like 20 or 30% of<br>customers who are looking for more of a<br>uh support experience than we want to<br>provide. And I I've realized that mostly<br>what they're actually looking for isn't<br>anything concrete.<br>They're just testing to see if there is<br>a person available who will care about<br>them. And my response to that is no,<br>there is absolutely not. Uh there is not<br>a person here who you're going to be<br>able to talk to about any of your<br>concerns. And if that's the kind of<br>thing you're looking for, you should<br>purchase from somebody else. Um now,<br>like I don't believe that that's a real<br>concern because obviously you can click<br>Australia in the menu. I put a lot of<br>thought into designing that menu,<br>thinking about<br>what countries we can ship<br>to<br>and like it's not like the box isn't<br>going to show up or it's going to be<br>damaged. That's obviously on us.<br>Uh, so yeah, I mean if it's a genuine<br>question, yeah, of course we ship these<br>things all over the world. We ship<br>multiple out every week. Um, but if it's<br>a, oh, I'm probing to see if there's<br>somebody here who cares about me, the<br>answer is no.<br>I'm not going to keep all output in<br>those comments. Wait, you want me to put<br>this one in the comments? Okay, I guess.<br>Yeah, it looks kind of cool.<br>is in the is in<br>how easy it is<br>to interact with the internals.<br>No, this<br>stuff APIs<br>for No, it compiles to C. That's<br>compiled. That's actually a metal<br>kernel. And I can also run with like CPU<br>equals one. And that's a C kernel.<br>I mean the other thing that I would say<br>about that is you can So<br>um everyone who wants any sort of like<br>support or any kind of interaction with<br>us uh they have to come into the<br>discord and you can read the discord<br>scroll back you can see<br>uh you can<br>see a whole bunch of people praising the<br>packaging. Um you can see one guy who<br>did get his packaging who's whose the<br>packaging was damaged when it arrived.<br>Uh he rejected the package. It was sent<br>back to us and we sent him a new tiny<br>box. Uh we get full insurance on all of<br>these things. Uh we got our money back<br>from FedEx. Uh not just for the<br>shipping, but I think I think we<br>actually got quite a bit for that box,<br>too. Um looked like a guy drove a<br>forklift into the side of it and it was<br>damaged.<br>Uh but yeah, that was one and maybe<br>we've sold<br>maybe sold a bit over a hundred boxes<br>now.<br>The<br>APIs here are subject to<br>change. So<br>We should kind of put some effort into<br>making these print better.<br>Hello. Would you like some lunch?<br>Oh, look who it is.<br>Oh, it's you. The camera's here, though.<br>The camera's here. Hi.<br>What are you getting for lunch? Are you<br>going to Oh, you're ordering from tender<br>greens. Do you want tender greens? I<br>never want tender green. It's not good.<br>It's not that it's not good. It's that<br>it's like sweet green. And in general, I<br>love sweet green. I I know. But but if<br>they have green in the name of the<br>restaurant in general, it's food for<br>rabbits. And you know, if I have that I<br>if rabbits eat it that I don't.<br>It has um salmon steak. I I understand,<br>but if rabbits eat it, I don't. Because<br>you just think about a rabbit and you<br>ask, "Do you want to be the rabbit?"<br>We're all going to become rabbits. Not<br>me. Many people might become rabbits. I<br>think people who fall for shiny objects<br>might become rabbits. Got to talk about<br>shiny objects. I told them the parable<br>of the Chinese farmer. Would you like me<br>to order you something for lunch?<br>What are our options? Are they only from<br>Tender Greens? If there's something else<br>you want, we can order something else.<br>Um, so the food that I like to order,<br>there's a great Chinese place. Is it<br>this one? No, I've never seen that one<br>before. There's my usual Saturday food.<br>Um, so the good Chinese is all on Convoy<br>Street.<br>What is skin<br>check? Tasty Mandarin. What is this? Do<br>I have to spell Chinese, right?<br>So, you told them the parable of the<br>Chinese farmer. I told them the parable<br>of the Chinese farmer. Yeah.<br>Um. Oo. I mean, Dintaiong is very good.<br>That looks great. Oh, what? Dentifong is<br>delicious. It's going to take a long<br>time. It has a moderate Oh, shi magic<br>kitchen. This place. Okay. This place.<br>Sauté spicy chicken with handpull<br>noodles is my favorite. Great. But<br>you'll be happy with that stuff. It's<br>good food. Great. And it's pretty<br>healthy, too. So, it's like it's just<br>real it's real. Like it's like real<br>Chinese. Good. All right. Um,<br>what are we talking about today? We're<br>doing a tutorial. So, Carpathy told me<br>that we need a ramp because Tiny doesn't<br>make any sense.<br>What do you mean it doesn't make sense?<br>Well, I start these tiny grad tutorial<br>streams and then I just go absolutely<br>off into the<br>weeds and we're really trying to stay<br>focused on this stream.<br>All right. So, yeah. Does this make<br>sense?<br>In a galaxy far, far away, we start with<br>a device. A device is where tensors are<br>stored and compute is run.<br>Tiny Ground auto detects the best<br>device. That part makes sense. Okay.<br>Which is the part you're concerned about<br>not making sense. Um, I mean, I'm not<br>sure. I'm not concerned about any<br>specific part not making<br>sense. It's more just<br>like Tiny Grat's just confusing. I don't<br>really know. And that was Carpathy's<br>feedback.<br>Carpathy's feedback was every time we<br>try to do a tutorial to tiny that it<br>doesn't make any sense.<br>I mean, I guess like I don't know. I I<br>don't know. I don't know what people are<br>really looking for.<br>Like there's a lot of people<br>who just want oh I just want to like use<br>this to do something and I don't want<br>those<br>people. The beauty of Tiny is that you<br>can actually like understand it and<br>change it but it is getting confusing<br>which is a which is another problem. And<br>then I usually go off in the weeds and I<br>refactor things to try to make it less<br>confusing.<br>That sounds useful. Well yeah but then<br>that's what we end up doing for the<br>stream.<br>I mean, you could ask these people if<br>they understand it if it's confusing. I<br>don't know if they understand it.<br>How would we know?<br>I don't even know what it really means<br>for them to understand it. Like, what do<br>I want them to do with tiny grad? But<br>then you're in this thing where you're<br>starting to think about like people<br>inside of your box and I don't ever want<br>to be<br>there.<br>Right? It's not like there's like a<br>workflow. I mean, I guess for so many<br>companies, this stuff's really easy<br>because you basically just think, here's<br>a person, and if I had complete mind<br>control over this person, I know that I<br>would want them to purchase a Pepsi and<br>consume a Pepsi every hour of the day.<br>And that would be success for the Pepsi<br>Corporation.<br>But what I want is people to do things<br>that are outside of the box that I've<br>put them in. Because if they're inside<br>the box, I might as well just use AI.<br>Well, they need to understand what it is<br>in order for them to George has gotten<br>so zen.<br>Look at that. What are the chances? What<br>are the chances on that? What are the<br>chances? I wonder why that happened.<br>Yeah.<br>All right. Interesting. I will leave you<br>to it and order some lunch. Sounds like<br>a nice quest. Tell me when the Shan<br>You'll love Shansi Magic Kitchen. I'm<br>excited about it. I'll bring it when it<br>comes. That sounds good. We can have<br>lunch. Get a white rice, too. It's only<br>$2. You can get a rice. Anything else<br>you want? Last chance. Just that. Okay.<br>Thank you.<br>Um source one in this K in this this one<br>is the GPU kernel is the GPU<br>kernel that's going to be<br>Run. Yeah.<br>It's kind of nonsensical still.<br>almost need like a better language<br>to Does this like kind of make sense<br>though?<br>It's basically the same as this.<br>Um<br>almost everything in tiny<br>uh functions<br>as a rewrite of the UOPS.<br>Hey. Uh already ordered. Thanks.<br>Um you can see at this point we are<br>adding seven not three and<br>four. Actually this stuff's always<br>better to do on CP that is CPU.<br>Oh, interesting.<br>I didn't run the linearizer.<br>I don't<br>know. Like, does this syntax make sense?<br>I mean, I know I'm sorry it's like kind<br>of confusing to read and we might want<br>to put some effort into uh working on<br>this, but yeah. So, define global is a<br>global<br>buffer and then we're indexing in with<br>this special thing called<br>GX. As you can see, we're loading from<br>global arg one. We're storing uh into<br>global argu<br>Oops.<br>Okay, so the function name um E4 means<br>that it's an elementwise op. I'll add<br>this here.<br>function<br>name<br>means E for element wise<br>op as<br>opposed to R for reduce<br>op four for the<br>size<br>and for<br>the for name DDang.<br>See<br>print name with debug equals 2. You'll<br>see the four is<br>yellow,<br>meaning<br>that it's upcasted.<br>If you run with no optals<br>1.<br>Get this<br>code. And<br>The four is<br>blue. So we have a list of the colors I<br>believe in<br>kernel.py. Wow. Like, okay, I'm<br>realizing how completely confusing this<br>is. Like when people see like when we<br>run something like beautiful<br>emnest and you can see like you see all<br>these colors and like they all just make<br>sense to me. But I guess this is just<br>nonsense for<br>people. Um, blue is global, light blue<br>is local, red is<br>reduce. Uh, yellow is upcasted and<br>purple is unrolled.<br>Uh, green means<br>group. Wow. I guess I guess like this is<br>such nonsense to<br>people. You think Viz is more<br>intuitive? Yeah.<br>Um, all right. Chat GPT, you're<br>up.<br>What followup questions<br>do you have after reading this tiny grad<br>tutorial?<br>to<br>think about how to approach<br>it. Yeah. Nice to know the colors and<br>the letters, right? Like it's the kind<br>of thing that people just Yeah. Like I<br>don't know. You're right.<br>It is<br>runnable, editable.<br>Whenever you see<br>stuff<br>like<br>discussed these are environment.<br>Oh, do you want to explore writing a<br>custom OP and gradient rules yourself?<br>So like the rewrite rule that's actually<br>doing that is<br>here. Um some people look at code. Oh, I<br>should make this small again. Sorry.<br>Uh, multi is being worked on right now,<br>but it's pretty stable. I mean, the<br>multi- examples haven't changed from<br>like a consumption perspective. It's<br>identical.<br>Uh, so like some people look at code<br>like this and they're like, "This shit<br>doesn't make any sense." But like it's<br>dense and you have to spend time looking<br>at it to understand it. But like<br>We're not optimizing for each line to be<br>readable. We're optimizing for the whole<br>thing to be readable. Like this is our<br>entire gradient library right<br>there. And sure, you might have to look<br>at it for 10 minutes, but like compare<br>that to trying to find wherever the<br>derivative of log is implemented in<br>PyTorch. You can just like edit that and<br>it'll like change the<br>derivative.<br>Um, this isn't that<br>good. I guess I don't really know what<br>to expect.<br>Now we<br>go<br>even lower and<br>understand how the graph rewrite engine<br>works.<br>It's<br>much simpler than what's in LVM or MLR.<br>Uh, I don't I don't really know how that<br>works. What you're saying like<br>this? Oh,<br>cool. What?<br>Huh? What? How do I Why is this doing<br>this?<br>Oh, you're right. How do I Why is this<br>not like<br>Solved it by using a<br>VM. Hate VMs.<br>All<br>right. Well, this might work for<br>somebody, but it doesn't work for me. I<br>don't<br>care. I'll just run it on the command<br>line.<br>Okay. Uh, you ops support normal Python<br>operations. Why doesn't this work?<br>I mean, I guess you want to use a<br>VM. I should get I should gain<br>experience with No, but that won't even<br>like before launching VS Code. What<br>Jupiter playbooks.<br>Oh, here we go.<br>The colonel<br>died. En no ant.<br>Oh,<br>what? I don't even know about that. I<br>mean,<br>Okay,<br>cool. Great.<br>This one runs on its own. T is not<br>defined. I have to redefine T.<br>I think I would almost do this write<br>some of this stuff a lot differently if<br>uh like I knew that it was going to be<br>run like this. It's kind of different,<br>but I don't<br>know. Okay.<br>um pattern matcher is a list of tpples.<br>All<br>right. So, you want to write a pattern.<br>Okay, cool.<br>Okay,<br>cool. So, does this kind of make sense<br>to people?<br>Yeah, we'll have to retweet<br>that. Tiny boxes are very good.<br>Yeah, it's it's it's simple. And then<br>like all<br>the there were edge cases and there were<br>foot guns. But I I think that kind of<br>like explains Tiny<br>Grad. Does anyone have any questions?<br>This looks like Haskell as a Python DSL.<br>Yeah, kind<br>of. It's functional. Um, no. I mean,<br>like viz is you should know about viz<br>once you've<br>uh like here. So, we can actually run<br>this tutorial with viz equals 1. I'm not<br>sure what it's going to do since uh I<br>won't be able to see some stuff. So like<br>yeah you can like see the kernel like<br>here's<br>34 here's that kernel getting written<br>and then like you can see down here<br>uh in<br>symbolic is where<br>like so that's the three and the four.<br>You can see that it's first rewritten to<br>put the two constant in an ad. That's<br>like an associative rule and then that's<br>the con folding rule.<br>um these this unroll thing you can see<br>it propagate through the graph here in<br>the de<br>vectorizer that actually becomes the<br>four stores and stuff. Yeah, I mean this<br>is beautiful and once you like<br>understand what these things even are,<br>this is an incredible tool.<br>um like each one of these boxes in the<br>graph is a UOP and we're working on so<br>uh this is mostly written by Kelin in<br>our discord and now we're working on<br>making a whole new tool kind of like<br>this but uh for timebased visualization<br>and not rewrite based visualization uh<br>yeah and all our devices are the same<br>like they don't have little subtle<br>differences like the torch ones I mean<br>okay there's like some differences like<br>sure a metal doesn't support long, but<br>like it's not like like there's nothing<br>we can do about that. That's fundamental<br>to the device. Um, Torch will be like,<br>"Oh, well, I'm sorry. We don't support<br>int 8 comms on the AVX2 CPU type." Uh,<br>and it's because we compile all the<br>kernels on the<br>fly. I don't know. There is like a lot<br>to understand now.<br>Um, yeah, we can see<br>these the four<br>go and it's<br>gone. Yeah, like a profiler. I mean, we<br>have a profiler, but it's<br>janky. Where's the<br>Yeah, you can see the kernels run over<br>here. Uh, but yeah, it's like peretto<br>based and like yeah, you can see this<br>kernel, but this should ideally like<br>link back to the<br>visualizer. This is just perfetto. This<br>is a Google tool. We can write<br>this. We're working on a different<br>profiler. I think that like work's<br>really going to start to pick up on that<br>and we're going to start thinking about<br>like yeah because otherwise it's really<br>hard to debug<br>theuler also. Yeah, you can just run<br>with like viz equals 1<br>most core concepts in<br>time can<br>run<br>to web<br>based graph<br>rewrite explore<br>Hopefully now you understand it.<br>You don't want trainer<br>fit. You think you do, but you don't.<br>Like, I mean, if you want like read<br>beautiful emnest, right? That's the<br>whole file. That's a whole file for an<br>emnest trainer.<br>Uh there's nothing you want taken out of<br>there, trust<br>me. Oh, we can Oh, we can almost get rid<br>of this line. I have a bugged effect,<br>but then we can get rid of the<br>line. Like that's a full emnest trainer.<br>Trust me, there's nothing else you<br>[Applause]<br>want. If that doesn't make sense, you<br>shouldn't be doing machine learning.<br>Okay. Well, that's today's<br>stream. I am going to go eat<br>food. Um<br>Uh well, I got five minutes. If anyone<br>has any tiny grad related<br>questions, hopefully this serves as an<br>actual uh<br>ramp. Hopefully people can follow this,<br>watch this video. It's relatively short.<br>We stayed on topic. We walked through<br>the tensor<br>level and then we dove down a bit into<br>the UOP level and saw how code is<br>actually generated. And if you read this<br>full rewrite to sync, all you're going<br>to find in here, uh, we'll have these<br>like rewrite steps, but this is just a<br>little bit of syntactic sugar around<br>uh, just graph<br>rewrites. So these are all the graph<br>rewrites in tiny which do the generation<br>and they're just graph rewrites just<br>like this one. So this is the strongest<br>part and if you understand how like this<br>stuff can transform u you ops you'll<br>understand the entire tiny and then you<br>can view these things with viz equals 1.<br>I'm happy that I explain the names to<br>people and the colors. So hopefully that<br>stuff's a bit more<br>understandable.<br>Um you know how to do how to do<br>gradients. It's all just it's all just<br>like the same transformations. Like you<br>can read this code, you'll see that it's<br>basically just so this is using the<br>pattern matcher directly. It's not a<br>graph rewrite, but you can figure out<br>why that is.<br>Um yeah, uh you know that this was a<br>real tutorial today because we made the<br>font large. You know that I was actually<br>trying to teach you things.<br>Um, I think<br>that<br>like the beauty of it is in its<br>simplicity.<br>Like it's not simple in the sense of you<br>can read each file and it's simple, but<br>it's simple in the sense that there are<br>not that this is practically<br>maintainable by a small group of very<br>smart<br>people. There's a lot of code out in the<br>world that when you think about when you<br>think about React and Kubernetes and<br>these these massive libraries, what<br>they're doing is they are forcing you to<br>think like Google or Facebook.<br>if you can't you can't break out of<br>slavery by using the master's tools. Um,<br>you know, it's a myth. People think that<br>the Amish are against technology, and<br>they aren't. Their problem with<br>technology is not something inherent to<br>technology. It's that if you buy a<br>tractor from John Deere, you now need<br>the John Deere serviceman to come into<br>your community, and he subverts the<br>ideology of your community. So, that's<br>the problem. Whereas something like a<br>wheelbarrow, well, a 12-year-old could<br>build a wheelbarrow and a wheelbarrow is<br>maintainable by the people in the<br>community. So, it's the same idea with<br>technology, and this is the point of the<br>tiny project. If we build something that<br>is realistically maintainable by one or<br>several smart people, I mean, you have<br>to be smart. There's no getting around<br>that. But no matter how smart you are,<br>you can't deal with the complexity of a<br>million line<br>codebase. You can use tactics to wrangle<br>complexity and you can work on part of<br>it and maybe you can make it work for<br>your use cases. But again, that's using<br>a John Deere tractor and not using a<br>wheelbarrow. We want to build a library<br>where you use it and you be like, you<br>look at it and you're like, well, I<br>could have written that. I can maintain<br>this. I can extend this. And it's the<br>whole thing. There's not, oh well, we<br>link in this whole magic thing. We link<br>in nothing. Tiny has no<br>dependencies. Um, except sort of for<br>LLVM, but even that one's going to be<br>removed in due<br>time. Uh, yeah. So, the the default<br>install of Tiny actually installs<br>nothing. These are just for testing and<br>docs and<br>stuff. Uh why is WMA not a rewrite rule?<br>That's actually a really good question.<br>Um because we're not upcasting warps on<br>GPUs and this is going to be fixed. So<br>basically right now the warp is being<br>treated as something that is outside of<br>the graph. So that's why it's these<br>hacks in kernel.py. Um I would put a big<br>bounty up if someone fixes that. If<br>someone if someone can can like<br>reasonably integrate warp upcasting,<br>it's almost doable. I mean, I had to do<br>a lot of this stuff for the DSP. What is<br>a warp? See, that is not a good<br>question. Um, that shows that you know<br>nothing about<br>GPUs. Is trying to port an existing<br>PyTorch pace model to tiny a good way to<br>learn? Yeah. Uh, should you expect<br>better performance someday? you should<br>expect better performance today. So if<br>you run with beam equals<br>2 depending on where you're running<br>there's many places where tiny is<br>faster. Um, if you're doing Nvidia,<br>maybe not. If you're doing these like<br>hyper optimized AMD things like stable<br>diffusion, maybe not. But it's not that<br>far off. But in general, just if you're<br>doing pure unoptimized stuff. So like we<br>have a HLBC implementation in here. And<br>if you run it with beam equals 2, it's<br>about 20% faster than normal torch on<br>AMD. Actually, that's training too. So<br>you can try it. And it's it's a little<br>bit finicky to get the performance<br>sometimes. Sometimes it's really easy.<br>Sometimes you just do beam equals two<br>and you wait and then it's<br>fast.<br>Um yeah, but no, I think that's that's a<br>really good way to to start playing with<br>it. Implement things. The the<br>point here is that Tiny really is your<br>library.<br>um you can fully own it and understand<br>all of it in a way that you could never<br>do with PyTorch or Jax because there's<br>so many<br>layers. There's so much complexity that<br>that it's designed for really for<br>massive companies only massive companies<br>are able to wrangle that much<br>complexity. You as an individual can use<br>the library but then you are a consumer.<br>The point of tiny is to get you out of<br>the idea that I'm a consumer. Oh, I<br>consume cuda. I consume cudn. No, you<br>don't. You don't consume any of that. We<br>don't use any of that<br>stuff. Tiny consumes nothing. Tiny is<br>yours and it's<br>[Music]<br>13,667 lines and that includes things<br>like a full AMD<br>driver. Uh there's a full AMD driver in<br>here. There's soon to be a full Nvidia<br>driver. So you can remove the AMD driver<br>from the kernel and you can just use<br>what we have in here. Um it like<br>downloads all the AMD registers from the<br>internet, parses them out<br>here, downloads the<br>registers. Here it's configuring the<br>PCIe bars. This is to use it over USB.<br>This is how the stuff works over USB.<br>So, it really is uh a library you<br>completely control. Does tiny grad make<br>money? Yeah, buy a tiny<br>box. Um, yeah, that is the thousand line<br>rule. Well, it's gotten a little bigger<br>than a thousand. Uh, but hopefully we've<br>kept the complexity well managed. I got<br>to go. I got lunch to go eat. Thank you<br>all for watching today's stream.<br>Hopefully, this was a very noob friendly<br>stream.<br>Um, yes. Yes, I'm<br>coming. We're We're almost<br>done.<br>Uh, yes. Um, I'll miss<br>uh all all of you too. If you missed<br>what food we got, you weren't here for<br>the beginning of the stream. You can<br>re-watch it on the VOD, but only if<br>you're a subscriber.<br>when new blog. Why don't you ask me when<br>the new jailbreak's coming out,<br>too? You have the heart. Thank you.<br>Thank you.<br>Um I might be on a podcast this week.<br>You might see me<br>uh torch<br>lin. Yeah. Uh well, it'd be great to<br>implement some of those things in<br>Tiny. Uh no, it's not Lex. It's it's uh<br>No. No. Um, okay everybody, uh, thank<br>you for watching, uh, today's stream. Go<br>out and,<br>um, use Tiny, but don't consume Tiny<br>Grat. That's kind of my whole<br>philosophy. That's my philosophy with K,<br>too. If you are a consumer now, you're<br>going to be a consumer the rest of your<br>life. Stop being a consumer.<br>That's the If you look in the Kaii<br>subreddit, you see me argue with people<br>and and what these people want is a<br>consumer mindset. These people just want<br>to be handed something so they can<br>consume it.<br>And I'm not going to actively go out of<br>my way to say, "No, you absolutely can't<br>use it like that." But I'm not here to<br>cater to that mentality either. People<br>are surprised by that. People are used<br>to other people catering to that<br>mentality. But I want you to realize<br>that if you're a consumer, what's going<br>to happen to you is that you're going to<br>end up<br>wireheaded. Whatever the biggest baddest<br>advertising manipulation agency<br>uh that decides to make you their<br>consumer, I mean, another word for that<br>is slave. And I don't know, but I don't<br>want to grow up to be a slave. I don't<br>want my kids to grow up to be slaves.<br>But if you want to be a consumer and you<br>want to consume, you can. You can. You<br>can consume right up until the day you<br>die. But<br>I am telling you to make a different<br>choice. But I'm not telling you to make<br>a different choice because you got to<br>find your own path. I'm not I'm not<br>There's no path to not be a consumer.<br>That's the whole point.<br>The world needs to change or we're all<br>going to die. You're going to die. I'm<br>gonna die. Everyone's gonna<br>die unless we make a change today. And<br>that's why I need you to sign this<br>petition in order to grow bananas right<br>here in America. Thank you for watching<br>today's stream. I'm going to consume<br>lunch.