利用阿里云PAI平台微调ChatGLM3-6B

news2024/10/8 15:45:28

1.介绍ChatGLM3-6B

ChatGLM3-6B大模型是智谱AI和清华大学 KEG 实验室联合发布的对话预训练模型。

1.1 模型规模

模型规模通常用参数数量(parameters)来衡量。参数数量越多,模型理论上越强大,但也更耗费资源。以下是一些典型模型的参数数量对比:

ChatTGLM3-6b:6 billion (60亿) 参数
GPT-3:175 billion (1750亿) 参数
BERT Large:340 million (3.4亿) 参数
GPT-2:1.5 billion (15亿) 参数
从参数数量上看,ChatTGLM3-6b比BERT和GPT-2大,但远小于GPT-3。

1.2 性能对比

性能可以通过在各种基准测试(benchmarks)上的表现来衡量,例如自然语言理解、问答、翻译等任务。以下是一些假设数据(具体的数值可能会有所不同,但用于说明差异):

性能对比

1.3 资源消耗对比表

资源消耗对比表
这些数据表明,ChatTGLM3-6b在资源消耗上比GPT-3低,但比BERT和GPT-2高一些。

2. 部署ChatGLM3-6B大模型

适用于本地交互和测试,适合个人用户和开发者进行快速迭代和调试,命令行模式。
1. 下载大模型

mkdir models
cd models
 
apt update
# 能够拉长文本形式的文件
apt install git-lfs
 
# 克隆chatGLM3-6b大模型
git clone https://www.modelscope.cn/ZhipuAI/chatglm3-6b.git

chatglm3-6b目录如图

2.下载项目

我们通过下面的 命令行 和 网页版 调用我们部署的本地大模型

mkdir webcodes
cd webcodes
 
# 下载chatglm3-6b web_demo项目
git clone https://github.com/THUDM/ChatGLM3.git

# 安装依赖
pip install -r requirements.txt

下载的ChatGLM项目

启动(启动之前需要修改大模型路径,如果没有修改默认从Hugging Face下载【需要魔法】),以下为小黑窗启动为例:
修改模型路径

# 小黑窗启动命令
python cli_demo.py

# 网页端启动
streamlit run web_demo_streamlit.py

效果如图所示

3. OpenAPI的部署

适用于需要将ChatGLM3-6B模型作为服务提供的场景,提供了丰富的API接口和灵活的部署选项【处理了文本的嵌入】。

1.下载向量,这里我以m3e为例子

cd models
# 克隆m3e向量模型
git clone https://www.modelscope.cn/xrunda/m3e-base.git

2.修改大模型路径
修改大模型路径

3,运行启动

cd openai_api_demo
python api_server.py

4. 测试

curl -X POST "http://127.0.0.1:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
-d "{\"model\": \"chatglm3-6b\", \"messages\": [{\"role\": \"system\", \"content\": \"You are ChatGLM3, a large language model trained by Zhipu.AI. Follow the user's instructions carefully. Respond using markdown.\"}, {\"role\": \"user\", \"content\": \"你好,你是谁?\"}], \"stream\": false, \"max_tokens\": 100, \"temperature\": 0.8, \"top_p\": 0.8}"

调用OpenAPI接口

4. ChatGLM3-6B大模型loar微调

借助LLaMA-Factory实现快速微调(官方推荐)LLaMA Factory的官网图片
1. 安装LLaMA-Factory
克隆LLaMA-Factory 以及install所需依赖

# 克隆项目
git clone https://github.com/hiyouga/LLaMA-Factory.git

# 安装项目依赖
cd LLaMA-Factory
pip install -r requirements.txt
pip install transformers_stream_generator bitsandbytes tiktoken auto-gptq optimum autoawq
pip install --upgrade tensorflow
pip uninstall flash-attn -y

# 运行
CUDA_VISIBLE_DEVICES=0 USE_MODELSCOPE_HUB=1 python src/train_web.py

使用GPU和对ModelScope Hub的支持
2.自定义训练集并上传
self_cognition文件

 
# 自定义数据集
[
    {
        "instruction": "用户指令(必填)",
        "input": "用户输入(选填)",
        "output": "模型回答(必填)",
        "system": "系统提示词(选填)",
        "history": [
            ["第一轮指令(选填)", "第一轮回答(选填)"],
            ["第二轮指令(选填)", "第二轮回答(选填)"]
        ]
    }
]

打开LLaMA-Factory项目data文件夹下的dataset_info.json,进行上传

{
  "alpaca_en": {
    "file_name": "alpaca_data_en_52k.json",
    "file_sha1": "607f94a7f581341e59685aef32f531095232cf23"
  },
  "alpaca_zh": {
    "file_name": "alpaca_data_zh_51k.json",
    "file_sha1": "0016a4df88f523aad8dc004ada7575896824a0dc"
  },
  "alpaca_gpt4_en": {
    "file_name": "alpaca_gpt4_data_en.json",
    "file_sha1": "647f4ad447bd993e4b6b6223d1be15208bab694a"
  },
  "alpaca_gpt4_zh": {
    "file_name": "alpaca_gpt4_data_zh.json",
    "file_sha1": "3eaa3bda364ccdd59925d7448a698256c31ef845"
  },
  "identity": {
    "file_name": "identity.json",
    "file_sha1": "ffe3ecb58ab642da33fbb514d5e6188f1469ad40"
  },
  "oaast_sft": {
    "file_name": "oaast_sft.json",
    "file_sha1": "7baf5d43e67a91f9bbdf4e400dbe033b87e9757e",
    "columns": {
      "prompt": "instruction",
      "query": "input",
      "response": "output",
      "history": "history"
    }
  },
  "oaast_sft_zh": {
    "file_name": "oaast_sft_zh.json",
    "file_sha1": "a6a91f18f80f37b10ded9cf633fb50c033bf7b9f",
    "columns": {
      "prompt": "instruction",
      "query": "input",
      "response": "output",
      "history": "history"
    }
  },
  "lima": {
    "file_name": "lima.json",
    "file_sha1": "9db59f6b7007dc4b17529fc63379b9cd61640f37",
    "columns": {
      "prompt": "instruction",
      "query": "input",
      "response": "output",
      "history": "history"
    }
  },
  "glaive_toolcall": {
    "file_name": "glaive_toolcall_10k.json",
    "file_sha1": "a6917b85d209df98d31fdecb253c79ebc440f6f3",
    "formatting": "sharegpt",
    "columns": {
      "messages": "conversations",
      "tools": "tools"
    }
  },
  "example": {
    "script_url": "example_dataset",
    "columns": {
      "prompt": "instruction",
      "query": "input",
      "response": "output",
      "history": "history"
    }
  },
  "guanaco": {
    "hf_hub_url": "JosephusCheung/GuanacoDataset",
    "ms_hub_url": "AI-ModelScope/GuanacoDataset"
  },
  "belle_2m": {
    "hf_hub_url": "BelleGroup/train_2M_CN",
    "ms_hub_url": "AI-ModelScope/train_2M_CN"
  },
  "belle_1m": {
    "hf_hub_url": "BelleGroup/train_1M_CN",
    "ms_hub_url": "AI-ModelScope/train_1M_CN"
  },
  "belle_0.5m": {
    "hf_hub_url": "BelleGroup/train_0.5M_CN",
    "ms_hub_url": "AI-ModelScope/train_0.5M_CN"
  },
  "belle_dialog": {
    "hf_hub_url": "BelleGroup/generated_chat_0.4M",
    "ms_hub_url": "AI-ModelScope/generated_chat_0.4M"
  },
  "belle_math": {
    "hf_hub_url": "BelleGroup/school_math_0.25M",
    "ms_hub_url": "AI-ModelScope/school_math_0.25M"
  },
  "belle_multiturn": {
    "script_url": "belle_multiturn",
    "formatting": "sharegpt"
  },
  "ultra_chat": {
    "script_url": "ultra_chat",
    "formatting": "sharegpt"
  },
  "open_platypus": {
    "hf_hub_url": "garage-bAInd/Open-Platypus",
    "ms_hub_url": "AI-ModelScope/Open-Platypus"
  },
  "codealpaca": {
    "hf_hub_url": "sahil2801/CodeAlpaca-20k",
    "ms_hub_url": "AI-ModelScope/CodeAlpaca-20k"
  },
  "alpaca_cot": {
    "hf_hub_url": "QingyiSi/Alpaca-CoT",
    "ms_hub_url": "AI-ModelScope/Alpaca-CoT"
  },
  "openorca": {
    "hf_hub_url": "Open-Orca/OpenOrca",
    "ms_hub_url": "AI-ModelScope/OpenOrca",
    "columns": {
      "prompt": "question",
      "response": "response",
      "system": "system_prompt"
    }
  },
  "slimorca": {
    "hf_hub_url": "Open-Orca/SlimOrca",
    "formatting": "sharegpt"
  },
  "mathinstruct": {
    "hf_hub_url": "TIGER-Lab/MathInstruct",
    "ms_hub_url": "AI-ModelScope/MathInstruct",
    "columns": {
      "prompt": "instruction",
      "response": "output"
    }
  },
  "firefly": {
    "hf_hub_url": "YeungNLP/firefly-train-1.1M",
    "columns": {
      "prompt": "input",
      "response": "target"
    }
  },
  "wikiqa": {
    "hf_hub_url": "wiki_qa",
    "columns": {
      "prompt": "question",
      "response": "answer"
    }
  },
  "webqa": {
    "hf_hub_url": "suolyer/webqa",
    "ms_hub_url": "AI-ModelScope/webqa",
    "columns": {
      "prompt": "input",
      "response": "output"
    }
  },
  "webnovel": {
    "hf_hub_url": "zxbsmk/webnovel_cn",
    "ms_hub_url": "AI-ModelScope/webnovel_cn"
  },
  "nectar_sft": {
    "hf_hub_url": "mlinmg/SFT-Nectar",
    "ms_hub_url": "AI-ModelScope/SFT-Nectar"
  },
  "deepctrl": {
    "ms_hub_url": "deepctrl/deepctrl-sft-data"
  },
  "adgen": {
    "hf_hub_url": "HasturOfficial/adgen",
    "ms_hub_url": "AI-ModelScope/adgen",
    "columns": {
      "prompt": "content",
      "response": "summary"
    }
  },
  "sharegpt_hyper": {
    "hf_hub_url": "totally-not-an-llm/sharegpt-hyperfiltered-3k",
    "formatting": "sharegpt"
  },
  "sharegpt4": {
    "hf_hub_url": "shibing624/sharegpt_gpt4",
    "ms_hub_url": "AI-ModelScope/sharegpt_gpt4",
    "formatting": "sharegpt"
  },
  "ultrachat_200k": {
    "hf_hub_url": "HuggingFaceH4/ultrachat_200k",
    "ms_hub_url": "AI-ModelScope/ultrachat_200k",
    "columns": {
      "messages": "messages"
    },
    "tags": {
      "role_tag": "role",
      "content_tag": "content",
      "user_tag": "user",
      "assistant_tag": "assistant"
    },
    "formatting": "sharegpt"
  },
  "agent_instruct": {
    "hf_hub_url": "THUDM/AgentInstruct",
    "ms_hub_url": "ZhipuAI/AgentInstruct",
    "formatting": "sharegpt"
  },
  "lmsys_chat": {
    "hf_hub_url": "lmsys/lmsys-chat-1m",
    "ms_hub_url": "AI-ModelScope/lmsys-chat-1m",
    "columns": {
      "messages": "conversation"
    },
    "tags": {
      "role_tag": "role",
      "content_tag": "content",
      "user_tag": "human",
      "assistant_tag": "assistant"
    },
    "formatting": "sharegpt"
  },
  "evol_instruct": {
    "hf_hub_url": "WizardLM/WizardLM_evol_instruct_V2_196k",
    "ms_hub_url": "AI-ModelScope/WizardLM_evol_instruct_V2_196k",
    "formatting": "sharegpt"
  },
  "glaive_toolcall_100k": {
    "hf_hub_url": "hiyouga/glaive-function-calling-v2-sharegpt",
    "formatting": "sharegpt",
    "columns": {
      "messages": "conversations",
      "tools": "tools"
    }
  },
  "cosmopedia": {
    "hf_hub_url": "HuggingFaceTB/cosmopedia",
    "columns": {
      "prompt": "prompt",
      "response": "text"
    }
  },
  "oasst_de": {
    "hf_hub_url": "mayflowergmbh/oasst_de"
  },
  "dolly_15k_de": {
    "hf_hub_url": "mayflowergmbh/dolly-15k_de"
  },
  "alpaca-gpt4_de": {
    "hf_hub_url": "mayflowergmbh/alpaca-gpt4_de"
  },
  "openschnabeltier_de": {
    "hf_hub_url": "mayflowergmbh/openschnabeltier_de"
  },
  "evol_instruct_de": {
    "hf_hub_url": "mayflowergmbh/evol-instruct_de"
  },
  "dolphin_de": {
    "hf_hub_url": "mayflowergmbh/dolphin_de"
  },
  "booksum_de": {
    "hf_hub_url": "mayflowergmbh/booksum_de"
  },
  "airoboros_de": {
    "hf_hub_url": "mayflowergmbh/airoboros-3.0_de"
  },
  "ultrachat_de": {
    "hf_hub_url": "mayflowergmbh/ultra-chat_de"
  },
  "hh_rlhf_en": {
    "script_url": "hh_rlhf_en",
    "columns": {
      "prompt": "instruction",
      "response": "output",
      "history": "history"
    },
    "ranking": true
  },
  "oaast_rm": {
    "file_name": "oaast_rm.json",
    "file_sha1": "622d420e9b70003b210618253bd3d9d2891d86cb",
    "columns": {
      "prompt": "instruction",
      "query": "input",
      "response": "output",
      "history": "history"
    },
    "ranking": true
  },
  "oaast_rm_zh": {
    "file_name": "oaast_rm_zh.json",
    "file_sha1": "1065af1f3784dd61be5e79713a35f427b713a232",
    "columns": {
      "prompt": "instruction",
      "query": "input",
      "response": "output",
      "history": "history"
    },
    "ranking": true
  },
  "comparison_gpt4_en": {
    "file_name": "comparison_gpt4_data_en.json",
    "file_sha1": "96fa18313544e22444fe20eead7754b17da452ae",
    "ranking": true
  },
  "comparison_gpt4_zh": {
    "file_name": "comparison_gpt4_data_zh.json",
    "file_sha1": "515b18ed497199131ddcc1af950345c11dc5c7fd",
    "ranking": true
  },
  "orca_rlhf": {
    "file_name": "orca_rlhf.json",
    "file_sha1": "acc8f74d16fd1fc4f68e7d86eaa781c2c3f5ba8e",
    "ranking": true,
    "columns": {
      "prompt": "question",
      "response": "answer",
      "system": "system"
    }
  },
  "nectar_rm": {
    "hf_hub_url": "mlinmg/RLAIF-Nectar",
    "ms_hub_url": "AI-ModelScope/RLAIF-Nectar",
    "ranking": true
  },
  "orca_dpo_de" : {
    "hf_hub_url": "mayflowergmbh/intel_orca_dpo_pairs_de",
    "ranking": true
  },
  "wiki_demo": {
    "file_name": "wiki_demo.txt",
    "file_sha1": "e70375e28eda542a90c68213640cc371898ce181",
    "columns": {
      "prompt": "text"
    }
  },
  "c4_demo": {
    "file_name": "c4_demo.json",
    "file_sha1": "a5a0c86759732f9a5238e447fecd74f28a66cca8",
    "columns": {
      "prompt": "text"
    }
  },
  "refinedweb": {
    "hf_hub_url": "tiiuae/falcon-refinedweb",
    "columns": {
      "prompt": "content"
    }
  },
  "redpajama_v2": {
    "hf_hub_url": "togethercomputer/RedPajama-Data-V2",
    "columns": {
      "prompt": "raw_content"
    },
    "subset": "default"
  },
  "wikipedia_en": {
    "hf_hub_url": "olm/olm-wikipedia-20221220",
    "ms_hub_url": "AI-ModelScope/olm-wikipedia-20221220",
    "columns": {
      "prompt": "text"
    }
  },
  "wikipedia_zh": {
    "hf_hub_url": "pleisto/wikipedia-cn-20230720-filtered",
    "ms_hub_url": "AI-ModelScope/wikipedia-cn-20230720-filtered",
    "columns": {
      "prompt": "completion"
    }
  },
  "pile": {
    "hf_hub_url": "EleutherAI/pile",
    "ms_hub_url": "AI-ModelScope/pile",
    "columns": {
      "prompt": "text"
    },
    "subset": "all"
  },
  "skypile": {
    "hf_hub_url": "Skywork/SkyPile-150B",
    "ms_hub_url": "AI-ModelScope/SkyPile-150B",
    "columns": {
      "prompt": "text"
    }
  },
  "the_stack": {
    "hf_hub_url": "bigcode/the-stack",
    "ms_hub_url": "AI-ModelScope/the-stack",
    "columns": {
      "prompt": "content"
    }
  },
  "starcoder_python": {
    "hf_hub_url": "bigcode/starcoderdata",
    "ms_hub_url": "AI-ModelScope/starcoderdata",
    "columns": {
      "prompt": "content"
    },
    "folder": "python"
  },
  "self_cognition": {
    "file_name": "self_cognition.json",
    "file_sha1": "eca3d89fa38b35460d6627cefdc101feef507eb5"
  }
}

data目录
3. 进行微调

# 运行
CUDA_VISIBLE_DEVICES=0 USE_MODELSCOPE_HUB=1 python src/train_web.py

微调Web页面

我们需要注意一下:设置正确的断点:

当报错output已经存在的时候,很有可能是因为当前断点已经设置过了,所以我们需要设置一个新的断点

微调过程图
结果如下所示:
结果图

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

1688商品库存查询

目录 下载安装与运行 功能简介 快速入门(视频) 当前支持的导出项 常用功能 历史商品是什么意思 粘贴商品有什么要求 导入商品需要什么样的模板 单个商品的查看 查看单个商品详情 下载安装与运行 下载、安装与运行 语雀 功能简介 最近一次测…

InternLM Xtuner Qlora 微调

Xtuner 简介 XTuner 是由上海人工智能实验室开发的一款低成本大模型训练工具箱。它以高效、灵活和全能的特性,成为轻量化大模型微调的理想选择。借助 XTuner,用户仅需 8GB 显存即可对 InternLM2-7B 模型进行微调,从而定制出独一无二的 AI 助手…

【OC】类与对象

类与对象 定义类接口部分定义成员变量方法说明实现部分 对象的产生与使用对象与指针self关键字避免重复创建 id类型方法详解方法的所属性形参个数可变的方法 成员变量成员变量及其运行机制多个实例中内存示意图模拟类变量单例模式 类是面向对象的重要内容,我们可以把…

C++进阶:继承

文章目录 继承的概念继承的定义方式继承关系和访问限定符基类和派生类对象的赋值转换继承中的作用域派生类中的默认成员函数构造函数拷贝构造函数赋值拷贝函数析构函数 总结 继承的概念 继承(inheritance)机制是面向对象程序设计使代码可以复用的最重要的手段,它允…

c++ 里函数选择的优先级:普通函数、模板函数、万能引用,函数重载的常量左值引用、右值引用,编译器选择哪个执行呢?

看大师写的代码时,除了在类里定义了 copy 构造函数,移动构造函数,还定义了对形参采取万能引用的构造函数,因此有个疑问,这时候的构造函数优先级是什么样的呢?简化逻辑测试一下,如下图&#xff0…

c语言:自定义类型(枚举、联合体)

目录 前言: 1.位段 1.1什么是位段 1.2 位段的内存分配 1.3 位段的跨平台问题 2.枚举 2.1枚举类型的定义 2.2枚举类型的优点 3.联合体(共用体) 3.1联合类型的定义 3.2联合体的特点 3.3联合大小的计算 3.4联合体的实际应用 前言…

【机器学习系列】深入理解集成学习:从Bagging到Boosting

目录 一、集成方法的一般思想 二、集成方法的基本原理 三、构建集成分类器的方法 常见的有装袋(Bagging)和提升(Boosting)两种方法 方法1 :装袋(Bagging) Bagging原理如下图: …

调研管理系统的设计

管理员账户功能包括:系统首页,个人中心,管理员管理,基础数据管理,教师类型管理,课程类型管理,公告类型管理 前台账户功能包括:系统首页,个人中心,论坛&#…

深度学习之文本分类模型-基于transformer

1、transformer transformer就是大名鼎鼎的论文《Attention Is All You Need》[1],其在一些翻译任务上获得了SOTA的效果。其模型整体结构如下图所示 encoder和decoder 其整体结构由encoder和decoder组成,其中encoder由6个相同的block组成,…

MySQL中的数据库约束

目录 导读: 约束类型 1、not null(不能为空) 2、unique(唯一) 3、default(默认值约束) 4、primary key(唯一)与unique 相同点: 不同点: auto_increment: 5、foreign key(外键) 语法形式&#xff…

GAN的入门理解

这一篇主要是关于生成对抗网络的模型笔记,有一些简单的证明和原理,是根据李宏毅老师的课程整理的,下面有链接。本篇文章主要就是梳理基础的概念和训练过程,如果有什么问题的话也可以指出的。 李宏毅老师的课程链接 1.概述 GAN是…

BC11 学生基本信息输入输出

BC11 学生基本信息输入输出 废话不多说上题目&#xff1a; 这道题表面上很简单&#xff0c;但是里面有很重要的点先给大家上正确的代码&#xff1a; #include<stdio.h> int main() {int stu 0;float c 0;float English 0;float math 0;scanf("%d;%f,%f,%f"…

Java入门教程上

常见的cmd命令 类 class 字面量 数据类型 输入 public static void main(String[] args) {Scanner anew Scanner(System.in);int na.nextInt();int ma.nextInt();System.out.println(mn);} } 算数运算符 package wclg;public class test {public static void main(String[] ar…

iOS调整collectionViewCell顺序

效果图 原理 就是设置collectionView调整顺序的代理方法&#xff0c;这里要注意一点 调整过代理方法之后&#xff0c;一定要修改数据源&#xff0c;否则导致错乱。 还有就是在collectionView上面添加一个长按手势&#xff0c;在长按手势的不同阶段&#xff0c;调用collectionV…

【数据结构】AVL树(平衡二叉树)

目录 一、AVL树的概念二、AVL树的节点三、AVL树的插入四、AVL树的旋转1.插入在较高左子树的左侧&#xff0c;使用右单旋2.插入在较高右子树的右侧&#xff0c;使用左单旋3.插入较高左子树的右侧&#xff0c;先左单旋再右单旋4.插入较高右子树的左侧&#xff0c;先右单旋再左单旋…

论文研读 A Comparison of TCP Automatic Tuning Techniques for Distributed Computing

论文《分布式计算中TCP自动调优技术的比较》由Eric Weigle和Wu-chun Feng撰写&#xff0c;探讨了自动调整TCP缓冲区大小以提升分布式应用性能的不同方法。文章首先讨论了手动优化TCP缓冲区大小的局限性&#xff0c;并介绍了研究人员提出的各种自动调优技术来应对这些挑战。 作者…

打造智慧工厂核心:ARMxy工业PC与Linux系统

智能制造正以前所未有的速度重塑全球工业格局&#xff0c;而位于这场革命核心的&#xff0c;正是那些能够精准响应复杂生产需求、高效驱动自动化流程的先进设备。钡铼技术ARMxy工业计算机&#xff0c;以其独特的设计哲学与卓越的技术性能&#xff0c;正成为众多现代化生产线背后…

2024全国大学生数学建模竞赛优秀参考资料分享

0、竞赛资料 优秀的资料必不可少&#xff0c;优秀论文是学习的关键&#xff0c;视频学习也非常重要&#xff0c;如有需要请点击下方名片获取。 一、赛事介绍 全国大学生数学建模竞赛(以下简称竞赛)是中国工业与应用数学学会主办的面向全国大学生的群众性科技活动&#xff0c;旨…

⌈ 传知代码 ⌋ 记忆大师

&#x1f49b;前情提要&#x1f49b; 本文是传知代码平台中的相关前沿知识与技术的分享~ 接下来我们即将进入一个全新的空间&#xff0c;对技术有一个全新的视角~ 本文所涉及所有资源均在传知代码平台可获取 以下的内容一定会让你对AI 赋能时代有一个颠覆性的认识哦&#x…

MySQL 函数与约束

MySQL 函数与约束 文章目录 MySQL 函数与约束1 函数1.1 字符串函数1.2 数值函数1.3 日期函数1.4 流程函数 2 约束2.1 概述2.2 约束演示2.3 外键约束2.4 删除/更新行为 1 函数 函数是指一段可以直接被另一程序调用的程序或代码。 1.1 字符串函数 MySQL中内置了很多字符串函数&…