Chore: panic is not solved (WIP)
This commit is contained in:
2
bot.go
2
bot.go
@@ -418,7 +418,9 @@ func fetchLCPModelsWithStatus() (*models.LCPModels, error) {
|
||||
if err := json.NewDecoder(resp.Body).Decode(data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
localModelsMu.Lock()
|
||||
localModelsData = data
|
||||
localModelsMu.Unlock()
|
||||
return data, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ func (o *KokoroONNXOrator) ensureInitialized(modelPath string) error {
|
||||
} else {
|
||||
// Shape is (510, 1, 256), we want the last 256 values (or first? let's use mean or just pick one)
|
||||
// Actually, let's average across all 510 to get a single 256-dim vector
|
||||
if len(styleVec) != 510*256 {
|
||||
o.logger.Error("voice embedding has unexpected size", "len", len(styleVec))
|
||||
err = fmt.Errorf("voice embedding has unexpected size", "len", len(styleVec))
|
||||
return err
|
||||
}
|
||||
o.styleVector = make([]float32, 256)
|
||||
for i := 0; i < 256; i++ {
|
||||
var sum float32
|
||||
|
||||
Reference in New Issue
Block a user