2,211,809 questions
0
votes
0
answers
5
views
How to safely cancel a running Hugging Face text generation mid-inference without restarting the whole server?
When running large models with Hugging Face's generate() function, if a user decides to cancel a request (e.g., UI "stop" button), the server has no way to interrupt an ongoing generate() ...
0
votes
1
answer
28
views
How to process CSV exports from an expense tool for visualization in a custom dashboard?
I’m currently using an Indonesian expense management tool (Mekari expense) that provides a solid built-in dashboard and allows exporting detailed expense reports as CSV files. However, I need more ...
0
votes
0
answers
20
views
Is there any advanced use of the autogenerated .bat/.sh generator conan files(e.g.: conanbuild.bat, conanbuildenv-release-x86_64.bat)?
I am using conan version 2.12 and this command:
conan install -r --output-folder= --build=missing
[requires]
zlib/1.2.13
[tool_requires]
cmake/3.22.6
make/4.4.1
ninja/1.12.1
[generators]
CMakeDeps
...
0
votes
0
answers
15
views
How to best partition my data with a 32 core EMR instance and make sure I max out the parallelize feature?
I’m optimizing a PySpark pipeline that processes records with a heavily skewed categorical column (category). The data has:
A few high-frequency categories (e.g., 90% of records fall into 2-3 ...
0
votes
2
answers
26
views
Import onnxruntime then load_dataset "causes ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found": why + how to fix?
Running
import onnxruntime as ort
from datasets import load_dataset
yields the error:
(env-312) dernoncourt@pc:~/test$ python SE--test_importpb.py
Traceback (most recent call last):
File "/...
0
votes
0
answers
20
views
Python, selenium, geckodriver, headless mode. Error when setting up the driver: Read timed out. (read timeout=120)
I am writing a program in Python using selenium. Everything works on the local computer, but the problem started when I tried to transfer the program to a remote server with headless mode configured. ...
0
votes
0
answers
29
views
What is the equivalent of torch.nn.Parameter(...) in julia's flux?
In pytorch I can create a custom module as follows (this code example is taken from here):
from torch import nn
class MyModel(nn.Module):
def __init__(self):
super().__init__()
...
0
votes
1
answer
28
views
How can I stop my tkinter hangman game accepting a correct letter more than once?
I am making a python hangman game using tkinter, however, after guessing a correct letter, it continues to accept that letter but marking it as wrong. This is my guess function:
def guess_letter(self, ...
0
votes
1
answer
45
views
How to match a substring using a pattern and replace by passing a variable in RegEx, Python
I am trying to iterate through a Pandas dataframe's column values one by one to detect a substring with a RegEx pattern and replace it wherever it shows up.
The string values in the dataframe's target ...
-3
votes
0
answers
28
views
ModuleNotFound error in Python even though files are in the same folder [closed]
I have already tried swapping the "from Chess" to "c:\Users\Maurilio\Desktop\Python\Chess" but it doesnt seem to work
I have no idea why it doesnt work, can someone explain? And ...
1
vote
1
answer
37
views
numba.njit signature for a list of jitclass objects
I am trying to pass a list of jitclass objects to a jitted function, but I've been unable to find a suitable type signature for njit. I don't understand well how Numba thinks, so I would really ...
0
votes
0
answers
18
views
Why is the numerator coefficient array returned by scipy.signal.cont2discrete two dimensional?
I'm converting a continuous-time dynamical system to discrete time using the function cont2discrete from Scipy's signal processing library.
dt = 0.1
num, den, dt = scipy.signal.cont2discrete(([1], [5, ...
0
votes
0
answers
21
views
I need a 3D adaptive threshold function in python
I have a 3D grayscale image, and I want to compute an adaptive threshold function. In other words, i want to convert gray to binary, using one of the algorithms described here.
I prefer python. I ...
0
votes
1
answer
29
views
Python pg8000 query params...syntax error at or near \”$2\"
Hi…I’m trying to add a parameter to my query but I get this error:
"errorMessage": "{'S': 'ERROR', 'V': 'ERROR', 'C': '42601', 'M': 'syntax error at or near \”$2\"', 'P': '3793', '...
0
votes
0
answers
12
views
Setting permissions between edit and view only in wagtail
In my Wagtail project, I have a class that inherits from EditView(modelAdmin). Within this class, I override the get_edit_handler method to dynamically set fields as read-only based on user ...
0
votes
0
answers
22
views
Issue with plotly filters
I'm using the following script to generate a stacked and grouped bar plot.
from plotly import graph_objects as go
data = {
"left": [
{"original": 15, "model_1&...
0
votes
0
answers
21
views
SystemError: initialization of _GPIO failed without raising an exception
My Python script toggles the state of a GPIO pin on a Raspberry Pi 4 running OSMC (however the problem was replicated on LibreELEC) to control a LED chaser circuit when media on Kodi is played. So the ...
0
votes
0
answers
49
views
How to compare every 2 rows(rows 1 and 2, rows 3 and 4, etc..) against eachother and output the results to a table
I am working on a project that requires me to compare 2 rows (1 and 2, 3 and 4, etc...) and output the differences to a table. Now I have been able to compare the columns and create the table with ...
2
votes
3
answers
38
views
How to Filter All Columns in a Polars DataFrame by expression?
I have this example Polars DataFrame:
import polars as pl
df = pl.DataFrame({
"id": [1, 2, 3, 4, 5],
"variable1": [15, None, 5, 10, 20],
"variable2": [40, ...
3
votes
0
answers
17
views
How can Polars' predicates be unpacked in an IO plugin?
Polars allows for custom IO plugins. These are great for creating custom data readers. The offer optimizations in the form of predicates, which are Polars expressing that are passed from the query ...
0
votes
1
answer
42
views
xlsxwriter not applying the border to the full dataset
I'm simply trying to create a nice border for my dataset. It applies it nicely to the entire dataset expect to the first row where the data actually starts.
import pandas as pd
import io
# In-memory ...
0
votes
0
answers
13
views
How to profile a FastAPI application running with Hypercorn (handling forked processes)?
I am trying to profile my Python module to find performance bottlenecks.
The module starts a Hypercorn server, on top of which an asynchronous FastAPI application runs.
Here’s a rough idea of how I ...
-1
votes
0
answers
22
views
PyTorch High Train Loss and Test Loss
So I'm using a CNN with 3 Conv layers with FGVCAircraft Dataset but my loss is so much higher than I expected and I don't know why.Here is the code of my CNN:
from torch import nn
class MNIST_model(nn....
0
votes
1
answer
19
views
How to use exit from glue job successfully
I am using below code to exit from the glue job
sys.exit(0)
But it is marked as fail as aws glue
My use case is that when no file found in s3 path, the pyspark code should successfully
2
votes
1
answer
31
views
How could I self-eject my USB-Drive using the python module 'sub-process'
I have a script for my USB that i need to use on multiple devices, and i want it to auto-eject, and using this method, as long as it has elevated privileges it runs, no issues, no errors, but i check ...
-5
votes
0
answers
40
views
Video capture/analysis on simple static snack (hot fries) site [closed]
Alright, so we've got this pretty basic, mostly static marketing website – you know, the kind that just shows off the product, here it is andycappshotfries.com. Nothing fancy on the backend, just ...
-1
votes
2
answers
26
views
BeautifulSoup Not Finding Table Headers on ClinicalTrials.gov Despite Inspect Element Showing Them
I am very new to Python, and I want to use the Beautifulsoup library to fetch the clinical Trials data ("mitochondrial diseases") for my research studies. Although they have an API, I want ...
1
vote
2
answers
71
views
: splice keeps cutting off the third+ digit. Why? How do I fix this?
So I have an assignment that I am working on in python, where I can only splice using the : splice method (i.e group= strg [:index]). For some reason splice refuses to see anything past 2 digits when ...
0
votes
0
answers
18
views
python 3.8 package installed but pkg_resources not able to found
Using old python version 3.8.6.
I created virtual environment in /var/virtualenvs/myvenv and installed mypkg.bouncer.client but when we import that, it gives below error.
Traceback (most recent call ...
0
votes
0
answers
18
views
Using Selenium to Navigate webpage with delays
I have a program I made that helps book golf tee-times at some busy courses in my city.
I use Selenium to navigate Chrome, pressing the buttons when time slots are available and get a time for me.
I ...
-2
votes
0
answers
49
views
Potential benefits from enforced vectorization - Numba [closed]
I am trying to see how can I improve the computational performance of this function that I am using in python. I am using numba with nopython mode and in general, I observe some small benefit in ...
-4
votes
0
answers
17
views
Tensorflow Fedearted Error parsing message
i am using eeg data in tensorflow federated .. after getting error: Serialized size of Dataset (1102790448 bytes) exceeds maximum allowed (104857600 bytes)
i manually changed serializable size to 1.5 ...
0
votes
2
answers
35
views
How I can realtime update the Ui when I receive a reuest upon fast api?
I have this simple script:
import os
import gradio as gr
from fastapi import FastAPI, Request
import uvicorn
import threading
from typing import List
from datetime import datetime
api = FastAPI()
# ...
-2
votes
0
answers
46
views
Python sys.exit() hexidecimal value [closed]
I am looking to set an exit code of sys.exit(2)
My issue is that, when I port this to a non-windows system, 2 actually translates to hexidecimal 200, which on this system is being returned as decimal ...
0
votes
1
answer
22
views
How to set up docker compose with django and pdm
I have a django project with pdm and docker compose and I set up the codebase volume to enable django hot reload and debugging in the container. Building with the compose config works fine but when I ...
-3
votes
0
answers
25
views
Thesis Ideas involving drones, BCI and python [closed]
I am studying for a degree in Computing with Information Systems and during the next scholastic year I will be starting my thesis and I wish to focus on controlling a drone with taughts using an EEG ...
0
votes
0
answers
9
views
Datahub SDK, emit a custom Platform with Logo in Python
I have tried to use http://localhost:8080/entities?action=ingest to ingest a snapshot of my platform. But Nothing happens.
Uploading dataset I am able to do, but a custom platform does not work.
Does ...
0
votes
1
answer
28
views
Joined loads across multiple tables
I'm stuck with joined loads over multiple models. I have a FastAPI project, and I'm using Jinja to serve some HTML pages. In said page, I need to access content joined from other tables (looks like ...
1
vote
0
answers
29
views
How to convert from Python pandas Timestamp to repeated google.protobuf.Timestamp? (Python + Google Protocol Buffers)
I am trying to write some code which converts the contents of a pandas.DataFrame to a protobuf object which can be serialized and written to a file.
Here is my protobuf definition.
syntax = "...
-1
votes
0
answers
21
views
how to display month in French languange in a python application deployed inside a docker container on Debian [duplicate]
I have a simple python application, when I run it in localhost (windows machine) it works as expected, and the months displayed in French, but when I deploy it on Debian inside a docker container, the ...
0
votes
0
answers
29
views
Cannot load databricks in my container because of numpy import error
I have a fairly simple Docker file to deploy on Lambda
FROM public.ecr.aws/lambda/python:3.9
COPY requirements.txt .
RUN pip install -r requirements.txt --target "${LAMBDA_TASK_ROOT}"
COPY ...
-7
votes
0
answers
37
views
Unable to launch Jupyter from Miniconda
When trying to launch Jupyter from Anaconda Prompt, the following error occurs. Jupyter installs successfully, but upon typing "jupyter-notebook" command or similar, I am presented with this ...
3
votes
1
answer
43
views
Double bar stacked bar plot in plotly dash
I'm trying to create a double bar stacked bar chart using plotly.
I found this code:
from plotly import graph_objects as go
data = {
"original":[15, 23, 32, 10, 23],
"model_1&...
0
votes
1
answer
18
views
Django Rest Framework query different from lookup_field
I am interested in designing a DRF view based class where the user may search for one or more objects but the search param may not exactly match the backing database value.
For instance, in a purchase ...
0
votes
0
answers
23
views
Optimizing overlap-add method with constant complex filter
I try to develop an overlap-add function which doesn't execute FFT of filter because it has been transformed and saved earlier. It works really good for real-value signals and filters (~20% faster ...
0
votes
0
answers
15
views
notesAndRests doesn't correctly detect initial half rest in first measure (second species counterpoint)
I'm developing an educational app in Python using Streamlit to analyze second species counterpoint exercises using music21.
One of the requirements of second species is to have two notes per measure, ...
0
votes
0
answers
7
views
Asynchronous multi-client Hugging Face inference server without blocking GPU utilization
I'm building a local inference server that handles multiple user requests concurrently on a single GPU.
Each user sends a prompt to a Hugging Face model (e.g., Llama-2, Mistral, Falcon).
However, I ...
1
vote
1
answer
27
views
How to select certain row(s) by code in a DataGrid table in Python-Shiny?
I created a table ("DataGrid") using:
ui.output_data_frame("grid")
which I filled using
@render.data_frame
def grid():
df = ...
return render.DataGrid(df, ...
0
votes
0
answers
49
views
"Expected type 'SupportsWrite[str]', got 'TextIO' instead"
import json
class Account:
"""Creates a new account"""
def __init__(self, name: str, account_no: int, pin: int, balance: float):
self.name = name....
0
votes
1
answer
48
views
TikTok Automated Upload bot wont publish Videos
ikTok Upload Bot Automation Failing at Final Step?
I’m currently developing an automated upload bot for TikTok Studio (https://www.tiktok.com/tiktokstudio/upload) using Selenium, to upload multiple ...