Skip to content

Commit

Permalink
Pass string format arguments as logging method parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsource-autofix[bot] committed Jul 7, 2021
1 parent f95d349 commit 04cd749
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lecture2notes/dataset/transcripts_wer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
audio_path = process_folder / (video_id + "." + ARGS.audio_format)

end_time = timer() - start_time
logger.info("Stage 1 (Download and Convert Audio) took %s" % end_time)
logger.info("Stage 1 (Download and Convert Audio) took %s", end_time)

# Transcribe
start_time = timer()
Expand All @@ -157,7 +157,7 @@
)

end_time = timer() - start_time
logger.info("Stage 2 (Transcribe) took %s" % end_time)
logger.info("Stage 2 (Transcribe) took %s", end_time)

transcribe.write_to_file(transcript, transcript_ml_path)
logger.info(
Expand Down
10 changes: 5 additions & 5 deletions lecture2notes/end_to_end/summarization_approaches.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ def extract_features_bow(
)
features = vectorizer.fit_transform(data)

logger.debug("done in %fs" % (time() - t0))
logger.debug("n_samples: %d, n_features: %d" % features.shape)
logger.debug("done in %fs", (time() - t0))
logger.debug("n_samples: %d, n_features: %d", features.shape)

if return_lsa_svd:
doc_term_matrix = features.toarray()
Expand All @@ -314,7 +314,7 @@ def extract_features_bow(

features = lsa.fit_transform(features)

logger.debug("done in %fs" % (time() - t0))
logger.debug("done in %fs", (time() - t0))

explained_variance = svd.explained_variance_ratio_.sum()
logger.debug(
Expand Down Expand Up @@ -555,10 +555,10 @@ def cluster(
else:
km = KMeans(n_clusters=num_topics, max_iter=100)

logger.debug("Clustering data with %s" % km)
logger.debug("Clustering data with %s", km)
t0 = time()
km.fit(X)
logger.debug("done in %0.3fs" % (time() - t0))
logger.debug("done in %0.3fs", (time() - t0))

sentence_clusters = [
[] for _ in range(num_topics)
Expand Down
8 changes: 4 additions & 4 deletions lecture2notes/end_to_end/transcribe/transcribe_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,10 @@ def resolve_deepspeech_models(dir_name):
"""

pb = glob.glob(dir_name + "/*.pbmm")[0]
logging.debug("Found model: %s" % pb)
logging.debug("Found model: %s", pb)

scorer = glob.glob(dir_name + "/*.scorer")[0]
logging.debug("Found scorer: %s" % scorer)
logging.debug("Found scorer: %s", scorer)

return pb, scorer

Expand Down Expand Up @@ -515,7 +515,7 @@ def transcribe_audio_deepspeech(
transcript_json_converted = convert_deepspeech_json(transcript_json)

inference_end = timer() - inference_start
logger.debug("Inference (transcription) took %0.3fs." % inference_end)
logger.debug("Inference (transcription) took %0.3fs.", inference_end)

return transcript_text, transcript_json_converted

Expand Down Expand Up @@ -682,7 +682,7 @@ def process_segments(
segment, model, raw_audio_data=True
)

logging.debug("Chunk Transcript: %s" % transcript)
logging.debug("Chunk Transcript: %s", transcript)

full_transcript_json.extend(transcript_json)

Expand Down
2 changes: 1 addition & 1 deletion lecture2notes/end_to_end/transcribe/webrtcvad_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def vad_segment_generator(wavFile, aggressiveness, desired_sample_rate=None):
"""
from .transcribe_main import read_wave

logging.debug("Caught the wav file @: %s" % (wavFile))
logging.debug("Caught the wav file @: %s", (wavFile))
audio, sample_rate, audio_length = read_wave(wavFile, desired_sample_rate)
if sample_rate not in (
8000,
Expand Down

0 comments on commit 04cd749

Please sign in to comment.