半小时在本地部署DeepSeek的Janus Pro,进行图片分析和文生图
半小时在本地部署DeepSeek的Janus Pro,进行图片分析和文生图
- 下载Janus Pro源代码
- 下载模型文件
- 创建Python虚拟环境
- 安装依赖包
- Janus Pro测试
- 运行程序
- 图片分析测试
- 文生图测试
- 使用中文提示词
- 使用英文提示词
测试印象:
- 整体模型体积较小,个人可以部署并使用。
- 图像识别效果不错,不但可以识别一般的图片,也可以识别一些图纸类的内容。
- 显存占用不高,24G显存即可以运行图片识别和图像生成。
- 部署相对简单,如果不考虑模型下载时间,半小时就可以进行简单测试。
- 图片识别时,如果图片是格式复杂的文本类(如试卷),在OCR时,会出现较严重的问题。
- 生成图片时,必须用英文。
- 生成图片时,当提示词过于简单时,会出现物品不完整的现象。
总体来说,在开源的多模态大模型中,还是一个非常不错的产品。
下载Janus Pro源代码
项目地址:
https://github.com/deepseek-ai/Janus
克隆源代码
git clone https://github.com/deepseek-ai/Janus.git
演示如下:
(base) ubuntu@ubuntu-server:~/study$ git clone https://github.com/deepseek-ai/Janus.git
Cloning into 'Janus'...
remote: Enumerating objects: 121, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 121 (delta 51), reused 36 (delta 36), pack-reused 47 (from 2)
Receiving objects: 100% (121/121), 7.19 MiB | 3.20 MiB/s, done.
Resolving deltas: 100% (57/57), done.
(base) ubuntu@ubuntu-server:~/study$
下载模型文件
模型文件地址:
https://hf-mirror.com/deepseek-ai/Janus-Pro-7B
https://modelscope.cn/models/deepseek-ai/Janus-Pro-7B
将模型文件全部下载到本地目录。
也可以使用git clone克隆模型。
进入源代码目录后,执行下面的克隆命令。
git clone https://hf-mirror.com/deepseek-ai/Janus-Pro-7B
这样操作简单,但有时会将.git目录进行下载,时间会更长一些。
说明:
- 可以将模型下载到本地的任何目录。后面在代码中,会指定模型的路径。下载到源代码中,可以使用相对路径。
- 这里进行这样的操作,主要是操作更简单,手动下载每个文件是最快的方式。
- 下载模型可以使用modescop的客户端下载,需要先安装一个客户端,这个方案是更优的方法。
如通过modelscope下载模型:
pip install modelscope
modelscope download --model deepseek-ai/Janus-Pro-7B --local_dir ./model_dir
模型下载过程:
(base) ubuntu@ubuntu-server:~/study$ cd Janus/
(base) ubuntu@ubuntu-server:~/study/Janus$ pwd
/home/ubuntu/study/Janus
(base) ubuntu@ubuntu-server:~/study/Janus$ git clone https://hf-mirror.com/deepseek-ai/Janus-Pro-7B
Cloning into 'Janus-Pro-7B'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 24 (delta 4), reused 0 (delta 0), pack-reused 4 (from 1)
Unpacking objects: 100% (24/24), 1.95 MiB | 1.24 MiB/s, done.
Filtering content: 100% (2/2), 1.82 GiB | 652.00 KiB/s, done.
Encountered 2 file(s) that may not have been copied correctly on Windows:pytorch_model-00002-of-00002.binpytorch_model-00001-of-00002.binSee: `git lfs help smudge` for more details.
(base) ubuntu@ubuntu-server:~/study/Janus$
下载完成后的目录结构
(base) ubuntu@ubuntu-server:~/study/Janus$ tree
.
├── demo
│ ├── app_janusflow.py
│ ├── app_januspro.py
│ ├── app.py
│ ├── fastapi_app.py
│ ├── fastapi_client.py
│ └── Janus_colab_demo.ipynb
├── generation_inference.py
├── images
│ ├── badge.svg
│ ├── doge.png
│ ├── equation.png
│ ├── logo.png
│ ├── logo.svg
│ ├── pie_chart.png
│ ├── teaser_janusflow.png
│ ├── teaser_januspro.png
│ ├── teaser.png
│ └── ve.png
├── inference.py
├── interactivechat.py
├── janus
│ ├── __init__.py
│ ├── janusflow
│ │ ├── __init__.py
│ │ └── models
│ │ ├── clip_encoder.py
│ │ ├── image_processing_vlm.py
│ │ ├── __init__.py
│ │ ├── modeling_vlm.py
│ │ ├── processing_vlm.py
│ │ ├── siglip_vit.py
│ │ └── uvit.py
│ ├── models
│ │ ├── clip_encoder.py
│ │ ├── image_processing_vlm.py
│ │ ├── __init__.py
│ │ ├── modeling_vlm.py
│ │ ├── processing_vlm.py
│ │ ├── projector.py
│ │ ├── siglip_vit.py
│ │ └── vq_model.py
│ └── utils
│ ├── conversation.py
│ ├── __init__.py
│ └── io.py
├── Janus-Pro-7B
│ ├── config.json
│ ├── janus_pro_teaser1.png
│ ├── janus_pro_teaser2.png
│ ├── preprocessor_config.json
│ ├── processor_config.json
│ ├── pytorch_model-00001-of-00002.bin
│ ├── pytorch_model-00002-of-00002.bin
│ ├── pytorch_model.bin.index.json
│ ├── README.md
│ ├── special_tokens_map.json
│ ├── tokenizer_config.json
│ └── tokenizer.json
├── janus_pro_tech_report.pdf
├── LICENSE-CODE
├── LICENSE-MODEL
├── Makefile
├── pyproject.toml
├── README.md
└── requirements.txt
创建Python虚拟环境
conda create -n janus_pro python=3.10
conda activate janus_pro
过程如下:
(base) ubuntu@ubuntu-server:~/study/Janus$ conda create -n janus_pro python=3.10
Retrieving notices: ...working... done
Collecting package metadata (current_repodata.json): done
Solving environment: done==> WARNING: A newer version of conda exists. <==current version: 22.11.1latest version: 25.1.1Please update conda by running$ conda update -n base -c defaults condaOr to minimize the number of packages updated during conda update useconda install conda=25.1.1## Package Plan ##environment location: /home/ubuntu/miniconda3/envs/janus_proadded / updated specs:- python=3.10The following NEW packages will be INSTALLED:_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main _openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu bzip2 pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_6 ca-certificates pkgs/main/linux-64::ca-certificates-2024.12.31-h06a4308_0 ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.40-h12ee557_0 libffi pkgs/main/linux-64::libffi-3.4.4-h6a678d5_1 libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 libuuid pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0 ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 openssl pkgs/main/linux-64::openssl-3.0.15-h5eee18b_0 pip pkgs/main/linux-64::pip-25.0-py310h06a4308_0 python pkgs/main/linux-64::python-3.10.16-he870216_1 readline pkgs/main/linux-64::readline-8.2-h5eee18b_0 setuptools pkgs/main/linux-64::setuptools-75.8.0-py310h06a4308_0 sqlite pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0 tk pkgs/main/linux-64::tk-8.6.14-h39e8969_0 tzdata pkgs/main/noarch::tzdata-2025a-h04d1e81_0 wheel pkgs/main/linux-64::wheel-0.45.1-py310h06a4308_0 xz pkgs/main/linux-64::xz-5.4.6-h5eee18b_1 zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1 Proceed ([y]/n)? yDownloading and Extracting PackagesPreparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate janus_pro
#
# To deactivate an active environment, use
#
# $ conda deactivate(base) ubuntu@ubuntu-server:~/study/Janus$ conda activate janus_pro
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$
安装依赖包
pip install -r requirements.txt
安装后的依赖环境信息
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$ pip list
Package Version
------------------------- -----------
accelerate 1.3.0
aiofiles 23.2.1
altair 5.5.0
annotated-types 0.7.0
anyio 4.8.0
attrdict 2.0.1
attrs 25.1.0
certifi 2025.1.31
charset-normalizer 3.4.1
click 8.1.8
cmake 3.31.4
colorama 0.4.5
contourpy 1.3.1
cycler 0.12.1
einops 0.8.1
exceptiongroup 1.2.2
fastapi 0.115.8
ffmpy 0.5.0
filelock 3.17.0
fonttools 4.56.0
fsspec 2025.2.0
gradio 3.48.0
gradio_client 0.6.1
h11 0.14.0
httpcore 1.0.7
httpx 0.28.1
huggingface-hub 0.28.1
idna 3.10
importlib_resources 6.5.2
Jinja2 3.1.5
jsonschema 4.23.0
jsonschema-specifications 2024.10.1
kiwisolver 1.4.8
latex2mathml 3.77.0
lit 18.1.8
Markdown 3.4.1
MarkupSafe 2.1.5
matplotlib 3.10.0
mdtex2html 1.3.0
mpmath 1.3.0
narwhals 1.26.0
networkx 3.4.2
numpy 1.26.4
nvidia-cublas-cu11 11.10.3.66
nvidia-cuda-cupti-cu11 11.7.101
nvidia-cuda-nvrtc-cu11 11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11 8.5.0.96
nvidia-cufft-cu11 10.9.0.58
nvidia-curand-cu11 10.2.10.91
nvidia-cusolver-cu11 11.4.0.1
nvidia-cusparse-cu11 11.7.4.91
nvidia-nccl-cu11 2.14.3
nvidia-nvtx-cu11 11.7.91
orjson 3.10.15
packaging 24.2
pandas 2.2.3
pillow 10.4.0
pip 25.0
psutil 6.1.1
pydantic 2.10.6
pydantic_core 2.27.2
pydub 0.25.1
Pygments 2.12.0
pyparsing 3.2.1
pypinyin 0.50.0
python-dateutil 2.9.0.post0
python-multipart 0.0.20
pytz 2025.1
PyYAML 6.0.2
referencing 0.36.2
regex 2024.11.6
requests 2.32.3
rpds-py 0.22.3
safetensors 0.5.2
semantic-version 2.10.0
sentencepiece 0.1.96
setuptools 75.8.0
six 1.17.0
sniffio 1.3.1
starlette 0.45.3
sympy 1.13.3
tiktoken 0.5.2
timm 1.0.14
tokenizers 0.21.0
torch 2.0.1
torchvision 0.15.2
tqdm 4.64.0
transformers 4.48.3
triton 2.0.0
typing_extensions 4.12.2
tzdata 2025.1
urllib3 2.3.0
uvicorn 0.34.0
websockets 11.0.3
wheel 0.45.1
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$
安装后的环境在进行图片分析时,会报错。
Janus Pro测试
运行程序
(janus_pro) ubuntu@ubuntu-server:~/study/Janus/demo$ pwd
/home/ubuntu/study/Janus/demo
(janus_pro) ubuntu@ubuntu-server:~/study/Janus/demo$ cat app_januspro.py | grep model_path
model_path = "deepseek-ai/Janus-Pro-7B"
config = AutoConfig.from_pretrained(model_path)
vl_gpt = AutoModelForCausalLM.from_pretrained(model_path,
vl_chat_processor = VLChatProcessor.from_pretrained(model_path)
(janus_pro) ubuntu@ubuntu-server:~/study/Janus/demo$
修改模型的路径

直接的执行,会报错。
(janus_pro) ubuntu@ubuntu-server:~/study/Janus/demo$ python app_januspro.py
Traceback (most recent call last):File "/home/ubuntu/study/Janus/demo/app_januspro.py", line 4, in <module>from janus.models import MultiModalityCausalLM, VLChatProcessor
ModuleNotFoundError: No module named 'janus'
(janus_pro) ubuntu@ubuntu-server:~/study/Janus/demo$
使用下面的方式进行解决。
pip install -e .
演示如下:
(janus_pro) ubuntu@ubuntu-server:~/study/Janus/demo$ cd ..
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$ pip install -e .
Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
Obtaining file:///home/ubuntu/study/JanusInstalling build dependencies ... doneChecking if build backend supports build_editable ... doneGetting requirements to build editable ... donePreparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: torch>=2.0.1 in /home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages (from janus==1.0.0) (2.0.1)
Requirement already satisfied: transformers>=4.38.2 in /home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages (from janus==1.0.0) (4.48.3)
......
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages (from torchvision->timm>=0.9.16->janus==1.0.0) (10.4.0)
Building wheels for collected packages: janusBuilding editable for janus (pyproject.toml) ... doneCreated wheel for janus: filename=janus-1.0.0-0.editable-py3-none-any.whl size=15963 sha256=0c33ddac3d9b813d27f9c12d27d1397f5b19aefd3f8b91ed3727361dd996759bStored in directory: /tmp/pip-ephem-wheel-cache-g69rs9_z/wheels/e8/bc/98/51f151a24aecfd261ac28237115419ab4b5e2f876035dd9a46
Successfully built janus
Installing collected packages: janus
Successfully installed janus-1.0.0
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$
在/home/ubuntu/study/Janus目录中运行程序(这个目录位置很重要)
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$ pwd
/home/ubuntu/study/Janus
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$ python demo/app_januspro.py
Python version is above 3.10, patching the collections module.
/home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages/torchvision/datapoints/__init__.py:12: UserWarning: The torchvision.datapoints and torchvision.transforms.v2 namespaces are still Beta. While we do not expect major breaking changes, some APIs may still change according to user feedback. Please submit any feedback you may have in this issue: https://github.com/pytorch/vision/issues/6753, and you can also check out https://github.com/pytorch/vision/issues/7319 to learn more about the APIs that we suspect might involve future changes. You can silence this warning by calling torchvision.disable_beta_transforms_warning().warnings.warn(_BETA_TRANSFORMS_WARNING)
/home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages/torchvision/transforms/v2/__init__.py:54: UserWarning: The torchvision.datapoints and torchvision.transforms.v2 namespaces are still Beta. While we do not expect major breaking changes, some APIs may still change according to user feedback. Please submit any feedback you may have in this issue: https://github.com/pytorch/vision/issues/6753, and you can also check out https://github.com/pytorch/vision/issues/7319 to learn more about the APIs that we suspect might involve future changes. You can silence this warning by calling torchvision.disable_beta_transforms_warning().warnings.warn(_BETA_TRANSFORMS_WARNING)
/home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages/transformers/models/auto/image_processing_auto.py:590: FutureWarning: The image_processor_class argument is deprecated and will be removed in v4.42. Please use `slow_image_processor_class`, or `fast_image_processor_class` insteadwarnings.warn(
Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]/home/ubuntu/miniconda3/envs/janus_pro/lib/python3.10/site-packages/torch/_utils.py:776: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()return self.fget.__get__(instance, owner)()
Loading checkpoint shards: 100%|????????????????????????????????????????????????????????| 2/2 [00:09<00:00, 4.89s/it]
Using a slow image processor as `use_fast` is unset and a slow processor was saved with this model. `use_fast=True` will be the default behavior in v4.48, even if the model was saved with a slow processor. This will result in minor differences in outputs. You'll still be able to use a slow processor with `use_fast=False`.
You are using the default legacy behaviour of the <class 'transformers.models.llama.tokenization_llama_fast.LlamaTokenizerFast'>. This is expected, and simply means that the `legacy` (previous) behavior will be used so nothing changes for you. If you want to use the new behaviour, set `legacy=False`. This should only be set if you understand what it means, and thoroughly read the reason why this was added as explained in https://github.com/huggingface/transformers/pull/24565 - if you loaded a llama tokenizer from a GGUF file you can ignore this message.
Some kwargs in processor config are unused and will not have any effect: add_special_token, mask_prompt, image_tag, sft_format, num_image_tokens, ignore_id.
Running on local URL: http://127.0.0.1:7860
IMPORTANT: You are using gradio version 3.48.0, however version 4.44.1 is available, please upgrade.
--------
Running on public URL: https://8737eac9b03202f1c7.gradio.liveThis share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)
由于运行默认地址为http://127.0.0.1:7860,只能在服务器上进行访问。

修改代码中的launch,加入server_name="0.0.0.0",并再次运行。
(base) ubuntu@ubuntu-server:~/study/Janus/demo$ tail app_januspro.py generation_button.click(fn=generate_image,inputs=[prompt_input, seed_input, cfg_weight_input, t2i_temperature],outputs=image_output)# demo.launch(share=True)
demo.launch(server_name="0.0.0.0", share=True)
# demo.queue(concurrency_count=1, max_size=10).launch(server_name="0.0.0.0", server_port=37906, root_path="/path")
(base) ubuntu@ubuntu-server:~/study/Janus/demo$

现在就可以在其它电脑上访问了。

图片分析测试
上传一个图片,进行测试。

运行报错

程序会报RuntimeError: "triu_tril_cuda_template" not implemented for 'BFloat16'。

这个问题可以通过升级torch的版本来解决,默认的为2.0.1。
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$ pip list | grep torch
torch 2.0.1
torchvision 0.15.2
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$
升级到2.2.2
pip install -U torch==2.2.2
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$ pip list | grep torch
torch 2.2.2
torchvision 0.15.2
(janus_pro) ubuntu@ubuntu-server:~/study/Janus$
可以正常分析图片了。

分析一个有难度的图片,来个线路图让它看看。


还是比较厉害的,虽然我没看懂,但是分析的结果像那么回事。
再来一张 测试一下。


测试一下小学生的试卷

这个图片分析的不太理想,内容识别出现大量的错误。

图片分析时的显存占用情况:
(base) ubuntu@ubuntu-server:~$ nvidia-smi
Tue Feb 11 09:45:08 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.120 Driver Version: 550.120 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4090 Off | 00000000:01:00.0 On | Off |
| 0% 38C P8 14W / 450W | 16271MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
| 1 NVIDIA GeForce RTX 4090 Off | 00000000:05:00.0 Off | Off |
| 0% 33C P8 15W / 450W | 926MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------++-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 4378 G /usr/lib/xorg/Xorg 205MiB |
| 0 N/A N/A 951857 C python 15320MiB |
| 0 N/A N/A 1261524 C ...erProcess --variations-seed-version 728MiB |
| 1 N/A N/A 4378 G /usr/lib/xorg/Xorg 4MiB |
| 1 N/A N/A 1261524 C ...erProcess --variations-seed-version 908MiB |
+-----------------------------------------------------------------------------------------+
(base) ubuntu@ubuntu-server:~$
文生图测试
使用中文提示词

当使用中文时,生成的内容完全不对。
使用英文提示词

一次可以生成多张图片。

生成的图片是768 * 768的。

使用复杂的提示词,可以生成更高质量的图片。

显存使用情况
Tue Feb 11 09:59:55 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.120 Driver Version: 550.120 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4090 Off | 00000000:01:00.0 On | Off |
| 0% 38C P8 13W / 450W | 22191MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
| 1 NVIDIA GeForce RTX 4090 Off | 00000000:05:00.0 Off | Off |
| 0% 32C P8 15W / 450W | 926MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------++-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 4378 G /usr/lib/xorg/Xorg 205MiB |
| 0 N/A N/A 951857 C python 21240MiB |
| 0 N/A N/A 1261524 C ...erProcess --variations-seed-version 728MiB |
| 1 N/A N/A 4378 G /usr/lib/xorg/Xorg 4MiB |
| 1 N/A N/A 1261524 C ...erProcess --variations-seed-version 908MiB |
+-----------------------------------------------------------------------------------------+
(base) ubuntu@ubuntu-server:~$
具体的应用情况,请小伙伴们自己测试吧。
相关文章:
半小时在本地部署DeepSeek的Janus Pro,进行图片分析和文生图
半小时在本地部署DeepSeek的Janus Pro,进行图片分析和文生图 下载Janus Pro源代码下载模型文件创建Python虚拟环境安装依赖包Janus Pro测试运行程序图片分析测试文生图测试使用中文提示词使用英文提示词 测试印象: 整体模型体积较小,个人可以…...
急停信号的含义
前言: 大家好,我是上位机马工,硕士毕业4年年入40万,目前在一家自动化公司担任软件经理,从事C#上位机软件开发8年以上!我们在开发C#的运动控制程序的时候,一个必要的步骤就是确认设备按钮的急停…...
设置mysql的主从复制模式
mysql设置主从复制模式似乎很容易,关键在于1)主库启用二进制日志,2)从库将主库设为主库。另外,主从复制,复制些什么?从我现在获得的还很少的经验来看,复制的内容有表,用户…...
三角拓扑聚合优化器TTAO-Transformer-BiLSTM多变量回归预测(Maltab)
三角拓扑聚合优化器TTAO-Transformer-BiLSTM多变量回归预测(Maltab) 完整代码私信回复三角拓扑聚合优化器TTAO-Transformer-BiLSTM多变量回归预测(Maltab) 一、引言 1、研究背景和意义 在现代数据科学领域,时间序列…...
东方财富Android面试题及参考答案
接口和抽象类的区别是什么? 定义与语法 接口:接口是一种抽象类型,它只包含方法签名、常量定义,方法默认是public、abstract的,常量默认是public、static、final的。接口不能包含实例变量和普通方法的实现。抽象类:抽象类是一种不能被实例化的类,它可以包含抽象方法和具体…...
ArcGIS基础知识之ArcMap基础设置——ArcMap选项:常规选项卡设置及作用
作为一名 GIS 从业者,ArcMap 是我们日常工作中不可或缺的工具。对于初学者来说,掌握 ArcMap 的基础设置是迈向 GIS 分析与制图的第一步。今天,就让我们一起深入了解 ArcMap 选项中常规选项卡的各个设置,帮助大家更好地使用这款强大的软件。 在 ArcMap 中,常规选项卡是用户…...
element-ui时间组件同一个月内选择/30天内选择
element-ui时间组件同一个月内选择/30天内选择 同一个月 <el-date-picker v-model"time" type"datetimerange"range-separator"至" start-placeholder"开始时间"value-format"timestamp" :picker-options"pickerO…...
Linux Media 子系统 V4l2
一 创建 V4l2 的 entity 在Linux内核的Media Controller框架中,V4L2设备作为实体(entity)的注册过程涉及以下步骤: 1. 初始化Media Controller结构 驱动首先创建一个media_device实例,并与V4L2设备(如v4…...
14,.左下角的值,路径和,由序列确定树
找树左下角的值 迭代法 层序遍历 class Solution { public:int findBottomLeftValue(TreeNode* root) {queue<TreeNode*> qu;qu.push(root);TreeNode* leftqu.front();while(!qu.empty()){int szqu.size();leftqu.front();for(int i0;i<sz;i){TreeNode* curqu.fron…...
RabbitMQ 如何设置限流?
RabbitMQ 的限流(流量控制)主要依赖于 QoS(Quality of Service) 机制,即 prefetch count 参数。这个参数控制每个消费者一次最多能获取多少条未确认的消息,从而避免某个消费者被大量消息压垮。 1. RabbitMQ…...
Python常见面试题的详解3
1. 类和对象的区别、对象访问类的方法、创建对象时的操作 类和对象的区别:类是一种抽象的概念,它定义了一组具有相同属性和方法的对象的蓝图或模板。而对象是类的具体实例,是根据类创建出来的实体,每个对象都有自己独立的状态&am…...
【推理llm论文精读】DeepSeek V3技术论文_精工见效果
先附上原始论文和效果对比https://arxiv.org/pdf/2412.19437 摘要 (Abstract) DeepSeek-V3是DeepSeek-AI团队推出的最新力作,一个强大的混合专家(Mixture-of-Experts,MoE)语言模型。它拥有671B的总参数量,但每个tok…...
python自动化测试之Pytest框架之YAML详解以及Parametrize数据驱动!
一、YAML详解 YAML是一种数据类型,它能够和JSON数据相互转化,它本身也是有很多数据类型可以满足我们接口 的参数类型,扩展名可以是.yml或.yaml 作用: 1.全局配置文件 基础路径,数据库信息,账号信息&…...
DeepSeek 本地部署指南
在人工智能飞速发展的今天,大语言模型的应用越来越广泛。DeepSeek 作为一款强大的大语言模型,具备出色的语言理解和生成能力。然而,许多用户希望能够在本地部署 DeepSeek,以实现更高的隐私性、更低的延迟和更好的定制化。本文将为…...
[LeetCode]day21 15.三数之和
题目链接 题目描述 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i ! j、i ! k 且 j ! k ,同时还满足 nums[i] nums[j] nums[k] 0 。请你返回所有和为 0 且不重复的三元组。 注意:答案中不可以包含重复…...
Unity学习part1
课程为b站【Unity教程】零基础带你从小白到超神 1、脚本执行顺序 unity的脚本执行顺序不像blender的修改器那样按顺序执行,而是系统默认给配置一个值,值越小,执行顺序越靠前(注意,这个顺序是全局生效的) …...
【AI知识点】Adversarial Validation(对抗验证)
【AI论文解读】【AI知识点】【AI小项目】【AI战略思考】【AI日记】【读书与思考】【AI应用】 Adversarial Validation(对抗验证) 是一种用于检查 训练集(Train Set)和测试集(Test Set)是否同分布 的方法。它…...
力扣 15.三数之和
题目: 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i ! j、i ! k 且 j ! k,同时还满足 nums[i] nums[j] nums[k] 0 。请你返回所有和为 0 且不重复的三元组。 注意:答案中不可以包含重复的…...
Spring boot中实现字典管理
数据库脚本 CREATE TABLE data_dict (id bigint NOT NULL COMMENT 主键,dict_code varchar(32) DEFAULT NULL COMMENT 字典编码,dict_name varchar(64) DEFAULT NULL COMMENT 字典名称,dict_description varchar(255) DEFAULT NULL COMMENT 字典描述,dict_status tinyint DEFA…...
唯一值校验的实现思路(续)
本文接着上一篇文章《唯一值校验的实现思路》,在后端实现唯一值校验。用代码实现。 /*** checkUniqueException[唯一值校验]** param entity 新增或编辑的学生实体* param insert 是否新增,如果是传入true;反之传入false* return void* date…...
【AI论文】10亿参数大语言模型能超越405亿参数大语言模型吗?重新思考测试时计算最优缩放
摘要:测试时缩放(Test-Time Scaling,TTS)是一种通过在推理阶段使用额外计算来提高大语言模型(LLMs)性能的重要方法。然而,目前的研究并未系统地分析策略模型、过程奖励模型(Process …...
Ubuntu20.04上搭建nginx正向代理提供上网服务
背景:公司很多电脑因软件管控问题不得不禁止设备上网,现需搭建上网代理服务器提供给这些用户使用。 操作系统:ubuntu20.04 工具:nginx-1.25.4 1、下载nginx安装包及依赖 由于nginx默认只持支持转发http协议,所以如…...
web前端布局--使用element中的Container布局容器
前端页面,跟Qt中一样,都是有布局设置的。 先布局,然后再在各布局中添加显示的内容。 Element网站布局容器:https://element.eleme.cn/#/zh-CN/componet/container 1.将element相应的布局容器代码layout,粘贴到vue项…...
使用 PDF SDK 通过页面分割和数据提取对建筑图纸进行分类
一家专门从事设计和建设的建筑公司对大量多页建筑 PDF 图纸进行分类,从而提高协作和运营效率。 这类公司通常承担多个建筑设计项目,每个项目包含多个设计图纸,如详细的结构计划、电气与水管计划、机械计划等。如果项目图纸可以在上传后自动分…...
Linux命名管道与共享内存
命名管道与共享内存 命名管道介绍和基本使用 理解了匿名管道后,命名管道的理解就会变得容易。在前面使用匿名管道时可以发现,之所以可以匿名是因为由父进程创建,子进程拷贝所以子进程和父进程都可以看到这个管道。但是如果对于任意两个进程…...
maven web项目如何定义filter
在 Maven Web 项目中定义一个 Servlet 过滤器(Filter),需要遵循 Java Servlet 规范,并利用 Maven 来管理项目结构和依赖。下面是如何在 Maven Web 项目中定义和配置一个过滤器的基本步骤: 1. 创建过滤器类 首先&…...
使用 Notepad++ 编辑显示 MarkDown
Notepad 是一款免费的开源文本编辑器,专为 Windows 用户设计。它是替代记事本(Notepad)的最佳选择之一,因为它功能强大且轻量级。Notepad 支持多种编程语言和文件格式,并可以通过插件扩展其功能。 Notepad 是一款功能…...
@synchronized的使用
synchronized 介绍 synchronized 是 Objective-C 提供的一种 互斥锁(Mutex),它用于确保一段代码在同一时间只有一个线程能执行,避免多线程访问共享资源时出现数据竞争。 基本语法 synchronized (lockObject) {// 需要加锁的代码…...
解锁Rust:融合多语言特性的编程利器
如果你曾为理解Rust的特性或它们之间的协同工作原理而苦恼,那么这篇文章正是为你准备的。 Rust拥有许多令人惊叹的特性,但这些特性并非Rust所独有。实际上,Rust巧妙地借鉴了众多其他语言的优秀特性,并将它们融合成了一个完美的整体。深入了解Rust这些重要特性的来源以及它是…...
zyNo.23
SQL注入漏洞 1.SQL语句基础知识 一个数据库由多个表空间组成,sql注入关系到关系型数据库,常见的关系型数据库有MySQL,Postgres,SQLServer,Oracle等 以Mysql为例,输入 mysql-u用户名-p密码 即可登录到MySQL交互式命令行界面。 既然是…...
