| 131 | }; |
| 132 | |
| 133 | struct bark_context { |
| 134 | struct bark_model text_model; |
| 135 | |
| 136 | struct encodec_context* encodec_ctx; |
| 137 | |
| 138 | // buffer for model evaluation |
| 139 | ggml_backend_buffer_t buf_compute; |
| 140 | |
| 141 | // custom allocator |
| 142 | struct ggml_allocr* allocr = NULL; |
| 143 | int n_gpu_layers = 0; |
| 144 | |
| 145 | std::mt19937 rng; |
| 146 | |
| 147 | bark_sequence tokens; |
| 148 | bark_sequence semantic_tokens; |
| 149 | |
| 150 | bark_codes coarse_tokens; |
| 151 | bark_codes fine_tokens; |
| 152 | |
| 153 | float* generated_audio = NULL; |
| 154 | int n_generated_samples = 0; |
| 155 | |
| 156 | // hyperparameters |
| 157 | bark_context_params params; |
| 158 | |
| 159 | // encodec parameters |
| 160 | std::string encodec_model_path; |
| 161 | |
| 162 | // statistics |
| 163 | bark_statistics stats; |
| 164 | }; |
| 165 | |
| 166 | template <typename T> |
| 167 | static void read_safe(std::ifstream& fin, T& dest) { |
nothing calls this directly
no outgoing calls
no test coverage detected