LLM-Llama在 MAC M1上体验Llama.cpp和通义千问Qwen 1.5-7B

Llama.cpp的主要目标是在各种硬件上(本地和云端)实现LLM推断,同时保持最小的设置和最先进的性能。

  • 纯C/C++实现,没有任何依赖关系
  • Apple芯片是一级的支持对象 - 通过ARM NEON、Accelerate和Metal框架进行优化
  • 对x86架构的AVX、AVX2和AVX512支持
  • 支持1.5位、2位、3位、4位、5位、6位和8位整数量化,以加快推断速度并减少内存使用
  • 为在NVIDIA GPU上运行LLMs而定制的CUDA内核(通过HIP支持AMD GPU)
  • Vulkan、SYCL和(部分)OpenCL后端支持
  • CPU+GPU混合推断,部分加速超过总VRAM容量的模型

而M1 上有GPU 芯片,因此让我们在 MAC M1 上运行大语言模型成为可能。

1. 下载

  1. 下载 llama.cpp
bash
复制代码
> git clone https://github.com/ggerganov/llama.cpp.git 
正克隆到 'llama.cpp'...
remote: Enumerating objects: 21605, done.
remote: Counting objects: 100% (6924/6924), done.
remote: Compressing objects: 100% (293/293), done.
remote: Total 21605 (delta 6761), reused 6711 (delta 6629), pack-reused 14681
接收对象中: 100% (21605/21605), 26.16 MiB | 3.31 MiB/s, 完成.
处理 delta 中: 100% (15230/15230), 完成.
  1. 下载通义千问1.5-7B模型
  • 安装git-lfs
复制代码
brew install git-lfs
  • 访问 hugging face 上 qwen 1.5 模型

这里我们使用 qwen 1.5 7B 的 chat 模型 huggingface.co/Qwen/Qwen1.…

bash
复制代码
git clone https://huggingface.co/Qwen/Qwen1.5-7B-Chat

如果你git下载不了 huggingface,也可以考虑浏览器下载文件放到该目录中。据了解chat模型和base模型区别是base模型只能续写,而cgat模型是在后面加了一些对话数据训练的,从而能够回复问题。下载好之后,目录如下

diff
复制代码
drwxr-xr-x  17 evilkylin  staff         544  4  3 11:21 .
drwxr-xr-x  10 evilkylin  staff         320  4  3 11:21 ..
drwxr-xr-x  12 evilkylin  staff         384  4  3 09:46 .git
-rw-r--r--   1 evilkylin  staff        1519  4  3 09:46 .gitattributes
-rw-r--r--   1 evilkylin  staff        6896  4  3 09:46 LICENSE
-rw-r--r--   1 evilkylin  staff        4338  4  3 09:46 README.md
-rw-r--r--   1 evilkylin  staff         663  4  3 09:46 config.json
-rw-r--r--   1 evilkylin  staff         243  4  3 09:46 generation_config.json
-rw-r--r--   1 evilkylin  staff     1671839  4  3 09:46 merges.txt
-rw-r--r--@  1 evilkylin  staff  3988014264  4  3 10:24 model-00001-of-00004.safetensors
-rw-r--r--@  1 evilkylin  staff  3957749080  4  3 10:23 model-00002-of-00004.safetensors
-rw-r--r--@  1 evilkylin  staff  3957749112  4  3 10:20 model-00003-of-00004.safetensors
-rw-r--r--@  1 evilkylin  staff  3539181096  4  3 10:16 model-00004-of-00004.safetensors
-rw-r--r--   1 evilkylin  staff       31696  4  3 09:46 model.safetensors.index.json
-rw-r--r--   1 evilkylin  staff     7028015  4  3 09:46 tokenizer.json
-rw-r--r--   1 evilkylin  staff        1402  4  3 09:46 tokenizer_config.json
-rw-r--r--   1 evilkylin  staff     2776833  4  3 09:46 vocab.json

2. 编译llama.cpp

csharp
复制代码
> cd llama.cpp
> make
I ccache not found. Consider installing it for faster compilation.
I llama.cpp build info: 
I UNAME_S:   Darwin
I UNAME_P:   arm
I UNAME_M:   arm64
.....
cc -I. -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL  -std=c11   -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -pthread -Wunreachable-code-break -Wunreachable-code-return -Wdouble-promotion  -c tests/test-c.c -o tests/test-c.o

3. 安装llama 依赖

markdown
复制代码
> python3 -m pip install -r requirements.txt

因为我是格式化后更新到 MAC OS 14.4 了,所以 python 有点问题。使用 homebrew 安装的 python 现在都安装在/opt/homebrew/bin/ , 这里我们要做两个链接。

shell
复制代码
> ln -s /opt/homebrew/bin/python3.10 /opt/homebrew/bin/python3
> ln -s /opt/homebrew/bin/python /opt/homebrew/bin/python

> ln -sf pip3.10 /opt/homebrew/bin/pip3
> ln -sf pip3.10 /opt/homebrew/bin/pip

如果你使用 conda 也可以考虑建立虚拟环境,接下来安装依赖。

scss
复制代码
> python3 -m pip install -r requirements.txt
Collecting numpy~=1.24.4 (from -r ./requirements/requirements-convert.txt (line 1))
  Downloading numpy-1.24.4-cp310-cp310-macosx_11_0_arm64.whl.metadata (5.6 kB)
...
Successfully installed MarkupSafe-2.1.5 certifi-2024.2.2 charset-normalizer-3.3.2 einops-0.7.0 filelock-3.13.3 fsspec-2024.3.1 gguf-0.6.0 huggingface-hub-0.22.2 idna-3.6 jinja2-3.1.3 mpmath-1.3.0 networkx-3.2.1 numpy-1.24.4 packaging-24.0 protobuf-4.25.3 pyyaml-6.0.1 regex-2023.12.25 requests-2.31.0 safetensors-0.4.2 sentencepiece-0.1.99 sympy-1.12 tokenizers-0.15.2 torch-2.1.2 tqdm-4.66.2 transformers-4.39.3 typing-extensions-4.10.0 urllib3-2.2.1

4. 转换 Qwen 模型为 GGUF

什么是 GGUF? GGUF是一种用于存储用于GGML推断和基于GGML的执行器的模型的文件格式。GGUF是一种二进制格式,旨在快速加载和保存模型,并易于阅读。传统上,模型是使用PyTorch或其他框架开发的,然后转换为GGUF以在GGML中使用。

GGUF是GGML、GGMF和GGJT的后继文件格式,旨在通过包含加载模型所需的所有信息来消除歧义。它还设计为可扩展的,因此可以向模型添加新信息而不会破坏兼容性,更多信息访问官方说明文档。

Llama.cpp上是使用 convert.py, 但有人说 qwen 得用 convert-hf-to-gguf.py。

注意:有同学在这里报错找不到文件之类的,注意执行该命令的时候python3 convert-hf-to-gguf.py ~/Projects/Qwen1.5-7B-Chat/ 后面的路径要改为你之前在第1.2节中下载Qwen1.5-7B-Chat的目录。

ini
复制代码
> python3 convert-hf-to-gguf.py ~/Projects/Qwen1.5-7B-Chat/
Loading model: Qwen1.5-7B-Chat
gguf: This GGUF file is for Little Endian only
Set model parameters
gguf: context length = 32768
gguf: embedding length = 4096
gguf: feed forward length = 11008
gguf: head count = 32
gguf: key-value head count = 32
gguf: rope theta = 1000000.0
gguf: rms norm epsilon = 1e-06
gguf: file type = 1
Set model tokenizer
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained
....
output_norm.weight, n_dims = 1, torch.bfloat16 --> float32
Model successfully exported to '/Users/xxxx/Projects/Qwen1.5-7B-Chat/ggml-model-f16.gguf'

可以看到他已经转为 F16 的 gguf 格式的模型了。

5. 量化模型

vbnet
复制代码
> ./quantize ~/Projects/Qwen1.5-7B-Chat/ggml-model-f16.gguf ./models/qwen1.5-chat-ggml-model-Q4_K_M.gguf Q4_K_M
main: build = 2585 (f87f7b89)
main: built with Apple clang version 15.0.0 (clang-1500.3.9.4) for arm64-apple-darwin23.4.0
main: quantizing '/Users/evilkylin/Projects/Qwen1.5-7B-Chat/ggml-model-f16.gguf' to './models/qwen1.5-chat-ggml-model-Q4_K_M.gguf' as Q4_K_M
llama_model_loader: loaded meta data with 19 key-value pairs and 387 tensors from /Users/evilkylin/Projects/Qwen1.5-7B-Chat/ggml-model-f16.gguf (version GGUF V3 (latest))
....
llama_model_quantize_internal: model size  = 14728.52 MB
llama_model_quantize_internal: quant size  =  4540.59 MB

main: quantize time = 72620.01 ms
main:    total time = 72620.01 ms

我们将gguf 的模型量化到INT4,这样模型会从大约 14.7G减少到 4.4GB 左右。

6. 运行测试

sql
复制代码
> ./main -m ./models/mymodels/qwen1.5-chat-ggml-model-Q4_K_M.gguf -n 128
Log start
main: build = 2585 (f87f7b89)
main: built with Apple clang version 15.0.0 (clang-1500.3.9.4) for arm64-apple-darwin23.4.0
main: seed  = 1712117398
llama_model_loader: loaded meta data with 20 key-value pairs and 387 tensors from ./models/mymodels/qwen1.5-chat-ggml-model-Q4_K_M.gguf (version GGUF V3 (latest))
....
压力容器的定期检查(包括外部检查、内部检查和全面检查)分为每()年1次和每3~6年1次两种。
A. 1
B. 2
C. 3
D. 5 答案:D微量元素在生物体内虽少,但对生物体的生命活动起着非常重要的作用,下列选项中都属于微量元素的是(  ) A. 钙、铁、锌 B. 钾、镁、氟 C. 锌、硒、碘 D. 碳、氢、氧

钙、钾、
llama_print_timings:        load time =    8845.23 ms
llama_print_timings:      sample time =      31.94 ms /   128 runs   (    0.25 ms per token,  4007.51 tokens per second)
llama_print_timings: prompt eval time =       0.00 ms /     1 tokens (    0.00 ms per token,      inf tokens per second)
llama_print_timings:        eval time =   10612.83 ms /   128 runs   (   82.91 ms per token,    12.06 tokens per second)
llama_print_timings:       total time =   10899.90 ms /   129 tokens
ggml_metal_free: deallocating
Log end

看起来是自动化跑了个测试, 看输出显示大约 12.06 tokens 每秒,也就是说应该每秒至少 12 个字,但由于编码原因有可能字更多。 接下来我们进入对话模型。如何启动呢?我们这里查看example/alpaca.sh 的启动方式,来编写启动 Qwen 模型命令。

bash
复制代码
#!/bin/bash

#
# Temporary script - will be removed in the future
#

cd `dirname $0`
cd ..

./main -m ./models/alpaca.13b.ggmlv3.q8_0.bin \
       --color \
       -f ./prompts/alpaca.txt \
       --ctx_size 2048 \
       -n -1 \
       -ins -b 256 \
       --top_k 10000 \
       --temp 0.2 \
       --repeat_penalty 1.1 \
       -t 7

那么 qwen 就是这样了,具体的参数可以参看官方说明。实际上 Qwen1.5 的context window 支持大小是32768,官方文档。但我测试将 ctx size 设置为 32768 会跑不了,不知道为啥,还是自己不断尝试修改吧。另外 top k 默认 40,这个参数的意思用来增加随机性的,因为预测下一个token 时候的top k 个选择,一般默认就行。我估计应该和 temp 有关系吧。-t 是说并发线程数,根据自己 cpu 核数设置

vbnet
复制代码
> ./main -m ./models/mymodels/qwen1.5-chat-ggml-model-Q4_K_M.gguf --color --ctx_size 2048 -n -1 -ins -b 256 --top_k 30 --temp 0.2 --repeat_penalty 1.1 -t 7
Log start
main: build = 2585 (f87f7b89)
main: built with Apple clang version 15.0.0 (clang-1500.3.9.4) for arm64-apple-darwin23.4.0
main: seed  = 1712120436
llama_model_loader: loaded meta data with 20 key-value pairs and 387 tensors from ./models/mymodels/qwen1.5-chat-ggml-model-Q4_K_M.gguf (version GGUF V3 (latest))
....
== Running in interactive mode. ==
 - Press Ctrl+C to interject at any time.
 - Press Return to return control to LLaMa.
 - To return control without starting a new line, end your input with '/'.
 - If you want to submit another line, end your input with ''.
You are a helpful assistant.
> 你是谁
我是阿里云研发的大规模语言模型,我叫通义千问。

img

实际测试下来,输出确实很快,一点也不卡。 但是多次重复启动后,会直接退出,据说是 llama.cpp 出问题了,因此重新 make cleanmake就好了。

7. 像OpenAI一样输出

llama.cpp内置了一个c++写的快速,轻量级的http server,提供 OpenAI API一样的输入输出,还提供一个简单 web 前端来和 llama.cpp 交互。使用以下命令开启http server,测试了一下qwen 1.5 context window 开到 16384 在 m1 上会报内存不足,据了解token数量本身也会占用不少内存,和transformer本身的设计有关,具体原理就不展开了。当前开到 8192个token GPU先存就完全跑满了。

bash
复制代码
./server -m ./models/mymodels/qwen1.5-chat-ggml-model-Q4_K_M.gguf -c 8192 -n -1 -t 7
  • chat completion接口

request

vbnet
复制代码
curl --location 'http://localhost:8080/v1/chat/completions' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "system",
      "content": "you are a helpful assitant"
    },
    {
      "role": "user",
      "content": "写一个笑话"
    }
  ],
  "stream": false
}'

response

swift
复制代码
{
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": " Why did the tomato turn red?\n\nBecause it saw the salad dressing!\n\nI hope that brought a smile to your face. If you have any other questions or need assistance with something, feel free to ask!",
                "role": "assistant"
            }
        }
    ],
    "created": 1713099144,
    "model": "gpt-3.5-turbo",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 47,
        "prompt_tokens": 20,
        "total_tokens": 67
    },
    "id": "chatcmpl-jItjibb9dXIOO0YgrqwZHNxSeBfdBmlR"
}
  • embeddings

要返回 embedings需要在开启 server 的时候加上flag --embeddings

bash
复制代码
./server -m ./models/mymodels/qwen1.5-chat-ggml-model-Q4_K_M.gguf -c 8192 -n -1 -t 7 --embeddings

request

css
复制代码
curl --location 'http://localhost:8080/v1/embeddings' \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "input": "The food was delicious and the waiter...",
    "model": "text-embedding-ada-002",
    "encoding_format": "float"
  }'

response

json
复制代码
{
    "model": "text-embedding-ada-002",
    "object": "list",
    "usage": {
        "prompt_tokens": 0,
        "total_tokens": 0
    },
    "data": [
        {
            "embedding": [
                -0.005755452439188957,
                ....
                0.01070545706897974,
                0.011975807137787342
            ],
            "index": 0,
            "object": "embedding"
        }
    ]
}
  • Tokenize

request

css
复制代码
curl --location 'http://localhost:8080/tokenize' \
--header 'Content-Type: application/json' \
--data '{
    "content": "hello are you ok"
}'

response

yaml
复制代码
{
    "tokens": [
        6312,
        28709,
        460,
        368,
        3614
    ]
}
  • detokenize

request

css
复制代码
curl --location 'http://localhost:8080/detokenize' \
--header 'Content-Type: application/json' \
--data '{
    "tokens": [
        6312,
        28709,
        460,
        368,
        3614
    ]
}'

response

css
复制代码
{
    "content": " hello are you ok"
}

如何系统的去学习大模型LLM ?

作为一名热心肠的互联网老兵,我意识到有很多经验和知识值得分享给大家,也可以通过我们的能力和经验解答大家在人工智能学习中的很多困惑,所以在工作繁忙的情况下还是坚持各种整理和分享。

但苦于知识传播途径有限,很多互联网行业朋友无法获得正确的资料得到学习提升,故此将并将重要的 AI大模型资料 包括AI大模型入门学习思维导图、精品AI大模型学习书籍手册、视频教程、实战学习等录播视频免费分享出来

😝有需要的小伙伴,可以V扫描下方二维码免费领取🆓

在这里插入图片描述

一、全套AGI大模型学习路线

AI大模型时代的学习之旅:从基础到前沿,掌握人工智能的核心技能!

img

二、640套AI大模型报告合集

这套包含640份报告的合集,涵盖了AI大模型的理论研究、技术实现、行业应用等多个方面。无论您是科研人员、工程师,还是对AI大模型感兴趣的爱好者,这套报告合集都将为您提供宝贵的信息和启示。

img

三、AI大模型经典PDF籍

随着人工智能技术的飞速发展,AI大模型已经成为了当今科技领域的一大热点。这些大型预训练模型,如GPT-3、BERT、XLNet等,以其强大的语言理解和生成能力,正在改变我们对人工智能的认识。 那以下这些PDF籍就是非常不错的学习资源。

img

在这里插入图片描述

四、AI大模型商业化落地方案

img

阶段1:AI大模型时代的基础理解

  • 目标:了解AI大模型的基本概念、发展历程和核心原理。
  • 内容
    • L1.1 人工智能简述与大模型起源
    • L1.2 大模型与通用人工智能
    • L1.3 GPT模型的发展历程
    • L1.4 模型工程
      - L1.4.1 知识大模型
      - L1.4.2 生产大模型
      - L1.4.3 模型工程方法论
      - L1.4.4 模型工程实践
    • L1.5 GPT应用案例

阶段2:AI大模型API应用开发工程

  • 目标:掌握AI大模型API的使用和开发,以及相关的编程技能。
  • 内容
    • L2.1 API接口
      - L2.1.1 OpenAI API接口
      - L2.1.2 Python接口接入
      - L2.1.3 BOT工具类框架
      - L2.1.4 代码示例
    • L2.2 Prompt框架
      - L2.2.1 什么是Prompt
      - L2.2.2 Prompt框架应用现状
      - L2.2.3 基于GPTAS的Prompt框架
      - L2.2.4 Prompt框架与Thought
      - L2.2.5 Prompt框架与提示词
    • L2.3 流水线工程
      - L2.3.1 流水线工程的概念
      - L2.3.2 流水线工程的优点
      - L2.3.3 流水线工程的应用
    • L2.4 总结与展望

阶段3:AI大模型应用架构实践

  • 目标:深入理解AI大模型的应用架构,并能够进行私有化部署。
  • 内容
    • L3.1 Agent模型框架
      - L3.1.1 Agent模型框架的设计理念
      - L3.1.2 Agent模型框架的核心组件
      - L3.1.3 Agent模型框架的实现细节
    • L3.2 MetaGPT
      - L3.2.1 MetaGPT的基本概念
      - L3.2.2 MetaGPT的工作原理
      - L3.2.3 MetaGPT的应用场景
    • L3.3 ChatGLM
      - L3.3.1 ChatGLM的特点
      - L3.3.2 ChatGLM的开发环境
      - L3.3.3 ChatGLM的使用示例
    • L3.4 LLAMA
      - L3.4.1 LLAMA的特点
      - L3.4.2 LLAMA的开发环境
      - L3.4.3 LLAMA的使用示例
    • L3.5 其他大模型介绍

阶段4:AI大模型私有化部署

  • 目标:掌握多种AI大模型的私有化部署,包括多模态和特定领域模型。
  • 内容
    • L4.1 模型私有化部署概述
    • L4.2 模型私有化部署的关键技术
    • L4.3 模型私有化部署的实施步骤
    • L4.4 模型私有化部署的应用场景

学习计划:

  • 阶段1:1-2个月,建立AI大模型的基础知识体系。
  • 阶段2:2-3个月,专注于API应用开发能力的提升。
  • 阶段3:3-4个月,深入实践AI大模型的应用架构和私有化部署。
  • 阶段4:4-5个月,专注于高级模型的应用和部署。
这份完整版的大模型 LLM 学习资料已经上传CSDN,朋友们如果需要可以微信扫描下方CSDN官方认证二维码免费领取【保证100%免费

😝有需要的小伙伴,可以Vx扫描下方二维码免费领取🆓

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/641591.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

重学java 43.多线程 多等待多唤醒案例

Fear never builds the future,but hope does. —— 24.5.25 多等待多唤醒问题 在多条线程同时消费同时等待时,会出现问题 BaoZiPu package S77ThreadMoreWait;/*count和flag可以定义成包装类,但要记得给count和flag手动赋值不然对于本案例来说&#xff…

TCN 问题汇总

config 代码 import osemotion ["Valence"]### For preprocessing ### If tagged with "# Check this", then its adjustable, otherwise leave it alone. config {"extract_class_label": 1,"extract_continuous_label": 1,"…

Linux之DMA驱动详解(2)-sun6i-dma.c 驱动为例

一、DMA控制器硬件 1.1 DMA寄存器 DMA控制器 一般都会包含以下寄存器: DMA硬件描述符地址寄存器:存放 DMA描述符 的地址。DMA配置寄存器:配置 DMA 的 burst 、 width 、 传输方向 等属性。DMA使能寄存器:使能 DMA通道DMA中断状…

LLM 大模型学习必知必会系列(十一):大模型自动评估理论和实战以及大模型评估框架详解

LLM 大模型学习必知必会系列(十一):大模型自动评估理论和实战以及大模型评估框架详解 0.前言 大语言模型(LLM)评测是LLM开发和应用中的关键环节。目前评测方法可以分为人工评测和自动评测,其中,自动评测技术相比人工…

暴雨“彩虹”行业大模型加速器平台全新发布

近日,在第七届数字中国建设峰会期间,暴雨信息全新发布“彩虹”行业大模型加速器平台,聚焦于为客户降本增效减负,将海量通用数据与行业特有数据融合,专注于流程工艺的智能化改进,因地制宜深挖业务需求&#…

第二十届文博会沙井艺立方分会场启幕!大咖齐打卡!

2024年5月24日-27日,第二十届中国(深圳)国际文化产业博览交易会沙井艺立方分会场活动将在艺立方非遗(文旅)产业园盛大举办。 本届文博会艺立方分会场活动办展特色鲜明,亮彩纷呈,将以“种下梧桐树…

win10无权禁用任务计划程序中的任务

问题说明 最近被win10的自动频繁更新搞得难受,发誓要彻底禁用这个家伙,于是网上找了教程执行,发现执行到禁用windows update计划任务时,提示: 这特么windows这个辣鸡系统,限制还真多!&#xf…

【Linux】信号>信号产生信号处理信号保存信号详解

主页:醋溜马桶圈-CSDN博客 专栏:Linux_醋溜马桶圈的博客-CSDN博客 gitee:mnxcc (mnxcc) - Gitee.com 目录 1.信号入门 1.1 生活角度的信号 1.2 技术应用角度的信号 1.3 信号概念 1.4 信号处理常见方式概览 2.产生信号 2.1 通过终端按键…

Redis 源码学习记录:集合 (set)

无序集合 Redis 源码版本:Redis-6.0.9,本篇文章无序集合的代码均在 intset.h / intset.c 文件中。 Redis 通常使用字典结构保存用户集合数据,字典键存储集合元素,字典值为空。如果一个集合全是整数,则使用字典国语浪费…

Python爬虫:爬取B站视频(最新、能用且讲解详细)【01】

📚博客主页:knighthood2001 ✨公众号:认知up吧 (目前正在带领大家一起提升认知,感兴趣可以来围观一下) 🎃知识星球:【认知up吧|成长|副业】介绍 ❤️如遇文章付费,可先看…

各位数字和-第13届蓝桥杯选拔赛Python真题精选

[导读]:超平老师的Scratch蓝桥杯真题解读系列在推出之后,受到了广大老师和家长的好评,非常感谢各位的认可和厚爱。作为回馈,超平老师计划推出《Python蓝桥杯真题解析100讲》,这是解读系列的第72讲。 各位数字和&#…

超简单白话文机器学习 - 回归树树剪枝(含算法介绍,公式,源代码实现以及调包实现)

1. 回归树 1.1 算法介绍 大家看到这篇文章时想必已经对树这个概念已经有基础了,如果不是很了解的朋友可以看看笔者的这篇文章: 超简单白话文机器学习-决策树算法全解(含算法介绍,公式,源代码实现以及调包实现&#x…

软件设计师备考笔记(十):网络与信息安全基础知识

文章目录 一、网络概述二、网络互连硬件(一)网络的设备(二)网络的传输介质(三)组建网络 三、网络协议与标准(一)网络的标准与协议(二)TCP/IP协议簇 四、Inter…

大模型再进化,实时互动成为未来核心能力

就在上周,OpenAI 又在 AI 湖面抛下一块大石,激起了千层浪:全新一代旗舰生成模型 GPT-4o 登场了。从现场演示来看,它与人类进行了一轮轮无缝衔接的对话,丝滑得就像真人,不仅响应时间极短,还能识别…

SkyWalking 介绍及部署

1、SkyWalking简介2、SkyWalking的搭建 2.1 部署Elasticsearch2.2 部署SkyWalking-Server2.3 部署SkyWalking-UI3、应用接入 3.1 jar包部署方式3.2 dockerfile方式3.3 DockerFile示例4、SkyWalking UI 界面说明 4.1 仪表盘 4.1.1 APM (1)全局维度&#x…

IDEA中好用的插件

IDEA中好用的插件 CodeGeeXMybatis Smart Code Help ProAlibaba Java Coding Guidelines​(XenoAmess TPM)​通义灵码常用操作 CodeGeeX 官网地址:https://codegeex.cn/ 使用手册:https://zhipu-ai.feishu.cn/wiki/CuvxwUDDqiErQUkFO2Tc4walnZY 安装完…

欣赏倪诗韵青桐断纹古琴很罕见:万中无一。

欣赏倪诗韵青桐断纹古琴很罕见:万中无一。龙池侧签海门倪诗韵制,带收藏证书此琴断纹优美如江面波光粼粼,为流水蛇腹断,是倪老师作品精品中的精品。细心的朋友可以看出倪老师在这张琴上题字非常小心认真。用一个词来形容——万中无…

【Unity2D:Animator】为角色添加动画效果

一、添加Animator组件并创建Animator Controller文件 1. 添加Animator组件: 2. 在Assets-Art文件夹中新建一个名为Animations的文件夹,用来存储所有动画资源 3. 在Animations文件夹中新建一个名为Player的文件夹,再创建一个名为Animators的文…

通过RAG架构LLM应用程序

在之前的博客文章中,我们已经描述了嵌入是如何工作的,以及RAG技术是什么。本节我们我们将使用 LangChain 库以及 RAG 和嵌入技术在 Python 中构建一个简单的 LLM 应用程序。 我们将使用 LangChain 库在 Python 中构建一个简单的 LLM 应用程序。LangChai…

白鹭群优化算法,原理详解,MATLAB代码免费获取

白鹭群优化算法(Egret Swarm Optimization Algorithm,ESOA)是一种受自然启发的群智能优化算法。该算法从白鹭和白鹭的捕食行为出发,由三个主要部分组成:坐等策略、主动策略和判别条件。将ESOA算法与粒子群算法(PSO)、遗传算法(GA)…