Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
"""Decoded Audio cells must be summarised; the soundfile fallback's waveform list crashed the client."""
from __future__ import annotations
import pytest
from hub.services.datasets.formatting import _serialize_preview_value
def test_a_decoded_audio_cell_collapses_to_a_summary():
cell = {"path": "a.wav", "array": [0.0] * 240_000, "sampling_rate": 24_000}
out = _serialize_preview_value({"audio": cell})
assert out == {"audio": "<audio, 240000 samples @ 24000 Hz, 10.0s>"}
assert len(str(out)) < 200
def test_the_undecoded_shape_still_reports_bytes():
out = _serialize_preview_value({"bytes": b"RIFFxxxx", "path": "a.wav"})
assert out == "<binary data, 8 bytes>"
def test_a_decoder_object_is_left_to_repr():
class _Decoder:
def __repr__(self):
return "<AudioDecoder>"
assert _serialize_preview_value({"audio": _Decoder()}) == {"audio": "<AudioDecoder>"}
def test_an_ordinary_list_column_is_untouched():
assert _serialize_preview_value({"ids": [1, 2, 3]}) == {"ids": [1, 2, 3]}
def test_a_missing_rate_does_not_raise():
out = _serialize_preview_value({"array": [0.0, 0.1], "sampling_rate": None})
assert out.startswith("<audio, 2 samples")
def test_a_numpy_array_cell_is_summarised_too():
np = pytest.importorskip("numpy")
cell = {"path": "a.m4a", "array": np.zeros(22050, dtype = "float32"), "sampling_rate": 22050}
assert _serialize_preview_value({"audio": cell}) == {
"audio": "<audio, 22050 samples @ 22050 Hz, 1.0s>"
}