File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ public sealed class DefaultSamplingPipeline
2020 /// </summary>
2121 public float RepeatPenalty { get ; init ; } = 1 ;
2222
23-
2423 /// <summary>
2524 /// Frequency penalty as described by OpenAI: https://platform.openai.com/docs/api-reference/chat/create<br />
2625 /// Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text
@@ -156,7 +155,16 @@ public float PresencePenalty
156155 /// <summary>
157156 /// Seed to use for random sampling
158157 /// </summary>
159- public uint Seed { get ; set ; } = ( uint ) new Random ( ) . Next ( 0 , int . MaxValue ) ;
158+ public uint Seed { get ; set ; } = GetRandomSeed ( ) ;
159+
160+
161+ private static Random RandomSeedGenerator = new ( ) ;
162+ private static uint GetRandomSeed ( )
163+ {
164+ lock ( RandomSeedGenerator )
165+ return ( uint ) RandomSeedGenerator . Next ( 0 , int . MaxValue ) + ( uint ) RandomSeedGenerator . Next ( 0 , int . MaxValue ) ;
166+ }
167+
160168
161169 /// <inheritdoc />
162170 protected override SafeLLamaSamplerChainHandle CreateChain ( SafeLLamaContextHandle context )
You can’t perform that action at this time.
0 commit comments