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

本地部署DeepSeek开源多模态大模型Janus-Pro-7B实操

本地部署DeepSeek开源多模态大模型Janus-Pro-7B实操

Janus-Pro-7B介绍

Janus-Pro-7B 是由 DeepSeek 开发的多模态 AI 模型,它在理解和生成方面取得了显著的进步。这意味着它不仅可以处理文本,还可以处理图像等其他模态的信息。
模型主要特点:Permalink
统一的架构: Janus-Pro 采用单一 transformer 架构来处理文本和图像信息,实现了真正的多模态理解和生成。
解耦的视觉编码: 为了更好地平衡理解和生成任务,Janus-Pro 将视觉编码解耦为独立的路径,提高了模型的灵活性和性能。
强大的性能: 在多个基准测试中,Janus-Pro 的性能超越了之前的统一模型,甚至可以与特定任务的模型相媲美。
开源: Janus-Pro-7B 是开源的,这意味着研究人员和开发者可以自由地访问和使用它,推动 AI 领域的创新。
具体来说,Janus-Pro-7B 有以下优势:

图像理解: 能够准确地识别和理解图像中的对象、场景和关系。
图像生成: 可以根据文本描述生成高质量的图像,甚至可以进行图像编辑和转换。
文本生成: 可以生成流畅、连贯的文本,例如故事、诗歌、代码等。
多模态推理: 可以结合文本和图像信息进行推理,例如根据图像内容回答问题,或者根据文本描述生成图像。
与其他模型的比较:
超越 DALL-E 3 和 Stable Diffusion: 在 GenEval 和 DPG-Bench 等基准测试中,Janus-Pro-7B 的性能优于 OpenAI 的 DALL-E 3 和 Stability AI 的 Stable Diffusion。
基于 DeepSeek-LLM: Janus-Pro 建立在 DeepSeek-LLM-1.5b-base/DeepSeek-LLM-7b-base 的基础上,并对其进行了多模态扩展。
应用场景:
Janus-Pro-7B 具有广泛的应用场景,例如:

内容创作: 可以帮助用户生成高质量的图像、文本和其他多媒体内容。
教育: 可以用于创建交互式学习体验,例如根据文本描述生成图像,或者根据图像内容回答问题。
客户服务: 可以用于构建更智能的聊天机器人,能够理解和回应用户的多模态查询。
辅助设计: 可以帮助设计师生成创意概念,并将其转化为可视化原型

1 启动Anaconda环境

在这里插入图片描述

在这里插入图片描述

2 进入命令环境

conda create -n myenv python=3.10 -ygit clone https://github.com/deepseek-ai/Janus.gitcd Januspip install -e .pip install webencodings beautifulsoup4 tinycss2pip install -e .[gradio]pip install 'pexpect>4.3'python demo/app_januspro.py

3 遇到默认配置下C盘磁盘空间不足问题

(myenvp) C:\Users\Administrator>python demo/app_januspro.py
python: can't open file 'C:\\Users\\Administrator\\demo\\app_januspro.py': [Errno 2] No such file or directory(myenvp) C:\Users\Administrator>e:(myenvp) E:\>cd ai(myenvp) E:\AI>cd Janus(myenvp) E:\AI\Janus>dir驱动器 E 中的卷是 chia-12T-1卷的序列号是 0AF0-159BE:\AI\Janus 的目录2025/01/31  12:26    <DIR>          .
2025/01/30  00:53    <DIR>          ..
2025/01/30  00:53               115 .gitattributes
2025/01/30  00:53             7,301 .gitignore
2025/01/30  01:47    <DIR>          .gradio
2025/01/30  01:18    <DIR>          .locks
2025/01/31  12:26                 0 4.3'
2025/01/30  00:53    <DIR>          demo
2025/01/30  00:53             4,515 generation_inference.py
2025/01/30  00:53    <DIR>          images
2025/01/30  00:53             2,642 inference.py
2025/01/30  00:53             5,188 interactivechat.py
2025/01/30  01:04    <DIR>          janus
2025/01/31  12:25    <DIR>          janus.egg-info
2025/01/30  00:53         2,846,268 janus_pro_tech_report.pdf
2025/01/30  00:53             1,065 LICENSE-CODE
2025/01/30  00:53            13,718 LICENSE-MODEL
2025/01/30  00:53             3,069 Makefile
2025/01/30  01:47    <DIR>          models--deepseek-ai--Janus-Pro-7B
2025/01/30  00:53             1,111 pyproject.toml
2025/01/30  00:53            26,742 README.md
2025/01/30  00:53               278 requirements.txt
2025/01/30  01:18                 1 version.txt14 个文件      2,912,013 字节9 个目录 9,387,683,614,720 可用字节

3.1 设置HF_DATASETS_CACHE环境变量没解决问题

(myenvp) E:\AI\Janus>set HF_DATASETS_CACHE="E:\AI\Janus"(myenvp) E:\AI\Janus>python demo/app_januspro.py
Python version is above 3.10, patching the collections module.
D:\anaconda3\envs\myenvp\lib\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(
Downloading shards:   0%|                                                                        | 0/2 [00:00<?, ?it/s]D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py:651: UserWarning: Not enough free disk space to download the file. The expected file size is: 9988.18 MB. The target location C:\Users\Administrator\.cache\huggingface\hub\models--deepseek-ai--Janus-Pro-7B\blobs only has 8154.37 MB free disk space.warnings.warn(
pytorch_model-00001-of-00002.bin:  37%|███████████████▉                           | 3.71G/9.99G [00:05<02:38, 39.5MB/s]
Downloading shards:   0%|                                                                        | 0/2 [00:06<?, ?it/s]
Traceback (most recent call last):File "E:\AI\Janus\demo\app_januspro.py", line 19, in <module>vl_gpt = AutoModelForCausalLM.from_pretrained(model_path,File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\models\auto\auto_factory.py", line 564, in from_pretrainedreturn model_class.from_pretrained(File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\modeling_utils.py", line 3944, in from_pretrainedresolved_archive_file, sharded_metadata = get_checkpoint_shard_files(File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\utils\hub.py", line 1098, in get_checkpoint_shard_filescached_filename = cached_file(File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\utils\hub.py", line 403, in cached_fileresolved_file = hf_hub_download(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fnreturn fn(*args, **kwargs)File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 860, in hf_hub_downloadreturn _hf_hub_download_to_cache_dir(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 1009, in _hf_hub_download_to_cache_dir_download_to_tmp_and_move(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 1543, in _download_to_tmp_and_movehttp_get(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 452, in http_getfor chunk in r.iter_content(chunk_size=constants.DOWNLOAD_CHUNK_SIZE):File "D:\anaconda3\envs\myenvp\lib\site-packages\requests\models.py", line 820, in generateyield from self.raw.stream(chunk_size, decode_content=True)File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 1066, in streamdata = self.read(amt=amt, decode_content=decode_content)File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 955, in readdata = self._raw_read(amt)File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 879, in _raw_readdata = self._fp_read(amt, read1=read1) if not fp_closed else b""File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 862, in _fp_readreturn self._fp.read(amt) if amt is not None else self._fp.read()File "D:\anaconda3\envs\myenvp\lib\http\client.py", line 466, in reads = self.fp.read(amt)File "D:\anaconda3\envs\myenvp\lib\socket.py", line 717, in readintoreturn self._sock.recv_into(b)File "D:\anaconda3\envs\myenvp\lib\ssl.py", line 1307, in recv_intoreturn self.read(nbytes, buffer)File "D:\anaconda3\envs\myenvp\lib\ssl.py", line 1163, in readreturn self._sslobj.read(len, buffer)
KeyboardInterrupt
^C

3.2 设置环境变量HF_HOME解决问题

(myenvp) E:\AI\Janus>set HF_HOME=E:\AI\Janus(myenvp) E:\AI\Janus>python demo/app_januspro.py
Python version is above 3.10, patching the collections module.
D:\anaconda3\envs\myenvp\lib\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(
config.json: 100%|████████████████████████████████████████████████████████████████████████| 1.28k/1.28k [00:00<?, ?B/s]
pytorch_model.bin.index.json: 100%|███████████████████████████████████████████████| 89.0k/89.0k [00:00<00:00, 1.67MB/s]
model.safetensors.index.json: 100%|███████████████████████████████████████████████| 92.8k/92.8k [00:00<00:00, 2.99MB/s]
pytorch_model-00001-of-00002.bin:  15%|██████▌                                    | 1.53G/9.99G [00:37<03:26, 41.0MB/s]
Downloading shards:   0%|                                                                        | 0/2 [00:37<?, ?it/s]
Traceback (most recent call last):File "E:\AI\Janus\demo\app_januspro.py", line 19, in <module>vl_gpt = AutoModelForCausalLM.from_pretrained(model_path,File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\models\auto\auto_factory.py", line 564, in from_pretrainedreturn model_class.from_pretrained(File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\modeling_utils.py", line 3944, in from_pretrainedresolved_archive_file, sharded_metadata = get_checkpoint_shard_files(File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\utils\hub.py", line 1098, in get_checkpoint_shard_filescached_filename = cached_file(File "D:\anaconda3\envs\myenvp\lib\site-packages\transformers\utils\hub.py", line 403, in cached_fileresolved_file = hf_hub_download(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\utils\_validators.py", line 114, in _inner_fnreturn fn(*args, **kwargs)File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 860, in hf_hub_downloadreturn _hf_hub_download_to_cache_dir(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 1009, in _hf_hub_download_to_cache_dir_download_to_tmp_and_move(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 1543, in _download_to_tmp_and_movehttp_get(File "D:\anaconda3\envs\myenvp\lib\site-packages\huggingface_hub\file_download.py", line 452, in http_getfor chunk in r.iter_content(chunk_size=constants.DOWNLOAD_CHUNK_SIZE):File "D:\anaconda3\envs\myenvp\lib\site-packages\requests\models.py", line 820, in generateyield from self.raw.stream(chunk_size, decode_content=True)File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 1066, in streamdata = self.read(amt=amt, decode_content=decode_content)File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 955, in readdata = self._raw_read(amt)File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 879, in _raw_readdata = self._fp_read(amt, read1=read1) if not fp_closed else b""File "D:\anaconda3\envs\myenvp\lib\site-packages\urllib3\response.py", line 862, in _fp_readreturn self._fp.read(amt) if amt is not None else self._fp.read()File "D:\anaconda3\envs\myenvp\lib\http\client.py", line 466, in reads = self.fp.read(amt)File "D:\anaconda3\envs\myenvp\lib\socket.py", line 717, in readintoreturn self._sock.recv_into(b)File "D:\anaconda3\envs\myenvp\lib\ssl.py", line 1307, in recv_intoreturn self.read(nbytes, buffer)File "D:\anaconda3\envs\myenvp\lib\ssl.py", line 1163, in readreturn self._sslobj.read(len, buffer)
KeyboardInterrupt
^C

3.3 如果没下载好模型文件忽略这步

如果之前已经下载好模型文件,将models–deepseek-ai–Janus-Pro-7B目录拷贝到E:\AI\Janus\hub

(myenvp) E:\AI\Janus>python demo/app_januspro.py
Python version is above 3.10, patching the collections module.
D:\anaconda3\envs\myenvp\lib\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: 100%|█████████████████████████████████████████████████████████| 2/2 [00:44<00:00, 22.13s/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: ignore_id, num_image_tokens, add_special_token, mask_prompt, image_tag, sft_format.
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://cf6180260c7448cc2b.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)
Keyboard interruption in main thread... closing server.
Traceback (most recent call last):File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\blocks.py", line 2361, in block_threadtime.sleep(0.1)
KeyboardInterruptDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "E:\AI\Janus\demo\app_januspro.py", line 244, in <module>demo.launch(share=True)File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\blocks.py", line 2266, in launchself.block_thread()File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\blocks.py", line 2365, in block_threadself.server.close()File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\networking.py", line 75, in closeself.thread.join()File "D:\anaconda3\envs\myenvp\lib\threading.py", line 1096, in joinself._wait_for_tstate_lock()File "D:\anaconda3\envs\myenvp\lib\threading.py", line 1116, in _wait_for_tstate_lockif lock.acquire(block, timeout):
KeyboardInterrupt
Killing tunnel 127.0.0.1:7860 <> https://cf6180260c7448cc2b.gradio.live
^C

4 强制使用显卡

(myenvp) E:\AI\Janus>python demo/app_januspro.py --device cuda
Python version is above 3.10, patching the collections module.
D:\anaconda3\envs\myenvp\lib\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: 100%|█████████████████████████████████████████████████████████| 2/2 [00:06<00:00,  3.29s/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: num_image_tokens, image_tag, ignore_id, mask_prompt, sft_format, add_special_token.
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://342ecb20d5120e7d8c.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)
Keyboard interruption in main thread... closing server.
Traceback (most recent call last):File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\blocks.py", line 2361, in block_threadtime.sleep(0.1)
KeyboardInterruptDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "E:\AI\Janus\demo\app_januspro.py", line 244, in <module>demo.launch(share=True)File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\blocks.py", line 2266, in launchself.block_thread()File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\blocks.py", line 2365, in block_threadself.server.close()File "D:\anaconda3\envs\myenvp\lib\site-packages\gradio\networking.py", line 75, in closeself.thread.join()File "D:\anaconda3\envs\myenvp\lib\threading.py", line 1096, in joinself._wait_for_tstate_lock()File "D:\anaconda3\envs\myenvp\lib\threading.py", line 1116, in _wait_for_tstate_lockif lock.acquire(block, timeout):
KeyboardInterrupt
Killing tunnel 127.0.0.1:7860 <> https://342ecb20d5120e7d8c.gradio.live
^C

5 部分部署过程

(myenvp) E:\AI\Janus>pip install -e .
Obtaining file:///E:/AI/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 d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (2.5.1+cu121)
Requirement already satisfied: transformers>=4.38.2 in d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (4.48.1)
Requirement already satisfied: timm>=0.9.16 in d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (1.0.14)
Requirement already satisfied: accelerate in d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (1.3.0)
Requirement already satisfied: sentencepiece in d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (0.1.96)
Requirement already satisfied: attrdict in d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (2.0.1)
Requirement already satisfied: einops in d:\anaconda3\envs\myenvp\lib\site-packages (from janus==1.0.0) (0.8.0)
Requirement already satisfied: torchvision in d:\anaconda3\envs\myenvp\lib\site-packages (from timm>=0.9.16->janus==1.0.0) (0.20.1+cu121)
Requirement already satisfied: pyyaml in d:\anaconda3\envs\myenvp\lib\site-packages (from timm>=0.9.16->janus==1.0.0) (6.0.2)
Requirement already satisfied: huggingface_hub in d:\anaconda3\envs\myenvp\lib\site-packages (from timm>=0.9.16->janus==1.0.0) (0.28.0)
Requirement already satisfied: safetensors in d:\anaconda3\envs\myenvp\lib\site-packages (from timm>=0.9.16->janus==1.0.0) (0.5.2)
Requirement already satisfied: filelock in d:\anaconda3\envs\myenvp\lib\site-packages (from torch>=2.0.1->janus==1.0.0) (3.17.0)
Requirement already satisfied: typing-extensions>=4.8.0 in d:\anaconda3\envs\myenvp\lib\site-packages (from torch>=2.0.1->janus==1.0.0) (4.12.2)
Requirement already satisfied: networkx in d:\anaconda3\envs\myenvp\lib\site-packages (from torch>=2.0.1->janus==1.0.0) (3.4.2)
Requirement already satisfied: jinja2 in d:\anaconda3\envs\myenvp\lib\site-packages (from torch>=2.0.1->janus==1.0.0) (3.1.5)
Requirement already satisfied: fsspec in d:\anaconda3\envs\myenvp\lib\site-packages (from torch>=2.0.1->janus==1.0.0) (2024.12.0)
Requirement already satisfied: sympy==1.13.1 in d:\anaconda3\envs\myenvp\lib\site-packages (from torch>=2.0.1->janus==1.0.0) (1.13.1)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in d:\anaconda3\envs\myenvp\lib\site-packages (from sympy==1.13.1->torch>=2.0.1->janus==1.0.0) (1.3.0)
Requirement already satisfied: numpy>=1.17 in d:\anaconda3\envs\myenvp\lib\site-packages (from transformers>=4.38.2->janus==1.0.0) (1.26.4)
Requirement already satisfied: packaging>=20.0 in d:\anaconda3\envs\myenvp\lib\site-packages (from transformers>=4.38.2->janus==1.0.0) (24.2)
Requirement already satisfied: regex!=2019.12.17 in d:\anaconda3\envs\myenvp\lib\site-packages (from transformers>=4.38.2->janus==1.0.0) (2024.11.6)
Requirement already satisfied: requests in d:\anaconda3\envs\myenvp\lib\site-packages (from transformers>=4.38.2->janus==1.0.0) (2.32.3)
Requirement already satisfied: tokenizers<0.22,>=0.21 in d:\anaconda3\envs\myenvp\lib\site-packages (from transformers>=4.38.2->janus==1.0.0) (0.21.0)
Requirement already satisfied: tqdm>=4.27 in d:\anaconda3\envs\myenvp\lib\site-packages (from transformers>=4.38.2->janus==1.0.0) (4.64.0)
Requirement already satisfied: psutil in d:\anaconda3\envs\myenvp\lib\site-packages (from accelerate->janus==1.0.0) (6.1.1)
Requirement already satisfied: six in d:\anaconda3\envs\myenvp\lib\site-packages (from attrdict->janus==1.0.0) (1.17.0)
Requirement already satisfied: colorama in d:\anaconda3\envs\myenvp\lib\site-packages (from tqdm>=4.27->transformers>=4.38.2->janus==1.0.0) (0.4.5)
Requirement already satisfied: MarkupSafe>=2.0 in d:\anaconda3\envs\myenvp\lib\site-packages (from jinja2->torch>=2.0.1->janus==1.0.0) (2.1.5)
Requirement already satisfied: charset-normalizer<4,>=2 in d:\anaconda3\envs\myenvp\lib\site-packages (from requests->transformers>=4.38.2->janus==1.0.0) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in d:\anaconda3\envs\myenvp\lib\site-packages (from requests->transformers>=4.38.2->janus==1.0.0) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in d:\anaconda3\envs\myenvp\lib\site-packages (from requests->transformers>=4.38.2->janus==1.0.0) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in d:\anaconda3\envs\myenvp\lib\site-packages (from requests->transformers>=4.38.2->janus==1.0.0) (2024.12.14)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in d:\anaconda3\envs\myenvp\lib\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=16196 sha256=cdb0ebb0c36046bf768a84cbf9208824eadb31fadea888f3b6ff102de576f743Stored in directory: C:\Users\Administrator\AppData\Local\Temp\pip-ephem-wheel-cache-dhnej7iy\wheels\e4\87\ba\dd6e5c70086c786d25bcd3e6bddaeb7c46f5ae69dc25ea8be0
Successfully built janus
Installing collected packages: janusAttempting uninstall: janusFound existing installation: janus 1.0.0Uninstalling janus-1.0.0:Successfully uninstalled janus-1.0.0
Successfully installed janus-1.0.0(myenvp) E:\AI\Janus>pip install webencodings beautifulsoup4 tinycss2
Requirement already satisfied: webencodings in d:\anaconda3\envs\myenvp\lib\site-packages (0.5.1)
Requirement already satisfied: beautifulsoup4 in d:\anaconda3\envs\myenvp\lib\site-packages (4.12.3)
Requirement already satisfied: tinycss2 in d:\anaconda3\envs\myenvp\lib\site-packages (1.4.0)
Requirement already satisfied: soupsieve>1.2 in d:\anaconda3\envs\myenvp\lib\site-packages (from beautifulsoup4) (2.6)(myenvp) E:\AI\Janus>pip install 'pexpect>4.3'
ERROR: Invalid requirement: "'pexpect": Expected package name at the start of dependency specifier'pexpect^(myenvp) E:\AI\Janus>pip install 'pexpect>4.3'
ERROR: Invalid requirement: "'pexpect": Expected package name at the start of dependency specifier'pexpect^(myenvp) E:\AI\Janus>pip install "pexpect>4.3"
Requirement already satisfied: pexpect>4.3 in d:\anaconda3\envs\myenvp\lib\site-packages (4.9.0)
Requirement already satisfied: ptyprocess>=0.5 in d:\anaconda3\envs\myenvp\lib\site-packages (from pexpect>4.3) (0.7.0)(myenvp) E:\AI\Janus>python demo/app_januspro.py
Python version is above 3.10, patching the collections module.
D:\anaconda3\envs\myenvp\lib\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: 100%|█████████████████████████████████████████████████████████| 2/2 [00:06<00:00,  3.25s/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: ignore_id, sft_format, image_tag, num_image_tokens, mask_prompt, add_special_token.
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://b0590adff3d54b2255.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)
Keyboard interruption in main thread... closing server.
Killing tunnel 127.0.0.1:7860 <> https://b0590adff3d54b2255.gradio.live(myenvp) E:\AI\Janus>python demo/app_januspro.py --device cuda
Python version is above 3.10, patching the collections module.
D:\anaconda3\envs\myenvp\lib\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: 100%|█████████████████████████████████████████████████████████| 2/2 [00:06<00:00,  3.05s/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: image_tag, sft_format, ignore_id, add_special_token, num_image_tokens, mask_prompt.
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://72d4294c2d37f91dc8.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)

6 使用效果

6.1 识别图片

在这里插入图片描述

在这里插入图片描述

6.2 文生图

在这里插入图片描述

6.2.1 浣熊师父身穿滴水服装,扮演街头歹徒。

Master shifu racoon wearing drip attire as a street gangster.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.2.2 美丽女孩的脸

The face of a beautiful girl
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

6.2.3 丛林中的宇航员,冷色调,柔和的色彩,细节丰富,8k

Astronaut in a jungle, cold color palette, muted colors, detailed, 8k
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.2.4 反光面上的一杯红酒。

A glass of red wine on a reflective surface.
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.2.5 一只可爱又迷人的小狐狸,有着大大的棕色眼睛,背景中秋叶迷人,永恒、蓬松、闪亮的鬃毛、花瓣、童话般的氛围,虚幻引擎 5 和 Octane 渲染器,细节丰富,具有照片级真实感,具有电影感,色彩自然。

A cute and adorable baby fox with big brown eyes, autumn leaves in the background enchanting,immortal,fluffy, shiny mane,Petals,fairyism,unreal engine 5 and Octane Render,highly detailed, photorealistic, cinematic, natural colors.
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.2.6 这幅画中的眼睛设计精巧,背景为圆形,饰有华丽的漩涡图案,既有现实主义的色彩,也有超现实主义的色彩。画中焦点是一只鲜艳的蓝色虹膜,周围环绕着从瞳孔向外辐射的细纹,营造出深度和强度。睫毛又长又黑,在周围的皮肤上投下微妙的阴影,皮肤看起来很光滑,但略带纹理,仿佛随着时间的流逝而老化或风化。眼睛上方有一个类似古典建筑的石头结构,为构图增添了神秘感和永恒的优雅。这一建筑元素与周围的有机曲线形成鲜明而和谐的对比。眼睛下方是另一个让人联想到巴洛克艺术的装饰图案,进一步增强了每个精心制作的细节所蕴含的整体永恒感。总体而言,氛围散发着一种神秘的气氛,与暗示永恒的元素无缝交织在一起,通过现实纹理和超现实艺术的并置实现。每一个组成部分——从吸引眼球的复杂设计到上方古老的石块——都以独特的方式创造出充满神秘魅力的视觉盛宴。

The image features an intricately designed eye set against a circular backdrop adorned with ornate swirl patterns that evoke both realism and surrealism. At the center of attention is a strikingly vivid blue iris surrounded by delicate veins radiating outward from the pupil to create depth and intensity. The eyelashes are long and dark, casting subtle shadows on the skin around them which appears smooth yet slightly textured as if aged or weathered over time.

Above the eye, there’s a stone-like structure resembling part of classical architecture, adding layers of mystery and timeless elegance to the composition. This architectural element contrasts sharply but harmoniously with the organic curves surrounding it. Below the eye lies another decorative motif reminiscent of baroque artistry, further enhancing the overall sense of eternity encapsulated within each meticulously crafted detail.

Overall, the atmosphere exudes a mysterious aura intertwined seamlessly with elements suggesting timelessness, achieved through the juxtaposition of realistic textures and surreal artistic flourishes. Each component—from the intricate designs framing the eye to the ancient-looking stone piece above—contributes uniquely towards creating a visually captivating tableau imbued with enigmatic allure.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

相关文章:

本地部署DeepSeek开源多模态大模型Janus-Pro-7B实操

本地部署DeepSeek开源多模态大模型Janus-Pro-7B实操 Janus-Pro-7B介绍 Janus-Pro-7B 是由 DeepSeek 开发的多模态 AI 模型&#xff0c;它在理解和生成方面取得了显著的进步。这意味着它不仅可以处理文本&#xff0c;还可以处理图像等其他模态的信息。 模型主要特点:Permalink…...

群晖搭建Gitea教程(使用系统自带的postgresql)

基于群晖7.2.2&#xff0c;使用套件中心的gitea&#xff0c;和系统自带的postgresql postgresql: 切换到postgres用户 sudo -I -u postgres 在想要保存数据库的磁盘路径下创建PostgreSql文件夹 初始化数据库文件夹配置 initdb -D ./PostgreSql 备份./PostgreSql路径下的post…...

洛谷 P8724 [蓝桥杯 2020 省 AB3] 限高杆

洛谷题目传送门 题目描述 某市有 n 个路口&#xff0c;有 m 段道路连接这些路口&#xff0c;组成了该市的公路系统。其中一段道路两端一定连接两个不同的路口。道路中间不会穿过路口。 由于各种原因&#xff0c;在一部分道路的中间设置了一些限高杆&#xff0c;有限高杆的路…...

DeepSeek文生图模型Janus-Pro论文解读 —— 多模态AI的革命?

介绍 整个AI行业仍在适应最近发布的、震惊人工智能领域的 DeepSeek-R1。1月28日除夕当天的凌晨&#xff0c;DeepSeek 又发布了另一款出色的开源模型 Janus-Pro。这一次&#xff0c;它是一款能与其他顶级多模态模型相媲美的多模态人工智能模型。 在本文中&#xff0c;我们将解…...

C语言:整型提升

一&#xff0c; 整型提升 C语⾔中整型算术运算总是⾄少以缺省&#xff08;默认&#xff09;整型类型的精度来进⾏的。 为了获得这个精度&#xff0c;表达式中的字符和短整型操作数在使⽤之前被转换为普通整型&#xff0c;这种转换称为整型提升。 整型提升的意义&#xff1a; …...

DRM系列六:Drm之KMS

KMS&#xff08;Kernel Mode Setting&#xff09;是负责显示输出的核心组件&#xff0c;它处理与plane、crtc、encoder和connector相关的各项任务。简单来说&#xff0c;KMS就是结构体drm_mode_config、drm_mode_object和组件&#xff08;object&#xff09;的结合。 KMSdrm_m…...

前端 Vue 性能提升策略

一、引言 前端性能优化是确保 Web 应用快速响应和流畅用户体验的关键。对于使用 Vue.js 构建的应用,性能优化不仅涉及通用的前端技术,还包括针对 Vue 特性的特定优化措施。本文将从多个方面探讨如何全面提升前端和 Vue 应用的性能。 二、前端性能优化基础 1. 减少初始加载…...

【C语言】static关键字的三种用法

【C语言】static关键字的三种用法 C语言中的static关键字是一个存储类说明符&#xff0c;它可以用来修饰变量和函数。static关键字的主要作用是控制变量或函数的生命周期和可见性。以下是static关键字的一些主要用法和含义&#xff1a; 局部静态变量&#xff1a; 当static修饰…...

数仓实战项目,大数据数仓实战(离线数仓+实时数仓)

1.课程目标 2.电商行业与电商系统介绍 3.数仓项目整体技术架构介绍 4.数仓项目架构-kylin补充 5.数仓具体技术介绍与项目环境介绍 6.kettle的介绍与安装 7.kettle入门案例 这个连线是点击shift键&#xff0c;然后鼠标左键拖动 ctrls保存一下 csv输入配置 Excel输出配置 配置完 …...

Unity安装教学与相关问题

文章目录 1. 前言2.Unity Hub2.1 下载Unity Hub2.2 安装Unity Hub2.3 注册Unity账号2.4 在Hub上登录账号2.5 在Hub上获取许可证 3. 下载并安装Unity3.1 从Unity Hub下载&#xff08;推荐&#xff09;3.1.1 选择下载版本3.1.2 选择下载组件3.1.3 安装Visual Studio Community 20…...

Linux_线程同步生产者消费者模型

同步的相关概念 同步&#xff1a;在保证数据安全的前提下&#xff0c;让线程能够按照某种特定的顺序访问临界资源&#xff0c;从而有效避免饥饿问题&#xff0c;叫做同步竞态条件&#xff1a;因为时序问题&#xff0c;而导致程序异常&#xff0c;我们称之为竞态条件。 同步的…...

边缘检测算法(candy)

人工智能例子汇总&#xff1a;AI常见的算法和例子-CSDN博客 Canny 边缘检测的步骤 1. 灰度转换 如果输入的是彩色图像&#xff0c;则需要先转换为 灰度图像&#xff0c;因为边缘检测通常在单通道图像上进行。 2. 高斯滤波&#xff08;Gaussian Blur&#xff09; 由于边缘…...

Hot100之双指针

283移动零 题目 思路解析 那我们就把不为0的数字都放在数组前面&#xff0c;然后数组后面的数字都为0就行了 代码 class Solution {public void moveZeroes(int[] nums) {int left 0;for (int num : nums) {if (num ! 0) {nums[left] num;// left最后会变成数组中不为0的数…...

租房管理系统实现智能化租赁提升用户体验与运营效率

内容概要 在当今快速发展的租赁市场中&#xff0c;租房管理系统的智能化转型显得尤为重要。它不仅帮助房东和租客之间建立更高效的沟通桥梁&#xff0c;还优化了整个租赁流程。通过智能化技术&#xff0c;这套系统能够自动处理资产管理、合同签署、财务管理等所有关键环节。这…...

spring和Mybatis的逆向工程

在现代企业级开发中&#xff0c;使用Spring和MyBatis进行快速、高效的数据库操作是非常常见的。本文将深入探讨如何使用Spring和MyBatis进行逆向工程&#xff0c;帮助开发者自动生成数据库相关的代码&#xff0c;提高开发效率和代码质量。 一、什么是逆向工程 逆向工程是指从…...

计算机网络 IP 网络层 2 (重置版)

IP的简介&#xff1a; IP 地址是互联网协议地址&#xff08;Internet Protocol Address&#xff09;的简称&#xff0c;是分配给连接到互联网的设备的唯一标识符&#xff0c;用于在网络中定位和通信。 IP编制的历史阶段&#xff1a; 1&#xff0c;分类的IP地址&#xff1a; …...

松灵机器人 scout ros2 驱动 安装

必须使用 ubuntu22 必须使用 链接的humble版本 #打开can 口 sudo modprobe gs_usbsudo ip link set can0 up type can bitrate 500000sudo ip link set can0 up type can bitrate 500000sudo apt install can-utilscandump can0mkdir -p ~/ros2_ws/srccd ~/ros2_ws/src git cl…...

【Leetcode 每日一题】541. 反转字符串 II

问题背景 给定一个字符串 s s s 和一个整数 k k k&#xff0c;从字符串开头算起&#xff0c;每计数至 2 k 2k 2k 个字符&#xff0c;就反转这 2 k 2k 2k 字符中的前 k k k 个字符。 如果剩余字符少于 k k k 个&#xff0c;则将剩余字符全部反转。如果剩余字符小于 2 k…...

掌握API和控制点(从Java到JNI接口)_35 JNI开发与NDK 03

3、 如何载入 .so档案 VM的角色 由于Android的应用层级类别都是以Java撰写的&#xff0c;这些Java类别转译为Dex型式的Bytecode之后&#xff0c;必须仰赖Dalvik虚拟机器(VM: Virtual Machine)来执行之。 VM在Android平台里&#xff0c;扮演很重要的角色。此外&#xff0c;在执…...

解锁豆瓣高清海报(二) 使用 OpenCV 拼接和压缩

解锁豆瓣高清海报(二): 使用 OpenCV 拼接和压缩 脚本地址: 项目地址: Gazer PixelWeaver.py pixel_squeezer_cv2.py 前瞻 继上一篇“解锁豆瓣高清海报(一) 深度爬虫与requests进阶之路”成功爬取豆瓣电影海报之后&#xff0c;本文将介绍如何使用 OpenCV 对这些海报进行智…...

【C/C++】Windows SAPI自实现文字转语音

本文通过封装Windows SAPI&#xff08;Speech Application Programming Interface&#xff09;&#xff0c;提供了一个现代化的C接口实现文字转语音功能。主要特性包括支持同步/异步语音合成、可调节语速&#xff08;-10到10&#xff09;和音量控制&#xff08;0-100%&#xff…...

openmv的端口被拆分为两个 导致电脑无法访问openmv文件系统解决办法 openmv USB功能改动 openmv驱动被更改如何修复

我之前误打误撞遇到一次&#xff0c;直接把openmv的全部端口删除卸载然后重新插上就会自动重新装上一个openmv端口修复成功&#xff0c;大家可以先试试不行再用下面的方法 全部卸载再重新插拔openmv 要解决OpenMV IDE中出现的两个端口问题&#xff0c;可以尝试以下步骤&#x…...

8.攻防世界Web_php_wrong_nginx_config

进入题目页面如下 尝试弱口令密码登录 一直显示网站建设中&#xff0c;尝试无果&#xff0c;查看源码也没有什么特别漏洞存在 用Kali中的dirsearch扫描根目录试试 命令&#xff1a; dirsearch -u http://61.147.171.105:53736/ -e* 登录文件便是刚才登录的界面打开robots.txt…...

音叉模态分析

目录 0 序言 1 自由状态下模态求解 1.1 添加模态项目 1.2 生成网格 1.3 设置最大模态阶数 1.4 求解 1.5 结果查看 1.6 结果分析 2 音叉能否释放频率440Hz的音调 3 预应力模态求解 3.1 静态结构分析 3.1.1 添加静态结构项目 3.1.2生成网格 3.1.3添加边界条件 3.1…...

智慧园区系统集成解决方案引领未来城市管理的智能化转型

内容概要 在现代城市管理的背景下&#xff0c;“智慧园区系统集成解决方案”正扮演着越来越重要的角色。这种解决方案不仅仅是技术上的创新&#xff0c;更是一种全新的管理理念&#xff0c;它旨在通过高效的数据整合与分析&#xff0c;优化资源配置&#xff0c;提升运营效率。…...

(即插即用模块-特征处理部分) 二十、(TPAMI 2022) Permute-MLP 置换MLP模块

文章目录 1、Permute-MLP layer2、代码实现 paper&#xff1a;Vision Permutator: A Permutable MLP-Like Architecture for Visual Recognition Code&#xff1a;https://github.com/Andrew-Qibin/VisionPermutator 1、Permute-MLP layer 传统的 MLP-like 模型&#xff08;如…...

FBX SDK的使用:基础知识

Windows环境配置 FBX SDK安装后&#xff0c;目录下有三个文件夹&#xff1a; include 头文件lib 编译的二进制库&#xff0c;根据你项目的配置去包含相应的库samples 官方使用案列 动态链接 libfbxsdk.dll, libfbxsdk.lib是动态库&#xff0c;需要在配置属性->C/C->预…...

爬虫基础(二)Web网页的基本原理

一、网页的组成 网页由三部分构成&#xff1a;HTML、JavaScript、CSS。 &#xff08;1&#xff09;HTML HTML 相当于网页的骨架&#xff0c;它通过使用标签来定义网页内容的结构。 举个例子&#xff1a; 它把图片标签为img、把视频标签为video&#xff0c;然后组合到一个界面…...

1.4 Go 数组

一、数组 1、简介 数组是切片的基础 数组是一个固定长度、由相同类型元素组成的集合。在 Go 语言中&#xff0c;数组的长度是类型的一部分&#xff0c;因此 [5]int 和 [10]int 是两种不同的类型。数组的大小在声明时确定&#xff0c;且不可更改。 简单来说&#xff0c;数组…...

爬虫基础(三)Session和Cookie讲解

目录 一、前备知识点 &#xff08;1&#xff09;静态网页 &#xff08;2&#xff09;动态网页 &#xff08;3&#xff09;无状态HTTP 二、Session和Cookie 三、Session 四、Cookie &#xff08;1&#xff09;维持过程 &#xff08;2&#xff09;结构 正式开始说 Sessi…...

hive:基本数据类型,关于表和列语法

基本数据类型 Hive 的数据类型分为基本数据类型和复杂数据类型 加粗的是常用数据类型 BOOLEAN出现ture和false外的其他值会变成NULL值 没有number,decimal类似number 如果输入的数据不符合数据类型, 映射时会变成NULL, 但是数据本身并没有被修改 创建表 创建表的本质其实就是在…...

Maya软件安装步骤与百度网盘链接

软件简介&#xff1a; MAYA软件是Autodesk旗下的著名三维建模和动画软件。maya软件功能更为强大&#xff0c;体系更为完善&#xff0c;因此国内很多的三维动画制作人员都开始转向maya&#xff0c;maya软件已成为三维动画软件的主流。 百度网盘链接: https://pan.baidu.com/s…...

error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054

Descriptions&#xff1a; Solutions&#xff1a;...

PID算法的数学实现和参数确定方法

目录 概述 1 算法描述 1.1 PID算法模型 1.2 PID离散化的图形描述 1.3 PID算法的特点 2 离散化的PID算法 2.1 位置式PID算法 2.2 增量式PID算法 2.3 位置式PID与增量式PID比较 3 控制器参数整定 3.1 PID参数确定方法 3.1.1 凑试法 3.1.2 临界比例法 3.1.3 经验法…...

【已解决】ECharts 没有在页面生效

元素高度问题&#xff1a; ECharts 需要一个具有明确高度的容器来渲染图表&#xff0c;也就是说 echartsRef 元素需要一个明确的 div 高度。我项目中的问题就是在 .base-echarts&#xff08;我项目中的最外层元素&#xff09; 上设置了高度为 300px&#xff0c;但没有为 .echar…...

三角函数正交性应用--以信号分离为例

三角函数的正交性的应用 引言 在信号处理、通信等众多领域中&#xff0c;三角函数的正交性发挥着至关重要的作用。它不仅是理论分析的基础&#xff0c;更是实际应用中解决各种问题的有力工具。本文将详细介绍三角函数正交性的定义、证明&#xff0c;并通过一个具体的信号处理…...

ASP.NET Core 中使用依赖注入 (DI) 容器获取并执行自定义服务

目录 一、ASP.NET Core 中使用依赖注入 (DI) 容器获取并执行自定义服务 1. app.Services 2. GetRequiredService() 3. Init() 二、应用场景 三、依赖注入使用拓展 1、使用场景 2、使用步骤 1. 定义服务接口和实现类 2. 注册服务到依赖注入容器 3. 使用依赖注入获取并…...

一个数如果恰好等于他的因子之和,这是就成为“完数“,例如6=1+2+3.编程找出1000以内的所有完数

from sys import stdoutfor i in range(2,1001):k[] #用于存储因子si #初始化s为当前数字ifor j in range(1,i):if i%j0: #如果j是i的因子s-j #从s中减去银子jk.append(j) #将因子j加入列表kif s0:#如果s最终为0,说明i是一个完数print(i)for j in range(len(k)): #遍历银子列表…...

理解 InnoDB 如何处理崩溃恢复

在数据库领域&#xff0c;数据的一致性与可靠性至关重要。InnoDB 存储引擎的崩溃恢复机制是保障数据安全的核心&#xff0c;其中 Doublewrite Buffer 和 Redo Log 发挥着关键作用。下面&#xff0c;我们将详细探讨 InnoDB 从写入到崩溃恢复的全过程。 一、写入流程 修改页面&…...

Linux-CentOS的yum源

1、什么是yum yum是CentOS的软件仓库管理工具。 2、yum的仓库 2.1、yum的远程仓库源 2.1.1、国内仓库 国内较知名的网络源(aliyun源&#xff0c;163源&#xff0c;sohu源&#xff0c;知名大学开源镜像等) 阿里源:https://opsx.alibaba.com/mirror 网易源:http://mirrors.1…...

Redis复制

一、Redis复制&#xff1a; 1.为了解决分布式中单点故障问题&#xff0c;通常会把数据复制多个副本部署到其他机器上来解决故障恢复和负载均衡等需求。 2.建立复制 参与复制的redis实例划分为主节点&#xff08;master&#xff09;和从节点&#xff08;slave&#xff09;,每个从…...

小白怎样部署和使用本地大模型DeepSeek ?

1 安装Ollama &#xff08;1&#xff09; 下载Ollama 从https://ollama.com/download 下载, 根据你的系统下载对应的版本&#xff0c;支持Win, Mac ,Linux&#xff1a; 如果下载不了&#xff0c;右键复制链接地址&#xff0c;贴到迅雷&#xff0c;指定可以下载下来。 (2) 安…...

ECharts 样式设置

ECharts 样式设置 引言 ECharts 是一款功能强大的可视化库&#xff0c;广泛用于数据可视化。样式设置是 ECharts 中的重要一环&#xff0c;它能够帮助开发者根据需求调整图表的视觉效果&#xff0c;使其更加美观和易于理解。本文将详细介绍 ECharts 的样式设置&#xff0c;包…...

Java synchronized关键字和锁分类

专栏系列文章地址&#xff1a;https://blog.csdn.net/qq_26437925/article/details/145290162 本文目标&#xff1a; 关于synchronized已经有很多博主很细致的讲解了&#xff0c;本文主要是通过代码例子再次理解下&#xff0c;并要求能头脑反射出相关知识点主要是锁分类的知识…...

Vue.js 新的生命周期钩子:`onMounted`, `onUpdated` 等

Vue.js 新的生命周期钩子&#xff1a;onMounted, onUpdated 等 今天我们来聊聊 Vue 3 中的生命周期钩子&#xff0c;特别是 onMounted、onUpdated 等。如果你对如何在 Vue 3 的组合式 API&#xff08;Composition API&#xff09;中使用这些钩子感到困惑&#xff0c;那么这篇文…...

OpenCV:闭运算

目录 1. 简述 2. 用膨胀和腐蚀实现闭运算 2.1 代码示例 2.2 运行结果 3. 闭运算接口 3.1 参数详解 3.2 代码示例 3.3 运行结果 4. 闭运算的应用场景 5. 注意事项 相关阅读 OpenCV&#xff1a;图像的腐蚀与膨胀-CSDN博客 OpenCV&#xff1a;开运算-CSDN博客 1. 简述…...

Android 音视频编解码 -- MediaCodec

引言 如果我们只是简单玩一下音频、视频播放&#xff0c;那么使用 MediaPlayer SurfaceView 播放就可以了&#xff0c;但如果想加个水印&#xff0c;加点其他特效什么的&#xff0c;那就不行了&#xff1b; 学习 Android 自带的硬件码类 – MediaCodec。 MediaCodec 介绍 Med…...

移动互联网用户行为习惯哪些变化,对小程序的发展有哪些积极影响

一、碎片化时间利用增加 随着生活节奏的加快&#xff0c;移动互联网用户的碎片化时间越来越多。在等公交、排队、乘坐地铁等间隙&#xff0c;用户更倾向于使用便捷、快速启动的应用来满足即时需求。小程序正好满足了这一需求&#xff0c;无需下载安装&#xff0c;随时可用&…...

数据分析系列--②RapidMiner导入数据和存储过程

一、下载数据 二、导入数据 1. 在本地计算机中创建3个文件夹 2. 从本地选择.csv或.xlsx 三、界面说明 四、存储过程 1.保存 Congratulations, you are done. 一、下载数据 点击下载AssociationAnalysisData.xlsx数据集 二、导入数据 1. 在本地计算机中创建3个文件夹 2. 从…...

Prometheus 中的 Exporter

在 Prometheus 生态系统中,Exporter 扮演着至关重要的角色,它们负责从不同的服务或系统中收集和暴露度量数据。本文将详细介绍 Exporter 的概念、类型以及如何有效使用它们将 Prometheus 集成到各种系统中进行监控。 什么是 Exporter? Exporter 是一段软件,它从应用程序或…...