Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add retry for download index & support MipsSquaredEuclidean #2134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rg070836rg
Copy link
Contributor

What do these changes do?

  1. In order to aviod download failure, We added the retrial logic to ensure that the index download is correct.
  2. In order to support the calculation method of inner product, we add the measurement method 'MipsSquaredEuclidean'

Related issue number

no issue number


def read_index():
with open(local_path, 'wb') as out_f:
with fs.open(index_path, 'rb') as in_f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with-block can hold multiple contexts, such as with func1() as v1, func2() as v2.

logger.warning(f"read success")
break
except: # noqa: E722 # nosec # pylint: disable=bare-except
logger.warning(f"read index file faild for times {_}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

failed for {n} times

break

# retry 3 times
for _ in range(3):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a variable name instead of _

@@ -406,7 +420,7 @@ def _execute_agg(cls, ctx, op: "ProximaSearcher"):
topk = op.topk

# calculate topk on rows
if op.distance_metric == "InnerProduct":
if op.distance_metric == "InnerProduct" or op.distance_metric == "MipsSquaredEuclidean":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use op.distance_metric in ('InnerProduct', 'MipsSquaredEuclidean')?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants