I would like to load the BERT’s weights (or whatever transformer) into a DPRQuestionEncoder architecture, such that I can use the HuggingFace save_pretrained method and plug the saved model into the RAG architecture to do end-to-end fine-tuning. But I got the following error I am using the last version …
Can’t send requests through socks5 proxy with Python
I was trying to send http/https requests via proxy (socks5), but I can’t understand if the problem is in my code or in the proxy. I tried using this code and it gives me an error: This is my code: Then, I checked the proxy with an online tool The tool manages to send requests through the proxy. . So
How to configure Python so that I can import a function directly from package?
Suppose I have a package structure like Suppose, there is a function func in a.py. I want to create a library, that can import func directly from pkg. from pkg import func How can I achieve this? Answer You can configure this via the __init__.py. pkg/__init__.py That way when pkg is accessed, the __init__.py …
How to resend verification email django restframework?
I can send a verification email upon registering the user so that the account can be activated. But how would one go about resending another verification email on an API? Here, I am making an activation link with a token in it and when the user opens the link it takes the token and verifies the user. But how …
Remove parent directories in python build source archive
I have the following setup for my python package: The __init__.py is empty, the pyproject.toml and the setup.cfg contain example output from the PyPi documentation page (content shown below). Now, for uploading to PyPi and for packing the python project, I run the command This gives me a new directory dist (i…
Pooling for 1D tensor
I am looking for a way to reduce the length of a 1D tensor by applying a pooling operation. How can I do it? If I apply MaxPool1d, I get the error max_pool1d() input tensor must have 2 or 3 dimensions but got 1. Here is my code: Answer Your initialization is fine, you’ve defined the first two parameters…
Why is my function returning full list instead of just a total count?
I’ve been working on a problem for a class that involves random number generation and returning a count for those divisible by 7 or 13. The function appears to work, or is at least returning the proper values along the steps. But, it returns a list for the count instead of a single value. What am I doin…
Creating a dataframe from a dictionary is giving me a could not broadcast error
I am trying to create a data frame from a dictionary I have and it gives me an error that says: Here is the code: Please tell me how I can transform the data I have into a data frame so I can export it into a csv first of all I was trying to to scrape this jobs website
Including specific strings in missing values count
I need to determine the percentage of missing and not available values. I have approx. 30 columns and data for missing are NA, ‘Information not found’ (string), and ‘Data not available’ (string). For determining the pct of missing (NA) values, I am using the following: How can I includ…
List the number of running instances in an AWS region
I want to list the number of all running ec2 instances in the us-west-2 region and I was able to list the instances but actually, I want the number of instance names is not nessosry. please see that below code Output is here Output type Answer You can store those names in a list, and check the list length: