【大模型实战篇】使用GPTQ量化QwQ-32B微调后的推理模型

1. 量化背景

        之所以做量化,就是希望在现有的硬件条件下,提升性能。量化能将模型权重从高精度(如FP32)转换为低精度(如INT8/FP16),内存占用可减少50%~75%。低精度运算(如INT8)在GPU等硬件上计算效率更高,推理速度可提升2~4倍。

        我们的任务是,将QwQ-32B微调后的推理模型,也就是bf16的精度,通过量化,压缩到int4。关于QwQ-32B微调,可以参考《利用ms-swift微调框架对QwQ-32B推理模型进行微调》。关于推理模型吞吐性能对比,可以参考《对比包括QwQ-32B在内的不同推理模型的吞吐量表现》。

2. 量化流程

        接下来进入量化介绍:

        QwQ-32B的模型架构依然还是Qwen2系列,所以可以使用GPTQ进行量化。之前尝试用AWQ,会报错。下列内容是基于AutoGPTQ实现量化。

        首先通过安装源代码的方式获取并安装最新版本的该软件包。

git clone https://github.com/AutoGPTQ/AutoGPTQ
cd AutoGPTQ
pip install -e .

        假设基于QwQ-32B模型进行微调,并将该微调后的模型命名为 QwQ-32B-finetuned ,且使用的是自己的带推理链的数据集。要构建GPTQ量化模型,还需要使用训练数据进行校准。

        这里校准数据的设置,最好配置参数damp_percent=0.1,然后我采用的校准样本量是128个sample。不然会报错【1】:

torch._C._LinAlgError: linalg.cholesky: The factorization could not be completed because the input is not positive-definite

        在我的场景中,damp_percent我设置0.01,通过调整校准样本量解决了该报错。

        我们采用双卡进行量化,脚本如下:        

from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
from transformers import AutoTokenizer
import torch
import json# 设置路径
model_path = "/data/QwQ-32B-finetuned"
quant_path = "/data/quantized_model"# 设置量化配置
quantize_config = BaseQuantizeConfig(bits=4,  # 可选择4或8位量化group_size=128,damp_percent=0.01,desc_act=False,  # 为了加速推理,可将其设置为False,但可能会导致困惑度稍差static_groups=False,sym=True,true_sequential=True,model_name_or_path=None,model_file_base_name="model"
)max_len = 8192  # 设置最大文本长度# 加载tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_path)# 加载模型,并指定使用GPU 2和GPU 5
model = AutoGPTQForCausalLM.from_pretrained(model_path,quantize_config,max_memory={2: "80GB", 5: "80GB"}  # 使用GPU 2和GPU 5,各分配80GB显存
)# 准备校准数据集
data = []
with open("/data/jz_v0303.jsonl", "r") as f:for line in f:msg = json.loads(line)text = tokenizer.apply_chat_template(msg["messages"], tokenize=False, add_generation_prompt=False)model_inputs = tokenizer([text])input_ids = torch.tensor(model_inputs.input_ids[:max_len], dtype=torch.int)data.append(dict(input_ids=input_ids, attention_mask=input_ids.ne(tokenizer.pad_token_id)))# 运行量化过程
import logginglogging.basicConfig(format="%(asctime)s %(levelname)s [%(name)s] %(message)s", level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S"
)
model.quantize(data, cache_examples_on_gpu=False)# 保存量化后的模型
model.save_quantized(quant_path, use_safetensors=True)
tokenizer.save_pretrained(quant_path)

量化日志:

        QwQ有64层transformer层,整个量化共花费约110分钟。

Loading checkpoint shards: 100%|██████████| 14/14 [00:24<00:00,  1.74s/it]
INFO - Start quantizing layer 1/64
INFO - Quantizing self_attn.k_proj in layer 1/64...
2025-03-16 13:08:27 INFO [auto_gptq.quantization.gptq] duration: 4.176503658294678
2025-03-16 13:08:27 INFO [auto_gptq.quantization.gptq] avg loss: 4.942690849304199
INFO - Quantizing self_attn.v_proj in layer 1/64...
2025-03-16 13:08:28 INFO [auto_gptq.quantization.gptq] duration: 1.400636911392212
2025-03-16 13:08:28 INFO [auto_gptq.quantization.gptq] avg loss: 1.4266357421875
INFO - Quantizing self_attn.q_proj in layer 1/64...
2025-03-16 13:08:30 INFO [auto_gptq.quantization.gptq] duration: 1.4035542011260986
2025-03-16 13:08:30 INFO [auto_gptq.quantization.gptq] avg loss: 14.252044677734375
INFO - Quantizing self_attn.o_proj in layer 1/64...
2025-03-16 13:08:35 INFO [auto_gptq.quantization.gptq] duration: 1.4259772300720215
2025-03-16 13:08:35 INFO [auto_gptq.quantization.gptq] avg loss: 21.492481231689453
INFO - Quantizing mlp.up_proj in layer 1/64...
2025-03-16 13:08:42 INFO [auto_gptq.quantization.gptq] duration: 1.4980144500732422
2025-03-16 13:08:42 INFO [auto_gptq.quantization.gptq] avg loss: 11.520009994506836
INFO - Quantizing mlp.gate_proj in layer 1/64...
2025-03-16 13:08:43 INFO [auto_gptq.quantization.gptq] duration: 1.4689013957977295
2025-03-16 13:08:43 INFO [auto_gptq.quantization.gptq] avg loss: 13.158416748046875
INFO - Quantizing mlp.down_proj in layer 1/64...
2025-03-16 13:09:36 INFO [auto_gptq.quantization.gptq] duration: 11.233691692352295
2025-03-16 13:09:36 INFO [auto_gptq.quantization.gptq] avg loss: 5.198782444000244
INFO - Start quantizing layer 2/64
INFO - Quantizing self_attn.k_proj in layer 2/64...
2025-03-16 13:09:50 INFO [auto_gptq.quantization.gptq] duration: 1.4270472526550293
2025-03-16 13:09:50 INFO [auto_gptq.quantization.gptq] avg loss: 0.25423723459243774
INFO - Quantizing self_attn.v_proj in layer 2/64...
2025-03-16 13:09:51 INFO [auto_gptq.quantization.gptq] duration: 1.377784252166748
2025-03-16 13:09:51 INFO [auto_gptq.quantization.gptq] avg loss: 0.12605950236320496
INFO - Quantizing self_attn.q_proj in layer 2/64...
2025-03-16 13:09:53 INFO [auto_gptq.quantization.gptq] duration: 1.3954062461853027
2025-03-16 13:09:53 INFO [auto_gptq.quantization.gptq] avg loss: 0.6923567056655884
INFO - Quantizing self_attn.o_proj in layer 2/64...
2025-03-16 13:09:58 INFO [auto_gptq.quantization.gptq] duration: 1.4187729358673096
2025-03-16 13:09:58 INFO [auto_gptq.quantization.gptq] avg loss: 0.21527329087257385
INFO - Quantizing mlp.up_proj in layer 2/64...
2025-03-16 13:10:05 INFO [auto_gptq.quantization.gptq] duration: 1.4918739795684814
2025-03-16 13:10:05 INFO [auto_gptq.quantization.gptq] avg loss: 42.98908615112305
INFO - Quantizing mlp.gate_proj in layer 2/64...
2025-03-16 13:10:07 INFO [auto_gptq.quantization.gptq] duration: 1.4632303714752197
2025-03-16 13:10:07 INFO [auto_gptq.quantization.gptq] avg loss: 254.09523010253906
INFO - Quantizing mlp.down_proj in layer 2/64...
2025-03-16 13:10:59 INFO [auto_gptq.quantization.gptq] duration: 11.405533790588379
2025-03-16 13:10:59 INFO [auto_gptq.quantization.gptq] avg loss: 1.4062278270721436
INFO - Start quantizing layer 3/64

.......

2025-03-16 14:33:08 INFO [auto_gptq.quantization.gptq] duration: 11.416744709014893
2025-03-16 14:33:08 INFO [auto_gptq.quantization.gptq] avg loss: 10015.05078125
INFO - Start quantizing layer 62/64
INFO - Quantizing self_attn.k_proj in layer 62/64...
2025-03-16 14:33:22 INFO [auto_gptq.quantization.gptq] duration: 1.4608099460601807
2025-03-16 14:33:22 INFO [auto_gptq.quantization.gptq] avg loss: 129.20584106445312
INFO - Quantizing self_attn.v_proj in layer 62/64...
2025-03-16 14:33:23 INFO [auto_gptq.quantization.gptq] duration: 1.417314052581787
2025-03-16 14:33:23 INFO [auto_gptq.quantization.gptq] avg loss: 834.720947265625
INFO - Quantizing self_attn.q_proj in layer 62/64...
2025-03-16 14:33:25 INFO [auto_gptq.quantization.gptq] duration: 1.4364099502563477
2025-03-16 14:33:25 INFO [auto_gptq.quantization.gptq] avg loss: 770.3301391601562
INFO - Quantizing self_attn.o_proj in layer 62/64...
2025-03-16 14:33:30 INFO [auto_gptq.quantization.gptq] duration: 1.4644238948822021
2025-03-16 14:33:30 INFO [auto_gptq.quantization.gptq] avg loss: 1413.948486328125
INFO - Quantizing mlp.up_proj in layer 62/64...
2025-03-16 14:33:38 INFO [auto_gptq.quantization.gptq] duration: 1.5320115089416504
2025-03-16 14:33:38 INFO [auto_gptq.quantization.gptq] avg loss: 7386.39453125
INFO - Quantizing mlp.gate_proj in layer 62/64...
2025-03-16 14:33:39 INFO [auto_gptq.quantization.gptq] duration: 1.5006358623504639
2025-03-16 14:33:39 INFO [auto_gptq.quantization.gptq] avg loss: 6787.9912109375
INFO - Quantizing mlp.down_proj in layer 62/64...
2025-03-16 14:34:32 INFO [auto_gptq.quantization.gptq] duration: 11.412427186965942
2025-03-16 14:34:32 INFO [auto_gptq.quantization.gptq] avg loss: 11235.9814453125
INFO - Start quantizing layer 63/64
INFO - Quantizing self_attn.k_proj in layer 63/64...
2025-03-16 14:34:46 INFO [auto_gptq.quantization.gptq] duration: 1.4546654224395752
2025-03-16 14:34:46 INFO [auto_gptq.quantization.gptq] avg loss: 130.98355102539062
INFO - Quantizing self_attn.v_proj in layer 63/64...
2025-03-16 14:34:48 INFO [auto_gptq.quantization.gptq] duration: 1.4156157970428467
2025-03-16 14:34:48 INFO [auto_gptq.quantization.gptq] avg loss: 958.8649291992188
INFO - Quantizing self_attn.q_proj in layer 63/64...
2025-03-16 14:34:49 INFO [auto_gptq.quantization.gptq] duration: 1.4323241710662842
2025-03-16 14:34:49 INFO [auto_gptq.quantization.gptq] avg loss: 780.7476196289062
INFO - Quantizing self_attn.o_proj in layer 63/64...
2025-03-16 14:34:55 INFO [auto_gptq.quantization.gptq] duration: 1.4556679725646973
2025-03-16 14:34:55 INFO [auto_gptq.quantization.gptq] avg loss: 2276.7041015625
INFO - Quantizing mlp.up_proj in layer 63/64...
2025-03-16 14:35:01 INFO [auto_gptq.quantization.gptq] duration: 1.533803939819336
2025-03-16 14:35:01 INFO [auto_gptq.quantization.gptq] avg loss: 7764.6142578125
INFO - Quantizing mlp.gate_proj in layer 63/64...
2025-03-16 14:35:03 INFO [auto_gptq.quantization.gptq] duration: 1.4962470531463623
2025-03-16 14:35:03 INFO [auto_gptq.quantization.gptq] avg loss: 7304.74365234375
INFO - Quantizing mlp.down_proj in layer 63/64...
2025-03-16 14:35:56 INFO [auto_gptq.quantization.gptq] duration: 11.429993629455566
2025-03-16 14:35:56 INFO [auto_gptq.quantization.gptq] avg loss: 17015.2734375
INFO - Start quantizing layer 64/64
INFO - Quantizing self_attn.k_proj in layer 64/64...
2025-03-16 14:36:10 INFO [auto_gptq.quantization.gptq] duration: 1.453392744064331
2025-03-16 14:36:10 INFO [auto_gptq.quantization.gptq] avg loss: 112.55108642578125
INFO - Quantizing self_attn.v_proj in layer 64/64...
2025-03-16 14:36:11 INFO [auto_gptq.quantization.gptq] duration: 1.4028844833374023
2025-03-16 14:36:11 INFO [auto_gptq.quantization.gptq] avg loss: 509.4556884765625
INFO - Quantizing self_attn.q_proj in layer 64/64...
2025-03-16 14:36:12 INFO [auto_gptq.quantization.gptq] duration: 1.434821605682373
2025-03-16 14:36:12 INFO [auto_gptq.quantization.gptq] avg loss: 685.0777587890625
INFO - Quantizing self_attn.o_proj in layer 64/64...
2025-03-16 14:36:18 INFO [auto_gptq.quantization.gptq] duration: 1.4707720279693604
2025-03-16 14:36:18 INFO [auto_gptq.quantization.gptq] avg loss: 990.3109130859375
INFO - Quantizing mlp.up_proj in layer 64/64...
2025-03-16 14:36:25 INFO [auto_gptq.quantization.gptq] duration: 1.572035312652588
2025-03-16 14:36:25 INFO [auto_gptq.quantization.gptq] avg loss: 8309.283203125
INFO - Quantizing mlp.gate_proj in layer 64/64...
2025-03-16 14:36:27 INFO [auto_gptq.quantization.gptq] duration: 1.8046717643737793
2025-03-16 14:36:27 INFO [auto_gptq.quantization.gptq] avg loss: 7995.7509765625
INFO - Quantizing mlp.down_proj in layer 64/64...
2025-03-16 14:37:20 INFO [auto_gptq.quantization.gptq] duration: 11.410486698150635
2025-03-16 14:37:20 INFO [auto_gptq.quantization.gptq] avg loss: 27875.2734375
INFO - Packing model...
2025-03-16 14:37:25 INFO [auto_gptq.modeling._utils] Packing model...
Packing model.layers.63.mlp.down_proj...: 100%|██████████| 448/448 [20:01<00:00,  2.68s/it]   
INFO - Model packed.
2025-03-16 14:57:31 INFO [auto_gptq.modeling._utils] Model packed.

量化前模型大小为62G:

total 62G
-rw-r--r-- 1 research research  707 Mar 12 10:19 added_tokens.json
-rw-r--r-- 1 research research  16K Mar 12 10:19 args.json
-rw-r--r-- 1 research research  785 Mar 12 10:15 config.json
-rw-r--r-- 1 research research  214 Mar 12 10:15 generation_config.json
-rw-r--r-- 1 research research 1.6M Mar 12 10:19 merges.txt
-rw-r--r-- 1 research research 4.6G Mar 12 10:15 model-00001-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:16 model-00002-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:16 model-00003-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:16 model-00004-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:16 model-00005-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:17 model-00006-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:17 model-00007-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:17 model-00008-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:18 model-00009-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:18 model-00010-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:18 model-00011-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:18 model-00012-of-00014.safetensors
-rw-r--r-- 1 research research 4.6G Mar 12 10:19 model-00013-of-00014.safetensors
-rw-r--r-- 1 research research 2.0G Mar 12 10:19 model-00014-of-00014.safetensors
-rw-r--r-- 1 research research  62K Mar 12 10:19 model.safetensors.index.json
-rw-r--r-- 1 research research  613 Mar 12 10:19 special_tokens_map.json
-rw-r--r-- 1 research research 8.0K Mar 12 10:19 tokenizer_config.json
-rw-r--r-- 1 research research  11M Mar 12 10:19 tokenizer.json
-rw-r--r-- 1 research research 2.7M Mar 12 10:19 vocab.json

量化后模型大小为19G:

total 19G
-rw-r--r-- 1 research research  707 Mar 16 14:58 added_tokens.json
-rw-r--r-- 1 research research 1.2K Mar 16 14:58 config.json
-rw-r--r-- 1 research research 1.6M Mar 16 14:58 merges.txt
-rw-r--r-- 1 research research  19G Mar 16 14:58 model.safetensors
-rw-r--r-- 1 research research  271 Mar 16 14:58 quantize_config.json
-rw-r--r-- 1 research research  613 Mar 16 14:58 special_tokens_map.json
-rw-r--r-- 1 research research 8.0K Mar 16 14:58 tokenizer_config.json
-rw-r--r-- 1 research research  11M Mar 16 14:58 tokenizer.json
-rw-r--r-- 1 research research 2.7M Mar 16 14:58 vocab.json

3. 量化模型部署

        vLLM已支持GPTQ,可以直接使用AutoGPTQ量化的模型。使用GPTQ模型与vLLM的基本用法相同。

CUDA_VISIBLE_DEVICES=0,1,2,3 \
vllm serve /data/quantized_model \
--tensor-parallel-size 4 \
--port 8001

        另外对api调用的model id,可以通过设置别名方式,而不需要暴露完整路径:

vllm serve my_model --served-model-name my_alias

        随后,可以这样调用API:

curl http://localhost:8001/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "quantized_model","messages": [{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},{"role": "user", "content": "推荐一款防水耳机."}],"temperature": 0.7,"top_p": 0.8,"repetition_penalty": 1.05,"max_tokens": 512
}'

        也可以使用 openai Python包中的API客户端:

from openai import OpenAIopenai_api_key = "EMPTY"
openai_api_base = "http://localhost:8001/v1"client = OpenAI(api_key=openai_api_key,base_url=openai_api_base,
)chat_response = client.chat.completions.create(model="/data/quantized_model",messages=[{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},{"role": "user", "content": "推荐一款防水耳机"},],temperature=0.7,top_p=0.8,max_tokens=512,extra_body={"repetition_penalty": 1.05,},
)
print("Chat response:", chat_response)

        实测了下,模型生成吞吐量可以在92 tokens/s, 还是很不错的。

       注意:需要注意下,百亿参数的模型,一般还是选择int8量化比较合适。int4更适合是千亿模型,百亿规模损失会有点大。

        以下是int8的量化loss表现:

       还有一个需要注意的是,量化后用vllm推理,默认会在prompt中添加<|im_start>assistant\n<think>这段,其实就是强制模型先输出推理链,本质上是指令遵循。所以你推理拿到的生成结果看起来是丢了<think>这个特殊token,实际上是已经在prompt中体现了。

4. 参考材料

【1】https://github.com/AutoGPTQ/AutoGPTQ/issues/196   

【2】GPTQ - Qwen    

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/34965.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Unity 笔记:在EditorWindow中绘制 Sorting Layer

在Unity开发过程中&#xff0c;可能会对旧资源进行批量修改&#xff0c;一个个手动修改费人费事&#xff0c;所以催生出了一堆批量工具。 分享一下在此过程中绘制 Sorting Layer 面板的代码脚本。 示意图&#xff1a; 在 EditorGUI 和 EditorGUILayer 中内置了 SortingLayerF…

idea更新git代码报错No Git Roots

idea更新git代码报错&#xff1a; No Git Roots None of configured Git roots are under Git. The configured directory must have ".git directory in it.但是本地项目里是存在.git文件的&#xff0c;就是突然间不能更新代码了 然后尝试重新拉新项目代码提示: Git i…

失败的面试经历(ʘ̥∧ʘ̥)

一.面向对象的三大特性 1.封装&#xff1a;将对象内部的属性私有化&#xff0c;外部对象不能够直接访问&#xff0c;但是可以提供一些可以使外部对象操作内部属性的方法。 2.继承&#xff1a;类与类之间会有一些相似之处&#xff0c;但也会有一些异处&#xff0c;使得他们与众…

qt加载VeloView工程

接上一篇点云软件配置与编译&#xff0c;使用qt加载需要先完成编译。编译完成后到编译目录下lidarview-superbuild\common-superbuild\lidarview\build 找到CmakeCache.txt&#xff0c;如下是我的编译目录。 使用QT6.5.3加载了CmakeCache.txt&#xff0c;QT5.14还加载不了cmake…

Windows Qt动态监测系统分辨率及缩放比变化

前言 Windows 显示设置中&#xff0c;可以修改缩放比&#xff0c;所有界面和文字会同比例放大或缩小&#xff0c;在开发桌面程序时&#xff0c; 实时监测Qt应用程序在不同缩放比例下的表现&#xff0c;可以及时调整程序界面以适应不同显示屏幕的需求。 正文 本文通过Qt相关…

CVE-2017-5645(使用 docker 搭建)

介绍: 是一个与 Apache Log4j2 相关的安全漏洞,属于远程代码执行,它可能允许攻击者通过构造恶意的日志信息 在目标系统上执行任意代码 Log4j2 介绍 Log4j2 是 Apache 的一个日志记录工具,属于 Java 应用的日志框架,它是 Log4j 的升级版,性能更好,功能更多.它被广泛的适用于 J…

交互式可视化进阶(Plotly Dash构建疫情仪表盘)

这里写目录标题 交互式可视化进阶(Plotly Dash构建疫情仪表盘)1. 引言2. 项目背景与意义3. 数据集生成与介绍4. GPU加速在数据处理中的应用5. 交互式仪表盘构建与Plotly Dash6. PyQt GUI集成与美化7. 工程整体架构8. 部分代码实现9. 代码自查与BUG排查10. 总结与展望交互式可…

RabbitMQ(补档)

RabbitMQ 是一个开源的消息队列软件&#xff08;有时也被称为消息代理&#xff09;&#xff0c;它实现了高级消息队列协议&#xff08;AMQP&#xff09;。它主要用于应用程序之间&#xff0c;或者软件组件之间的消息通信。通过使用 RabbitMQ&#xff0c;可以实现异步的、可靠的…

平方矩阵问题

Ⅰ 回字形二维数组 #include <iostream> #include <iomanip> using namespace std; int main(){int n;while(cin>>n,n){for(int i0; i<n;i){for(int j0; j<n; j){int upi, downn-i1, leftj, rightn-j1;cout<<min(min(up,down),min(left,right)…

电子电气架构 --- 智能座舱和车载基础软件简介

我是穿拖鞋的汉子,魔都中坚持长期主义的汽车电子工程师。 老规矩,分享一段喜欢的文字,避免自己成为高知识低文化的工程师: 人生是一场骗局,最大的任务根本不是什么买车买房,也不是及时行乐,这就是欲望,不是理想,是把自己对生命的希望寄托在外物上,正确的做法应该是内…

Qt 通过MSVC编译运行项目

第一步下载Qt 把Qt能选的插件都选上&#xff0c;有的是连接数据库必须得插件&#xff0c;有的是做图表必须得插件&#xff0c;有的是运行MSVC必须得插件&#xff0c;能选尽量都选上。 第二步安装VS2017&#xff0c;当然我们安装2017的目的主要是用C的编译器&#xff0c;这里提…

高效手机检测:视觉分析技术的优势

在当今社会&#xff0c;手机已成为人们日常生活和工作中不可或缺的工具。然而&#xff0c;在某些特定场合&#xff0c;如考场、工作场所等&#xff0c;手机的使用却可能带来负面影响。因此&#xff0c;如何有效监测和防止在这些场合偷用手机的行为&#xff0c;成为了一个亟待解…

Gitee重新远程连接仓库(Linux)

Gitee重新远程连接仓库&#xff08;Linux&#xff09; 因为虚拟机重新安装了一回&#xff0c;所以需要重新和远程仓库连接&#xff0c;在网上找了很久没有找到相关操作&#xff0c;自己实操成功&#xff0c;记录下本博客&#xff0c;帮助有需要的人 确保新虚拟机安装Git 在新虚…

【论文笔记】FFA-Net: Feature Fusion Attention Network for Single Image Dehazing

文章目录 1. 研究背景2. FFA - Net网络结构3. 实验结果4. 研究贡献5. 重点详解1. 通道注意力&#xff08;Channel Attention, CA&#xff09;通道注意力的实现步骤&#xff1a; 2. 像素注意力&#xff08;Pixel Attention, PA&#xff09;像素注意力的实现步骤&#xff1a; 3. …

计算机视觉cv2入门之图像的读取,显示,与保存

在计算机视觉领域&#xff0c;Python的cv2库是一个不可或缺的工具&#xff0c;它提供了丰富的图像处理功能。作为OpenCV的Python接口&#xff0c;cv2使得图像处理的实现变得简单而高效。 示例图片 目录 opencv获取方式 图像基本知识 颜色空间 RGB HSV 图像格式 BMP格式 …

深度学习中的向量的样子-DCN

深度学习中向量都是 竖着的&#xff0c;譬如 DCN中的计算逻辑

OBS推WebRTC流,并添加毫秒级时间显示

作者在用OBS推WebRTC流&#xff0c;并用浏览器观看推送的实时流。另外就是想看一下延迟有多少。采用一台电脑&#xff0c;流媒体服务器为SRS&#xff0c;相关配置比较简单&#xff0c;可以自行搜索。 推送的流 http://localhost:1985/rtc/v1/whip/?applive&streamlivestr…

【MySQL】多表操作 —— 外键约束

目录 多表关系一对一关系一对多/多对一关系多对多关系 外键约束基本概念一对多/多对一创建外键约束外键约束下的数据操作数据插入数据删除 删除外键约束 多对多创建外键约束外键约束下的数据操作数据插入数据删除 删除外键约束 多表关系 MySQL 多表之间的关系可以概括为&#…

82.HarmonyOS NEXT 性能优化指南:从理论到实践

温馨提示&#xff1a;本篇博客的详细代码已发布到 git : https://gitcode.com/nutpi/HarmonyosNext 可以下载运行哦&#xff01; HarmonyOS NEXT 性能优化指南&#xff1a;从理论到实践 文章目录 HarmonyOS NEXT 性能优化指南&#xff1a;从理论到实践1. 性能优化概述1.1 性能指…