23 std::span<const std::string_view>
labels;
85 [[nodiscard]]
static std::string_view
label(uint32_t index)
noexcept;
88 [[nodiscard]]
static bool is_vowel(uint32_t index)
noexcept;
94 [[nodiscard]] static uint32_t
frame_count(
size_t samples) noexcept;
123 [[nodiscard]]
std::vector<
float>
process(
std::span<const
float> samples);
149 [[nodiscard]] DeviceBuffer posterior_buffer();
152 [[nodiscard]] DeviceBuffer hidden_buffer();
Non-template base that owns all type-independent GPU dispatch logic.
Shared command buffer for GPU dispatch work.
static constexpr uint32_t frame_hop
Samples between the starts of successive frames.
static constexpr uint32_t phonemes
Classes 0 to phonemes - 1 are phonemes.
HubertPhonemeModel(const Kakshya::TensorSet &weights)
Upload the weights and prepare the GPU resources.
static constexpr uint32_t classes
Scores per frame.
static bool is_vowel(uint32_t index) noexcept
Whether a class is a vowel phoneme.
std::unique_ptr< Impl > m_impl
static std::string diagnose(const Kakshya::TensorSet &weights)
Check that a tensor set holds the weights the network needs.
static constexpr uint32_t blank_class
Class the network emits between phonemes.
static constexpr uint32_t sample_rate
Sample rate in Hz the network was trained and runs at.
static PhonemeVocabulary vocabulary() noexcept
The vocabulary of this network: the names, the phoneme count, the blank class and the vowels.
static std::string_view label(uint32_t index) noexcept
Name of a class: the ARPABET symbol of a phoneme, or a bracketed name for the others.
std::vector< float > process(std::span< const float > samples)
Run one utterance.
static constexpr uint32_t frame_span
Samples one frame's features are computed from.
size_t resident_frames() const noexcept
Frames the latest utterance left on the device.
static constexpr uint32_t hidden_width
Width of the state before the final layer.
static constexpr size_t max_samples
Longest utterance one call accepts, 30 s.
std::vector< float > hidden_states()
The state before the final layer for every frame of the latest utterance.
static uint32_t frame_count(size_t samples) noexcept
Frames an utterance of this many samples gives, 0 below frame_span samples.
Named tensors that belong together, such as a model's weights or I/O.
const GpuDispatchCore * context
Where a result of the latest utterance is on the device.
uint32_t blank
Class the network emits between phonemes.
std::span< const uint32_t > vowels
Classes that are vowel phonemes, as HubertPhonemeModel::is_vowel gives them.
uint32_t phonemes
Classes 0 to phonemes - 1 are phonemes.
std::span< const std::string_view > labels
Name of each class, as HubertPhonemeModel::label gives it.
The classes of a phoneme network: their names, how many are phonemes, the blank class,...