<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
<channel>
<atom:link href="https://zeta.future-world.net/feed" rel="self" type="application/rss+xml"/>
<title>ゼタ </title>
<link>https://zeta.future-world.net</link>
<description>⛩️</description>
<language>zh-CN</language>
<copyright>© QixiQ </copyright>
<pubDate>Sun, 03 May 2026 12:00:25 GMT</pubDate>
<generator>Mix Space CMS (https://github.com/mx-space)</generator>
<docs>https://mx-space.js.org</docs>
<image>
    <url>https://zeta.future-world.net/api/v2/objects/avatar/vjhshj5jppqt4uvho2.png</url>
    <title>ゼタ </title>
    <link>https://zeta.future-world.net</link>
</image>
<item>
    <title>【深度学习模型训练】从链式法则到显存优化</title>
    <link>https://zeta.future-world.net/posts/ai/DeepLearn_1</link>
    <pubDate>Tue, 07 Apr 2026 13:19:47 GMT</pubDate>
    <description>本文以一个典型的三层多层感知机（MLP）为例，梳理神经网络前向传播与反向传播的数学基础，并在此基础上</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/posts/ai/DeepLearn_1'>https://zeta.future-world.net/posts/ai/DeepLearn_1</a></blockquote>
      <blockquote>
<p>本文以一个典型的三层多层感知机（MLP）为例，梳理神经网络前向传播与反向传播的数学基础，并在此基础上，从系统视角剖析单次训练迭代中的 GPU 显存占用情况及相应的显存优化策略。</p>
</blockquote>
<h2>一、 数学基础：基于链式法则的反向传播</h2>
<p>一个三层 MLP 模型，其参数矩阵分布为 <span class="katex-render">W_1, W_2, W_3</span>，输入为 <span class="katex-render">x</span>，真实标签为 <span class="katex-render">y</span>。</p>
<h3>1. 前向传播 (Forward Propagation)</h3>
<p>前向传播的核心是计算每一层的中间激活值（Activations）以及最终的预测值 <span class="katex-render">\hat{y}</span>。为保持表达严谨且简洁，省略偏置项并合并激活函数，各层计算过程可表示为：</p>
<ul>
<li><strong>第一层：</strong> <span class="katex-render">h_1 = f_1(W_1, x)</span></li>
<li><strong>第二层：</strong> <span class="katex-render">h_2 = f_2(W_2, h_1)</span></li>
<li><strong>第三层：</strong> <span class="katex-render">\hat{y} = f_3(W_3, h_2)</span></li>
</ul>
<p>从全局视角来看，整个前向传播是一个深度的嵌套复合函数，其最终的损失函数（Loss）计算如下：</p>
<p><span class="katex-render">$L = \text{Loss}(f_3(W_3, f_2(W_2, f_1(W_1, x))))$</span></p>
<h3>2. 反向传播 (Backpropagation)</h3>
<p>训练的核心目标是最小化误差 <span class="katex-render">L</span>。我们需要求解损失 <span class="katex-render">L</span> 对各层参数 <span class="katex-render">W</span> 的偏导数（梯度），即量化<strong>参数微小变化对最终误差的边际影响</strong>。该过程严格依赖微积分中的<strong>链式法则（Chain Rule）</strong>。</p>
<ul>
<li><p><strong>第三层梯度：</strong>
误差直接对 <span class="katex-render">W_3</span> 求导，等于总误差对预测值的偏导乘以预测值对 <span class="katex-render">W_3</span> 的偏导。</p>
<p><span class="katex-render">$ \frac{\partial L}{\partial W_3} = \frac{\partial L}{\partial \hat{y}} \cdot \frac{\partial \hat{y}}{\partial W_3} $</span></p>
</li>
<li><p><strong>第二层梯度：</strong>
误差需先传导至第二层的输出 <span class="katex-render">h_2</span>，再对 <span class="katex-render">W_2</span> 求导。</p>
<p><span class="katex-render">$ \frac{\partial L}{\partial W_2} = \underbrace{\frac{\partial L}{\partial \hat{y}} \cdot \frac{\partial \hat{y}}{\partial h_2}}_{\text{传导至 } h_2 \text{ 的误差}} \cdot \frac{\partial h_2}{\partial W_2} $</span></p>
</li>
<li><p><strong>第一层梯度：</strong>
同理，误差依次反向传播至第一层。</p>
<p><span class="katex-render">$ \frac{\partial L}{\partial W_1} = \frac{\partial L}{\partial \hat{y}} \cdot \frac{\partial \hat{y}}{\partial h_2} \cdot \frac{\partial h_2}{\partial h_1} \cdot \frac{\partial h_1}{\partial W_1} $</span></p>
</li>
</ul>
<h3>3. 参数更新 (Weight Update)</h3>
<p>获取各层梯度后，通过梯度下降（Gradient Descent）算法，结合学习率 <span class="katex-render">\eta</span> 对模型参数进行迭代更新：</p>
<ul>
<li><span class="katex-render">W_3 \leftarrow W_3 - \eta \cdot \frac{\partial L}{\partial W_3}</span></li>
<li><span class="katex-render">W_2 \leftarrow W_2 - \eta \cdot \frac{\partial L}{\partial W_2}</span></li>
<li><span class="katex-render">W_1 \leftarrow W_1 - \eta \cdot \frac{\partial L}{\partial W_1}</span></li>
</ul>
<hr>
<h2>二、 系统视角：单次迭代的 GPU 显存剖析</h2>
<p>在上述数学过程转化为工程代码并在 GPU 上执行时，显存（VRAM）的占用是制约模型规模的核心瓶颈。在一次 Forward + Backward 循环中，GPU 显存主要被以下两类数据占据：</p>
<h3>1. 静态与输入数据</h3>
<ul>
<li><strong>模型参数 (Model Parameters):</strong> 即上述的 <span class="katex-render">W_1, W_2, W_3</span>。</li>
<li><strong>输入与标签 (Inputs &amp; Labels):</strong> 维度通常为 <code>Batch_Size</code> <span class="katex-render">\times</span> 数据维度的大小。</li>
</ul>
<h3>2. 动态生成数据（训练时激增的开销）</h3>
<ul>
<li><strong>中间激活值 (Activations, <span class="katex-render">H</span>):</strong> 
在计算链式法则时，反向传播需要用到前向传播的中间结果（如 <span class="katex-render">h_1, h_2</span>）。因此这些状态必须驻留在显存中 (直到计算出 <code>n-1</code>
层才会释放内存)，其占用大小与 <code>Batch_Size</code>  <code>输入序列长度</code> 呈严格的线性正相关关系。</li>
<li><strong>参数梯度 (Gradients, <span class="katex-render">\nabla W</span>):</strong> 
大小与模型参数 <span class="katex-render">W</span> 完全一致。</li>
<li><strong>优化器状态 (Optimizer States):</strong> 
如果使用 Adam 等具有动量机制的优化器，需要额外记录每个参数的过去一阶动量（Momentum）和二阶方差（Variance）。并为了保证精度使用  32位，这将消耗 <span class="katex-render">4 \times</span> 模型参数大小的额外显存。</li>
</ul>
<hr>
<p>以目前最热门的模型llama、qwen等，最小规模 7B 至少 14GB，一次训练单次batch size <span class="katex-render">\times 6=84GB</span> （模型参数[1] 梯度[1] 优化器[4]），已经 超出一张A100的大小，所以如今大模型训练设计出了各种显存优化策略。</p>
<h2>三、 显存优化：存算置换与高效训练策略</h2>
<p>针对上述显存瓶颈，工程上常采用“以计算时间换取显存空间”或“降低数值精度”的策略。</p>
<h3>1. 核心“存算置换”策略概览</h3>
<p><em>(以下提及的存算置换策略，其底层原理与工程实现机制将在后续的专栏文章中进行详细深度解析。)</em></p>
<ul>
<li><strong>小批次 + 梯度累加 (Small Batch + Gradient Accumulation):</strong> 
在时间维度上拆分大 Batch，通过多次小 Batch 的前向/反向传播累加梯度，绕过单次激活值过大的显存限制。（但依旧会 OOM）</li>
<li><strong>ZeRO-Offload (算时加载):</strong> 
将优化器状态或梯度等暂时卸载至 CPU 内存（RAM），在需要计算时再通过 PCIe 调度至 GPU显存。</li>
<li><strong>梯度检查点 (Gradient Checkpointing):</strong> 
前向传播时主动丢弃部分中间激活值 <span class="katex-render">H</span>，在反向传播经过该层时重新计算。这是一种典型的以增加计算量（约30%）换取显著显存节省的策略。</li>
</ul>
<h3>2. 其他正交优化技术</h3>
<blockquote>
<p>工业实践上更为常用</p>
</blockquote>
<ul>
<li><strong>混合精度与量化 (Mixed Precision / Quantization):</strong> 将传统的 FP32 运算降阶为 FP16/BF16，甚至 INT8/INT4，成倍削减显存占用并提升计算吞吐。</li>
<li><strong>参数高效微调 (PEFT, 如 LoRA):</strong> 在微调阶段冻结主干网络（不保存其激活值与优化器状态），仅注入极少量的可训练参数矩阵，将训练显存开销降低至全量微调的零头。</li>
</ul>

      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/posts/ai/DeepLearn_1#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">69d50473f47f0b917ede9d69</guid>
  <category>posts</category>
<category>人工智能</category>
 </item>
  <item>
    <title>Nginx 常用配置避坑与说明：root/alias、路径透传与 SPA 部署</title>
    <link>https://zeta.future-world.net/posts/web/nginx-setting</link>
    <pubDate>Thu, 22 Jan 2026 08:55:10 GMT</pubDate>
    <description>最近使用AI Agent, 框架开发web应用。然而设计数据库或前后端交互时，还需自行设计后端。当然</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/posts/web/nginx-setting'>https://zeta.future-world.net/posts/web/nginx-setting</a></blockquote>
      <blockquote>
<p>最近使用AI Agent, 框架开发web应用。然而设计数据库或前后端交互时，还需自行设计后端。当然过于跨域等老生常谈的问题不用过多赘述，因为Nginx解决了大部分。在开发过程中总结一些关于Nginx配置踩坑并额外补充的一些前端知识。</p>
</blockquote>
<h3>一个简单的配置</h3>
<pre><code class="language-nginx">## web
    location /tb/ {
    alias D:/Projects/xxx/dist/;
    index index.html;
    try_files $uri $uri/ /tallybook/index.html;
    }
## api
    location /tbapi/ {
        proxy_pass http://127.0.0.1:8000/;
        proxy_redirect off;
    }
</code></pre><h2>root 与 alias</h2>
<p><code>localtion</code> 模块中用来指定映射服务器静态资源文件的命令</p>
<ul>
<li><strong>root</strong> 是<strong>追加</strong>：它把请求的 URL <strong>拼接到</strong> root 指定的路径后面。</li>
<li><strong>alias</strong> 是<strong>替换</strong>：它用 alias 指定的路径 <strong>替换掉</strong> location 匹配的部分。</li>
</ul>
<p>当浏览器访问：<a href="http://site.com/images/cat.jpg">*http://site.com/images/cat.jpg</a>  时*</p>
<pre><code class="language-nginx">location /images/ {
    root /var/www/html;
}</code></pre><p><em>→ /var/www/html/images/cat.jpg</em></p>
<pre><code class="language-nginx">location /images/ {
    alias /var/www/html/;
}</code></pre><p>→ <em>/var/www/html/cat.jpg</em></p>
<p><strong>注意：<strong>如果 location 后面有 <code>/</code>（例如 /images/），那么 alias 后面</strong>必须</strong>也要加 /。</p>
<h2><code>proxy_pass</code>  反向代理的路径透传</h2>
<p>对于nginx设置</p>
<pre><code class="language-python">    location /downloader/data/ {
        proxy_pass http://127.0.0.1:8000/;</code></pre><table>
<thead>
<tr>
<th>location</th>
<th>proxy_pass</th>
<th>后端收到的 URI</th>
</tr>
</thead>
<tbody><tr>
<td><code>/downloader/data</code></td>
<td><code>http://127.0.0.1:8000</code></td>
<td><code>/downloader/data/file.txt</code></td>
</tr>
<tr>
<td><code>/downloader/data/</code></td>
<td><code>http://127.0.0.1:8000</code></td>
<td><code>/downloader/data/file.txt</code></td>
</tr>
<tr>
<td><code>/downloader/data/</code></td>
<td><code>http://127.0.0.1:8000/</code></td>
<td><code>/file.txt</code></td>
</tr>
<tr>
<td><code>/downloader/data</code></td>
<td><code>http://127.0.0.1:8000/</code></td>
<td><strong>未定义/危险</strong></td>
</tr>
</tbody></table>
<p>如果设置了<code>autoindex on;</code>  location 建议以 <code>/</code> 结尾</p>
<p>注意，此时只会路由到<code>/downloader/data</code> 或 <code>/</code> </p>
<h3>🕳 python http.server</h3>
<p>最好的debug方式就是在 <code>do_GET</code>中打印地址</p>
<pre><code class="language-python">
    def do_GET(self):
        print(self.path)
        # ...
        super().do_GET()</code></pre><p><strong>启用 <code>http.server</code> 需要注意的坑</strong><br><strong>场景：将<code>http.server</code>作为静态资源服务器，指定资源目录</strong></p>
<p>如果希望指定目录. 则需要在python后端重写**<code>path</code>** ，<em>这种方法在需要修改目录的情况下最方便。</em></p>
<pre><code class="language-python"># 将 Nginx 传来的虚拟路径替换为本地实际目录
self.path = self.path.replace('/downloader/data', f'/{DIRECTORY}')
# 指定 http.server 访问的目录
# self.path = f'/{DIRECTORY}' + self.path</code></pre><h2><code>try_files</code> 单页应用（SPA）的部署策略</h2>
<pre><code class="language-nginx">try_files $uri $uri/ /index.html;</code></pre><h3>为什么这样写：</h3>
<p><strong>现代 SPA（单页应用）</strong></p>
<p>现在的前端框架（如 Vue/React），整个网站其实只有<strong>一个</strong> HTML 文件（通常是 index.html）。页面的切换（路由）是由浏览器里的 <strong>JavaScript</strong> 控制的，而不是服务器。</p>
<p><strong>问题来了：</strong></p>
<ol>
<li>用户访问首页 <a href="http://site.com/">http://site.com/</a> -&gt; Nginx 返回 index.html -&gt; JS 加载 -&gt; 此时用户点击按钮跳转到 /user/profile。<ul>
<li><strong>注意</strong>：这时候浏览器地址栏变了，但浏览器<strong>并没有</strong>向 Nginx 发送请求，是 JS 把页面内容变了。一切正常。</li>
</ul>
</li>
<li><strong>但是！</strong> 用户在 /user/profile 这个页面，按了一下 <strong>F5 刷新</strong>。</li>
<li>浏览器向 Nginx 发送请求：GET /user/profile。</li>
<li>Nginx 傻眼了：我去哪里找 /user/profile 这个文件？根目录下根本没有 user 文件夹，更没有 profile 文件。</li>
<li>Nginx 默认行为：<strong>直接报 404 错误</strong>。</li>
</ol>
<h3>作用 （三步走）</h3>
<p>先尝试访问路由文件→ 访问目录 + index/html（如果存在）→ 指定的html (兜底)</p>
<p>一种优雅的**“静态资源优先，应用入口兜底”** 的设计模式</p>

      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/posts/web/nginx-setting#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">6971e5ee464157458f3254d7</guid>
  <category>posts</category>
<category>前端开发</category>
 </item>
  <item>
    <title>物体运动（一） 蓝图控制</title>
    <link>https://zeta.future-world.net/notes/20</link>
    <pubDate>Thu, 04 Dec 2025 12:41:42 GMT</pubDate>
    <description>控制移动

基础移动

创建一个物体

进入蓝图 （蓝图关系）

蓝图设置



F7 编译蓝图

</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/notes/20'>https://zeta.future-world.net/notes/20</a></blockquote>
      <h2>控制移动</h2>
<h3>基础移动</h3>
<h5>创建一个物体</h5>
<p></p>
<h5>进入蓝图 （蓝图关系）</h5>
<p></p>
<h5>蓝图设置</h5>
<p></p>
<p><code>F7</code> 编译蓝图</p>
<h5>设置移动性</h5>
<p></p>
<h5>预览</h5>
<p></p>
<p><code>Alt</code>+<code>P</code></p>
<p></p>
<h3>非线性移动</h3>
<h5>添加时间轴</h5>
<p></p>
<h5>编辑时间轴</h5>
<p></p>
<h5>接入时间轴</h5>
<p></p>
<h3>Spline 移动</h3>
<blockquote>
<p>通过 <code>spline</code> 设计物体运动路线，实现复杂的运动路线</p>
</blockquote>
<ul>
<li>创建蓝图 -&gt; 赋予 <code>spline</code> 组件</li>
<li>场景中编辑线条 （拖动、alt 添加节点）</li>
<li>运动物体引用 <code>spline</code> 位置</li>
</ul>
<h4>创建 <code>spline</code> 蓝图</h4>
<p></p>
<h4>蓝图</h4>
<p></p>
<p>最右侧为 <code>Ftransform</code> 变量，可视为 <code>位置</code>、<code>旋转</code>、<code>缩放</code> 的<strong>结构体</strong></p>
<p>
</p>
<p></p>
<h4>设置路径</h4>
<p>从内容菜单拖出对象</p>
<p><code>Alt</code> + 🖱️ 左键端点拉出新的路径点</p>
<p></p>
<h4>移动物体引用路径</h4>
<h5>创建一个新的蓝图类</h5>
<p></p>
<p>打开蓝图为其添加一个 spline 蓝图的引用，（相当于一个指向该类对象的指针）</p>
<p></p>
<p></p>
<p>记得编译</p>
<h5>绑定对象</h5>
<p>
</p>
<h5>编辑蓝图</h5>
<p></p>
<p></p>
<h5>预览</h5>
<p></p>

      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/notes/20#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">69318186e766036af9d15598</guid>
  <category>notes</category>
false
 </item>
  <item>
    <title>UE5 踩坑记录</title>
    <link>https://zeta.future-world.net/posts/debug/debug1</link>
    <pubDate>Tue, 18 Nov 2025 11:01:14 GMT</pubDate>
    <description>过程 
开启c++编程后，编译报错

Expecting to find a type to be </description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/posts/debug/debug1'>https://zeta.future-world.net/posts/debug/debug1</a></blockquote>
      <h2>过程</h2>
<p>开启c++编程后，编译报错</p>
<pre><code class="language-shell">Expecting to find a type to be declared in a module rules named 'VisualStudioTools' in 'UE5Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.  This type must derive from the 'ModuleRules' type defined by UnrealBuildTool.</code></pre><p>缺少 <code>VisualStudioTools</code>  , 疑似新建c++项目，初始化时安装插件时选择 <code>安装到驱动</code> 导致。 应该选择<code>安装到项目</code></p>
<h3>解决方法</h3>
<p>项目目录新建<code>Plugins</code>目录， 将 <code>...\UE_5.x\Engine\Plugins\VisualStudioTools</code>  拷贝到该目录下。</p>
<h4>其他</h4>
<p>类似问题，同理解决方法</p>
<pre><code class="language-shell">Expecting to find a type to be declared in a module rules named 'XXX' in 'UE5Rules</code></pre>
      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/posts/debug/debug1#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">691c51faf8773e046319a13b</guid>
  <category>posts</category>
<category>踩坑</category>
 </item>
  <item>
    <title>开新坑了 UE5</title>
    <link>https://zeta.future-world.net/notes/18</link>
    <pubDate>Mon, 27 Oct 2025 07:48:49 GMT</pubDate>
    <description>突然接到任务，做一款基于UE5的项目，大概两个月时间， 这不可能完成的吧。从头开始学估计要花不少时间</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/notes/18'>https://zeta.future-world.net/notes/18</a></blockquote>
      <p>突然接到任务，做一款基于UE5的项目，大概两个月时间， <span style="text-decoration: line-through;">这不可能完成的吧</span>。从头开始学估计要花不少时间，虽然项目上只需要关注 C++ 侧的编程，只能先学再说了。<br>迅速了解了下UE5的作品。貌似可以开发VR 项目。刚好用上在角落吃灰的quest3，原本也有计划在3年内做款 VR Game，这下提前计划了。<span class="reveal-on-hover">最近各种学习计划被提前 等于没提前</span></p>
<h3>针对项目做计划</h3>
<p>近期目标就是实现运动与事件交互吧 （2025.10.25）</p>
<ul>
<li><input disabled="" type="checkbox"> C++ Class 如何使用 （如何体现到blueprint）</li>
<li><input disabled="" type="checkbox"> 实现物体移动</li>
<li><input disabled="" type="checkbox"> 物体状态触发事件</li>
<li><input disabled="" type="checkbox"> 物体与物体间的交互</li>
</ul>
<style>
.reveal-on-hover {
  background-color: black;
  color: black;
  padding: 0 4px;
  border-radius: 2px;
  transition: color 0.3s ease;
  cursor: pointer;
}
.reveal-on-hover:hover {
  color: white;
}
</style>
      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/notes/18#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">68ff23e12fe7cc3f49adb05b</guid>
  <category>notes</category>
false
 </item>
  <item>
    <title>天津神户园</title>
    <link>https://zeta.future-world.net/notes/17</link>
    <pubDate>Wed, 15 Oct 2025 17:12:13 GMT</pubDate>
    <description>天津神户园，纪念中日的两个港口城市友好交往而建。可惜到时天时以晚，加上手机电量告急。匆匆拍上几张照片</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/notes/17'>https://zeta.future-world.net/notes/17</a></blockquote>
      <p>天津神户园，纪念中日的两个港口城市友好交往而建。可惜到时天时以晚，加上手机电量告急。匆匆拍上几张照片便乘车返回了。<br>下午到天津市区开会，刚好在水上公园边上，会议结束时便顺路散步到了神户园。 听闻这个中日蜜月期建成的园林很久了，但地方太偏了（没一条顺路的地铁线到达）  </p>
<div style="float: left;">
  <img src="https://zeta.future-world.net/api/v2/objects/file/travelogue_shenhuyuan1.jpg">
</div>
<br style="clear: both;">

<p> 从里面拍摄，经典的日式入口
<br><br></p>
<div style="float: left;">
  <img src="https://zeta.future-world.net/api/v2/objects/file/travelogue_shenhuyuan2.jpg">
</div>
<br style="clear: both;">

<div style="float: left;">
  <img src="https://zeta.future-world.net/api/v2/objects/file/travelogue_shenhuyuan3.jpg">
</div>
<br style="clear: both;">

<div style="float: left;">
  <img src="https://zeta.future-world.net/api/v2/objects/file/travelogue_shenhuyuan4.jpg">
</div>
<br style="clear: both;">

<p>内部小道和建筑都极具日式风格⛩️ 。虽然看着挺亮，全靠手动快门救活
<br><br>
、</p>
<div style="float: left;">
  <img src="https://zeta.future-world.net/api/v2/objects/file/travelogue_shenhuyuan5.jpg">
</div>
<br style="clear: both;">


<div style="float: left;">
  <img src="https://zeta.future-world.net/api/v2/objects/file/travelogue_shenhuyuan6.jpg">
</div>
<br style="clear: both;">
内部几家挺有情调的小店，貌似是日式甜品和日咖夜吧。晚风吹过还会传出干净清脆的风铃声🎐
      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/notes/17#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">68efd5edee089de1340f83b3</guid>
  <category>notes</category>
false
 </item>
  <item>
    <title>WSL2 下 onnx 报错记录</title>
    <link>https://zeta.future-world.net/posts/debug/wslonnxdebug</link>
    <pubDate>Tue, 30 Sep 2025 02:47:51 GMT</pubDate>
    <description>记一次wsl下的环境踩坑，折腾一个多小时，发现了奇怪的解决方法

发现问题

先上环境：

impo</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/posts/debug/wslonnxdebug'>https://zeta.future-world.net/posts/debug/wslonnxdebug</a></blockquote>
      <blockquote>
<p>记一次wsl下的环境踩坑，折腾一个多小时，发现了奇怪的解决方法</p>
</blockquote>
<h3>发现问题</h3>
<p>先上环境：</p>
<pre><code class="language-PYTHON">import onnxruntime as ort
ort.get_available_providers()</code></pre><p>显示可用</p>
<pre><code class="language-TEXT">['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider']</code></pre><p>报错段，识别不到 gpu ，但环境下pytorch能使用gpu</p>
<pre><code class="language-PYTHON">session = ort.InferenceSession("yolov8n/best.onnx", providers=["CUDAExecutionProvider"])</code></pre><BR>
ERROR

<pre><code class="language-">*************** EP Error ***************
EP Error /onnxruntime_src/onnxruntime/core/providers/cuda/cuda_call.cc:129 std::conditional_t&lt;THRW, void, onnxruntime::common::Status&gt; onnxruntime::CudaCall(ERRTYPE, const char*, const char*, SUCCTYPE, const char*, const char*, int) [with ERRTYPE = cudaError; bool THRW = true; SUCCTYPE = cudaError; std::conditional_t&lt;THRW, void, common::Status&gt; = void] /onnxruntime_src/onnxruntime/core/providers/cuda/cuda_call.cc:121 std::conditional_t&lt;THRW, void, onnxruntime::common::Status&gt; onnxruntime::CudaCall(ERRTYPE, const char*, const char*, SUCCTYPE, const char*, const char*, int) [with ERRTYPE = cudaError; bool THRW = true; SUCCTYPE = cudaError; std::conditional_t&lt;THRW, void, common::Status&gt; = void] CUDA failure 100: no CUDA-capable device is detected ; GPU=-1 ; hostname=DESKTOP-LBBLQ7H ; file=/onnxruntime_src/onnxruntime/core/providers/cuda/cuda_execution_provider.cc ; line=282 ; expr=cudaSetDevice(info_.device_id); 

 when using ['CUDAExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.
****************************************</code></pre><h3>尝试 debug</h3>
<p>查阅资料，认为的 <code>onnxruntime</code> 找不到 <code>cudnn</code>, 而  <code>pytorch</code> 是自带 <code>cudnn</code> 的。  </p>
<p><em>wsl 中的 cuda toolkit 都是调用window下的，在win下安装好后一般不必在wsl重新安装</em></p>
<p>apt 安装库，修改环境变量 ...    之后便报了  <code>not found</code> 错误, 然而继续把缺少的安装上并修改环境变量后，在终端执行 <code>nvidia-smi</code> 发现无效了, 赶紧把环境变量注释掉。</p>
<h3>意外解决</h3>
<p>原本打算就这样算了，服务器用 CPU （i7-13700） 也足够，在中间需要数据转换时 <code>import torch</code> 报错 <code>undefined symbol</code>,一开始以为还是把环境搞崩了，但开了新的 <code>.py</code> 发现能正常使用。之后尝试在使用 onnx 前多加一行</p>
<pre><code class="language-python">import torch # add
import onnxruntime as ort
session = ort.InferenceSession("yolov8n/best.onnx", providers=["CUDAExecutionProvider"])</code></pre><p>没想到真就通过了...</p>
<h3>记录引起报错的代码</h3>
<p>onnxruntime: 无法识别 GPU </p>
<pre><code class="language-PYTHON">import onnxruntime as ort
session = ort.InferenceSession("yolov8n/best.onnx", providers=["CUDAExecutionProvider"])</code></pre><p>pytorch: <code>undefined symbol</code> 报错</p>
<pre><code class="language-PYTHON">import onnxruntime
import torch</code></pre>
      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/posts/debug/wslonnxdebug#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">68db44d7ee089de1340f4821</guid>
  <category>posts</category>
<category>踩坑</category>
 </item>
  <item>
    <title>hashcat 掩码格式</title>
    <link>https://zeta.future-world.net/posts/zlab/hashcat_mask</link>
    <pubDate>Fri, 22 Aug 2025 09:24:34 GMT</pubDate>
    <description>使用hashcat掩码模式破解文档时，一开始以为设计mask，会和正则一样，虽然复杂但使用GPT之类</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/posts/zlab/hashcat_mask'>https://zeta.future-world.net/posts/zlab/hashcat_mask</a></blockquote>
      <p>使用hashcat掩码模式破解文档时，一开始以为设计mask，会和正则一样，虽然复杂但使用GPT之类的工具能快速构建出规则。但可能是版本原因或其他问题，GPT、deepseek提供的方案都无效</p>

      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/posts/zlab/hashcat_mask#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">68a83752ee089de1340ee33b</guid>
  <category>posts</category>
<category>折腾</category>
 </item>
  <item>
    <title>《重构: 改善既有代码设计》关于代码的&quot;坏味道&quot; 【其一 表达与清晰度问题】</title>
    <link>https://zeta.future-world.net/notes/16</link>
    <pubDate>Wed, 20 Aug 2025 09:44:06 GMT</pubDate>
    <description>表达与清晰问题可以分为两类，信息表达不充分与表达过度，而这类问题在如今有AI辅助下，是最好解决。

</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/notes/16'>https://zeta.future-world.net/notes/16</a></blockquote>
      <p>表达与清晰问题可以分为两类，信息表达不充分与表达过度，而这类问题在如今有AI辅助下，是最好解决。</p>
<h3>信息表达不充分</h3>
<p><em>获取信息不足，理解困难</em>  </p>
<ul>
<li>神秘命名（Mysterious Name），不用多说，像 <code>a</code> <code>b</code> <code>x</code> <code>y</code> 等变量命名，虽说设计阶段很方便，但在维护与使用会产生时间成本。</li>
<li>注释（Comments），不是说写注释不好，而是不应该把注释当作“除臭剂”</li>
</ul>
<pre><code class="language-python">def do_stuff(a, b):
    return a * b + 42
result = do_stuff(5, 7)

def calculate_total_price(unit_price: float, quantity: float) -&gt; float:
    TAX = 42
    return unit_price * quantity + TAX
total = calculate_total_price(5, 7)</code></pre><p>上面的函数 <code>do_stuff</code> 就算把注释加上，每次阅读代码可能都需要鼠标移到函数上靠IDE的阅读一遍注释才能理解其作用；而<code>calculate_total_price</code> 只看函数命名便能知道它是干嘛的。</p>
<h3>表达过度</h3>
<p><em>代码获取信息过多，信噪比低</em>  </p>
<ul>
<li>冗赘的元素（Lazy Element），被设计出来但没有被使用的变量、函数、类等，也可能是维护过程遗留的东西，属于纯粹的噪音</li>
<li>夸夸其谈通用性（Speculative Generality），过早抽象、设计，不仅是噪音，还在开发阶段浪费不少时间与精力</li>
<li><code>循环语句（Loops）</code> ，并不是说循环是错的，而是说在高层逻辑中显式写循环是低层次的表达。相比于使用声明式的高级抽象（如函数式操作），往往会产生更多的问题。比如<code>map</code> <code>stream</code>等高级方法能代替 <code>for</code> <code>while</code>的功能，并更清晰地表达其意图。</li>
</ul>

      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/notes/16#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">68a598e6ee089de1340edc4e</guid>
  <category>notes</category>
false
 </item>
  <item>
    <title>《重构: 改善既有代码设计》关于代码的&quot;坏味道&quot;</title>
    <link>https://zeta.future-world.net/notes/15</link>
    <pubDate>Sat, 02 Aug 2025 09:41:25 GMT</pubDate>
    <description>对该书重构部分，“坏味道”的总结。随着 IDE 功能的完善与日益发展的AI，有些问题也有了更好的解决</description>
    <content:encoded><![CDATA[
      <blockquote>该渲染由 marked 生成，可能存在排版问题，最佳体验请前往：<a href='https://zeta.future-world.net/notes/15'>https://zeta.future-world.net/notes/15</a></blockquote>
      <p>对该书重构部分，“坏味道”的总结。随着 IDE 功能的完善与日益发展的AI，有些问题也有了更好的解决方法，后续进一步展示个人解读与思考</p>
<pre><code class="language-text">1. 神秘命名（Mysterious Name）  
2. 重复代码（Duplicated Code）  
3. 过长函数（Long Function）  
4. 过长参数列表（Long Parameter List）  
5. 全局数据（Global Data）  
6. 可变数据（Mutable Data）  
7. 发散式变化（Divergent Change）  
8. 霰弹式修改（Shotgun Surgery）  
9. 依恋情结（Feature Envy）  
10. 数据泥团（Data Clumps）  
11. 基本类型偏执（Primitive Obsession）  
12. 重复的 switch（Repeated Switches）  
13. 循环语句（Loops）  
14. 冗赘的元素（Lazy Element）  
15. 夸夸其谈通用性（Speculative Generality）  
16. 临时字段（Temporary Field）  
17. 过长的消息链（Message Chains）  
18. 中间人（Middle Man）  
19. 内幕交易（Insider Trading）  
20. 过大的类（Large Class）  
21. 异曲同工的类（Alternative Classes with Different Interfaces）  
22. 纯数据类（Data Class）  
23. 被拒绝的遗赠（Refused Bequest）  
24. 注释（Comments）</code></pre><h2>对24个&quot;坏味道&quot;进行分类</h2>
<h3>一、表达与清晰度问题</h3>
<ul>
<li>神秘命名（Mysterious Name）</li>
<li>注释（Comments）</li>
<li>循环语句（Loops）</li>
<li>冗赘的元素（Lazy Element）  </li>
<li>夸夸其谈通用性（Speculative Generality）</li>
</ul>
<h3>二、结构与规模问题</h3>
<ul>
<li>过长函数（Long Function）</li>
<li>过大的类（Large Class）</li>
<li>过长参数列表（Long Parameter List）</li>
</ul>
<h3>三、重复与分散问题</h3>
<ul>
<li>重复代码（Duplicated Code）</li>
<li>重复的 switch（Repeated Switches）</li>
<li>异曲同工的类（Alternative Classes with Different Interfaces）</li>
<li>霰弹式修改（Shotgun Surgery）</li>
<li>发散式变化（Divergent Change）</li>
</ul>
<h3>四、耦合与依赖 （模块间）</h3>
<ul>
<li>全局数据（Global Data）</li>
<li>可变数据（Mutable Data）</li>
<li>依恋情结（Feature Envy）</li>
<li>过长的消息链（Message Chains）</li>
<li>中间人（Middle Man）</li>
<li>内幕交易（Insider Trading）</li>
<li>被拒绝的遗赠（Refused Bequest）</li>
</ul>
<h3>五、数据组织问题</h3>
<ul>
<li>数据泥团（Data Clumps）</li>
<li>基本类型偏执（Primitive Obsession）</li>
<li>纯数据类（Data Class）</li>
<li>临时字段（Temporary Field）</li>
</ul>
<hr>
<p>除去<code>1</code>外，其他4类可以归为<strong>设计边界</strong>上的不合理</p>
<p>规模问题 → “一个类/函数是不是太胖？”</p>
<p>重复问题 → “为什么到处都有类似的逻辑？”</p>
<p>耦合问题 → “为什么 A 和 B 粘在一起动不了？”</p>
<p>数据问题 → “为什么数据不像对象，更像裸变量？”</p>
<table>
<thead>
<tr>
<th>类别</th>
<th>关注点</th>
<th>边界失衡的方式</th>
<th>常见后果</th>
</tr>
</thead>
<tbody><tr>
<td>结构与规模问题</td>
<td>单体内部</td>
<td><strong>太集中</strong> → 过度膨胀</td>
<td>难读、难维护</td>
</tr>
<tr>
<td>重复与分散问题</td>
<td>单体之间</td>
<td><strong>太分散</strong> → 逻辑重复</td>
<td>修改代价高</td>
</tr>
<tr>
<td>耦合与依赖问题</td>
<td>模块关系</td>
<td><strong>边界渗透</strong> → 模块纠缠</td>
<td>难独立演进</td>
</tr>
<tr>
<td>数据组织问题</td>
<td>数据抽象</td>
<td><strong>边界脆弱</strong> → 数据贫血</td>
<td>缺乏封装，难演化</td>
</tr>
</tbody></table>

      <p style='text-align: right'>
      <a href='https://zeta.future-world.net/notes/15#comments'>看完了？说点什么呢</a>
      </p>
    ]]>
    </content:encoded>
  <guid isPermaLink="false">688ddd45ee089de1340ea087</guid>
  <category>notes</category>
false
 </item>
  
</channel>
</rss>