docs: 更新多篇技术文档的元数据和格式

- 添加Entity Framework Core文档
- 更新大数据文档的标签和格式
- 完善Claude Code文档的元数据和表格格式
- 为C#和ASP.NET Core文档添加.NET标签
- 修正大模型文档的标签和表格格式
This commit is contained in:
wenyongda 2026-04-15 12:51:17 +08:00
parent 5a9ddf7918
commit 09b91081f2
6 changed files with 114 additions and 103 deletions

View File

@ -4,6 +4,7 @@ date: 2021-03-23 10:30:31
author: 文永达 author: 文永达
permalink: asp-net-core/ permalink: asp-net-core/
top_img: https://gcore.jsdelivr.net/gh/volantis-x/cdn-wallpaper/abstract/67239FBB-E15D-4F4F-8EE8-0F1C9F3C4E7C.jpeg top_img: https://gcore.jsdelivr.net/gh/volantis-x/cdn-wallpaper/abstract/67239FBB-E15D-4F4F-8EE8-0F1C9F3C4E7C.jpeg
tags: .NET
--- ---
# IDE智能提示优化 # IDE智能提示优化
@ -20,7 +21,7 @@ dotnet tool install -g islocalizer
`.net6`的汉化包已经有现成的了,可以直接进行安装 `.net6`的汉化包已经有现成的了,可以直接进行安装
```shell ```shell
islocalizer install auto -m net6.0 -l zh-cn islocalizer install auto -m net6.0 -l zh-cn
``` ```
工具会自动从`github`下载对应的包进行安装(可能需要访问加速)。 工具会自动从`github`下载对应的包进行安装(可能需要访问加速)。
@ -134,7 +135,7 @@ docker ps
cd /usr/local/jenkins_home/workspace/XiaodaERP_NetCore cd /usr/local/jenkins_home/workspace/XiaodaERP_NetCore
echo $PWD echo $PWD
docker image build -f ./XiaodaERP/Dockerfile -t xiaodaerp/netcore . docker image build -f ./XiaodaERP/Dockerfile -t xiaodaerp/netcore .
docker images docker images
docker run --name xiaodaerp/netcore -p 7274:80 -d xiaodaerp/netcore docker run --name xiaodaerp/netcore -p 7274:80 -d xiaodaerp/netcore
``` ```
@ -475,7 +476,7 @@ http {
``` ```
- 如果`$http_upgrade`的值与`default`不匹配(通常是指`$http_upgrade`未设置或未匹配任何其他条件),则将`$connection_upgrade`设置为`upgrade` - 如果`$http_upgrade`的值与`default`不匹配(通常是指`$http_upgrade`未设置或未匹配任何其他条件),则将`$connection_upgrade`设置为`upgrade`
- 如果`$http_upgrade`的值为空字符串(''),则将`$connection_upgrade`设置为`close`。这意味着Nginx将关闭连接而不是升级。 - 如果`$http_upgrade`的值为空字符串(''),则将`$connection_upgrade`设置为`close`。这意味着Nginx将关闭连接而不是升级。
2. 第二个`map`块(微软官方用法): 2. 第二个`map`块(微软官方用法):
```conf ```conf
map $http_connection $connection_upgrade { map $http_connection $connection_upgrade {
@ -483,7 +484,7 @@ http {
default keep-alive; default keep-alive;
} }
``` ```
- 如果`$http_connection`的值匹配正则表达式`~*Upgrade`(不区分大小写地匹配包含"Upgrade"的值),则将`$connection_upgrade`设置为`$http_connection`的值,通常是`upgrade` - 如果`$http_connection`的值匹配正则表达式`~*Upgrade`(不区分大小写地匹配包含"Upgrade"的值),则将`$connection_upgrade`设置为`$http_connection`的值,通常是`upgrade`
- 如果没有匹配的值,将`$connection_upgrade`设置为`keep-alive`。这意味着Nginx将保持HTTP连接保持活动状态以进行进一步的请求和响应。 - 如果没有匹配的值,将`$connection_upgrade`设置为`keep-alive`。这意味着Nginx将保持HTTP连接保持活动状态以进行进一步的请求和响应。
@ -653,7 +654,7 @@ namespace XiaodaERP.Utils
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
private readonly JwtSecurityTokenHandler _jwtSecurityTokenHandler; private readonly JwtSecurityTokenHandler _jwtSecurityTokenHandler;
public TokenHelper(IConfiguration configuration, JwtSecurityTokenHandler jwtSecurityTokenHandler) public TokenHelper(IConfiguration configuration, JwtSecurityTokenHandler jwtSecurityTokenHandler)
{ {
this._configuration = configuration; this._configuration = configuration;
this._jwtSecurityTokenHandler = jwtSecurityTokenHandler; this._jwtSecurityTokenHandler = jwtSecurityTokenHandler;
} }
@ -735,7 +736,7 @@ namespace XiaodaERP.Utils
public ViewUser Login(string UserName, string PassWord) public ViewUser Login(string UserName, string PassWord)
{ {
var res = _sqlServerDbContext.Users.Include(user => user.Role).FirstOrDefault(x => x.UserName == UserName); var res = _sqlServerDbContext.Users.Include(user => user.Role).FirstOrDefault(x => x.UserName == UserName);
if (res != null) if (res != null)
{ {
if (res.PassWord == Md5Encoding(PassWord)) if (res.PassWord == Md5Encoding(PassWord))
{ {
@ -884,7 +885,7 @@ namespace XiaodaERP.Attributes
sysActionLog.ActionUserId = us.UserId; sysActionLog.ActionUserId = us.UserId;
Console.WriteLine(us.username); Console.WriteLine(us.username);
sysActionLog.ActionUserName = us.username; sysActionLog.ActionUserName = us.username;
} }
sysActionLog.ActionTime = DateTime.Now; sysActionLog.ActionTime = DateTime.Now;
} }
_sqlServerDbContext.SysActionLogs.Add(sysActionLog); _sqlServerDbContext.SysActionLogs.Add(sysActionLog);
@ -997,7 +998,7 @@ app.UseIpRateLimiting();
"ClientIdHeader": "X-ClientId", "ClientIdHeader": "X-ClientId",
//限制状态码 //限制状态码
"HttpStatusCode": 429, "HttpStatusCode": 429,
////IP白名单:支持Ip v4和v6 ////IP白名单:支持Ip v4和v6
//"IpWhitelist": [ "127.0.0.1", "::1/10", "192.168.0.0/24" ], //"IpWhitelist": [ "127.0.0.1", "::1/10", "192.168.0.0/24" ],
////端点白名单 ////端点白名单
//"EndpointWhitelist": [ "get:/api/license", "*:/api/status" ], //"EndpointWhitelist": [ "get:/api/license", "*:/api/status" ],
@ -1071,13 +1072,13 @@ app.UseIpRateLimiting();
using (var serviceScope = app.Services.CreateScope()) using (var serviceScope = app.Services.CreateScope())
{ {
var services = serviceScope.ServiceProvider; var services = serviceScope.ServiceProvider;
// get the IpPolicyStore instance // get the IpPolicyStore instance
var ipPolicyStore = services.GetRequiredService<IIpPolicyStore>(); var ipPolicyStore = services.GetRequiredService<IIpPolicyStore>();
// seed IP data from appsettings // seed IP data from appsettings
ipPolicyStore.SeedAsync().GetAwaiter().GetResult(); ipPolicyStore.SeedAsync().GetAwaiter().GetResult();
var clientPolicyStore = services.GetRequiredService<IClientPolicyStore>(); var clientPolicyStore = services.GetRequiredService<IClientPolicyStore>();
clientPolicyStore.SeedAsync().GetAwaiter().GetResult(); clientPolicyStore.SeedAsync().GetAwaiter().GetResult();
} }
@ -1141,16 +1142,16 @@ public class CustomIpRateLimitMiddleware : IpRateLimitMiddleware
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IIpRateLimitLogService _ipRateLimitLogService; private readonly IIpRateLimitLogService _ipRateLimitLogService;
public CustomIpRateLimitMiddleware(RequestDelegate next, IProcessingStrategy processingStrategy, public CustomIpRateLimitMiddleware(RequestDelegate next, IProcessingStrategy processingStrategy,
IOptions<IpRateLimitOptions> options, IIpPolicyStore policyStore, IRateLimitConfiguration config, IOptions<IpRateLimitOptions> options, IIpPolicyStore policyStore, IRateLimitConfiguration config,
ILogger<IpRateLimitMiddleware> logger, IIpRateLimitLogService ipRateLimitLogService) : base(next, processingStrategy, options, policyStore, config, logger) ILogger<IpRateLimitMiddleware> logger, IIpRateLimitLogService ipRateLimitLogService) : base(next, processingStrategy, options, policyStore, config, logger)
{ {
_ipRateLimitLogService = ipRateLimitLogService; _ipRateLimitLogService = ipRateLimitLogService;
} }
// 重写 用于记录被阻止的请求的日志 // 重写 用于记录被阻止的请求的日志
protected override void LogBlockedRequest(HttpContext httpContext, ClientRequestIdentity identity, protected override void LogBlockedRequest(HttpContext httpContext, ClientRequestIdentity identity,
RateLimitCounter counter, RateLimitRule rule) RateLimitCounter counter, RateLimitRule rule)
{ {
// base.LogBlockedRequest(httpContext, identity, counter, rule); // base.LogBlockedRequest(httpContext, identity, counter, rule);
@ -1260,9 +1261,9 @@ public class HelloQuartzJob : IJob
{ {
public Task Execute(IJobExecutionContext context) public Task Execute(IJobExecutionContext context)
{ {
return Task.Factory.StartNew(() => return Task.Factory.StartNew(() =>
{ {
Console.WriteLine("Hello Quartz.Net"); Console.WriteLine("Hello Quartz.Net");
}) })
} }
} }
@ -1276,12 +1277,12 @@ Job不是孤立存在的它需要执行的参数这些参数如何传递
public class SayHelloJob : IJob public class SayHelloJob : IJob
{ {
public string UserName { get; set; } public string UserName { get; set; }
public Task Execute(IJobExecutionContext context) public Task Execute(IJobExecutionContext context)
{ {
return Task.Factory.StartNew(() => return Task.Factory.StartNew(() =>
{ {
Console.WriteLine($"Hello {UserName}!"); Console.WriteLine($"Hello {UserName}!");
}) })
} }
} }
@ -1516,7 +1517,7 @@ NLog 配置文件是一个以`nlog`为根节点的 XML 文件。`nlog`节点可
```xml ```xml
<nlog> <nlog>
<extensions> <extensions>
<add assembly="MyAssembly" /> <add assembly="MyAssembly" />
</extensions> </extensions>
<targets> <targets>
@ -1577,7 +1578,7 @@ NLog 4.4.2 之后可以使用通配符`*`指定多个文件。例如,`<include
var logger = NLog.LogManager.GetCurrentClassLogger(); var logger = NLog.LogManager.GetCurrentClassLogger();
``` ```
2. `NLog.LogManager.GetLogger`方法 2. `NLog.LogManager.GetLogger`方法
通过`NLog.LogManager.GetLogger("MyLogger")`方法可以显示地指定`NLog.Logger`的名称为MyLogger。 通过`NLog.LogManager.GetLogger("MyLogger")`方法可以显示地指定`NLog.Logger`的名称为MyLogger。
@ -1917,12 +1918,12 @@ gRPC 客户端类型通过依赖性注入(DI)注册为暂时性。现在可以
public class AggregatorService : Aggregator.AggregatorBase public class AggregatorService : Aggregator.AggregatorBase
{ {
private readonly Greeter.GreeterClient _client; private readonly Greeter.GreeterClient _client;
public AggregatorService(Greeter.GreeterClient client) public AggregatorService(Greeter.GreeterClient client)
{ {
_client = client; _client = client;
} }
public override async Task SayHellos(HelloRequest request, public override async Task SayHellos(HelloRequest request,
IServerStreamWriter<HelloReply> responseStream, ServerCallContext context) IServerStreamWriter<HelloReply> responseStream, ServerCallContext context)
{ {

View File

@ -4,6 +4,7 @@ date: 2021-03-23 10:30:31
author: 文永达 author: 文永达
permalink: csharp/ permalink: csharp/
top_img: https://gcore.jsdelivr.net/gh/volantis-x/cdn-wallpaper/abstract/67239FBB-E15D-4F4F-8EE8-0F1C9F3C4E7C.jpeg top_img: https://gcore.jsdelivr.net/gh/volantis-x/cdn-wallpaper/abstract/67239FBB-E15D-4F4F-8EE8-0F1C9F3C4E7C.jpeg
tags: .NET
--- ---
# 异步编程 # 异步编程
@ -117,30 +118,30 @@ DataTable dt = new DataTable("Table_New");
DataColumn dc = new DataColumn(); DataColumn dc = new DataColumn();
dt.Columns.Add(dc); dt.Columns.Add(dc);
//2. 提供列名,并对列属性进行设置 //2. 提供列名,并对列属性进行设置
DataTable workTable = new DataTable("Customers"); DataTable workTable = new DataTable("Customers");
//带列名和类型名 //带列名和类型名
DataColumn workCol = workTable.Columns.Add("CustID", typeof(Int32)); DataColumn workCol = workTable.Columns.Add("CustID", typeof(Int32));
// 对进行属性设置 // 对进行属性设置
workCol.AllowDBNull = false; //列的属性设置为不允许 DBNull 值 workCol.AllowDBNull = false; //列的属性设置为不允许 DBNull 值
workCol.Unique = true; //值约束为唯一 workCol.Unique = true; //值约束为唯一
workColumn.AutoIncrement = true; //在表中添加新行时自动递增 workColumn.AutoIncrement = true; //在表中添加新行时自动递增
workColumn.AutoIncrementSeed = 200; //从值 200 开始并以 3 为增量递增的列 workColumn.AutoIncrementSeed = 200; //从值 200 开始并以 3 为增量递增的列
workColumn.AutoIncrementStep = 3; workColumn.AutoIncrementStep = 3;
column.DefaultValue = 25; column.DefaultValue = 25;
// 定义主键:唯一地标识表中的每一行 // 定义主键:唯一地标识表中的每一行
workTable.PrimaryKey = new DataColumn[] {workTable.Columns["CustID"]}; workTable.PrimaryKey = new DataColumn[] {workTable.Columns["CustID"]};
// Or // Or
DataColumn[] columns = new DataColumn[1]; DataColumn[] columns = new DataColumn[1];
columns[0] = workTable.Columns["CustID"]; columns[0] = workTable.Columns["CustID"];
workTable.PrimaryKey = columns; workTable.PrimaryKey = columns;
// 创建表达式列:能够包含根据 同一行 中其他列值或根据表中 多行 的列值计算而得的值 // 创建表达式列:能够包含根据 同一行 中其他列值或根据表中 多行 的列值计算而得的值
//比如 表达式类型 示例 //比如 表达式类型 示例
// 比较 “总计 >= 500” // 比较 “总计 >= 500”
// 计算 "UnitPrice * Quantity" // 计算 "UnitPrice * Quantity"
// 聚合 Sum(Price) // 聚合 Sum(Price)
workTable.Columns.Add("Total", typeof(Double)); workTable.Columns.Add("Total", typeof(Double));
workTable.Columns.Add("SalesTax", typeof(Double), "Total * 0.086"); workTable.Columns.Add("SalesTax", typeof(Double), "Total * 0.086");
``` ```
## 复制DataTable ## 复制DataTable
@ -198,11 +199,11 @@ ObjectTable.EndLoadData();
# 反射(Reflection) # 反射(Reflection)
> 反射是.NET中的重要机制通过反射可以得到\*.exe或\*.dll等程序集内部的接口、类、方法、字段、属性、特性等信息还可以动态创建出类型实例并执行其中的方法。 > 反射是.NET中的重要机制通过反射可以得到\*.exe或\*.dll等程序集内部的接口、类、方法、字段、属性、特性等信息还可以动态创建出类型实例并执行其中的方法。
> >
> 反射指程序可以访问、检测和修改它本身状态或行为的一种能力。 > 反射指程序可以访问、检测和修改它本身状态或行为的一种能力。
> >
> 程序集包含模块,而模块包含类型,类型又包含成员。反射则提供里封装程序集、模块和类型的对象。 > 程序集包含模块,而模块包含类型,类型又包含成员。反射则提供里封装程序集、模块和类型的对象。
> >
> 可以使用反射动态地创建类型的实例,将类型绑定到现有对象,或从现有对象中获取类型。然后,可以调用类型的方法或访问其字段和属性。 > 可以使用反射动态地创建类型的实例,将类型绑定到现有对象,或从现有对象中获取类型。然后,可以调用类型的方法或访问其字段和属性。
通过反射获取类型 通过反射获取类型
@ -210,21 +211,21 @@ ObjectTable.EndLoadData();
描述:有三种类型 描述:有三种类型
1. 通过`typeof`获取某个值的类型 1. 通过`typeof`获取某个值的类型
```c# ```c#
System.Type personType=typeof(Person); System.Type personType=typeof(Person);
System.Type heroType=typeof(Framework.Hero); System.Type heroType=typeof(Framework.Hero);
``` ```
2. 通过一个对象获取该对象所对应的类的类型、 2. 通过一个对象获取该对象所对应的类的类型、
```c# ```c#
Framework.hero dmxy =new Framework.hero(); Framework.hero dmxy =new Framework.hero();
System Type=dmxy.GetType(); System Type=dmxy.GetType();
``` ```
3. 通过类的名称字符串获取对应的类型 3. 通过类的名称字符串获取对应的类型
```c# ```c#
System.Type strType =System.Type.GetType("Person"); System.Type strType =System.Type.GetType("Person");
System.Type strType =System.Type.GetType("Framework.Hero"); System.Type strType =System.Type.GetType("Framework.Hero");
@ -284,7 +285,7 @@ private void ShowTypeField()
- GetMember(),GerMembers() - GetMember(),GerMembers()
1.返回MemberInfo类型用于取得该类的所有成员的信息 1.返回MemberInfo类型用于取得该类的所有成员的信息
2.GetConstructor(),GetConstructors() -返回ConstructorInfo类型用于取得该类构造函数的信息 2.GetConstructor(),GetConstructors() -返回ConstructorInfo类型用于取得该类构造函数的信息
@ -312,4 +313,4 @@ private void ShowTypeField()
## foreach ## foreach
### ###

View File

@ -3,6 +3,8 @@ title: Claude Code
date: 2026-02-27 14:05:22 date: 2026-02-27 14:05:22
tags: [AI, 效率工具] tags: [AI, 效率工具]
categories: 开发工具 categories: 开发工具
permalink: claude-code/
tag: AI
--- ---
## 简介 ## 简介
@ -65,7 +67,7 @@ export ANTHROPIC_API_KEY="your-api-key-here"
**方式二:配置文件** **方式二:配置文件**
```json ```json
{ {
"env": { "env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY", "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://coding.dashscope.aliyuncs.com/apps/anthropic", "ANTHROPIC_BASE_URL": "https://coding.dashscope.aliyuncs.com/apps/anthropic",
@ -95,13 +97,13 @@ claude --model claude-haiku-4-5-20251001
## 常用命令 ## 常用命令
| 命令 | 说明 | | 命令 | 说明 |
|------|------| | ------------------------- | ------------------ |
| `claude` | 启动交互式对话 | | `claude` | 启动交互式对话 |
| `claude -p "问题"` | 直接提问并获取答案 | | `claude -p "问题"` | 直接提问并获取答案 |
| `claude --model <模型名>` | 指定模型 | | `claude --model <模型名>` | 指定模型 |
| `claude --version` | 查看版本 | | `claude --version` | 查看版本 |
| `claude --help` | 查看帮助 | | `claude --help` | 查看帮助 |
## MCP 配置 ## MCP 配置
@ -116,11 +118,11 @@ claude mcp add fetch -- uvx mcp-server-fetch
### 常用 MCP 服务 ### 常用 MCP 服务
| 服务 | 命令 | 说明 | | 服务 | 命令 | 说明 |
|------|------|------| | ---------- | ------------------------------------------------------------------------- | ------------ |
| fetch | `claude mcp add fetch -- uvx mcp-server-fetch` | 网页内容抓取 | | fetch | `claude mcp add fetch -- uvx mcp-server-fetch` | 网页内容抓取 |
| filesystem | `claude mcp add filesystem -- npx -y @anthropic-ai/mcp-server-filesystem` | 文件系统访问 | | filesystem | `claude mcp add filesystem -- npx -y @anthropic-ai/mcp-server-filesystem` | 文件系统访问 |
| git | `claude mcp add git -- npx -y @anthropic-ai/mcp-server-git` | Git 操作 | | git | `claude mcp add git -- npx -y @anthropic-ai/mcp-server-git` | Git 操作 |
配置好的 MCP 配置文件实例 `~/.claude.json` 配置好的 MCP 配置文件实例 `~/.claude.json`

View File

@ -0,0 +1,7 @@
---
title: Entity Framework Core
date: 2026-04-15 12:35:21
tags: .NET
permalink: entity-framework-core/
---

View File

@ -1,7 +1,7 @@
--- ---
title: 大数据 title: 大数据
date: 2025-08-03 22:53:51 date: 2025-08-03 22:53:51
tags: tags: 大数据
--- ---
# Apache Doris # Apache Doris
@ -341,13 +341,13 @@ ulimit -n 65536
] ]
} }
} }
``` ```
执行任务 执行任务
```bash ```bash
cd datax cd datax
python ./bin/datax.py mysql_2_doris_t_base_material.json python ./bin/datax.py mysql_2_doris_t_base_material.json
``` ```

View File

@ -1,7 +1,7 @@
--- ---
title: 大模型 title: 大模型
date: 2025-02-18 10:06:57 date: 2025-02-18 10:06:57
tags: tags: AI
--- ---
# Ollama # Ollama
@ -379,7 +379,7 @@ pip install -U "huggingface_hub"
hf download cyankiwi/Nemotron-Orchestrator-8B-AWQ-8bit --local-dir /AI/hf/models/cyankiwi/Nemotron-Orchestrator-8B-AWQ-8bit hf download cyankiwi/Nemotron-Orchestrator-8B-AWQ-8bit --local-dir /AI/hf/models/cyankiwi/Nemotron-Orchestrator-8B-AWQ-8bit
``` ```
- -
# Code-forge # Code-forge
@ -538,7 +538,7 @@ conda activate ai
# Anaconda # Anaconda
> >
## 安装 ## 安装
@ -561,7 +561,7 @@ source ~/.zshrc
conda env list conda env list
``` ```
2. 查看conda下的包 2. 查看conda下的包
```she ```she
@ -602,7 +602,7 @@ source ~/.zshrc
conda remove --name env_name package_name conda remove --name env_name package_name
``` ```
## 问题 ## 问题
@ -612,24 +612,24 @@ source ~/.zshrc
```shell ```shell
#在个人环境下修改 #在个人环境下修改
conda activate gatkenv conda activate gatkenv
conda env config vars set PS1='($CONDA_DEFAULT_ENV)[\u@\h \W]$' conda env config vars set PS1='($CONDA_DEFAULT_ENV)[\u@\h \W]$'
#重启环境就ok了 #重启环境就ok了
conda deactivate conda deactivate
conda activate gatkenv conda activate gatkenv
#在所有的虚拟环境下修改,这个命令的意思是在~/.condarc下添加一行 #在所有的虚拟环境下修改,这个命令的意思是在~/.condarc下添加一行
conda config --set env_prompt "({default_env})[\u@\h \W]$" conda config --set env_prompt "({default_env})[\u@\h \W]$"
#取消设置 #取消设置
conda config --remove-key env_prompt conda config --remove-key env_prompt
``` ```
2. conda 安装后没有将conda置为默认 2. conda 安装后没有将conda置为默认
@ -638,23 +638,23 @@ source ~/.zshrc
This will activate conda on startup and change the command prompt when activated. This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup, If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated: run the following command when conda is activated:
conda config --set auto_activate_base false conda config --set auto_activate_base false
You can undo this by running `conda init --reverse $SHELL`? [yes|no] You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> [no] >>>
You have chosen to not have conda modify your shell scripts at all. You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session: To activate conda's base environment in your current shell session:
eval "$(/home/user/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)" eval "$(/home/user/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)"
To install conda's shell functions for easier access, first activate, then: To install conda's shell functions for easier access, first activate, then:
conda init conda init
Thank you for installing Miniconda3! Thank you for installing Miniconda3!
``` ```
则执行以下shell 则执行以下shell
@ -688,7 +688,7 @@ source ~/.zshrc
下载试试:如果两都能看到下载源,那么就更改成功。 下载试试:如果两都能看到下载源,那么就更改成功。
```mipsasm ```mipsasm
conda install conda install
``` ```
##### Linux系统下: ##### Linux系统下:
@ -705,22 +705,22 @@ source ~/.zshrc
```ini ```ini
[global] [global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install] [install]
trusted-host=pypi.tuna.tsinghua.edu.cn trusted-host=pypi.tuna.tsinghua.edu.cn
disable-pip-version-check = true disable-pip-version-check = true
timeout = 6000 timeout = 6000
``` ```
下载试试: 下载试试:
```bash ```bash
pip install pip install
``` ```
# Jupyter Notebook # Jupyter Notebook
> >
## 全局 ## 全局
@ -946,7 +946,7 @@ CUDA_VISIBLE_DEVICES=0 vllm serve /mnt/e/modelscope/deepseek-ai/DeepSeek-R1-Dist
### Qwen/Qwen3-4B ### Qwen/Qwen3-4B
```shell ```shell
vllm serve ~/modelscope/Qwen/Qwen3-4B --api-key token-abc123 --enable-reasoning --reasoning-parser deepseek_r1 --max_model_len=2048 --gpu_memory_utilization=0.85 vllm serve ~/modelscope/Qwen/Qwen3-4B --api-key token-abc123 --enable-reasoning --reasoning-parser deepseek_r1 --max_model_len=2048 --gpu_memory_utilization=0.85
``` ```
#### supervisor #### supervisor
@ -1166,7 +1166,7 @@ cd LLaMA-Factory
# 安装所需依赖 # 安装所需依赖
pip install -e ".[torch,metrics]" pip install -e ".[torch,metrics]"
# 启动webui # 启动webui
python src/webui.py python src/webui.py
``` ```
## 微调 ## 微调
@ -1255,24 +1255,24 @@ print(f'Model is quantized and saved at "{quant_path}"')
## **1. 核心原理对比** ## **1. 核心原理对比**
| **架构类型** | **核心思想** | **典型模型** | | **架构类型** | **核心思想** | **典型模型** |
| -------------- | ------------------------------------------------------------ | -------------------------- | | -------------- | ------------------------------------------------------------------------------------ | -------------------------- |
| **Dense** | 所有参数对所有输入生效,每层神经元全连接,统一处理所有输入特征。 | GPT-3、BERT、LLAMA | | **Dense** | 所有参数对所有输入生效,每层神经元全连接,统一处理所有输入特征。 | GPT-3、BERT、LLAMA |
| **MoE** | 将模型划分为多个“专家”(子网络),每个输入仅激活部分专家,通过路由机制动态分配任务。 | Switch Transformer、GShard | | **MoE** | 将模型划分为多个“专家”(子网络),每个输入仅激活部分专家,通过路由机制动态分配任务。 | Switch Transformer、GShard |
| **Hybrid-MoE** | 混合Dense和MoE层部分层全连接部分层采用MoE结构平衡计算效率和模型容量。 | DeepSeek-MoE、Google GLaM | | **Hybrid-MoE** | 混合Dense和MoE层部分层全连接部分层采用MoE结构平衡计算效率和模型容量。 | DeepSeek-MoE、Google GLaM |
------ ------
## **2. 技术特点与性能对比** ## **2. 技术特点与性能对比**
| **维度** | **Dense** | **MoE** | **Hybrid-MoE** | | **维度** | **Dense** | **MoE** | **Hybrid-MoE** |
| -------------- | --------------------------------------------------- | ------------------------------------------------------------ | ----------------------------------------- | | -------------- | --------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------- |
| **参数规模** | 总参数量=激活参数量,随层数线性增长。 | 总参数量高(专家数×专家规模),但激活参数量低(仅激活部分专家)。 | 介于两者之间MoE层数可控。 | | **参数规模** | 总参数量=激活参数量,随层数线性增长。 | 总参数量高(专家数×专家规模),但激活参数量低(仅激活部分专家)。 | 介于两者之间MoE层数可控。 |
| **计算效率** | 计算成本高FLOPs与参数量正相关适合小规模模型。 | 相同参数量下FLOPs显著降低仅激活部分专家。 | 通过调整MoE层比例灵活平衡计算开销。 | | **计算效率** | 计算成本高FLOPs与参数量正相关适合小规模模型。 | 相同参数量下FLOPs显著降低仅激活部分专家 | 通过调整MoE层比例灵活平衡计算开销。 |
| **训练稳定性** | 收敛稳定,梯度传播路径简单。 | 路由机制易导致专家负载不均衡,需复杂正则化。 | 稳定性优于纯MoE但仍需路由优化。 | | **训练稳定性** | 收敛稳定,梯度传播路径简单。 | 路由机制易导致专家负载不均衡,需复杂正则化。 | 稳定性优于纯MoE但仍需路由优化。 |
| **扩展性** | 参数规模受硬件限制,千亿级后成本陡增。 | 可扩展至万亿参数如GShard-1.6T),适合超大规模模型。 | 通过局部MoE化实现高效扩展适配中等规模。 | | **扩展性** | 参数规模受硬件限制,千亿级后成本陡增。 | 可扩展至万亿参数如GShard-1.6T),适合超大规模模型。 | 通过局部MoE化实现高效扩展适配中等规模。 |
| **显存占用** | 高(需存储全部参数梯度)。 | 显存需求更高(专家参数独立存储)。 | 显存介于两者之间取决于MoE层占比。 | | **显存占用** | 高(需存储全部参数梯度)。 | 显存需求更高(专家参数独立存储)。 | 显存介于两者之间取决于MoE层占比。 |
| **应用场景** | 通用任务、资源受限场景。 | 超大规模预训练、多任务学习。 | 需平衡性能与成本的工业级应用。 | | **应用场景** | 通用任务、资源受限场景。 | 超大规模预训练、多任务学习。 | 需平衡性能与成本的工业级应用。 |
------ ------
@ -1309,11 +1309,11 @@ print(f'Model is quantized and saved at "{quant_path}"')
## **4. 典型应用场景** ## **4. 典型应用场景**
| **架构** | **适用场景** | | **架构** | **适用场景** |
| -------------- | ------------------------------------------------------------ | | -------------- | ----------------------------------------------------------------------------------- |
| **Dense** | - 中小规模模型(<100B参数 - 对训练稳定性要求高的任务如对话生成 - 边缘设备推理 | | **Dense** | - 中小规模模型(<100B参数 - 对训练稳定性要求高的任务如对话生成 - 边缘设备推理 |
| **MoE** | - 超大规模预训练(>500B参数 - 多任务/多模态学习 - 云端高性能计算集群 | | **MoE** | - 超大规模预训练(>500B参数 - 多任务/多模态学习 - 云端高性能计算集群 |
| **Hybrid-MoE** | - 中等规模模型100B-500B参数 - 需兼顾通用性与效率的工业场景 - 长文本处理任务 | | **Hybrid-MoE** | - 中等规模模型100B-500B参数 - 需兼顾通用性与效率的工业场景 - 长文本处理任务 |
------ ------