Pytorch error while querying

Hi, I’m new to weaviate so this might be a basic question but when I’m querying using with_near_vector() I’m getting an error which says
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment. If you were attempting to deepcopy a module, this may be because of a torch.nn.utils.weight_norm usage, see Add parametrization version of weight_norm by ezyang · Pull Request #103001 · pytorch/pytorch · GitHub

Hi @Pranav_Madhu ! Welcome to our community! :hugs:

Can you provide a same code on how are you getting that vector and more on this error?

Is it on the client or from the vectorizer? what vectorizer are you using?

Hi @DudaNogueira
I am using facebook/dpr-ctx_encoder-single-nq-base as a tokenizer to generate the vector embeddings.
tokenizer = DPRContextEncoderTokenizer.from_pretrained(
model = DPRContextEncoder.from_pretrained(
input_ids = tokenizer(text, return_tensors=“pt”)[“input_ids”]
embeddings = model(input_ids).pooler_output
This block of code is where the error is coming from
result = client.query.get("DocumentSearch,[“source_text”]).with_limit(2).with_near_vector({
“vector”: query_vector,
“certainty”: 0.7
If there is a better way to use dpr as a vectorizer please let me know!

Hi! This is most probably something while generating your vectors before querying.

Weaviate client doesn’t do vectorization, and doesn’t use pytorch.

can you make sure that query_vector has you vectors?

For Hugging Face models we recommend text2vec-huggingface | Weaviate - vector database

Let me know if that helps.