Diagonalising matrices that are too large for gpu memory
I want to diagonalise matrices which are too large for the amount of memory available on the gpu. I am interested in any approaches that would allow me to gain some speed up over just diagonalising the...
View ArticleHow to pass arguments containing parentheses to aws ecs execute-command using...
Goal: Use the aws cli in a subprocess.run call to execute a command in a container of a running task.Example Usage:task_arn = 'a_task_arn'arg = event = {'something': 'that contains ( )'}# Attempt 1:...
View ArticleRun LLama 2 on GPU
I want to run LLama2 on a GPU since it takes forever to create answers with CPU. I have access to a nvidia a6000 through a jupyter notebook. I have installed everything and the responses are fine but...
View ArticleHow to remove everything in a string before first occurrence of pattern...
I have a string that looks like the following:sample_string = 'Hello, my name is Bob.\nI like sparkling water.\nMy favorite flavor is mango.\n Goodbye.'I want to do two things:Edit the string in a way...
View ArticleHow to Override a Package's __init__.py Without Breaking Submodule Imports in...
I'm working on a project where I need to override files located in the ./lib/python3.9/site-packages" directory. I have the following hook that does just that using importlib.util and...
View ArticleHow to fix error "OPENSSL_Uplink(00007FF939F55C88,08): no OPENSSL_Applink"...
I am trying to install packages within a OSGEO4w(QGIS 3.36.2) shell, but it fails with OPENSSL_Uplink(00007FF939F55C88,08): no OPENSSL_Applink. This is preventing me from installing any packages. How...
View ArticleInstalling requirements.txt in a venv inside VSCode
Apart from typing out commands - is there a good way to install requirements.txt inside VSCode.I have a workspace with 2 folders containing different Python projects added - each has it's own virtual...
View Articlecumulative aggregate a polars list[struct[]]
I have to accomplish a complex dataframe conversion like this:original_dataframe = pl.DataFrame({'index': ['A', 'B', 'C', 'D', 'E', 'F', 'G'], 'content': [{'key': 3, 'val': 20}, {'key': 4, 'val': 50},...
View ArticleHow can I set up a virtual environment for Python in Visual Studio Code?
In my project folder I created a venv folder:python -m venv venvWhen I run command select python interpreter in Visual Studio Code, my venv folder is not shown. I went one level up like suggested here,...
View ArticleFastest way to remove first and last lines from a Python string
I have a python script that, for various reasons, has a variable that is a fairly large string, say 10mb long. This string contains multiple lines.What is the fastest way to remove the first and last...
View ArticleForce my scrapy spider to stop crawling
is there a chance to stop crawling when specific if condition is true (like scrap_item_id == predefine_value ). My problem is similar to Scrapy - how to identify already scraped urls but I want to...
View ArticleTypeError: Query fields cannot be resolved. The type QuestionnaireType...
I have the following schema:class Query(graphene.ObjectType): all_questionnaires = DjangoFilterConnectionField(QuestionnaireType)I got the error when running the testsTypeError: Query fields cannot be...
View ArticleHow to configure Airflow dag to run at specific time on daily basis?
How to configure the Airflow dag to execute at specified time on daily basis no matter what happens, something exactly like crons.I know that similar behaviour could be obtained using TimeSensor, but...
View ArticleCalculating Pi to the Nth digit
I'm trying to enter in a number and calculate pi to that digit input. I managed to be able to calculate Pi, however no matter what number I type it will still generate the same amount of Pi numbers.I'm...
View ArticlePython kafka getting consumer messages in an async manner
I'm using kafka-python. I'm trying to define for message in kafka_consumer to run async in the background. Currently, it seems to me that it runs in sync thus blocking other methods. Does kafka-python...
View Articlesklearn GridSearchCV gives questionable results
I have input data X_train with dimension (477 x 200) and y_train with length 477.I want to use a support vector machine regressor and I am doing grid search.param_grid = {'kernel': ['poly', 'rbf',...
View ArticleHow to convert np.NaN to string in ndarray/list?
I have a simple Python code:l2 =[4,np.nan, 5.1]a2 = np.array(l2)a3 = np.where(np.isnan(a2), '3.3', a2)a3 = a3.astype(float)print(a3)a3 = np.where(np.isnan(a2), 'x', a2)print(a3)The code above produce...
View ArticleValueError: too many values to unpack (expected 2) using CV library
I'm doing some quick exercises using CV library, trying to analyze some colored images.This is my code:import cv2 as cvimg01=cv.imread('PATH')from matplotlib import pyplot as...
View ArticleIntegration of Yolov8 onto Visual Studio Code
I am attempting to download the open source software (Yolov8). I tried a few methods. I ended up opting to try installation via terminal. However, the terminal outputted a few errors with my input...
View ArticlePython argparser ignoring options present
I have a python project with several command line (argparser) options which have been working. I went to modify the --scan arg to accept a integer and now several of the options are not being accepted...
View Article