模型参数中模型基本参数默认值

This commit is contained in:
junleea 2025-03-28 16:08:01 +08:00
parent abd613d97a
commit cae326a598
2 changed files with 23 additions and 0 deletions

View File

@ -41,6 +41,21 @@ type ModelParam struct {
TopP float64 `json:"topP"` //取 TopP float64 `json:"topP"` //取
} }
func (m *ModelParam) SetDefaultParams() {
if m.Temperature == 0 {
m.Temperature = DefaultTemperature
}
if m.MaxTokens == 0 {
m.MaxTokens = DefaultMaxTokens
}
if m.TopK == 0 {
m.TopK = DefaultTopK
}
if m.TopP == 0 {
m.TopP = DefaultTopP
}
}
type SessionResponse struct { type SessionResponse struct {
gorm.Model gorm.Model
UserID int `gorm:"column:user_id"` //只能由用户创建 UserID int `gorm:"column:user_id"` //只能由用户创建

View File

@ -130,3 +130,11 @@ const (
SparkContextLength = 6 SparkContextLength = 6
DouBaoContextLength = 6 DouBaoContextLength = 6
) )
// 模型参数
const (
DefaultTemperature = 0.5
DefaultMaxTokens = 4096
DefaultTopK = 0.5
DefaultTopP = 0.8
)