Added some logging code
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import csv
|
import csv
|
||||||
|
import logging
|
||||||
|
|
||||||
from sentence_transformers import SentenceTransformer
|
from sentence_transformers import SentenceTransformer
|
||||||
import tqdm
|
import tqdm
|
||||||
@@ -13,12 +14,23 @@ from .util import ffmpeg_description, parse_ucs
|
|||||||
|
|
||||||
@click.group(epilog="For more information see "
|
@click.group(epilog="For more information see "
|
||||||
"<https://git.squad51.us/jamie/ucsinfer>")
|
"<https://git.squad51.us/jamie/ucsinfer>")
|
||||||
# @click.option('--verbose', flag_value='verbose', help='Verbose output')
|
@click.option('--verbose', '-v', flag_value='verbose', help='Verbose output')
|
||||||
def ucsinfer():
|
def ucsinfer(verbose):
|
||||||
"""
|
"""
|
||||||
Tools for applying UCS categories to sounds using large-language Models
|
Tools for applying UCS categories to sounds using large-language Models
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
if verbose:
|
||||||
|
logging.basicConfig(format="%(levelname)s: %(message)s",
|
||||||
|
level=logging.DEBUG)
|
||||||
|
else:
|
||||||
|
import warnings
|
||||||
|
warnings.filterwarnings(
|
||||||
|
action='ignore', module='torch', category=FutureWarning,
|
||||||
|
message=r"`encoder_attention_mask` is deprecated.*")
|
||||||
|
|
||||||
|
logging.basicConfig(format="%(levelname)s: %(message)s",
|
||||||
|
level=logging.WARN)
|
||||||
|
|
||||||
|
|
||||||
@ucsinfer.command('recommend')
|
@ucsinfer.command('recommend')
|
||||||
@@ -44,7 +56,7 @@ def recommend(text, paths, model, interactive, skip_ucs):
|
|||||||
"Description" text metadata is extracted from audio files given as PATHS,
|
"Description" text metadata is extracted from audio files given as PATHS,
|
||||||
or text can be provided directly using the "--text" option. The selected
|
or text can be provided directly using the "--text" option. The selected
|
||||||
model is then used to attempt to classify the given text according to
|
model is then used to attempt to classify the given text according to
|
||||||
the synonyms and explanations definied for each UCS subcategory. A list
|
the synonyms an explanations definied for each UCS subcategory. A list
|
||||||
of ranked subcategories is printed to the terminal for each PATH.
|
of ranked subcategories is printed to the terminal for each PATH.
|
||||||
"""
|
"""
|
||||||
m = SentenceTransformer(model)
|
m = SentenceTransformer(model)
|
||||||
@@ -246,10 +258,4 @@ def evaluate(dataset, offset, limit, model, no_foley):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
|
||||||
|
|
||||||
# sentence_transformers generates an error in PyTorch upon loading
|
|
||||||
import warnings
|
|
||||||
warnings.filterwarnings(action='ignore', module='torch',
|
|
||||||
category=FutureWarning,
|
|
||||||
message=r"`encoder_attention_mask` is deprecated.*")
|
|
||||||
|
|
||||||
ucsinfer()
|
ucsinfer()
|
||||||
|
Reference in New Issue
Block a user