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

LLM系列 | 22 : Code Llama实战(下篇):本地部署、量化及GPT-4对比

  • 引言

  • 模型简介

  • 依赖安装

  • 模型inference

    • 代码补全

    • 4-bit版模型

    • 代码填充

    • 指令编码

  • Code Llama vs ChatGPT vs GPT4

  • 小结

引言

青山隐隐水迢迢,秋尽江南草未凋。

小伙伴们好,我是《小窗幽记机器学习》的小编:卖热干面的小女孩。紧接前文:

今天这篇小作文作为代码大语言模型Code Llama的下篇,主要介绍如何在本地部署Code Llama,同时介绍如何对Code Llama做模型量化。最后,对比Code Llama、ChatGPT和GTP4这三者的代码生成效果。

模型简介

官方发布了3类Code Llama模型,每类都有三种模型尺寸:

  • Code Llama:Base模型(即常说的基座模型),为通用的代码生成和理解而设计。

  • Code Llama - Python:专门为Python而设计。

  • Code Llama - Instruct:遵循指令,更加安全,可以作为代码助手。

三者关系如下:

依赖安装

pip3 install git+https://github.com/huggingface/transformers.git@main accelerate -i https://mirrors.cloud.tencent.com/pypi/simple

transformers版本:Version: 4.33.0.dev0

本文以下实验代码的获取,请前往《小窗幽记机器学习》找小编获取。

模型inference

代码补全

测试代码补齐功能的代码如下:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/9/4 20:07
# @Author  : 卖秋裤的小女孩
# @File    : inference_code_llama_hf.py
# @联系方式  : 微信公众号<小窗幽记机器学习>from transformers import AutoTokenizer
import transformers
import torch
"""
测试代码补全能力
"""
model_path = "/home/model_zoo/LLM/llama2/CodeLlama-34b-Python-hf/"
tokenizer = AutoTokenizer.from_pretrained(model_path)
pipeline = transformers.pipeline("text-generation",model=model_path,torch_dtype=torch.float16,device_map="auto",
)sequences = pipeline('def fibonacci(',do_sample=True,temperature=0.2,top_p=0.9,num_return_sequences=1,eos_token_id=tokenizer.eos_token_id,max_length=512,
)
for seq in sequences:print(f"Result: {seq['generated_text']}")

以上使用34B的模型做代码补齐能力测试,如果将模型置于一张A100(40G)上做inference,显存基本打满:

经过「漫长」的等待,终于「输出结果:」

Result: def fibonacci(n):if n == 0:return 0elif n == 1:return 1else:return fibonacci(n-1) + fibonacci(n-2)def fibonacci_iterative(n):if n == 0:return 0elif n == 1:return 1else:a = 0b = 1for i in range(2, n+1):c = a + ba = bb = creturn bdef fibonacci_iterative_2(n):if n == 0:return 0elif n == 1:return 1else:a = 0b = 1for i in range(2, n+1):c = a + ba = bb = creturn cdef fibonacci_iterative_3(n):if n == 0:return 0elif n == 1:return 1else:a = 0b = 1for i in range(2, n+1):c = a + ba = bb = creturn adef fibonacci_iterative_4(n):if n == 0:return 0elif n == 1:return 1else:a = 0b = 1for i in range(2, n+1):c = a + ba = bb = creturn adef fibonacci_iterative_5(n):if n == 0:return 0elif n == 1:return 1else:a = 0b = 1for i in range(2, n+1):c = a + ba = bb = creturn a

如果用2张A100(40G)加载模型做inference,能够相对较快返回结果。所以,对于34B版模型,建议先做量化,再用多块A100的做inference。

4-bit版模型

Transformers中已集成Code Llama,因此可以直接使用Transformers加载4-bit模型。这使得在消费级的nvidia 3090卡上运行大型的32B参数模型变得可能!以下演示如何在4-bit模式下进行推理的方法:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/9/4 21:01
# @Author  : 卖秋裤的小女孩
# @联系方式  : 微信公众号<小窗幽记机器学习>
# @File    : inference_code_llama_34B_4bit.pyfrom transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torchmodel_id = "/home/model_zoo/LLM/llama2/CodeLlama-34b-Python-hf/"
# model_id = "codellama/CodeLlama-34b-hf"
quantization_config = BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_compute_dtype=torch.float16
)tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id,quantization_config=quantization_config,device_map="auto",
)prompt = 'def remove_non_ascii(s: str) -> str:\n    """ '
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")output = model.generate(inputs["input_ids"],max_new_tokens=512,do_sample=True,top_p=0.9,temperature=0.1,
)
output = output[0].to("cpu")
print(tokenizer.decode(output))

inference期间显卡占用情况:

「输出结果如下:」

<s> def remove_non_ascii(s: str) -> str:"""Remove non-ascii characters from a string"""return "".join(c for c in s if ord(c) < 128)def clean_string(s: str) -> str:"""Clean a string by removing non-ascii characters and then removingany extra whitespace"""s = remove_non_ascii(s)s = s.strip()return s
</s>

鉴于inference速度问题,后续试验选用7B大小的模型。

代码填充

这是一个针对代码模型的特殊任务。在该任务下,模型为现有前缀和后缀的代码(包括注释)生成最佳匹配的代码。这是代码助手通常使用的策略:根据出现在光标前后的内容,填充当前的光标位置的内容。这个任务只能在「7B和13B模型的基座模型和指令微调模型」中使用。代码填充任务「不适用于34B版模型或Python版模型」。如果想要使用代码填充功能,需要注意训练模型的格式,因为它使用特殊的分隔符来识别提示的不同部分。可以直接使用transformers的CodeLlamaTokenizer。在底层,tokenizer会自动通过<FILL_ME>进行分割,以创建一个符合原始训练模式的格式化输入字符串。具体代码如下:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/9/4 19:25
# @Author  : 卖秋裤的小女孩
# @联系方式  : 微信公众号<小窗幽记机器学习>
# @File    : inference_code_infilling_hf.pyfrom transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig
import torch# model_id = "/home/model_zoo/LLM/llama2/CodeLlama-7b-Python-hf"  # 代码填充任务不适用于Python版模型
model_id = "/home/model_zoo/LLM/llama2/CodeLlama-7b-Instruct-hf"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model_config = AutoConfig.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id,config=model_config,torch_dtype=torch.float16
).to("cuda")prompt = '''def remove_non_ascii(s: str) -> str:""" <FILL_ME>return result
'''input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"].to("cuda")
output = model.generate(input_ids,max_new_tokens=512,
)
output = output[0].to("cpu")filling = tokenizer.decode(output[input_ids.shape[1]:], skip_special_tokens=True)
print(prompt.replace("<FILL_ME>", filling))

输出结果如下:

def remove_non_ascii(s: str) -> str:  """ Remove non-ASCII characters from a string.  Args:    s (str): The string to remove non-ASCII characters from.  Returns:    str: The string with non-ASCII characters removed.  """  result = ""  for c in s:    if ord(c) < 128:      result += c  return resultdef remove_non_ascii_and_spaces(s: str) -> str:  """ Remove non-ASCII and space characters from a string.  Args:    s (str): The string to remove non-ASCII and space characters from.  Returns:    str: The string with non-ASCII and space characters removed.  """  result = ""  for c in s:    if ord(c) < 128 and c != " ":      result += c  return resultdef remove_non_ascii_and_spaces_and_newlines(s: str) -> str:  """ Remove non-ASCII, space, and newline characters from a string.  Args:    s (str): The string to remove non-ASCII, space, and newline characters from.  Returns:    str: The string with non-ASCII, space, and newline characters removed.  """  result = ""  for c in s:    if ord(c) < 128 and c not in ["\n", "\r", "\t", " "]:      result += c  return resultdef remove_non_ascii_and_spaces_and_newlines_and_punctuation(s: str) -> str:  """ Remove non-ASCII, space, newline, and punctuation characters from a string.  Args:    s (str): The string to remove non-ASCII, space, newline, and punctuation characters from.  Returns:    str: The string with non-ASCII, space, newline, and punctuation characters removed.  """  result = ""  for c in s:    if ord(c) < 128 and c not in ["\  return result

如果在上述代码中强行使用CodeLlama-7b-Python-hf模型做代码填充任务,模型inference的时候可能报错:

RuntimeError: CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling `cublasCreate(handle)`

指令编码

如前面所述基座模型可以用于代码补全和填充,Code Llama还发布了一个经过指令微调的模型,可用于对话式编程。 针对这个任务,需要使用llama2中的提示模板,具体可以参考之前的文章:Llama 2实战(上篇):本地部署(附代码) :

<s>[INST] <<SYS>>
{{ system_prompt }}
<</SYS>>{{ user_msg_1 }} [/INST] {{ model_answer_1 }} </s><s>[INST] {{ user_msg_2 }} [/INST]

注意,系统提示是可选的,在没有它的情况下模型可以正常工作,但我们可以使用系统提示system_prompt来进一步配置模型的行为或风格。例如,总是希望得到JavaScript的代码答案,可以在这里指定。在系统提示之后,需要提供历史对话:用户询问的问题和模型的回答。与代码填充案例一样,需要注意使用分隔符。输入的最后一个组成必须始终是一个新的用户指令,这是模型提供答案的信号。以下代码片段演示了在实践中模板的工作方式。

  1. 没有system prompt的用户query

user = 'I have a pandas DataFrame df['text'], how can I directly add a list of data test_list to df['text'] to increase the number of rows?'prompt = f"<s>[INST] {user.strip()} [/INST]"
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")

「完整示例代码:」

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/9/5 20:49
# @Author  : 卖猪脚饭的小女孩
# @联系方式  : 微信公众号<小窗幽记机器学习>
# @File    : inference_code_instructions_hf_v2.py
"""
测试  instruction 版模型
CUDA_VISIBLE_DEVICES=2 python3 inference_code_instructions_hf_v2.py
"""
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfigmodel_id = "/home/model_zoo/LLM/llama2/CodeLlama-7b-Instruct-hf/"
# model_id = "codellama/CodeLlama-34b-hf"
# device_map="auto",
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id,
).to("cuda")user_query = "I have a pandas DataFrame df['text'], how can I directly add a list of data test_list to df['text'] to increase the number of rows?"prompt = f"<s>[INST] {user_query.strip()} [/INST]"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")output = model.generate(inputs["input_ids"],max_new_tokens=512,do_sample=True,top_p=0.9,temperature=0.1,
)
output = output[0].to("cpu")
print(tokenizer.decode(output))

输出结果如下:

<s><s> [INST] I have a pandas DataFrame df['text'], how can I directly add a list of data test_list to df['text'] to increase the number of rows? [/INST]  You can use the `append` method to add a list of data to a pandas DataFrame. Here's an example:```import pandas as pd# create a sample DataFramedf = pd.DataFrame({'text': ['hello', 'world']})# create a list of data to addtest_list = ['foo', 'bar', 'baz']# add the list to the DataFramedf['text'] = df['text'].append(test_list)print(df)```This will output:```   text0  hello1  world2  foo3  bar4  baz```Note that the `append` method returns a new DataFrame with the added data, so you need to assign the result back to the original DataFrame.Alternatively, you can use the `concat` function to concatenate the DataFrame with the list of data:```import pandas as pd# create a sample DataFramedf = pd.DataFrame({'text': ['hello', 'world']})# create a list of data to addtest_list = ['foo', 'bar', 'baz']# concatenate the DataFrame with the list of datadf = pd.concat([df, pd.DataFrame({'text': test_list})])print(df)```This will output the same result as the previous example.</s>

可以看出,输出了2种代码。 第一种:

import pandas as pd# create a sample DataFrame
df = pd.DataFrame({'text': ['hello', 'world']})# create a list of data to add
test_list = ['foo', 'bar', 'baz']# add the list to the DataFrame
df['text'] = df['text'].append(test_list)print(df)

第一种代码写法无法正常运行。

第二种:

import pandas as pd# create a sample DataFrame
df = pd.DataFrame({'text': ['hello', 'world']})# create a list of data to add
test_list = ['foo', 'bar', 'baz']# concatenate the DataFrame with the list of data
df = pd.concat([df, pd.DataFrame({'text': test_list})])print(df)

经过测试,第二种写法可以正常运行,且结果符合预期。

所以,简单的代码需求,CodeLlama-7b-Instruct-hf表现一般,可能存在一些比较明显的坑。

进一步尝试使用34B版模型:CodeLlama-34b-Instruct-hf,生成代码如下:

import pandas as pd# create a sample DataFrame with a 'text' column
df = pd.DataFrame({'text': ['hello', 'world', 'this', 'is', 'a', 'test']})# create a list of data to add to the 'text' column
test_list = ['new', 'data', 'to', 'add']# concatenate the 'text' column with the test_list
df['text'] = pd.concat([df['text'], test_list])print(df)

上述代码直接运行会报错:

TypeError: cannot concatenate object of type '<class 'list'>'; only Series and DataFrame objs are valid
  1. 带system prompt的用户query

system = "Provide answers in C++"
user = "Write a function that computes the set of sums of all contiguous sublists of a given list."prompt = f"<s><<SYS>>\\n{system}\\n<</SYS>>\\n\\n{user}"
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
  1. 带历史对话的持续对话

system = "System prompt"
user_1 = "user_prompt_1"
answer_1 = "answer_1"
user_2 = "user_prompt_2"
answer_2 = "answer_2"
user_3 = "user_prompt_3"prompt  = f"<<SYS>>\\n{system}\\n<</SYS>>\\n\\n{user_1}"
prompt  = f"<s>[INST] {prompt.strip()} [/INST] {answer_1.strip()} </s>"
prompt += f"<s>[INST] {user_2.strip()} [/INST] {answer_2.strip()} </s>"
prompt += f"<s>[INST] {user_3.strip()} [/INST]"inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")

ChatGPT vs GPT4

延续上述指令编程中的panda行方向数据扩增这一代码需求,在ChatGPT和GPT4上对比测试。由于ChatGPT和GPT4都支持中文输入,所以直接使用中文Promp输入:

我有一个pandas数据 df['text'],如何将一个list数据test_list直接添加到df['text']中,使得行数变多

「ChatGPT生成结果如下:」

import pandas as pd# 原始数据
df = pd.DataFrame({'text': ['hello', 'world']})# 要添加的数据
test_list = ['foo', 'bar']# 将test_list作为一个新的DataFrame对象添加到原始DataFrame对象中
new_df = df.append(pd.DataFrame({'text': test_list}), ignore_index=True)# 打印结果
print(new_df)

ChatGPT生成代码运行结果如下:

   text
0  hello
1  world
2    foo
3    bar

「GPT4生成结果如下:」

# 假设这是你的原始DataFrame
import pandas as pd
df = pd.DataFrame({'text': ['hello', 'world']})# 这是你要添加的list
test_list = ['foo', 'bar']# 将list转换为DataFrame
new_df = pd.DataFrame({'text': test_list})# 使用append方法将新的DataFrame添加到原来的DataFrame中
df = df.append(new_df, ignore_index=True)print(df)

GPT4生成代码运行结果如下:

    text
0  hello
1  world
2    foo
3    bar

可以看出,对于简单的代码需求,ChatGPT和GPT4都cover住。

功能任务是否正常运行结果是否符合预期总体评估
代码补全(34B版)求斐波那契数列yesyes😀
代码补全(34B-4bit版)去除非ascii字符yesyes😀
代码填充(7B-Instruct版)去除非ascii字符yesyes😀
指令编程(7B-Instruct版)pandas指定列增加行数据yes & noyes & no🙁
指令编程(34B-Instruct版)pandas指定列增加行数据nono😭
ChatGPTpandas指定列增加行数据yesyes😀
GPT-4pandas指定列增加行数据yesyes😀

小结

在普通代码需求上,现阶段的Code Llama模型仍然有一些明显的瑕疵,实战效果仍不如ChatGPT和GPT4。相信Code Llama后续的发展及其成长可以进一步趋近当下的ChatGPT和GPT4。

相关文章:

LLM系列 | 22 : Code Llama实战(下篇):本地部署、量化及GPT-4对比

引言 模型简介 依赖安装 模型inference 代码补全 4-bit版模型 代码填充 指令编码 Code Llama vs ChatGPT vs GPT4 小结 引言 青山隐隐水迢迢&#xff0c;秋尽江南草未凋。 小伙伴们好&#xff0c;我是《小窗幽记机器学习》的小编&#xff1a;卖热干面的小女孩。紧接…...

Nginx的进程结构实例演示

可以参考《Ubuntu 20.04使用源码安装nginx 1.14.0》安装nginx 1.14.0。 nginx.conf文件中worker_processes 2;这条语句表明启动两个worker进程。 sudo /nginx/sbin/nginx -c /nginx/conf/nginx.conf开启nginx。 ps -ef | grep nginx看一下进程情况。 sudo /nginx/sbin/ng…...

【Nginx36】Nginx学习:SSI静态文件服务器端包含模块

Nginx学习&#xff1a;SSI静态文件服务器端包含模块 这个模块让我想到了 2009 年刚刚工作的时候。最早我是做 .NET 的&#xff0c;而第一家公司其实是从 ASP 向 ASP.NET 转型中&#xff0c;因此&#xff0c;还是有不少的 ASP 做的页面。在那个时候&#xff0c;就用到了 SSI 。 …...

StripedFly恶意软件框架感染了100万台Windows和Linux主机

导语 近日&#xff0c;一款名为StripedFly的恶意软件框架在网络安全研究人员的监视之外悄然感染了超过100万台Windows和Linux系统。这款跨平台的恶意软件平台在过去的五年中一直未被察觉。在去年&#xff0c;卡巴斯基实验室发现了这个恶意框架的真实本质&#xff0c;并发现其活…...

蓝桥杯每日一题2023.10.25

乘积尾零 - 蓝桥云课 (lanqiao.cn) 题目描述 题目分析 由于需要相乘的数很多&#xff0c;所以我们不能直接进行暴力模拟&#xff0c;我们知道10 2 * 5&#xff0c; 所以我们只需要找出这个数2和5的个数&#xff0c;其中2和5个数小的那个则为末尾0出现的个数 #include<bi…...

【C++】详解map和set基本接口及使用

文章目录 一、关联式容器与键值对1.1关联式容器&#xff08;之前学的都是序列容器&#xff09;1.2键值对pairmake_pair函数&#xff08;map在插入的时候会很方便&#xff09; 1.3树形结构的关联式容器 二、set2.1set的基本介绍2.1默认构造、迭代器区间构造、拷贝构造&#xff0…...

如何学习 Linux 内核内存管理

Linux内核内存管理部分是Linux内核中第二复杂的部分&#xff0c;但也非常有趣。学习它的最佳方法就是阅读代码。但在不了解术语和当前 mm 部分到底发生了什么的情况下&#xff0c;显然不能随意开始阅读代码。因此&#xff0c;我想这样开始学习比较好&#xff1a; 了解当前的 LS…...

【计算机网络】(谢希仁第八版)第一章课后习题答案

1.计算机网络可以向用户提供哪些服务&#xff1f; 答&#xff1a;例如音频&#xff0c;视频&#xff0c;游戏等&#xff0c;但本质是提供连通性和共享这两个功能。 连通性&#xff1a;计算机网络使上网用户之间可以交换信息&#xff0c;好像这些用户的计算机都可以彼此直接连…...

Operator开发之operator-sdk入门

1 operator-sdk 除了kubebuilder&#xff0c;operator-sdk是另一个常用的用于开发Operator的框架&#xff0c;不过operator-sdk还是基于kubebuilder&#xff0c;因此&#xff0c;通常还是建议使用kubebuilder开发Operator。 2 环境准备 跟kubebuilder类似&#xff0c;需要安…...

RabbitMQ生产者的可靠性

目录 MQ使用时会出现的问题 生产者的可靠性 1、生产者重连 2、生产者确认 3、数据持久化 交换机持久化 队列持久化 消息持久化 LazyQueue懒加载 MQ使用时会出现的问题 发送消息时丢失&#xff1a; 生产者发送消息时连接MQ失败生产者发送消息到达MQ后未找到Exchange生…...

集群节点批量执行 shell 命令

1、SSH 工具本身支持多窗口 比如 MobaXterm&#xff1a; 2、编写脚本通过 ssh 在多台机器批量执行shell命令 创建 ssh_hosts 配置文件&#xff0c;定义需要批量执行的节点&#xff08;必须能够通过 ssh 免密登录&#xff0c;且存在同名用户&#xff09; vim ssh_hostsbig…...

fl studio21.2水果软件怎么设置中文?

FL Studio编曲软件真的是个神器&#xff0c;不过一开始打开看到全是英文&#xff0c;有点头大&#xff0c;对吧&#xff1f;其实切换成中文版超级简单&#xff0c;只需要几个步骤就搞定啦&#xff01;我自己也是用中文版的&#xff0c;觉得用起来更得心应手&#xff0c;效率也提…...

.NET CORE 3.1 集成JWT鉴权和授权2

JWT&#xff1a;全称是JSON Web Token是目前最流行的跨域身份验证、分布式登录、单点登录等解决方案。 通俗地来讲&#xff0c;JWT是能代表用户身份的令牌&#xff0c;可以使用JWT令牌在api接口中校验用户的身份以确认用户是否有访问api的权限。 授权&#xff1a;这是使用JWT的…...

nbcio-boot如何进行gitee第三方登录

更多nbcio-boot功能请看演示系统 gitee源代码地址 后端代码&#xff1a; https://gitee.com/nbacheng/nbcio-boot 前端代码&#xff1a;https://gitee.com/nbacheng/nbcio-vue.git 在线演示&#xff08;包括H5&#xff09; &#xff1a; http://122.227.135.243:9888 1、用户g…...

【C语言】字符函数、字符串函数与内存函数

简单不先于复杂&#xff0c;而是在复杂之后。 目录 0. 前言 1. 函数介绍 1.1 strlen 1.1.1 介绍 1.1.2 strlen 函数模拟实现 1.1.2.1 计数器方法 1.1.2.2 递归方法 1.1.2.3 指针 - 指针方法 1.2 strcpy 1.2.1 介绍 1.2.2 strcpy 函数模拟实现 1.3 strcat 1…...

生成树协议:监控 STP 端口和交换机

什么是生成树协议 生成树协议 &#xff08;STP&#xff09; 用于网络交换机&#xff0c;以防止循环和广播风暴。在局域网 &#xff08;LAN&#xff09; 中&#xff0c;两条或多条冗余路径可以连接到同一网段。当交换机或网桥从所有可用端口传输帧时&#xff0c;这些帧开始在网…...

【黑产攻防道03】利用JS参数更新检测黑产的协议破解

任何业务在运营一段时间之后都会面临黑产大量的破解。验证码和各种爬虫的关系就像猫和老鼠一样, 会永远持续地进行博弈。极验根据十一年和黑产博弈对抗的经验&#xff0c;将黑产的破解方式分为三类&#xff1a; 1.通过识别出验证码图片答案实现批量破解验证&#xff0c;即图片…...

什么是web3.0?

Web 3.0&#xff0c;也常被称为下一代互联网&#xff0c;代表着互联网的下一个重大演变。尽管关于Web 3.0的确切定义尚无共识&#xff0c;但它通常被认为是一种更分散、更开放且更智能的互联网。 以下是Web 3.0的一些主要特征和概念&#xff1a; 1. 去中心化 Web 3.0旨在减少…...

二、W5100S/W5500+RP2040树莓派Pico<DHCP>

文章目录 1 前言2 简介2 .1 什么是DHCP&#xff1f;2.2 为什么要使用DHCP&#xff1f;2.3 DHCP工作原理2.4 DHCP应用场景 3 WIZnet以太网芯片4 DHCP网络设置示例概述以及使用4.1 流程图4.2 准备工作核心4.3 连接方式4.4 主要代码概述4.5 结果演示 5 注意事项6 相关链接 1 前言 …...

【开源】基于SpringBoot的天然气工程业务管理系统的设计和实现

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块三、使用角色3.1 施工人员3.2 管理员 四、数据库设计4.1 用户表4.2 分公司表4.3 角色表4.4 数据字典表4.5 工程项目表4.6 使用材料表4.7 使用材料领用表4.8 整体E-R图 五、系统展示六、核心代码6.1 查询工程项目6.2 工程物资…...

讯飞星火大模型V3.0 WebApi使用

讯飞星火大模型V3.0 WebApi使用 文档说明&#xff1a;星火认知大模型Web文档 | 讯飞开放平台文档中心 (xfyun.cn) 实现效果 初始化 首先构建一个基础脚手架项目 npm init vuelatest用到如下依赖 "dependencies": {"crypto-js": "^4.2.0",&q…...

拥有DOM力量的你究竟可以干什么

如果你希望访问 HTML 页面中的任何元素&#xff0c;那么您总是从访问 document 对象开始&#xff01; 查找HTML元素 document.getElementById(id) 通过元素 id 来查找元素 <!DOCTYPE html> <html> <head><meta charset…...

GnuTLS recv error (-110): The TLS connection was non-properly terminated

ubuntu git下载提示 GnuTLS recv error (-110): The TLS connection was non-properly terminated解决方法 git config --global --unset http.https://github.com.proxy...

Notepad++安装插件和配置快捷键

Notepad是一款轻量级、开源的文件编辑工具&#xff0c;可以编辑、浏览文本文件、二进制文件、.cpp、.java、*.cs等文件。Notepad每隔1个月&#xff0c;就有一个新版本&#xff0c;其官网是&#xff1a; https://github.com/notepad-plus-plus/notepad-plus-plus。这里介绍其插件…...

iOS Autolayout 约束设置【顺序】的重要性!

0x00 顺序不同&#xff0c;结果不同 看图说话 1 代码是这样滴~ 设置好约束&#xff0c;让 4 个按钮&#xff0c;宽度均分~ 结果如上图 [_pastButton.topAnchor constraintEqualToAnchor:_textView.bottomAnchor constant:6].active YES;[_pastButton.leftAnchor constraintEq…...

Echarts渲染不报错但是没有内容

&#x1f525;博客主页&#xff1a; 破浪前进 &#x1f516;系列专栏&#xff1a; Vue、React、PHP ❤️感谢大家点赞&#x1f44d;收藏⭐评论✍️ 问题&#xff1a;在开发项目的时候使用了Echarts但是好端端的忽然就不渲染了 感觉很无语啊&#xff0c;毕竟好好的就不渲染了&am…...

数据结构 | 算法的时间复杂度和空间复杂度【详解】

数据结构 | 算法的时间复杂度和空间复杂度【详解】 1. 什么是数据结构&#xff1f; 数据结构(Data Structure)是计算机存储、组织数据的方式&#xff0c;指相互之间存在一种或多种特定关系的数据元素的集合。 2. 什么是算法&#xff1f; 算法(Algorithm):就是定义良好的计算过…...

高级篇之ENC编码器多机位帧同步配置详解

高级篇之ENC编码器多机位帧同步配置详解 一 帧同步方案多样性1. 配合vMIX导播的帧同步方案3. 配合硬件导播的帧同步方案3. 配合芯象导播的帧同步 二 帧同步方案1实现步骤1. 准备设备2. 搭建环境3 配置设备3.1 配置固定机位3.2 配置帧同步转发端3.3 配置vMIX 三 效果对比1 不开帧…...

matlab simulink 四旋翼跟拍无人机仿真

1、内容简介 略 7-可以交流、咨询、答疑 2、内容说明 四旋翼跟拍无人机仿真 四旋翼、无人机 需求分析 背景介绍 无人飞行机器人&#xff0c;是无人驾驶且具有一定智能的空中飞行器。这是一种融合了计算机技术、人工智能技术、传感器技术、自动控制技术、新型材料技术、导航…...

jenkins、ant、selenium、testng搭建自动化测试框架

如果在你的理解中自动化测试就是在eclipse里面讲webdriver的包引入&#xff0c;然后写一些测试脚本&#xff0c;这就是你所说的自动化测试&#xff0c;其实这个还不能算是真正的自动化测试&#xff0c;你见过每次需要运行的时候还需要打开eclipse然后去选择运行文件吗&#xff…...