@dr33m/react-native-litert-lm 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/HybridLiteRTLM.swift +10 -9
- package/package.json +1 -1
package/ios/HybridLiteRTLM.swift
CHANGED
|
@@ -431,15 +431,16 @@ public class HybridLiteRTLM: HybridLiteRTLMSpec_base, HybridLiteRTLMSpec_protoco
|
|
|
431
431
|
|
|
432
432
|
litert_lm_session_config_set_max_output_tokens(sessionConfig, Int32(self.maxOutputTokens))
|
|
433
433
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
sampler
|
|
438
|
-
|
|
439
|
-
sampler.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
434
|
+
// v0.15: sampler params are opaque — built through create/setters
|
|
435
|
+
// instead of a stack struct. set_sampler_params copies the values into
|
|
436
|
+
// the session config, so the params can be freed when this scope ends.
|
|
437
|
+
guard let sampler = litert_lm_sampler_params_create(kLiteRtLmSamplerTypeTopP) else { return }
|
|
438
|
+
defer { litert_lm_sampler_params_delete(sampler) }
|
|
439
|
+
litert_lm_sampler_params_set_top_k(sampler, Int32(self.topK))
|
|
440
|
+
litert_lm_sampler_params_set_top_p(sampler, Float(self.topP))
|
|
441
|
+
litert_lm_sampler_params_set_temperature(sampler, Float(self.temperature))
|
|
442
|
+
litert_lm_sampler_params_set_seed(sampler, 0)
|
|
443
|
+
litert_lm_session_config_set_sampler_params(sessionConfig, sampler)
|
|
443
444
|
|
|
444
445
|
litert_lm_conversation_config_set_session_config(convConfig, sessionConfig)
|
|
445
446
|
|