MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / StableAudioSession

Method StableAudioSession

src/models/stable_audio/session.cpp:184–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182} // namespace
183
184StableAudioSession::StableAudioSession(
185 runtime::TaskSpec task,
186 runtime::SessionOptions options,
187 std::shared_ptr<const StableAudioAssets> assets)
188 : runtime::RuntimeSessionBase(options),
189 task_(task),
190 assets_(require_assets(std::move(assets))) {
191 max_batch_ = runtime::parse_int_option(options.options, {"stable_audio.max_batch"}).value_or(max_batch_);
192 if (max_batch_ <= 0) {
193 throw std::runtime_error("stable_audio.max_batch must be positive");
194 }
195 if (const auto it = this->options().options.find("stable_audio.weight_type"); it != this->options().options.end()) {
196 weight_storage_type_ = engine::assets::parse_tensor_storage_type(it->second);
197 validate_weight_storage(weight_storage_type_, "stable_audio.weight_type");
198 }
199 if (const auto mem_saver = runtime::find_option(this->options().options, {"stable_audio.mem_saver"})) {
200 mem_saver_ = runtime::parse_bool_option(*mem_saver, "stable_audio.mem_saver");
201 }
202 for (const auto & [key, value] : this->options().options) {
203 if (key == "stable_audio.max_batch" || key == "stable_audio.weight_type" || key == "stable_audio.mem_saver") {
204 (void) value;
205 continue;
206 }
207 if (key.rfind("stable_audio.", 0) == 0) {
208 throw std::runtime_error("unknown Stable Audio session option: " + key);
209 }
210 }
211}
212
213StableAudioSession::~StableAudioSession() = default;
214

Callers

nothing calls this directly

Calls 8

parse_int_optionFunction · 0.85
find_optionFunction · 0.85
parse_bool_optionFunction · 0.85
require_assetsFunction · 0.70
validate_weight_storageFunction · 0.70
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected