go : add temperature options (#2417)
* Fixed go cuda bindings building * Added note to go bindings Readme to build using cuda support * Added temperature bindings for Go --------- Co-authored-by: Binozo <entwickler@binozoworks.de>
This commit is contained in:
parent
bea43e0c64
commit
34972dbe22
@ -131,6 +131,16 @@ func (p *Params) SetEntropyThold(t float32) {
|
|||||||
p.entropy_thold = C.float(t)
|
p.entropy_thold = C.float(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Params) SetTemperature(t float32) {
|
||||||
|
p.temperature = C.float(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the fallback temperature incrementation
|
||||||
|
// Pass -1.0 to disable this feature
|
||||||
|
func (p *Params) SetTemperatureFallback(t float32) {
|
||||||
|
p.temperature_inc = C.float(t)
|
||||||
|
}
|
||||||
|
|
||||||
// Set initial prompt
|
// Set initial prompt
|
||||||
func (p *Params) SetInitialPrompt(prompt string) {
|
func (p *Params) SetInitialPrompt(prompt string) {
|
||||||
p.initial_prompt = C.CString(prompt)
|
p.initial_prompt = C.CString(prompt)
|
||||||
@ -162,6 +172,8 @@ func (p *Params) String() string {
|
|||||||
str += fmt.Sprintf(" audio_ctx=%d", p.audio_ctx)
|
str += fmt.Sprintf(" audio_ctx=%d", p.audio_ctx)
|
||||||
str += fmt.Sprintf(" initial_prompt=%s", C.GoString(p.initial_prompt))
|
str += fmt.Sprintf(" initial_prompt=%s", C.GoString(p.initial_prompt))
|
||||||
str += fmt.Sprintf(" entropy_thold=%f", p.entropy_thold)
|
str += fmt.Sprintf(" entropy_thold=%f", p.entropy_thold)
|
||||||
|
str += fmt.Sprintf(" temperature=%f", p.temperature)
|
||||||
|
str += fmt.Sprintf(" temperature_inc=%f", p.temperature_inc)
|
||||||
str += fmt.Sprintf(" beam_size=%d", p.beam_search.beam_size)
|
str += fmt.Sprintf(" beam_size=%d", p.beam_search.beam_size)
|
||||||
if p.translate {
|
if p.translate {
|
||||||
str += " translate"
|
str += " translate"
|
||||||
|
@ -140,6 +140,17 @@ func (context *context) SetEntropyThold(t float32) {
|
|||||||
context.params.SetEntropyThold(t)
|
context.params.SetEntropyThold(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set Temperature
|
||||||
|
func (context *context) SetTemperature(t float32) {
|
||||||
|
context.params.SetTemperature(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the fallback temperature incrementation
|
||||||
|
// Pass -1.0 to disable this feature
|
||||||
|
func (context *context) SetTemperatureFallback(t float32) {
|
||||||
|
context.params.SetTemperatureFallback(t)
|
||||||
|
}
|
||||||
|
|
||||||
// Set initial prompt
|
// Set initial prompt
|
||||||
func (context *context) SetInitialPrompt(prompt string) {
|
func (context *context) SetInitialPrompt(prompt string) {
|
||||||
context.params.SetInitialPrompt(prompt)
|
context.params.SetInitialPrompt(prompt)
|
||||||
|
@ -52,6 +52,8 @@ type Context interface {
|
|||||||
SetBeamSize(n int) // Set Beam Size
|
SetBeamSize(n int) // Set Beam Size
|
||||||
SetEntropyThold(t float32) // Set Entropy threshold
|
SetEntropyThold(t float32) // Set Entropy threshold
|
||||||
SetInitialPrompt(prompt string) // Set initial prompt
|
SetInitialPrompt(prompt string) // Set initial prompt
|
||||||
|
SetTemperature(t float32) // Set temperature
|
||||||
|
SetTemperatureFallback(t float32) // Set temperature incrementation
|
||||||
|
|
||||||
// Process mono audio data and return any errors.
|
// Process mono audio data and return any errors.
|
||||||
// If defined, newly generated segments are passed to the
|
// If defined, newly generated segments are passed to the
|
||||||
|
Loading…
Reference in New Issue
Block a user