惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
Vercel News
Vercel News
Recent Announcements
Recent Announcements
B
Blog RSS Feed
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
D
Docker
Jina AI
Jina AI
IT之家
IT之家
人人都是产品经理
人人都是产品经理
L
LangChain Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
博客园 - 叶小钗
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog

StudyingLover's Blog

Diffusion Policy笔记 rwkv笔记 act笔记 nanovllm-block_manager opencode多智能体 nanobot-pre-train nanobot-rl nanobot-sft nanobot-checkpoint_manager nanobot-gpt nanobot-mid-train Vision Mamba (Vim)笔记 BPE演示 最后一遍学习Transformer YOLOv5 目标检测笔记 下载根服务器解析记录 Dynaseal A Backend-Controlled LLM API Key Distribution Scheme with Constrained Invocation Parameters 判断链表有环 王道25数据结构勘误 关于perplexity的open-sourcing-r1-1776 AI为什么不像人类一样进行多轮对话 新博客改造日记和功能测试 linuxqq只显示登陆背景图 数字设计和计算机体系结构(机械工业出版社)勘误(自制) Dynaseal:面向未来端侧llm agent的llm api key分发机制 A Definitive Guide to Markdown Style This post is using MDX, Where you can embed JSX and Astro components RT-Patch学习 pydantic实现的LLM ReAct fastapi 和 uvicorn 设置监听 ipv6
快速上手llama2.c(更新版)
About the Author StudyingLover · 2023-07-29 · via StudyingLover's Blog

快速上手llama2.c(更新版)

在上一次我同时在我的博客和知乎发布了快速上手llama2.c 之后,我一个小透明也收获了不少收藏,并收到了人生中第一个这样的留言(其实我感觉是机器人)。

当然,之前的llama2.c也有一些不好的地方,例如不能添加自己的prompt,所以我提了这样的一个issue,今天收到了贡献者的回复说是可以用了。那我们来看一下。

首先还是克隆整个仓库,编译并下载模型,这里以15m参数的模型作为示例

git clone https://github.com/karpathy/llama2.c.git
cd llama2.c
make run
wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin

接下来我们就可以使用编译出来的run 运行了,要使用自己的prompt,需要指定温度和 步长,这里温度设置成1.0,步长设置256,prompt在双引号写,我这里写的是One day morning , I don't want to go to school .

./run stories15M.bin 1.0 256 "One day morning , I don't want to go to school"

这里给出我的运行结果,也就3秒种不到

<s>
One day morning , I don't want to go to school, so he packed his trunk lid to pack. memorized his chores, he thought about what his mom would like him to stay home and not do all day. She wanted him to in a very competitive way.
"Come and play in the puddle, it'll be more fun!"He begged.
Mom shook her head. "No, we haven't seen coming for sure," she said thought. 
Thumper and Mom just shrugged.
"See," she said. "Come on now. Let's go and find some fun ways to clean the world!"
The little boy was relieved and ran out to the yard. He had found a great idea to share his day with his mom instead. They scattered around the yard and had fun playing until their tired eyes were aching.
<s>
Once upon a time, there was a little boy named Tim. Tim was very excited because he was going on a trip with his family. He saw a big bus that helped them get off at their destination.
As the bus drove along, Tim noticed an unusual looking man sitting next to it. Tim asked the
achieved tok/s: 175.378267

当然为了获得更好的效果,我们可以使用更大模型

下载42m参数模型

wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories42M.bin

下载110m参数模型

wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.bin