大规模语言LLaVA:多模态GPT-4智能助手,融合语言与视觉,满足用户复杂需求
大规模语言LLaVA:多模态GPT-4智能助手,融合语言与视觉,满足用户复杂需求
一个面向多模式GPT-4级别能力构建的助手。它结合了自然语言处理和计算机视觉,为用户提供了强大的多模式交互和理解。LLaVA旨在更深入地理解和处理语言和视觉信息,从而实现更复杂的任务和对话。这个项目代表了下一代智能助手的发展方向,它能够更好地理解和应对用户需求。
- 效果展示
demo链接:https://llava.hliu.cc/
当我来这里旅游时,我应该注意哪些事情?
在平静的湖面上游览码头时,有几件事你应该小心。首先,要注意天气状况,因为图像显示的是多云的天空。这可能表明天气突然变化的可能性,如下雨或强风,这可能使码头湿滑或不安全。其次,要注意水深和水位突然变化的可能性,因为码头位于湖中。最后,要小心任何可能出现在该地区的野生动物或昆虫,因为它们可能会对你的安全或健康构成威胁。为了确保安全愉快的体验,保持警惕和尊重环境是必不可少的。
- 主流大模型之间对比
1.安装
- Clone this repository and navigate to LLaVA folder
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVA
- Install Package
conda create -n llava python=3.10 -y
conda activate llava
pip install --upgrade pip # enable PEP 660 support
pip install -e .
- Install additional packages for training cases
pip install ninja
pip install flash-attn --no-build-isolation
1.1 升级到最新的代码库
git pull
pip uninstall transformers
pip install -e .
2.LLaVA 权重
Please check out our Model Zoo for all public LLaVA checkpoints, and the instructions of how to use the weights.
2.1 Demo
To run our demo, you need to prepare LLaVA checkpoints locally. Please follow the instructions here to download the checkpoints.
2.2 基于Gradio Web UI
要在本地启动Gradio demo,请依次运行以下命令。如果你计划启动多个模型工作者来比较不同的检查点,你只需要启动控制器和web服务器一次。
- Launch a controller
python -m llava.serve.controller --host 0.0.0.0 --port 10000
- Launch a gradio web server.
python -m llava.serve.gradio_web_server --controller http://localhost:10000 --model-list-mode reload
您刚刚启动了grado web界面。现在,您可以打开带有打印在屏幕上的URL的web界面。您可能会注意到在模型列表中没有模型。别担心,我们还没有推出劳模。当你启动一个模型工作者时,它将被自动更新。
- Launch a model worker
This is the actual worker that performs the inference on the GPU. Each worker is responsible for a single model specified in --model-path
.
python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.5-13b
Wait until the process finishes loading the model and you see “Uvicorn running on …”. Now, refresh your Gradio web UI, and you will see the model you just launched in the model list.
You can launch as many workers as you want, and compare between different model checkpoints in the same Gradio interface. Please keep the --controller
the same, and modify the --port
and --worker
to a different port number for each worker.
python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port <different from 40000, say 40001> --worker http://localhost:<change accordingly, i.e. 40001> --model-path <ckpt2>
If you are using an Apple device with an M1 or M2 chip, you can specify the mps device by using the --device
flag: --device mps
.
- Launch a model worker (Multiple GPUs, when GPU VRAM <= 24GB)
如果GPU的VRAM小于24GB(例如,RTX 3090, RTX 4090等),您可以尝试在多个GPU上运行它。如果您有多个GPU,我们最新的代码库将自动尝试使用多个GPU。你可以使用’ CUDA_VISIBLE_DEVICES '来指定使用哪个gpu。下面是使用前两个gpu运行的示例。
CUDA_VISIBLE_DEVICES=0,1 python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.5-13b
- Launch a model worker (4-bit, 8-bit inference, quantized)
您可以使用量化位(4位,8位)启动模型工作器,这允许您在减少GPU内存占用的情况下运行推理,可能允许您在只有12GB VRAM的GPU上运行。请注意,使用量子化位的推理可能不如全精度模型准确。只需将’——load-4bit ‘或’——load-8bit '附加到您正在执行的model worker命令。下面是一个使用4位量化运行的示例。
python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1.5-13b --load-4bit
- Launch a model worker (LoRA weights, unmerged)
您可以使用LoRA权重启动模型工作器,而不将它们与基本检查点合并,以节省磁盘空间。会有额外的加载时间,而推理速度与合并的检查点相同。未合并的LoRA检查点在模型名称中没有“LoRA -merge”,并且通常比合并的检查点小得多(小于1GB) (7B为13G, 13B为25G)。
要加载未合并的LoRA权重,您只需要传递一个额外的参数’——model-base ',这是用于训练LoRA权重的基本LLM。您可以在模型动物园中查看每个LoRA权重的基本LLM。
python -m llava.serve.model_worker --host 0.0.0.0 --controller http://localhost:10000 --port 40000 --worker http://localhost:40000 --model-path liuhaotian/llava-v1-0719-336px-lora-vicuna-13b-v1.3 --model-base lmsys/vicuna-13b-v1.3
3.CLI 推理
使用LLaVA讨论图像,而不需要使用Gradio接口。支持多gpu、4位和8位量化推理。使用4位量化,对于我们的LLaVA-1.5-7B,它在单个GPU上使用不到8GB的VRAM。
python -m llava.serve.cli \--model-path liuhaotian/llava-v1.5-7b \--image-file "https://llava-vl.github.io/static/images/view.jpg" \--load-4bit

4.模型训练
以下是LLaVA v1.5的最新培训配置。对于遗留模型,请参考此版本的README。稍后我们将把它们添加到一个单独的文档中
LLaVA训练包括两个阶段:(1)特征对齐阶段:使用LAION-CC-SBU数据集的558K子集将“冻结预训练”视觉编码器连接到“冻结LLM”;(2)视觉指令调整阶段:使用150K gpt生成的多模态指令跟随数据,加上515K左右的学术任务VQA数据,来教模型遵循多模态指令。
LLaVA is trained on 8 A100 GPUs with 80GB memory. To train on fewer GPUs, you can reduce the per_device_train_batch_size
and increase the gradient_accumulation_steps
accordingly. Always keep the global batch size the same: per_device_train_batch_size
x gradient_accumulation_steps
x num_gpus
.
4.1 超参数
We use a similar set of hyperparameters as Vicuna in finetuning. Both hyperparameters used in pretraining and finetuning are provided below.
- Pretraining
Hyperparameter | Global Batch Size | Learning rate | Epochs | Max length | Weight decay |
---|---|---|---|---|---|
LLaVA-v1.5-13B | 256 | 1e-3 | 1 | 2048 | 0 |
- Finetuning
Hyperparameter | Global Batch Size | Learning rate | Epochs | Max length | Weight decay |
---|---|---|---|---|---|
LLaVA-v1.5-13B | 128 | 2e-5 | 1 | 2048 | 0 |
4.2 下载 Vicuna checkpoints (automatically)
我们的基本模型Vicuna v1.5,这是一个指令调整聊天机器人,将自动下载,当你运行我们提供的训练脚本。不需要任何操作。
4.3 预训练 (特征对齐)
请下载我们在论文中使用的带有BLIP标题的LAION-CC-SBU数据集的558K子集在这里。
在8x A100 (80G)上,由于分辨率增加到336px, LLaVA-v1.5-13B的预训练大约需要5.5小时。LLaVA-v1.5-7B大约需要3.5小时。
Training script with DeepSpeed ZeRO-2: pretrain.sh
.
--mm_projector_type mlp2x_gelu
: the two-layer MLP vision-language connector.--vision_tower openai/clip-vit-large-patch14-336
: CLIP ViT-L/14 336px.
4.4 可视化训练调试
- Prepare data
Please download the annotation of the final mixture our instruction tuning data llava_v1_5_mix665k.json, and download the images from constituting datasets:
- COCO: train2017
- GQA: images
- OCR-VQA: download script
- TextVQA: train_val_images
- VisualGenome: part1, part2
After downloading all of them, organize the data as follows in ./playground/data
,
├── coco
│ └── train2017
├── gqa
│ └── images
├── ocr_vqa
│ └── images
├── textvqa
│ └── train_images
└── vg├── VG_100K└── VG_100K_2
- Start training!
You may download our pretrained projectors in Model Zoo. It is not recommended to use legacy projectors, as they may be trained with a different version of the codebase, and if any option is off, the model will not function/train as we expected.
Visual instruction tuning takes around 20 hours for LLaVA-v1.5-13B on 8x A100 (80G), due to the increased resolution to 336px. It takes around 10 hours for LLaVA-v1.5-7B on 8x A100 (40G).
Training script with DeepSpeed ZeRO-3: finetune.sh
.
New options to note:
--mm_projector_type mlp2x_gelu
: the two-layer MLP vision-language connector.--vision_tower openai/clip-vit-large-patch14-336
: CLIP ViT-L/14 336px.--image_aspect_ratio pad
: this pads the non-square images to square, instead of cropping them; it slightly reduces hallucination.--group_by_modality_length True
: this should only be used when your instruction tuning dataset contains both language (e.g. ShareGPT) and multimodal (e.g. LLaVA-Instruct). It makes the training sampler only sample a single modality (either image or language) during training, which we observe to speed up training by ~25%, and does not affect the final outcome.
5.模型评估
In LLaVA-1.5, we evaluate models on a diverse set of 12 benchmarks. To ensure the reproducibility, we evaluate the models with greedy decoding. We do not evaluate using beam search to make the inference process consistent with the chat demo of real-time outputs.
See Evaluation.md.
5.1 基于GPT协助的评估
我们的gpt辅助的多模态建模评估管道提供了对视觉语言模型能力的全面理解。详情请参阅我们的文章。
- Generate LLaVA responses
python model_vqa.py \--model-path ./checkpoints/LLaVA-13B-v0 \--question-file \playground/data/coco2014_val_qa_eval/qa90_questions.jsonl \--image-folder \/path/to/coco2014_val \--answers-file \/path/to/answer-file-our.jsonl
- Evaluate the generated responses. In our case,
answer-file-ref.jsonl
is the response generated by text-only GPT-4 (0314), with the context captions/boxes provided.
OPENAI_API_KEY="sk-***********************************" python llava/eval/eval_gpt_review_visual.py \--question playground/data/coco2014_val_qa_eval/qa90_questions.jsonl \--context llava/eval/table/caps_boxes_coco2014_val_80.jsonl \--answer-list \/path/to/answer-file-ref.jsonl \/path/to/answer-file-our.jsonl \--rule llava/eval/table/rule.json \--output /path/to/review.json
- Summarize the evaluation results
python summarize_gpt_review.py
6.模型合集
要使用llava -1.5检查点,您的llava软件包版本必须高于1.1.0。说明如何升级。
如果您有兴趣在模型动物园中加入任何其他细节,请打开一个问题:)
下面的模型权重是合并的权重。你不需要应用。LLaVA检查点的使用应该符合基本LLM的模型许可:Llama 2。
LLaVA-v1.5
Version | Size | Schedule | Checkpoint | VQAv2 | GQA | VizWiz | SQA | T-VQA | POPE | MME | MM-Bench | MM-Bench-CN | SEED | LLaVA-Bench-Wild | MM-Vet |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LLaVA-1.5 | 7B | full_ft-1e | liuhaotian/llava-v1.5-7b | 78.5 | 62.0 | 50.0 | 66.8 | 58.2 | 85.9 | 1510.7 | 64.3 | 58.3 | 58.6 | 65.4 | 31.1 |
LLaVA-1.5 | 13B | full_ft-1e | liuhaotian/llava-v1.5-13b | 80.0 | 63.3 | 53.6 | 71.6 | 61.3 | 85.9 | 1531.3 | 67.7 | 63.6 | 61.6 | 72.5 | 36.1 |
LLaVA-1.5 | 7B | lora-1e | coming soon | ||||||||||||
LLaVA-1.5 | 13B | lora-1e | coming soon |
LLaVA-v1
Note: We recommend using the most capable LLaVA-v1.5 series above for the best performance.
Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | LLaVA-Bench-Conv | LLaVA-Bench-Detail | LLaVA-Bench-Complex | LLaVA-Bench-Overall | Download |
---|---|---|---|---|---|---|---|---|---|---|
Vicuna-13B-v1.3 | CLIP-L-336px | LCS-558K | 1e | LLaVA-Instruct-80K | proj-1e, lora-1e | 64.3 | 55.9 | 81.7 | 70.1 | LoRA LoRA-Merged |
LLaMA-2-13B-Chat | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | full_ft-1e | 56.7 | 58.6 | 80.0 | 67.9 | ckpt |
LLaMA-2-7B-Chat | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | lora-1e | 51.2 | 58.9 | 71.6 | 62.8 | LoRA |
Projector weights
These are projector weights we have pretrained. You can use these projector weights for visual instruction tuning. They are just pretrained on image-text pairs, and are NOT instruction tuned, which means they do NOT follow instructions as good as our official models, and can output repetitive, lengthy, and garbled outputs. If you want to have nice conversations with LLaVA, use the checkpoints above (LLaVA v1.5).
NOTE: These projector weights are only compatible with the llava>=1.0.0
, please check out the latest code base if your local code version is below v1.0.0
.
NOTE: When you use our pretrained projector for visual instruction tuning, it is very important to use the same base LLM and vision encoder as the one we used for pretraining the projector. Otherwise, the performance will be very bad.
When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,
--mm_use_im_start_end False
--mm_use_im_patch_token False
Base LLM | Vision Encoder | Projection | Pretrain Data | Pretraining schedule | Download |
---|---|---|---|---|---|
Vicuna-13B-v1.5 | CLIP-L-336px | MLP-2x | LCS-558K | 1e | projector |
Vicuna-7B-v1.5 | CLIP-L-336px | MLP-2x | LCS-558K | 1e | projector |
LLaMA-2-13B-Chat | CLIP-L-336px | Linear | LCS-558K | 1e | projector |
LLaMA-2-7B-Chat | CLIP-L-336px | Linear | LCS-558K | 1e | projector |
LLaMA-2-13B-Chat | CLIP-L | Linear | LCS-558K | 1e | projector |
LLaMA-2-7B-Chat | CLIP-L | Linear | LCS-558K | 1e | projector |
Vicuna-13B-v1.3 | CLIP-L-336px | Linear | LCS-558K | 1e | projector |
Vicuna-7B-v1.3 | CLIP-L-336px | Linear | LCS-558K | 1e | projector |
Vicuna-13B-v1.3 | CLIP-L | Linear | LCS-558K | 1e | projector |
Vicuna-7B-v1.3 | CLIP-L | Linear | LCS-558K | 1e | projector |
Science QA Checkpoints
Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | Download |
---|---|---|---|---|---|---|
Vicuna-13B-v1.3 | CLIP-L | LCS-558K | 1e | ScienceQA | full_ft-12e | ckpt |
Legacy Models (merged weights)
The model weights below are merged weights. You do not need to apply delta. The usage of LLaVA checkpoints should comply with the base LLM’s model license.
Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | Download |
---|---|---|---|---|---|---|
MPT-7B-Chat | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | full_ft-1e | preview |
Legacy Models (delta weights)
The model weights below are delta weights. The usage of LLaVA checkpoints should comply with the base LLM’s model license: LLaMA.
You can add our delta to the original LLaMA weights to obtain the LLaVA weights.
Instructions:
- Get the original LLaMA weights in the huggingface format by following the instructions here.
- Use the following scripts to get LLaVA weights by applying our delta. It will automatically download delta weights from our Hugging Face account. In the script below, we use the delta weights of
liuhaotian/LLaVA-7b-delta-v0
as an example. It can be adapted for other delta weights by changing the--delta
argument (and base/target accordingly).
python3 -m llava.model.apply_delta \--base /path/to/llama-7b \--target /output/path/to/LLaVA-7B-v0 \--delta liuhaotian/LLaVA-7b-delta-v0
Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Finetuning Data | Finetuning schedule | Download |
---|---|---|---|---|---|---|
Vicuna-13B-v1.1 | CLIP-L | CC-595K | 1e | LLaVA-Instruct-158K | full_ft-3e | delta-weights |
Vicuna-7B-v1.1 | CLIP-L | LCS-558K | 1e | LLaVA-Instruct-80K | full_ft-1e | delta-weights |
Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | LLaVA-Instruct-158K | full_ft-3e | delta-weights |
Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | ScienceQA | full_ft-12e | delta-weights |
Vicuna-7B-v0 | CLIP-L | CC-595K | 1e | LLaVA-Instruct-158K | full_ft-3e | delta-weights |
Legacy Projector weights
The following projector weights are deprecated, and the support for them may be removed in the future. They do not support zero-shot inference. Please use the projector weights in the table above if possible.
NOTE: When you use our pretrained projector for visual instruction tuning, it is very important to use the same base LLM and vision encoder as the one we used for pretraining the projector. Otherwise, the performance will be very bad.
When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,
--mm_use_im_start_end True
--mm_use_im_patch_token False
Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Download |
---|---|---|---|---|
Vicuna-7B-v1.1 | CLIP-L | LCS-558K | 1e | projector |
Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | projector |
Vicuna-7B-v0 | CLIP-L | CC-595K | 1e | projector |
When using these projector weights to instruction tune your LMM, please make sure that these options are correctly set as follows,
--mm_use_im_start_end False
--mm_use_im_patch_token False
Base LLM | Vision Encoder | Pretrain Data | Pretraining schedule | Download |
---|---|---|---|---|
Vicuna-13B-v0 | CLIP-L | CC-595K | 1e | projector |
7.数据集介绍
Data file name | Size |
---|---|
llava_instruct_150k.json | 229 MB |
llava_instruct_80k.json | 229 MB |
conversation_58k.json | 126 MB |
detail_23k.json | 20.5 MB |
complex_reasoning_77k.json | 79.6 MB |
7.1 Pretraining Dataset
The pretraining dataset used in this release is a subset of CC-3M dataset, filtered with a more balanced concept coverage distribution. Please see here for a detailed description of the dataset structure and how to download the images.
If you already have CC-3M dataset on your disk, the image names follow this format: GCC_train_000000000.jpg
. You may edit the image
field correspondingly if necessary.
Data | Chat File | Meta Data | Size |
---|---|---|---|
CC-3M Concept-balanced 595K | chat.json | metadata.json | 211 MB |
LAION/CC/SBU BLIP-Caption Concept-balanced 558K | blip_laion_cc_sbu_558k.json | metadata.json | 181 MB |
Important notice: Upon the request from the community, as ~15% images of the original CC-3M dataset are no longer accessible, we upload images.zip
for better reproducing our work in research community. It must not be used for any other purposes. The use of these images must comply with the CC-3M license. This may be taken down at any time when requested by the original CC-3M dataset owner or owners of the referenced images.
7.2 GPT-4 Prompts
我们为GPT-4查询提供提示和少量样本,以更好地促进该领域的研究。请查看’ prompts '文件夹中的三种问题:对话、细节描述和复杂推理。
它们以’ system_message.txt ‘的格式组织,用于系统消息,’ abc_caps.txt ‘对用于少数几个示例用户输入,’ abc_conf .txt '用于少数几个示例参考输出。
请注意,它们的格式可能不同。例如,’ conversation ‘在’ json '中,详细描述是只回答的。我们在初步实验中选择的格式比我们尝试的一组有限的替代方案稍微好一些:“json”,更自然的格式,只有答案。如果有兴趣,您可以尝试其他变体或对此进行更仔细的研究。欢迎投稿!
更多优质内容请关注公号:汀丶人工智能;会提供一些相关的资源和优质文章,免费获取阅读。
相关文章:

大规模语言LLaVA:多模态GPT-4智能助手,融合语言与视觉,满足用户复杂需求
大规模语言LLaVA:多模态GPT-4智能助手,融合语言与视觉,满足用户复杂需求 一个面向多模式GPT-4级别能力构建的助手。它结合了自然语言处理和计算机视觉,为用户提供了强大的多模式交互和理解。LLaVA旨在更深入地理解和处理语言和视…...

Element UI定义方法校验邮箱格式
1. .vue中定义了3个邮箱输入框,前面两个是输入多个邮件地址,最后一个是使用element自带的校验来校验单个邮件地址 <el-row><el-col :span"24"><el-form-item label"收件人" prop"to"><el-input v-mo…...

DigiCert代码签名证书
在当今的数字化时代,确保软件的完整性和来源的可靠性至关重要。DigiCert代码签名证书是一种专业而受信任的数字签名解决方案,帮助开发者保护其软件免受篡改和恶意行为的侵害。本文将介绍DigiCert代码签名证书的特点和优势,并讨论为何选择Digi…...

HTML5+CSS3小实例:网页底部间隔波浪动画特效
实例:网页底部间隔波浪动画特效 技术栈:HTML+CSS 效果: 源码: 【html】 <!DOCTYPE html> <html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content…...

前端 js 之 代码执行的一个过程 02
嘿,欢迎你来 !💕 文章目录 前言一、运行一个 js 文件二、运行环境三、js执行代码的过程(普通变量)四、打印 window五、js执行代码的过程(函数变量)六、函数调用函数的过程注意!&…...

【经验分享】如何构建openGauss开发编译提交一体化环境
前文 本文适合对openGauss源代码有好奇心的爱好者,那么一个友好的openGauss源代码环境应该是怎么样的。openGauss的开发环境是如何设置的?openGauss的编译环境是如何构建的?如何向openGauss提交代码,笔者集合官方和几位博主实践提…...

儿童疫苗接种:安全与注意事项
引言: 儿童的疫苗接种是维护其健康和预防传染病的重要措施。疫苗可以有效地保护儿童免受各种疾病的威胁,但在接种过程中需要家长和监护人特别关注一些注意事项,以确保接种的安全性和有效性。本文将深入探讨儿童疫苗接种的重要性,…...

Go 代码块与作用域,变量遮蔽问题详解
Go 代码块与作用域详解 文章目录 Go 代码块与作用域详解一、引入二、代码块 (Block)2.1 代码块介绍2.2 显式代码块2.3 隐式代码块2.4 空代码块2.5 支持嵌套代码块 三、作用域 (Scope)3.1 作用域介绍3.2 作用域划定原则3.3 标识符的作用域范围3.3.1 预定义标识符作用域3.3.2 包代…...

可观测性-Metrics-WebClient异步Http远程Call
代码示例 1.依赖导入 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webflux</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><ar…...

Android之播放本地视频和Url视频方法
一、播放本地视频文件 根据文件路径在浏览器中播放,可用于视频预览等场景 效果: 用浏览器播放本地视频 文件路径例子: /storage/emulated/0/Android/data/com.custom.jfrb/files/Movies/1697687179497.mp4 File file new File("文件…...

设计模式:工厂方法模式(C#、JAVA、JavaScript、C++、Python、Go、PHP):
本节主要介绍设计模式中的工厂方法模式。 简介: 工厂方法模式,它是对简单工厂模式的进一步抽象化,其好处是可以使系统在不修改原来代码的情况下引进新的产品,即满足开闭原则。 它定义了一个用于创建对象的工厂接口,让…...

C++基础——指针
1 概述 指针的作用:可以通过指针间接访问内存 内存编号从0开始,一般使用十六进制数字表示,指针可以保存地址 2 指针变量定义和作用 int main() {//1、指针的定义int a 10; //定义整型变量a//指针定义语法: 数据类型 * 变量名 …...

PLC 学习day02 硬件输入/输入的知识
1.资料来源 1.链接:三菱PLC视频教程全集之FX3U基本单元输入接线_哔哩哔哩_bilibili 2. 链接: 三菱plc视频教程全集之FX3U基本单元输出接线_哔哩哔哩_bilibili 2. PLC 的输入部分器件连接。 2.1 PLC输入部分的硬件知识 1. 一般输入部分是PLC获取信息的地…...

rabbitMq (2)
RabbitMQ 消息应答与发布 文章目录 1. 消息应答1.2 自动应答1.2 手动应答1.3 代码案例 2. RabbitMQ 持久化2.1 队列持久化2.2 消息持久化 3. 不公平分发4. 预取值分发5. 发布确认5.1 发布确认逻辑5.2 开启发布确认的方法5.3 单个确认发布5.4 批量确认发布5.5 异步确认5.5.1 处理…...

通讯协议学习之路:RS422协议理论
通讯协议之路主要分为两部分,第一部分从理论上面讲解各类协议的通讯原理以及通讯格式,第二部分从具体运用上讲解各类通讯协议的具体应用方法。 后续文章会同时发表在个人博客(jason1016.club)、CSDN;视频会发布在bilibili(UID:399951374) 一、…...

剪映failed to initialize,cuda.is_available()为false解决
debug记录帖 错误1:打开剪映发现弹窗提示failed to initialize graphics backed for D3D11 错误2:torch版本、cuda版本(之前的正常环境)都对但是torch.cuda.is_available()为false 怀疑是显卡驱动的问题 打开Nvidia Geforce Exp…...

基于Spring Boot的LDAP开发全教程
写在前面 协议概述 LDAP(轻量级目录访问协议,Lightweight Directory Access Protocol)是一种用于访问和维护分布式目录服务的开放标准协议,是一种基于TCP/IP协议的客户端-服务器协议,用于访问和管理分布式目录服务,如企业内部的…...

在 Linux 上保护 SSH 服务器连接的 8 种方法
SSH 是一种广泛使用的协议,用于安全地访问 Linux 服务器。大多数用户使用默认设置的 SSH 连接来连接到远程服务器。但是,不安全的默认配置也会带来各种安全风险。 具有开放 SSH 访问权限的服务器的 root 帐户可能存在风险。尤其是如果使用的是公共 IP 地…...

摩尔信使MThings的协议转换(数据网关)功能
摩尔信使MThings可以作为现场总线(RS485)和以太网的数据中枢,并拥有强大的Modbus协议转换功能。 数据网关功能提供协议转换和数据汇聚功能,可实现多维度映射,包括:不同的通道(总线)类型、协议类型ÿ…...

Mac安装Kali保姆级教程
Mac安装Kali保姆级教程 其他安装教程:使用VMware安装系统Window、Linux(kali)、Mac操作系统 1 虚拟机安装VM Fusion 去官网下载VM Fusion 地址:https://customerconnect.vmware.com/en/evalcenter?pfusion-player-personal-13 …...

利用Spring Boot框架做事件发布和监听
一、编写事件 1.编写事件类并集成spring boot 事件接口,提供访问事件参数属性 public class PeriodicityRuleChangeEvent extends ApplicationEvent {private final JwpDeployWorkOrderRuleDTO jwpDeployWorkOrderRuleDTO;public PeriodicityRuleChangeEvent(Obje…...

KingBase库模式表空间和客户端认证(kylin)
库、模式、表空间 数据库 数据库基集簇与数据库实例 KES集簇是由单个KES实例管理的数据库的集合KES集簇中的库使用相同的全局配置文件和监听端口、共享相关的进程和内存结构同一数据库集簇中的进程、相关的内存结构统称为实例 数据库 数据库是一个长期存储在计算机内的、有…...

h5的扫一扫功能 (非微信浏览器环境下)
必须在 https 域名下才生效 <template><div><van-field label"服务商编码" right-icon"scan" placeholder"扫描二维码获取" click-right-icon"getCameras" /> <div class"scan" :style"{disp…...

Typora 导出PDF 报错 failed to export as pdf. undefined 解决方案
情况 我想把一个很大的markdown 导出为 248页的pdf 然后就报错 failed to export as pdf. undefined 原因 : 个人感觉应该是图片太大了 格式问题之类导致的 解决 文件 -> 偏好设置 - > 导出 -> pdf -> 自定义 -> 把大小全部改为24mm (虽然图中是32 …...

[架构之路-239]:目标系统 - 纵向分层 - 中间件middleware
目录 前言: 一、中间件概述 1.1 中间件在软件层次中的位置 1.2 什么是中间件 1.3 为什么需要中间件 1.4 中间件应用场合(应用程序不用的底层需求:计算、存储、通信) 1.5 中间件分类 - 按内容分 二、嵌入式系统的中间件 2…...

javascript利用xhr对象实现http流的comet轮循,主要是利用readyState等于3的特点
//此文件 为前端获取http流 <!DOCTYPE html> <html xmlns"http://www.w3.org/1999/xhtml" lang"UTF-8"></html> <html><head><meta http-equiv"Content-Type" content"text/html; charsetUTF-8"/&g…...

【Mybatis源码】XPathParser解析器
XPathParser是Mybatis中定义的进行解析XML文件的类,此类用于读取XML文件中的节点文本与属性;本篇我们主要介绍XPathParser解析XML的原理。 一、XPathParser构造方法 这里我们介绍主要的构造方法 public XPathParser(InputStream inputStream, boolean validation, Propert…...

辉视智慧酒店解决方案助力传统酒店通过智能升级焕发新生
辉视智慧酒店解决方案基于强大的物联网平台,将酒店客控、网络覆盖、客房智能化控制、酒店服务交互等完美融合,打造出全方位的酒店智慧化产品。利用最新的信息化技术,我们推动酒店智慧化转型,综合运用前沿的信息科学和技术、消费方…...

文件和命令的查找与处理
1.命令查找 which which 接命令 2.文件查找 find 按文件名字查找 准确查找 find / -name "hosts" 粗略查找 find / -name "ho*ts" 扩展名查找 find / -name "*.txt" 按文件类型查找 find / -type f 文件查找 find / -ty…...

第七章:最新版零基础学习 PYTHON 教程—Python 列表(第三节 -Python程序访问列表中的索引和值)
有多种方法可以访问列表的元素,但有时我们可能需要访问元素及其所在的索引。让我们看看访问列表中的索引和值的所有不同方法。 目录 使用Naive 方法访问列表中的索引和值 使用列表理解访问列表中的索引和值...