1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #include "ggml/ggml.h"
- #include "ggml/ggml-alloc.h"
- #include "math.h"
- #include "model_loader.h"
- #include "fairseq2.h"
- #include <thread>
- #include <cassert>
- #include <cmath>
- #include <cstdio>
- #include <cstring>
- #include <fstream>
- #include <map>
- #include <string>
- #include <vector>
- #include <iostream>
- #include <cstdlib>
- struct Result {
- std::vector<std::string> transcription;
- std::vector<float> word_confidence_scores;
- std::unordered_map<std::string, float> lid_scores;
- int err;
- };
- struct ggml_cgraph * unity_speech_encoder(
- fairseq2_model& model,
- struct ggml_tensor * speech_input);
- Hypothesis* unity_decode(
- fairseq2_model& model,
- const SequenceGeneratorOptions& opts,
- int tgt_lang_idx,
- ggml_tensor* encoder_output,
- int n_threads
- );
- extern "C" fairseq2_model unity_init_model(const char* model_path);
- extern "C" Result unity_eval(fairseq2_model model, std::vector<float> data, SequenceGeneratorOptions opts, std::string tgt_lang, int n_threads, int memory_gb);
|