LLM大模型学习之菜鸟的进阶道路(一)

Openstack新手入门 适合Openstack入门使用,了解Openstack架构,各个模块的组成,部署,维护。 立即下载

在我学习大模型之前,我一直是一个java哥,现在学习了大模型,我看视频学习,就只知道一个base llm,还有一个是instruction tuned llm,我理解了这些词汇的意义,然后进入了正式学习,那我们正式开始吧!

资源,配置,环境

首先我是通过DeepLearning.AI进行最基础的学习,网址是:DLAI - Learning Platform (deeplearning.ai),在这里你可以学习到最基础的知识,里面有内置Jupyter,可以方便读者学习,通过视频的讲解加上自己的编写可以学的更快!

开始

首先我们会有两条对应原则,具体内容我们后面会进行讲解 如果你是在本机运行这些代码,那我们首先需要

pip install openai

当然如果你是在网站用内置jupyter那就不需要管这些问题了
好了让我们来看看这些晦涩难懂的大模型是什么吧

运行

import openai
import os

from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

openai.api_key  = os.getenv('OPENAI_API_KEY')

这段代码的目的是设置并使用OpenAI的API密钥以访问OpenAI的服务

import openai
import os

这两行代码导入了需要的模块:

  • openai模块用于与OpenAI的API进行交互。
  • os模块用于与操作系统进行交互,特别是用于获取环境变量。
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

这两行代码的作用是加载环境变量:

  • load_dotenv和find_dotenv函数来自dotenv库,dotenv库用于读取.env文件中的环境变量。
  • find_dotenv()函数会自动找到当前项目中的.env文件路径。
  • load_dotenv(find_dotenv())会加载这个文件中的所有环境变量。
openai.api_key = os.getenv('OPENAI_API_KEY')

这行代码从环境变量中获取OpenAI的API密钥并设置它:

  • os.getenv('OPENAI_API_KEY')从环境变量中获取名为OPENAI_API_KEY的值。
  • openai.api_key将该值设置为OpenAI库使用的API密钥,以便在之后的代码中可以使用OpenAI的API。
    这段代码的总体目的是从.env文件中读取OpenAI的API密钥,并配置OpenAI库以便后续代码可以使用该密钥与OpenAI的服务进行交互。
    然后点击下图这个按钮就可以运行 image.png 然后显示为这个形式就是运行成功 image.png
    然后我们继续运行后续的代码
def get_completion(prompt, model="gpt-3.5-turbo"):
    messages = [{"role": "user", "content": prompt}]
    response = openai.ChatCompletion.create(
        model=model,
        messages=messages,
        temperature=0, # this is the degree of randomness of the model's output
    )
    return response.choices[0].message["content"]

这里我们写了一个辅助函数,何为辅助函数,用简单的话来说就是为了减少代码的冗余,而存在的函数
这里定义了一个名为get_completion的辅助函数,用于通过OpenAI的gpt-3.5-turbo模型生成聊天补全

def get_completion(prompt, model="gpt-3.5-turbo"):

这行代码定义了一个函数get_completion,它接受两个参数:

  • prompt:这是用户提供的提示信息或问题。
  • model:这是使用的模型名称,默认为gpt-3.5-turbo。
    messages = [{"role": "user", "content": prompt}]

这行代码创建了一个包含字典的列表messages,用于向OpenAI API发送请求。字典中有两个键:

  • "role":指定消息的角色,这里是"user",表示用户的消息。
  • "content":包含实际的提示内容,即用户提供的prompt。
    response = openai.ChatCompletion.create(
        model=model,
        messages=messages,
        temperature=0, # this is the degree of randomness of the model's output
    )

这段代码调用OpenAI的ChatCompletion.create方法生成聊天补全。传递的参数包括:

  • model:使用的模型名称,这里使用函数参数model,默认是gpt-3.5-turbo。
  • messages:消息列表,这里是包含用户提示的messages。
  • temperature:设置为0,控制模型输出的随机性。温度值越低,输出越确定和一致;温度值越高,输出越随机。
    return response.choices[0].message["content"]

这行代码从API的响应中提取并返回生成的消息内容:

  • response.choices[0].message["content"]:从响应中提取第一个选择的消息内容,并将其返回。 总体来说,这个函数的作用是:
  1. 接收用户提供的提示信息。
  2. 调用OpenAI的gpt-3.5-turbo模型生成响应。
  3. 返回生成的消息内容。

然后我们就可以运行了
然后下面那个我们可以不用管他,如果这个In [2]显示了,就证明运行成功了 image.png
接下来就我们前面提到的两个原则:

  • 原则1:编写清晰而具体的指令
  • 原则2:给模型时间进行“思考” 然后我们运行这个后面的代码:
text = f"""
You should express what you want a model to do by \ 
providing instructions that are as clear and \ 
specific as you can possibly make them. \ 
This will guide the model towards the desired output, \ 
and reduce the chances of receiving irrelevant \ 
or incorrect responses. Don't confuse writing a \ 
clear prompt with writing a short prompt. \ 
In many cases, longer prompts provide more clarity \ 
and context for the model, which can lead to \ 
more detailed and relevant outputs.
"""
prompt = f"""
Summarize the text delimited by triple backticks \ 
into a single sentence.
```{text}```
"""
response = get_completion(prompt)
print(response)

这里定义了一个包含多行文本的字符串,并使用OpenAI的get_completion函数生成一个总结。

text = f"""
You should express what you want a model to do by \ 
providing instructions that are as clear and \ 
specific as you can possibly make them. \ 
This will guide the model towards the desired output, \ 
and reduce the chances of receiving irrelevant \ 
or incorrect responses. Don't confuse writing a \ 
clear prompt with writing a short prompt. \ 
In many cases, longer prompts provide more clarity \ 
and context for the model, which can lead to \ 
more detailed and relevant outputs.
"""

这段代码使用三重引号定义了一个多行字符串text。其中的\ 用于在行尾进行换行,使代码更易读。这个字符串包含了关于如何编写有效提示的信息,强调了清晰和具体的重要性。

prompt = f"""
Summarize the text delimited by triple backticks \ 
into a single sentence.
```{text}```
"""

这段代码构建了一个新的字符串prompt,该字符串是一个提示,要求模型总结用三重反引号括起来的文本。使用了f字符串格式化方法,将前面定义的text嵌入到提示中。生成的提示内容如下:

Summarize the text delimited by triple backticks 
into a single sentence.
```You should express what you want a model to do by providing instructions that are as clear and specific as you can possibly make them. This will guide the model towards the desired output, and reduce the chances of receiving irrelevant or incorrect responses. Don't confuse writing a clear prompt with writing a short prompt. In many cases, longer prompts provide more clarity and context for the model, which can lead to more detailed and relevant outputs.```

response = get_completion(prompt)

这行代码调用了前面定义的get_completion函数,传入构建的prompt作为参数。该函数使用OpenAI的API生成对提示的响应。

print(response)

这行代码将API的响应打印出来,即模型对提示生成的总结。 总结起来,这段代码的作用是:

  1. 定义一段关于如何编写有效提示的文本。
  2. 构建一个提示,要求模型对这段文本进行总结。
  3. 使用OpenAI的模型生成总结并打印输出。

然后我们运行这个代码即可,以下图片是我运行时的结果 image.png
这里就可以看到我们通过openai进行了最基础的询问操作
然后就是结构化进行输出
我们为了使传递模型的输出更加容易我们可以让其输出HTML或者是JSON格式
然后我们运行后面这个代码

prompt = f"""
Generate a list of three made-up book titles along \ 
with their authors and genres. 
Provide them in JSON format with the following keys: 
book_id, title, author, genre.
"""
response = get_completion(prompt)
print(response)

这里定义了一个提示,要求OpenAI的模型生成三个虚构的书籍标题,并提供相关的作者和体裁信息,然后返回这些数据的JSON格式。

prompt = f"""
Generate a list of three made-up book titles along \ 
with their authors and genres. 
Provide them in JSON format with the following keys: 
book_id, title, author, genre.
"""

这段代码使用了多行字符串构建了一个提示字符串prompt,内容如下:

Generate a list of three made-up book titles along 
with their authors and genres. 
Provide them in JSON format with the following keys: 
book_id, title, author, genre.

具体来说,这个提示的意思是:

  • 生成三个虚构的书名。
  • 提供每本书的作者和体裁。
  • 以JSON格式提供这些信息,并包含以下键:book_id, title, author, genre。
response = get_completion(prompt)

这行代码调用了前面定义的get_completion函数,传入构建的prompt作为参数。该函数使用OpenAI的API生成对提示的响应。

print(response)

这行代码将API的响应打印出来。模型生成的响应将是一个包含三个虚构书籍信息的JSON格式字符串。 总结起来,这段代码的作用是:

  1. 构建一个提示,要求模型生成三本虚构书籍的标题、作者和体裁。
  2. 使用OpenAI的模型生成响应,并以JSON格式提供这些信息。
  3. 打印生成的响应。

然后我们运行代码 image.png
很显然,我们运行成功了,同样确实实现了相应功能
如果我们想要进行对应格式化输出其他的内容我们还可以这样进行,比如下列代码:

text_1 = f"""
Making a cup of tea is easy! First, you need to get some \ 
water boiling. While that's happening, \ 
grab a cup and put a tea bag in it. Once the water is \ 
hot enough, just pour it over the tea bag. \ 
Let it sit for a bit so the tea can steep. After a \ 
few minutes, take out the tea bag. If you \ 
like, you can add some sugar or milk to taste. \ 
And that's it! You've got yourself a delicious \ 
cup of tea to enjoy.
"""
prompt = f"""
You will be provided with text delimited by triple quotes. 
If it contains a sequence of instructions, \ 
re-write those instructions in the following format:

Step 1 - ...
Step 2 - …
…
Step N - …

If the text does not contain a sequence of instructions, \ 
then simply write \"No steps provided.\"

\"\"\"{text_1}\"\"\"
"""
response = get_completion(prompt)
print("Completion for Text 1:")
print(response)

这段代码的目的是处理一段文本,并将其中的指令按步骤格式化

text_1 = f"""
Making a cup of tea is easy! First, you need to get some \ 
water boiling. While that's happening, \ 
grab a cup and put a tea bag in it. Once the water is \ 
hot enough, just pour it over the tea bag. \ 
Let it sit for a bit so the tea can steep. After a \ 
few minutes, take out the tea bag. If you \ 
like, you can add some sugar or milk to taste. \ 
And that's it! You've got yourself a delicious \ 
cup of tea to enjoy.
"""

这段代码定义了一个包含多行文本的字符串text_1,描述了制作一杯茶的步骤。文本中包含了一些换行符\以保持代码格式的整洁。

prompt = f"""
You will be provided with text delimited by triple quotes. 
If it contains a sequence of instructions, \ 
re-write those instructions in the following format:

Step 1 - ...
Step 2 - …
…
Step N - …

If the text does not contain a sequence of instructions, \ 
then simply write "No steps provided."

\"\"\"{text_1}\"\"\"
"""

这段代码构建了一个新的提示字符串prompt,其内容如下:

You will be provided with text delimited by triple quotes. 
If it contains a sequence of instructions, 
re-write those instructions in the following format:

Step 1 - ...
Step 2 - …
…
Step N - …

If the text does not contain a sequence of instructions, 
then simply write "No steps provided."

"""Making a cup of tea is easy! First, you need to get some water boiling. While that's happening, grab a cup and put a tea bag in it. Once the water is hot enough, just pour it over the tea bag. Let it sit for a bit so the tea can steep. After a few minutes, take out the tea bag. If you like, you can add some sugar or milk to taste. And that's it! You've got yourself a delicious cup of tea to enjoy."""

这个提示要求模型将包含在三重引号中的文本重新格式化为分步骤的指令格式。如果文本不包含指令,则输出“No steps provided.”

response = get_completion(prompt)

这行代码调用了前面定义的get_completion函数,传入构建的prompt作为参数。该函数使用OpenAI的API生成对提示的响应。

print("Completion for Text 1:")
print(response)

这两行代码打印出模型生成的响应。具体来说,将显示模型如何将给定的制作茶的步骤重新格式化为分步骤的形式。
总结起来,这段代码的作用是:

  1. 定义一段描述如何制作茶的文本。
  2. 构建一个提示,要求模型将文本中的指令重新格式化为分步骤的形式。
  3. 使用OpenAI的模型生成响应并打印输出。

然后我们运行代码
image.png
这个就是输出内容
后面我们就开始介绍对应代码了,因为后面几乎都是相同概念

text_2 = f"""
The sun is shining brightly today, and the birds are \
singing. It's a beautiful day to go for a \ 
walk in the park. The flowers are blooming, and the \ 
trees are swaying gently in the breeze. People \ 
are out and about, enjoying the lovely weather. \ 
Some are having picnics, while others are playing \ 
games or simply relaxing on the grass. It's a \ 
perfect day to spend time outdoors and appreciate the \ 
beauty of nature.
"""
prompt = f"""
You will be provided with text delimited by triple quotes. 
If it contains a sequence of instructions, \ 
re-write those instructions in the following format:

Step 1 - ...
Step 2 - …
…
Step N - …

If the text does not contain a sequence of instructions, \ 
then simply write \"No steps provided.\"

\"\"\"{text_2}\"\"\"
"""
response = get_completion(prompt)
print("Completion for Text 2:")
print(response)

这段代码定义了一个新的文本,并要求模型判断该文本是否包含指令。如果包含指令,将其重新格式化为步骤形式;如果不包含指令,则输出“No steps provided”。

text_2 = f"""
The sun is shining brightly today, and the birds are \
singing. It's a beautiful day to go for a \ 
walk in the park. The flowers are blooming, and the \ 
trees are swaying gently in the breeze. People \ 
are out and about, enjoying the lovely weather. \ 
Some are having picnics, while others are playing \ 
games or simply relaxing on the grass. It's a \ 
perfect day to spend time outdoors and appreciate the \ 
beauty of nature.
"""

这段代码定义了一个包含多行文本的字符串text_2,描述了一个美好的户外场景。文本中使用了换行符\以保持代码格式的整洁。

prompt = f"""
You will be provided with text delimited by triple quotes. 
If it contains a sequence of instructions, \ 
re-write those instructions in the following format:

Step 1 - ...
Step 2 - …
…
Step N - …

If the text does not contain a sequence of instructions, \ 
then simply write "No steps provided."

\"\"\"{text_2}\"\"\"
"""

这段代码构建了一个新的提示字符串prompt,其内容如下:

You will be provided with text delimited by triple quotes. 
If it contains a sequence of instructions, 
re-write those instructions in the following format:

Step 1 - ...
Step 2 - …
…
Step N - …

If the text does not contain a sequence of instructions, 
then simply write "No steps provided."

"""The sun is shining brightly today, and the birds are singing. It's a beautiful day to go for a walk in the park. The flowers are blooming, and the trees are swaying gently in the breeze. People are out and about, enjoying the lovely weather. Some are having picnics, while others are playing games or simply relaxing on the grass. It's a perfect day to spend time outdoors and appreciate the beauty of nature."""

这个提示要求模型将包含在三重引号中的文本重新格式化为分步骤的指令格式。如果文本不包含指令,则输出“No steps provided.”

response = get_completion(prompt)

这行代码调用了前面定义的get_completion函数,传入构建的prompt作为参数。该函数使用OpenAI的API生成对提示的响应。

print("Completion for Text 2:")
print(response)

这两行代码打印出模型生成的响应。具体来说,将显示模型判断文本是否包含指令,并根据判断结果输出相应内容。
总结起来,这段代码的作用是:

  1. 定义一段描述户外美好场景的文本。
  2. 构建一个提示,要求模型判断文本是否包含指令,并根据判断结果重新格式化或输出“No steps provided.”
  3. 使用OpenAI的模型生成响应并打印输出。

运行后,我们会发现text2是一段描写美好的风景,并没有指令所以很显然这个就是No steps provided.
image.png
先发布一下吧!!! 然后过段时间再更新

2024年6月6日更新

昨天写到十点要睡觉了,今天接着写,吃了个中饭,继续开始学习
首先我们会看到下面的代码是一个有关于对话的自动生成代码,具体的内容我放在了下面,代码的解析和上述的代码是几乎一样的

prompt = f"""
Your task is to answer in a consistent style.

<child>: Teach me about patience.

<grandparent>: The river that carves the deepest \ 
valley flows from a modest spring; the \ 
grandest symphony originates from a single note; \ 
the most intricate tapestry begins with a solitary thread.

<child>: Teach me about resilience.
"""
response = get_completion(prompt)
print(response)

这个是对应结果 image.png

原理2:给机器思考时间

实例一:

text = f"""
In a charming village, siblings Jack and Jill set out on \ 
a quest to fetch water from a hilltop \ 
well. As they climbed, singing joyfully, misfortune \ 
struck—Jack tripped on a stone and tumbled \ 
down the hill, with Jill following suit. \ 
Though slightly battered, the pair returned home to \ 
comforting embraces. Despite the mishap, \ 
their adventurous spirits remained undimmed, and they \ 
continued exploring with delight.
"""
# example 1
prompt_1 = f"""
Perform the following actions: 
1 - Summarize the following text delimited by triple \
backticks with 1 sentence.
2 - Translate the summary into French.
3 - List each name in the French summary.
4 - Output a json object that contains the following \
keys: french_summary, num_names.

Separate your answers with line breaks.

Text:
```{text}```
"""
response = get_completion(prompt_1)
print("Completion for prompt 1:")
print(response)

这里是对给定的文本进行一系列处理,包括总结、翻译和提取信息,然后以JSON格式输出结果。

text = f"""
In a charming village, siblings Jack and Jill set out on \ 
a quest to fetch water from a hilltop \ 
well. As they climbed, singing joyfully, misfortune \ 
struck—Jack tripped on a stone and tumbled \ 
down the hill, with Jill following suit. \ 
Though slightly battered, the pair returned home to \ 
comforting embraces. Despite the mishap, \ 
their adventurous spirits remained undimmed, and they \ 
continued exploring with delight.
"""

这段代码定义了一个包含多行文本的字符串text,描述了杰克和吉尔去取水的故事

prompt_1 = f"""
Perform the following actions: 
1 - Summarize the following text delimited by triple \
backticks with 1 sentence.
2 - Translate the summary into French.
3 - List each name in the French summary.
4 - Output a json object that contains the following \
keys: french_summary, num_names.

Separate your answers with line breaks.

Text:
```{text}```
"""

这段代码构建了一个新的提示字符串prompt_1,其内容如下:

Perform the following actions: 
1 - Summarize the following text delimited by triple backticks with 1 sentence.
2 - Translate the summary into French.
3 - List each name in the French summary.
4 - Output a json object that contains the following keys: french_summary, num_names.

Separate your answers with line breaks.

Text:
```In a charming village, siblings Jack and Jill set out on a quest to fetch water from a hilltop well. As they climbed, singing joyfully, misfortune struck—Jack tripped on a stone and tumbled down the hill, with Jill following suit. Though slightly battered, the pair returned home to comforting embraces. Despite the mishap, their adventurous spirits remained undimmed, and they continued exploring with delight.```

这个提示要求模型对包含在三重引号中的文本执行以下操作:

  1. 用一句话总结该文本。
  2. 将总结翻译成法语。
  3. 列出法语总结中的每个名字。
  4. 输出一个包含french_summary和num_names键的JSON对象。

要求每个答案用换行符分隔。

response = get_completion(prompt_1)

这行代码调用了前面定义的get_completion函数,传入构建的prompt_1作为参数。该函数使用OpenAI的API生成对提示的响应。

print("Completion for prompt 1:")
print(response)

这两行代码打印出模型生成的响应。具体来说,将显示模型按步骤处理后的结果。

总结起来,这段代码的作用是:

  1. 定义一段描述杰克和吉尔去取水的故事文本。
  2. 构建一个提示,要求模型总结文本、翻译总结、提取名字,并以JSON格式输出。
  3. 使用OpenAI的模型生成响应并打印输出。

image.png
在这里,我们没有看到明显的机器思考的过程,但是我们可以发现在这里我们确实可以通过指令的方式让机器有条不紊的按照要求进行输出,这种方法有助于提高模型输出的质量和准确性

实例二:
我们给出一个很有意思的问题

prompt = f"""
Determine if the student's solution is correct or not.

Question:
I'm building a solar power installation and I need \
 help working out the financials. 
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost \ 
me a flat $100k per year, and an additional $10 / square \
foot
What is the total cost for the first year of operations 
as a function of the number of square feet.

Student's Solution:
Let x be the size of the installation in square feet.
Costs:
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x
Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000
"""
response = get_completion(prompt)
print(response)

我丢,数学题,我们在写数学题的时候需要动脑筋,同样的,我们的模型也需要进行思考,这个是很重要的事情,证明了我们训练模型时同样需要让机器具有人的思维方式
让我们看看这些是什么意思吧
这里在检查一个学生的解决方案是否正确,具体是针对一个太阳能发电站的财务计算问题。
定义提示字符串

prompt = f"""
Determine if the student's solution is correct or not.

Question:
I'm building a solar power installation and I need \
 help working out the financials. 
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost \ 
me a flat $100k per year, and an additional $10 / square \
foot
What is the total cost for the first year of operations 
as a function of the number of square feet.

Student's Solution:
Let x be the size of the installation in square feet.
Costs:
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 10x
Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000
"""

这段代码构建了一个提示字符串prompt,其内容如下:

Determine if the student's solution is correct or not.

Question:
I'm building a solar power installation and I need help working out the financials. 
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot
What is the total cost for the first year of operations as a function of the number of square feet.

Student's Solution:
Let x be the size of the installation in square feet.
Costs:
1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 10x
Total cost: 100x + 250x + 100,000 + 10x = 360x + 100,000

这个提示要求模型判断学生的解决方案是否正确。问题描述了构建一个太阳能发电站的费用计算,包括土地成本、太阳能板成本和维护成本。学生的解决方案列出了每项成本并给出了总成本的计算公式。

调用函数生成响应

response = get_completion(prompt)

这行代码调用了前面定义的get_completion函数,传入构建的prompt作为参数。该函数使用OpenAI的API生成对提示的响应。

打印结果

print(response)

这行代码打印出模型生成的响应。具体来说,将显示模型判断学生解决方案的结果。

分析学生的解决方案 学生的解决方案如下:

  • 土地成本:100x
  • 太阳能板成本:250x
  • 维护成本:100000 + 10x
  • 总成本:100x + 250x + 100000 + 10x = 360x + 100000

根据问题描述,学生的解决方案看起来是正确的,因为所有成本都被正确计算并总和在一起。模型会检查这些计算并确认是否正确。 总结
这段代码的作用是:

  1. 构建一个提示,要求模型检查并确认一个学生解决方案的正确性。
  2. 使用OpenAI的模型生成响应并打印输出。
  3. 通过打印输出,确认学生对太阳能发电站费用的计算是否正确。

然后我们看到模型给我们的回答是

image.png
这里是不是就恍然大明白了
同样的,我们可以让机器模型充当导师的作用,我们可以给学生写上评价

菜鸟第一节总结如下:

我们的大模型在回答相应问题时,必然的会出现很多错误,这些我们称之为幻觉(Hallucinations),这个是正常现象,我们需要去优化和反馈,不断的训练模型,在后面有一些作业,作为大菜菜会及时写完验收学习成果!!!
希望各位看到这篇文章会有所收获,你们的支持是我前进的动力!!!

三大主流交易接口实战指南:XTP、CTP与数字货币API的实盘接入解析 本文深入解析了量化交易系统实现实盘交易的关键环节,聚焦于三大主流交易接口的实战接入。详细介绍了证券领域的XTP、期货领域的CTP以及数字货币交易所API的核心特性、代码封装要点与风控实践,并提供了多市场接口整合的统一架构方案,为开发者打通量化交易的“最后一公里”提供了一份接地气的实战指南。 阅读详情

相关推荐

环境配置 |Jupyter lab/Jupyter Notebook 安装与设置

ipynb使用Jupyterlab/Jupyter Notebook 来编写程序时的文件,在使用时,可以现转换为标准的.py的python文件。

weixin_44649780的博客 5774

菜鸟教程:从0开始离线部署私有大模型

大模型的使用必将包含以下三个阶段:1. 直接使用,用于提效2. 使用 API 定制应用程序3. 离线部署+微调,实现私有数据模型化第一个阶段已经完成,作为技术者应该关注第二、三阶段。1. 环境安装和配置我们以清华大学开源的 ChatGLM-6B 语言模型为例。ChatGLM-6B 是一个开源的、支持中英双语的对话语言模型,基于 General Language Model (GLM) 架构,具有 62 亿参数。结合模型量化技术,用户可以在消费级的显卡上进行本地部署。

weixin_59191169的博客 3432

RK3566添加ffpeg【Buildroot系统】

有很多人都发现了RK3566系列的芯片是不可以直接使用ffmpeg官网源码的!会报错: Not a video capture device. /dev/video0: No such device 接下来我们就来解决这个问题!!

honmy18的博客 4070

从菜鸟到上手:程序员入门LLM的超简单指南

近年来,大型语言模型(LLM)在自然语言处理领域取得了显著的进展,成为了人工智能领域的热点话题。对于初学者来说,学习LLM可能会感到有些困难。大型语言模型是一种基于深度学习的人工智能模型,它们通过海量文本数据训练而成,能够理解、生成人类语言,甚至进行创造性的表达。GPT系列(如GPT-3、GPT-4)和ChatGPT就是目前最为人熟知的代表。

2401_85325519的博客 2363

Vben Admin权限管理全解析:从动态菜单到按钮级控制(附代码示例)

本文全面解析Vben Admin框架的权限管理系统,从动态菜单生成到按钮级细粒度控制,提供完整的实现方案和代码示例。深入探讨基于角色-权限模型的架构设计,分享前后端协作的最佳实践,帮助开发者快速构建安全高效的企业级后台系统。

weixin_30919429的博客 487

别再手动抓波形了!用Synopsys AXI VIP的Port Monitor自动收集事务数据(附完整连接Scoreboard代码)

当标准Port Monitor无法满足需求时,Synopsys提供的callback机制就像一套精密的手术工具,允许你深入VIP内部进行定制化改造。创建自定义监控点的四步法继承基类// 其他自定义字段...endclass重写目标phase方法// 克隆事务并发送到自定义端口在env中注册callbackcustom_cb);连接自定义端口到分析组件经典应用场景地址phase特定检查数据beat级监控自定义性能统计异常注入检测。

weixin_28716181的博客 397

大模型入门指南

通俗来讲,大模型就是输入大量语料,来让计算机获得类似人类的“思考”能力,使之能够理解自然语言,能够进行『文本生成』、『推理问答』、『对话』、『文档摘要』等工作。

kaka0722ww的博客 1863

基于深度学习的茶叶等级检测识别系统:YOLOv8 + UI界面 + 数据集完整实现

随着深度学习技术的不断进步,基于计算机视觉的茶叶等级检测系统可以大大提高检测效率,提供客观一致的评估标准。本系统将利用YOLOv8进行茶叶等级的检测与识别,通过图形用户界面(UI)实现与用户的交互,提供茶叶等级分类的实时反馈。本文将详细介绍如何使用YOLOv8结合UI界面,建立一个完整的茶叶等级检测与识别系统,包括数据集的准备、模型的训练、UI的设计及完整的代码实现。本系统的目标是通过深度学习技术,结合YOLOv8模型和图形用户界面(UI),实现对茶叶等级的自动化检测与识别。

YOLO 972

大模型训练全流程实战指南工具篇(十)—— 小白也能懂的大模型训练参数万字详解

本文系统讲解了大模型训练的三种核心方法及其适用场景:全参数训练适用于高质量大数据但资源消耗大;LoRA训练通过轻量适配器实现高效微调,适合中小企业和个人开发者;QLoRA进一步降低显存需求,是极限性价比之选。文章重点解析了LLaMA Factory工具中LoRA训练的关键配置参数,包括模型路径、数据格式、训练参数等,帮助读者从"流程可运行"进阶到"训练稳定、效果可控"。通过通俗易懂的比喻和实战经验分享,本文为大模型训练入门者提供了从理论到实践的完整指导。

weixin_42782643的博客 566

玩转Docker小游戏项目系列:Docker部署魔塔网页经典小游戏

玩转Docker小游戏项目系列:Docker部署魔塔网页经典小游戏

jks212454的博客 1063

JAVA:Spring Boot3 集成 Spring AI 实现 Skill 开发

本文介绍了如何通过Spring Boot和Spring AI实现大模型技能(Skill)开发,让AI具备调用业务系统能力。文章首先解释了Skill的概念,即AI可调用的业务能力,如查询订单、天气等,并展示了执行流程和整体架构。然后详细介绍了实践样例,包括技术版本、Maven依赖配置、AI服务设置、ChatClient创建和Skill技能注册中心的实现。注册中心提供了技能的注册、查询、启用/禁用等功能,支持按类别管理技能,并能够获取所有可用技能列表。通过这种方式,开发者可以轻松为大模型扩展业务功能调用能力。

木头 624

大模型入门指南(非常详细)零基础入门到精通,收藏这一篇就够了

通俗来讲,大模型就是输入大量语料,来让计算机获得类似人类的“思考”能力,使之能够理解自然语言,能够进行『文本生成』、『推理问答』、『对话』、『文档摘要』等工作。既然是学习,那我们就可以用『上学参加工作』这件事来类比大模型的训练、使用过程:找学校 :: 训练 LLM 需要大量的计算,因此 GPU 更合适,因此只有购买得起大量 GPU 的贵族学校才有资本训练自己的大模型确定教材 :: 大模型顾名思义就是大,需要的数据量特别多,几千亿序列(Token)的输入基本是标配。

Python_0011的博客 1797

ESP32-C3入门教程 蓝牙篇①——基于Blufi 的 WiFi 智能配网

文章目录一、前言二、WiFi配网方式三、快速运行四、运行效果五、ESP32-C3程序流程5.1 主程序5.2 回调函数5.3 SmartConfig线程5.4 流程图六、关键函数6.1 设置SmartConfig的协议类型6.2 启动SmartConfig6.3 停止SmartConfig七、其他八、参考 一、前言 本文基于VS Code IDE进行编程、编译、下载、运行等操作 基础知识点请查阅:ESP32-C3入门教程 基础篇①——基于VS Code构建Hello World 二、WiFi配网方式 W

7766

LLM大模型学习之菜鸟的进阶道路(二)---工程迭代

这一章还是比较基础的调用api,有些朋友建议直接搞构造大模型,很显然这是很不科学的,我们先从基础学习,大模型本来就是很晦涩难懂的东西,并且知识体系十分庞大,所以我们慢慢学习才是最重要的事情!

pythonhy的博客 1239

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

想转岗AI大模型?看这篇就够了!

作为最近非常火爆的AI领域,引起了很多同学的兴趣,AI相关岗位的收入也比较可观。但同时,AI入门又有一定的门槛。那么,有哪些岗位是比较适合的呢?

huang9604的博客 1239

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

2024年学习LLM的7大步骤,让你少走弯路

人工智能(AI)已经深刻影响我们的生活和工作,作为一名有抱负的AI工程师,你可能正在考虑如何高效地学习AI知识,并在这个飞速发展的领域占得一席之地。

2401_85325726的博客 1186

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

2024年学习LLM的7大步骤,让你少走弯路!!

人工智能(AI)已经深刻影响我们的生活和工作,作为一名有抱负的AI工程师,你可能正在考虑如何高效地学习AI知识,并在这个飞速发展的领域占得一席之地。

2401_85373691的博客 1168

2025年学习LLM的7大步骤,让你少走99%弯路!!

人工智能(AI)已经深刻影响我们的生活和工作,作为一名有抱负的AI工程师,你可能正在考虑如何高效地学习AI知识,并在这个飞速发展的领域占得一席之地。 以下是我基于个人经验的七大步骤建议:

2401_85325726的博客 1161

AI大模型在物流行业应用前景分析_大数据模型和物流业

物流行业使用AI大模型的原因多种多样。首先,物流业因其环节众多、需求多样性、数据复杂和场景丰富等特征,被视为大模型落地应用的一大极具潜力的重要领域。专家指出,大模型加入物流企业独有的场景数据,能够快速生成专属模型。这种细分深耕为产业大模型的落地提供了差异化的数据优势与能力优势。通过使用AI大模型,物流公司可以更好地应对复杂的运营挑战,并实现更高效、更可靠的物流服务。此外,大模型技术的深度应用预期将为数字货运全链路运营效率、服务体验和业务创新带来巨大变革。

2401_85378759的博客 1936

人工智能界的“黑话“大揭秘:AI新词汇速成指南

AI圈的高频词汇,下次听到有人讨论"用RAG增强Agent的能力"或"通过Fine-tuning改进Chain-of-Thought",你就能点头表示理解,而不是一脸问号了。记住,这个领域日新月异,可能你刚学会这些词,明天又有新概念冒出来。但掌握了这些基础,你至少能跟上80%的AI讨论了!AI的世界就像一场永无止境的"黑话派对",而你,已经拿到了入场券。下次再有朋友问你"什么是RAG",你可以神秘地微笑:“哦,那只是AI的’开卷考试’模式而已。

weixin_42657666的博客 1416

三位3D视觉从业者的2025年终总结!

答案或许因人而异,而我的答案是:持续学习的能力、解决问题的实力,以及洞察本质的眼光。在那里的一些时光,也曾参与了一些较有挑战的项目,也学到了很多,从琢磨算法方案、跟外部团队对接,到反复调试、推动落地,经历了一个还算比较完整的循环。Beyond coding,在软实力方面同样不可忽视,项目中的对接交流、留痕、汇报、纪要等环节,同样是保证项目顺利推进的关键,也是自身KPI的保障。2025年的最后一天了,总觉得该写点什么,给过去的一年画个简单的句号,也愿新的一年2026,愿新年胜旧年。求道之人,不问寒暑。

3D视觉工坊 444

【前端发展路径】技术成长路径、职业方向分支、行业趋势与建议、学习资源推荐

前端开发是一个快速发展的领域,技术栈和职业路径也在不断演进。,无论选择哪个方向,保持好奇心和对技术的热情是关键。随着经验的积累,可以逐步找到适合自己的细分领域,成为不可替代的开发者。前端开发的核心价值在于。

qq_45974648的博客 1391

Python与AI学习全路径:从零基础到项目实战的系统指南

Python作为一门语法简洁、生态丰富的高级编程语言,因其在数据处理和科学计算领域的强大库支持,成为进入人工智能领域的首选工具。其核心原理在于通过易读的语法和模块化设计,降低编程门槛,同时借助NumPy、Pandas等库实现高效的数据操作,为机器学习模型提供数据基础。在技术价值上,Python与AI的结合让开发者能够快速构建和部署智能应用,从自动化脚本到复杂的预测模型。应用场景广泛覆盖数据分析、机器学习模型训练以及当前热门的AI大模型调用与微调。本文聚焦于为初学者梳理一条清晰的Python+AI学习路径,涵

weixin_33739627的博客 448

Elastic:开发者上手指南

你们好,我是Elastic的刘晓国。如果大家想开始学习Elastic的话,那么这里将是你理想的学习园地。在我的博客几乎涵盖了你想学习的许多方面。在这里,我来讲述一下作为一个菜鸟该如何阅读我的这些博客文章。 我们可以按照如下的步骤来学习: 1)Elasticsearch简介:对Elasticsearch做了一个简单的介绍 2)Elasticsearch中的一些重要概念:cluster,n..........................................................

Elastic 中国社区官方博客 17万+

从 WAIC 2026 打开人工智能:一部正在发生的科技史诗

2026年7月17日到20日,上海世博展览馆。1100多家企业、3000多项展品、300多款全球首发——第九届世界人工智能大会(WAIC 2026)又一次把全球AI圈的目光拉到了黄浦江畔。但这次不一样:机器人不再只是在玻璃柜里挥挥手,而是真的在展馆里走楼梯、搬箱子、给你倒咖啡。AI也不再只是聊天机器人,而是能自己规划任务、调用工具、给你交活的"数字员工"。本文以WAIC 2026为窗口,倒带70年,聊聊AI是怎么从一群人的异想天开,变成改变世界的力量的。

weixin_72753562的博客 354
上一篇: OpenAI的函数调用经验:大模型技术突破与应用实例
下一篇: LLM大模型学习之菜鸟的进阶道路(二)---工程迭代
Llama-Turbo
博客等级 码龄4年 9901粉丝 2024原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值