voice_audio_multi/tests/vibevoice/torch_bin_parity.cpp
Fabio c36510c21e
Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

35 lines
1.3 KiB
C++

#include "engine/framework/assets/torch_bin.h"
#include <cstdio>
#include <string>
#include <vector>
int main(int argc, char ** argv) {
const std::string path = argc > 1
? argv[1]
: "E:/REPOS/VIBEVOICE-MAIN/VibeVoice/loras/mp1/semantic_connector/pytorch_model.bin";
try {
const auto source = engine::assets::open_torch_bin_tensor_source(path);
std::printf("torch .bin: %s\n", path.c_str());
for (const auto & meta : source->tensors()) {
const auto values = source->require_f32(meta.name);
double sum = 0.0;
for (const float value : values) {
sum += value;
}
std::printf("%-16s dtype=%-4s shape=[", meta.name.c_str(), meta.dtype.c_str());
for (size_t i = 0; i < meta.shape.size(); ++i) {
std::printf("%s%lld", i == 0 ? "" : ",", static_cast<long long>(meta.shape[i]));
}
std::printf("] mean=%.8f first8=", sum / static_cast<double>(values.size()));
for (size_t i = 0; i < values.size() && i < 8; ++i) {
std::printf("%s%.6f", i == 0 ? "" : ",", values[i]);
}
std::printf("\n");
}
} catch (const std::exception & error) {
std::fprintf(stderr, "torch_bin_parity failed: %s\n", error.what());
return 1;
}
return 0;
}