从零开始实现GPT(1)
大模型(LLM)需要大量的算力,从而导致大部分人没办法像旧时代一样轻易的参与AI时代的编程。网上也有很多从零开始写GPT的例子,我们也可以这么做。对于数据和算力的需求,可以通过把目标定的比较小的方式来实现。
先开个头,随时更新。
//
可以从这里开始:https://github.com/karpathy/nanoGPT
但是有一个疑问是nanoGPT对标的是哪个版本的GPT?make it run,先本地能跑起来最重要。
//
ollama 和 llama.cpp 把开源模块的下载,安装,启动服务都做了很多集成。通过这两个工具可以快速体验最新开源llm的效果,并且产生做上层应用的想法。
用 ollama 在 Macbook Pro M1 Max 32G 上安装 Google LLM gemma-7b
下载地址(文件大小 17G)
ollama.com/library/gemma
运行指令
ollama run gemma:7b-instruct-fp16
// 向量化推理库
https://github.com/huggingface/text-embeddings-inference
// GGUF
大模型文件格式浅析
https://vickiboykis.com/2024/02/28/gguf-the-long-way-around/
// 拆解Llama3,一步步构造组装
https://github.com/naklecha/llama3-from-scratch
// Deep Reinforcement Learning: Zero to Hero!
https://github.com/alessiodm/drl-zh
// Numpy版本 Llama
https://github.com/likejazz/llama3.np
https://github.com/hscspring/llama.np
// GPU编程语言
bend: https://github.com/HigherOrderCO/bend/blob/main/GUIDE.md
另外一个是mojo:https://github.com/modularml/mojo
// The best way to test your understanding of neural networks, Lean by play game
https://graphgame.sabrina.dev/
// 直接支持GPU/CUDA的库
CUDA DataFrame: https://github.com/rapidsai/cudf
// 不依赖Python的大模型开发
https://github.com/karpathy/llm.c