| 5 | #include <vector> |
| 6 | |
| 7 | int main(int argc, char ** argv) { |
| 8 | const std::string path = argc > 1 |
| 9 | ? argv[1] |
| 10 | : "E:/REPOS/VIBEVOICE-MAIN/VibeVoice/loras/mp1/semantic_connector/pytorch_model.bin"; |
| 11 | try { |
| 12 | const auto source = engine::assets::open_torch_bin_tensor_source(path); |
| 13 | std::printf("torch .bin: %s\n", path.c_str()); |
| 14 | for (const auto & meta : source->tensors()) { |
| 15 | const auto values = source->require_f32(meta.name); |
| 16 | double sum = 0.0; |
| 17 | for (const float value : values) { |
| 18 | sum += value; |
| 19 | } |
| 20 | std::printf("%-16s dtype=%-4s shape=[", meta.name.c_str(), meta.dtype.c_str()); |
| 21 | for (size_t i = 0; i < meta.shape.size(); ++i) { |
| 22 | std::printf("%s%lld", i == 0 ? "" : ",", static_cast<long long>(meta.shape[i])); |
| 23 | } |
| 24 | std::printf("] mean=%.8f first8=", sum / static_cast<double>(values.size())); |
| 25 | for (size_t i = 0; i < values.size() && i < 8; ++i) { |
| 26 | std::printf("%s%.6f", i == 0 ? "" : ",", values[i]); |
| 27 | } |
| 28 | std::printf("\n"); |
| 29 | } |
| 30 | } catch (const std::exception & error) { |
| 31 | std::fprintf(stderr, "torch_bin_parity failed: %s\n", error.what()); |
| 32 | return 1; |
| 33 | } |
| 34 | return 0; |
| 35 | } |
nothing calls this directly
no test coverage detected