Quantcast
Browsing all 13981 articles
Browse latest View live

Error When Fitting Model in TensorFlow: logits and labels must have the same...

I am new to using TensorFlow, but I am trying to build an LSTM Model using tokenized strings as inputs.# Define the modeldef build_lstm_model(): input_ids = tf.keras.layers.Input(shape=(128,),...

View Article


Graph not displayed in jupyter notebook (ml) and 'TreeEnsemble' object has no...

Graph not displayed in jupyter notebook and there is an issue:'TreeEnsemble' object has no attribute 'values'there is no such error in vs codeCode:import shapimport pandas as pdfrom...

View Article


Image may be NSFW.
Clik here to view.

How do use pivot a table and cumulate them?

I have a dataset which has two destinations and the distance between them.city1city2distance1011025610210334103104610410515I want to prepare a table which will have the cumulative distance with city1...

View Article

Automatic Execution of Sagemaker Autopilot Generated Notebook

I'm able to upload data from my local machine to my s3 bucket, create an autopilot job given that data, have the file outputs from the autopilot job put back into my s3 bucket, and download the outputs...

View Article

Python Decorator class with arguments

I have a simple Python class that I want to use to add named hooks to a program I am writing. I try to run the below code and I get the following output.Code:hooks = {}class hook(object): def...

View Article


Checking derivative tensor in Pytorch

In this question on Math StackExchange people are discussing the derivative of a function f(x) = Axx'A / (x'AAx) where x is a vector and A is a symmetric, positive semi-definite square matrix.The...

View Article

Packaging with pyinstaller when there are custom input loaders

I'm trying to generate an app on my mac from a collection of python scripts. When I use pyinstaller, it can create a binary without error but it fails at runtime because of my custom import loader....

View Article

How the builtin Python's next function works as used in the Gunicorn server

The following is the code cross section from gunicorn.workers.sync.SyncWorker class self.handle method:def handle(self, listener, client, addr): req = None try: if self.cfg.is_ssl: client =...

View Article


how to include input values given to subprocess.run input in stdout txt file

A feature that I want my automatic graders to have is to write the output generated by a student's submission to a txt file. The generated txt file will then be compared to another txt file, that has...

View Article


Why is builtin sorted() slower for a list containing descending numbers if...

I sorted four similar lists. List d consistently takes much longer than the others, which all take about the same time:a: 33.5 msb: 33.4 msc: 36.4 msd: 110.9 msWhy is that?Test script (Attempt This...

View Article

Need to Extract Particular Data from PDF file

`I am trying to extract the data from a pdf file however not able to.Below is the code that I am using`import fitz # PyMuPDFdef extract_data_from_pdf(pdf_path): # Open the PDF file pdf_document =...

View Article

Problem counting activities and updating column in Python

So I have a input where I have like 16 columns, I'm trying to count the rows that I get in my output, so I can find the last row that contains the "BIDGROUP" element inside and place the count in its...

View Article

How to overcome a precision error in Python3 when summing a list of floating...

In Python3, 0.35 * 10 does not show the same result as summing a list of 10 numbers 0.35.Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) [Clang 6.0 (clang-600.0.57)] on darwinType "help",...

View Article


Receiving a status 429 too many requests when executing code in cloud...

I want to automate an api call with cloud functions but it does not work.The code works fine locally but I receive 429 when using cloud functions.Is there a way to handle it in code? or is it a problem...

View Article

How can I generate an annotated field with list of values in Django queryset?

I need to make up an advanced query that allows me get a queryset containing dictionaries with strings for keys and lists with all possible values for values. Here is what I got:In [26]:...

View Article


Cannot find any information on 9-digit decimal TOTP key

Long story short, I'm trying to create a front-end for a 2FA app in Python and I encountered something strange.Typical TOTP keys are base-32 numbers with 16 or 32 digits, but one of the accounts I was...

View Article

Trying to use RegEx to parse a log file that consists of 3-line headers...

The log file I am trying to parse has the following format:===================DateTimeStamp - ShortSummaryOfEntry===================Line 1 of textLine 2 of text ...Line last of...

View Article


transaction.atomic() rolls back if another query is executed

I am having issues with Django's transaction.atomic. I have this app that users can update their information, but I will be giving an example here. So I want to prevent update to this field if more...

View Article

PyTorch CNN model's inference performance depends on batch size

I have a CNN model which is basically just VGG16. I train it with my own data then using the model to infer the same dataset as a part of the model evaluation. The code is roughly as follows:batch_size...

View Article

Cannot update llamaindex

After llamaindex introduced v0.10 in February 2024, it introduced a lot of breaking changes to imports. I am trying to update llama-index within a conda environment, but I receive the following...

View Article
Browsing all 13981 articles
Browse latest View live