https://eugeneyan.com/rss 09月30日 19:10
Raspberry-LLM让树莓派更智能
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

作者探索了如何在低资源环境中使用大型语言模型,如将它们集成到树莓派等家用设备中。通过GitHub项目‘raspberry-llm’,作者展示了如何利用树莓派和电子墨水屏调用新闻和黑客新闻的RSS源,以及第三方语言模型API来生成特定风格的内容,例如模仿苏斯博士的风格、制造虚假的华尔街日报引语,甚至生成黑客新闻的恶意评论。整个过程挑战了内存限制,作者不得不逐字符解析RSS源,学习内存消耗,并频繁调用垃圾回收。尽管困难重重,作者最终成功让树莓派以幽默的方式解释新闻标题,展示了语言模型在资源受限环境下的潜力。

🔧 项目‘raspberry-llm’展示了如何将大型语言模型集成到树莓派等低资源设备中,通过调用新闻和黑客新闻的RSS源以及第三方语言模型API,生成特定风格的内容,如模仿苏斯博士、制造虚假华尔街日报引语或生成恶意评论。

📊 由于树莓派的内存限制(仅8KB),作者不得不逐字符解析RSS源,学习内存消耗,并频繁调用垃圾回收,以管理内存使用。

🎨 作者成功让树莓派以幽默的方式解释新闻标题,例如用苏斯博士的风格或华尔街日报的虚假引语,展示了语言模型在资源受限环境下的创意应用。

🖥️ 项目还涉及在电子墨水屏上绘制文本,尽管内存限制使得常见库(如json、xmltodict)不可用,但作者通过自定义解析和垃圾回收机制克服了这些挑战。

🌐 作者提供了GitHub代码库和配置文件secrets.py的更新指南,允许其他用户尝试该项目,并强调了开源贡献的重要性。

As I continue my exploration with large language models, I wondered how they might be used in a low-resource setting, such as a household appliance or a Raspberry Pico. I was also curious about how good they were with generating content in a particular style (e.g., Dr. Seuss), humour (e.g., fake WSJ quotes), and toxic (e.g., HackerNews troll comments).

To satisfy my curiosity, I hacked on raspberry-llm (Github). It’s a simple Raspberry Pico with an e-ink screen that calls WSJ and HackerNews RSS feeds, 3rd-party LLM APIs, and generates some content. It started with a rhyming clock, and then… well you’ll see.

• • •


While some use LLMs to disrupt industries and more,

Others build ChatGPT plugins, pushing boundaries galore.

Yet here I am with my Raspberry Pi loose,

Using LLMs to explain headlines via Dr. Seuss.

You'll find that it can be quite witty,

Making up fake quotes from celebrithttps://eugeneyan.com/assets/headline-quote.webps/headline-quote.webp" loading="lazy" title="Image" alt="Image">

It can also pose as a hackernews troll,

Slinging mean comments, and https://eugeneyan.comhttps://eugeneyan.com/assets/hackernews.webp

It all started with getting it to tell the time,


• • •

Overall, it was a fun experience learning how to work with only 8kb of memory(!) and Micro Python. Given the memory constraints, common libraries (e.g., json, xmltodict) were unavailable on the Pico. And even if they were, I couldn’t load the entire RSS feed into memory before parsing it via xmltodict.parse().

As a result, I had to parse RSS feeds character by character, learn how much memory was consumed at each step, and do lots of gc.collect(). It was also fun learning to draw on an e-ink screen (the helper functions made it easier than expected).

To try it, clone this GitHub repo and update your wifi and OpenAI credentials in secrets.py.

OG image prompt on MidJourney: “An e-ink display connected to a raspberry pi displaying some text –ar 2:1”

If you found this useful, please cite this write-up as:

Yan, Ziyou. (Apr 2023). Raspberry-LLM - Making My Raspberry Pico a Little Smarter. eugeneyan.com. https://eugeneyan.com/writing/raspberry-llm/.

or

@article{yan2023raspberry,  title   = {Raspberry-LLM - Making My Raspberry Pico a Little Smarter},  author  = {Yan, Ziyou},  journal = {eugeneyan.com},  year    = {2023},  month   = {Apr},  url     = {https://eugeneyan.com/writing/raspberry-llm/}}
Share on:

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Raspberry Pi 语言模型 低资源环境 电子墨水屏 开源项目
相关文章