@@ -18,7 +18,7 @@ class LanguageModel extends EventEmitter {
18
18
this . options = {
19
19
modelUrl : '' , // if set, model.bin will be preloaded from provided URL (assumed to be embedded in llama2.data if not)
20
20
tokenizerUrl : '' , // if set, tokenizer.bin will be preloaded from provided URL (assumed to be embedded in llama2.data if not)
21
- steps : 0 , // how many tokens to generate (defaults to model's maximum)
21
+ maxTokens : 0 , // how many tokens to generate (defaults to model's maximum)
22
22
temperature : 1.0 , // 0.0 = (deterministic) argmax sampling, 1.0 = baseline, don't set higher
23
23
topp : 0.9 , // p value in top-p (nucleus) sampling, 0 = off
24
24
stopOnBosOrEos : true , // stop when encountering beginning-of-sequence or end-of-sequence token
@@ -163,7 +163,7 @@ class LanguageModel extends EventEmitter {
163
163
this . callback = optionsOrCb ;
164
164
} else {
165
165
if ( typeof optionsOrCb === 'object' ) {
166
- this . options . steps = ( typeof optionsOrCb . steps === 'number' ) ? optionsOrCb . steps : this . options . steps ;
166
+ this . options . maxTokens = ( typeof optionsOrCb . maxTokens === 'number' ) ? optionsOrCb . maxTokens : this . options . maxTokens ;
167
167
this . options . temperature = ( typeof optionsOrCb . temperature === 'number' ) ? optionsOrCb . temperature : this . options . temperature ;
168
168
this . options . topp = ( typeof optionsOrCb . topp === 'number' ) ? optionsOrCb . topp : this . options . topp ;
169
169
this . options . stopOnBosOrEos = ( typeof optionsOrCb . stopOnBosOrEos == 'boolean' ) ? optionsOrCb . stopPropagation : this . options . stopOnBosOrEos ;
@@ -181,7 +181,7 @@ class LanguageModel extends EventEmitter {
181
181
this . promiseResolve ( this . text ) ;
182
182
}
183
183
184
- await this . llama2 . ccall ( 'set_parameters' , null , [ 'number' , 'number' , 'number' ] , [ this . options . temperature , this . options . topp , this . options . steps ] ) ;
184
+ await this . llama2 . ccall ( 'set_parameters' , null , [ 'number' , 'number' , 'number' ] , [ this . options . temperature , this . options . topp , this . options . maxTokens ] ) ;
185
185
186
186
this . prompt = prompt ;
187
187
this . text = '' ;
@@ -220,7 +220,7 @@ class LanguageModel extends EventEmitter {
220
220
this . callback = optionsOrCb ;
221
221
} else {
222
222
if ( typeof optionsOrCb === 'object' ) {
223
- this . options . steps = ( typeof optionsOrCb . steps === 'number' ) ? optionsOrCb . steps : this . options . steps ;
223
+ this . options . maxTokens = ( typeof optionsOrCb . maxTokens === 'number' ) ? optionsOrCb . maxTokens : this . options . maxTokens ;
224
224
this . options . temperature = ( typeof optionsOrCb . temperature === 'number' ) ? optionsOrCb . temperature : this . options . temperature ;
225
225
this . options . topp = ( typeof optionsOrCb . topp === 'number' ) ? optionsOrCb . topp : this . options . topp ;
226
226
this . options . stopOnBosOrEos = ( typeof optionsOrCb . stopOnBosOrEos == 'boolean' ) ? optionsOrCb . stopPropagation : this . options . stopOnBosOrEos ;
@@ -238,7 +238,7 @@ class LanguageModel extends EventEmitter {
238
238
this . promiseResolve ( this . text ) ;
239
239
}
240
240
241
- await this . llama2 . ccall ( 'set_parameters' , null , [ 'number' , 'number' , 'number' ] , [ this . options . temperature , this . options . topp , this . options . steps ] ) ;
241
+ await this . llama2 . ccall ( 'set_parameters' , null , [ 'number' , 'number' , 'number' ] , [ this . options . temperature , this . options . topp , this . options . maxTokens ] ) ;
242
242
243
243
this . prompt = prompt ;
244
244
this . text = '' ;
0 commit comments