paulwong

          #

          DeepSeek背后的數(shù)學(xué):深入研究群體相對(duì)策略?xún)?yōu)化(GRPO)

               摘要: 本博客深入探討了群體相對(duì)策略?xún)?yōu)化(GRPO)背后的數(shù)學(xué),GRPO是推動(dòng)DeepSeek卓越推理能力的核心強(qiáng)化學(xué)習(xí)算法。我們將分解GRPO的工作原理、其關(guān)鍵組件,以及為什么它是訓(xùn)練高級(jí)大型語(yǔ)言模型(LLM)的改變者。 GRPO的基礎(chǔ) GRPO是什么? 群相對(duì)策略?xún)?yōu)化(GRPO)是一種強(qiáng)化學(xué)習(xí)(RL)算法,專(zhuān)門(mén)用于增強(qiáng)大型語(yǔ)言模型(LLM)的推理能力。與傳統(tǒng)的RL方法不同,RL方法嚴(yán)重依賴(lài)外部評(píng)...  閱讀全文

          posted @ 2025-02-08 00:13 paulwong 閱讀(317) | 評(píng)論 (0)編輯 收藏

          DeepSeek資源

          DeepSeek大模型由于采用了GRPO算法, 大幅降低了顯存的需求.

          【DeepSeek】復(fù)現(xiàn)DeepSeek R1?快來(lái)看這個(gè)Open R1項(xiàng)目實(shí)踐指南~
          https://blog.csdn.net/qq_38961840/article/details/145388142

          !!!實(shí)戰(zhàn)LLM強(qiáng)化學(xué)習(xí)——使用GRPO(DeepSeek R1出圈算法)
          https://blog.csdn.net/qq_38961840/article/details/145390704

          【DeepSeek】一文詳解GRPO算法——為什么能減少大模型訓(xùn)練資源?
          https://blog.csdn.net/qq_38961840/article/details/145384852

          DeepSeek R1系列
          https://blog.csdn.net/qq_38961840/category_12885087.html


          posted @ 2025-02-02 19:22 paulwong 閱讀(100) | 評(píng)論 (0)編輯 收藏

          不用再找了,這是大模型最全的面試題庫(kù)

          https://blog.csdn.net/m0_59596990/article/details/135200833

          posted @ 2025-01-22 07:42 paulwong 閱讀(41) | 評(píng)論 (0)編輯 收藏

          數(shù)據(jù)集資源

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
          https://hyper.ai/cn/datasets


          posted @ 2025-01-17 15:52 paulwong 閱讀(30) | 評(píng)論 (0)編輯 收藏

          vllm資源

          vllm是一個(gè)可以加載大模型, 推理, 量化模型, 以http api的方式暴露服務(wù)的框架.

          https://docs.vllm.ai/en/latest/getting_started/examples/basic_with_model_default_sampling.html


          posted @ 2025-01-17 13:01 paulwong 閱讀(74) | 評(píng)論 (0)編輯 收藏

          AI應(yīng)用場(chǎng)景

          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
          到底AI是虛的還是假的, 在企業(yè)中有沒(méi)實(shí)際落地場(chǎng)景, 以下取實(shí)際應(yīng)用場(chǎng)景:

          生物公司
          使用qwen2:7b訓(xùn)練細(xì)胞制備領(lǐng)域的數(shù)據(jù)集,目標(biāo)是
          1.預(yù)測(cè)細(xì)胞收獲量  
          2.算細(xì)胞存活狀態(tài)(存活/死亡)
          3.預(yù)測(cè)工藝是否成功
          4.可以提前預(yù)測(cè)細(xì)胞的質(zhì)量是否達(dá)標(biāo),以便及時(shí)采取措施進(jìn)行調(diào)整
          5.細(xì)胞培養(yǎng)過(guò)程中出現(xiàn)大量細(xì)胞死亡的情況,模型可以根據(jù)實(shí)時(shí)數(shù)據(jù)和歷史經(jīng)驗(yàn),分析可能是培養(yǎng)箱溫度失控、培養(yǎng)基成分錯(cuò)誤或受到污染等原因?qū)е碌模⑻峁┫鄳?yīng)的排查建議」

          文體旅游
          智能旅游系統(tǒng):
          提供目的地介紹、
          旅行路線規(guī)劃、
          酒店預(yù)訂和景
          點(diǎn)推薦等服務(wù)。

          考試改卷
          基于大模型,做一個(gè)判試卷的應(yīng)用,能夠判斷主觀題,比如閱讀理解,比如歷史,地理,政治問(wèn)答題。
          判卷準(zhǔn)確率不能低于人工判卷準(zhǔn)確率。
          即一次考試,一個(gè)班50份試卷,判斷結(jié)果錯(cuò)誤不超過(guò)5道題。判斷效率高于或等于人工。

          取過(guò)往同學(xué)試卷題目, 作答內(nèi)容, 得分 作一波ocr出數(shù)據(jù), 一個(gè)科目, 提取所有試卷內(nèi)容, 最后就是一個(gè)科目一個(gè)模型, 提取的內(nèi)容放在文本, csv, json,
          基于“bert-base-chinese”這個(gè)模型, 進(jìn)行微調(diào)出專(zhuān)用模型即可,  
          讓大模型成為專(zhuān)業(yè)的判卷老師

          考試
          用扣子打一個(gè)智能體,實(shí)現(xiàn)不同學(xué)員對(duì)掌握的知識(shí)進(jìn)行測(cè)試,根據(jù)測(cè)試結(jié)果進(jìn)行打分和二次出題測(cè)試



          posted @ 2025-01-17 11:23 paulwong 閱讀(147) | 評(píng)論 (0)編輯 收藏

          搭建llamafactory微調(diào)、評(píng)估、測(cè)試和量化環(huán)境

          0. 配置環(huán)境變量
          HF_ENDPOINT=https://hf-mirror.com
          HF_HOME=/root/autodl-tmp/paul/tools/huggingface

          1. 本機(jī)安裝python 3.10, 并設(shè)置軟件源
          pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
          pip config set global.index-url https://mirrors.huaweicloud.com/repository/pypi/simple

          2. 安裝miniconda

          3. 新建一個(gè)環(huán)境, 并激活
          conda create -n quantization python=3.12

          2. 本機(jī)安裝pytorch2.5.1+cuda12.4
          pip3 install torch torchvision torchaudio
          pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

          3. clone llamafactory源碼
          git clone https://github.com/hiyouga/LLaMA-Factory

          4. llamafactory本地安裝依賴(lài)
          pip install -e .
          pip install -e .["vllm","gptq"]

          5. 啟動(dòng)webui
          llamafactory-cli webui

          6. 在頁(yè)面中填入相關(guān)參數(shù)進(jìn)行操作

          posted @ 2025-01-16 16:54 paulwong 閱讀(142) | 評(píng)論 (0)編輯 收藏

          量化大模型工具

          VLLM量化推理
          https://llmc-zhcn.readthedocs.io/en/latest/backend/vllm.html#id1

          安裝此工具前需安裝兩個(gè)包:
          sudo apt-get install cmake
          sudo apt-get install pkgconfig

          配置huggingface鏡像地址:
          export HF_ENDPOINT=https://hf-mirror.com

          下載代碼庫(kù), 并安裝python依賴(lài)
          git clone https://github.com/ModelTC/llmc.git
          cd llmc/
          pip install -r requirements.txt

          找到量化方法的配置文件, 并作修改
          base:
              seed: &seed 42
          model:
              type: Llama
              path: /home/paul/.cache/huggingface/models/models--unsloth--llama-3-8b-Instruct-lawdata
              torch_dtype: auto
          quant:
              method: RTN
              weight:
                  bit: 8
                  symmetric: True
                  granularity: per_group
                  group_size: 128
                  need_pack: True
          eval:
              eval_pos: [fake_quant]
              name: wikitext2
              download: True
              path: /home/paul/paulwong/work/workspaces/llmc/dataset
              bs: 1
              seq_len: 2048
              inference_per_block: False
          save:
              save_vllm: True
              save_path: /home/paul/.cache/huggingface/models/models--unsloth--llama-3-8b-Instruct-lawdata-quantization

          找到run_llmc.sh, 并作修改
          #!/bin/bash

          # export CUDA_VISIBLE_DEVICES=0,1

          llmc=/home/paul/paulwong/work/workspaces/llmc
          export PYTHONPATH=$llmc:$PYTHONPATH

          # task_name=awq_w_only
          # config=${llmc}/configs/quantization/methods/Awq/awq_w_only.yml
          task_name=rtn_for_vllm
          config=${llmc}/configs/quantization/backend/vllm/rtn_w8a16.yml

          nnodes=1
          nproc_per_node=1


          find_unused_port() {
              while true; do
                  port=$(shuf -i 10000-60000 -n 1)
                  if ! ss -tuln | grep -q ":$port "; then
                      echo "$port"
                      return 0
                  fi
              done
          }
          UNUSED_PORT=$(find_unused_port)


          MASTER_ADDR=127.0.0.1
          MASTER_PORT=$UNUSED_PORT
          task_id=$UNUSED_PORT

          nohup \
          torchrun \
          --nnodes $nnodes \
          --nproc_per_node $nproc_per_node \
          --rdzv_id $task_id \
          --rdzv_backend c10d \
          --rdzv_endpoint $MASTER_ADDR:$MASTER_PORT \
          ${llmc}/llmc/__main__.py --config $config --task_id $task_id \
          > ${task_name}.log 2>&1 &

          sleep 2
          ps aux | grep '__main__.py' | grep $task_id | awk '{print $2}' > ${task_name}.pid

          # You can kill this program by 
          # xargs kill -9 < xxx.pid
          # xxx.pid is ${task_name}.pid file

          執(zhí)行量化操作
          bash scripts/run_llmc.sh




          posted @ 2025-01-15 18:00 paulwong 閱讀(92) | 評(píng)論 (0)編輯 收藏

          微調(diào)資源

          Fine-tune Llama 3.1 Ultra-Efficiently with Unsloth
          https://huggingface.co/blog/mlabonne/sft-llama3

          A beginners guide to fine tuning LLM using LoRA
          https://zohaib.me/a-beginners-guide-to-fine-tuning-llm-using-lora/

          【Day 23】調(diào)教你的 AI 寵物:用微調(diào)讓 LLM 乖乖聽(tīng)話
          https://ithelp.ithome.com.tw/articles/10346441


          posted @ 2025-01-15 17:56 paulwong 閱讀(72) | 評(píng)論 (0)編輯 收藏

          安裝docker版的Nvidia container toolkit

          https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installation

          posted @ 2025-01-13 14:20 paulwong 閱讀(50) | 評(píng)論 (0)編輯 收藏

          僅列出標(biāo)題
          共115頁(yè): 上一頁(yè) 1 2 3 4 5 6 7 8 9 下一頁(yè) Last 
          主站蜘蛛池模板: 高碑店市| 安义县| 晋中市| 托里县| 襄垣县| 沙河市| 西畴县| 六安市| 博湖县| 辽源市| 南丰县| 安化县| 武穴市| 澄迈县| 南木林县| 沧州市| 卓资县| 尖扎县| 岑巩县| 云安县| 定南县| 克拉玛依市| 龙门县| 连江县| 莎车县| 九龙坡区| 洪泽县| 中宁县| 抚松县| 元谋县| 桐城市| 长武县| 嘉善县| 白水县| 涞源县| 固镇县| 都匀市| 萨迦县| 福海县| 高安市| 屯门区|