question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First of all, thank you for adding this feature!

I am attempting to recreate the example locally from the docs:

import numpy as np
import requests
from txtai.embeddings import Embeddings

data = ['test', 'test2']
def transform(inputs):
  response = requests.post("https://api-inference.huggingface.co/pipeline/feature-extraction/sentence-transformers/nli-mpnet-base-v2",
                           json={"inputs": inputs})

  return np.array(response.json(), dtype=np.float32)

# Index data using vectors from Inference API
embeddings = Embeddings({"method": "external", "transform": transform, "content": True})
embeddings.index([(uid, text, None) for uid, text in enumerate(data)])

print("%-20s %s" % ("Query", "Best Match"))
print("-" * 50)

print(embeddings.search('test', 1))

when I run the search, I receive an empty array. Perhaps data must be a tuple?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
davidmezzetticommented, Jun 4, 2022

Hi @bramses

I see the settings here use external vectors but faiss is the default ANN storage engine. When external vectors are used, it just uses the transform function to vectorize text but vectors are still stored internally.

Did you intend to have data stored externally?

1reaction
luquitaredcommented, May 17, 2022

Worked like a charm!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

internal and external divison of vectors - UrbanPro
Vector is that quantity that has direction and magnitude for example force, velocity, acceleration and displacement The scaler is that quantity ...
Read more >
External Vector Art, Icons, and Graphics for Free Download
Browse 1929 incredible External vectors, icons, clipart graphics, and backgrounds for royalty-free download from the creative contributors at Vecteezy!
Read more >
Exterior algebra - Wikipedia
is called a bivector and lives in a space called the exterior square, a vector space that is distinct from the original space...
Read more >
External Images | Free Vectors, Stock Photos & PSD
Find & Download Free Graphic Resources for External. 6000+ Vectors, Stock Photos & PSD files. ✓ Free for commercial use ✓ High Quality...
Read more >
Section Formula In Vector Algebra - Line Segment - Byju's
The point R can divide the line segment PQ in two ways: internally and externally. Let us consider both these cases individually. Case...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found