This commit is contained in:
2025-12-31 16:00:29 +00:00
commit 3688f93d5d
310 changed files with 93400 additions and 0 deletions

317
2023/04/05/ai.html Normal file
View File

@@ -0,0 +1,317 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>关于最近人工智能的探索 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="关于最近人工智能的探索" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="最近人工智能发展的还真是不错啊……" />
<meta property="og:description" content="最近人工智能发展的还真是不错啊……" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2023-04-05T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="关于最近人工智能的探索" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2023-04-05T00:00:00+08:00","datePublished":"2023-04-05T00:00:00+08:00","description":"最近人工智能发展的还真是不错啊……","headline":"关于最近人工智能的探索","mainEntityOfPage":{"@type":"WebPage","@id":"/2023/04/05/ai.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2023/04/05/ai.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2023/04/05/ai.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1767196818" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Thu, 01 Jan 2026 00:00:18 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2023-04-05T00:00:00+08:00">5 April 2023</time> - 字数统计2705 - 阅读大约需要8分钟 - Hits: <span id="/2023/04/05/ai.html" class="visitors">Loading...</span></small>
<h1 class="p-name">关于最近人工智能的探索</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Wed, 05 Apr 2023 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章讲述了人工智能特别是LLM大型语言模型领域近期的发展以ChatGPT和相关模型如Alpaca为例。作者提到开源社区如GitHub上的llama.cpp项目让AI技术更加亲民即使是在资源有限的设备上也能体验到。斯坦福大学的Finetune技术使得AI模型性能提升而成本较低的LoRA方法使得AI训练更加普及作者还分享了自己的实践经验如使用不同设备运行不同规模的模型。此外作者对开源社区的AI发展持乐观态度希望未来能在低成本情况下提高效率但也表达了对技术被商业化和不平等竞争的担忧。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#关于llama衍生的模型体验">关于LLaMA衍生的模型体验</a></li><li><a href="#让m2芯片发挥更大的作用">让M2芯片发挥更大的作用</a></li><li><a href="#感想">感想</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>最近人工智能发展的还真是不错啊……<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>最近ChatGPT为代表的人工智能发展的越来越好了而且因为它对生产力的提升使得了解AI的人也越来越多了。虽然我也不算是对AI很感兴趣但是我在Github Copilot刚出的时候就已经用上了到现在一直在用不过毕业了以后估计就用不了了吧😂。不过那时候Copilot毕竟专业性比较高知道的人也比较少不像现在ChatGPT能在各行各业使用甚至还有基于类似模型的Vtuber比如<a href="https://www.twitch.tv/vedal987">Neuro-sama</a>,所以即使是普通人使用它,都能够减轻自己的工作压力,所以现在的人们都在讨论它。 </p><p>
当然在这之前还有一些很厉害的画图AI比如使用了Stable Difusion的NovalAI以及Midjourney啥的不过因为我对画图并不感兴趣所以它发展的有多好也基本上和我没有关系。其实除了这些能够AIGC的模型之外在那之前还有下围棋的AlphaGO啥的那个我就更不感兴趣了相信大多数人也不感兴趣所以总的来看也就只有现在才能证明AI发展到了能够让大家觉得能干涉到更多人的地步吧。 </p><p>
也正因为现在以ChatGPT为代表的LLM的发展开源社区也开始搞起来一些有意思的东西。不过LLM的训练成本比较高所以现在开源社区在这一块的发展也许得感谢比如Facebook的<a href="https://github.com/facebookresearch/llama">LLaMA</a>之类基础的模型才能让大家能用较低的成本去训练属于自己的AI吧。</p>
<h1 id="关于llama衍生的模型体验">
<a href="#关于llama衍生的模型体验"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 关于LLaMA衍生的模型体验
</h1>
<p>在刚开始LLaMA被Facebook开源的时候GitHub上就出现了<a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a>这个项目因为我没钱买显卡手头只有笔记本电脑上的一张非常垃圾的GTX1650Ti 4GiB显存的显卡多亏了这个项目可以让我这种没显卡的人也能体验LLM的乐趣。而且这个项目使用起来非常简单不像很多AI项目还要装什么TensorFlow啊还是什么PyTorch啥的那些东西不仅大还非常的挑版本这个项目运行的时候就什么都不用考虑对使用者来说非常的友好像清华那个<a href="https://github.com/THUDM/ChatGLM-6B">ChatGLM-6B</a>我就完全跑不了它要想正常体验得要有8GiB的显存我就没法整这种东西了。 </p><p>
我体验了那个最开始的LLaMA-7B的模型效果其实不怎么样根本没法流畅对话不过也能理解因为它应该相当于是把一堆数据堆到一起的东西吧也没有针对对话进行训练。不过很快斯坦福大学对这个模型进行了Finetune制作出了<a href="https://github.com/tatsu-lab/stanford_alpaca">Alpaca</a>当然这个仓库里面的东西是纯粹的菜谱和食材把他们加工成模型得要整一堆A100的显卡跑几个小时这个我可整不来不过还好有人根据这个原材料加工成了完整的模型现在去🤗上就能下载的到比如去<a href="https://huggingface.co/chavinlo/alpaca-native">这个仓库</a>就能下载到训练好的模型,在<a href="https://huggingface.co/Pi3141/alpaca-native-7B-ggml">这里</a>可以下载到已经经过量化直接可以给llama.cpp使用的版本不过现在llama.cpp升级了得要按照说明在仓库里执行那个Python脚本进行转换才能正常使用</p><p>
我运行这些东西是在我的Macbook Pro上它只有8GiB的内存所以只能跑7B70亿参数的模型不过就这个模型也已经非常厉害了虽然只能说英文但是流畅程度上下文关系的能力都非常不错而且常见的知识都能正确回答效果让我很满意。不过8GiB内存实在是太小了想跑点别的也没办法……不过16GiB内存的电脑我还是能找得到的我找了台CPU是i7-11700K的台式机跑了下<a href="https://huggingface.co/Pi3141/gpt4-x-alpaca-native-13B-ggml">使用GPT-4对话数据微调的13B模型</a>速度比M2芯片跑的速度感觉慢了至少5倍吧Macbook生成的速度基本上能达到对话的语速台式机跑的速度那就是一个一个词往出蹦这下就能感受到M2芯片的计算能力还是强大啊4大核+4小核比8核16线程还要厉害苹果的产品属实有点东西😝不过这个13B的模型也确实厉害有些7B的模型回答有错误的部分这个13B的都能正确回答如果我能整个16GiB的Macbook可能就能完整体验了吧可惜苹果家的内存比金子都贵实在是买不起啊…… </p><p>
斯坦福的这种Finetune方法成本还是有点高所以后来又有人研究出了一个叫<a href="https://arxiv.org/pdf/2106.09685.pdf">LoRA</a>的办法去Finetune模型据说只要一张普通的显卡就可以进行不需要一堆高级显卡也能跑不过再低级的显卡也不是我这GTX1650Ti能碰瓷的所以我也只能看看别人训练的模型啦。在看的时候我发现了一个用的中文训练集跑的模型项目<a href="https://github.com/ymcui/Chinese-LLaMA-Alpaca">Chinese-LLaMA-Alpaca</a>看起来还挺有意思的不过他们似乎担心什么版权问题只放出了LoRA权重没有完整的模型就相当于是没有面饼的泡面只有料包好在他们倒是给了去哪里找面饼。不过泡面的这个过程对我来说也挺难的合并它需要13-15GiB的可用内存16GiB的内存肯定不够用所以得找一台32GiB内存的电脑不会有人组非2次方倍数内存的电脑吧……我手头没有还好从网上找了台免费的云主机整了个32GiB内存的才成功的把这碗面泡出来了。虽然泡面的步骤不多也不算特别难只是我是觉得干嘛同一碗面泡那么多次不如我提前泡好直接放网上所以我也在🤗上上传了最终合并并量化的模型<a href="https://huggingface.co/Mabbs/chinese-Alpaca-lora-7b-ggml">在这里</a>就能下载到直接就能拿来用的模型了。至于运行的参数就按照之前仓库的操作就行了。</p>
<h1 id="让m2芯片发挥更大的作用">
<a href="#让m2芯片发挥更大的作用"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 让M2芯片发挥更大的作用
</h1>
<p>在我玩完那个llama.cpp项目之后我觉得让M2芯片光用CPU算好浪费啊毕竟这个芯片里面还有神经网络引擎和GPU啊这些哪个都比CPU算更好吧不过想要调那些东西进行人工智能计算貌似只能用苹果的Core ML框架。这两天我在Github看到一个苹果官方发布的<a href="https://github.com/apple/ml-stable-diffusion">Core ML Stable Diffusion</a>看起来还挺有意思的我倒是也想在我的Macbook上跑一下正好🤗开发了一个示例<a href="https://apps.apple.com/app/diffusers/id1666309574">Diffusers</a>可以拿来试试看可惜8GiB内存还是限制了它的发挥跑是能跑速度也挺快的就是模型没法换因为内存也只能跑小的模型跑出来可以说真的就是那种抽象的不能再抽象的东西吧……不过不管怎么说这还是发挥了一下神经网络引擎和GPU的作用吧不然感觉苹果做了这些东西就没啥作用了😂。</p>
<h1 id="感想">
<a href="#感想"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 感想
</h1>
<p>从这次体验来看我对开源社区的AI发展感觉还是挺有信心的虽然相比于ChatGPT之类的来说可能还没办法当作生产力不过毕竟它比较平民化至于知识量少的问题如果开发者们能加把油能让这些模型对接网络那也许就可以在很低成本的情况代替OpenAI的ChatGPT吧也能避免他们服务器出问题之类的原因导致生产力的下降吧。不过开源这种事情还是有点……毕竟还是不希望这些东西被人拿去商业化更不希望出现国外一开源国内就自研这种糟糕情况也许开源产品比不上人家的商业产品也是正常的。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=AI"><em>AI</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=LLM"><em>LLM</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD"><em>人工智能</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2023-04-05-ai.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2023/04/05/ai.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2023/03/12/php-async.html">
上一篇PHP异步执行的探索
</a>
</span>
<br />
<span class="next">
<a href="/2023/05/22/rpi-win.html">
下一篇使用树莓派安装Windows的尝试
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2023/04/05/ai', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2023/04/05/ai.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-01-01 00:00:18<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>