diff --git a/utils/similarity/encode.py b/utils/similarity/encode.py index 0418a82e7..3ea47ca7c 100644 --- a/utils/similarity/encode.py +++ b/utils/similarity/encode.py @@ -32,7 +32,7 @@ def parse_target(target): else: simil_logger.error("Invalid target. It should be 'function' or 'Contract.function'") -def load_and_encode(infile, model, filter=None, nsamples=None, **kwargs): +def load_and_encode(infile, vmodel, ext=None, nsamples=None, **kwargs): r = dict() if infile.endswith(".npz"): r = load_cache(infile, nsamples=nsamples) @@ -42,7 +42,7 @@ def load_and_encode(infile, model, filter=None, nsamples=None, **kwargs): for x,ir in encode_contract(contract, **kwargs).items(): if ir != []: y = " ".join(ir) - r[x] = model.get_sentence_vector(y) + r[x] = vmodel.get_sentence_vector(y) return r diff --git a/utils/similarity/test.py b/utils/similarity/test.py index 08542dd0d..15a39cc13 100755 --- a/utils/similarity/test.py +++ b/utils/similarity/test.py @@ -33,7 +33,7 @@ def test(args): y = " ".join(irs[(filename,contract,fname)]) fvector = model.get_sentence_vector(y) - cache = load_and_encode(infile, **vars(args)) + cache = load_and_encode(infile, model, **vars(args)) #save_cache("cache.npz", cache) r = dict()