LLM - R1 強化學習 DRPO 策略優化 DAPO 與 Dr. GRPO 算法 教程

歡迎關注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/146533892


DAPO

在強化學習算法中,DAPO (Decoupled Clip and Dynamic Sampling Policy Optimization),通過解耦裁剪和動態采樣策略提升模型的推理能力。與 GRPO (Group Relative Policy Optimization) 相比,DRPO 移除 KL 散度懲罰項,允許模型在長推理任務中自由探索,同時,通過調整上下裁剪范圍,增加低概率 Token 探索能力,有效緩解熵崩潰問題。DRPO 引入動態采樣策略,過濾掉準確率為 0 或 1 的無效樣本,確保每個批次中的樣本,具有有效的梯度信號,從而提升訓練效率和模型的收斂速度。Dr. GRPO (GRPO Done Right) 解決 GRPO 優化中的偏差問題,提出的改進方案,通過刪除長度歸一化項和標準差標準化項,解決 GRPO 可能導致錯誤響應逐漸變長的問題。同時,Dr. GRPO 在掩碼均值函數中,將 mask.sum(axis=dim) 替換為固定值 MAX_TOKENS,以確保優化目標的無偏性。能夠有效緩解優化偏差,顯著減少錯誤回答的長度,同時保持模型的推理性能。

DAPO,即 Decoupled Clip and Dynamic sAmpling Policy Optimization,解耦剪裁與動態采樣策略優化

  • DAPO: an Open-Source LLM Reinforcement Learning System at Scale

Dr. GRPO,即 GRPO Done Right

  • Dr. GRPO: Understanding R1-Zero-Like Training: A Critical Perspective

GitHub:

  • DAPO:https://dapo-sia.github.io/
  • Dr. GRPO:https://github.com/sail-sg/understand-r1-zero

標準的 GRPO,如下:
1 G ∑ i = 1 G 1 ∣ o i ∣ ∑ t = 1 ∣ o i ∣ { m i n [ π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) A ^ i , t , c l i p ( π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) , 1 ? ? , 1 + ? ) A ^ i , t ] ? β D K L ( π θ ∣ ∣ π r e f ) } w h e r e A ^ i , t = R ( q , o i ) ? m e a n ( { R ( q , o i ) , . . . , R ( q , o G ) } ) s t d ( { R ( q , o i ) , . . . , R ( q , o G ) } ) \frac{1}{G}\sum_{i=1}^{G} \frac{1}{|o_{i}|}\sum_{t=1}^{|o_{i}|} \big\{ min \big[ \frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}\hat{A}_{i,t}, clip(\frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}, 1-\epsilon, 1+\epsilon)\hat{A}_{i,t} \big] -\beta \mathbb{D}_{KL}(\pi_{\theta}||\pi_{ref}) \big\} \\ where \ \hat{A}_{i,t}=\frac{R(q,o_{i}) - mean(\{R(q,o_{i}),...,R(q,o_{G})\})}{std(\{R(q,o_{i}),...,R(q,o_{G})\})} G1?i=1G?oi?1?t=1oi??{min[πθold??(oi,t?q,oi,<t?)πθ?(oi,t?q,oi,<t?)?A^i,t?,clip(πθold??(oi,t?q,oi,<t?)πθ?(oi,t?q,oi,<t?)?,1??,1+?)A^i,t?]?βDKL?(πθ?∣∣πref?)}where?A^i,t?=std({R(q,oi?),...,R(q,oG?)})R(q,oi?)?mean({R(q,oi?),...,R(q,oG?)})?
DAPO (Decoupled Clip and Dynamic sAmpling Policy Optimization),即 解耦剪裁與動態采樣策略優化,即 (1) 增加 Clip 上界范圍,(2) 去除 全正或全錯的采樣,(3) 修改 Token-Level 全平均 代替 Sample-Level 分組平均。
1 ∑ i = 1 G ∣ o i ∣ 1 G ∑ i = 1 G ∑ t = 1 ∣ o i ∣ { m i n [ π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) A ^ i , t , c l i p ( π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) , 1 ? ? l o w , 1 + ? u p ) A ^ i , t ] } w h e r e A ^ i , t = R ( q , o i ) ? m e a n ( { R ( q , o i ) , . . . , R ( q , o G ) } ) s t d ( { R ( q , o i ) , . . . , R ( q , o G ) } ) s . t . 0 < ∣ { o i ∣ i s _ e q u i v a l e n t ( a , o i ) } ∣ < G \frac{1}{\sum_{i=1}^{G}|o_{i}|} \frac{1}{G}\sum_{i=1}^{G} \sum_{t=1}^{|o_{i}|} \big\{ min \big[ \frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}\hat{A}_{i,t}, clip(\frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}, 1-\epsilon_{low}, 1+\epsilon_{up})\hat{A}_{i,t} \big] \big\} \\ where \ \hat{A}_{i,t}=\frac{R(q,o_{i}) - mean(\{R(q,o_{i}),...,R(q,o_{G})\})}{std(\{R(q,o_{i}),...,R(q,o_{G})\})} \\ s.t. \ 0 < \big| \{{o_{i}|is\_equivalent(a,o_{i})} \} \big| < G i=1G?oi?1?G1?i=1G?t=1oi??{min[πθold??(oi,t?q,oi,<t?)πθ?(oi,t?q,oi,<t?)?A^i,t?,clip(πθold??(oi,t?q,oi,<t?)πθ?(oi,t?q,oi,<t?)?,1??low?,1+?up?)A^i,t?]}where?A^i,t?=std({R(q,oi?),...,R(q,oG?)})R(q,oi?)?mean({R(q,oi?),...,R(q,oG?)})?s.t.?0< ?{oi?is_equivalent(a,oi?)} ?<G
Dr. GRPO (GRPO Done Right),即 運行正確的 GRPO,即 (1)去掉 序列長度 1 ∣ o i ∣ \frac{1}{|o_{i}|} oi?1?,(2)去掉 優勢方差 s t d std std,如下:
1 G ∑ i = 1 G ∑ t = 1 ∣ o i ∣ { m i n [ π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) A ^ i , t , c l i p ( π θ ( o i , t ∣ q , o i , < t ) π θ o l d ( o i , t ∣ q , o i , < t ) , 1 ? ? , 1 + ? ) A ^ i , t ] ) } w h e r e A ^ i , t = R ( q , o i ) ? m e a n ( { R ( q , o i ) , . . . , R ( q , o G ) } ) \frac{1}{G}\sum_{i=1}^{G} \sum_{t=1}^{|o_{i}|} \big\{ min \big[ \frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}\hat{A}_{i,t}, clip(\frac{\pi_{\theta}(o_{i,t}|q,o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t}|q,o_{i,<t})}, 1-\epsilon, 1+\epsilon)\hat{A}_{i,t} \big]) \big\} \\ where \ \hat{A}_{i,t}=R(q,o_{i}) - mean(\{R(q,o_{i}),...,R(q,o_{G})\}) G1?i=1G?t=1oi??{min[πθold??(oi,t?q,oi,<t?)πθ?(oi,t?q,oi,<t?)?A^i,t?,clip(πθold??(oi,t?q,oi,<t?)πθ?(oi,t?q,oi,<t?)?,1??,1+?)A^i,t?])}where?A^i,t?=R(q,oi?)?mean({R(q,oi?),...,R(q,oG?)})

DAPO 移除 KL 散度 (Removing KL Divergence):KL 懲罰用于調節 在線策略 與 凍結參考策略 之間的散度。

  • 在 強化學習人類反饋(RLHF) 場景中,強化學習的目標是,避免與初始模型偏離太遠,對齊模型的行為。
  • 訓練 長思維鏈(long-CoT) 的模型,模型分布可能顯著偏離初始模型,因此,KL 懲罰沒有必要。

Dr. GRPO,同樣,移除 KL 散度,即:

  • KL 正則化項,通常用于從人類反饋中強化學習,其中 r r r 是從 π r e f \pi_{ref} πref? 收集的數據中,學習得到的獎勵模型。正則化有助于防止 π θ \pi_{\theta} πθ? 過度偏離獎勵模型準確的分布。
  • 推理模型的強化學習微調,通常使用基于規則的驗證器作為 r r r,消除分布偏移的擔憂,因此,可以移除 KL 項
  • 節省在訓練過程中由 π r e f \pi_{ref} πref? 所需的顯存和計算資源,而且,可能為 RL 訓練帶來更好的性能。
  • 因此,假設 β D K L \beta \mathbb{D}_{KL} βDKL? 項的參數 β = 0 \beta=0 β=0

在 TRL - GRPO 的 KL 散度參數中,即

  • β = 0.04 \beta = 0.04 β=0.04,default,GRPOConfig
  • 在 math 訓練中, β = 0.001 \beta=0.001 β=0.001 ,也是降低 KL 散度權重。

1. DAPO 策略

DAPO 去除 KL 散度項、使用基于規則的獎勵模型(Rule-based Reward Modeling)。

DAPO 核心包括:

  1. Clip-Higher (裁剪上界):促進系統多樣性,避免熵坍塌(Entropy Collapse),在 策略梯度損失(Policy Gradient Loss) 中,通過增加重要性采樣比率的 剪裁上界(Upper Clip) 緩解。
    • 提升 Clip 上界,正例(A>0),低概率 Token 絕對提升能力增強,有效釋放低概率路徑的探索潛能,緩解策略熵的快速降低。
    • 保持 Clip 下界,避免策略急劇收縮。
    • ? l o w = 0.2 , ? h i g h = 0.28 \epsilon_{low}=0.2,\epsilon_{high}=0.28 ?low?=0.2?high?=0.28
  2. Dynamic Sampling (動態采樣):提高訓練效率和穩定性,提出動態采樣策略,篩選出準確率為 1 和 0 的提示組(Prompt Groups),確保每個批次中,有效梯度的提示數量保持一致。
  3. Token-level Policy Gradient Loss (Token-Level 策略梯度損失):避免 長思維鏈的強化學習(long-CoT RL) 中,無意義的 Pattern 懲罰較低,效果顯著。
    • GRPO:先在 部分(Generation Level) 取平均,再在 整體(Group Level) 取平均。
    • DAPO:在 Group 中,全部 Generation 全部 Tokens,一起取平均。
  4. Overlong Reward Shaping (過長獎勵規范):使用 超長過濾(Overlong Filtering) 策略,隱藏(Mask) 截斷樣本(Truncated Samples) 的損失,顯著穩定訓練過程,提高性能,降低獎勵噪聲(Reward Noise)。

軟過長懲罰(Soft Overlong Punishment),即:
R l e n g t h ( y ) = { 0 , ∣ y ∣ ≤ L m a x ? L c a c h e L m a x ? L c a c h e ? ∣ y ∣ L c a c h e , L m a x ? L c a c h e < ∣ y ∣ ≤ L m a x ? 1 , L m a x < ∣ y ∣ R_{length}(y) = \begin{cases} 0, &|y|\le L_{max} - L_{cache} \\ \frac{L_{max} - L_{cache} - |y|}{L_{cache}}, &L_{max} - L_{cache} < |y| \le L_{max} \\ -1, &L_{max} < |y| \end{cases} Rlength?(y)=? ? ??0,Lcache?Lmax??Lcache??y?,?1,?yLmax??Lcache?Lmax??Lcache?<yLmax?Lmax?<y?

DAPO 流程:

DAPO

2. Dr. GRPO 策略

Dr. GRPO 解決 GRPO 的 2 個偏差(Biases):

  1. 響應長度偏差(Response-level length bias):即 除以 ∣ o i ∣ |o_{i}| oi?
    • 正向優勢 ( A ^ i , t > 0 \hat{A}_{i,t}>0 A^i,t?>0) 回答正確,短回答的梯度更新大,長回答的梯度更新小。
    • 負向優勢 ( A ^ i , t < 0 \hat{A}_{i,t}<0 A^i,t?<0) 回答錯誤,長回答的懲罰較小,短回答的懲罰較大。
    • 去掉 除以 ∣ o i ∣ |o_{i}| oi? 之后,避免回答長短的影響,只考慮獎勵函數值。
  2. 問題難度偏差(Question-level difficulty bias):即 優勢 A ^ i , t \hat{A}_{i,t} A^i,t? 除以 s t d ( { R ( q , o i ) , . . . , R ( q , o G ) } ) std(\{R(q,o_{i}),...,R(q,o_{G})\}) std({R(q,oi?),...,R(q,oG?)})
    • 標準差較低的問題,在策略更新過程中,賦予更高的權重。
    • 批次歸一化是合理的,但是,問題級別歸一化,導致目標函數中不同問題的權重有所不同。
    • 模型訓練更偏向于,回答一致性較高的問題,降低探索能力。

3. TRL GRPO 實現

TRL 代碼中,計算 GRPO 的邏輯:

# 1. advantages 優勢的計算過程
# Gather the reward per function: this part is crucial, because the rewards are normalized per group and the
# completions may be distributed across processes
rewards_per_func = gather(rewards_per_func)# Apply weights to each reward function's output and sum
rewards = (rewards_per_func * self.reward_weights.to(device).unsqueeze(0)).nansum(dim=1)# Compute grouped-wise rewards
mean_grouped_rewards = rewards.view(-1, self.num_generations).mean(dim=1)
std_grouped_rewards = rewards.view(-1, self.num_generations).std(dim=1)# Normalize the rewards to compute the advantages
mean_grouped_rewards = mean_grouped_rewards.repeat_interleave(self.num_generations, dim=0)
std_grouped_rewards = std_grouped_rewards.repeat_interleave(self.num_generations, dim=0)
advantages = rewards - mean_grouped_rewards
if self.args.scale_rewards:advantages = advantages / (std_grouped_rewards + 1e-4)# KL 散度
per_token_kl = torch.exp(ref_per_token_logps - per_token_logps) - (ref_per_token_logps - per_token_logps) - 1# 2. Loss 的計算過程
# Compute the loss
advantages = inputs["advantages"]
# When using num_iterations == 1, old_per_token_logps == per_token_logps, so we can skip it's computation (see
# _generate_and_score_completions) and use per_token_logps.detach() instead.
old_per_token_logps = inputs["old_per_token_logps"] if self.num_iterations > 1 else per_token_logps.detach()
coef_1 = torch.exp(per_token_logps - old_per_token_logps)
coef_2 = torch.clamp(coef_1, 1 - self.epsilon_low, 1 + self.epsilon_high)
per_token_loss1 = coef_1 * advantages.unsqueeze(1)
per_token_loss2 = coef_2 * advantages.unsqueeze(1)
per_token_loss = -torch.min(per_token_loss1, per_token_loss2)
if self.beta != 0.0:per_token_loss = per_token_loss + self.beta * per_token_kl
loss = (per_token_loss * completion_mask).sum() / completion_mask.sum()

4. loss 是 0 不代表 gradient 是 0

loss = 0 也可以反向傳播,更新梯度:

  • loss 是 0,gradient 可能不是 0

l o s s ( w ) = ( w ? 1 ) 2 ? 1 ? l o s s ? w = 2 w ? 2 \begin{align} loss(w) &= (w-1)^{2} - 1 \\ \frac{\partial{loss}}{\partial{w}} &= 2w - 2 \end{align} loss(w)?w?loss??=(w?1)2?1=2w?2??

  • 當 loss 是 0 時,w=0,梯度 gradient 是 -2,學習 = 學習率 * 梯度,假設,學習率 η = 0.1 \eta=0.1 η=0.1

w n e w = w ? η ? g = 0 ? ( 0.1 × ( ? 2 ) ) = 0.2 w_{new} = w - \eta \cdot g = 0 - (0.1\times(-2)) = 0.2 wnew?=w?η?g=0?(0.1×(?2))=0.2

  • gradient 是 0,則不可優化

測試:

import torch
x = torch.tensor([3.0], requires_grad=True)
y1 = x-x
y1.backward()
print(f"Grad for x-x: {x.grad.item()}")  # 0.0x.grad.zero_()
y2 = x - x.detach()
y2.backward()
print(f"Grad for x - x.detach(): {x.grad.item()}")  # 1.0

參考:

  • GitHub - GRPO questions
  • GitHub - Add warning when negative KL
  • 知乎 - DAPO中的CLIP trick

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/899158.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/899158.shtml
英文地址,請注明出處:http://en.pswp.cn/news/899158.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

美攝科技智能汽車視頻延遲攝影解決方案,開啟智能出行新視界

在智能汽車時代&#xff0c;車載影像技術正以前所未有的速度發展&#xff0c;成為提升駕乘體驗和滿足用戶多樣化需求的關鍵因素。美攝科技憑借其卓越的技術實力和創新精神&#xff0c;推出了智能汽車視頻延遲攝影解決方案&#xff0c;為智能汽車行業帶來了一場視覺盛宴。 一、…

[250325] Claude AI 現已支持網絡搜索功能!| ReactOS 0.4.15 發布!

目錄 Claude AI 現已支持網絡搜索功能&#xff01;ReactOS 0.4.15 發布&#xff01; Claude AI 現已支持網絡搜索功能&#xff01; 近日&#xff0c;Anthropic 公司宣布&#xff0c;其 AI 助手 Claude 現在可以進行網絡搜索&#xff0c;為用戶提供更及時、更相關的回復。這項新…

代碼規范之Variable Names變量名

代碼規范之Variable Names變量名 golang中 官方文檔&#xff1a;https://go.dev/wiki/CodeReviewComments#variable-names Variable names in Go should be short rather than long. This is especially true for local variables with limited scope. Prefer c to lineCoun…

Mybatis_plus

前言 Mybatis_plus 是在 mybatis 的基礎上進行了增強&#xff0c;在 MyBatis 的基礎上只做增強不做改變&#xff0c;為簡化開發、提高效率而生。本文章只做簡單的使用介紹&#xff0c;更加詳細的內容大家可以參考官網。 下面是mybatis_plus 官網地址&#xff1a; mybatis_plu…

深圳問頂安全科技有限公司asktopsec是做什么的?

深圳問頂安全科技有限公司&#xff0c;是一家專業的AI與應用安全公司。 全球領先的AI、Android、IOS應用安全解決方案提供商&#xff0c;官網&#xff1a;https://asktopsec.com 問頂安全主要為企業提供AI和應用安全服務 移動應用安全檢測、移動應用安全加固、AI智能體安全、AI…

鴻蒙OS 5 架構設計探秘:從分層設計到多端部署

文章目錄 鴻蒙OS架構設計探秘&#xff1a;從分層設計到多端部署一、鴻蒙的分層架構設計二、模塊化設計的精髓三、智慧分發設計&#xff1a;資源的動態調度四、一次開發&#xff0c;多端部署的實踐總結與思考 鴻蒙OS架構設計探秘&#xff1a;從分層設計到多端部署 最近兩年來&a…

idea 沒有 add framework support(添加框架支持)選項

在 IntelliJ IDEA 2023 中&#xff0c;若需通過設置手動添加 “添加框架支持” 菜單項&#xff0c;可按照以下步驟操作&#xff1a; 手動添加 “添加框架支持” 菜單項 打開設置 點擊頂部菜單欄的 File&#xff08;文件&#xff09; -> Settings&#xff08;設置&#xff09…

計算機網絡--傳輸層(2)

傳輸層核心機制深度解析 一、可靠傳輸實現機制 1. 校驗和機制 技術原理&#xff1a; 使用16位二進制反碼求和算法&#xff0c;計算范圍包括TCP偽首部&#xff08;12字節&#xff09;、TCP首部&#xff08;20字節&#xff09;和數據部分接收端重新計算校驗和&#xff0c;若與…

再探帶權并查集

典型例題 Acwing 權值 故名思義&#xff0c;在帶權并查集中&#xff0c;我們需要讓每個節點攜帶一個**“權值”**。 那么這個權值應該是什么呢&#xff1f;其實答案就在并查集當中。 由于在并查集當中我們可以在 O ( 1 ) O(1) O(1) 時間內找到一個節點的根節點&#xff0c;那…

Vala編成語言教程-構造函數和析構函數

構造函數 Vala支持兩種略有不同的構造方案&#xff1a;我們將重點討論Java/C#風格的構造方案&#xff0c;另一種是GObject風格的構造方案。 Vala不支持構造函數重載的原因與方法重載不被允許的原因相同&#xff0c;這意味著一個類不能有多個同名構造函數。但這并不構成問題&…

本地部署Stable Diffusion生成爆火的AI圖片

直接上代碼 Mapping("/send") Post public Object send(Body String promptBody) { JSONObject postSend new JSONObject(); System.out.println(promptBody); JSONObject body JSONObject.parseObject(promptBody); List<S…

python爬蟲WASM

WASM 一.WASM簡介 1.1 WASM定義 ? WebAssembly(簡稱wasm)是一個虛擬指令集體系架構(virtual ISA),整體架構包括核心的ISA定義、二進制編碼、程序語義的定義與執行,以及面向不同的嵌入環境(如Web)的應用編程接口(WebAssembly API)。是一種運行在現代網絡瀏覽器中的…

Docker鏡像遷移方案

Docker鏡像遷移方案 文章目錄 Docker鏡像遷移方案一&#xff1a;背景二&#xff1a;操作方式三&#xff1a;異常原因參考&#xff1a; 一&#xff1a;背景 比如機器上已經有先有的容器&#xff0c;但是docker pull的時候是失敗的二&#xff1a;操作方式 1、停止正在運行的容器…

關于跨域問題(本地前端訪問服務器端接口跨域出錯)

問題來源&#xff1a; 當服務器封裝了接口但是本地電腦端前端訪問出現跨域問題。 解決方案&#xff1b; 1、使用ipconfig 查看本地電腦的ip地址 ipconfig 2、在后端接口處配置如下代碼 allow_origins["http://本地ip地址:3001", # 局域網內其他設備訪問的本地…

邊緣計算 vs. 云計算,誰才是工業物聯網的未來?

前言 在物聯網&#xff08;IoT&#xff09;飛速發展的今天&#xff0c;邊緣計算正在徹底改變數據的處理、存儲和分析方式。傳統的IoT設備數據通常需要發送到云端進行處理&#xff0c;但隨著設備數量的激增&#xff0c;這種模式在延遲、帶寬和安全性方面暴露出諸多局限。邊緣計…

dell 臺式機 電腦 紐扣電池 如何取下?

dell 臺式機 電腦 紐扣電池 如何取下&#xff1f; 戴爾-optiplex-3060-塔式機-服務手冊

NFC 智能門鎖全棧解決方案:移動端、服務器、Web 管理平臺

目錄 一、系統整體架構 二、移動端 APP 開發 2.1 開發環境與基礎準備 2.2 主要功能模塊 2.3 示例代碼&#xff08;Android/Kotlin 簡化示例&#xff09; 三、后臺服務開發 3.1 環境準備 3.2 主要功能 3.3 示例代碼&#xff08;Node.js Express 簡化示例&#xff09; …

DDR4、DDR5、固態硬盤(SSD)和機械硬盤(HDD)在連續讀/寫、隨機讀/寫性能的對比分析

以下是關于DDR4、DDR5、固態硬盤&#xff08;SSD&#xff09;和機械硬盤&#xff08;HDD&#xff09;在連續讀/寫、隨機讀/寫性能的對比分析&#xff0c;結合技術特性與應用場景的總結&#xff1a; 一、性能對比表格 存儲類型連續讀&#xff08;MB/s&#xff09;連續寫&#x…

【AI】MAC版本本地Stable Diffusion web ui安裝

文章目錄 前言環境依賴homebrewpython3下載stable-diffusion-webui webui模型準備模型網站 中文頁面設置提示詞轉漢語轉英文controlnet安裝controlnet模型下載 結尾 前言 目前&#xff0c;市面上已經出現了很多用Ai 繪圖制作的作品&#xff0c;用于自媒體或者商業等。例如表情…

Linux 云服務器開放端口

首先找到你買服務器的官網&#xff0c;我這里是阿里云 點擊這里的控制臺 這里先點手動添加&#xff0c;再看自己是UDP還是TCP協議&#xff0c;找到對應的協議&#xff0c;目的就填你想開放的端口&#xff0c;源填所有IP/4 0.0.0.0 添加備注點擊保存就開放好了。