October 22, 2024
Chicago 12, Melborne City, USA
python

Python dependencies in kubeflow spark operator

I wanted to ask if there is a way to use python as a .wheel or .egg or just .py dependency in kubeflow spark operator. The resulting file i have in mind would look something like this, the dependecy would be either under jars or files, i presume files would make more sense: apiVersion: sparkoperator.k8s.io/v1beta2

Read More
python

Fine-Tuning segment anything model

I’ve been trying to fine-tune the SAM model but most of the tutorials I found require us to provide prompts even after fine tuning. Is it not possible to fine tune the model so that it can work on that specific data set without us providing prompts? I tried following a tutorial but it did

Read More
python

Converting .py file to Databricks with Markdown

I wish to convert a python .py file into one that can be run on Databricks with multiple cells. I don’t wish to do it in the GUI, as I’ll eventually want an automated process for this. What is the minimal code to create a title cell and then have the rest of the code

Read More
python

Schema replacement is not working in SQLalchemy

I have the following Python code which uses SQLalchemy stmt = select(Lclzone.sequence).where(Lclzone.refno == cReference) _sequence = self.session.execute(stmt).scalar() It generates the error; Unable to process fmb73 error: (psycopg2.errors.UndefinedTable) relation "public.lclzone" does not exist LINE 2: FROM public.lclzone ^ [SQL: SELECT public.lclzone.sequence FROM public.lclzone WHERE public.lclzone.refno = %(refno_1)s] This is application has multiple schemas. I need it

Read More
python

mysql-connector-python self._cmysql.connect(**cnx_kwargs) crashes the application

I have issues with my PySide6 application. In the application I am using mysql-connector-python libary and trying to connect to our private Mysql server. I have noticed that on some computers, my application will run without any issues, while on other PC’s it will crash with Process ended with exit code 3221225477. I have run

Read More
python

Pandas DataFrame – KNNImputer Algorithm Implementation

I have a dataset set with missing values and I want to fill them groupwise. I used the groupby() method and it works fine. But the same thing I want to do using the KNNImputer algorithm. Code I have done so far(using groupby() method which worked as expected): null_columns = df.columns[df.isnull().any()] # filling median values

Read More
python

Issue Displaying All Colors of a Product Variant in Django Template

I’m working on a Django application where I have a Product model with a many-to-many relationship with a Color model. I want to display all colors associated with a product variant on its detail page. However, when I click on a specific color (e.g., white), the page only shows that color instead of all available

Read More
python

python. kafka raft connect to controller

I want to connect to kraft controller on port 9093 (non broker). And I can’t to connect code example: #!/usr/bin/env python3 from confluent_kafka.admin import AdminClient import json import os credentials="credentials/example.json" with open(credentials, 'r') as json_file: data = json.load(json_file) conf = { 'bootstrap.servers': 'kafkacontroller1.example.com:9093', 'security.protocol': 'SASL_SSL', 'ssl.ca.location': os.path.abspath('./credentials/example/ca_cert'), 'ssl.certificate.location': os.path.abspath('./credentials/example/ca'), 'ssl.key.location': os.path.abspath('./credentials/example/ca_key'), 'ssl.key.password': data['SSLKeyPassword'], 'sasl.mechanism': 'PLAIN',

Read More
python

Where do I put Django Debug Terminal in middleware

Django Debug Terminal’s documentation says The order of MIDDLEWARE is important. You should include the Debug Toolbar middleware as early as possible in the list. However, it must come after any other middleware that encodes the response’s content, such as GZipMiddleware. But this can be a bit tricky. For example, in my settings.py I have

Read More
python

Why is the Python mulitprocessing using class functions slower than in serial for this code?

I am trying to run a multiprocessing pool within a class to calculate several values that use class functions of a much larger class. I am trying to take the initial values and add a random 5% normal distribution to each value and calculate the new log likelihood of those new values. Here is a

Read More