paulwong

#

AI应用场景

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/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 阅读(69) | 评论 (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 阅读(49) | 评论 (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 阅读(62) | 评论 (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