You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it normal that memory should keep increasing to the point where your run out of memory? I have this example:
fromfunctoolsimportpartialimportlitdataasldimportpandasaspdfromquran_ai.preprocessingimportprepare_datasetfromtransformersimport (
WhisperFeatureExtractor,
WhisperTokenizerFast,
WhisperProcessor,
)
model_id="openai/whisper-large-v3-turbo"feature_extractor=WhisperFeatureExtractor.from_pretrained(model_id)
tokenizer=WhisperTokenizerFast.from_pretrained(
model_id, language="Arabic", task="transcribe"
)
processor=WhisperProcessor.from_pretrained(
model_id, language="Arabic", task="transcribe"
)
if__name__=="__main__":
df_full=pd.read_csv("data.csv")
df_full=df_full.drop(columns=["Unnamed: 0"])
ld.optimize(
fn=partial(prepare_dataset, tokenizer=tokenizer, feature_extractor=feature_extractor), # the function applied to each inputinputs=df_full.to_dict(orient="records"), # the inputs to the function (here it's a list of numbers)output_dir="prepared_data", # optimized data is stored herenum_workers=4, # The number of workers on the same machinechunk_size=1000 , # size of each chunk,
)
defprepare_dataset(batch,
feature_extractor: WhisperFeatureExtractor,
tokenizer: WhisperTokenizer):
try:
# load and resample audio data from 48 to 16kHzaudio_file_path=batch["audio_file_path"]
audio, sr=load_wave(audio_file_path)
# compute log-Mel input features from input audio array batch["input_features"] =feature_extractor(audio.numpy(), sampling_rate=sr).input_features[0]
# encode target text to label ids batch["labels"] =tokenizer(batch["arabic_text"]).input_idsexceptExceptionase:
passyieldbatch
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi.
Is it normal that memory should keep increasing to the point where your run out of memory? I have this example:
Beta Was this translation helpful? Give feedback.
All reactions