Instructions to use litert-community/ZONOS3-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/ZONOS3-Mini with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download host/core.hpp from litert-community/ZONOS3-Mini: direct link, hf CLI and curl.
- Browser
- Download file 1.71 kB
-
https://huggingface.co/litert-community/ZONOS3-Mini/resolve/main/host/core.hpp
- Command line
-
hf download hf://litert-community/ZONOS3-Mini/host/core.hpp
-
curl -L -o core.hpp https://huggingface.co/litert-community/ZONOS3-Mini/resolve/main/host/core.hpp
1.71 kB
| namespace fs = std::filesystem; | |
| using Floats = std::vector<float>; | |
| using Row = std::array<int32_t, 10>; | |
| struct View { const float* data; size_t size; }; | |
| inline View view(const Floats& v) { return {v.data(), v.size()}; } | |
| inline void require(bool ok, const std::string& reason) { | |
| if (!ok) throw std::runtime_error(reason); | |
| } | |
| template<class T> std::vector<T> read_file(const fs::path& p, size_t expected = 0) { | |
| auto bytes = fs::file_size(p); | |
| require(bytes % sizeof(T) == 0 && (!expected || bytes == expected * sizeof(T)), "bad size: " + p.string()); | |
| std::vector<T> data(bytes / sizeof(T)); | |
| std::ifstream f(p, std::ios::binary); | |
| require(bool(f.read(reinterpret_cast<char*>(data.data()), bytes)), "read: " + p.string()); | |
| return data; | |
| } | |
| template<class T> void write_file(const fs::path& p, const std::vector<T>& data) { | |
| std::ofstream f(p, std::ios::binary); | |
| f.write(reinterpret_cast<const char*>(data.data()), data.size()*sizeof(T)); | |
| f.close(); | |
| require(bool(f), "write: " + p.string()); | |
| } | |
| using Outputs = std::vector<Floats*>; | |
| class Graph { | |
| public: | |
| virtual void run(const std::vector<View>& inputs, const Outputs& outputs) = 0; | |
| virtual ~Graph() = default; | |
| }; | |
| std::unique_ptr<Graph> open_graph(const fs::path& model, bool decoder); | |
| Floats decode_audio(const Floats& head, int frames, const fs::path& shared); | |
| void save_audio(const fs::path& dest, const Floats& wav); | |