



'''simple docstring'''



from __future__ import annotations

import unittest

from transformers import MobileBertConfig, is_tf_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
	import tensorflow as tf

	from transformers import (
	    TF_MODEL_FOR_PRETRAINING_MAPPING,
	    TFMobileBertForMaskedLM,
	    TFMobileBertForMultipleChoice,
	    TFMobileBertForNextSentencePrediction,
	    TFMobileBertForPreTraining,
	    TFMobileBertForQuestionAnswering,
	    TFMobileBertForSequenceClassification,
	    TFMobileBertForTokenClassification,
	    TFMobileBertModel,
	)






@require_tf
class 					UpperCAmelCase__	(		UpperCamelCase__							,       UpperCamelCase__							,       unittest.TestCase ):
					a      :     Optional[int]        =							(
					    (
					        TFMobileBertModel,
					        TFMobileBertForMaskedLM,
					        TFMobileBertForNextSentencePrediction,
					        TFMobileBertForPreTraining,
					        TFMobileBertForQuestionAnswering,
					        TFMobileBertForSequenceClassification,
					        TFMobileBertForTokenClassification,
					        TFMobileBertForMultipleChoice,
					    )
					    if is_tf_available()
					    else ()
					)
					a      :     Union[str, Any]        =							(
					    {
					        """feature-extraction""": TFMobileBertModel,
					        """fill-mask""": TFMobileBertForMaskedLM,
					        """question-answering""": TFMobileBertForQuestionAnswering,
					        """text-classification""": TFMobileBertForSequenceClassification,
					        """token-classification""": TFMobileBertForTokenClassification,
					        """zero-shot""": TFMobileBertForSequenceClassification,
					    }
					    if is_tf_available()
					    else {}
					)
					a      :     Any        =							False
					a      :     List[str]        =							False



					def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase=False     )     ->			List[Any]:
						__lowerCAmelCase												=  super()._prepare_for_class(UpperCamelCase			,				UpperCamelCase			,				return_labels=UpperCamelCase     )

						if return_labels:
							if model_class in get_values(UpperCamelCase     ):
								__lowerCAmelCase												=  tf.zeros(self.model_tester.batch_size			,				dtype=tf.intaa     )

						return inputs_dict






					class 					UpperCAmelCase__	(		UpperCamelCase__ ):



										def __init__(    self			,				UpperCamelCase			,				UpperCamelCase=13			,				UpperCamelCase=7			,				UpperCamelCase=True			,				UpperCamelCase=True			,				UpperCamelCase=True			,				UpperCamelCase=True			,				UpperCamelCase=99			,				UpperCamelCase=32			,				UpperCamelCase=32			,				UpperCamelCase=2			,				UpperCamelCase=4			,				UpperCamelCase=37			,				UpperCamelCase="gelu"			,				UpperCamelCase=0.1			,				UpperCamelCase=0.1			,				UpperCamelCase=512			,				UpperCamelCase=16			,				UpperCamelCase=2			,				UpperCamelCase=0.02			,				UpperCamelCase=3			,				UpperCamelCase=4			,				UpperCamelCase=None			,				)     ->			int:
											__lowerCAmelCase												=  parent
											__lowerCAmelCase												=  batch_size
											__lowerCAmelCase												=  seq_length
											__lowerCAmelCase												=  is_training
											__lowerCAmelCase												=  use_input_mask
											__lowerCAmelCase												=  use_token_type_ids
											__lowerCAmelCase												=  use_labels
											__lowerCAmelCase												=  vocab_size
											__lowerCAmelCase												=  hidden_size
											__lowerCAmelCase												=  num_hidden_layers
											__lowerCAmelCase												=  num_attention_heads
											__lowerCAmelCase												=  intermediate_size
											__lowerCAmelCase												=  hidden_act
											__lowerCAmelCase												=  hidden_dropout_prob
											__lowerCAmelCase												=  attention_probs_dropout_prob
											__lowerCAmelCase												=  max_position_embeddings
											__lowerCAmelCase												=  type_vocab_size
											__lowerCAmelCase												=  type_sequence_label_size
											__lowerCAmelCase												=  initializer_range
											__lowerCAmelCase												=  num_labels
											__lowerCAmelCase												=  num_choices
											__lowerCAmelCase												=  scope
											__lowerCAmelCase												=  embedding_size



										def        UpperCAmelCase_ (    self     )     ->			str:
											__lowerCAmelCase												=  ids_tensor([self.batch_size, self.seq_length]			,				self.vocab_size     )

											__lowerCAmelCase												=  None
											if self.use_input_mask:
												__lowerCAmelCase												=  random_attention_mask([self.batch_size, self.seq_length]     )

											__lowerCAmelCase												=  None
											if self.use_token_type_ids:
												__lowerCAmelCase												=  ids_tensor([self.batch_size, self.seq_length]			,				self.type_vocab_size     )

											__lowerCAmelCase												=  None
											__lowerCAmelCase												=  None
											__lowerCAmelCase												=  None
											if self.use_labels:
												__lowerCAmelCase												=  ids_tensor([self.batch_size]			,				self.type_sequence_label_size     )
												__lowerCAmelCase												=  ids_tensor([self.batch_size, self.seq_length]			,				self.num_labels     )
												__lowerCAmelCase												=  ids_tensor([self.batch_size]			,				self.num_choices     )

											__lowerCAmelCase												=  MobileBertConfig(
											    vocab_size=self.vocab_size			,				hidden_size=self.hidden_size			,				num_hidden_layers=self.num_hidden_layers			,				num_attention_heads=self.num_attention_heads			,				intermediate_size=self.intermediate_size			,				hidden_act=self.hidden_act			,				hidden_dropout_prob=self.hidden_dropout_prob			,				attention_probs_dropout_prob=self.attention_probs_dropout_prob			,				max_position_embeddings=self.max_position_embeddings			,				type_vocab_size=self.type_vocab_size			,				initializer_range=self.initializer_range			,				embedding_size=self.embedding_size			,				)

											return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			Dict:
											__lowerCAmelCase												=  TFMobileBertModel(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )

											__lowerCAmelCase												=  [input_ids, input_mask]
											__lowerCAmelCase												=  model(UpperCamelCase     )

											__lowerCAmelCase												=  model(UpperCamelCase     )

											self.parent.assertEqual(
											    result.last_hidden_state.shape			,				(self.batch_size, self.seq_length, self.hidden_size)     )
											self.parent.assertEqual(result.pooler_output.shape			,				(self.batch_size, self.hidden_size)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			List[Any]:
											__lowerCAmelCase												=  TFMobileBertForMaskedLM(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(result.logits.shape			,				(self.batch_size, self.seq_length, self.vocab_size)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			Union[str, Any]:
											__lowerCAmelCase												=  TFMobileBertForNextSentencePrediction(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(result.logits.shape			,				(self.batch_size, 2)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			Union[str, Any]:
											__lowerCAmelCase												=  TFMobileBertForPreTraining(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(
											    result.prediction_logits.shape			,				(self.batch_size, self.seq_length, self.vocab_size)     )
											self.parent.assertEqual(result.seq_relationship_logits.shape			,				(self.batch_size, 2)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			Union[str, Any]:
											__lowerCAmelCase												=  self.num_labels
											__lowerCAmelCase												=  TFMobileBertForSequenceClassification(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(result.logits.shape			,				(self.batch_size, self.num_labels)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			Optional[Any]:
											__lowerCAmelCase												=  self.num_choices
											__lowerCAmelCase												=  TFMobileBertForMultipleChoice(config=UpperCamelCase     )
											__lowerCAmelCase												=  tf.tile(tf.expand_dims(UpperCamelCase			,				1     )			,				(1, self.num_choices, 1)     )
											__lowerCAmelCase												=  tf.tile(tf.expand_dims(UpperCamelCase			,				1     )			,				(1, self.num_choices, 1)     )
											__lowerCAmelCase												=  tf.tile(tf.expand_dims(UpperCamelCase			,				1     )			,				(1, self.num_choices, 1)     )
											__lowerCAmelCase												=  {
											    "input_ids": multiple_choice_inputs_ids,
											    "attention_mask": multiple_choice_input_mask,
											    "token_type_ids": multiple_choice_token_type_ids,
											}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(result.logits.shape			,				(self.batch_size, self.num_choices)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			Optional[int]:
											__lowerCAmelCase												=  self.num_labels
											__lowerCAmelCase												=  TFMobileBertForTokenClassification(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(result.logits.shape			,				(self.batch_size, self.seq_length, self.num_labels)     )



										def        UpperCAmelCase_ (    self			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase			,				UpperCamelCase     )     ->			List[Any]:
											__lowerCAmelCase												=  TFMobileBertForQuestionAnswering(config=UpperCamelCase     )
											__lowerCAmelCase												=  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
											__lowerCAmelCase												=  model(UpperCamelCase     )
											self.parent.assertEqual(result.start_logits.shape			,				(self.batch_size, self.seq_length)     )
											self.parent.assertEqual(result.end_logits.shape			,				(self.batch_size, self.seq_length)     )



										def        UpperCAmelCase_ (    self     )     ->			Tuple:
											__lowerCAmelCase												=  self.prepare_config_and_inputs()
											(
											    (
											    __lowerCAmelCase
											)							,       (
											    __lowerCAmelCase
											)							,       (
											    __lowerCAmelCase
											)							,       (
											    __lowerCAmelCase
											)							,       (
											    __lowerCAmelCase
											)							,       (
											    __lowerCAmelCase
											)							,       (
											    __lowerCAmelCase
											)							,       
											)												=  config_and_inputs
											__lowerCAmelCase												=  {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
											return config, inputs_dict



					def        UpperCAmelCase_ (    self     )     ->			Any:
						__lowerCAmelCase												=  TFMobileBertModelTest.TFMobileBertModelTester(self     )
						__lowerCAmelCase												=  ConfigTester(self			,				config_class=UpperCamelCase			,				hidden_size=37     )



					def        UpperCAmelCase_ (    self     )     ->			List[Any]:
						self.config_tester.run_common_tests()



					def        UpperCAmelCase_ (    self     )     ->			Any:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_model(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			Any:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_masked_lm(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			Any:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_multiple_choice(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			Optional[Any]:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			Dict:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_pretraining(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			List[Any]:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_question_answering(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			Tuple:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_sequence_classification(*UpperCamelCase     )



					def        UpperCAmelCase_ (    self     )     ->			Union[str, Any]:
						__lowerCAmelCase												=  self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_mobilebert_for_token_classification(*UpperCamelCase     )



					@slow
					def        UpperCAmelCase_ (    self     )     ->			Union[str, Any]:
						# for model_name in TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
						for model_name in ["google/mobilebert-uncased"]:
							__lowerCAmelCase												=  TFMobileBertModel.from_pretrained(UpperCamelCase     )
							self.assertIsNotNone(UpperCamelCase     )






@require_tf
class 					UpperCAmelCase__	(		unittest.TestCase ):



					@slow
					def        UpperCAmelCase_ (    self     )     ->			List[str]:
						__lowerCAmelCase												=  TFMobileBertForPreTraining.from_pretrained("google/mobilebert-uncased"     )
						__lowerCAmelCase												=  tf.constant([[0, 1, 2, 3, 4, 5]]     )
						__lowerCAmelCase												=  model(UpperCamelCase     )[0]

						__lowerCAmelCase												=  [1, 6, 3_0522]
						self.assertEqual(output.shape			,				UpperCamelCase     )

						__lowerCAmelCase												=  tf.constant(
						    [
						        [
						            [-4.5_91_95_47, -9.24_82_95, -9.64_52_56],
						            [-6.7_30_61_75, -6.44_02_84, -6.6_05_28_37],
						            [-7.2_74_35_06, -6.7_84_79_15, -6.02_46_73],
						        ]
						    ]     )
						tf.debugging.assert_near(output[:, :3, :3]			,				UpperCamelCase			,				atol=1E-4     )




'''simple docstring'''



import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union

import numpy as np



def   __lowerCAmelCase					(							lowerCamelCase   :						bytes				,		lowerCamelCase   :						int					):






	'''simple docstring'''




	__lowerCAmelCase												=  f'''{sampling_rate}'''
	__lowerCAmelCase												=  "1"
	__lowerCAmelCase												=  "f32le"
	__lowerCAmelCase												=  [
	    "ffmpeg",
	    "-i",
	    "pipe:0",
	    "-ac",
	    ac,
	    "-ar",
	    ar,
	    "-f",
	    format_for_conversion,
	    "-hide_banner",
	    "-loglevel",
	    "quiet",
	    "pipe:1",
	]

	try:
		with subprocess.Popen(lowerCamelCase				,		stdin=subprocess.PIPE				,		stdout=subprocess.PIPE					) as ffmpeg_process:
			__lowerCAmelCase												=  ffmpeg_process.communicate(lowerCamelCase					)
	except FileNotFoundError as error:
		raise ValueError("ffmpeg was not found but is required to load audio files from filename"					) from error
	__lowerCAmelCase												=  output_stream[0]
	__lowerCAmelCase												=  np.frombuffer(lowerCamelCase				,		np.floataa					)
	if audio.shape[0] == 0:
		raise ValueError("Malformed soundfile"					)
	return audio



def   __lowerCAmelCase					(							lowerCamelCase   :						int				,		lowerCamelCase   :						float				,		lowerCamelCase   :						str = "f32le"				,		):






	'''simple docstring'''




	__lowerCAmelCase												=  f'''{sampling_rate}'''
	__lowerCAmelCase												=  "1"
	if format_for_conversion == "s16le":
		__lowerCAmelCase												=  2
	elif format_for_conversion == "f32le":
		__lowerCAmelCase												=  4
	else:
		raise ValueError(f'''Unhandled format `{format_for_conversion}`. Please use `s16le` or `f32le`'''					)

	__lowerCAmelCase												=  platform.system()
	if system == "Linux":
		__lowerCAmelCase												=  "alsa"
		__lowerCAmelCase												=  "default"
	elif system == "Darwin":
		__lowerCAmelCase												=  "avfoundation"
		__lowerCAmelCase												=  ":0"
	elif system == "Windows":
		__lowerCAmelCase												=  "dshow"
		__lowerCAmelCase												=  "default"

	__lowerCAmelCase												=  [
	    "ffmpeg",
	    "-f",
	    format_,
	    "-i",
	    input_,
	    "-ac",
	    ac,
	    "-ar",
	    ar,
	    "-f",
	    format_for_conversion,
	    "-fflags",
	    "nobuffer",
	    "-hide_banner",
	    "-loglevel",
	    "quiet",
	    "pipe:1",
	]
	__lowerCAmelCase												=  int(round(sampling_rate * chunk_length_s					)					) * size_of_sample
	__lowerCAmelCase												=  _ffmpeg_stream(lowerCamelCase				,		lowerCamelCase					)
	for item in iterator:
		yield item



def   __lowerCAmelCase					(							lowerCamelCase   :						int				,		lowerCamelCase   :						float				,		lowerCamelCase   :						Optional[int] = None				,		lowerCamelCase   :						Optional[Union[Tuple[float, float], float]] = None				,		lowerCamelCase   :						str = "f32le"				,		):






	'''simple docstring'''




	if stream_chunk_s is not None:
		__lowerCAmelCase												=  stream_chunk_s
	else:
		__lowerCAmelCase												=  chunk_length_s

	__lowerCAmelCase												=  ffmpeg_microphone(lowerCamelCase				,		lowerCamelCase				,		format_for_conversion=lowerCamelCase					)
	if format_for_conversion == "s16le":
		__lowerCAmelCase												=  np.intaa
		__lowerCAmelCase												=  2
	elif format_for_conversion == "f32le":
		__lowerCAmelCase												=  np.floataa
		__lowerCAmelCase												=  4
	else:
		raise ValueError(f'''Unhandled format `{format_for_conversion}`. Please use `s16le` or `f32le`'''					)

	if stride_length_s is None:
		__lowerCAmelCase												=  chunk_length_s / 6
	__lowerCAmelCase												=  int(round(sampling_rate * chunk_length_s					)					) * size_of_sample
	if isinstance(lowerCamelCase				,		(int, float)					):
		__lowerCAmelCase												=  [stride_length_s, stride_length_s]

	__lowerCAmelCase												=  int(round(sampling_rate * stride_length_s[0]					)					) * size_of_sample
	__lowerCAmelCase												=  int(round(sampling_rate * stride_length_s[1]					)					) * size_of_sample
	__lowerCAmelCase												=  datetime.datetime.now()
	__lowerCAmelCase												=  datetime.timedelta(seconds=lowerCamelCase					)
	for item in chunk_bytes_iter(lowerCamelCase				,		lowerCamelCase				,		stride=(stride_left, stride_right)				,		stream=lowerCamelCase					):
		# Put everything back in numpy scale
		__lowerCAmelCase												=  np.frombuffer(item["raw"]				,		dtype=lowerCamelCase					)
		__lowerCAmelCase												=  (
		    item["stride"][0] // size_of_sample,
		    item["stride"][1] // size_of_sample,
		)
		__lowerCAmelCase												=  sampling_rate
		audio_time += delta
		if datetime.datetime.now() > audio_time + 10 * delta:
			# We're late !! SKIP
			continue
		yield item



def   __lowerCAmelCase					(							lowerCamelCase   :						Optional[Any]				,		lowerCamelCase   :						int				,		lowerCamelCase   :						Tuple[int, int]				,		lowerCamelCase   :						bool = False					):






	'''simple docstring'''




	__lowerCAmelCase												=  B""
	__lowerCAmelCase							,       __lowerCAmelCase												=  stride
	if stride_left + stride_right >= chunk_len:
		raise ValueError(
		    f'''Stride needs to be strictly smaller than chunk_len: ({stride_left}, {stride_right}) vs {chunk_len}'''					)
	__lowerCAmelCase												=  0
	for raw in iterator:
		acc += raw
		if stream and len(lowerCamelCase					) < chunk_len:
			__lowerCAmelCase												=  (_stride_left, 0)
			yield {"raw": acc[:chunk_len], "stride": stride, "partial": True}
		else:
			while len(lowerCamelCase					) >= chunk_len:
				# We are flushing the accumulator
				__lowerCAmelCase												=  (_stride_left, stride_right)
				__lowerCAmelCase												=  {"raw": acc[:chunk_len], "stride": stride}
				if stream:
					__lowerCAmelCase												=  False
				yield item
				__lowerCAmelCase												=  stride_left
				__lowerCAmelCase												=  acc[chunk_len - stride_left - stride_right :]
    # Last chunk
	if len(lowerCamelCase					) > stride_left:
		__lowerCAmelCase												=  {"raw": acc, "stride": (_stride_left, 0)}
		if stream:
			__lowerCAmelCase												=  False
		yield item




def   __lowerCAmelCase					(							lowerCamelCase   :						Optional[int]				,		lowerCamelCase   :						int					):






	'''simple docstring'''




	__lowerCAmelCase												=  2**24  # 16Mo
	try:
		with subprocess.Popen(lowerCamelCase				,		stdout=subprocess.PIPE				,		bufsize=lowerCamelCase					) as ffmpeg_process:
			while True:
				__lowerCAmelCase												=  ffmpeg_process.stdout.read(lowerCamelCase					)
				if raw == b"":
					break
				yield raw
	except FileNotFoundError as error:
		raise ValueError("ffmpeg was not found but is required to stream audio files from filename"					) from error