karpathy

Stars and mentions

Last 30 days, Oct 4 – Nov 2

GitHub stars6,247
mentions56
0190380570760Oct 4Oct 18Nov 2
UTC days · repositories karpathy owns29 repositories

Package downloads

Cumulative recorded downloads · since 2025-10-22

crates.io—
npm—
PyPI289.1K
072.3K144.6K216.8K289.1KOct 4Oct 18Nov 2
Oct 28crates.io: 0/2 packages observed · npm: 0/1 packages observed · PyPI: 1/5 packages observed

Across 8 known packages in repositories karpathy owns. Cumulative totals include recorded downloads before the selected range. Missing observations leave gaps; totals may be incomplete. PyPI excludes known mirrors.

Top repositories

karpathy’s repositories ranked by new forks, as on trending.

Loading

Contributes to

Repositories outside karpathy’s account where karpathy opened or reviewed pull requests in the past 365 days.

Who noticed karpathy

Everyone who starred or forked karpathy’s repositories since the archive began in 2011.

Notable accounts

Ordered by the stars their own repositories have received.

Biggest fans

Accounts that starred the most of these repositories.

Breakout weeks

Each repository’s best week of new stars, with the release published around it.

Mentions

59posts
Nov 35 posts
  1. 一个模型回答问题,容易把偏见写得很自信。 Karpathy 的 LLM Council 换了个思路:让多个模型分别回答、互相评审,最后再综合结果。 它不会自动产生“真相”,但能让分歧和薄弱点更早暴露。适合复杂判断,不适合每个小问题都开一桌模型会议——成本和时间都更高。 karpathy/llm-council #GitHub #大模型 #AI工具

    5 likes · 203 views
  2. 想亲手训个 GPT-2 级模型,又不想烧几万刀? Karpathy 的 nanochat 是极简 LLM 训练框架:分词到推理全包,只调 --depth,GPT-2 级别约 2 小时、48 美元跑完。 适合想搞懂 LLM 训练、又没大算力预算的人。 你会先拿它训个什么小模型玩玩? #LLM #开源模型 @grok karpathy/nanochat

    5 likes · 1 repost · 212 views
  3. Build a BPE Tokenizer in 80 Lines of TypeScript and Watch JSON Eat Your Tokens - Book: AI That Answers - The series: AI in TypeScript — 5 books, from your first LLM call to agents in production — all five here - My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools - Me: xgabriel.com | GitHub --- The maintainers of the TOON format ran three flat datasets through OpenAI's o200k_base encoding and counted 164,643 tokens for the pretty-printed JSON and 104,908 for the same data minified. Nothing was dropped. The minified version holds every key and every value. It stops paying for indentation and line breaks, and that alone takes about 36% off the count. Tokens are the unit your LLM bill is written in. Anthropic's pricing table, for one, quotes input and output separately, per million tokens. Yet most developers who pay that bill have never watched a string turn into tokens. You can build the machine that does it in 80 lines of TypeScript and train it on your own JSON. What happens to your prompt before the model sees it OpenAI's tokenizers use byte-pair encoding. BPE began as a compression algorithm, and Sennrich, Haddow and Birch adapted it to split words into subword units for neural machine translation (ACL 2016). The tiktoken README says the encoding is reversible and lossless and works on any text, even text the tokenizer never saw in training. On average, a token covers about 4 bytes. Encoding runs in three steps. 1. A regex cuts the text into chunks, so letters, digits, punctuation and whitespace end up in separate runs. Karpathy's minbpe credits this to the GPT-2 paper and notes it "ensures that no merges will happen across category boundaries." 2. Each chunk becomes its UTF-8 bytes. The starting vocabulary is the 256 possible byte values, so nothing is ever out of vocabulary. 3. Learned merges glue adjacent byte pairs into bigger tokens, in the order they were learned. Training is where the merges come from. Count every adjacent pair across the corpus, take the pair with the highest count, give it the next free id (256, then 257, and so on), replace it everywhere, repeat. The minbpe README walks through aaabdaaabac: three merges (aa, then ab, then the pair of those two new tokens) turn 11 bytes into five tokens, [258, 100, 258, 97, 99]. !Rows of small square byte tiles fusing pairwise into larger tiles, layer by layer Byte-pair encoding: start from single bytes, then fuse the most frequent neighbours, one merge at a time. The tokenizer in 80 lines This is the whole trainer and encoder. It uses GPT-2's pre-split pattern, minus the contraction rules ('s, 'll, and friends), copied from minbpe's regex.py. // bpe.ts: a toy byte-level BPE trainer and encoder type Pair = [number, number]; // GPT-2's pre-split pattern, minus its contraction rules const SPLIT = / ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu; const utf8 = new TextEncoder(); const text8 = new TextDecoder(); const key = (a: number, b: number) => `${a},${b}`; const show = (b: Uint8Array) => JSON.stringify(text8.decode(b)); const chunksOf = (text: string) => (text.match(SPLIT) ?? []).map((c) => Array.from(utf8.encode(c))); function countPairs(ids: number[], counts: Map<string, number>) { for (let i = 0; i < ids.length - 1; i++) { const k = key(ids[i], ids[i + 1]); counts.set(k, (counts.get(k) ?? 0) + 1); } } function merge(ids: number[], [a, b]: Pair, id: number) { const out: number[] = []; for (let i = 0; i < ids.length; i++) { if (ids[i] === a && ids[i + 1] === b) { out.push(id); i++; // the pair's second half is consumed too } else out.push(ids[i]); } return out; } export function train(text: string, numMerges: number) { let chunks = chunksOf(text); const merges = new Map<string, number>(); const vocab = new Map<number, Uint8Array>(); for (let b = 0; b < 256; b++) vocab.set(b, Uint8Array.of(b)); for (let m = 0; m < numMerges; m++) { const counts = new Map<string, number>(); for (const ids of chunks) countPairs(ids, counts); let best = ""; let bestCount = 1; // a pair seen once earns no token for (const [k, c] of counts) { if (c > bestCount) { best = k; bestCount = c; } } if (!best) break; const [a, b] = best.split(",").map(Number) as Pair; const id = 256 + m; chunks = chunks.map((ids) => merge(ids, [a, b], id)); merges.set(best, id); const l = vocab.get(a)!, r = vocab.get(b)!; const bytes = new Uint8Array([...l, ...r]); vocab.set(id, bytes); console.log(`#${m}`, show(l), "+", show(r), "->", show(bytes), `${bestCount}x`); } return { merges, vocab }; } export function encode(text: string, merges: Map<string, number>) { const out: number[] = []; for (let ids of chunksOf(text)) { while (ids.length > 1) { // earliest-learned merge first, the order training used let pair: Pair | null = null; let rank = Infinity; for (let i = 0; i < ids.length - 1; i++) { const r = merges.get(key(ids[i], ids[i + 1])); if (r !== undefined && r < rank) { rank = r; pair = [ids[i], ids[i + 1]]; } } if (!pair) break; ids = merge(ids, pair, rank); } out.push(...ids); } return out; } Pairs are keyed as "a,b" strings because a Map compares array keys by reference, so [1, 2] would never find [1, 2]. Ties go to the pair seen first, since Map iterates in insertion order and the comparison is strict. Training works chunk by chunk, so a merge can never span a letter and a digit, or a word and the punctuation after it, which matches the real thing. And encode always applies the lowest-ranked merge available, the same rule minbpe's _encode_chunk uses: replay the merges in the order training learned them. The show helper decodes a token's bytes for printing. When a token holds only part of a multi-byte character, TextDecoder prints �, because the token boundary falls inside the character. The Japanese sample further down does the same. Train it on JSON and read the merges Feed it the kind of text your app actually sends: an array of records, pretty-printed. // demo.ts import { train, encode } from "./bpe"; const records = Array.from({ length: 40 }, (_, i) => ({ customer_id: 1000 + i, status: i % 4 ? "active" : "suspended", country: ["DE", "BR", "JP", "US"][i % 4], })); const pretty = JSON.stringify(records, null, 2); const { merges } = train(pretty, 40); const one = records[0]; const asPretty = encode(JSON.stringify(one, null, 2), merges); const asMin = encode(JSON.stringify(one), merges); console.log({ pretty: asPretty.length, minified: asMin.length }); Run it with tsx: npx tsx demo.ts. Each log line is one merge, with the two parts, the new token, and how often the pair appeared. Read all 40 and sort them in your head: how many are fragments of the keys customer_id, status and country, how many are values and digits, and how many are quotes, colons and runs of spaces? On a corpus made of nothing but JSON, every merge has to come from one of those. The keys repeat in every single record, and that repetition is what earns them merges. A production tokenizer learns its merges from a huge general corpus instead, so common English words have a good chance of getting a token of their own (the next script shows you whether customer did). Your acctBalanceAdjFlagV2 pays for every piece. Then try the experiments the script makes cheap. Train on JSON.stringify(records) instead of the pretty version and compare the merge log. Rename customer_id to cid and see how many merges it frees up. Compare the two counts in the last line, and remember that this toy only knows 40 merges, so the ratio between them tells you more than either number. Ask a real encoder: o200k_base Your toy has 40 merges. o200k_base has a vocabulary of about 200,000 tokens, roughly double GPT-4's ~100,000, according to Simon Willison's notes from the GPT-4o launch. tiktoken's model table maps gpt-4o, gpt-4.1, o3, o4-mini and gpt-5 to it. js-tiktoken loads it in Node; the lite import pulls in only the one rank file you need. // compare.ts import { Tiktoken } from "js-tiktoken/lite"; import o200k_base from "js-tiktoken/ranks/o200k_base"; const enc = new Tiktoken(o200k_base); const pieces = (s: string) => enc.encode(s).map((id) => enc.decode([id])); const samples = [ '{\n "customer_id": 1000\n}', '{"customer_id":1000}', "customerShippingAddressLine2", "1730505600000", "Your order has been cancelled.", "ご注文はキャンセルされました。", ]; for (const s of samples) { const p = pieces(s); console.log(p.length, JSON.stringify(p)); } You can predict part of what it prints by reading the o200k pre-split regex in tiktoken's openai_public.py. Every chunk the regex produces costs at least one token, so the regex sets a floor. - camelCase splits at every capital. The letter rule matches a run of uppercase letters (possibly none) followed by lowercase, so customerShippingAddressLine2 cuts into customer, Shipping, Address, Line and 2 before BPE starts. Five chunks, at least five tokens. - Digits go in groups of three. The number rule is \p{N}{1,3}. A 13-digit millisecond timestamp is five chunks, so at least five tokens, every time it appears in a log line you paste. - Whitespace is its own chunk. Indentation runs, minus their last space, are cut out separately from the keys they sit in front of. One small quirk: the space after "customer_id": in the pretty version cannot attach to a following number, because the digit rule (\p{N}{1,3}) takes no leading character and the punctuation rule's optional space needs a symbol after it. It becomes a chunk on its own. Before a string value it rides along with the opening quote instead. - Non-English text gets fewer merges. Byte-level BPE can encode anything, but the merges go to whatever was common in training data. Petrov et al. (NeurIPS 2023) found the same text translated into different languages could differ in token length by up to 15 times on the tokenizers they studied. OpenAI's larger vocabulary cut non-English counts: its launch figures, as quoted in Willison's notes, put Gujarati at 4.4x fewer tokens and Japanese at 1.4x fewer than the previous tokenizer. When a token boundary still lands inside a Japanese character, pieces prints � for those fragments. !A long accordion of curly braces and indentation blocks next to a compact stack of the same blocks Same data, same keys and values; only the whitespace and repetition change, and that is where the tokens go. One payload, three shapes Now measure the thing you actually send. This script builds one payload and counts it as pretty JSON, minified JSON and TOON, a tabular encoding of the JSON data model that declares the keys of a uniform array once (@toon-format/toon on npm). // shapes.ts import { Tiktoken } from "js-tiktoken/lite"; import o200k_base from "js-tiktoken/ranks/o200k_base"; import { encode as toToon } from "@toon-format/toon"; const enc = new Tiktoken(o200k_base); const orders = Array.from({ length: 50 }, (_, i) => ({ orderId: 5000 + i, customerId: 70 + (i % 9), status: i % 3 ? "shipped" : "pending", totalCents: 1999 + i * 37, })); const payload = { orders }; const shapes: Record<string, string> = { pretty: JSON.stringify(payload, null, 2), minified: JSON.stringify(payload), toon: toToon(payload), }; for (const [name, text] of Object.entries(shapes)) { console.log(name.padEnd(9), enc.encode(text).length); } Swap payload for a real request body from your logs and you have your own numbers. I can't give you numbers for your data, so here are published ones for theirs. TOON's benchmark, counted with o200k_base: | Track | Pretty JSON | Minified JSON | TOON | |---|---|---|---| | Flat data, 3 datasets | 164,643 | 104,908 | 68,030 | | Mixed structure, 5 datasets | 393,637 | 260,451 | 264,734 | On flat, uniform records TOON came in 58.7% under pretty JSON and 35.2% under minified. On mixed and nested data the picture flips: minified JSON beat TOON by 1.6% overall, and the README says plainly that "for deeply nested or non-uniform data, JSON may be more efficient." It also notes that absolute counts are tokenizer-specific, since other providers tokenize differently, and that you have to measure latency yourself. Fewer tokens is also not the same as better answers, so run your evals on the new shape before you ship it. One win held on both tracks: minifying the JSON cut about a third of the tokens, so do that to anything a program produced before it goes into a prompt. Dropping keys the model does not need helps whatever the shape. Save the tabular format for long arrays of identical objects, where TOON won, and keep JSON for nested data, where it lost. Then put shapes.ts next to your prompt builder and check the count every time someone adds a field. --- If this was useful Token cost is the first bill an LLM app runs up, and it is one of the threads in AI That Answers, the first book of my AI in TypeScript series. It covers your first LLM app in TypeScript end to end: prompts, structured output, and keeping an eye on what each call costs before the invoice does it for you. ![AI That Answers — AI in TypeScript](amazon.com) The other four books go from retrieval and tool calling to agents in production: the whole AI in TypeScript series is here.

    3 reactions · 4 comments
  4. How long does it take to train an AI model on cloud GPUs? Training an AI model takes anywhere from a few minutes to several months, depending on model size, how many tokens it trains on and how many GPUs run in parallel. On Nodus a small fine-tune can finish in under five minutes, while by our math a 7B language model trained from scratch on 140 billion tokens takes about 3.6 days on 64 NVIDIA H100s. The sections below show the formula, check it against published runs, and list what makes the real clock run longer than the math. How do you estimate how long a training run will take? Work out the total math the run needs, then divide by how fast your GPUs actually do math. Training a transformer takes about 6 floating-point operations per parameter per token, the rule from Kaplan et al.'s scaling-laws paper. An NVIDIA H100 SXM peaks at about 989 teraFLOPS of dense BF16 math, half the sparse figure on NVIDIA's H100 page. No real run gets the full peak. The share you get is called model FLOPs utilization, and 30% is a fair planning number for code you have not tuned. That gives: GPU-hours = (6 × parameters × tokens) / (989e12 × utilization × 3,600) wall-clock = GPU-hours / number of GPUs (if scaling were perfect) At 30% utilization, one H100-hour delivers about 1.07 × 10^18 useful operations. The second line is the optimistic part, and we come back to it below. How long does it take to train a language model from scratch? Days to weeks for small and mid-size models, if you have enough GPUs. Here is the formula at 30% utilization, using a compute-optimal budget of about 20 tokens per parameter from DeepMind's Chinchilla paper, plus one longer 7B run. | Model and tokens | H100 GPU-hours | Fewer GPUs | More GPUs | | --- | ---: | ---: | ---: | | 1B on 20B tokens | 112 | 1 GPU: 4.7 days | 8 GPUs: 14 hours | | 7B on 140B tokens | 5,505 | 8 GPUs: 28.7 days | 64 GPUs: 3.6 days | | 7B on 2T tokens | 78,643 | 64 GPUs: 51.2 days | 512 GPUs: 6.4 days | | 70B on 1.4T tokens | 550,500 | 512 GPUs: 44.8 days | 2,048 GPUs: 11.2 days | Our arithmetic: 6 × parameters × tokens, 989 teraFLOPS dense BF16, 30% utilization, perfect scaling. Real runs land later; see the overheads section. Token count moves the clock as much as model size. The same 7B model takes 14 times longer on 2 trillion tokens than on 140 billion. Many open models now train far past the Chinchilla ratio, so settle the token budget first. Our post on what it costs to train an LLM prices the same GPU-hours in dollars. How long do real published training runs take? Small reproductions take hours, and frontier models take months. Andrej Karpathy's llm.c reproduction of GPT-2 124M trained on 10 billion tokens in about 90 minutes on one 8 × NVIDIA A100 80GB node. His GPT-2 1.6B run took about 24 hours on one 8 × H100 node: 32,000 steps of roughly 1 million tokens each, at about 2.75 seconds per step. That 1.6B run is a good check on the formula. It works out to 192 GPU-hours for about 33.6 billion tokens, which back-solves to roughly 46% utilization. Karpathy's own logs show 42% to 47% at the start, so well-tuned code beats our 30% planning figure by about half. At the top end, Meta's Llama 3.1 model card lists 30.84 million H100 GPU-hours for the 405B model. The Llama 3 paper says it trained on up to 16,384 H100s. Divide one by the other and even that cluster needs about 78 days of pure compute, a floor on the real calendar time. Do more GPUs make training proportionally faster? Only roughly, and never for free. Adding GPUs splits the same GPU-hours across more machines, so the bill stays about the same while the calendar shrinks. In practice the bill creeps up, because GPUs spend more time talking to each other. Meta's own numbers show the effect. The Llama 3 paper reports 43% utilization on 8,192 GPUs and 41% on 16,384 GPUs for the same model, a small but real loss from doubling the cluster. !Days to train a 7B model on 2 trillion tokens: 409.6 days on 8 H100s, 51.2 days on 64, 6.4 days on 512, at 30% utilization and perfect scaling. The same 78,643 GPU-hours: one 8-GPU node needs 409.6 days, a 512-GPU cluster about a week. Our decision rule: pick the smallest GPU count that finishes before your deadline, not the largest you can get. Single nodes of 8 GPUs scale best because the GPUs share fast NVLink links. Multi-node runs add network cost and more machines that can fail. How long does fine-tuning take? Usually minutes to a few hours, because fine-tuning sees far fewer tokens than pretraining. Fine-tuning a 7B model on 50 million tokens is about 2 H100-hours of math at 30% utilization by the same formula, and LoRA does less than that because it skips most weight gradients. For small jobs, the work around training often takes longer than training itself. In our published fine-tuning benchmark, Qwen2.5-0.5B on one NVIDIA L4 spent 112.8 seconds in the training loop on Nodus. From submission to a verified exported model took 4.8 minutes, or 288 seconds. !Small fine-tune on Nodus: 112.8 seconds in the training loop versus 288 seconds from submission to exported model. For a small fine-tune, startup, evaluation and export took longer than the training loop. So for fine-tuning, the honest answer to "how long" is mostly startup, model download, evaluation and export. On Nodus, a TrainingJob imports a pinned Hugging Face model revision into a read-only Volume once, and later runs reuse it, so billed GPU time is not spent downloading weights. Why does the real clock run longer than the math? Because the formula counts only useful training steps. Four things add time on most projects: - Waiting for capacity. A large multi-GPU request may queue until enough machines are free together. - Startup. Pulling the image, loading the model and reading the first batch of data. - Failures and restarts. Over a 54-day stretch of Llama 3 405B pretraining, Meta logged 466 job interruptions, 419 of them unexpected. It still reported more than 90% effective training time, meaning at least a tenth of the elapsed time did no useful training. - Evaluation and export. Validation passes and writing out the final weights. Our planning rule is to add at least 10% to the formula for multi-day runs. Go higher if your checkpoints are far apart, since every restart redoes the work since the last save. How does Nodus show the time before you launch? A dry run returns the estimate before anything is charged. For a managed TrainingJob, the training guide says the estimate is the number of steps times the measured seconds per step on the slowest GPU type you allowed, plus evaluation time. You can set spec.expectedDuration to use your own figure. $ nodus apply -f sft.yaml --dry-run -o yaml # status.estimate: cost to completion, first hold, start time For your own script, nodus run takes the same idea from flags. This prints the estimate only, using your expected duration: $ nodus run --dry-run --gpu H100:8 --expected-duration 24h -- torchrun train.py If the run must finish by a date, --complete-by (or placement.completeByTime) keeps it off any capacity whose p90 finish is later, per our placement docs. H100s are listed at $2.60/hr on the Nodus pricing page, checked October 31, 2026. If a machine is lost mid-run, Nodus starts a new attempt from the latest committed checkpoint, as described in attempts and recovery. Our post on how often spot GPUs are interrupted shows how much that matters on cheaper capacity. FAQ How long does it take to train a model like GPT-4? Nobody outside the lab knows, because the GPU-hours were never published. The closest public figure is Llama 3.1 405B at 30.84 million H100 GPU-hours, which is months even on a cluster of more than 16,000 GPUs. Can I train a useful model on a single GPU? Yes, if it is small or a fine-tune. Karpathy notes his GPT-2 124M run would take roughly 4 to 24 hours on a single GPU, depending on the card. Is a faster GPU always worth it for training time? Not always. A GPU that costs twice as much per hour but runs the job 2.5 times faster is cheaper overall, and one that runs it 1.5 times faster is not. Compare per-step time on your own model. Nodus managed training runtimes publish measured step times for their presets, which is what their estimates use. Does training time include data preparation? No, none of the figures here do. Tokenizing and cleaning a large dataset is usually CPU work that you can finish before you pay for any GPU time. Originally published on the Nodus blog.

  5. How much does it cost to train an LLM from scratch? Training an LLM from scratch costs from a few hundred dollars for a small model to tens of millions for a frontier model, and almost all of it is GPU-hours times the hourly rate. At the $2.60/hr Nodus lists for an NVIDIA H100 on its pricing page, a compute-optimal 1B model costs about $292 and a 7B model about $14,300 in compute. The rest of this post shows the formula, checks it against what Meta and DeepSeek actually published, and lists the costs the headline numbers leave out. How do you estimate what an LLM training run will cost? You need three numbers: model size, training tokens and how much of the GPU's peak speed you will really get. Training a transformer takes about 6 floating-point operations per parameter per token, the rule from Kaplan et al.'s scaling-laws paper. So a run needs roughly 6 × parameters × tokens operations in total. An NVIDIA H100 SXM peaks at about 989 teraFLOPS of dense BF16 math. NVIDIA's H100 page lists 1,979 teraFLOPS, but that figure assumes sparsity, so halve it for normal training. No real run gets the full peak. The share you do get is called utilization, and it is the number that moves your budget most. Put together, the estimate is: GPU-hours = (6 × parameters × tokens) / (989e12 × utilization × 3,600) cost = GPU-hours × hourly rate At 30% utilization, one H100-hour delivers about 1.07 × 10^18 useful operations. Every cost in this post comes from that line and a rate. How many tokens should a model train on? A common starting point is about 20 tokens per parameter. DeepMind's Chinchilla paper found that model size and training tokens should grow together for the best model at a fixed compute budget, which works out to roughly that ratio: Chinchilla itself paired 70 billion parameters with 1.4 trillion tokens. A 1B model gets 20 billion tokens and a 7B model gets 140 billion. Most open models now train far past that point. Meta trained every Llama 3.1 model on about 15 trillion tokens, which is over 1,800 tokens per parameter for the 8B model. Extra tokens cost more to train but give a better small model that is cheaper to serve. That choice can multiply your bill by ten or more, so decide it before you price anything. What did real LLM training runs actually cost? Published GPU-hour counts are the best reality check, and they run from about 1.5 million to over 30 million for recent open models. Meta's Llama 3.1 model card lists the H100-80GB hours for each size. DeepSeek's V3 technical report lists 2.788 million H800 GPU-hours for its full training, which it prices at $5.576 million assuming $2 per GPU-hour. | Model | Published GPU-hours | At $2.60/GPU-hour | | --- | ---: | ---: | | Llama 3.1 8B | 1.46M H100 | $3.80M | | Llama 3.1 70B | 7M H100 | $18.2M | | Llama 3.1 405B | 30.84M H100 | $80.2M | | DeepSeek-V3 (37B active) | 2.788M H800 | $7.25M | GPU-hours from the Llama 3.1 model card and the DeepSeek-V3 report; Nodus H100 list rate checked October 30, 2026. The last column is for scale only: runs this size need thousands of GPUs held for weeks, which is a reserved-capacity contract, not an hourly bill. !Published GPU-hours: Llama 3.1 8B 1.46 million, DeepSeek-V3 2.788 million, Llama 3.1 70B 7.0 million, Llama 3.1 405B 30.84 million. DeepSeek-V3 used fewer GPU-hours than Llama 3.1 70B because only 37B of its parameters are active per token. DeepSeek-V3 is a mixture-of-experts model, so each token only touches 37 billion of its parameters. That is why its compute bill sits between the 8B and 70B dense Llama models even though it is much larger in total. What utilization should you plan for? Plan for 30% unless you have measured better on your own code. We back-solved the effective utilization of each published run from its parameters, tokens and GPU-hours, using the formula above. The results were about 14% for Llama 3.1 8B, 25% for Llama 3.1 70B and 33% for Llama 3.1 405B. The best small-scale result we found is higher. Andrej Karpathy's llm.c reproduction of the 1.6B GPT-2 trained on 33.6 billion tokens in 24 hours on one 8 × H100 node. That is 192 GPU-hours, which back-solves to about 46% utilization, close to the roughly 50% he reports. !Effective utilization back-solved from published runs: Llama 3.1 8B 14%, Llama 3.1 70B 25%, Llama 3.1 405B 33%, llm.c GPT-2 1.6B 46%. The same formula on four real runs: plan for 30% and treat 45% as a well-tuned best case. The gap between running speed and the full bill is the useful part. The Llama 3 paper reports 38% to 43% utilization while the 405B model was training, yet the whole GPU-hour count back-solves to 33%. Over a 54-day stretch of that run, Meta logged 466 job interruptions, 419 of them unexpected. Restarts, redone work and idle time all land on the bill, and that is why we plan at 30%, not at peak. How much does it cost to train a small LLM from scratch? A small model is cheap enough to train for learning or for a narrow domain. Here is the formula at 30% utilization and the Nodus H100 list rate of $2.60/hr. | Model and tokens | Total operations | H100 GPU-hours | Compute cost | | --- | ---: | ---: | ---: | | 1B on 20B tokens | 1.2 × 10^20 | 112 | $292 | | 7B on 140B tokens | 5.9 × 10^21 | 5,505 | $14,313 | | 7B on 2T tokens | 8.4 × 10^22 | 78,643 | $204,471 | | 70B on 1.4T tokens | 5.9 × 10^23 | 550,500 | $1.43M | Our arithmetic from 6 × parameters × tokens, 989 teraFLOPS dense BF16, 30% utilization and $2.60 per H100-hour (checked October 30, 2026). To check the method against a real bill, take the llm.c GPT-2 run. Karpathy priced its 192 H100-hours at $672, which is $3.50 per GPU-hour. At $2.60, the same 192 GPU-hours cost $499.20. If your code reaches 45% instead of 30%, every row above falls by a third. What costs do these numbers leave out? The formula prices one clean run, and real projects are never one clean run. DeepSeek says plainly that its $5.576 million covers only the official training run and excludes prior research and ablation experiments on architecture, algorithms and data. Expect to spend real money on small test runs before the big one. Four other costs show up on most projects: - Lost work after an interruption. If an 8-node, 64-GPU run loses 6 hours of progress, that is 384 GPU-hours, or $998.40 at $2.60. With a checkpoint no more than 30 minutes old, the same failure costs 32 GPU-hours, or $83.20. - Idle GPUs. A node that sits waiting for data, a fix or a person bills the same as one that trains. - Data preparation and evaluation. Cleaning and tokenizing a large corpus and running benchmarks takes its own compute. - Storage for checkpoints and datasets, which grows with model size. The first two are the ones you control with tooling. That is where most of the gap between the formula and the final invoice comes from. Should you train from scratch at all? Usually not. Train from scratch only when you need your own architecture or tokenizer, a model with no inherited weights, or research results about pretraining itself. For most teams, continuing to pretrain an open model on your own text, or fine-tuning it, gets a better model for a small fraction of the cost. Our own continued-pretraining benchmark shows the scale difference. Continuing to train Qwen2.5-0.5B on raw text on one NVIDIA L4 cut held-out perplexity by 21.8% for a recorded charge of $0.121164. That was a small pilot on a tiny model. Still, it shows the order of magnitude: well under a dollar to adapt a small model, against hundreds to train even a 1B model from nothing. If you are fine-tuning instead, the cheapest way to fine-tune Llama on an H100 walks through that cost. How do you run a from-scratch pretraining job on Nodus? Nodus runs pretraining as a TrainingJob with task: Pretrain and initialization: Scratch, which keeps only the model's architecture and tokenizer. This manifest follows the training guide, with a spending cap and two 8-GPU nodes added: apiVersion: nodus.dev/v1beta1 kind: TrainingJob metadata: name: scratch-pretrain spec: runtime: nodus/sft task: Pretrain model: {uri: hf://Qwen/Qwen3-0.6B@c1899de289a04d12100db370d81485cdf75e47ca} data: {volume: corpus, format: JSONL} parameters: {steps: 10000, initialization: Scratch, packing: true} resources: {gpu: {type: [h100-sxm-80g], count: 8}, nodes: 2} maxCostUSD: "500.00" Price it before anything runs: $ nodus apply -f scratch-pretrain.yaml --dry-run -o yaml $ nodus apply -f scratch-pretrain.yaml The dry run's estimate is the number of steps times the measured seconds per step on the slowest GPU type you allowed. maxCostUSD caps the whole run, including retries; when it is reached the run is suspended, not failed, and raising the cap resumes it from its checkpoint. If a node is lost, the gang restarts from the latest checkpoint every rank committed, up to three times. Multi-node TrainingJobs are in Beta and go up to 8 nodes, as the multi-node guide explains. FAQ How much did it cost to train GPT-4? OpenAI has not published GPT-4's training compute or cost, so any figure you see is an outside estimate. The best public anchors are open models that publish GPU-hours, such as Llama 3.1 405B at 30.84 million H100-hours. Can you train an LLM on one GPU? Yes, for small models. Karpathy notes the 1.6B GPT-2 run would take about 8 days on one GPU instead of 1 day on eight, for the same GPU-hours. Nodus lists prices per GPU-hour, so the GPU-hours, not the GPU count, set the compute cost. Is a B200 cheaper than an H100 for pretraining? Only if it finishes the job more than proportionally faster. Nodus lists the NVIDIA B200 at $5.50/hr against $2.60/hr for the H100, so the B200 needs over 2.1 times the H100's throughput on your model to cost less per run. Measure seconds per step on both before you commit. Does a mixture-of-experts model cost less to train? Per token, yes, because compute scales with active parameters, not total ones. DeepSeek-V3 has 37B active parameters and needed 2.788 million GPU-hours, fewer than the dense Llama 3.1 70B at 7.0 million. You still need enough GPU memory to hold all the experts. Originally published on the Nodus blog.

  6. LLM Council (free, open source): karpathy/llm-council Anthropic's study: anthropic.com

    3 likes · 31 views
  7. YouTube · · YouTube description · TERABIOTECH · karpathy/nanoGPT

    Cambia 3 letras y tu IA lee un repo de GitHub completo (gratis) Cambia tres letras en un enlace de GitHub (hub por ingest) y tu IA recibe el repositorio completo en un solo texto. Gitingest es una herramienta de código abierto (licencia MIT) de Coderamp que convierte cualquier repositorio de Git en un texto listo para pegar en ChatGPT, Claude u otra IA: resumen con tokens estimados, árbol de carpetas y contenido de cada archivo. En el video la probamos con karpathy/nanoGPT en gitingest.com y con su CLI en un contenedor. 📦 Búscalo en GitHub: coderamp-labs/gitingest ⚙️ Comandos: Instalar: pipx install gitingest Repo → digest.txt: gitingest karpathy/nanoGPT Solo archivos de Python: gitingest karpathy/nanoGPT -i '*.py' -o py.txt Ver opciones: gitingest --help Actualizar: pipx upgrade gitingest Desinstalar: pipx uninstall gitingest ⚠️ En gitingest.com el repo se procesa en sus servidores; con el CLI se procesa en tu computadora. Para repos privados necesitas un token de GitHub (--token o GITHUB_TOKEN). Los tokens son estimados. 💬 ¿Dudas? Pregúntame en los comentarios. 🔔 Suscríbete: un repo útil cada día. Datos al 25 oct 2026 · No afiliado al proyecto. #ia #github #opensource #programacion #herramientasgratis

    43 views
  8. หลักสูตร AI ฟรีจาก Karpathy 7 รีโป 3 แสนดาว เรียนยังไงให้ได้ผลจริง? โดย Nokka (นก-กา) | ตรวจข้อมูล 27 ต.ค. 2026 บทความนี้เขียนโดย AI (deepseek-v4.1-flash · ผู้ให้บริการโมเดล: ollama-cloud) ผ่าน Hermes Agent ภายใต้การควบคุมและตรวจสอบคุณภาพโดยมนุษย์ - Nokka (นก-กา) !ภาพเปิด: ชั้นหนังสือเจ็ดชั้นเรียงจากฐานแคบไปยอดกว้าง แต่ละชั้นมีแสงสีต่างกัน เรืองในห้องมืด โพสต์หนึ่งบน X เมื่อ 26 ตุลาคม 2026 ตามเวลาสากล หรือเช้ามืด 27 ตุลาคมตามเวลาไทย อ้างว่า Andrej Karpathy วางหลักสูตร AI ทั้งชุดไว้บน GitHub ฟรี โดยมีเจ็ดรีโปและดาวรวมกัน 306,741 ดวง [1] ผมรวมดาวจาก GitHub API ทั้งเจ็ดรีโปได้ 306,851 ดวง ณ วันที่เปิดดู ต่างจากที่โพสต์ระบุราวหนึ่งร้อยดวง เพราะดาวเพิ่มขึ้นระหว่างวัน [2] แต่คำว่า "หลักสูตร" กับคำว่า "ดีกรี" เป็นคนละเรื่องกัน และนี่คือจุดที่คนอ่านโพสต์แบบนี้มักเข้าใจผิด ก่อนจะเชื่อคำว่า AI degree ดาวไม่ได้แปลว่าเรียนจบ ดาวบน GitHub บอกว่าคนสนใจรีโปนั้นมากแค่ไหน ไม่ได้บอกว่าคุณจะเข้าใจมันได้ รีโปที่ดาวเยอะที่สุดในชุดนี้คือ autoresearch ที่มีดาว 98,637 ดวง [2] แต่ถ้าคุณยังไม่เข้าใจการเทรนโมเดล มันจะอ่านไม่รู้เรื่องเลย ไม่มีใบรับรองและไม่มีคนตรวจงาน หลักสูตรนี้ไม่มีวุฒิบัตร ไม่มีอาจารย์ตรวจการบ้าน และไม่มีกำหนดส่ง คุณจะได้ความสามารถที่พิสูจน์ได้จากโค้ดที่เขียนเอง ซึ่งในตลาดงานจริงมีค่ามากกว่าซีวีที่ระบุว่าจบคอร์สออนไลน์ แต่เนื้อหาฟรีและลึกจริง ข้อดีคือทั้งหมดเป็นโค้ดที่รันได้ ไม่ใช่สไลด์บรรยาย คุณสามารถแก้บรรทัดหนึ่งแล้วเห็นผลลัพธ์เปลี่ยน ซึ่งเป็นวิธีเรียนที่ได้ผลกว่าการอ่านทฤษฎีอย่างเดียว เจ็ดรีโปเรียงตามลำดับที่ควรเรียน 1. micrograd: ฐานของทุกอย่าง micrograd คือเอนจิน autograd ขนาดเล็กที่สอนว่าโครงข่ายประสาทเรียนได้อย่างไร [3] ไฟล์ engine.py ของมันยาว 94 บรรทัด [3] ซึ่งน้อยจนคุณอ่านจบได้ในคืนเดียว ตัวอย่างการใช้งานสั้น ๆ มีหน้าตาแบบนี้ from micrograd.engine import Value a = Value(2.0) b = Value(-3.0) c = a * b + Value(1.0) c.backward() print(a.grad) โค้ดสิบกว่าบรรทัดนี้คือหัวใจของการเทรนโมเดลทุกตัวที่คุณจะเจอต่อไป คุณจะเห็นว่า backpropagation คือการไล่ gradient ย้อนกลับ ไม่ใช่กล่องดำ 2. nn-zero-to-hero: คอร์สวิดีโอที่ต่อยอดจาก micrograd รีโปนี้รวมวิดีโอบรรยายและ notebook ที่ไล่จากนิวรอนตัวเดียวไปจนถึง GPT [4] ผู้เขียนระบุว่าผู้เรียนควรมีพื้นฐาน Python และแค่ความจำราง ๆ เรื่องแคลคูลัสจากมัธยมปลาย [4] ขั้นนี้มักใช้เวลานานที่สุด เพราะเป็นการเปลี่ยนจากเล่นโค้ดเล็ก ๆ ไปสู่การเทรนจริง 3. minbpe: ข้อความกลายเป็นโทเคนได้อย่างไร โมเดลภาษาไม่ได้อ่านตัวอักษร แต่มันอ่านโทเคนซึ่งสร้างจากอัลกอริทึม BPE [5] minbpe คือโค้ด BPE แบบ minimal ที่ทำให้เห็นว่าคำถูกแตกเป็นชิ้นอย่างไร และทำไมภาษาไทยถึงกินโทเคนมากกว่าอังกฤษ ถ้าคุณทำงานด้านภาษาไทย ขั้นนี้สำคัญมาก เพราะมันอธิบายค่าใช้จ่ายของ API ที่คุณจ่ายทุกวัน 4. nanoGPT: เทรน GPT ตัวแรกของคุณ nanoGPT คือรีโปที่เรียบง่ายที่สุดสำหรับการเทรนหรือ fine-tune โมเดลขนาดกลาง [6] คุณจะได้เห็นตั้งแต่การโหลดข้อมูล การตั้งค่า learning rate ไปจนถึงการสร้างข้อความ นี่คือจุดที่คนเริ่มรู้สึกว่าโมเดลไม่ใช่เวทมนตร์ แต่มันคือการคำนวณที่เปลืองไฟ 5. llm.c: มองทะลุลงไปถึง C และ CUDA llm.c ทำการเทรนแบบเดียวกันด้วย C และ CUDA ล้วน ไม่มี PyTorch อยู่ข้างใต้ [7] จุดประสงค์ไม่ใช่ให้คุณเขียน CUDA เก่ง แต่ให้เห็นว่าชั้นที่ PyTorch ซ่อนไว้ทำอะไร คนที่ผ่านขั้นนี้จะอ่านเปเปอร์เรื่องประสิทธิภาพได้เข้าใจขึ้นมาก 6. nanochat: โมเดลแชตจบในตัว nanochat คือการเทรนโมเดลระดับ GPT-2 ตั้งแต่ต้นจนคุยได้ [8] รีโประบุว่า GPT-2 ใช้เงินราว 43,000 ดอลลาร์ในการเทรนเมื่อปี 2019 แต่ตอนนี้เทรนระดับเดียวกันใช้ประมาณ 48 ดอลลาร์ หรือประมาณสองชั่วโมงบนโหนด 8 การ์ด H100 [8] ถ้าใช้ spot instance ค่าใช้จ่ายอาจเหลือใกล้ 15 ดอลลาร์ [8] ตัวเลขนี้แสดงให้เห็นชัดว่าความรู้ด้าน AI ถูกลงแค่ไหนในรอบเจ็ดปี 7. autoresearch: ให้ agent ทำวิจัยแทน autoresearch คือรีโปที่ให้ agent แก้โค้ดเทรนเอง เทรนห้านาที ดูว่าผลดีขึ้นไหม เก็บหรือทิ้ง แล้ววนซ้ำทั้งคืน [9] รีโปนี้อธิบายตัวเองว่าเป็นจุดเริ่มต้นของการวิจัยที่ agents ทำกันเองบน GPU ตัวเดียว [9] รีโปนี้เป็นปลายทางที่ดีของหลักสูตรนี้ เพราะคุณจะเห็นว่าความรู้ทุกชั้นรวมกันเป็นระบบอัตโนมัติได้อย่างไร ลำดับนี้สำคัญเพราะอะไร แต่ละชั้นเป็นพื้นฐานของชั้นถัดไป micrograd สอนกลไกการเรียนรู้ nn-zero-to-hero สอนการสร้างโมเดล minbpe สอนการแปลงภาษาเป็นตัวเลข [3][4][5] โค้ดเทรนของ llm.c ก็ดัดแปลงมาจาก nanoGPT และ autoresearch ก็ใช้โค้ดเทรนแบบย่อของ nanochat [7][9] ถ้าข้ามขั้น คุณจะใช้ nanoGPT ได้ แต่จะไม่รู้ว่าทำไมมันพัง การเทรนจริงบังคับให้คุณเจอปัญหาจริง ตัวอย่างปัญหาที่เจอจริงคือ loss ไม่ลด หน่วยความจำเต็ม และข้อมูลเสีย ปัญหาเหล่านี้ไม่มีในวิดีโอ แต่มีในรีโป และนั่นคือส่วนที่ทำให้คุณเก่งขึ้น คุณไม่ต้องเก่งคณิตทุกบท แคลคูลัสที่ต้องใช้จริงคืออนุพันธ์และการไล่ chain rule เท่านั้น ส่วนที่เหลือเรียนรู้ได้จากการเขียนโค้ดและแก้ error อะไรที่ต้องมีก่อนเริ่ม พื้นฐาน Python คุณต้องอ่านโค้ด Python ได้ และเข้าใจ class กับฟังก์ชัน ถ้ายังไม่แน่ใจ ให้เขียนโปรแกรมเล็ก ๆ ที่รับข้อมูลและคำนวณผลก่อน พื้นฐานแคลคูลัส คุณต้องเข้าใจว่าอนุพันธ์คืออัตราการเปลี่ยนแปลง และ chain rule ใช้ต่อกันอย่างไร ไม่ต้องจำสูตรทั้งหมด เพราะโค้ดจะทำให้เห็นภาพ เครื่องที่พอใช้ ช่วง micrograd ถึง nanoGPT ใช้ CPU หรือ GPU เล็กก็พอ ส่วน llm.c ต้องมีการ์ด NVIDIA ที่ใช้ CUDA เพราะทาง CPU มีแต่รันเดโม [7] แต่ตั้งแต่ nanochat ขึ้นไปต้องใช้ GPU ที่มีหน่วยความจำมาก หรือเช่า cloud ตามชั่วโมง แผน 24 สัปดาห์ที่ผมเรียงเอง สัปดาห์ 1 ถึง 3: micrograd อ่านโค้ดทั้งหมด เขียนใหม่ด้วยมือ และทำแบบฝึกหัด เป้าหมายคืออธิบายได้ว่าทำไม gradient ถึงไหลย้อนกลับได้ สัปดาห์ 4 ถึง 8: nn-zero-to-hero ดูวิดีโอทีละตอนและพิมพ์โค้ดตามทุกบรรทัด อย่าดูรวดเดียว เพราะสมองจะจำไม่ได้ว่าอะไรเกิดขึ้นตอนไหน สัปดาห์ 9 ถึง 10: minbpe ทดลองแบ่งคำภาษาไทยและอังกฤษ แล้วเทียบจำนวนโทเคน คุณจะเห็นทันทีว่าทำไมบางภาษาจ่ายแพงกว่า สัปดาห์ 11 ถึง 14: nanoGPT เทรนโมเดลเล็กบนข้อความของคุณเอง และบันทึกค่า loss ทุกครั้ง ถ้า loss ไม่ลด ให้ตรวจข้อมูลและ learning rate ก่อนสงสัยโมเดล สัปดาห์ 15 ถึง 18: llm.c และ nanochat ทำความเข้าใจชั้น C และลองเทรน nanochat ตามงบที่คุณมี ถ้างบไม่พอ ให้รันเฉพาะขั้นตอนสั้น ๆ เพื่อดูกลไก สัปดาห์ 19 ถึง 24: autoresearch ปล่อยให้ agent ทำงานหนึ่งคืน แล้วอ่าน log ตอนเช้า คุณจะไม่ได้โมเดลที่เก่งที่สุด แต่จะเข้าใจว่าการวิจัยอัตโนมัติทำงานอย่างไร กับดักที่คนมักเจอ ดูวิดีโอจบแต่ไม่เขียนโค้ด กับดักที่พบบ่อยที่สุดข้อหนึ่งของการเรียนออนไลน์ ถ้าไม่พิมพ์โค้ดเอง คุณจะเข้าใจตอนดู แต่ทำไม่ได้ตอนเจอปัญหาจริง ข้ามไป nanochat เพราะอยากได้ผลเร็ว คนจำนวนมากอยากเทรนโมเดลใหญ่ทันที แต่ไม่เข้าใจว่า loss คืออะไร ผลคือเสียค่า GPU โดยไม่รู้ว่าปัญหาอยู่ที่ข้อมูลหรือโค้ด ประเมินค่าใช้จ่ายต่ำเกินไป รีโปบอกว่าเทรน GPT-2 ระดับนั้นใช้ 48 ดอลลาร์ [8] แต่ราคานั้นอิงการเช่า GPU 8 การ์ดเป็นเวลาสองชั่วโมง ถ้าคุณรันผิดพลาดหลายรอบ ค่าใช้จ่ายจะคูณขึ้นทันที คิดว่าดาวเยอะแปลว่าเหมาะกับตัวเอง autoresearch มีดาวเกือบหนึ่งแสน [2] แต่เนื้อหาของมันต้องการพื้นฐานการเทรนโมเดลมาก่อน เลือกตามระดับของคุณ ไม่ใช่ตามอันดับดาว สิ่งที่หลักสูตรนี้ให้ไม่ได้ ไม่ได้สอนการทำผลิตภัณฑ์ การเทรนโมเดลกับการทำผลิตภัณฑ์เป็นคนละทักษะ หลักสูตรนี้ไม่ได้สอนเรื่องต้นทุนทีม การตลาด หรือการดูแลระบบหลังบ้าน ไม่ได้สอนจริยธรรมและกฎหมาย เรื่องลิขสิทธิ์ข้อมูล ความเป็นส่วนตัว และข้อกำหนดการใช้งาน ต้องเรียนแยก และเป็นส่วนที่สำคัญกว่าที่คนคิด เมื่อคุณนำโมเดลไปใช้จริง ไม่ได้รับรองคุณภาพผู้เรียน การมีรีโปอยู่ในเครื่องไม่ได้แปลว่าคุณทำได้ หลักฐานคือผลงานที่รันได้และคำอธิบายที่คุณเขียนเอง บทสรุป ในมุมมองของผม เจ็ดรีโปนี้เรียงกันเป็นเส้นทางที่สมเหตุสมผล ตั้งแต่กลไกการเรียนรู้ไปจนถึง agent ที่ทำวิจัยเอง [3][9] ตัวเลข 306,851 ดาวยืนยันว่าคนให้ความสนใจมาก แต่ไม่ได้รับประกันว่าคุณจะเรียนจบ [2] ถ้าคุณมีเวลา 6 เดือนและวินัยพอที่จะเขียนโค้ดทุกสัปดาห์ ในมุมมองของผม นี่คือหนึ่งในเส้นทางที่คุ้มที่สุดตอนนี้ และตารางสัปดาห์ข้างบนเป็นข้อเสนอของผม ไม่ใช่ผลที่วัดจากการเรียนจริง แต่ถ้าคุณมองหาหลักสูตรที่มีคนตรวจงานและใบรับรอง คุณจะผิดหวัง เพราะ Karpathy ให้แผนที่มา ไม่ได้ให้รถรับส่ง REF [1] Mr. Buzzoni (26 ต.ค. 2026) · Karpathy put an entire AI degree on GitHub for free. x.com [2] GitHub (27 ต.ค. 2026) · รายชื่อรีโปและจำนวนดาวของ Karpathy (รวมโดยผู้เขียนจาก GitHub REST API ทั้งเจ็ดรีโป). github.com/karpathy [3] Andrej Karpathy (2020) · micrograd. karpathy/micrograd [4] Andrej Karpathy (2022) · Neural Networks: Zero to Hero. karpathy/nn-zero-to-hero [5] Andrej Karpathy (2024) · minbpe. karpathy/minbpe [6] Andrej Karpathy (2022) · nanoGPT. karpathy/nanoGPT [7] Andrej Karpathy (2024) · llm.c. karpathy/llm.c [8] Andrej Karpathy (2025) · nanochat. karpathy/nanochat [9] Andrej Karpathy (2026) · autoresearch. karpathy/autoresearch

  9. YouTube · · YouTube description · ErrorFixer · karpathy/nanoGPT

    Build a GPT From Scratch in Python (201 Lines, 10.7M Parameters) Official downloads & docs: Python — python.org PyTorch — pytorch.org nanoGPT (MIT, Andrej Karpathy) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn CHAPTERS 0:00 Why build a GPT 0:24 Tokens & data 0:58 The bigram floor 1:25 Attention from scratch 2:25 Training the model 3:20 Generation & sampling 3:52 Bugs you will hit 4:15 What's next WHAT YOU WILL BUILD A complete character-level GPT in one Python file: tokenizer, embeddings, causal self-attention, a 6-layer transformer, cross-entropy loss, the training loop, and sampling. 201 lines, 10,745,088 parameters, vocabulary of 65 characters, context window of 256 characters. WHAT YOU NEED - Python 3.10 or newer (this build: Python 3.13.5) and PyTorch 2.x (this build: 2.7.1 + CUDA 11.8) - Any NVIDIA GPU with 8 GB or more, or a free Colab T4; CPU works but training is much slower - 4 GB of disk for Python, PyTorch and the 1.1 MB Tiny Shakespeare text file - No paid tools, no API key, no cloud account, no prior deep-learning experience required - About 25 minutes: the 5,000-step run in this video took 1,273 seconds on one RTX 3080 WHAT IS INSIDE The video is honest about the result: training loss falls from 4.27 to 0.31, validation loss bottoms at 1.48 around step 1,500 and then climbs to 2.19 as the model memorises the one-megabyte corpus. Attention maps, parameter counts and timings are measured from the checkpoint trained on screen, not copied from a paper. Independent tutorial. Not affiliated with OpenAI, GitHub, PyTorch, Python or any company shown. No payment, sponsorship or free product was received. All trademarks belong to their owners. "GPT" is used descriptively for the model family. Code and numbers are provided for education, without warranty; verify versions against the official sources above before installing. [ar] كيف تبني نموذج GPT من الصفر بلغة بايثون (201 سطرًا و10.7 مليون معامل) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn الفصول 0:00 لماذا نبني GPT 0:24 الرموز والبيانات 0:58 سقف نموذج الثنائيات 1:25 الانتباه من الصفر 2:25 تدريب النموذج 3:20 التوليد وأخذ العينات 3:52 الأخطاء التي ستواجهها 4:15 ما التالي نبني نموذج GPT كاملًا على مستوى الحروف في ملف بايثون واحد: المُرمِّز، والتضمينات، والانتباه الذاتي السببي، وست طبقات محوّل، ودالة الخسارة، وحلقة التدريب. 201 سطر و10,745,088 معاملًا، دُرِّبت فعليًا على بطاقة RTX 3080. ما تحتاجه - بايثون 3.10 أو أحدث (هنا 3.13.5) وPyTorch 2.x (هنا 2.7.1 مع CUDA 11.8) - أي بطاقة NVIDIA بذاكرة 8 غيغابايت أو أكثر، أو T4 مجانية على Colab؛ يعمل على المعالج لكنه أبطأ بكثير - نحو 4 غيغابايت من القرص لبايثون وPyTorch وملف النص بحجم 1.1 ميغابايت - دون أدوات مدفوعة أو مفتاح API أو خبرة سابقة في التعلم العميق درس مستقل. غير مرتبط بـ OpenAI أو GitHub أو PyTorch أو Python أو أي شركة تظهر في الفيديو. لم نتحصل على أي دفع أو رعاية أو منتج مجاني. جميع العلامات التجارية ملك لأصحابها. استُخدم «GPT» وصفًا لعائلة النماذج. الكود والأرقام لأغراض تعليمية دون ضمان. [bn] Python দিয়ে শূন্য থেকে GPT তৈরি (২০১ লাইন, ১ কোটি ৭ লাখ প্যারামিটার) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn অধ্যায় 0:00 কেন GPT বানাব 0:24 টোকেন ও ডেটা 0:58 বাইগ্রামের সীমা 1:25 শূন্য থেকে attention 2:25 মডেল প্রশিক্ষণ 3:20 জেনারেশন ও স্যাম্পলিং 3:52 যে বাগগুলো পাবেন 4:15 এরপর কী একটি Python ফাইলেই সম্পূর্ণ character-level GPT বানাই: টোকেনাইজার, এমবেডিং, কজাল self-attention, ছয়টি ট্রান্সফর্মার লেয়ার, লস ও ট্রেনিং লুপ। ২০১ লাইন ও ১,০৭,৪৫,০৮৮ প্যারামিটার, সত্যিকারের RTX 3080-এ প্রশিক্ষিত। যা লাগবে - Python 3.10 বা নতুন (এখানে 3.13.5) এবং PyTorch 2.x (এখানে CUDA 11.8 সহ 2.7.1) - ৮ GB বা বেশি ভিডিও মেমরির যেকোনো NVIDIA GPU, অথবা Colab-এ ফ্রি T4; CPU-তেও চলে, তবে অনেক ধীর - Python, PyTorch ও ১.১ MB টেক্সট ফাইলের জন্য প্রায় ৪ GB ডিস্ক - কোনো paid টুল, API key বা আগের deep learning অভিজ্ঞতা লাগবে না স্বতন্ত্র টিউটোরিয়াল। OpenAI, GitHub, PyTorch, Python বা দেখানো কোনো কোম্পানির সঙ্গে সম্পর্কিত নয়। কোনো অর্থ, স্পনসরশিপ বা ফ্রি পণ্য নেওয়া হয়নি। সব ট্রেডমার্ক তাদের মালিকদের। “GPT” শব্দটি মডেল পরিবারের বর্ণনায় ব্যবহৃত। কোড ও সংখ্যা শিক্ষামূলক, কোনো ওয়ারেন্টি নেই। [cs] Jak postavit GPT od nuly v Pythonu (201 řádků, 10,7 milionu parametrů) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn KAPITOLY 0:00 Proč stavět GPT 0:24 Tokeny a data 0:58 Strop bigramu 1:25 Attention od nuly 2:25 Trénink modelu 3:20 Generování a vzorkování 3:52 Chyby, na které narazíte 4:15 Co dál Postavíme kompletní znakový GPT v jediném souboru Pythonu: tokenizér, embeddingy, kauzální self-attention, šest vrstev transformeru, ztrátu a trénovací smyčku. 201 řádků a 10 745 088 parametrů, skutečně natrénovaných na RTX 3080. CO BUDETE POTŘEBOVAT - Python 3.10 nebo novější (zde 3.13.5) a PyTorch 2.x (zde 2.7.1 s CUDA 11.8) - Libovolnou GPU NVIDIA s 8 GB nebo více, případně bezplatnou T4 na Colabu; na CPU to běží, ale mnohem pomaleji - Asi 4 GB místa na disku pro Python, PyTorch a textový soubor o velikosti 1,1 MB - Žádné placené nástroje, žádný API klíč a žádné předchozí zkušenosti s deep learningem Nezávislý tutoriál. Není spojen s OpenAI, GitHub, PyTorch, Python ani žádnou zobrazenou firmou. Nebyla přijata žádná platba, sponzorství ani bezplatný produkt. Všechny ochranné známky patří jejich majitelům. „GPT“ je použito popisně pro tuto rodinu modelů. Kód a čísla jsou vzdělávací, bez záruky. [da] Byg en GPT fra bunden i Python (201 linjer, 10,7 millioner parametre) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn KAPITLER 0:00 Hvorfor bygge en GPT 0:24 Tokens og data 0:58 Bigram-loftet 1:25 Attention fra bunden 2:25 Træn modellen 3:20 Generering og sampling 3:52 De fejl du vil møde 4:15 Hvad nu Vi bygger en komplet tegnbaseret GPT i én Python-fil: tokenizer, embeddings, kausal self-attention, seks transformer-lag, loss og træningsløkke. 201 linjer og 10.745.088 parametre, faktisk trænet på et RTX 3080. DU SKAL BRUGE - Python 3.10 eller nyere (her 3.13.5) og PyTorch 2.x (her 2.7.1 med CUDA 11.8) - Et NVIDIA-kort med 8 GB eller mere, eller en gratis T4 på Colab; på CPU virker det, men meget langsommere - Cirka 4 GB disk til Python, PyTorch og tekstfilen på 1,1 MB - Ingen betalingsværktøjer, ingen API-nøgle og ingen tidligere erfaring med deep learning Uafhængig vejledning. Ikke tilknyttet OpenAI, GitHub, PyTorch, Python eller nogen virksomhed, der vises. Der er ikke modtaget betaling, sponsorat eller gratis produkt. Alle varemærker tilhører deres ejere. »GPT« bruges beskrivende om modelfamilien. Kode og tal er pædagogiske og uden garanti. [de] Ein GPT von Grund auf in Python bauen (201 Zeilen, 10,7 Mio. Parameter) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn KAPITEL 0:00 Warum ein GPT bauen 0:24 Tokens und Daten 0:58 Die Bigramm-Grenze 1:25 Attention von Grund auf 2:25 Das Modell trainieren 3:20 Generierung und Sampling 3:52 Diese Fehler wirst du treffen 4:15 Wie es weitergeht Wir bauen ein vollständiges zeichenbasiertes GPT in einer einzigen Python-Datei: Tokenizer, Embeddings, kausale Self-Attention, sechs Transformer-Schichten, Loss und Trainingsschleife. 201 Zeilen und 10.745.088 Parameter, wirklich auf einer RTX 3080 trainiert. VORAUSSETZUNGEN - Python 3.10 oder neuer (hier 3.13.5) und PyTorch 2.x (hier 2.7.1 mit CUDA 11.8) - Jede NVIDIA-GPU mit mindestens 8 GB oder eine kostenlose T4 in Colab; auf der CPU läuft es, aber viel langsamer - Rund 4 GB Speicher für Python, PyTorch und die 1,1-MB-Textdatei - Keine kostenpflichtigen Tools, kein API-Key und keine Vorkenntnisse in Deep Learning Unabhängiges Tutorial. Nicht verbunden mit OpenAI, GitHub, PyTorch, Python oder einem gezeigten Unternehmen. Es gab keine Bezahlung, kein Sponsoring und kein kostenloses Produkt. Alle Marken gehören ihren Inhabern. „GPT“ wird beschreibend für die Modellfamilie verwendet. Code und Zahlen dienen der Bildung, ohne Gewähr. [de-DE] Erstellen Sie einen GPT von Grund auf in Python (201 Zeilen, 10,7 Millionen Parameter) Offizielle Downloads & Dokumentation: Python – python.org PyTorch – pytorch.org nanoGPT (MIT, Andrej Karpathy) – karpathy/nanoGPT Tiny Shakespeare-Datensatz – karpathy/char-rnn KAPITEL 0:00 Warum ein GPT entwickeln? 0:24 Tokens & Daten 0:58 Die Bigramm-Untergrenze 1:25 Attention von Grund auf 2:25 Das Modell trainieren 3:20 Generierung & Sampling 3:52 Mögliche Fehler 4:15 Wie geht es weiter? WAS SIE ERSTELLEN WERDEN Ein vollständiges GPT auf Zeichenebene in einer Python-Datei: Tokenizer, Einbettungen, kausale Selbstaufmerksamkeit, ein 6-schichtiger Transformer, Kreuzentropie-Verlust, die Trainingsschleife und Sampling. 201 Zeilen, 10.745.088 Parameter, Vokabular von 65 Zeichen, Kontextfenster von 256 Zeichen. VORAUSSETZUNGEN - Python 3.10 oder neuer (diese Version: Python 3.13.5) und PyTorch 2.x (diese Version: 2.7.1 + CUDA 11.8) - Eine beliebige NVIDIA-GPU mit mindestens 8 GB oder ein kostenloses Colab T4; Die CPU funktioniert, aber das Training ist deutlich langsamer. - 4 GB Festplattenspeicher für Python, PyTorch und die 1,1 MB große Tiny Shakespeare-Textdatei - Keine kostenpflichtigen Tools, kein API-Schlüssel, kein Cloud-Konto, keine Vorkenntnisse im Deep Learning erforderlich - Ca. 25 Minuten: Der 5.000-Schritte-Lauf in diesem Video dauerte auf einer RTX 3080 1.273 Sekunden. WAS IST DRIN? Das Video zeigt die Ergebnisse ehrlich: Der Trainingsverlust sinkt von 4,27 auf 0,31, der Validierungsverlust erreicht um Schritt 1.500 ein Minimum von 1,48 und steigt dann auf 2,19, während das Modell den 1-Megabyte-Korpus auswendig lernt. Aufmerksamkeitskarten, Parameteranzahlen und Laufzeiten wurden anhand des im Video trainierten Checkpoints gemessen und nicht aus einer wissenschaftlichen Arbeit übernommen. Unabhängiges Tutorial. Keine Verbindung zu OpenAI, GitHub, PyTorch, Python oder einem der gezeigten Unternehmen. Es wurden keine Zahlungen, Sponsoring oder kostenlose Produkte erhalten. Alle Markenrechte gehören den jeweiligen Inhabern. „GPT“ wird beschreibend für die Modellfamilie verwendet. Code und Nummern werden zu Schulungszwecken und ohne Gewährleistung bereitgestellt; überprüfen Sie die Versionen vor der Installation anhand der oben genannten offiziellen Quellen. [el] Φτιάξε ένα GPT από το μηδέν σε Python (201 γραμμές, 10,7 εκατ. παράμετροι) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn ΚΕΦΑΛΑΙΑ 0:00 Γιατί να φτιάξεις GPT 0:24 Tokens και δεδομένα 0:58 Το όριο του bigram 1:25 Attention από το μηδέν 2:25 Εκπαίδευση του μοντέλου 3:20 Παραγωγή και δειγματοληψία 3:52 Τα bugs που θα συναντήσεις 4:15 Τι ακολουθεί Χτίζουμε ένα πλήρες GPT σε επίπεδο χαρακτήρα σε ένα μόνο αρχείο Python: tokenizer, embeddings, αιτιακό self-attention, έξι επίπεδα transformer, συνάρτηση απώλειας και βρόχο εκπαίδευσης. 201 γραμμές και 10.745.088 παράμετροι, εκπαιδευμένοι πραγματικά σε RTX 3080. ΤΙ ΧΡΕΙΑΖΕΣΑΙ - Python 3.10 ή νεότερη (εδώ 3.13.5) και PyTorch 2.x (εδώ 2.7.1 με CUDA 11.8) - Οποιαδήποτε GPU NVIDIA με 8 GB ή περισσότερα, ή δωρεάν T4 στο Colab· σε CPU τρέχει αλλά πολύ πιο αργά - Περίπου 4 GB δίσκου για Python, PyTorch και το αρχείο κειμένου 1,1 MB - Χωρίς πληρωμένα εργαλεία, χωρίς API key και χωρίς προηγούμενη εμπειρία σε deep learning Ανεξάρτητο σεμινάριο. Δεν συνδέεται με την OpenAI, το GitHub, το PyTorch, την Python ή οποιαδήποτε εταιρεία που εμφανίζεται. Δεν ελήφθη πληρωμή, χορηγία ή δωρεάν προϊόν. Όλα τα εμπορικά σήματα ανήκουν στους ιδιοκτήτες τους. Το «GPT» χρησιμοποιείται περιγραφικά για την οικογένεια μοντέλων. Ο κώδικας και τα νούμερα είναι εκπαιδευτικά, χωρίς εγγύηση. [es] Cómo construir un GPT desde cero en Python (201 líneas, 10,7 M de parámetros) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn CAPÍTULOS 0:00 Por qué construir un GPT 0:24 Tokens y datos 0:58 El límite del bigrama 1:25 Atención desde cero 2:25 Entrenar el modelo 3:20 Generación y muestreo 3:52 Errores que encontrarás 4:15 Qué viene después Creamos un GPT completo a nivel de carácter en un solo archivo de Python: tokenizador, embeddings, autoatención causal, seis capas de transformer, función de pérdida y bucle de entrenamiento. 201 líneas y 10.745.088 parámetros, entrenados de verdad en una RTX 3080. REQUISITOS - Python 3.10 o superior (aquí 3.13.5) y PyTorch 2.x (aquí 2.7.1 con CUDA 11.8) - Cualquier GPU NVIDIA de 8 GB o más, o una T4 gratuita en Colab; en CPU funciona, pero tarda mucho más - Unos 4 GB de disco para Python, PyTorch y el archivo de texto de 1,1 MB - Sin herramientas de pago, sin clave de API y sin experiencia previa en deep learning Tutorial independiente. No está afiliado a OpenAI, GitHub, PyTorch, Python ni a ninguna empresa mostrada. No se recibió pago, patrocinio ni producto gratuito. Todas las marcas pertenecen a sus dueños. «GPT» se usa de forma descriptiva para la familia de modelos. El código y las cifras son educativos y no ofrecen garantía. [es-US] Crea un GPT desde cero en Python (201 líneas, 10.7M de parámetros) Descargas y documentación oficiales: Python — python.org PyTorch — pytorch.org nanoGPT (MIT, Andrej Karpathy) — karpathy/nanoGPT Conjunto de datos Tiny Shakespeare — karpathy/char-rnn CAPÍTULOS 0:00 ¿Por qué crear un GPT? 0:24 Tokens y datos 0:58 El límite inferior de bigramas 1:25 Atención desde cero 2:25 Entrenamiento del modelo 3:20 Generación y muestreo 3:52 Errores comunes 4:15 Próximos pasos QUÉ CONSTRUIRÁS Un GPT completo a nivel de caracteres en un solo archivo Python: tokenizador, incrustaciones, autoatención causal, un transformador de 6 capas, pérdida de entropía cruzada, el bucle de entrenamiento y muestreo. 201 líneas, 10.745.088 parámetros, vocabulario de 65 caracteres, ventana de contexto de 256 caracteres. REQUISITOS - Python 3.10 o superior (esta compilación: Python 3.13.5) y PyTorch 2.x (esta compilación: 2.7.1 + CUDA 11.8) - Cualquier GPU NVIDIA con 8 GB o más, o una Colab T4 gratuita; La CPU funciona, pero el entrenamiento es mucho más lento. - 4 GB de disco para Python, PyTorch y el archivo de texto Tiny Shakespeare de 1,1 MB. - No se requieren herramientas de pago, clave API, cuenta en la nube ni experiencia previa en aprendizaje profundo. - Aproximadamente 25 minutos: la ejecución de 5000 pasos de este video tardó 1273 segundos en una RTX 3080. CONTENIDO El video muestra los resultados con transparencia: la pérdida de entrenamiento baja de 4,27 a 0,31, la pérdida de validación alcanza un mínimo de 1,48 alrededor del paso 1500 y luego sube a 2,19 a medida que el modelo memoriza el corpus de un megabyte. Los mapas de atención, el número de parámetros y los tiempos se miden desde el punto de control entrenado en pantalla, no se copian de ningún documento. Tutorial independiente. No afiliado a OpenAI, GitHub, PyTorch, Python ni a ninguna de las empresas que aparecen en el video. No se recibió ningún pago, patrocinio ni producto gratuito. Todas las marcas registradas pertenecen a sus respectivos propietarios. "GPT" se utiliza como referencia para la familia de modelos. Los códigos y números se proporcionan con fines educativos, sin garantía; verifique las versiones con las fuentes oficiales mencionadas anteriormente antes de la instalación. [fa] ساخت GPT از صفر با پایتون (۲۰۱ خط، ۱۰٫۷ میلیون پارامتر) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn فصل‌ها 0:00 چرا GPT بسازیم 0:24 توکن‌ها و داده 0:58 سقف بی‌گرام 1:25 توجه از صفر 2:25 آموزش مدل 3:20 تولید و نمونه‌گیری 3:52 خطاهایی که می‌بینید 4:15 قدم بعدی یک GPT کامل در سطح کاراکتر را در یک فایل پایتون می‌سازیم: توکنایزر، امبدینگ، خودتوجهی علّی، شش لایه ترنسفورمر، تابع خطا و حلقه آموزش. ۲۰۱ خط و ۱۰٬۷۴۵٬۰۸۸ پارامتر که واقعاً روی یک RTX 3080 آموزش دیده است. چه چیزی لازم دارید - پایتون ۳٫۱۰ یا جدیدتر (اینجا ۳٫۱۳٫۵) و PyTorch 2.x (اینجا ۲٫۷٫۱ با CUDA 11.8) - هر کارت NVIDIA با ۸ گیگابایت یا بیشتر، یا T4 رایگان در Colab؛ روی CPU اجرا می‌شود اما بسیار کندتر - حدود ۴ گیگابایت فضا برای پایتون، PyTorch و فایل متنی ۱٫۱ مگابایتی - بدون ابزار پولی، بدون کلید API و بدون تجربه قبلی یادگیری عمیق آموزش مستقل است. وابسته به OpenAI، GitHub، PyTorch، Python یا هیچ شرکت نمایش‌داده‌شده نیست. هیچ پرداخت، اسپانسری یا محصول رایگانی دریافت نشده است. همه علائم تجاری متعلق به صاحبانشان است. «GPT» به‌صورت توصیفی برای این خانواده مدل‌ها به کار رفته است. کد و اعداد آموزشی و بدون ضمانت‌اند. [fi] Rakenna GPT alusta asti Pythonilla (201 riviä, 10,7 miljoonaa parametria) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn LUVUT 0:00 Miksi rakentaa GPT 0:24 Tokenit ja data 0:58 Bigrammin raja 1:25 Attention alusta asti 2:25 Mallin koulutus 3:20 Generointi ja näytteistys 3:52 Bugsit, joihin törmäät 4:15 Mitä seuraavaksi Rakennamme täyden merkkipohjaisen GPT:n yhteen Python-tiedostoon: tokenisoija, upotukset, kausaalinen self-attention, kuusi transformer-kerrosta, häviö ja koulutussilmukka. 201 riviä ja 10 745 088 parametria, oikeasti koulutettuna RTX 3080:lla. TARVITSET - Python 3.10 tai uudempi (tässä 3.13.5) ja PyTorch 2.x (tässä 2.7.1 CUDA 11.8:lla) - Minkä tahansa NVIDIA-näytönohjaimen, jossa on vähintään 8 Gt, tai ilmaisen T4:n Colabissa; CPU:lla toimii mutta on paljon hitaampi - Noin 4 Gt levytilaa Pythonille, PyTorchille ja 1,1 Mt:n tekstitiedostolle - Ei maksullisia työkaluja, ei API-avainta eikä aiempaa deep learning -kokemusta Itsenäinen opetusvideo. Ei sidoksissa OpenAI:hin, GitHubiin, PyTorchiin, Pythoniin tai mihinkään esitettyyn yritykseen. Maksua, sponsorointia tai ilmaista tuotetta ei ole vastaanotettu. Kaikki tavaramerkit kuuluvat omistajilleen. ”GPT” viittaa kuvaavasti malliperheeseen. Koodi ja luvut ovat opetuksellisia ilman takuuta. [fr] Construire un GPT de zéro en Python (201 lignes, 10,7 M de paramètres) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn CHAPITRES 0:00 Pourquoi construire un GPT 0:24 Tokens et données 0:58 Le plafond du bigramme 1:25 L'attention depuis zéro 2:25 Entraîner le modèle 3:20 Génération et échantillonnage 3:52 Les bugs que vous rencontrerez 4:15 Et ensuite Nous écrivons un GPT complet au niveau du caractère dans un seul fichier Python : tokenizer, embeddings, auto-attention causale, six couches de transformer, perte et boucle d'entraînement. 201 lignes et 10 745 088 paramètres, réellement entraînés sur une RTX 3080. PRÉREQUIS - Python 3.10 ou plus récent (ici 3.13.5) et PyTorch 2.x (ici 2.7.1 avec CUDA 11.8) - N'importe quel GPU NVIDIA de 8 Go ou plus, ou un T4 gratuit sur Colab ; sur CPU cela fonctionne mais beaucoup plus lentement - Environ 4 Go de disque pour Python, PyTorch et le fichier texte de 1,1 Mo - Aucun outil payant, aucune clé API et aucune expérience préalable en deep learning Tutoriel indépendant. Non affilié à OpenAI, GitHub, PyTorch, Python ni à aucune entreprise citée. Aucun paiement, parrainage ou produit gratuit n'a été reçu. Toutes les marques appartiennent à leurs propriétaires. « GPT » est utilisé de façon descriptive pour la famille de modèles. Le code et les chiffres sont fournis à titre éducatif, sans garantie. [fr-FR] Créer un GPT à partir de zéro en Python (201 lignes, 10,7 millions de paramètres) Téléchargements et documentation officiels : Python — python.org PyTorch — pytorch.org nanoGPT (MIT, Andrej Karpathy) — karpathy/nanoGPT Jeu de données Tiny Shakespeare — karpathy/char-rnn CHAPITRES 0:00 Pourquoi créer une GPT ? 0:24 Tokens et données 0:58 Le plancher des bigrammes 1:25 L’attention à partir de zéro 2:25 Entraînement du modèle 3:20 Génération et échantillonnage 3:52 Problèmes rencontrés 4:15 Et ensuite ? CE QUE VOUS ALLEZ CRÉER Une GPT complète au niveau des caractères dans un seul fichier Python : tokenizer, plongements lexicaux, auto-attention causale, un transformeur à 6 couches, perte d’entropie croisée, boucle d’entraînement et échantillonnage. 201 lignes, 10 745 088 paramètres, vocabulaire de 65 caractères, fenêtre de contexte de 256 caractères. PRÉREQUIS : - Python 3.10 ou version ultérieure (cette version : Python 3.13.5) et PyTorch 2.x (cette version : 2.7.1 + CUDA 11.8) - Carte graphique NVIDIA avec 8 Go de mémoire ou plus, ou un Colab T4 gratuit. Le processeur fonctionne, mais l'entraînement est beaucoup plus lent. - 4 Go d'espace disque requis pour Python, PyTorch et le fichier texte Tiny Shakespeare de 1,1 Mo. - Aucun outil payant, aucune clé API, aucun compte cloud, aucune expérience préalable en apprentissage profond n'est nécessaire. - Environ 25 minutes : l'exécution de 5 000 étapes présentée dans cette vidéo a duré 1 273 secondes sur une RTX 3080. CONTENU La vidéo présente les résultats de manière transparente : la perte d'entraînement chute de 4,27 à 0,31, la perte de validation atteint son minimum à 1,48 autour de l'étape 1 500, puis remonte à 2,19 à mesure que le modèle mémorise le corpus d'un mégaoctet. Les cartes d'attention, le nombre de paramètres et les temps d'exécution sont mesurés à partir du point de contrôle d'entraînement affiché à l'écran, et non extraits d'un article scientifique. Tutoriel indépendant. Non affilié à OpenAI, GitHub, PyTorch, Python ni à aucune des entreprises mentionnées. Aucun paiement, parrainage ou produit gratuit n'a été reçu. Toutes les marques déposées appartiennent à leurs propriétaires respectifs. « GPT » est utilisé à titre descriptif pour désigner la gamme de modèles. Les codes et numéros sont fournis à des fins pédagogiques, sans garantie ; veuillez vérifier les versions auprès des sources officielles mentionnées ci-dessus avant toute installation. [gu] Python માં શૂન્યથી GPT બનાવો (201 લાઇન, 10.7 મિલિયન પેરામીટર્સ) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn પ્રકરણો 0:00 GPT કેમ બનાવવો 0:24 ટોકન અને ડેટા 0:58 બાયગ્રામની મર્યાદા 1:25 શૂન્યથી attention 2:25 મોડેલની તાલીમ 3:20 જનરેશન અને સેમ્પલિંગ 3:52 તમને મળતા બગ 4:15 આગળ શું એક જ Python ફાઇલમાં સંપૂર્ણ character-level GPT બનાવીએ છીએ: ટોકનાઇઝર, એમ્બેડિંગ, કોઝલ self-attention, છ ટ્રાન્સફોર્મર સ્તર, લોસ અને તાલીમ લૂપ. 201 લાઇન અને 10,745,088 પેરામીટર્સ, સાચા RTX 3080 પર તાલીમ પામેલા. શું જરૂરી છે - Python 3.10 અથવા નવું (અહીં 3.13.5) અને PyTorch 2.x (અહીં CUDA 11.8 સાથે 2.7.1) - 8 GB કે વધુ ધરાવતું કોઈપણ NVIDIA GPU, અથવા Colab પર મફત T4; CPU પર ચાલે છે પણ ઘણું ધીમું - Python, PyTorch અને 1.1 MB ટેક્સ્ટ ફાઇલ માટે લગભગ 4 GB ડિસ્ક - કોઈ પેઇડ ટૂલ, API કી કે પહેલાંનો deep learning અનુભવ જરૂરી નથી સ્વતંત્ર ટ્યુટોરિયલ. OpenAI, GitHub, PyTorch, Python કે દર્શાવેલી કોઈ કંપની સાથે સંલગ્ન નથી. કોઈ ચુકવણી, પ્રાયોજિતતા કે મફત ઉત્પાદન મળ્યું નથી. બધા ટ્રેડમાર્ક તેમના માલિકોના છે. “GPT” મોડેલ પરિવાર માટે વર્ણનાત્મક રીતે વપરાયું છે. કોડ અને આંકડા શૈક્ષણિક છે, વોરંટી નથી. [hi] Python में शून्य से GPT बनाएं (201 लाइनें, 10.7 मिलियन पैरामीटर) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn अध्याय 0:00 GPT क्यों बनाएं 0:24 टोकन और डेटा 0:58 बाइग्राम की सीमा 1:25 शून्य से attention 2:25 मॉडल का प्रशिक्षण 3:20 जनरेशन और सैंपलिंग 3:52 वे बग जो आपको मिलेंगे 4:15 आगे क्या एक ही Python फ़ाइल में पूरा character-level GPT बनाते हैं: टोकनाइज़र, एम्बेडिंग, कॉज़ल self-attention, छह ट्रांसफ़ॉर्मर लेयर, लॉस और ट्रेनिंग लूप। 201 लाइनें और 10,745,088 पैरामीटर, असली RTX 3080 पर प्रशिक्षित। क्या चाहिए - Python 3.10 या नया (यहाँ 3.13.5) और PyTorch 2.x (यहाँ CUDA 11.8 के साथ 2.7.1) - 8 GB या अधिक वाला कोई भी NVIDIA GPU, या Colab पर मुफ़्त T4; CPU पर चलता है पर बहुत धीमा है - Python, PyTorch और 1.1 MB टेक्स्ट फ़ाइल के लिए लगभग 4 GB डिस्क - कोई paid टूल नहीं, कोई API key नहीं और deep learning का पहले से अनुभव ज़रूरी नहीं स्वतंत्र ट्यूटोरियल। OpenAI, GitHub, PyTorch, Python या दिखाई गई किसी कंपनी से संबद्ध नहीं। कोई भुगतान, प्रायोजन या मुफ़्त उत्पाद नहीं मिला। सभी ट्रेडमार्क उनके स्वामियों के हैं। “GPT” का उपयोग मॉडल परिवार के लिए वर्णनात्मक रूप से किया गया है। कोड और आंकड़े शैक्षिक हैं, बिना किसी वारंटी के। [hu] Építs GPT-t a nulláról Pythonban (201 sor, 10,7 millió paraméter) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn FEJEZETEK 0:00 Miért építsünk GPT-t 0:24 Tokenek és adatok 0:58 A bigram plafonja 1:25 Attention a nulláról 2:25 A modell tanítása 3:20 Generálás és mintavétel 3:52 Hibák, amelyekbe belefutsz 4:15 Mi jön ezután Egyetlen Python-fájlban építünk teljes karakter szintű GPT-t: tokenizáló, beágyazások, kauzális self-attention, hat transformer réteg, veszteségfüggvény és tanítási ciklus. 201 sor és 10 745 088 paraméter, valóban RTX 3080-on tanítva. AMIRE SZÜKSÉGED LESZ - Python 3.10 vagy újabb (itt 3.13.5) és PyTorch 2.x (itt 2.7.1 CUDA 11.8-cal) - Bármilyen NVIDIA GPU 8 GB vagy több memóriával, vagy ingyenes T4 a Colabon; CPU-n is fut, de sokkal lassabb - Kb. 4 GB lemezterület a Pythonhoz, a PyTorchhoz és az 1,1 MB-os szövegfájlhoz - Nincs fizetős eszköz, nincs API-kulcs és nincs szükség előzetes deep learning tapasztalatra Független oktatóvideó. Nem áll kapcsolatban az OpenAI-jal, a GitHubbal, a PyTorchhal, a Pythonnal vagy bármely bemutatott vállalattal. Nem kaptunk fizetést, szponzorációt vagy ingyenes terméket. Minden védjegy a tulajdonosáé. A „GPT” leíró jelleggel a modellcsaládra utal. A kód és a számok oktatási célúak, garancia nélkül. [id] Membuat GPT dari Nol dengan Python (201 baris, 10,7 juta parameter) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn BAB 0:00 Mengapa membangun GPT 0:24 Token dan data 0:58 Batas bigram 1:25 Attention dari nol 2:25 Melatih model 3:20 Generasi dan sampling 3:52 Bug yang akan Anda temui 4:15 Selanjutnya Kami membangun GPT lengkap tingkat karakter dalam satu file Python: tokenizer, embedding, self-attention kausal, enam lapisan transformer, loss, dan loop pelatihan. 201 baris dan 10.745.088 parameter, benar-benar dilatih di RTX 3080. YANG DIBUTUHKAN - Python 3.10 atau lebih baru (di sini 3.13.5) dan PyTorch 2.x (di sini 2.7.1 dengan CUDA 11.8) - GPU NVIDIA 8 GB atau lebih, atau T4 gratis di Colab; di CPU bisa jalan tetapi jauh lebih lambat - Sekitar 4 GB disk untuk Python, PyTorch, dan file teks 1,1 MB - Tanpa alat berbayar, tanpa API key, dan tanpa pengalaman deep learning sebelumnya Tutorial independen. Tidak berafiliasi dengan OpenAI, GitHub, PyTorch, Python, atau perusahaan mana pun yang ditampilkan. Tidak ada pembayaran, sponsor, atau produk gratis yang diterima. Semua merek dagang milik pemiliknya. “GPT” digunakan secara deskriptif untuk keluarga model ini. Kode dan angka bersifat edukatif, tanpa jaminan. [it] Costruire un GPT da zero in Python (201 righe, 10,7 milioni di parametri) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn CAPITOLI 0:00 Perché costruire un GPT 0:24 Token e dati 0:58 Il limite del bigramma 1:25 L'attenzione da zero 2:25 Addestrare il modello 3:20 Generazione e campionamento 3:52 Gli errori che incontrerai 4:15 Cosa viene dopo Scriviamo un GPT completo a livello di carattere in un solo file Python: tokenizer, embedding, self-attention causale, sei blocchi transformer, loss e ciclo di addestramento. 201 righe e 10.745.088 parametri, addestrati davvero su una RTX 3080. REQUISITI - Python 3.10 o superiore (qui 3.13.5) e PyTorch 2.x (qui 2.7.1 con CUDA 11.8) - Qualsiasi GPU NVIDIA da 8 GB o più, oppure una T4 gratuita su Colab; su CPU funziona ma è molto più lento - Circa 4 GB di disco per Python, PyTorch e il file di testo da 1,1 MB - Nessun tool a pagamento, nessuna chiave API e nessuna esperienza precedente di deep learning Tutorial indipendente. Non affiliato a OpenAI, GitHub, PyTorch, Python o a qualsiasi azienda mostrata. Nessun pagamento, sponsorizzazione o prodotto gratuito è stato ricevuto. Tutti i marchi appartengono ai rispettivi proprietari. “GPT” è usato in senso descrittivo per la famiglia di modelli. Codice e numeri sono educativi e senza garanzia. [iw] לבנות GPT מאפס בפייתון (201 שורות, 10.7 מיליון פרמטרים) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn פרקים 0:00 למה לבנות GPT 0:24 טוקנים ונתונים 0:58 תקרת הביגרם 1:25 Attention מאפס 2:25 אימון המודל 3:20 יצירה ודגימה 3:52 הבאגים שתפגשו 4:15 מה הלאה אנחנו בונים GPT שלם ברמת תו בקובץ פייתון אחד: טוקנייזר, אמבדינגים, self-attention סיבתי, שש שכבות טרנספורמר, פונקציית הפסד ולולאת אימון. 201 שורות ו-10,745,088 פרמטרים, שאומנו באמת על RTX 3080. מה צריך - פייתון 3.10 ומעלה (כאן 3.13.5) ו-PyTorch 2.x (כאן 2.7.1 עם CUDA 11.8) - כל כרטיס NVIDIA עם 8GB ומעלה, או T4 חינמי ב-Colab; על CPU זה עובד אבל איטי בהרבה - כ-4GB דיסק לפייתון, PyTorch וקובץ הטקסט בגודל 1.1MB - בלי כלים בתשלום, בלי מפתח API ובלי ניסיון קודם בלמידה עמוקה מדריך עצמאי. אינו קשור ל-OpenAI, GitHub, PyTorch, Python או לכל חברה שמוצגת. לא התקבל תשלום, חסות או מוצר חינם. כל הסימנים המסחריים שייכים לבעליהם. „GPT” משמש כתיאור למשפחת המודלים. הקוד והמספרים הם למטרות חינוך, ללא אחריות. [ja] PythonでゼロからGPTを作る(201行・1074万パラメータ) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn チャプター 0:00 なぜGPTを作るのか 0:24 トークンとデータ 0:58 バイグラムの限界 1:25 アテンションを一から 2:25 モデルの学習 3:20 生成とサンプリング 3:52 つまずくバグ 4:15 次にやること 文字単位のGPTをPythonファイル1つで作り切ります。トークナイザ、埋め込み、因果的self-attention、6層のTransformer、損失関数、学習ループまで。201行・10,745,088パラメータをRTX 3080で実際に学習します。 必要なもの - Python 3.10以降(本動画は3.13.5)とPyTorch 2.x(本動画はCUDA 11.8版2.7.1) - 8GB以上のNVIDIA GPU、またはColabの無料T4。CPUでも動きますが大幅に遅くなります - Python・PyTorch・1.1MBのテキストファイル用に約4GBの空き容量 - 有料ツール、APIキー、深層学習の事前知識は不要です 独立したチュートリアルです。OpenAI、GitHub、PyTorch、Python、および作中に登場する企業とは提携していません。報酬・スポンサー・無償提供は受け取っていません。商標はすべて各所有者に帰属します。「GPT」はモデル系統を指す一般的な名称として用いています。コードと数値は教育目的であり、保証はありません。 [ko] 파이썬으로 GPT 처음부터 만들기 (201줄, 1074만 파라미터) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn 챕터 0:00 왜 GPT를 만드는가 0:24 토큰과 데이터 0:58 바이그램의 한계 1:25 어텐션을 처음부터 2:25 모델 학습 3:20 생성과 샘플링 3:52 마주치게 될 버그 4:15 다음 단계 문자 단위 GPT를 파이썬 파일 하나로 완성합니다. 토크나이저, 임베딩, 인과적 self-attention, 6층 트랜스포머, 손실 함수, 학습 루프까지. 201줄·10,745,088 파라미터를 RTX 3080에서 실제로 학습합니다. 준비물 - Python 3.10 이상(영상에서는 3.13.5), PyTorch 2.x(영상에서는 CUDA 11.8용 2.7.1) - 8GB 이상 NVIDIA GPU 또는 Colab 무료 T4. CPU에서도 되지만 훨씬 느립니다 - Python, PyTorch, 1.1MB 텍스트 파일용 약 4GB 디스크 - 유료 도구, API 키, 사전 딥러닝 경험은 필요 없습니다 독립 튜토리얼입니다. OpenAI, GitHub, PyTorch, Python 및 영상에 등장하는 어떤 기업과도 제휴 관계가 없습니다. 금전적 대가, 후원, 무상 제공을 받지 않았습니다. 모든 상표는 각 소유자에게 있습니다. ‘GPT’는 모델 계열을 가리키는 설명적 용도로 사용했습니다. 코드와 수치는 교육 목적이며 보증하지 않습니다. [mr] Python मध्ये शून्यापासून GPT तयार करा (201 ओळी, 10.7 दशलक्ष पॅरामीटर्स) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn प्रकरणे 0:00 GPT का तयार करावा 0:24 टोकन आणि डेटा 0:58 बायग्रामची मर्यादा 1:25 शून्यापासून attention 2:25 मॉडेलचे प्रशिक्षण 3:20 जनरेशन आणि सॅम्पलिंग 3:52 तुम्हाला भेटणारे बग 4:15 पुढे काय एका Python फाइलमध्ये संपूर्ण character-level GPT तयार करतो: टोकनायझर, एम्बेडिंग्ज, कॉजल self-attention, सहा ट्रान्सफॉर्मर स्तर, लॉस आणि प्रशिक्षण लूप. 201 ओळी आणि 10,745,088 पॅरामीटर्स, खऱ्या RTX 3080 वर प्रशिक्षित. काय लागेल - Python 3.10 किंवा नवीन (येथे 3.13.5) आणि PyTorch 2.x (येथे CUDA 11.8 सह 2.7.1) - 8 GB किंवा अधिक असलेला कोणताही NVIDIA GPU, किंवा Colab वर मोफत T4; CPU वर चालतो पण खूप हळू - Python, PyTorch आणि 1.1 MB मजकूर फाइलसाठी सुमारे 4 GB डिस्क - कोणतेही पैसे देऊन घ्यावे लागणारे साधन, API की किंवा आधीचा deep learning अनुभव आवश्यक नाही स्वतंत्र ट्युटोरियल. OpenAI, GitHub, PyTorch, Python किंवा दाखवलेल्या कोणत्याही कंपनीशी संबंधित नाही. कोणतेही पैसे, प्रायोजकत्व किंवा मोफत उत्पादन घेतले नाही. सर्व ट्रेडमार्क त्यांच्या मालकांचे आहेत. “GPT” मॉडेल कुटुंबासाठी वर्णनात्मक वापरले आहे. कोड आणि आकडे शैक्षणिक आहेत, हमी नाही. [ms] Membina GPT dari Kosong dalam Python (201 baris, 10.7 juta parameter) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn BAB 0:00 Mengapa membina GPT 0:24 Token dan data 0:58 Had bigram 1:25 Attention dari kosong 2:25 Melatih model 3:20 Penjanaan dan persampelan 3:52 Pepijat yang akan anda jumpa 4:15 Apa seterusnya Kami membina GPT lengkap peringkat aksara dalam satu fail Python: tokenizer, embedding, self-attention kausal, enam lapisan transformer, loss dan gelung latihan. 201 baris dan 10,745,088 parameter, benar-benar dilatih pada RTX 3080. APA YANG DIPERLUKAN - Python 3.10 atau lebih baharu (di sini 3.13.5) dan PyTorch 2.x (di sini 2.7.1 dengan CUDA 11.8) - Mana-mana GPU NVIDIA 8 GB atau lebih, atau T4 percuma di Colab; pada CPU ia berjalan tetapi jauh lebih perlahan - Kira-kira 4 GB cakera untuk Python, PyTorch dan fail teks 1.1 MB - Tiada alat berbayar, tiada kunci API dan tiada pengalaman deep learning terdahulu Tutorial bebas. Tidak bergabung dengan OpenAI, GitHub, PyTorch, Python atau mana-mana syarikat yang ditunjukkan. Tiada bayaran, penajaan atau produk percuma diterima. Semua tanda dagangan milik pemiliknya. “GPT” digunakan secara deskriptif untuk keluarga model ini. Kod dan nombor adalah untuk pendidikan, tanpa jaminan. [nl] Zelf een GPT bouwen in Python (201 regels, 10,7 miljoen parameters) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn HOOFDSTUKKEN 0:00 Waarom een GPT bouwen 0:24 Tokens en data 0:58 De bigram-grens 1:25 Attention vanaf nul 2:25 Het model trainen 3:20 Genereren en samplen 3:52 De bugs die je tegenkomt 4:15 Wat volgt We bouwen een compleet character-level GPT in één Python-bestand: tokenizer, embeddings, causale self-attention, zes transformer-lagen, loss en trainingsloop. 201 regels en 10.745.088 parameters, echt getraind op een RTX 3080. VEREISTEN - Python 3.10 of nieuwer (hier 3.13.5) en PyTorch 2.x (hier 2.7.1 met CUDA 11.8) - Elke NVIDIA-GPU met 8 GB of meer, of een gratis T4 in Colab; op CPU werkt het, maar veel langzamer - Ongeveer 4 GB schijf voor Python, PyTorch en het tekstbestand van 1,1 MB - Geen betaalde tools, geen API-sleutel en geen ervaring met deep learning nodig Onafhankelijke tutorial. Niet verbonden aan OpenAI, GitHub, PyTorch, Python of een getoond bedrijf. Er is geen betaling, sponsoring of gratis product ontvangen. Alle handelsmerken zijn eigendom van hun eigenaren. ‘GPT’ wordt beschrijvend gebruikt voor de modelfamilie. Code en cijfers zijn educatief, zonder garantie. [no] Bygg en GPT fra bunnen av i Python (201 linjer, 10,7 millioner parametere) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn KAPITLER 0:00 Hvorfor bygge en GPT 0:24 Tokens og data 0:58 Bigram-taket 1:25 Attention fra bunnen 2:25 Trene modellen 3:20 Generering og sampling 3:52 Feilene du vil møte 4:15 Hva kommer nå Vi bygger en komplett tegnbasert GPT i én Python-fil: tokenizer, embeddinger, kausal self-attention, seks transformer-lag, tap og treningsløkke. 201 linjer og 10 745 088 parametere, faktisk trent på et RTX 3080. DU TRENGER - Python 3.10 eller nyere (her 3.13.5) og PyTorch 2.x (her 2.7.1 med CUDA 11.8) - Et NVIDIA-kort med 8 GB eller mer, eller en gratis T4 på Colab; på CPU virker det, men mye tregere - Rundt 4 GB disk til Python, PyTorch og tekstfilen på 1,1 MB - Ingen betalverkøy, ingen API-nøkkel og ingen erfaring med deep learning fra før Uavhengig veiledning. Ikke tilknyttet OpenAI, GitHub, PyTorch, Python eller noe selskap som vises. Ingen betaling, sponsing eller gratis produkt er mottatt. Alle varemerker tilhører eierne sine. «GPT» brukes beskrivende om modellfamilien. Kode og tall er pedagogiske og gis uten garanti. [pa] Python ਵਿੱਚ ਸਿਫ਼ਰ ਤੋਂ GPT ਬਣਾਓ (201 ਲਾਈਨਾਂ, 10.7 ਮਿਲੀਅਨ ਪੈਰਾਮੀਟਰ) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn ਅਧਿਆਏ 0:00 GPT ਕਿਉਂ ਬਣਾਈਏ 0:24 ਟੋਕਨ ਅਤੇ ਡੇਟਾ 0:58 ਬਾਈਗ੍ਰਾਮ ਦੀ ਹੱਦ 1:25 ਸਿਫ਼ਰ ਤੋਂ attention 2:25 ਮਾਡਲ ਦੀ ਸਿਖਲਾਈ 3:20 ਜਨਰੇਸ਼ਨ ਅਤੇ ਸੈਂਪਲਿੰਗ 3:52 ਉਹ ਬੱਗ ਜੋ ਤੁਹਾਨੂੰ ਮਿਲਣਗੇ 4:15 ਅੱਗੇ ਕੀ ਇੱਕ ਹੀ Python ਫ਼ਾਈਲ ਵਿੱਚ ਪੂਰਾ character-level GPT ਬਣਾਉਂਦੇ ਹਾਂ: ਟੋਕਨਾਈਜ਼ਰ, ਐਂਬੈਡਿੰਗ, ਕਾਜ਼ਲ self-attention, ਛੇ ਟ੍ਰਾਂਸਫਾਰਮਰ ਲੇਅਰਾਂ, ਲੌਸ ਅਤੇ ਟ੍ਰੇਨਿੰਗ ਲੂਪ। 201 ਲਾਈਨਾਂ ਅਤੇ 10,745,088 ਪੈਰਾਮੀਟਰ, ਅਸਲੀ RTX 3080 ਉੱਤੇ ਸਿਖਲਾਈ ਪ੍ਰਾਪਤ। ਕੀ ਲੋੜ ਹੈ - Python 3.10 ਜਾਂ ਨਵਾਂ (ਇੱਥੇ 3.13.5) ਅਤੇ PyTorch 2.x (ਇੱਥੇ CUDA 11.8 ਨਾਲ 2.7.1) - 8 GB ਜਾਂ ਵੱਧ ਵਾਲਾ ਕੋਈ ਵੀ NVIDIA GPU, ਜਾਂ Colab ਉੱਤੇ ਮੁਫ਼ਤ T4; CPU ਉੱਤੇ ਚੱਲਦਾ ਹੈ ਪਰ ਬਹੁਤ ਹੌਲੀ - Python, PyTorch ਅਤੇ 1.1 MB ਟੈਕਸਟ ਫ਼ਾਈਲ ਲਈ ਲਗਭਗ 4 GB ਡਿਸਕ - ਕੋਈ ਪੇਡ ਟੂਲ, API ਕੀ ਜਾਂ ਪਹਿਲਾਂ ਦਾ deep learning ਤਜਰਬਾ ਲੋੜੀਂਦਾ ਨਹੀਂ ਸੁਤੰਤਰ ਟਿਊਟੋਰੀਅਲ। OpenAI, GitHub, PyTorch, Python ਜਾਂ ਦਿਖਾਈ ਕਿਸੇ ਕੰਪਨੀ ਨਾਲ ਸੰਬੰਧਿਤ ਨਹੀਂ। ਕੋਈ ਭੁਗਤਾਨ, ਸਪਾਂਸਰਸ਼ਿਪ ਜਾਂ ਮੁਫ਼ਤ ਉਤਪਾਦ ਨਹੀਂ ਮਿਲਿਆ। ਸਾਰੇ ਟ੍ਰੇਡਮਾਰਕ ਉਨ੍ਹਾਂ ਦੇ ਮਾਲਕਾਂ ਦੇ ਹਨ। “GPT” ਮਾਡਲ ਪਰਿਵਾਰ ਲਈ ਵਰਣਨਾਤਮਕ ਤੌਰ ’ਤੇ ਵਰਤਿਆ ਗਿਆ ਹੈ। ਕੋਡ ਅਤੇ ਅੰਕੜੇ ਸਿੱਖਿਅਕ ਹਨ, ਵਾਰੰਟੀ ਨਹੀਂ। [pl] Jak zbudować GPT od zera w Pythonie (201 linii, 10,7 mln parametrów) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn ROZDZIAŁY 0:00 Po co budować GPT 0:24 Tokeny i dane 0:58 Granica bigramu 1:25 Attention od zera 2:25 Trening modelu 3:20 Generowanie i próbkowanie 3:52 Błędy, które napotkasz 4:15 Co dalej Budujemy kompletny GPT znakowy w jednym pliku Pythona: tokenizer, embeddingi, przyczynową self-attention, sześć warstw transformera, funkcję straty i pętlę treningu. 201 linii i 10 745 088 parametrów, naprawdę wytrenowanych na RTX 3080. WYMAGANIA - Python 3.10 lub nowszy (tutaj 3.13.5) i PyTorch 2.x (tutaj 2.7.1 z CUDA 11.8) - Dowolny GPU NVIDIA z 8 GB lub więcej albo darmowa T4 w Colab; na CPU działa, ale znacznie wolniej - Około 4 GB dysku na Pythona, PyTorch i plik tekstowy 1,1 MB - Bez płatnych narzędzi, bez klucza API i bez wcześniejszego doświadczenia w deep learningu Niezależny samouczek. Niepowiązany z OpenAI, GitHub, PyTorch, Python ani żadną pokazaną firmą. Nie otrzymano płatności, sponsorowania ani darmowego produktu. Wszystkie znaki towarowe należą do ich właścicieli. „GPT” użyto opisowo dla rodziny modeli. Kod i liczby mają charakter edukacyjny, bez gwarancji. [pt] Como construir um GPT do zero em Python (201 linhas, 10,7 milhões de parâmetros) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn CAPÍTULOS 0:00 Por que construir um GPT 0:24 Tokens e dados 0:58 O limite do bigrama 1:25 Atenção do zero 2:25 Treinar o modelo 3:20 Geração e amostragem 3:52 Erros que você vai encontrar 4:15 O que vem depois Montamos um GPT completo em nível de caractere em um único arquivo Python: tokenizador, embeddings, autoatenção causal, seis camadas de transformer, função de perda e loop de treino. 201 linhas e 10.745.088 parâmetros, treinados de verdade em uma RTX 3080. REQUISITOS - Python 3.10 ou superior (aqui 3.13.5) e PyTorch 2.x (aqui 2.7.1 com CUDA 11.8) - Qualquer GPU NVIDIA com 8 GB ou mais, ou uma T4 gratuita no Colab; na CPU funciona, mas é bem mais lento - Cerca de 4 GB de disco para Python, PyTorch e o arquivo de texto de 1,1 MB - Sem ferramentas pagas, sem chave de API e sem experiência prévia em deep learning Tutorial independente. Sem vínculo com OpenAI, GitHub, PyTorch, Python ou qualquer empresa mostrada. Não houve pagamento, patrocínio ou produto gratuito. Todas as marcas pertencem aos seus donos. “GPT” é usado de forma descritiva para a família de modelos. Código e números são educativos e não têm garantia. [pt-BR] Crie um GPT do zero em Python (201 linhas, 10,7M de parâmetros) Downloads e documentação oficiais: Python — python.org PyTorch — pytorch.org nanoGPT (MIT, Andrej Karpathy) — karpathy/nanoGPT Conjunto de dados Tiny Shakespeare — karpathy/char-rnn CAPÍTULOS 0:00 Por que construir um GPT 0:24 Tokens e dados 0:58 O limite inferior dos bigramas 1:25 Atenção do zero 2:25 Treinando o modelo 3:20 Geração e amostragem 3:52 Bugs que você encontrará 4:15 O que vem a seguir O QUE VOCÊ VAI CONSTRUIR Um GPT completo em nível de caractere em um único arquivo Python: tokenizador, embeddings, autoatenção causal, um transformer de 6 camadas, perda de entropia cruzada, o loop de treinamento e amostragem. 201 linhas, 10.745.088 parâmetros, vocabulário de 65 caracteres, janela de contexto de 256 caracteres. REQUISITOS - Python 3.10 ou mais recente (esta versão: Python 3.13.5) e PyTorch 2.x (esta versão: 2.7.1 + CUDA 11.8) - Qualquer GPU NVIDIA com 8 GB ou mais, ou uma Colab T4 gratuita; O processador funciona, mas o treinamento é muito mais lento. - 4 GB de disco para Python, PyTorch e o arquivo de texto Tiny Shakespeare de 1,1 MB. - Sem ferramentas pagas, sem chave de API, sem conta na nuvem, sem experiência prévia em aprendizado profundo. - Cerca de 25 minutos: a execução de 5.000 passos neste vídeo levou 1.273 segundos em uma RTX 3080. O QUE HÁ DENTRO O vídeo é honesto sobre o resultado: a perda de treinamento cai de 4,27 para 0,31, a perda de validação atinge o mínimo de 1,48 por volta do passo 1.500 e depois sobe para 2,19 à medida que o modelo memoriza o corpus de um megabyte. Os mapas de atenção, a contagem de parâmetros e os tempos são medidos a partir do checkpoint treinado na tela, não copiados de um artigo. Tutorial independente. Não afiliado à OpenAI, GitHub, PyTorch, Python ou qualquer empresa mostrada. Nenhum pagamento, patrocínio ou produto gratuito foi recebido. Todas as marcas registradas pertencem aos seus respectivos proprietários. "GPT" é usado descritivamente para a família de modelos. O código e os números são fornecidos para fins educacionais, sem garantia; verifique as versões nas fontes oficiais acima antes de instalar. [ro] Construiește un GPT de la zero în Python (201 linii, 10,7 milioane de parametri) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn CAPITOLE 0:00 De ce să construiești un GPT 0:24 Tokeni și date 0:58 Limita bigramelor 1:25 Attention de la zero 2:25 Antrenarea modelului 3:20 Generare și eșantionare 3:52 Erorile pe care le vei întâlni 4:15 Ce urmează Construim un GPT complet la nivel de caracter într-un singur fișier Python: tokenizator, embeddings, self-attention cauzal, șase straturi transformer, funcția de pierdere și bucla de antrenare. 201 linii și 10.745.088 parametri, antrenați efectiv pe un RTX 3080. CE AI NEVOIE - Python 3.10 sau mai nou (aici 3.13.5) și PyTorch 2.x (aici 2.7.1 cu CUDA 11.8) - Orice GPU NVIDIA cu 8 GB sau mai mult, sau un T4 gratuit pe Colab; pe CPU funcționează, dar mult mai lent - Aproximativ 4 GB de disc pentru Python, PyTorch și fișierul text de 1,1 MB - Fără instrumente plătite, fără cheie API și fără experiență anterioară în deep learning Tutorial independent. Neafiliat cu OpenAI, GitHub, PyTorch, Python sau orice companie prezentată. Nu s-a primit nicio plată, sponsorizare sau produs gratuit. Toate mărcile aparțin proprietarilor. „GPT” este folosit descriptiv pentru familia de modele. Codul și cifrele sunt educaționale, fără garanție. [ru] Как собрать GPT с нуля на Python (201 строка, 10,7 млн параметров) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn ГЛАВЫ 0:00 Зачем собирать GPT 0:24 Токены и данные 0:58 Предел биграмм 1:25 Attention с нуля 2:25 Обучение модели 3:20 Генерация и сэмплирование 3:52 Ошибки, которые вас ждут 4:15 Что дальше Собираем полноценный символьный GPT в одном файле Python: токенизатор, эмбеддинги, причинное self-attention, шесть слоёв трансформера, функция потерь и цикл обучения. 201 строка и 10 745 088 параметров, обученных на реальной RTX 3080. ЧТО НУЖНО - Python 3.10 или новее (здесь 3.13.5) и PyTorch 2.x (здесь 2.7.1 с CUDA 11.8) - Любая видеокарта NVIDIA от 8 ГБ или бесплатная T4 в Colab; на CPU работает, но намного медленнее - Около 4 ГБ на диске для Python, PyTorch и текстового файла на 1,1 МБ - Без платных инструментов, без API-ключа и без опыта в глубоком обучении Независимый обучающий ролик. Не связан с OpenAI, GitHub, PyTorch, Python или любой показанной компанией. Оплата, спонсорство или бесплатный продукт не получены. Все торговые марки принадлежат их владельцам. «GPT» используется описательно для семейства моделей. Код и цифры приведены в образовательных целях, без гарантий. [sv] Bygg en GPT från grunden i Python (201 rader, 10,7 miljoner parametrar) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn KAPITEL 0:00 Varför bygga en GPT 0:24 Tokens och data 0:58 Bigram-taket 1:25 Attention från grunden 2:25 Träna modellen 3:20 Generering och sampling 3:52 Buggar du kommer att möta 4:15 Vad händer härnäst Vi bygger en komplett teckenbaserad GPT i en enda Python-fil: tokenizer, embeddings, kausal self-attention, sex transformer-lager, förlustfunktion och träningsloop. 201 rader och 10 745 088 parametrar, faktiskt tränade på ett RTX 3080. DU BEHÖVER - Python 3.10 eller nyare (här 3.13.5) och PyTorch 2.x (här 2.7.1 med CUDA 11.8) - Ett NVIDIA-grafikkort med 8 GB eller mer, eller en gratis T4 på Colab; på CPU fungerar det men mycket långsammare - Cirka 4 GB disk för Python, PyTorch och textfilen på 1,1 MB - Inga betalverktyg, ingen API-nyckel och ingen tidigare erfarenhet av deep learning Oberoende handledning. Inte knuten till OpenAI, GitHub, PyTorch, Python eller något företag som visas. Ingen betalning, sponsring eller gratis produkt har tagits emot. Alla varumärken tillhör sina ägare. ”GPT” används beskrivande för modellfamiljen. Kod och siffror är pedagogiska och lämnas utan garanti. [ta] Python-ல் பூஜ்யத்திலிருந்து GPT உருவாக்குதல் (201 வரிகள், 10.7 மில்லியன் அளவுருக்கள்) Python — python.org PyTorch — pytorch.org nanoGPT (MIT) — karpathy/nanoGPT Tiny Shakespeare dataset — karpathy/char-rnn அத்தியாயங்கள் 0:00 ஏன் GPT உருவாக்க வேண்டும் 0:24 டோக்கன்கள் மற்றும் தரவு 0:58 பைகிராம் வரம்பு 1:25 பூஜ்யத்திலிருந்து attention 2:25 மாடலைப் பயிற்றுவித்தல் 3:20 உருவாக்கம் மற்றும் மாதிரி எடுத்தல் 3:52 நீங்கள் சந்திக்கும் பிழைகள் 4:15 அடுத்து என்ன ஒரே Python கோப்பில் முழுமையான character-level GPT உருவாக்குகிறோம்: டோக்கனைசர், எம்பெடிங்குகள், காசல் self-attention, ஆறு டிரான்ஸ்ஃபார்மர் அடுக்குகள், இழப்பு மற்றும் பயிற்சி சுழற்சி. 201 வரிகள், 10,745,088 அளவுருக்கள், உண்மையான RTX 3080-ல் பயிற்றுவிக்கப்பட்டது. தேவையானவை - Python 3.10 அல்லது அதற்கு மேல் (இங்கு 3.13.5) மற்றும் PyTorch 2.x (இங்கு CUDA 11.8 உடன் 2.7.1) - 8 GB அல்லது அதற்கு மேல் உள்ள எந்த NVIDIA GPU அல்லது Colab-ல் இலவச T4; CPU-ல் இயங்கும் ஆனால் மிக மெதுவாக - P

    1 like · 1 comment · 44 views
  10. 想弄清楚神经网络里的反向传播,可以看 Karpathy 的 micrograd。 自动求导引擎大约 100 行,神经网络部分大约 50 行,处理的是标量运算。项目虽然小,但能把计算图怎么建立、梯度怎么往回传这些过程展示出来。 它适合拿来读代码和学习,不是拿来训练大模型的框架。 karpathy/micrograd

    5 likes · 186 views
Trending awards, every completed day and week
Gold
421st place finishes
Silver
172nd place finishes
Bronze
243rd place finishes
Awarded repositories
11Owned by karpathy now

Repositories

Ordered by gold, then silver, then bronze.

  1. LLM101nBest: 1st by stars, 8,466 stars1214
  2. llm.cBest: 1st by stars, 13,508 stars921
  3. llama2.cBest: 1st by stars, 8,280 stars721
  4. nanochatBest: 1st by stars, 5,452 stars622
  5. minGPTBest: 1st by stars, 3,871 stars311
  6. llm-councilBest: 1st by stars, 1,029 stars220
  7. nanoGPTBest: 1st by stars, 2,232 stars133
  8. autoresearchBest: 1st by stars, 2,106 stars127
  9. minbpeBest: 1st by stars, 951 stars122
  10. neuraltalkBest: 3rd by stars, 547 stars002
  11. reader3Best: 3rd by stars, 312 stars001

A repository earns an award for finishing first, second or third in a completed trending day or week, ranked by new stars, new forks or pull request authors. Awards follow a repository through renames and transfers and count toward its current owner. Weeks run Monday to Sunday, UTC.