Selaa lähdekoodia

fix: qwen top_p min/max wrong (#2044)

takatost 1 vuosi sitten
vanhempi
commit
b582fc13c3

+ 2 - 2
api/core/model_runtime/entities/model_entities.py

@@ -149,8 +149,8 @@ class ParameterRule(BaseModel):
     help: Optional[I18nObject] = None
     required: bool = False
     default: Optional[Any] = None
-    min: Optional[float | int] = None
-    max: Optional[float | int] = None
+    min: Optional[float] = None
+    max: Optional[float] = None
     precision: Optional[int] = None
     options: list[str] = []
 

+ 2 - 0
api/core/model_runtime/model_providers/tongyi/llm/qwen-max-1201.yaml

@@ -17,6 +17,8 @@ parameter_rules:
   - name: top_p
     use_template: top_p
     default: 0.8
+    min: 0.1
+    max: 0.9
     help:
       zh_Hans: 生成过程中核采样方法概率阈值,例如,取值为0.8时,仅保留概率加起来大于等于0.8的最可能token的最小集合作为候选集。取值范围为(0,1.0),取值越大,生成的随机性越高;取值越低,生成的确定性越高。
       en_US: The probability threshold of the kernel sampling method during the generation process. For example, when the value is 0.8, only the smallest set of the most likely tokens with a sum of probabilities greater than or equal to 0.8 is retained as the candidate set. The value range is (0,1.0). The larger the value, the higher the randomness generated; the lower the value, the higher the certainty generated.

+ 2 - 0
api/core/model_runtime/model_providers/tongyi/llm/qwen-max-longcontext.yaml

@@ -17,6 +17,8 @@ parameter_rules:
   - name: top_p
     use_template: top_p
     default: 0.8
+    min: 0.1
+    max: 0.9
     help:
       zh_Hans: 生成过程中核采样方法概率阈值,例如,取值为0.8时,仅保留概率加起来大于等于0.8的最可能token的最小集合作为候选集。取值范围为(0,1.0),取值越大,生成的随机性越高;取值越低,生成的确定性越高。
       en_US: The probability threshold of the kernel sampling method during the generation process. For example, when the value is 0.8, only the smallest set of the most likely tokens with a sum of probabilities greater than or equal to 0.8 is retained as the candidate set. The value range is (0,1.0). The larger the value, the higher the randomness generated; the lower the value, the higher the certainty generated.

+ 2 - 0
api/core/model_runtime/model_providers/tongyi/llm/qwen-max.yaml

@@ -17,6 +17,8 @@ parameter_rules:
   - name: top_p
     use_template: top_p
     default: 0.8
+    min: 0.1
+    max: 0.9
     help:
       zh_Hans: 生成过程中核采样方法概率阈值,例如,取值为0.8时,仅保留概率加起来大于等于0.8的最可能token的最小集合作为候选集。取值范围为(0,1.0),取值越大,生成的随机性越高;取值越低,生成的确定性越高。
       en_US: The probability threshold of the kernel sampling method during the generation process. For example, when the value is 0.8, only the smallest set of the most likely tokens with a sum of probabilities greater than or equal to 0.8 is retained as the candidate set. The value range is (0,1.0). The larger the value, the higher the randomness generated; the lower the value, the higher the certainty generated.

+ 2 - 0
api/core/model_runtime/model_providers/tongyi/llm/qwen-plus.yaml

@@ -17,6 +17,8 @@ parameter_rules:
   - name: top_p
     use_template: top_p
     default: 0.8
+    min: 0.1
+    max: 0.9
     help:
       zh_Hans: 生成过程中核采样方法概率阈值,例如,取值为0.8时,仅保留概率加起来大于等于0.8的最可能token的最小集合作为候选集。取值范围为(0,1.0),取值越大,生成的随机性越高;取值越低,生成的确定性越高。
       en_US: The probability threshold of the kernel sampling method during the generation process. For example, when the value is 0.8, only the smallest set of the most likely tokens with a sum of probabilities greater than or equal to 0.8 is retained as the candidate set. The value range is (0,1.0). The larger the value, the higher the randomness generated; the lower the value, the higher the certainty generated.

+ 2 - 0
api/core/model_runtime/model_providers/tongyi/llm/qwen-turbo.yaml

@@ -17,6 +17,8 @@ parameter_rules:
   - name: top_p
     use_template: top_p
     default: 0.8
+    min: 0.1
+    max: 0.9
     help:
       zh_Hans: 生成过程中核采样方法概率阈值,例如,取值为0.8时,仅保留概率加起来大于等于0.8的最可能token的最小集合作为候选集。取值范围为(0,1.0),取值越大,生成的随机性越高;取值越低,生成的确定性越高。
       en_US: The probability threshold of the kernel sampling method during the generation process. For example, when the value is 0.8, only the smallest set of the most likely tokens with a sum of probabilities greater than or equal to 0.8 is retained as the candidate set. The value range is (0,1.0). The larger the value, the higher the randomness generated; the lower the value, the higher the certainty generated.