Adopt PanPhon realization channel
This commit is contained in:
parent
13c29fea12
commit
21c1046f9d
11 changed files with 89 additions and 27 deletions
|
|
@ -71,13 +71,14 @@ public sealed record SpeechTimingReceipt(
|
|||
[MessagePackObject]
|
||||
public sealed record SpeechUtteranceEmbeddingInputSnapshot(
|
||||
[property: Key(0)] float[] TextEmbedding,
|
||||
[property: Key(1)] float[] Prosody,
|
||||
[property: Key(2)] float[] CharacterState)
|
||||
[property: Key(1)] float[] PhoneticRealization,
|
||||
[property: Key(2)] float[] Prosody,
|
||||
[property: Key(3)] float[] CharacterState)
|
||||
{
|
||||
public UtteranceEmbeddingInput ToInput() => new(TextEmbedding, Prosody, CharacterState);
|
||||
public UtteranceEmbeddingInput ToInput() => new(TextEmbedding, PhoneticRealization, Prosody, CharacterState);
|
||||
|
||||
public static SpeechUtteranceEmbeddingInputSnapshot From(UtteranceEmbeddingInput input) =>
|
||||
new([.. input.SpeechTextEmbedding], [.. input.ProsodyAndEmphasisHints], [.. input.CharacterStateVector]);
|
||||
new([.. input.SpeechTextEmbedding], [.. input.PhoneticRealizationVector], [.. input.ProsodyAndEmphasisHints], [.. input.CharacterStateVector]);
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@ namespace AquaSynth.Dsl;
|
|||
|
||||
public sealed record UtteranceEmbeddingInput(
|
||||
IReadOnlyList<float> SpeechTextEmbedding,
|
||||
IReadOnlyList<float> PhoneticRealizationVector,
|
||||
IReadOnlyList<float> ProsodyAndEmphasisHints,
|
||||
IReadOnlyList<float> CharacterStateVector)
|
||||
{
|
||||
public UtteranceEmbeddingFeatureVector ToFeatureVector()
|
||||
{
|
||||
var values = new float[SpeechTextEmbedding.Count + ProsodyAndEmphasisHints.Count + CharacterStateVector.Count];
|
||||
var values = new float[SpeechTextEmbedding.Count + PhoneticRealizationVector.Count + ProsodyAndEmphasisHints.Count + CharacterStateVector.Count];
|
||||
var offset = Copy(SpeechTextEmbedding, values, 0);
|
||||
offset = Copy(PhoneticRealizationVector, values, offset);
|
||||
offset = Copy(ProsodyAndEmphasisHints, values, offset);
|
||||
Copy(CharacterStateVector, values, offset);
|
||||
return new UtteranceEmbeddingFeatureVector(values);
|
||||
|
|
@ -25,6 +27,35 @@ public sealed record UtteranceEmbeddingInput(
|
|||
}
|
||||
}
|
||||
|
||||
public static class WeksaUtteranceEmbeddingHandoff
|
||||
{
|
||||
public const string SchemaVersion = "weksa.utterance_embedding_handoff.v0.1";
|
||||
public const string SpeechTextEmbeddingModelId = "bge-m3:latest";
|
||||
public const string PhoneticRealizationModelId = "weksa.panphon_realization.v0.1";
|
||||
public const int SpeechTextEmbeddingSize = 1024;
|
||||
public const int PhoneticRealizationVectorSize = 256;
|
||||
public const int ProsodyAndEmphasisHintSize = 32;
|
||||
public const int CharacterStateVectorSize = 64;
|
||||
public const int UtteranceEmbeddingSize = 64;
|
||||
public const int InputSize = SpeechTextEmbeddingSize + PhoneticRealizationVectorSize + ProsodyAndEmphasisHintSize + CharacterStateVectorSize;
|
||||
|
||||
public static void Validate(UtteranceEmbeddingInput input)
|
||||
{
|
||||
ValidateSize(input.SpeechTextEmbedding, SpeechTextEmbeddingSize, nameof(input.SpeechTextEmbedding));
|
||||
ValidateSize(input.PhoneticRealizationVector, PhoneticRealizationVectorSize, nameof(input.PhoneticRealizationVector));
|
||||
ValidateSize(input.ProsodyAndEmphasisHints, ProsodyAndEmphasisHintSize, nameof(input.ProsodyAndEmphasisHints));
|
||||
ValidateSize(input.CharacterStateVector, CharacterStateVectorSize, nameof(input.CharacterStateVector));
|
||||
}
|
||||
|
||||
private static void ValidateSize(IReadOnlyList<float> values, int expected, string name)
|
||||
{
|
||||
if (values.Count != expected)
|
||||
{
|
||||
throw new ArgumentException($"{SchemaVersion} requires {name} to have {expected} values", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record UtteranceEmbeddingFeatureVector(IReadOnlyList<float> Values);
|
||||
|
||||
public sealed record UtteranceEmbedding(IReadOnlyList<float> Values)
|
||||
|
|
|
|||
Loading…
Reference in a new issue