repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
EbodShojaei/bake
from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules import ( AssignmentSpacingRule, ContinuationRule, PhonyRule, TabsRule, TargetSpacingRule, WhitespaceRule, ) class TestContinuationRule: def test_formats_simple_continua...
"SOURCES = file1.c \\"
assert
string_literal
tests/test_bake.py
test_formats_simple_continuation
TestContinuationRule
173
null
EbodShojaei/bake
from unittest.mock import MagicMock, patch import pytest from mbake.utils.version_utils import ( VersionError, check_for_updates, get_pypi_version, is_development_install, parse_version, ) class TestCheckForUpdates: @patch("mbake.utils.version_utils.get_pypi_version") @patch("mbake.utils...
"1.0.0"
assert
string_literal
tests/test_version_utils.py
test_network_error
TestCheckForUpdates
154
null
EbodShojaei/bake
import tempfile from pathlib import Path from unittest.mock import patch import pytest from typer.testing import CliRunner from mbake.cli import app class TestValidateCommand: def runner(self): """Create a CLI runner for testing.""" return CliRunner() def test_validate_makefile_with_relativ...
subdir
assert
variable
tests/test_validate_command.py
test_validate_makefile_with_relative_include
TestValidateCommand
86
null
EbodShojaei/bake
from pathlib import Path from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule def create_alignment_config( align_assignments: bool = True, align_across_comments: bool = False ) -> Config: "...
"LONGER_VAR3 += -more"
assert
string_literal
tests/test_assignment_alignment.py
test_alignment_with_different_operators
TestAssignmentAlignment
80
null
EbodShojaei/bake
from unittest.mock import MagicMock, patch import pytest from mbake.utils.version_utils import ( VersionError, check_for_updates, get_pypi_version, is_development_install, parse_version, ) class TestCheckForUpdates: @patch("mbake.utils.version_utils.get_pypi_version") @patch("mbake.utils...
"1.1.0"
assert
string_literal
tests/test_version_utils.py
test_update_available
TestCheckForUpdates
117
null
EbodShojaei/bake
from pathlib import Path from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule def create_alignment_config( align_assignments: bool = True, align_across_comments: bool = False ) -> Config: "...
"ifdef DEBUG"
assert
string_literal
tests/test_assignment_alignment.py
test_conditional_blocks_break_alignment
TestAssignmentAlignment
236
null
EbodShojaei/bake
from unittest.mock import MagicMock, patch import pytest from mbake.utils.version_utils import ( VersionError, check_for_updates, get_pypi_version, is_development_install, parse_version, ) class TestCheckForUpdates: @patch("mbake.utils.version_utils.get_pypi_version") @patch("mbake.utils...
False
assert
bool_literal
tests/test_version_utils.py
test_network_error
TestCheckForUpdates
152
null
EbodShojaei/bake
from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter class TestReversedAssignmentOperators: def test_mixed_correct_and_incorrect_operators(self): """Test mix of correct and incorrect operators.""" config = Config(formatter=FormatterConfig()) f...
[7, 8, 9]
assert
collection
tests/test_reversed_assignment_operators.py
test_mixed_correct_and_incorrect_operators
TestReversedAssignmentOperators
276
null
EbodShojaei/bake
from pathlib import Path from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule def create_alignment_config( align_assignments: bool = True, align_across_comments: bool = False ) -> Config: "...
"AFTER = test"
assert
string_literal
tests/test_assignment_alignment.py
test_comments_break_blocks
TestAssignmentAlignment
106
null
EbodShojaei/bake
from pathlib import Path from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule def create_alignment_config( align_assignments: bool = True, align_across_comments: bool = False ) -> Config: "...
"VAR1 = value1"
assert
string_literal
tests/test_assignment_alignment.py
test_conditional_blocks_break_alignment
TestAssignmentAlignment
233
null
EbodShojaei/bake
from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules import ( AssignmentSpacingRule, ContinuationRule, PhonyRule, TabsRule, TargetSpacingRule, WhitespaceRule, ) class TestTabsRule: def test_handles_mixed_indentation(self)...
["target:", "\techo 'mixed'"]
assert
collection
tests/test_bake.py
test_handles_mixed_indentation
TestTabsRule
51
null
EbodShojaei/bake
from mbake.config import Config, FormatterConfig from mbake.core.formatter import MakefileFormatter from mbake.core.rules import ( AssignmentSpacingRule, ContinuationRule, PhonyRule, TabsRule, TargetSpacingRule, WhitespaceRule, ) class TestFinalNewlineRule: def test_detects_missing_final_n...
1
assert
numeric_literal
tests/test_bake.py
test_detects_missing_final_newline
TestFinalNewlineRule
129
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
5
assert
numeric_literal
ultravox/data/datasets_test.py
test_range
157
null
fixie-ai/ultravox
import pytest import transformers from ultravox.model import ultravox_config @pytest.mark.parametrize( "model_id", ["fixie-ai/ultravox-v0_2", "fixie-ai/ultravox-v0_3", "fixie-ai/ultravox-v0_4"], ) def test_can_load_release(model_id: str): orig_config: transformers.PretrainedConfig = ( transformers...
orig_config.text_config.to_dict()
assert
func_call
ultravox/model/ultravox_config_test.py
test_can_load_release
33
null
fixie-ai/ultravox
import re from unittest import mock from ultravox.evaluation import eval_types from ultravox.evaluation import gpt_eval from ultravox.evaluation import gpt_eval_conv def test_evaluate_conversation(): gpt_eval.gpt_evaluator.client = mock.MagicMock() sample = eval_types.Sample( index=0, history=...
2
assert
numeric_literal
ultravox/evaluation/gpt_eval_test.py
test_evaluate_conversation
28
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
2
assert
numeric_literal
ultravox/data/datasets_test.py
test_dataset_config_serialization
236
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[1, 1]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_multiple_audios
110
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
1
assert
numeric_literal
ultravox/model/ultravox_model_test.py
test_init_latency_mask_valid
36
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
1000
assert
numeric_literal
ultravox/data/datasets_test.py
test_dataset_config
211
null
fixie-ai/ultravox
import os from typing import Optional from unittest import mock import numpy as np import pytest import torch import transformers from ultravox import data as datasets from ultravox.inference import base as infer_base from ultravox.inference import infer from ultravox.model import ultravox_processing def tokenizer()...
None
assert
none_literal
ultravox/inference/infer_test.py
test_infer_text_only
174
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[100, 1000]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_multiple_audios
99
null
fixie-ai/ultravox
import torch import torch.nn as nn from ultravox.tools import projector_combine_tool def test_combine_linear_layers(): linear_1 = nn.Linear(10, 12, bias=False) linear_2 = nn.Linear(12, 23, bias=False) combined = projector_combine_tool.combine_linear_layers(linear_1, linear_2) test_inp = torch.randn(1,...
linear_1.in_features
assert
complex_expr
ultravox/tools/projector_combine_tool_test.py
test_combine_linear_layers
12
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
5000
assert
numeric_literal
ultravox/data/datasets_test.py
test_dataset_config
205
null
fixie-ai/ultravox
import pytest import transformers from ultravox.model import ultravox_config @pytest.mark.parametrize( "model_id", ["fixie-ai/ultravox-v0_2", "fixie-ai/ultravox-v0_3", "fixie-ai/ultravox-v0_4"], ) def test_can_load_release(model_id: str): orig_config: transformers.PretrainedConfig = ( transformers...
orig_values
assert
variable
ultravox/model/ultravox_config_test.py
test_can_load_release
30
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
100, rel=1e-2)
pytest.approx
complex_expr
ultravox/evaluation/string_metrics_test.py
test_wer_en_cap_hypothesis_len
78
null
fixie-ai/ultravox
import re from unittest import mock from ultravox.evaluation import eval_types from ultravox.evaluation import gpt_eval from ultravox.evaluation import gpt_eval_conv def test_evaluate_conversation(): gpt_eval.gpt_evaluator.client = mock.MagicMock() sample = eval_types.Sample( index=0, history=...
gpt_question
assert
variable
ultravox/evaluation/gpt_eval_test.py
test_evaluate_conversation
32
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[1, 2, 1]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_multiple_audios_with_overflowing_audio
137
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
expected_output
assert
variable
ultravox/evaluation/string_metrics_test.py
test_remove_diacritics
127
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[7, 63]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_multiple_audios
100
null
fixie-ai/ultravox
import os from typing import Optional from unittest import mock import numpy as np import pytest import torch import transformers from ultravox import data as datasets from ultravox.inference import base as infer_base from ultravox.inference import infer from ultravox.model import ultravox_processing def tokenizer()...
20
assert
numeric_literal
ultravox/inference/infer_test.py
test_infer_16kHz
97
null
fixie-ai/ultravox
import os from typing import Optional from unittest import mock import numpy as np import pytest import torch import transformers from ultravox import data as datasets from ultravox.inference import base as infer_base from ultravox.inference import infer from ultravox.model import ultravox_processing def tokenizer()...
12
assert
numeric_literal
ultravox/inference/infer_test.py
test_infer_text_only
170
null
fixie-ai/ultravox
import re from unittest import mock from ultravox.evaluation import eval_types from ultravox.evaluation import gpt_eval from ultravox.evaluation import gpt_eval_conv def test_evaluate_conversation(): gpt_eval.gpt_evaluator.client = mock.MagicMock() sample = eval_types.Sample( index=0, history=...
"user"
assert
string_literal
ultravox/evaluation/gpt_eval_test.py
test_evaluate_conversation
30
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
model.state_dict())
assert_*
func_call
ultravox/model/ultravox_model_test.py
test_load_pretrained_model
111
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
90
assert
numeric_literal
ultravox/data/datasets_test.py
test_generic_dataset_multiple_splits
399
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[3, 12]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_multiple_audios
101
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
61.216343280457046, rel=1e-2)
pytest.approx
complex_expr
ultravox/evaluation/string_metrics_test.py
test_bleu_en
101
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
4
assert
numeric_literal
ultravox/model/ultravox_model_test.py
test_init_latency_mask_valid
35
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[2]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_overflowing_audio
88
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
9.090909090909092, rel=1e-2)
pytest.approx
complex_expr
ultravox/evaluation/string_metrics_test.py
test_wer_en
71
null
fixie-ai/ultravox
import json import jinja2 def test_quotes(): with open("tools/ds_tool/soda_alt_last_turn.jinja", "r") as template_file: template = template_file.read() dialogue = [ 'Have you ever used a double quote (")', "Of course, what about a single quote (')?", '"Yes, I have."', ...
4
assert
numeric_literal
ultravox/tools/ds_tool/template_test.py
test_quotes
24
null
fixie-ai/ultravox
from typing import Union import numpy as np import pytest from ultravox.data import data_sample def _create_sine_wave( freq: int = 440, duration: float = 1.0, sample_rate: int = 16000, amplitude: float = 0.1, target_dtype: str = "float32", ) -> Union[ np.typing.NDArray[np.float32], np.typ...
AssertionError)
pytest.raises
variable
ultravox/data/data_sample_test.py
test_create_sample__raises_on_unsupported_dtype
80
null
fixie-ai/ultravox
import json import jinja2 def test_quotes(): with open("tools/ds_tool/soda_alt_last_turn.jinja", "r") as template_file: template = template_file.read() dialogue = [ 'Have you ever used a double quote (")', "Of course, what about a single quote (')?", '"Yes, I have."', ...
"user"
assert
string_literal
ultravox/tools/ds_tool/template_test.py
test_quotes
22
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
None
assert
none_literal
ultravox/model/ultravox_model_test.py
test_init_latency_mask_none
27
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
4
assert
numeric_literal
ultravox/data/datasets_test.py
test_dataset_config
203
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
encoder._buffers
assert
complex_expr
ultravox/model/ultravox_model_test.py
test_init_latency_mask_persistence
68
null
fixie-ai/ultravox
import json import jinja2 def test_quotes(): with open("tools/ds_tool/soda_alt_last_turn.jinja", "r") as template_file: template = template_file.read() dialogue = [ 'Have you ever used a double quote (")', "Of course, what about a single quote (')?", '"Yes, I have."', ...
"system"
assert
string_literal
ultravox/tools/ds_tool/template_test.py
test_quotes
25
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
15.384615384615385, rel=1e-2)
pytest.approx
complex_expr
ultravox/evaluation/string_metrics_test.py
test_wer_zh
91
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[1]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_single_audio
58
null
fixie-ai/ultravox
from typing import Union import numpy as np import pytest from ultravox.data import data_sample def _create_sine_wave( freq: int = 440, duration: float = 1.0, sample_rate: int = 16000, amplitude: float = 0.1, target_dtype: str = "float32", ) -> Union[ np.typing.NDArray[np.float32], np.typ...
None
assert
none_literal
ultravox/data/data_sample_test.py
_create_and_validate_sample
46
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
45.43741956108463, rel=1e-2)
pytest.approx
complex_expr
ultravox/evaluation/string_metrics_test.py
test_bleu_zh
106
null
fixie-ai/ultravox
import pytest import transformers from ultravox.model import ultravox_config def test_no_config_when_id_present(): config = ultravox_config.UltravoxConfig(audio_model_id="openai/whisper-small") assert "audio_config" not in
config.to_diff_dict()
assert
func_call
ultravox/model/ultravox_config_test.py
test_no_config_when_id_present
44
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[188, 32]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_overflowing_audio
82
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
torch.finfo(dtype).min
assert
func_call
ultravox/model/ultravox_model_test.py
test_init_latency_mask_different_dtypes
62
null
fixie-ai/ultravox
import torch import torch.nn as nn from ultravox.tools import projector_combine_tool def test_combine_linear_layers(): linear_1 = nn.Linear(10, 12, bias=False) linear_2 = nn.Linear(12, 23, bias=False) combined = projector_combine_tool.combine_linear_layers(linear_1, linear_2) test_inp = torch.randn(1,...
linear_2.out_features
assert
complex_expr
ultravox/tools/projector_combine_tool_test.py
test_combine_linear_layers
13
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[4]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_multiple_audios_with_overflowing_audio
136
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
10
assert
numeric_literal
ultravox/data/datasets_test.py
test_range
164
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[3, 3]
assert
collection
ultravox/model/ultravox_processing_test.py
test_collator_with_audio
209
null
fixie-ai/ultravox
import platform import numpy as np import pytest from ultravox.data.aug import AugRegistry @pytest.mark.parametrize("gain_db", [10, -10]) def test_gain(gain_db): augmentation_config = AugRegistry.get_config("gain", {"gain_db": gain_db}) augmentation = AugRegistry.create_augmentation(augmentation_config) ...
audio.shape
assert
complex_expr
ultravox/data/aug/test_augs.py
test_gain
15
null
fixie-ai/ultravox
from unittest import mock import numpy as np import pytest import torch from ultravox import data as datasets from ultravox.model import ultravox_config from ultravox.model import ultravox_data_proc TEST_USER_MESSAGE = { "role": "user", "content": "Listen to <|audio|> and respond.", } TEST_ASSISTANT_MESSAGE ...
torch.Size([1, 1, 3])
assert
func_call
ultravox/model/ultravox_data_proc_test.py
test_process
88
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
ValueError)
pytest.raises
variable
ultravox/model/ultravox_processing_test.py
test_processor_fails_with_too_many_audio_tokens
143
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
AssertionError, match="must divide .* evenly")
pytest.raises
complex_expr
ultravox/model/ultravox_model_test.py
test_init_latency_mask_invalid_block_size
54
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
pytest.approx(15.384615384615385, rel=1e-2)
assert
func_call
ultravox/evaluation/string_metrics_test.py
test_wer_zh
91
null
fixie-ai/ultravox
from typing import Optional from unittest.mock import patch import datasets as hf_datasets import numpy as np import pytest import torch from torch.utils import data from transformers.feature_extraction_utils import BatchFeature from ultravox.data import data_sample from ultravox.data import datasets from ultravox.da...
"0"
assert
string_literal
ultravox/data/datasets_test.py
test_transcribe_dataset
179
null
fixie-ai/ultravox
import os from typing import Optional from unittest import mock import numpy as np import pytest import torch import transformers from ultravox import data as datasets from ultravox.inference import base as infer_base from ultravox.inference import infer from ultravox.model import ultravox_processing def tokenizer()...
"56789"
assert
string_literal
ultravox/inference/infer_test.py
test_infer_16kHz
99
null
fixie-ai/ultravox
import os import pytest import safetensors.torch import torch import transformers from ultravox.model import ultravox_config from ultravox.model import ultravox_model TINY_MODEL_PATH = "./assets/tiny_ultravox" def encoder(): config = transformers.WhisperConfig( max_source_positions=1500, d_model...
dict_b[k])
assert_*
complex_expr
ultravox/model/ultravox_model_test.py
assert_equal_state_dict
74
null
fixie-ai/ultravox
from typing import Union import numpy as np import pytest from ultravox.data import data_sample def _create_sine_wave( freq: int = 440, duration: float = 1.0, sample_rate: int = 16000, amplitude: float = 0.1, target_dtype: str = "float32", ) -> Union[ np.typing.NDArray[np.float32], np.typ...
np.float32
assert
complex_expr
ultravox/data/data_sample_test.py
_create_and_validate_sample
48
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
pytest.approx(45.43741956108463, rel=1e-2)
assert
func_call
ultravox/evaluation/string_metrics_test.py
test_bleu_zh
106
null
fixie-ai/ultravox
import json import jinja2 def test_quotes(): with open("tools/ds_tool/soda_alt_last_turn.jinja", "r") as template_file: template = template_file.read() dialogue = [ 'Have you ever used a double quote (")', "Of course, what about a single quote (')?", '"Yes, I have."', ...
dialogue[:-1]
assert
complex_expr
ultravox/tools/ds_tool/template_test.py
test_quotes
26
null
fixie-ai/ultravox
import platform import numpy as np import pytest from ultravox.data.aug import AugRegistry def test_all_registered_augmentations(): """ Test that all registered augmentations can be created and applied to audio data. This ensures that every augmentation in the registry is working as expected. """ ...
0
assert
numeric_literal
ultravox/data/aug/test_augs.py
test_all_registered_augmentations
57
null
fixie-ai/ultravox
import os import pytest import torch.distributed from torch import multiprocessing as mp from ultravox.training import ddp_utils os.environ["MASTER_ADDR"] = "localhost" os.environ["MASTER_PORT"] = "12355" def verify_all_gather(rank: int, world_size: int, k: int = 4): if world_size > 1: torch.distributed...
list(range(world_size * k))
assert
func_call
ultravox/training/ddp_utils_test.py
verify_all_gather
27
null
fixie-ai/ultravox
from typing import Union import numpy as np import pytest from ultravox.data import data_sample def _create_sine_wave( freq: int = 440, duration: float = 1.0, sample_rate: int = 16000, amplitude: float = 0.1, target_dtype: str = "float32", ) -> Union[ np.typing.NDArray[np.float32], np.typ...
16000
assert
numeric_literal
ultravox/data/data_sample_test.py
_create_and_validate_sample
45
null
fixie-ai/ultravox
import re from unittest import mock from ultravox.evaluation import eval_types from ultravox.evaluation import gpt_eval from ultravox.evaluation import gpt_eval_conv def test_evaluate_conversation(): gpt_eval.gpt_evaluator.client = mock.MagicMock() sample = eval_types.Sample( index=0, history=...
"system"
assert
string_literal
ultravox/evaluation/gpt_eval_test.py
test_evaluate_conversation
29
null
fixie-ai/ultravox
import numpy as np import pytest import transformers from ultravox.model import ultravox_processing def processor(): audio_processor = transformers.AutoProcessor.from_pretrained( "./assets/hf/openai-whisper-tiny", local_files_only=True ) tokenizer = transformers.AutoTokenizer.from_pretrained( ...
[7]
assert
collection
ultravox/model/ultravox_processing_test.py
test_processor_single_audio
54
null
fixie-ai/ultravox
import os from typing import Optional from unittest import mock import numpy as np import pytest import torch import transformers from ultravox import data as datasets from ultravox.inference import base as infer_base from ultravox.inference import infer from ultravox.model import ultravox_processing def tokenizer()...
7
assert
numeric_literal
ultravox/inference/infer_test.py
test_infer_16kHz
108
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
pytest.approx(40.909090909090914, rel=1e-2)
assert
func_call
ultravox/evaluation/string_metrics_test.py
test_wer_ja
96
null
fixie-ai/ultravox
import pytest from ultravox.data import text_proc def test_format_message_history(): roles = {"user": "user", "assistant": "assistant"} messages = {"role": ["user", "assistant"], "content": ["A", "B"]} assert text_proc.format_message_history(messages, roles) ==
[ {"role": "user", "content": "A"}, {"role": "assistant", "content": "B"}, ]
assert
collection
ultravox/data/text_proc_test.py
test_format_message_history
28
null
fixie-ai/ultravox
import pytest from ultravox.data import text_proc def test_garbage_utterance(): with pytest.raises(
text_proc.FormatASRError)
pytest.raises
complex_expr
ultravox/data/text_proc_test.py
test_garbage_utterance
20
null
fixie-ai/ultravox
import os from typing import Optional from unittest import mock import numpy as np import pytest import torch import transformers from ultravox import data as datasets from ultravox.inference import base as infer_base from ultravox.inference import infer from ultravox.model import ultravox_processing def tokenizer()...
5
assert
numeric_literal
ultravox/inference/infer_test.py
test_long_audio_context
81
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
350, rel=1e-2)
pytest.approx
complex_expr
ultravox/evaluation/string_metrics_test.py
test_wer_en_cap_hypothesis_len
83
null
fixie-ai/ultravox
import pytest from ultravox.evaluation import eval_types from ultravox.evaluation import string_metrics samples_en = [ eval_types.Sample( index=0, question="", transcript="", expected_answer="The quick brown fox jumps over the lazy dog", generated_answer="The quick brown fo...
pytest.approx(61.216343280457046, rel=1e-2)
assert
func_call
ultravox/evaluation/string_metrics_test.py
test_bleu_en
101
null
run-llama/llama_deploy
from typing import Any from unittest import mock import httpx from fastapi.testclient import TestClient from llama_deploy.apiserver.settings import settings def test_prom_proxy(http_client: TestClient) -> None: mock_metrics_response = 'metric1{label="value"} 1.0\nmetric2{label="value"} 2.0' mock_response = h...
mock_metrics_response
assert
variable
tests/apiserver/routers/test_status.py
test_prom_proxy
35
null
run-llama/llama_deploy
from unittest import mock from click.testing import CliRunner from llama_deploy.cli import llamactl from llama_deploy.types.apiserver import Status, StatusEnum def test_status(runner: CliRunner) -> None: with mock.patch("llama_deploy.cli.status.Client") as mocked_client: mocked_client.return_value.sync.a...
"LlamaDeploy is up and running.\n\nCurrently there are no active deployments\n"
assert
string_literal
tests/cli/test_status.py
test_status
44
null
run-llama/llama_deploy
import os from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from click.testing import CliRunner from tenacity import RetryError from llama_deploy.apiserver.settings import settings from llama_deploy.cli.serve import serve def runner() -> CliRunner: """Fixture for invoki...
mock_file_open.return_value
assert
complex_expr
tests/cli/test_serve.py
test_serve_with_deployment_file
124
null
run-llama/llama_deploy
from typing import Any from unittest import mock import httpx from fastapi.testclient import TestClient from llama_deploy.apiserver.settings import settings def test_read_main(http_client: TestClient) -> None: response = http_client.get("/status") assert response.status_code == 200 assert response.json(...
{ "max_deployments": 10, "deployments": [], "status": "Healthy", "status_message": "", }
assert
collection
tests/apiserver/routers/test_status.py
test_read_main
13
null
run-llama/llama_deploy
from unittest import mock import pytest from llama_deploy.client import Client from llama_deploy.client.client import _SyncClient from llama_deploy.client.models import ApiServer def test_client_init_default() -> None: c = Client() assert c.api_server_url ==
"http://localhost:4501"
assert
string_literal
tests/client/test_client.py
test_client_init_default
12
null
run-llama/llama_deploy
import asyncio from typing import AsyncGenerator import pytest from llama_deploy.client import Client from llama_deploy.client.models import Collection, Model from llama_deploy.client.models.model import _async_gen_to_list, make_sync def test_collection_get() -> None: class MyCollection(Collection): pass...
"bar"
assert
string_literal
tests/client/models/test_model.py
test_collection_get
51
null
run-llama/llama_deploy
from pathlib import Path from unittest import mock import pytest from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig from llama_deploy.apiserver.source_managers.git import GitSourceManager def config(data_path: Path) -> DeploymentConfig: return DeploymentConfig.from_yaml(data_path / "git...
( "https://example.com/llama_deploy.git", None, )
assert
collection
tests/apiserver/source_managers/test_git.py
test_parse_source
21
null
run-llama/llama_deploy
import io from typing import Any from unittest import mock import httpx import pytest from llama_deploy.client.models.apiserver import ( ApiServer, Deployment, DeploymentCollection, SessionCollection, Task, TaskCollection, ) from llama_deploy.types import SessionDefinition, TaskDefinition, Tas...
"http://localhost:4501/deployments/a_deployment")
assert_*
string_literal
tests/client/models/test_apiserver.py
test_task_deployment_collection_get
235
null
run-llama/llama_deploy
from pathlib import Path import pytest from llama_deploy.types import TaskDefinition @pytest.mark.asyncio async def test_reload(apiserver, client): here = Path(__file__).parent deployment_fp = here / "deployments" / "deployment_reload1.yml" with open(deployment_fp) as f: deployment = await client...
"I have received:bar"
assert
string_literal
e2e_tests/apiserver/test_reload.py
test_reload
19
null
run-llama/llama_deploy
from unittest import mock from click.testing import CliRunner from llama_deploy.cli import llamactl from llama_deploy.types.apiserver import Status, StatusEnum def test_status_with_deployments(runner: CliRunner) -> None: with mock.patch("llama_deploy.cli.status.Client") as mocked_client: mocked_client.re...
"LlamaDeploy is up and running.\n\nActive deployments:\n- foo\n- bar\n"
assert
string_literal
tests/cli/test_status.py
test_status_with_deployments
61
null
run-llama/llama_deploy
from typing import Any from unittest import mock import httpx from fastapi.testclient import TestClient from llama_deploy.apiserver.settings import settings def test_prom_proxy_off(http_client: TestClient, monkeypatch: Any) -> None: monkeypatch.setattr(settings, "prometheus_enabled", False) response = http_c...
204
assert
numeric_literal
tests/apiserver/routers/test_status.py
test_prom_proxy_off
24
null
run-llama/llama_deploy
import io from typing import Any from unittest import mock import httpx import pytest from llama_deploy.client.models.apiserver import ( ApiServer, Deployment, DeploymentCollection, SessionCollection, Task, TaskCollection, ) from llama_deploy.types import SessionDefinition, TaskDefinition, Tas...
"Down"
assert
string_literal
tests/client/models/test_apiserver.py
test_status_down
253
null
run-llama/llama_deploy
from typing import Any from unittest import mock import httpx from fastapi.testclient import TestClient from llama_deploy.apiserver.settings import settings def test_prom_proxy_failure(http_client: TestClient) -> None: # Mock the HTTP client to raise an exception with mock.patch( "httpx.AsyncClient.g...
"Connection failed"
assert
string_literal
tests/apiserver/routers/test_status.py
test_prom_proxy_failure
45
null
run-llama/llama_deploy
import io from typing import Any from unittest import mock import httpx import pytest from llama_deploy.client.models.apiserver import ( ApiServer, Deployment, DeploymentCollection, SessionCollection, Task, TaskCollection, ) from llama_deploy.types import SessionDefinition, TaskDefinition, Tas...
2
assert
numeric_literal
tests/client/models/test_apiserver.py
test_session_collection_list
84
null
run-llama/llama_deploy
from unittest import mock from click.testing import CliRunner from llama_deploy.cli import llamactl from llama_deploy.cli.__main__ import main def test_root_command(runner: CliRunner) -> None: result = runner.invoke(llamactl) assert result.exit_code ==
0
assert
numeric_literal
tests/cli/test_cli.py
test_root_command
19
null
run-llama/llama_deploy
from pathlib import Path from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig def do_assert(config: DeploymentConfig) -> None: assert config.name == "MyDeployment" assert config.default_service == "myworkflow" wf_config = config.services["myworkflow"] assert wf_config.name == ...
1313
assert
numeric_literal
tests/apiserver/test_config_parser.py
do_assert
16
null
run-llama/llama_deploy
import asyncio import json import subprocess import sys from collections.abc import Generator from copy import deepcopy from pathlib import Path from typing import Any from unittest import mock import pytest from workflows import Context, Workflow from workflows.handler import WorkflowHandler from llama_deploy.apiser...
10
assert
numeric_literal
tests/apiserver/test_deployment.py
test_manager_ctor
440
null
run-llama/llama_deploy
import io from typing import Any from unittest import mock import httpx import pytest from llama_deploy.client.models.apiserver import ( ApiServer, Deployment, DeploymentCollection, SessionCollection, Task, TaskCollection, ) from llama_deploy.types import SessionDefinition, TaskDefinition, Tas...
"Unhealthy"
assert
string_literal
tests/client/models/test_apiserver.py
test_status_unhealthy
268
null
run-llama/llama_deploy
import os from pathlib import Path from unittest.mock import MagicMock, mock_open, patch import pytest from click.testing import CliRunner from tenacity import RetryError from llama_deploy.apiserver.settings import settings from llama_deploy.cli.serve import serve def runner() -> CliRunner: """Fixture for invoki...
5
assert
numeric_literal
tests/cli/test_serve.py
test_serve_deployment_creation_fails
165
null
run-llama/llama_deploy
from unittest import mock import httpx from click.testing import CliRunner from llama_deploy.cli import llamactl def test_sessions_create_error(runner: CliRunner) -> None: with mock.patch("llama_deploy.cli.sessions.Client") as mocked_client: mocked_client.return_value.sync.apiserver.deployments.get.side_...
"Error: test error\n"
assert
string_literal
tests/cli/test_sessions.py
test_sessions_create_error
45
null