paulwong

          #

          AI應用場景

          @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是虛的還是假的, 在企業中有沒實際落地場景, 以下取實際應用場景:

          生物公司
          使用qwen2:7b訓練細胞制備領域的數據集,目標是
          1.預測細胞收獲量  
          2.算細胞存活狀態(存活/死亡)
          3.預測工藝是否成功
          4.可以提前預測細胞的質量是否達標,以便及時采取措施進行調整
          5.細胞培養過程中出現大量細胞死亡的情況,模型可以根據實時數據和歷史經驗,分析可能是培養箱溫度失控、培養基成分錯誤或受到污染等原因導致的,并提供相應的排查建議」

          文體旅游
          智能旅游系統:
          提供目的地介紹、
          旅行路線規劃、
          酒店預訂和景
          點推薦等服務。

          考試改卷
          基于大模型,做一個判試卷的應用,能夠判斷主觀題,比如閱讀理解,比如歷史,地理,政治問答題。
          判卷準確率不能低于人工判卷準確率。
          即一次考試,一個班50份試卷,判斷結果錯誤不超過5道題。判斷效率高于或等于人工。

          取過往同學試卷題目, 作答內容, 得分 作一波ocr出數據, 一個科目, 提取所有試卷內容, 最后就是一個科目一個模型, 提取的內容放在文本, csv, json,
          基于“bert-base-chinese”這個模型, 進行微調出專用模型即可,  
          讓大模型成為專業的判卷老師

          考試
          用扣子打一個智能體,實現不同學員對掌握的知識進行測試,根據測試結果進行打分和二次出題測試



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

          搭建llamafactory微調、評估、測試和量化環境

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

          1. 本機安裝python 3.10, 并設置軟件源
          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. 新建一個環境, 并激活
          conda create -n quantization python=3.12

          2. 本機安裝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本地安裝依賴
          pip install -e .
          pip install -e .["vllm","gptq"]

          5. 啟動webui
          llamafactory-cli webui

          6. 在頁面中填入相關參數進行操作

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

          量化大模型工具

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

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

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

          下載代碼庫, 并安裝python依賴
          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

          執行量化操作
          bash scripts/run_llmc.sh




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

          微調資源

          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】調教你的 AI 寵物:用微調讓 LLM 乖乖聽話
          https://ithelp.ithome.com.tw/articles/10346441


          posted @ 2025-01-15 17:56 paulwong 閱讀(70) | 評論 (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) | 評論 (0)編輯 收藏

          開源鏡像庫

          華為:
          https://mirrors.huaweicloud.com/home
          https://mirrors.huaweicloud.com/artifactory/pypi-public/simple/torch/

          清華:
          https://mirrors.tuna.tsinghua.edu.cn
          點擊問號進詳情

          docker:
          https://mirrors.huaweicloud.com/mirrorDetail/5ea14d84b58d16ef329c5c13?mirrorName=docker-ce&catalog=docker

          posted @ 2025-01-13 10:32 paulwong 閱讀(90) | 評論 (0)編輯 收藏

          windows中添加端口轉發規則

          設置端口轉發

          在 Windows 上,以管理員身份打開 PowerShell,
          netsh interface portproxy add v4tov4 listenport=7860 listenaddress=0.0.0.0 connectport=7860 connectaddress=123.45.67.89

          在 PowerShell 中使用 netsh interface portproxy 命令設置的端口轉發規則是持久性的。這些規則會在系統重啟后繼續生效,因為它們被存儲在 Windows 的注冊表中。

          刪除端口轉發規則

          如果想刪除之前設置的端口轉發規則,可以使用以下命令:
          netsh interface portproxy delete v4tov4 listenport=7860 listenaddress=0.0.0.0

          這里的 listenport 和 listenaddress 應與之前設置時的值一致。

          查看當前的端口轉發規則

          要查看當前系統中所有的端口轉發規則,可以運行:
          netsh interface portproxy show all


          posted @ 2025-01-13 09:34 paulwong 閱讀(138) | 評論 (0)編輯 收藏

          AI微調框架axolotl安裝

          1. N卡驅動和toolkit安裝
          https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=runfile_local
           
          2. python和mini-conda安裝
          基本是要下載安裝包安裝,
          python下載地址:https://repo.huaweicloud.com/python/3.12.8/
          m
          ini-conda下載地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
          co
          nda清華資源:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/


          3. 新建一個conda環境
          conda create -n axolotl python=3.12

          4. cuda版本的pytorch安裝
          https://download.pytorch.org/whl/cu124/torch-2.5.0%2Bcu124-cp311-cp311-linux_x86_64.whl#sha256=5e3f4a7ba812517c2c1659857b5195f287a288fbd050a5abf9311e03dbe1a28b
          如想安裝其他版本, 可從以下網址查找:
          https://download.pytorch.org/whl/torch

          5. git clone https://github.com/axolotl-ai-cloud/axolotl, cd到根目錄, 運行
          pip3 install --no-build-isolation axolotl[flash-attn,deepspeed]





          posted @ 2025-01-12 16:37 paulwong 閱讀(63) | 評論 (0)編輯 收藏

          內網穿透工具

          將內網, 如家庭中的使用wifi建立的網站, 發布到外網, 而無需使用服務器.

          https://i.cpolar.com/m/5jN0

          reference:
          https://www.cpolar.com/blog/cpolar-quick-start-tutorial-ubuntu-series

          posted @ 2025-01-12 11:54 paulwong 閱讀(158) | 評論 (0)編輯 收藏

          安裝cuda版本的pytorch

          先下載cuda版本的pytorch的整個打包文件:
          https://download.pytorch.org/whl/cu124/torch-2.5.1%2Bcu124-cp312-cp312-linux_x86_64.whl#sha256=bf6484bfe5bc4f92a4a1a1bf553041505e19a911f717065330eb061afe0e14d7
          https://mirrors.huaweicloud.com/artifactory/pypi-public/simple/torch/


          pip install torch-2.5.1+cu124-cp312-cp312-linux_x86_64.whl

          驗證:
          #python
          import torch
          torch.__version__

          posted @ 2025-01-12 11:05 paulwong 閱讀(74) | 評論 (0)編輯 收藏

          僅列出標題
          共115頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
          主站蜘蛛池模板: 延川县| 赫章县| 乐山市| 诸暨市| 肇州县| 安泽县| 怀化市| 柳江县| 岳阳市| 平利县| 垦利县| 永嘉县| 辽宁省| 兴宁市| 西平县| 漳平市| 邓州市| 翁源县| 博湖县| 盐源县| 隆化县| 长子县| 元氏县| 手游| 理塘县| 淮阳县| 大余县| 和平区| 鄯善县| 多伦县| 鄂托克前旗| 淮阳县| 乌恰县| 溧阳市| 石屏县| 澜沧| 凤冈县| 南涧| 柏乡县| 库车县| 汪清县|