当前位置: 首页 > news >正文

Datawhale多模态赛事(1)

赛事说明:https://tianchi.aliyun.com/competition/entrance/532251/introduction?spm=a2c22.12281925.0.0.2f307137p8qZmp
学习平台:https://linklearner.com/home

第一天

1.报名赛道学习赛事 https://tianchi.aliyun.com/competition/entrance/532251
2.尝试跑通baseline并打卡 https://linklearner.com/activity/14/13/27

详细描述:
Better Synth 是一项以数据为中心的挑战赛,考察如何合成与清洗图文数据以在多模态大模型上取得更优的图片理解能力。
本次比赛基于 Mini-Gemini 模型进行训练,只关注于预训练(模态间对齐)阶段的数据合成与清洗,指令微调阶段为固定数据集。为了选手更高效地迭代数据合成方案,本次比赛选用 MGM-2B 规模的模型作为比赛模型。
主办方提供候选种子数据集,要求参赛者基于种子数据集进行数据合成与清洗,产出一份基于种子数据集的更高质量、更多样性的数据集,并在给定计算约束下进行训练。主办方提供开发套件,要求参赛者在统一的框架和参数设置下进行模型训练和任务评测,公平对比数据导致的性能差异。数据集产出流程中必须包含“合成”的过程,未包含的方案会被认为是无效方案。

环境安装

使用阿里云创建 DSW实例,可以试用3个月5000算力。然后在 魔搭社区 -> 我的Notebook -> 个人云账号授权实例 -> PAI-DSW 创建实例。
镜像链接:dsw-registry-vpc.cn-hangzhou.cr.aliyuncs.com/pai-training-algorithm/data-juicer-better-synth:0.0.1

若不是镜像链接的则需要安装环境:

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)# for data-juicer
echo "[1] Installing toolkit/data-juicer"
cd ${SCRIPT_DIR}/toolkit
git clone https://github.com/modelscope/data-juicer.git
cd data-juicer
pip install ".[all]"# for MGM training
echo "[2] Installing toolkit/training"
cd ${SCRIPT_DIR}/toolkit/training
pip install -e .
pip install flash-attn --no-build-isolationecho "Done"

baseline文件解析

  1. input -> pretrain_stage_1_10k:包含10k的图像文字数据对,images中是图像,mgm-pretrain-stage.json中是图像和文字对匹配
  2. models 中存放 BLIP2 模型
  3. toolkit:
    • train_mgm_2b_stage_1.sh 训练脚本
    • eval 评测数据集
    • training 训练数据集和模型
      • data: eval、finetune
      • model_zoo: LLM(Gemma)、Openai(CLIP)
  4. output:
    • image_caption_output / res_10k.jsonl
    • eval_result
    • training_dirs:pretrain_dir、finetune_dir

跑baseline

  1. 下载baseline代码: git clone https://www.modelscope.cn/datasets/Datawhale/better_synth_challenge_baseline.git
    安装
apt update & apt install axel zip file
pip install modelscope

其中 axel 可以用来加速下载。

  1. 下载模型和数据
cd better_synth_challenge_baseline
bash download.sh  ###大概需要50分钟

注意:
速度很慢可以 ctl+C 再重新下,每次会断点续传。
看到有 tar.gz.st 的就是还没下好,需要继续下载。
每次下载完毕后会进行解压缩,此时千万别看着卡住了就 ctl+c ,不然会没有完全解压缩出现问题。

下载的内容:

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)# for base models gemma模型
echo "[1] Downloading base models for training..."
mkdir -p ${SCRIPT_DIR}/toolkit/training/model_zoo/LLM/gemma
cd ${SCRIPT_DIR}/toolkit/training/model_zoo/LLM/gemma
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/models/gemma-2b-it.tar.gz
tar zxvf gemma-2b-it.tar.gz# openai 的 CLIP 模型视觉编码器
mkdir -p ${SCRIPT_DIR}/toolkit/training/model_zoo/OpenAI
cd ${SCRIPT_DIR}/toolkit/training/model_zoo/OpenAI
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/models/clip-vit-large-patch14-336.tar.gz
tar zxvf clip-vit-large-patch14-336.tar.gz
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/models/openclip-convnext-large-d-320-laion2B-s29B-b131K-ft-soup.tar.gz
tar zxvf openclip-convnext-large-d-320-laion2B-s29B-b131K-ft-soup.tar.gz# for training data
echo "[2] Downloading seed datasets..."
mkdir -p ${SCRIPT_DIR}/input
cd ${SCRIPT_DIR}/input
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/data/stage_1/pretrain_stage_1_10k.tar.gz
tar zxvf pretrain_stage_1_10k.tar.gz
cd pretrain_stage_1_10k
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/data/stage_1/mgm_pretrain_stage_1_10k.jsonl
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/data/stage_1/stage_1.jsonecho "[3] Downloading finetuning datasets..."
mkdir -p ${SCRIPT_DIR}/toolkit/training/data
cd ${SCRIPT_DIR}/toolkit/training/data
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/data/stage_1/finetuning_stage_1_12k.tar.gz
tar zxvf finetuning_stage_1_12k.tar.gz
cd finetuning_stage_1_12k
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/data/stage_1/mgm_instruction_stage_1_12k.json# for eval data
echo "[4] Downloading evaluation datasets"
mkdir -p ${SCRIPT_DIR}/toolkit/training/data
cd ${SCRIPT_DIR}/toolkit/training/data
axel -n 5 http://dail-wlcb.oss-cn-wulanchabu.aliyuncs.com/dj-competition/better_synth/data/stage_1/eval_stage_1.tar.gz
tar zxvf eval_stage_1.tar.gzecho "Done"

数据格式 mgm_pretrain_stage_1_10k.jsonl

{"id": "006092514", "text": "<__dj__image>\nthe end part of the minecraft exploits with tmg bond <|__dj__eoc|>", "images": ["images/00609/006092514.jpg"]}
{"id": "003743290", "text": "<__dj__image>\nfloral banner or background with white border - kostenk, vector grat stock fotografie <|__dj__eoc|>", "images": ["images/00374/003743290.jpg"]}
{"id": "001419269", "text": "<__dj__image>\na l c womens wool - blend coat in black <|__dj__eoc|>", "images": ["images/00141/001419269.jpg"]}
{"id": "005736255", "text": "<__dj__image>\nqueen of the coupons sticker <|__dj__eoc|>", "images": ["images/00573/005736255.jpg"]}
{"id": "005738088", "text": "<__dj__image>\ncolores coreline eye and cheek tin <|__dj__eoc|>", "images": ["images/00573/005738088.jpg"]}
  1. 下载BLIP模型,用来生成图片的字幕
### 下载BLIP模型,大概需要20分钟
from modelscope import snapshot_downloadmodel_dir = snapshot_download('goldsj/blip2-opt-2.7b', cache_dir='/mnt/workspace/better_synth_challenge_baseline/models', revision='master')

使用 data-juice 对数据进行处理:使用BLIP2对图片进行字幕生成
dj-process --config solution/image_captioning.yaml


dataset_path: /mnt/workspace/better_synth_challenge_baseline/input/pretrain_stage_1_10k/mgm_pretrain_stage_1_10k.jsonl
export_path: /mnt/workspace/better_synth_challenge_baseline/output/image_captioning_output/res_10k.jsonlnp: 1
process:- image_captioning_mapper:hf_img2seq: '/mnt/workspace/better_synth_challenge_baseline/models/goldsj/blip2-opt-2___7b'  # You can replace this path to a local downloaded HF modelkeep_original_sample: false  # we only need the recaptioned captions

输出

{"id":"006092514","text":"<__dj__image> an image of the minecraft logo showing a clock in an open area\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00609\/006092514.jpg"]}
{"id":"003743290","text":"<__dj__image> a colorful set of horizontal banners\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00374\/003743290.jpg"]}
{"id":"001419269","text":"<__dj__image> g-star wash - black wool overcoat in full length\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00141\/001419269.jpg"]}
{"id":"005736255","text":"<__dj__image> queen of the coupst stickers\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00573\/005736255.jpg"]}
{"id":"005738088","text":"<__dj__image> caroline powder blush in red with white labels and logos\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00573\/005738088.jpg"]}
{"id":"000270672","text":"<__dj__image> three donuts made with dark chocolate icing on top of a cooling rack\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00027\/000270672.jpg"]}
{"id":"000704893","text":"<__dj__image> the golden goose super star sneakers with glitter\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00070\/000704893.jpg"]}
{"id":"000888725","text":"<__dj__image> a star wars land in disney world\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00088\/000888725.jpg"]}
{"id":"002873494","text":"<__dj__image> gpu geforce gtx 1070 4gb oc\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00287\/002873494.jpg"]}
{"id":"000933565","text":"<__dj__image> playmobil® playset with toy soldier and green soldiers\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00093\/000933565.jpg"]}
{"id":"000398115","text":"<__dj__image> a beer logo with palm trees and the word goodland written to the right\n <|__dj__eoc|>","images":["\/mnt\/workspace\/better_synth_challenge_baseline\/input\/pretrain_stage_1_10k\/images\/00039\/000398115.jpg"]}
  1. 处理完数据后,执行模型的训练和推理
    需要修改实例配置,在 阿里云平台PAI -> 交互式建模(DSW) -> 变更实例配置,修改为32G显存及以上的GPU规格 (注意二阶段finetune需要至少32G)
    在这里插入图片描述

然后执行

cd toolkit
git clone https://github.com/modelscope/data-juicer.git
bash train_mgm_2b_stage_1.sh   ### 大概需要3小时

train_mgm_2b_stage_1.sh:这里会执行一个pretrain,二阶段 finetune,然后进行评测

#!/bin/bash
############################################################################
########################### Editable Part Begins ###########################
############################################################################# exp meta information
EXP_NAME=default
PRETRAIN_DATASET=../output/image_captioning_output/res_10k.jsonl
PRETRAIN_DATASET_IMAGE_PATH=../input/pretrain_stage_1_10k# training args
# pretraining
# make sure PRETRAIN_BATCH_SIZE_PER_GPU * PRETRAIN_GRADIENT_ACCUMULATION_STEPS * num_gpus = 256
# **NOTICE**: the default setting is for 1 GPU
PRETRAIN_BATCH_SIZE_PER_GPU=4
PRETRAIN_GRADIENT_ACCUMULATION_STEPS=64
PRETRAIN_DATALOADER_NUM_WORKERS=4
# finetuning
# make sure FINETUNE_BATCH_SIZE_PER_GPU * FINETUNE_GRADIENT_ACCUMULATION_STEPS * num_gpus = 128
# **NOTICE**: the default setting is for 1 GPU
FINETUNE_BATCH_SIZE_PER_GPU=4
FINETUNE_GRADIENT_ACCUMULATION_STEPS=32
FINETUNE_DATALOADER_NUM_WORKERS=4
# log and ckpt
LOGGING_STEP=1
CKPT_SAVE_STEPS=100
TOTAL_SAVE_CKPT_LIMIT=1# inference args
# inference for some benchmarks supports multi-gpus
INFER_CUDA_IDX="0"
############################################################################
############################ Editable Part Ends ############################
############################################################################
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)ORIGINAL_DATASET_ALL=$SCRIPT_DIR/../input/pretrain_stage_1_10k/stage_1.json# check the global size
PRETRAIN_PASS=`python $SCRIPT_DIR/training/preprocess/check_global_batch_size.py $PRETRAIN_BATCH_SIZE_PER_GPU $PRETRAIN_GRADIENT_ACCUMULATION_STEPS 256`
if [ "$PRETRAIN_PASS" = "False" ]; thenecho "[ERROR] The global batch size of pretraining stage is not 256! Please check and retry."exit
fi
FINETUNE_PASS=`python $SCRIPT_DIR/training/preprocess/check_global_batch_size.py $FINETUNE_BATCH_SIZE_PER_GPU $FINETUNE_GRADIENT_ACCUMULATION_STEPS 128`
if [ "$FINETUNE_PASS" = "False" ]; thenecho "[ERROR] The global batch size of finetuning stage is not 128! Please check and retry."exit
fi# check number of dataset samples
MAX_SAMPLE_NUM=200000
SAMPLED_PRETRAIN_DATASET=$PRETRAIN_DATASET-200k.jsonl
python $SCRIPT_DIR/training/preprocess/check_sample_number.py $PRETRAIN_DATASET $SAMPLED_PRETRAIN_DATASET $MAX_SAMPLE_NUM# convert dataset from dj format to llava format
PRETRAIN_DATASET_JSON=$SAMPLED_PRETRAIN_DATASET.json
python $SCRIPT_DIR/data-juicer/tools/multimodal/data_juicer_format_to_target_format/dj_to_llava.py $SAMPLED_PRETRAIN_DATASET $PRETRAIN_DATASET_JSON --image_special_token "<__dj__image>" --restore_questions True --original_llava_ds_path $ORIGINAL_DATASET_ALL# train model
PRETRAIN_NAME=MGM-2B-Pretrain-$EXP_NAME
FINETUNE_NAME=MGM-2B-Finetune-$EXP_NAME
AUX_SIZE=768NUM_TRAIN_EPOCHS=1
PRETRAIN_SAMPLE_NUM=200000mkdir -p $SCRIPT_DIR/../output/training_dirs/$PRETRAIN_NAME# ------------- Pretrain ---------------
deepspeed $SCRIPT_DIR/training/mgm/train/train_mem.py \--deepspeed $SCRIPT_DIR/training/scripts/zero2_offload.json \--model_name_or_path $SCRIPT_DIR/training/model_zoo/LLM/gemma/gemma-2b-it \--version gemma \--data_path $PRETRAIN_DATASET_JSON \--image_folder $PRETRAIN_DATASET_IMAGE_PATH \--vision_tower $SCRIPT_DIR/training/model_zoo/OpenAI/clip-vit-large-patch14-336 \--vision_tower_aux $SCRIPT_DIR/training/model_zoo/OpenAI/openclip-convnext-large-d-320-laion2B-s29B-b131K-ft-soup \--mm_projector_type mlp2x_gelu \--tune_mm_mlp_adapter True \--mm_vision_select_layer -2 \--mm_use_im_start_end False \--mm_use_im_patch_token False \--image_size_aux $AUX_SIZE \--bf16 True \--output_dir $SCRIPT_DIR/../output/training_dirs/$PRETRAIN_NAME \--num_train_epochs $NUM_TRAIN_EPOCHS \--per_device_train_batch_size $PRETRAIN_BATCH_SIZE_PER_GPU \--per_device_eval_batch_size 4 \--gradient_accumulation_steps $PRETRAIN_GRADIENT_ACCUMULATION_STEPS \--evaluation_strategy "no" \--save_strategy "steps" \--save_steps $CKPT_SAVE_STEPS \--save_total_limit $TOTAL_SAVE_CKPT_LIMIT \--learning_rate 1e-3 \--weight_decay 0. \--warmup_ratio 0.03 \--lr_scheduler_type "cosine" \--logging_steps $LOGGING_STEP \--tf32 True \--model_max_length 2048 \--gradient_checkpointing True \--dataloader_num_workers $PRETRAIN_DATALOADER_NUM_WORKERS \--lazy_preprocess True \--report_to none \2>&1 | tee $SCRIPT_DIR/../output/training_dirs/$PRETRAIN_NAME/pretrain.logmkdir -p $SCRIPT_DIR/../output/training_dirs/$FINETUNE_NAME#  ------------- Finetune ---------------
deepspeed $SCRIPT_DIR/training/mgm/train/train_mem.py \--deepspeed $SCRIPT_DIR/training/scripts/zero2_offload.json \--model_name_or_path $SCRIPT_DIR/training/model_zoo/LLM/gemma/gemma-2b-it \--version gemma \--data_path $SCRIPT_DIR/training/data/finetuning_stage_1_12k/mgm_instruction_stage_1_12k.json \--image_folder $SCRIPT_DIR/training/data/finetuning_stage_1_12k \--vision_tower $SCRIPT_DIR/training/model_zoo/OpenAI/clip-vit-large-patch14-336 \--vision_tower_aux $SCRIPT_DIR/training/model_zoo/OpenAI/openclip-convnext-large-d-320-laion2B-s29B-b131K-ft-soup \--pretrain_mm_mlp_adapter $SCRIPT_DIR/../output/training_dirs/$PRETRAIN_NAME/mm_projector.bin \--mm_projector_type mlp2x_gelu \--mm_vision_select_layer -2 \--mm_use_im_start_end False \--mm_use_im_patch_token False \--image_aspect_ratio pad \--group_by_modality_length True \--image_size_aux $AUX_SIZE \--bf16 True \--output_dir $SCRIPT_DIR/../output/training_dirs/$FINETUNE_NAME \--num_train_epochs $NUM_TRAIN_EPOCHS \--per_device_train_batch_size $FINETUNE_BATCH_SIZE_PER_GPU \--per_device_eval_batch_size 4 \--gradient_accumulation_steps $FINETUNE_GRADIENT_ACCUMULATION_STEPS \--evaluation_strategy "no" \--save_strategy "steps" \--save_steps $CKPT_SAVE_STEPS \--save_total_limit $TOTAL_SAVE_CKPT_LIMIT \--learning_rate 2e-5 \--weight_decay 0. \--warmup_ratio 0.03 \--lr_scheduler_type "cosine" \--logging_steps $LOGGING_STEP \--tf32 True \--model_max_length 2048 \--gradient_checkpointing True \--dataloader_num_workers $FINETUNE_DATALOADER_NUM_WORKERS \--lazy_preprocess True \--report_to none \2>&1 | tee $SCRIPT_DIR/../output/training_dirs/$FINETUNE_NAME/finetuning.log# inference for submission
# TextVQA
echo "Infer on TextVQA..."
bash $SCRIPT_DIR/eval/textvqa.sh $FINETUNE_NAME $INFER_CUDA_IDX
# MMBench
echo "Infer on MMBench..."
bash $SCRIPT_DIR/eval/mmbench.sh $FINETUNE_NAME "mmbench_dev_20230712" $INFER_CUDA_IDX# copy this script to output
cp $0 $SCRIPT_DIR/../output/train.sh# info
echo "Training and Inference done."
echo "Training checkpoints are stored in output/training_dirs/$FINETUNE_NAME."
echo "Inference results are stored in output/eval_results/$FINETUNE_NAME."

输出

Loading extension module cpu_adam...
Time to load cpu_adam op: 27.677916765213013 seconds0%|                                                                                        | 0/39 [00:00<?, ?it/s]/usr/local/lib/python3.10/dist-packages/torch/utils/checkpoint.py:31: UserWarning: None of the inputs have requires_grad=True. Gradients will be Nonewarnings.warn("None of the inputs have requires_grad=True. Gradients will be None")
{'loss': 13.1191, 'grad_norm': 215.75602308863463, 'learning_rate': 0.0005, 'epoch': 0.03}                          
{'loss': 12.9561, 'grad_norm': 245.24804705387612, 'learning_rate': 0.001, 'epoch': 0.05}                           
{'loss': 1373.125, 'grad_norm': 1152.2338424281413, 'learning_rate': 0.0009981987442712632, 'epoch': 0.08}          
{'loss': 9.3379, 'grad_norm': 22.12235184085656, 'learning_rate': 0.0009928079551738544, 'epoch': 0.1}              
{'loss': 9.4634, 'grad_norm': 22.63307231665722, 'learning_rate': 0.0009838664734667494, 'epoch': 0.13}             
{'loss': 7.2959, 'grad_norm': 11.233604260137353, 'learning_rate': 0.0009714387227305421, 'epoch': 0.15}            
{'loss': 7.2471, 'grad_norm': 9.763044450077903, 'learning_rate': 0.0009556142451940679, 'epoch': 0.18}             
{'loss': 7.2354, 'grad_norm': 12.32727083600074, 'learning_rate': 0.0009365070565805941, 'epoch': 0.2}              
{'loss': 7.1592, 'grad_norm': 5.8093453916971995, 'learning_rate': 0.0009142548246219211, 'epoch': 0.23}            
{'loss': 6.9897, 'grad_norm': 4.417171339272648, 'learning_rate': 0.0008890178771592198, 'epoch': 0.26}             
{'loss': 6.6577, 'grad_norm': 3.8698857264930413, 'learning_rate': 0.0008609780469772622, 'epoch': 0.28}      

最后基本在1.5左右
在这里插入图片描述

  1. 最后终端执行以下进行提交
cd submitcp -r /mnt/workspace/better_synth_challenge_baseline/solution .cp -r /mnt/workspace/better_synth_challenge_baseline/output/eval_results output/eval_results/cp -r /mnt/workspace/better_synth_challenge_baseline/output/train.sh output/cp /mnt/workspace/better_synth_challenge_baseline/output/training_dirs/MGM-2B-Finetune-image_recaption/finetuning.log output/training_dirs/MGM-2B-Finetune-image_recaption/cp /mnt/workspace/better_synth_challenge_baseline/output/training_dirs/MGM-2B-Pretrain-image_recaption/pretrain.log output/training_dirs/MGM-2B-Pretrain-image_recaption/zip -r submit.zip solution output

相关文章:

Datawhale多模态赛事(1)

赛事说明&#xff1a;https://tianchi.aliyun.com/competition/entrance/532251/introduction?spma2c22.12281925.0.0.2f307137p8qZmp 学习平台&#xff1a;https://linklearner.com/home 第一天 1.报名赛道学习赛事 https://tianchi.aliyun.com/competition/entrance/53225…...

云手机在海外社交媒体运营中的作用

随着社交媒体的全球普及&#xff0c;海外社交媒体运营成为众多企业与个人提升品牌影响力和扩大市场份额的重要策略。在这一进程中&#xff0c;海外云手机以其独特的功能&#xff0c;为海外社交媒体运营提供了强大的支持。 那么&#xff0c;海外云手机在海外社交媒体运营中究竟扮…...

Ubuntu怎么进入救援模式或单用户模式

进入救援模式&#xff08;Rescue Mode&#xff09;或单用户模式&#xff08;Single User Mode&#xff09;的方法取决于你所使用的Linux发行版。以下是通用的步骤&#xff0c;适用于大多数基于GRUB引导的系统&#xff0c;如Ubuntu、Debian、CentOS等&#xff1a; 重启你的系统。…...

学习鸿蒙-构建私有仓储

1.选择 鸿蒙提供ohpm-repo工具用于构建本地私有仓储 ohpm-repo下载 2.环境配置 安装node&#xff0c;ohpm-repo 支持 node.js 18.x 及以上版本 node最新版本下载 3.配置文件及运行 1.解压 ohpm-repo 私仓工具包 2.进入 ohpm-repo 解压目录的 conf 目录内&#xff0c;打开 c…...

经验是负债,学习是资产

经验是负债&#xff0c;学习是资产 经验是负债&#xff0c;学习是资产。这是李嘉诚先生的一句名言。他一语道出了学习在企业发展中的推动作用。 企业家经营的目的&#xff0c;无非就是将利润最大化。企业能够产生利润&#xff0c;靠的是提升自身业绩、降低运营成本&#xff0c;…...

电脑屏幕录制工具分享5款,附上详细电脑录屏教程(2024全新)

日月更迭&#xff0c;转眼间已经来到了2024年的立秋&#xff0c;在这个数字技术快速发展的时代&#xff0c;电脑录屏技术已经成为了一项不可或缺的技能&#xff0c;无论是用于工作汇报、在线教学、游戏直播还是个人娱乐。那么录屏软件哪个好用呢&#xff1f;接下来&#xff0c;…...

Docker资源隔离的实现策略以及适用场景

Docker通过多种技术实现资源隔离&#xff0c;确保不同容器之间相互独立并有效利用主机资源。 以下是Docker资源隔离的主要实现策略以及适用场景&#xff1a; 实现策略 1、命名空间&#xff08;Namespaces&#xff09; 进程命名空间&#xff08;PID Namespace&#xff09;: 隔…...

PLL基本原理、设计及应用

PLL基本原理 锁相环&#xff08;Phase-Locked Loop, PLL&#xff09;是一种基本的反馈控制系统&#xff0c;广泛应用于电子通信、信号处理、时钟同步等多个领域。PLL通过反馈机制锁定输入信号的频率和相位&#xff0c;从而实现输出信号与输入信号的同步。其基本工作原理可以概…...

Qt实现类似淘宝商品看板的界面,带有循环翻页以及点击某页跳转的功能

效果如下&#xff1a; #ifndef ModelDashboardGroup_h__ #define ModelDashboardGroup_h__#include <QGridLayout> #include <QLabel> #include <QPushButton> #include <QWidget>#include <QLabel> #include <QWidget> #include <QMou…...

2024下半年国际学术会议一览表

在科技与人文的交汇点&#xff0c;2024年的国际学术会议季即将拉开帷幕&#xff0c;一系列聚焦于计算机科学与人工智能、工程与技术、教育与社会科学的盛会&#xff0c;不仅展示了全球学术研究的最新成果&#xff0c;更促进了跨学科交流与合作&#xff0c;为未来的科技发展与社…...

serial靶场

项目地址 https://download.vulnhub.com/serial/serial.zip 实验过程 将下载好的靶机导入到VMware中&#xff0c;设置网络模式为NAT模式&#xff0c;然后开启靶机虚拟机 使用C段扫描&#xff0c;获取靶机IP地址 arp-scan -l 扫描一下端口 nmap -sV -p- 192.168.48.149 查看…...

如何在Vue3项目中引入并使用Echarts图表

在Vue 3项目中引入并使用ECharts图表&#xff0c;你可以通过npm或yarn来安装ECharts&#xff0c;然后在Vue组件中引入并使用它。以下是一个基本的步骤指南&#xff1a; 1. 安装ECharts 首先&#xff0c;你需要在你的Vue 3项目中安装ECharts。打开你的终端或命令提示符&#x…...

C# 子类、接口

栏目总目录 子类 继承的概念 继承机制&#xff1a;C#支持单继承&#xff0c;即一个类只能直接继承自一个基类。但基类本身可以继承自另一个类&#xff0c;从而实现继承链。继承关键字&#xff1a;使用冒号&#xff08;:&#xff09;表示继承关系&#xff0c;子类在声明时指定…...

Qt实现圆形窗口

重新实现paintEvent()函数。 效果如下&#xff1a; 效果为蓝色区域&#xff0c;背景是vs接面&#xff0c;代码直接复制可用&#xff0c;留给有需要的人。 #ifndef CircleWidget_h__ #define CircleWidget_h__#include <QWidget>class CCircleWidget : public QWidget {Q…...

LeetCode 算法:有效的括号 c++

原题链接&#x1f517;&#xff1a;有效的括号 难度&#xff1a;简单⭐️ 题目 给定一个只包括 ‘(’&#xff0c;‘)’&#xff0c;‘{’&#xff0c;‘}’&#xff0c;‘[’&#xff0c;‘]’ 的字符串 s &#xff0c;判断字符串是否有效。 有效字符串需满足&#xff1a; …...

react和vue的diff算法的差别

React 的 Diff 算法 React 的 diff 算法主要基于以下几个原则&#xff1a; 同层比较&#xff1a; React 只会比较同一层级的节点&#xff0c;不会跨层级比较。假设跨层级的变化较少&#xff0c;从而简化了算法&#xff0c;提高了性能。 深度优先遍历&#xff1a; React 采用深…...

算法【滑动窗口】

滑动窗口指的是维持左、右边界都不回退的一段范围&#xff0c;来求解很多子数组&#xff08;串&#xff09;的相关问题。 滑动窗口的关键是找到范围和答案指标之间的单调性关系&#xff08;类似贪心&#xff09;。 滑动过程&#xff1a;滑动窗口可以用简单变量或者结构来维护…...

【RISC-V设计-06】- RISC-V处理器设计K0A之ALU

【RISC-V设计-06】- RISC-V处理器设计K0A之ALU 文章目录 【RISC-V设计-06】- RISC-V处理器设计K0A之ALU1.简介2.顶层设计3.内部结构4.端口说明5.操作码说明6.设计代码7.总结 1.简介 算术逻辑单元&#xff08;Arithmetic Logic Unit&#xff0c;简称 ALU&#xff09;是计算机中…...

MyIP:强大且简单好用!

在这个数字化的时代&#xff0c;IP地址就像是我们的网络身份证。各位在日常的工作中&#xff0c;肯定会会遇到需要和 IP 地址相关的需求。 今天和大家聊一聊一个非常好用的开源 IP 工具项目 - MyIP。 简介 MyIP一个开源IP工具箱&#xff0c;提供了一系列的网络检测工具&…...

Redis作为缓存,如何与MySql的数据进行同步?

允许延时一致的业务 概念 采用异步通知使用MQ作为中间件&#xff0c;更新数据之后通知缓存删除利用canal中间件&#xff0c;不需要修改业务代码&#xff0c;伪装成Mysql的一个从节点&#xff0c;canal通过读取binlog数据更新缓存 强一致性业务 概念 采用Redission提供的读写锁…...

【WiFi帧结构】

文章目录 帧结构MAC头部管理帧 帧结构 Wi-Fi的帧分为三部分组成&#xff1a;MAC头部frame bodyFCS&#xff0c;其中MAC是固定格式的&#xff0c;frame body是可变长度。 MAC头部有frame control&#xff0c;duration&#xff0c;address1&#xff0c;address2&#xff0c;addre…...

渗透实战PortSwigger靶场-XSS Lab 14:大多数标签和属性被阻止

<script>标签被拦截 我们需要把全部可用的 tag 和 event 进行暴力破解 XSS cheat sheet&#xff1a; https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 通过爆破发现body可以用 再把全部 events 放进去爆破 这些 event 全部可用 <body onres…...

大数据零基础学习day1之环境准备和大数据初步理解

学习大数据会使用到多台Linux服务器。 一、环境准备 1、VMware 基于VMware构建Linux虚拟机 是大数据从业者或者IT从业者的必备技能之一也是成本低廉的方案 所以VMware虚拟机方案是必须要学习的。 &#xff08;1&#xff09;设置网关 打开VMware虚拟机&#xff0c;点击编辑…...

k8s业务程序联调工具-KtConnect

概述 原理 工具作用是建立了一个从本地到集群的单向VPN&#xff0c;根据VPN原理&#xff0c;打通两个内网必然需要借助一个公共中继节点&#xff0c;ktconnect工具巧妙的利用k8s原生的portforward能力&#xff0c;简化了建立连接的过程&#xff0c;apiserver间接起到了中继节…...

select、poll、epoll 与 Reactor 模式

在高并发网络编程领域&#xff0c;高效处理大量连接和 I/O 事件是系统性能的关键。select、poll、epoll 作为 I/O 多路复用技术的代表&#xff0c;以及基于它们实现的 Reactor 模式&#xff0c;为开发者提供了强大的工具。本文将深入探讨这些技术的底层原理、优缺点。​ 一、I…...

MySQL用户和授权

开放MySQL白名单 可以通过iptables-save命令确认对应客户端ip是否可以访问MySQL服务&#xff1a; test: # iptables-save | grep 3306 -A mp_srv_whitelist -s 172.16.14.102/32 -p tcp -m tcp --dport 3306 -j ACCEPT -A mp_srv_whitelist -s 172.16.4.16/32 -p tcp -m tcp -…...

在Ubuntu24上采用Wine打开SourceInsight

1. 安装wine sudo apt install wine 2. 安装32位库支持,SourceInsight是32位程序 sudo dpkg --add-architecture i386 sudo apt update sudo apt install wine32:i386 3. 验证安装 wine --version 4. 安装必要的字体和库(解决显示问题) sudo apt install fonts-wqy…...

面向无人机海岸带生态系统监测的语义分割基准数据集

描述&#xff1a;海岸带生态系统的监测是维护生态平衡和可持续发展的重要任务。语义分割技术在遥感影像中的应用为海岸带生态系统的精准监测提供了有效手段。然而&#xff0c;目前该领域仍面临一个挑战&#xff0c;即缺乏公开的专门面向海岸带生态系统的语义分割基准数据集。受…...

Java毕业设计:WML信息查询与后端信息发布系统开发

JAVAWML信息查询与后端信息发布系统实现 一、系统概述 本系统基于Java和WML(无线标记语言)技术开发&#xff0c;实现了移动设备上的信息查询与后端信息发布功能。系统采用B/S架构&#xff0c;服务器端使用Java Servlet处理请求&#xff0c;数据库采用MySQL存储信息&#xff0…...

Netty从入门到进阶(二)

二、Netty入门 1. 概述 1.1 Netty是什么 Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients. Netty是一个异步的、基于事件驱动的网络应用框架&#xff0c;用于…...