Added more helpful prompts and help
This commit is contained in:
@@ -77,13 +77,17 @@ def finetune():
|
|||||||
|
|
||||||
|
|
||||||
@ucsinfer.command('evaluate')
|
@ucsinfer.command('evaluate')
|
||||||
@click.option('--offset', type=int, default=0)
|
@click.option('--offset', type=int, default=0, metavar="<int>",
|
||||||
@click.option('--limit', type=int, default=-1)
|
help='Skip this many records in the dataset before processing')
|
||||||
|
@click.option('--limit', type=int, default=-1, metavar="<int>",
|
||||||
|
help='Process this many records and then exit')
|
||||||
@click.option('--no-foley', 'no_foley', flag_value=True, default=False,
|
@click.option('--no-foley', 'no_foley', flag_value=True, default=False,
|
||||||
help="Ignore any data in the set with FOLYProp or FOLYFeet "
|
help="Ignore any data in the set with FOLYProp or FOLYFeet "
|
||||||
"category")
|
"category")
|
||||||
@click.option('--model', type=str,
|
@click.option('--model', type=str, metavar="<model-name>",
|
||||||
default="paraphrase-multilingual-mpnet-base-v2")
|
default="paraphrase-multilingual-mpnet-base-v2",
|
||||||
|
show_default=True,
|
||||||
|
help="Select the sentence_transformer model to use")
|
||||||
@click.argument('dataset', type=click.File('r', encoding='utf8'),
|
@click.argument('dataset', type=click.File('r', encoding='utf8'),
|
||||||
default='dataset.csv')
|
default='dataset.csv')
|
||||||
def evaluate(dataset, offset, limit, model, no_foley):
|
def evaluate(dataset, offset, limit, model, no_foley):
|
||||||
@@ -110,8 +114,17 @@ def evaluate(dataset, offset, limit, model, no_foley):
|
|||||||
ctx = InferenceContext(m, model)
|
ctx = InferenceContext(m, model)
|
||||||
reader = csv.reader(dataset)
|
reader = csv.reader(dataset)
|
||||||
|
|
||||||
|
print(f"Evaluating model {model}...")
|
||||||
results = []
|
results = []
|
||||||
for i, row in enumerate(tqdm.tqdm(reader)):
|
|
||||||
|
if offset > 0:
|
||||||
|
print(f"Skipping {offset} records...")
|
||||||
|
|
||||||
|
if limit > 0:
|
||||||
|
print(f"Will only evaluate {limit} records...")
|
||||||
|
|
||||||
|
progress_bar = tqdm.tqdm(total=limit)
|
||||||
|
for i, row in enumerate(reader):
|
||||||
if i < offset:
|
if i < offset:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -131,6 +144,8 @@ def evaluate(dataset, offset, limit, model, no_foley):
|
|||||||
results.append({'catid': cat_id, 'result': "TOP_10"})
|
results.append({'catid': cat_id, 'result': "TOP_10"})
|
||||||
else:
|
else:
|
||||||
results.append({'catid': cat_id, 'result': "MISS"})
|
results.append({'catid': cat_id, 'result': "MISS"})
|
||||||
|
|
||||||
|
progress_bar.update(1)
|
||||||
|
|
||||||
total = len(results)
|
total = len(results)
|
||||||
total_top = len([x for x in results if x['result'] == 'TOP'])
|
total_top = len([x for x in results if x['result'] == 'TOP'])
|
||||||
|
Reference in New Issue
Block a user