Instructions to use surogate/amami-357m-ro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- NeMo
How to use surogate/amami-357m-ro with NeMo:
# tag did not correspond to a valid NeMo domain.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use surogate/amami-357m-ro with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf surogate/amami-357m-ro # Run inference directly in the terminal: llama cli -hf surogate/amami-357m-ro
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf surogate/amami-357m-ro # Run inference directly in the terminal: llama cli -hf surogate/amami-357m-ro
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf surogate/amami-357m-ro # Run inference directly in the terminal: ./build/bin/llama cli -hf surogate/amami-357m-ro
Use Docker
docker model run hf.co/surogate/amami-357m-ro
- Llama new
- LM Studio
- Jan
- Ollama
How to use surogate/amami-357m-ro with Ollama:
ollama run hf.co/surogate/amami-357m-ro
- Unsloth Desktop
- Docker Model Runner
How to use surogate/amami-357m-ro with Docker Model Runner:
docker model run hf.co/surogate/amami-357m-ro
- Lemonade
How to use surogate/amami-357m-ro with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull surogate/amami-357m-ro
Run and chat with the model
lemonade run user.amami-357m-ro-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Download gpu/source/batch.cpp from surogate/amami-357m-ro: direct link, hf CLI and curl.
- Browser
- Download file 5.63 kB
-
https://huggingface.co/surogate/amami-357m-ro/resolve/main/gpu/source/batch.cpp
- Command line
-
hf download hf://surogate/amami-357m-ro/gpu/source/batch.cpp
-
curl -L -o batch.cpp https://huggingface.co/surogate/amami-357m-ro/resolve/main/gpu/source/batch.cpp
5.63 kB
| // Bounded CPU-only native synthesis probe using exact exported Romanian token IDs. | |
| static bool collect(const uint8_t* pcm, size_t count, void* user) { | |
| auto& audio = *static_cast<std::vector<uint8_t>*>(user); | |
| audio.insert(audio.end(), pcm, pcm + count); | |
| return true; | |
| } | |
| static void le(std::ostream& out, uint32_t value, int bytes) { | |
| for (int index = 0; index < bytes; ++index) out.put(static_cast<char>((value >> (8 * index)) & 255)); | |
| } | |
| static void wav(const std::string& path, const std::vector<uint8_t>& audio, int rate) { | |
| std::ofstream out(path, std::ios::binary); | |
| if (!out) throw std::runtime_error("Cannot open output WAV"); | |
| out.write("RIFF", 4); le(out, 36 + audio.size(), 4); out.write("WAVEfmt ", 8); | |
| le(out, 16, 4); le(out, 1, 2); le(out, 1, 2); le(out, rate, 4); | |
| le(out, rate * 2, 4); le(out, 2, 2); le(out, 16, 2); out.write("data", 4); | |
| le(out, audio.size(), 4); out.write(reinterpret_cast<const char*>(audio.data()), audio.size()); | |
| } | |
| int main(int argc, char** argv) { | |
| if (argc != 5) { std::cerr << "Usage: batch MAGPIE CODEC JOBS OUTPUT_DIR\n"; return 2; } | |
| using namespace nemo_speech::tts; | |
| MagpieRuntimeConfig config; | |
| config.magpie_model = argv[1]; config.codec_model = argv[2]; | |
| config.threads = 4; config.codec_threads = 4; | |
| // SUROGATE_TTS_DEVICE=gpu hands generation, codec and sampling to the GPU backend (Metal or CUDA); default CPU | |
| const char* device = std::getenv("SUROGATE_TTS_DEVICE"); | |
| const bool gpu = device && std::string(device) == "gpu"; | |
| config.magpie_cpu = !gpu; config.codec_cpu = !gpu; config.lt_fp32 = true; | |
| config.lt_backend = gpu ? MagpieBackendPreference::Auto : MagpieBackendPreference::Cpu; | |
| config.sampling_backend = gpu ? MagpieBackendPreference::Auto : MagpieBackendPreference::Cpu; | |
| config.longform_mode = MagpieLongformMode::Auto; | |
| config.seed = 9; config.steps = 900; config.top_k = 80; | |
| config.temperature = .5f; config.override_temperature = true; | |
| config.cfg_scale = 1.5f; config.override_cfg_scale = true; | |
| try { | |
| MagpieTtsRuntime synth(config); | |
| std::ifstream jobs(argv[3]); | |
| std::ofstream report(std::string(argv[4]) + "/stats.jsonl"); | |
| if (!jobs || !report) throw std::runtime_error("Cannot open jobs or stats"); | |
| std::string line; | |
| while (std::getline(jobs, line)) { | |
| std::istringstream fields(line); | |
| std::string id, voice_text, seed_text, temperature_text, guidance_text, encoded; | |
| std::getline(fields, id, '\t'); std::getline(fields, voice_text, '\t'); | |
| std::getline(fields, seed_text, '\t'); std::getline(fields, temperature_text, '\t'); | |
| std::getline(fields, guidance_text, '\t'); std::getline(fields, encoded); | |
| if (id.empty() || id.find_first_not_of("0123456789-v") != std::string::npos) | |
| throw std::runtime_error("Invalid corpus ID"); | |
| MagpieSynthesisOptions options; | |
| options.speaker = std::stoi(voice_text); options.seed = std::stoi(seed_text); | |
| options.temperature = std::stof(temperature_text); | |
| options.cfg_scale = std::stof(guidance_text); | |
| if (!std::isfinite(options.temperature) || options.temperature <= 0 || | |
| !std::isfinite(options.cfg_scale) || options.cfg_scale <= 0) | |
| throw std::runtime_error("Invalid fixed sampling policy"); | |
| options.override_temperature = true; options.override_cfg_scale = true; | |
| std::vector<std::vector<int32_t>> chunks; | |
| std::istringstream pieces(encoded); | |
| std::string piece; | |
| while (std::getline(pieces, piece, ';')) { | |
| std::istringstream values(piece); | |
| std::vector<int32_t> tokens; | |
| int32_t token; | |
| while (values >> token) tokens.push_back(token); | |
| if (tokens.empty()) throw std::runtime_error("Empty input chunk"); | |
| chunks.push_back(std::move(tokens)); | |
| } | |
| if (chunks.empty()) throw std::runtime_error("Empty request"); | |
| const std::string file = std::string(argv[4]) + "/" + id + ".wav"; | |
| if (std::ifstream(file)) throw std::runtime_error("Output exists; do not overwrite audio"); | |
| std::vector<uint8_t> audio; | |
| auto stats = synth.synthesize(chunks, options, [&](const std::string& pcm) { | |
| audio.insert(audio.end(), pcm.begin(), pcm.end()); return true; | |
| }); | |
| if (audio.empty()) throw std::runtime_error("Empty audio output"); | |
| wav(file, audio, stats.sample_rate); | |
| report << "{\"id\":\"" << id << "\",\"voice\":" << options.speaker | |
| << ",\"seed\":" << options.seed << ",\"audio_s\":" << stats.audio_s | |
| << ",\"elapsed_s\":" << stats.elapsed_s << ",\"rtf\":" << stats.rtf | |
| << ",\"temperature\":" << options.temperature << ",\"cfg_scale\":" << options.cfg_scale | |
| << ",\"frames\":" << stats.generated_frames << ",\"input_chunks\":" << chunks.size() | |
| << ",\"sample_rate\":" << stats.sample_rate << "}\n" << std::flush; | |
| std::cout << id << " " << stats.audio_s << " seconds audio in " << stats.elapsed_s << " seconds\n" << std::flush; | |
| } | |
| } catch (const std::exception& error) { | |
| std::cerr << error.what() << '\n'; return 3; | |
| } | |
| } | |