Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/models/fish_drama3.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ CPU PyTorch dependencies managed by uv and does not load weights onto a GPU.

## Generate and stream

Tower decode and codebook sampling use one cached backend graph by default.
Set `--session-option fish_drama3.device_sampling=false` to use host sampling.
Host sampling is used by default. Set
`--session-option fish_drama3.device_sampling=true` to enable tower decode and
codebook sampling in one cached backend graph, or select the `cuda_perf` preset.
Graph probability arithmetic is F32, so sampled outputs may differ from host sampling.

`fish_drama3.perf_mode` defaults to `off`. The opt-in `cuda_perf` preset sets
Expand All @@ -137,14 +138,14 @@ the following defaults; explicit session options override the preset:
| `fish_drama3.fused_moe` | `false` | `true` | Cached-decode routing and SwiGLU fusion. |
| `fish_drama3.kv_cache_type` | `f16` | `f16` | KV storage precision, not weight precision. Set `f32` to use F32 KV storage. |
| `fish_drama3.kv_cache_alignment` | `1` | `256` | Cached attention-prefix buckets; all history retained. |
| `fish_drama3.device_sampling` | `true` | `true` | Cached tower decode and device sampling; existing default retained. |
| `fish_drama3.device_sampling` | `false` | `true` | Cached tower decode and device sampling. |
| `fish_drama3.codec_batch_frames` | `4` | `4` | Streaming codec batch ceiling; existing default retained. |
| `fish_drama3.codec_async_decode` | `true` | `true` | Streaming AR/codec overlap; existing default retained. |
| `fish_drama3.backbone_prefill_cache_mb` | `256` | `256` | Backbone prefill graph-cache budget in MiB; existing default retained. |
| `fish_drama3.tower_prefill_cache_mb` | `256` | `256` | Tower prefill graph-cache budget in MiB; existing default retained. |

`off` disables only the new preset optimizations, not the existing performance
defaults listed above. `cuda_perf` leaves those existing controls unchanged.
`off` retains the defaults listed above. Explicit session options override either
preset, including `fish_drama3.device_sampling=false` with `cuda_perf`.

Fused arithmetic and attention shapes can change sampled audio. To enable the
combined CUDA path, add:
Expand Down
2 changes: 1 addition & 1 deletion include/engine/community_models/fish_drama3/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Drama3Generator {
int64_t cache_steps_;
bool profile_first_audio_ = false;
bool disk_experts_ = false;
bool device_sampling_ = true;
bool device_sampling_ = false;
size_t codec_batch_frames_ = 4;
bool codec_async_decode_ = true;
runtime::StreamingAudioController<int32_t> streaming_audio_;
Expand Down
6 changes: 3 additions & 3 deletions model_specs/fish_drama3.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
{
"name": "perf_mode",
"type": "enum",
"description": "AR decode preset. cuda_perf enables fused MoE and 256-row attention buckets. F16 KV storage, device sampling, codec batching/overlap and prefill-cache defaults remain unchanged in both modes. Explicit session options override the preset.",
"description": "AR decode preset. cuda_perf enables fused MoE, 256-row attention buckets and device sampling. F16 KV storage, codec batching/overlap and prefill-cache defaults remain unchanged in both modes. Explicit session options override the preset.",
"required": false,
"values": [
"off",
Expand Down Expand Up @@ -198,9 +198,9 @@
{
"name": "device_sampling",
"type": "bool",
"description": "Enable tower decode and codebook sampling in one cached backend graph. Uses F32 probabilities; sampled outputs may differ from the host sampler.",
"description": "Enable tower decode and codebook sampling in one cached backend graph. Disabled by default; enabled by cuda_perf unless explicitly overridden. Uses F32 probabilities; sampled outputs may differ from the host sampler.",
"required": false,
"default": true
"default": false
},
{
"name": "profile_first_audio",
Expand Down
13 changes: 8 additions & 5 deletions src/community_models/fish_drama3/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ struct PerfPreset {
bool fused_moe;
ggml_type kv_cache_type;
int64_t kv_cache_alignment;
bool device_sampling;
};

constexpr std::array<PerfPreset, 2> kPerfPresets{{
{"off", false, GGML_TYPE_F16, 1},
{"cuda_perf", true, GGML_TYPE_F16, 256},
{"off", false, GGML_TYPE_F16, 1, false},
{"cuda_perf", true, GGML_TYPE_F16, 256, true},
}};

struct SamplerScratch {
Expand Down Expand Up @@ -97,9 +98,6 @@ Drama3Generator::Drama3Generator(std::shared_ptr<const Drama3Assets> assets,
if (const auto value = runtime::find_option(options.options, {"fish_drama3.profile_first_audio"})) {
profile_first_audio_ = runtime::parse_bool_option(*value, "fish_drama3.profile_first_audio");
}
if (const auto value = runtime::find_option(options.options, {"fish_drama3.device_sampling"})) {
device_sampling_ = runtime::parse_bool_option(*value, "fish_drama3.device_sampling");
}
codec_batch_frames_ = static_cast<size_t>(runtime::parse_positive_i64_option(
options.options, {"fish_drama3.codec_batch_frames"}, 4));
if (const auto value = runtime::find_option(options.options, {"fish_drama3.codec_async_decode"})) {
Expand All @@ -111,6 +109,10 @@ Drama3Generator::Drama3Generator(std::shared_ptr<const Drama3Assets> assets,
const auto preset = std::find_if(kPerfPresets.begin(), kPerfPresets.end(),
[&](const auto & entry) { return entry.name == perf_mode; });
if (preset == kPerfPresets.end()) throw std::runtime_error("Invalid fish_drama3.perf_mode: " + perf_mode);
device_sampling_ = preset->device_sampling;
if (const auto value = runtime::find_option(options.options, {"fish_drama3.device_sampling"})) {
device_sampling_ = runtime::parse_bool_option(*value, "fish_drama3.device_sampling");
}
backbone_config.fused_moe = preset->fused_moe;
backbone_config.kv_cache_type = preset->kv_cache_type;
backbone_config.kv_cache_alignment = preset->kv_cache_alignment;
Expand All @@ -124,6 +126,7 @@ Drama3Generator::Drama3Generator(std::shared_ptr<const Drama3Assets> assets,
else throw std::runtime_error("fish_drama3.kv_cache_type requires f32 or f16");
}
debug::trace_log_scalar("fish_drama3.perf_mode", perf_mode);
debug::trace_log_scalar("fish_drama3.device_sampling", device_sampling_);
debug::trace_log_scalar("fish_drama3.fused_moe", backbone_config.fused_moe);
debug::trace_log_scalar("fish_drama3.kv_cache_type", std::string_view(backbone_config.kv_cache_type == GGML_TYPE_F16 ? "f16" : "f32"));
debug::trace_log_scalar("fish_drama3.kv_cache_alignment", backbone_config.kv_cache_alignment);
Expand Down
Loading