Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TensorSpeech
GitHub Repository: TensorSpeech/TensorFlowTTS
Path: blob/master/examples/cppwin/TensorflowTTSCppInference/FastSpeech2.h
1559 views
1
#pragma once
2
3
#include "ext/CppFlow/include/Model.h"
4
#include "VoxCommon.hpp"
5
class FastSpeech2
6
{
7
private:
8
Model* FastSpeech;
9
10
public:
11
FastSpeech2();
12
FastSpeech2(const std::string& SavedModelFolder);
13
14
/*
15
Initialize and load the model
16
17
-> SavedModelFolder: Folder where the .pb, variables, and other characteristics of the exported SavedModel
18
<- Returns: (bool)Success
19
*/
20
bool Initialize(const std::string& SavedModelFolder);
21
22
/*
23
Do inference on a FastSpeech2 model.
24
25
-> InputIDs: Input IDs of tokens for inference
26
-> SpeakerID: ID of the speaker in the model to do inference on. If single speaker, always leave at 0. If multispeaker, refer to your model.
27
-> Speed, Energy, F0: Parameters for FS2 inference. Leave at 1.f for defaults
28
29
<- Returns: TFTensor<float> with shape {1,<len of mel in frames>,80} containing contents of mel spectrogram.
30
*/
31
TFTensor<float> DoInference(const std::vector<int32_t>& InputIDs, int32_t SpeakerID = 0, float Speed = 1.f, float Energy = 1.f, float F0 = 1.f,int32_t EmotionID = -1);
32
33
34
35
~FastSpeech2();
36
};
37
38
39