text:
Issues with larger context lengths in a transformer model like GPT
Based on my understanding, one of the issues with longer context lengths is the computational complexity of attention mechanism which is quadratic. But is this really a problem on modern hardware with parallel CPU's?
Eg: 32k context length (GPT4) has a complexity of O(32k * 32k) which is O(1024 million).
Are there any other issues apart from the above which are impeding transformer models from supporting larger context lengths?
As a side note, even if larger context lengths leads to slower non-interactive responses, I think it can still be very helpful in a lot of scenarios


text:
Should I downsample because of overrepresentation of geographic locations in time series data
I am in the start of working with a project where I am hoping to be able to classify activities based time series data. I have historic data; lat/long/speed/(..) as well as the activity.
The challenge is that I have two sources for these data - one is having a short range but high detection (fixed equipment on ground) and the other have high range and low detection (satellite). This means that there is a 10-1 amount of data in favor for the source with short range. But the coverage for the high range is twice as good.
I worry that this will lead to that the data that is picked up by the short range detection will be overrepresented in any future classifications.
One idea I have is to down sample the data to a time-scale where the time-density of the data is more or less the same, which means bringing the high detection source "down" to level with the high coverage one.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Tips for getting LSTM to train for next word predcition
I am trying to train an LSTM network for next work prediction. I have scraped a rather large dataset from Wikipedia of country descriptions. I have done normal preprocessing (removing punctuation and contractions, etc.). The text is vectorized into integers with a vocab size of 1,000 and any words not in the most common 1,000 are replaced with <unk>. It is then batched into sequences of 128 words each and these are further split to provide variable sequence lengths to the model. In total, I end up with 2.1million sequences, obviously with considerable overlap.
An example of my data (prior to tokenization) is below:
['some', 'scholars', 'suggest', 'that'] -> 'the'
['some', 'scholars', 'suggest', 'that', 'the'] -> 'root'
['some', 'scholars', 'suggest', 'that', 'the', 'root'] -> 'name'
...

It is worth noting that the dataset contains many unknown words (about 30% of the total dataset is <unk>).
The model I am using is a simple LSTM:
from tensorflow.keras import layers, Model
class LSTMModel(Model):
    """A super simple LSTM model for history text generation"""
    def __init__(self, vocab_size, embedding_dim=256, lstm_units=512, num_layers=2,
                 bidirectional=False, num_dense_layers=2, hidden_dim=256,
                 **kwargs):
        super().__init__(**kwargs)

        # Embedding from vocab into embedding dimension
        self.embed = layers.Embedding(vocab_size + 1, embedding_dim)

        # LSTM layers
        lstm_layers = []
        for _ in range(num_layers - 1):
            local_layer = layers.LSTM(lstm_units, return_sequences=True)
            if bidirectional:
                local_layer = layers.Bidirectional(local_layer)
            lstm_layers.append(local_layer)

        # Add final layer
        final_layer = layers.LSTM(lstm_units, return_sequences=False)
        if bidirectional:
            final_layer = layers.Bidirectional(final_layer)
        lstm_layers.append(final_layer)
        self.lstm_layers = lstm_layers

        # Small MLP at the end
        self.head = MLP(num_dense_layers, vocab_size, hidden_dim)

    def call(self, x):
        # Mask zero values in input (ignored by LSTM)
        mask = utils.make_padding_mask(x)
        mask = tf.cast(mask, tf.bool)
        x = self.embed(x)
        for lstm in self.lstm_layers:
            x = lstm(x, mask=mask)
        return self.head(x)

This takes a sequence as input and returns a softmaxed vector over my vocabulary size. I am then using crossentropy to train to predict the next word correctly. But my loss decreases only a little at first and then stays quite high. The model learns to always predict "the" as the next word.
Why won't it learn anything? I have tried larger/smaller models (including a huge model with 30million parameters), playing with learning rate, using label smoothing, increasing vocab size, different sequence lengths, and nothing seems to work. Is this problem simply too hard? Is there something fundamentally flawed in my approach?
I'm learning NLP and would appreciate any insight.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Training model for a board game with large actions space
that has a NxM board, and players take turns putting their "dots" on the board a X,Y coordinate, taking up the space. When a few connected dots surround an opponent dot(s), the surrounding dots create a polygon which is taken (no dots can be put on it) and counting the surrounded dots as points. The game ends when less than 20% of the board remains available and the winner is the player who has more points.

So my question is, how do I approach the training of an agent for this game? I've trained a model on a much simpler "fighting" game, with 3 possible actions, stamina and HP to acceptable results using this setup:
# Define the game environment
NUM_OF_ACTIONS = 3
NUM_OF_EPISODES = 20

# Define the neural network model
model = tf.keras.Sequential([
    tf.keras.layers.Dense(32, activation='relu', input_shape=(4,)),
    tf.keras.layers.Dense(32, activation='relu'),
    tf.keras.layers.Dense(NUM_OF_ACTIONS, activation='softmax')
])

# Define the loss function and optimizer
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy()
optimizer = tf.keras.optimizers.Adam(learning_rate=0.001)

And this code for training each step:
action_probs = model.predict(np.array([state]))
        action = np.random.choice(NUM_OF_ACTIONS, p=action_probs[0])

        # Take the chosen action and observe the resulting state and reward
        next_state, reward, done = env.step(action)
        print(f"{reward=}, {done=}")
        # Train the model on the observed transition
        train_step(state, action, reward, next_state, done)

But in setup I don't see a way to limit the action space when coordinates become unavailable - how do I disable coords as they become unavailable?

Do I need to train the agent to play on each map size (NxM) I want him to play on?

Welcome to AI SE. I'd like to propose several points of improvement for your post. First, limit your post to one question. Second, refrain from questions on programming advice etc, you can better ask those over at DS SE. Lastly, put your one specific question in the title of your post.


text:
Is this lstm diagram correct?
I made an LSTM diagram, but do not know if it is correct. Can you point out any errors in case there are any?


text:
What is the difference between "Image Clustering" and "Unsupervised Classification" tasks?
I am trying to compare some results that I obtained in benchmarks with my unsupervised model. My model basically takes an unlabelled dataset and clusters it into semantic classes (10 clusters in the case of MNIST). However this clustering is done in such a way that a classifier is created (unsupervisedly), as for every image, it outputs a $k$-long vector, with probabilities of being in cluster number $k$.
For evaluation, and because I actually have the labels of the dataset (only to evaluate), I associate every cluster with a class (based on the most assignments to a class per cluster), and calculate an accuracy.
When trying to compare with the MNIST benchmark for instance, I found these two very confusing categories:
On the one hand, we have Unsupervised Image Classification on MNIST
https://paperswithcode.com/sota/unsupervised-image-classification-on-mnist
On the other hand, we have Image Clustering on MNIST-full
https://paperswithcode.com/sota/image-clustering-on-mnist-full
They record different scores, as if some papers don't qualify for one task but do for the other. At the same time, some papers are in both categories.
What's the difference? I'd really like to know because I'm obtaining State of the Art in this benchmark, and I need to be sure that I'm comparing against the correct papers.
edit: another thing I noticed is that some papers that do classification by clustering images, don't use a test dataset. Why is this allowed? How can they know that the generalization ability of their model is still good?


text:
Spiking neural network framework for training simple networks with no biases and negative weights
I'm looking for a spiking neural network framework to train (at the beginning) a simple network with two or so hidden layers against MNIST digits dataset, and then to take the weights and try to model it as an electrical circuit. That's why I'm looking for a framework that could best describe physical LIF nodes and connections.
An example model of physical LIF (obviously the framework doesn't have to implement this exactly) modeled by differential equation taken from S. R. Nandakumar, et al. (2020). Here $C_m$ is the membrane capacitance, $g_L$ is the leak conductance, $E_L$ is the leak reversal potential, and $I(t)$ is the
net synaptic current fowing into the neuron.
$$C_m\frac{dV(t)}{dt}=-g_l(V(t) - E_L) + I(t) $$
I tried to use NengoDL, but the neurons there have biases (which aren't present in physical description of LIF neurons, and I haven't found a way to disable them), and it would be great if you could restrict the weights to only positive values (as far as I know you can't do this in Nengo).


text:
Clustering of Graph with Binary Vertex Labels
Consider a graph data structure with unweighted edges, where each vertex has been assigned either 0 or 1.
I am wondering if there exists a good way of clustering this graph to detect communities. All nodes within a community should be connected. A community could contain both 0 and 1, but one of the two labels should be dominating. It should ideally also be densely connected within each community, and sparsely connected between communities. It should be possible to detect more than 2 communities from the structure.
The graph clustering algorithms that I have found works with the edge weights. So a more open, general question would be if there exist any nice algorithms that work with vertex labels rather than edge weights?


text:
Improving embedding similarity search of aggregated embeddings
I am building an author suggestion tool that proposes authors writing about similar topics as a given input text. I want to use embeddings for this. The way I currently do it is to store embeddings of many articles of many different authors in a vector database. Then I generate an embedding for every author by taking the embeddings of their last X articles and calculate the mean of those vectors. I can then compare the embedding of any given input text with the aggregated author embeddings using cosine similarity.
This does work to some extend but it looks like:

The aggregated author embeddings do not only capture topics, but also other things such as writing style, language, and so on. Which I am not really intested in.
By using a mean as embedding it captures the broad field of an author quite well (e.g. tech, science, economy, sports) but the sub-fields seem to get over-shadowed by authors that write more generic articles sometimes. Searching for a niche topic often doesn't give the best results as the niche authors that wrote articles about it often get scored worse than authors that write more generic articles in the same overacrching field.

I am looking for ways to improve my method, any suggestions are welcome.


text:
How to use deep relative trust to measure the distance between two RNNs, and between two transformers?
I want to measure how different two networks, i.e., between two RNNs and between
two transformers. I read that Deep relative trust can be used to measure the distance between two NNs. Can it be used on RNNs and Transformers?
Because in the paper, as far as I understand, it is only applied to MLPs?
Can I simply loop for each layer and compute the deep relative trust?
I want to plot the difference (distance) between two neural nets (as the x axis) vs the differece between the two nets' generated solution (as the y axis)?

Can you clarify why you want to do this? One could define a lot of similarity measures (e.g. number of parameters, number of layers of the same type, etc), but each may be useful in one case but not another. So, maybe you could explain why you want to do this.

I have added the intended usage. I'm still wondering though if it is logical/rational for that use..


text:
What would be the best approach to resume longer texts in one word?
I am trying to create a model capable of resuming longer texts (my dataset has up to 140 words for each instance) in a single word (or multiple separate words). The idea is to synthetize positive or negative feedbacks as words like "frustrated", "amazed" etc
In my research I found references to "Seq2Seq" and "Autoencoder" strategies.
I tried to train an Autoencoder neural network but since I am very newbie i hadn't had much success. The Autoencoder sounded like a good ideia because right now the entries in my dataset are not labeled
I was wondering what architecture is the best option in this case
Thanks in advance


text:
Approximate weight matrices of pretrained models
I am looking for a guide on matrix approximation of pretrained models.
My idea is related to transfer learning: I want to use a pretrained model, take the weights and biases of one of its layers, approximate the matrix using a matrix of a different shape, and deploy that matrix in my new model as a frozen layer. Do you have any recommendations for research papers I could look into?

Can you clarify why you think it's possible to do this and why do you want to do this? You tagged this with SVD, but that doesn't seem to be the same thing you're looking for.

I am not sure it is possible. I was thinking conceptually about low-rank approximation (Lora), but I never studied how it works in detail. I would like to do this because transfer learning gives me some nice properties for my matrix, such as a meaningful latent space if I choose the right matrix to approximate. I will provide more details tomorrow.


text:
Neural translation model - alignment as a latent variable or as a trainable part of the model
I consider the neural machine translation method in https://arxiv.org/pdf/1409.0473.pdf.
I understand that the intuition here, as the title says, is to jointly train alignment and translation. Alignment is part of the model, the alignment model is
$ e_{ij} = a(s_{i-1}, h_{j}) $
where function $a$ scores the match between information around time j represented by an annotation $h_{j}$ and the translation model output at time $i-1$ represented by the RNN's hidden state $s_{i-1}$.
I kind of understand we obtain a big model intricating the alignment part embedded by the annotations and the translation part, in particular with annotations depending on the hidden states of the translation model.
It says,
Note that unlike in traditional machine translation,
the alignment is not considered to be a latent variable.

Here my question, how is a model like, which considers alignment as a latent variable?
It might be similar to the approach described in this article, with the "alignment model" made "not trainable". In this case, how is alignment computed? How would one formalize this translation model where alignment is a latent variable?


text:
Change in the Structure of Deep Associative Networks since their Inception
I am trying to understand how far associative networks have evolved from the Hopfield network. A lot of the research is only available to institutions which is why I deferred to this stack exchange. My belief is that modern networks have fully connected networks with a basic perceptron design on the inside with weights and biases. The inputs consist of the state of its neighboring nodes. Is there any truth to my understanding or is there anything I am missing? Could you please refer me to some places to better understand the modern state of associative memory?
---EDIT---
I am referencing the modern versions of the Hopfield network described in this paper: https://www.pnas.org/doi/epdf/10.1073/pnas.79.8.2554
I am not referencing any particular paper but merely want examples of modern DANs in an attempt to see how much they have changed from the original one.
---EDIT---
If this is not the right place to ask this question, could you please refer me to right place to get my answer? I truly appreciate all your help!

Could you add some references? Also, are you referring to some paper in particular?

I edited my question. Please let me know if you need any more information.

Can you please reformulate the title as a specific question? Thanks.


text:
which journals accept an original idea on AI based face recognition tool as a conceptual paper
I have an original idea/concept for a new face recognition AI based tool. I do not want to patent it but wish to publish it as a conceptual paper, that is to share the original concept. which journals allows this kind of conceptual paper

You mean to explain the idea, without a practical implementation and comparison with the SOTA?

@LucaAnzalone YES

Maybe the Frontiers in AI journal. Have a check, I'm not so sure

Okay. Thank you for your response.


text:
How to create dataset to extract information and classify intent using BERT?
Given a message: "Hey I am XYZ person (description about oneself), and I was thinking to launch a youtube video, wanted to get in touch with someone with similar experience", the model should detect two things: 1) description about the sender, 2) intention- "to connect with someone who has some experience in launching yt videos".
Here, the model should be able to detect what "same" implies.
I realized I can't make do with only intent classification because classification can only be done based on trained labels and if prompt changes to something like,
"Hey I want to connect with someone who lives in Europe and has a newly set up business in ai", the model has to detect multiple elements - (lives in Europe, newly set up business in ai).
How do I set up the training data and how do I go about solving this using Bert? My best solution was information extraction or a combined approach of intent classification and NER, where intent can be classified based on fixed labels- to seek collaboration/ seek advice. Etc.


text:
How many iterations are required for iterative-lengthening search when step costs are drawing from a continuos range [0, 1]?
I just started studying the book AI A modern Approach and I am lost on the following question. Could someone explain please or provide reference paper to understand.
Consider the step costs drawn from the continuous range [0,1] with a minimum positive cost e. How many iterations are required in the worst case?
I know it has already been answered but it does not explain the answer(
How many iterations are required for iterative-lengthening search when step costs are drawing from a continuos range [ϵ, 1]?)


text:
Val_loss not converging to 0, is my result acceptable?
I'm trying to make a CNN model that is a binary classifier, trying to distinguish between Electronic and Non electronic waste.
Although i'm getting around 90% on the val_accuracy, my loss converge to 0 while my val_loss stales at 0.3 ~ 0.2.
I have tryed differents architetures for the model, techniques for regularization as dropout, batch normalization, kernel regularizes, data augmentation and even synthesize the dataset in differents ways, none of this was able to converge my val_loss to 0.
here is a confusion matrix performed at 52 images never shown to the model:

Model values:

Accuracy and Loss graphs:
[

There is only 8 epochs performed because of the earlystop, it starts to overfit by the 15 epoch.
It actually performed well in the dataset shown for the confusion matrix, but is it acceptable to have this flutuation between loss and val_loss? is 0.2 val_loss too much?
Is this sign for overfit? if not, what does this represents?

This is overfitting, and as I can see it's around $9%$ on accuracy which is quite large. Try using optimizers like AdamW with enough weight decay (like 1e-3, or 10x less if too severe)


text:
My text classifier behaves like regex
I'm trying to train binary classifier that classifies ask to ask programming questions, programming questions that say "I'm getting an error about x/I have problem about x" but don't say the error/problem and those who ask inadequate questions ask for help in dm. I looked models and linear svm did better job than others. So i trained linear svm. But when linear svm see certain word phrases like "Who knows" etc. it tends to give positive label. Because in dataset there is so much "Who knows javascript" like questions. So when i test "Who knows ewsamfsakfas" model gives 1 label. It behaves like regex.
So i tried to add new datas by my hand like that:

"Who knows safasfasfsa" -> 0
"Who knows msafmsafmsamf" -> 0
"Who knows smafsamfsnafn" -> 0
...

Weirdly... SVM can't learn properly and still gives 1 label. I even tried adding more data it finally learned to give 0 label. But when i add new real world 1 label data and tested again "Who knows ansjafsanfjnas" it gived 1 label...
I don't have good math so i don't know what's going on. But i need good solution for that. Because it's practically regex... Am i need to train second classifier that classifies "it is programming question or not"? Or is there any other possible solution?

What features you use to describe the text? How you encode it and train the model? Have you tried TF-IDF as feature?

Yes i use tf-idf vectorizer i forgot to say that sorry. If unique words mean features then... you know there are many feature. example datas are "is there any java expert around", "pls help my unity problem in dm" etc.

Do you remove the stop words? If not you should, and you may add "who" and "knows" to them too. Probably the model is learning just a correlation with the count of such works, you want to avoid that

i lowercased and removed other than a-z. but didnt remove stop words. because in turkish stop words there are "is there", "who" etc. if i remove stop words then i thinked how can model undestand data is question or not?


text:
What is actually tuned during prompt engineering of autoregressive LLMs like GPT?
There are a lot of sites going over prompt engineering, but I don't see them explaining what is actually being changed. Is it hidden activation layers being tuned?


text:
How many Neurons are in a single Layer Transformer?
For example, in the base model described in the original paper, each layer has the following configuration:

6 layers in the encoder
6 layers in the decoder
A model size (i.e., the dimension of the embeddings and the hidden layers) of 512
8 attention heads
A feed-forward/filter size of 2048

How do I calculate the number of Neurons? Is there any formula, as in the parameters?


text:
Translating relatively little known language
I want to build a model that does translation from some little known foreign language to English. No clue how to go about and wanted to get some advice.
Here’s what I have:
An old pdf (looks like something that was just scanned into a pdf so it’s kinda difficult) that has a word in the foreign language and Spanish and English translations
I estimated that it’s only about 3500-4000 words (a small dictionary)
My hope is to try to use a voice to text app to capture a speaker’s voice(speaking foreign language) and turn it into text. And then use the dictionary to make approximative translations and output that into a screen.
Basically,
Real-time translating apps use a combination of machine learning and artificial intelligence to translate text or speech from one language to another. The process typically works as follows:
1.The user speaks or types in a sentence or phrase in the source language.
2.The app uses a microphone or speech-to-text engine to convert the input to text.
3.The app uses a machine learning model to translate the text into the target language.
4. The translated text is displayed on the screen or if one wants to be ambitious spoken aloud by the app.
Seems simple but I feel like I would need to work on obtaining more data. Perhaps approaching hundreds of people or work with a team to somehow and more words and many sentence combinations?
What exactly would I need to do? and how realistic is it? Hoping to use ChatGPT4(haven't used it) or other LLMs


text:
NLP - Sentence reconstruction
I need to define a neural network for sentence reconstruction. Below the details:
The dataset is composed by a snapshot of wikipedia. We restricted the vocabolary to the 10K most frequent words, and only took sentences making use of this vocabulary. In addition, we restricted to sequences with a length between 3 and 30 words.
Here an example:
For instance, given the sequence of words

to henry at be first france the king wanted with of friends

the model should be able to reconstruct the following sentence

at first henry wanted to be friends with the king of france

Concerning the score:
Let s be the source string and p your prediction. The quality of the results will be measured according to the following metric:
look for the longest substring w between s and p
compute |w|/|s|
If the match is exact, the score is 1.
When computing the score, you should NON consider the start and end tokens.
The longest common substring can be computed with the SequenceMatcher function of difflib, that allows a simple definition of our metric.
The score must be computed as an average of at least 3K random examples taken form the test set.


text:
Can you clarify these terminologies?
I am having confusion with the terminology Computational Intelligence.
As far as I know: Computational intelligence refers to the field of study that combines principles from artificial intelligence, machine learning, and optimization to develop algorithms and models capable of solving complex problems and adapting to changing environments.
What is the difference between Machine Learning and Computational Intelligence? Are they related or not?
What are not the sub-fields or sub-topics of Computational Intelligence?
Where does Computational Intelligence sit in the following chart?


text:
How to extract body of a base-model and fine tune with that body on different shape dataset like this situation
In BERT like transformer model (I am not talking about BERT in this thread), it has 2 training objectives Masked Language Modeling and Next sentence prediction right? and BERT model is also supports different input shapes, So I am actually building a model with 2 training objectives on a base model and those 2 training objectives are Denoising data on time-series and Triplet loss on time sereis and just want to take the base model body and fine tune the model on different data with different shape in TensorFlow, How is code written for this in tensorflow at low-level and what I mean is extract that body add new inputs and new outputs to this base model and fine-tune whole model on some dataset with different shape.
Base Model Arcitechture:
inputs=layers.Input((3000,7))
x = layers.Conv1D(32, 3, activation=tf.nn.leaky_relu,padding='same')(inputs)
x = layers.MaxPooling1D(2)(x)
x = layers.MultiHeadAttention(num_heads=4, key_dim=2)(x, x)

x = layers.BatchNormalization()(x)

x = layers.Conv1D(64, 3, activation=tf.nn.leaky_relu,padding='same')(x)
x = layers.MaxPooling1D(2)(x)
x = layers.MultiHeadAttention(num_heads=4, key_dim=2)(x, x)

x = layers.GlobalAveragePooling1D()(x)
x = layers.Dense(512, activation='relu')(x)
x = layers.Dense(256, activation='relu')(x)
outputs = layers.Dense(128, activation='relu')(x)

base_model = keras.Model(inputs=inputs, outputs=x)

Pre-training Base model:
input_denoising = keras.Input(shape=(x_unlabelled.shape[1], x_unlabelled.shape[2]))
x = base_model(input_denoising)
x=layers.Dense(3000*7,activation=tf.nn.leaky_relu)(x)
output_denoising=layers.Reshape((3000, 7))(x)

input_1 = keras.Input(shape=(x_unlabelled.shape[1], x_unlabelled.shape[2]))
input_2 = keras.Input(shape=(x_unlabelled.shape[1], x_unlabelled.shape[2]))
input_3 = keras.Input(shape=(x_unlabelled.shape[1], x_unlabelled.shape[2]))

output_1 = base_model(input_1)
output_2 = base_model(input_2)
output_3 = base_model(input_3)

concatenated = layers.concatenate([output_1, output_2, output_3])
output = layers.Dense(2, activation='softmax')(concatenated)

combined_model=keras.Model(inputs=[input_denoising,input_1, input_2, input_3],outputs=[output_denoising,output])
combined_model.compile(optimizer='adam',loss=['mse','categorical_crossentropy'])

combined_model.summary()

So, now I want to remove all the input and outputs and add new inputs and outputs aligned with new data and fine-tune on that dataset, so how can I do this


text:
Loss is negative- DQN with BCE Loss function
I am writing a code with DQN, using BCE as a loss function for the classification of a sequential time series. But while training, the loss value goes in negative. Also, accuracy and binary accuracy are low as well almost 20 %. I have tried tuning the hyperparameters as well.

Using RL for classification is a very bad idea, because you make everything at least 100x more difficult and slower to learn. Just use supervised learning, as usual.


text:
How to load labeled data to train CNN model?
I am trying to load my dataset to train cnn model :
my dataset is like :
- Dataset
- Train
    - Person
        - person_image1.jpg
        - person_image1.xml
        - person_image2.jpg
        - person_image2.xml
        ...
    - Dog
        - dog_image1.jpg
        - dog_image1.xml
        - dog_image2.jpg
        ...
- Valid
    - Person
        - person_image1.jpg
        - person_image1.xml
        - person_image2.jpg
        - person_image2.xml
        ...
    - Dog
        - dog_image1.jpg
        - dog_image1.xml
        - dog_image2.jpg
        ...
- Test
    - Person
        - person_image1.jpg
        - person_image1.xml
        - person_image2.jpg
        - person_image2.xml
        ...
    - Dog
        - dog_image1.jpg
        - dog_image1.xml
        - dog_image2.jpg
        ...

I labeled the images with labelImg and choosed the pascalVoc as save format .
this is an examle of label : person_image1.xml
<annotation>
    <folder>Person</folder>
    <filename>428.jpg</filename>
    <path>/home/cnn/dataset/train/Person/428.jpg</path>
    <source>
        <database>Unknown</database>
    </source>
    <size>
        <width>416</width>
        <height>416</height>
        <depth>3</depth>
    </size>
    <segmented>0</segmented>
    <object>
        <name>Person</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>55</xmin>
            <ymin>86</ymin>
            <xmax>112</xmax>
            <ymax>158</ymax>
        </bndbox>
    </object>
    <object>
        <name>Person</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>122</xmin>
            <ymin>94</ymin>
            <xmax>169</xmax>
            <ymax>166</ymax>
        </bndbox>
    </object>
</annotation>

I used this code :
    class_mapping = {'Passenger': 0, 'Phone Violation': 1, 'Seat Belt': 2, 'With Helmet': 3, 'Without Helmet': 4}

# Function to load and preprocess images and labels
def load_data(folder_path):
    images = []
    labels = []
    for class_name in class_mapping:
        class_folder = os.path.join(folder_path, class_name)
        for image_file in os.listdir(class_folder):
            if image_file.endswith('.jpg') or image_file.endswith('.png') or image_file.endswith('.jpeg'):
                image_path = os.path.join(class_folder, image_file)
                label_file = image_file.split('.')[0] + '.xml'
                label_path = os.path.join(class_folder, label_file)
                print("image_path",image_path)
                print("label_path",label_path)
                if os.path.isfile(label_path):
                    img = cv2.imread(image_path)
                    img = cv2.resize(img, (416, 416))  # Resize images to a consistent size
                    img = img.astype('float32') / 255.0  # Normalize pixel values between 0 and 1
                    images.append(img)

                    # Parse the XML file to extract label information
                    tree = ET.parse(label_path)
                    root = tree.getroot()
                    # Extract the necessary label information from the XML
                    # XML follows Pascal VOC format:
                    xmin = int(root.find('object/bndbox/xmin').text)
                    ymin = int(root.find('object/bndbox/ymin').text)
                    xmax = int(root.find('object/bndbox/xmax').text)
                    ymax = int(root.find('object/bndbox/ymax').text)

                    print("class_name",class_name)
                    label = class_mapping[class_name]
                    print("label",label)
                    print('xmin, ymin, xmax, ymax',xmin, ymin, xmax, ymax)
                    labels.append((xmin, ymin, xmax, ymax, label))

    return np.array(images), np.array(labels)

# Load train images and labels
train_images, train_labels = load_data(train_folder)

# Load valid images and labels
valid_images, valid_labels = load_data(valid_folder)

# Load test images and labels
test_images, test_labels = load_data(test_folder)

# Combine train images and labels
train_data = (train_images, train_labels)

# Combine valid images and labels
valid_data = (valid_images, valid_labels)

# Combine test images and labels
test_data = (test_images, test_labels)

But I get bad trained model :

Train Loss: 1030294208.0000
Train Accuracy: 0.0000e+00
Validation Loss: 1030294208.0
Validation Accuracy: 0.0

THANKS


text:
Create a texture from a sample
Photoshop has a great feature - Fill/Content-Aware. That's what it does. You have an image with more or less uniform content (ideally a pattern) and you want to expand that content over a larger area. To do this you create free space and use this tool. It sounds cool, but unfortunately this tool does not always give an acceptable result. I'm looking for a tool that performs a similar task, but in a smarter way.
Ideally, this should be a tool that creates a seamless texture based on the sample. Of the ready-made solutions, I found Withpoly, but I cannot highly appreciate the result of this work. Also while searching I came across this post:
Using AI to extend an imagine pattern.
The first answer is almost what I need, but I'm not familiar with Torch (just a little Keras) and I can't change the code so that the result is like in the answer (seamless texture).
Please advise an app (online or local. and of course I'm looking for a free app), or a ready-made Keras solution for solving such a problem.


text:
How to compare word segmentation methods?
I am comparing a few methods of word segmentation in artificial language without dictionary and "golden" segmentation.
Let's say, idolikecats is splitted by three different algorithms to i do like cats, ido li kecats and ido lik cat s.

Is there a measure to compare the quality of the segmentation?
Is it a good idea to compare it with perplexity on the char level?
Would it require building an n-gram model for each segmentation method on the training set and comparing results from the test set?


text:
How is (**) obtained from (*) in deriving the equivalence between average costs?
How is (**) obtained from (*) in deriving the equivalence between average costs?

Do you have the definition of $d_\pi(s)$? because what I've noticed is that in (**) figures $d_\pi(s')$ over next state $s'$, while in (*) is over $s$ - in fact it also says "after one-step transition" so, maybe, it just starts at the next timestep.


text:
Positional encoding in transformers
After training a single-head transformer, I'm trying to understand some of its internals.
The question I want to answer is:

Given token=X in the last position, how does the query it generates correlates (dot-product) with the keys produced by tokens in other positions?

For example, if I use single letters for the tokens and the token in the last position is a "H", it's probably very important for it to know if there's a "T" in the previous position (since "THE" is a very common word in English) and less important to know if there's a "T" 2 positions before it. So calling the query produced by token "H" in the last position QHL, I'd expect a softmax of the [(QHL . key("T", pos-2)), (QHL . key("T", pos-3))] to be something like [0.90, 0.10].
Does that make sense? I hope not (but I don't know why), because this is not working well.
I mean, in a sense this works, but the softmax result is the same regardless of the second token (e.g. it doesn't matter if I dot-product with "T" as in the example or with "H").
I created a toy example to try to demonstrate this:
# let's encode just 2 tokens and 3 positions using one-hot encoding instead of a trained embedding
tok1 = torch.tensor([1, 0, 0])*1.0  # let's say this is token "H"
tok2 = torch.tensor([0, 1, 0])*1.0  # let's say this is token "T"
pos1 = torch.tensor([1, 0, 0])*0.5  # first position
pos2 = torch.tensor([0, 1, 0])*0.5  # second position
pos3 = torch.tensor([0, 0, 1])*0.5  # third/last position

# query(x) and key(x) linear layers
q = nn.Linear(3, 3)
k = nn.Linear(3, 3)

q13 = q(tok1 + pos3)  # query produced by tok1 in pos3
k11 = k(tok1 + pos1)  # key produced by tok1 in pos1
k12 = k(tok1 + pos2)  # key produced by tok1 in pos2
k21 = k(tok2 + pos1)  # key produced by tok2 in pos1
k22 = k(tok2 + pos2)  # key produced by tok2 in pos2

r11 = torch.dot(q13, k11)  # "affinity" (dot product) between q13 and k11
r12 = torch.dot(q13, k12)  # "affinity" (dot product) between q13 and k12
r21 = torch.dot(q13, k21)  # "affinity" (dot product) between q13 and k21
r22 = torch.dot(q13, k22)  # "affinity" (dot product) between q13 and k22

print("query(tok1+pos3) . key(tok1+pos1)=", r11)
print("query(tok1+pos3) . key(tok1+pos2)=", r12)

print("query(tok1+pos3) . key(tok2+pos1)=", r21)
print("query(tok1+pos3) . key(tok2+pos2)=", r22)

print("sm1=", F.softmax(torch.tensor([r11, r12]), dim=-1))
print("sm2=", F.softmax(torch.tensor([r21, r22]), dim=-1))

output:
query(tok1+pos3) . key(tok1+pos1)= tensor(-0.5932, grad_fn=<DotBackward0>)
query(tok1+pos3) . key(tok1+pos2)= tensor(-0.3802, grad_fn=<DotBackward0>)
query(tok1+pos3) . key(tok2+pos1)= tensor(-0.1671, grad_fn=<DotBackward0>)
query(tok1+pos3) . key(tok2+pos2)= tensor(0.0459, grad_fn=<DotBackward0>)
sm1= tensor([0.4469, 0.5531])
sm2= tensor([0.4469, 0.5531])

In the end, the softmax of
[query(tok1+pos3) . key(tok1+pos1), query(tok1+pos3) . key(tok1+pos2)]
is == to the softmax of
[query(tok1+pos3) . key(tok2+pos1), query(tok1+pos3) . key(tok2+pos2)]


text:
Where can I find a model trained to detect patterns of an object like laboratory mice?
I am working on a real-time pose detection project using a model trained by DeepLabCut, which utilizes .pb and .yaml files for the model. My aim is to find a model or method that can help me detect behavioral patterns in the subjects being analyzed. For instance, I would like to apply an unsupervised learning algorithm that can identify and return the most frequent behavioral patterns (such as the most repeated poses) in the behavior of a particular subject, like a rat. Is there any recommended approach or method to achieve this?
It should be noted that I am working on developing a system that does behavioral pattern detection with python and models trained in DeepLabCut.
I have been thinking if TensorFlow and OpenCV can be a tool.
Thank you so much for giving me some ideas!!!


text:
how to preprocess satellite imagery for semantic segmentation?
I have to train binary semantic segmentation in Python(using Tenforflow, rasterio, geopandas, sh). And I have raster .tif images and vector .shp images which is mask. I know that I should divide each images into sub-images(tiles). But I need some help in coding part because even when I found code to generate patches for raster images I cannot apply it to the mask because it's vector file, not raster one. Here is multiple codes that I tried:
large_image_stack = tiff.imread('path_to_file.tif')
#large_mask_stack = tiff.imread('small_dataset_for_training/masks/12_training_mito_masks.tif')

for img in range(large_image_stack.shape[0]):

    large_image = large_image_stack[img]

    patches_img = patchify(large_image, (64, 64), step=64)  #Step=256 for 256 patches means no overlap
    patches_img = np.squeeze(patches_img)
    for i in range(patches_img.shape[0]):
        for j in range(patches_img.shape[1]):

            single_patch_img = patches_img[i,j,:,:,:]
            tiff.imwrite('patches/images/' + 'image_' + str(img) + '_' + str(i)+str(j)+ ".tif", single_patch_img)

By the way I had this error while running this : window_shape is too large
Another code:
patch_size = 128
scaler = MinMaxScaler()
image_dataset = []
for path,subdirs,files in os.walk(tif_dir):
    dirname = path.split(os.path.sep)[-1]
    if dirname == 'train':
        images = os.listdir(path)
        images.sort()
        print(images)
        for i, image_name in enumerate(images):
            if image_name.endswith(".tif"):
                #Get image paths  "print(path+"/"+image_name)"
                image = cv2.imread(path+"/"+image_name,1)
                SIZE_X = (image.shape[1]//patch_size)*patch_size
                SIZE_Y = (image.shape[0]//patch_size)*patch_size
                image = Image.fromarray(image)
                image = image.crop((0,0,SIZE_X,SIZE_Y))
                image = np.array(image)
                patches_img = patchify(image, (patch_size, patch_size, 3), step=patch_size)

                for i in range(patches_img.shape[0]):
                    for j in range(patches_img.shape[1]):
                        single_patch_img = patches_img[i,j,0,:,:]
                        single_patch_img = scaler.fit_transform(single_patch_img.reshape(-1, single_patch_img.shape[-1])).reshape(single_patch_img.shape)
                        image_dataset.append(single_patch_img)

My question is what can I do with both .tif raster and .shp vector images to train them?


text:
Recognize Logos and their Sources
I am working on a problem where I have to recognize logos and also output about the logo placement (logo source). I have attached an image below for visuals, if any of the logos on the below image is detected, we have to output its source as well. The logos detected on the back wall of Jürgen Klopp source should be Wall of Logos and the Nike logo on Jürgen Klopp shirt source should be shirt/apparel.
I hope that makes the problem clear. For basic logo detection, what I have in mind is to try SOTA detectors i.e. yolov5/yolov8/yolonas but for the source what do you think could be a better solution? I can add the logo sources as a separate class to the detector model as well but If you can suggest any other way, it would be appreciated.


text:
When running reinforcement learning on a language model, how do you prevent the model from just minimizing its logits?
Suppose you have a pre-trained autoregressive language model, and some cost function C mapping strings to numbers. Lower costs mean a given generated string is "better". Pass the model some input sequence and autoregressively generate an output sequence, say by just directly sampling from the model's output distribution at each timestep, for say n timesteps. Now let (l1, ... ln) denote the logits of the tokens selected at timesteps 1 through n. A very simply reinforcement learning objective is
C(y)(l1 + ... + ln)
where C(y) is the cost of the output sequence. In other words, if C(y) is positive (bad output), make those logits smaller, and if C(y) is negative (good output), make the logits bigger.
This seems like a sensible and simple reinforcement learning objective, but when I run it, all I find is that the system just minimizes its logits. These are histograms of the model's output logits at various points during training - as training progresses the histograms move to the left.

Basically the model is tending towards a uniform output distribution, minimizing the loss by minimizing the l1 + ... + ln factor rather than the C(y) factor.
How do SOTA reinforcement learning methods get around this issue?


text:
How to build a Generative AI based on insights
I have a huge amount of documents that I do some preprocessing for them to extract insights. For instance, thousands of companies' profiles are used to extract the top N industries that exist in Japan.
Generally, if I want to build a chatbot on top of a corpus, I will fine-tune an AI model (e.g GPT) on the needed corpus and then I can ask questions like, what is the capital of Japan? etc.
But, how can I train a chatbot to answer insights questions from the companies' profiles?
I was thinking of defining what I want the chatbot to answer, and then extracting all the possible answers and transforming them into a text. Finally, fine-tune the model on the text. I feel this is going to be hard to identify what a user might ask.
Is there a better way to solve this?


text:
Are image classification nets independent of input size ? Which ones?
Most models I have seen have a dense layer at the exit of the network with a softmax function or a relu sometimes, so I thought this was confusing:

The major hurdle for going from image classification to object detection is fixed size input requirement to the network because of existing fully connected layers.

Source


text:
Incorporating HiPlot and Keras
I just started to learn about Keras and train some models, and I came across HiPlot which is used for tuning hyperparameters. I was wondering if HiPlot can also be used to see what parameters would increase the accuracy of a model in Keras. Some of the parameters that was thinking were: Learning Rate, Batch Size, Dropout Rate, Regularization Strength, Number of Layers, Number of Neurons per Layer, Activation Function, Optimizer Choice.
I am not sure if Keras already provides tools that would help with this, and if using HiPlot it is not going to be as efficient?
Also, is there an automated way to know how the algorithm would perform for different values of parameters?


text:
Not pre-trained binary transformer model
I stacked with a problem. My default Transformer model totally does not learn how to evaluate python logical expressions, like: '(False and not True) xor False or (not False and False)'. Model should understand how eval such expressions and return True or False answers. Model after training returns all the time False answer. To test how does my logical expressions generator, tokeniser and custom dataset works, I wrote LSTM model with MultiheadAttention layer. And such LSTM model after training successfully evaluates logical expressions. So all parts in my code works fine, except Transformer model.
So my question is, is it theoretically possible to train an untrained Transformer model to make it a binary classifier?
Because as I correctly understand LSTMs have a sequential nature and are effective in capturing dependencies in sequential data, such as natural language sequences. The LSTM-based model, with the use of bidirectional LSTM layers and attention mechanism, might be able to learn the patterns and dependencies present in the logical expressions more effectively, resulting in accurate evaluations.
On the other hand, transformers are designed to capture global dependencies and are highly effective in tasks involving long-range dependencies. However, they might not be as effective when dealing with sequential data or capturing fine-grained sequential patterns. But I don't see any problems why my Transformer doesn't trained to eval expressions and after that return correct answer.


text:
How to Change the Length of a Sequence Using Linear Projection In PyTorch?
I was trying to reproduce a voice conversion model using PyTorch and I had difficulty implementing a module called PBTC (Parallel Bank of Transposed Convlutions), used in https://arxiv.org/pdf/2303.12197.pdf. As in the paper, it consists of several parallel branches with transposed convlution followed by a linear projection.

The input to this module is a sequence of f0 (fundamental frequency) embeddings with shape [B, T, L]. Basically we want it to pass through the PBTC module and get a new sequence with shape [B, T, F].
As shown in the figure, it first passes through a transposed convolution and get a sequence with shape [B, t', F]. Then it passes through a linear projection and get a sequence with shape [B, T, F].
But the thing is how to define such linear projection? As in the figure, t' is computed using t, dilation dil and kernel size k, where t should be the length of input sequence, T. But we don't exactly know what t is since the length of input sequence varies among different data point. So should I fix the input length, truncating or padding the raw input sequence to fit this length? But this does't seem to make sense...
My implementation of PBTC module is as follow:
class PBTC(nn.Module):
    """
    Parallel Bank of Transposed Convolutions
    Reference:
    https://www.isca-speech.org/archive/pdfs/interspeech_2020/webber20_interspeech.pdf
    https://arxiv.org/pdf/2303.12197.pdf
    """

    def __init__(self,
                 in_channels,
                 out_channels,
                 input_length,
                 output_length,
                 kernel_size=50,
                 num_branches=10):
        super(PBTC, self).__init__()
        self.in_channels = in_channels
        self.out_channels = out_channels
        self.input_length = input_length
        self.output_length = output_length
        self.kernel_size = kernel_size
        self.num_branches = num_branches

        self.branches = nn.ModuleList()

        for dilation in range(1, 2 * num_branches, 2):
            # t' = (t-1) + dil * (k-1) + 1
            input_length_prime = (input_length - 1) + dilation * (self.kernel_size - 1) + 1
            self.branches.append(
                nn.Sequential(
                    # ConvTranspose1D(num_filters, stride, dilation)
                    nn.ConvTranspose1d(in_channels, out_channels, kernel_size=50, stride=1, dilation=dilation),
                    nn.Linear(in_features=input_length_prime, out_features=output_length),
                    nn.ReLU()
                )
            )

    def forward(self, seq):
        # seq: [B, N, L]
        seq = seq.permute(0, 2, 1)  # [B, L, N]
        encoded_seq = torch.zeros((seq.size(0), self.out_channels, seq.size(-1)))  # B, F, N]
        for branch in self.branches:
            encoded_seq += branch(seq)
        encoded_seq = encoded_seq.permute(0, 2, 1)  # [B, N, F]

        return encoded_seq

I really appriciate it if anyone could help me!

I also encountered the same problem, did you solve it?


text:
How to track arbitrary object picked by mouse using YOLO?
We can track human, car, animal, etc using YOLO V8.
In order to track object, the model has to be trained on target objects.
But I have to track arbitrary objects picked by mouse on a video.
Since the target object is unknown, I can't train YOLO model.
I thought that it's possible to track arbitrary object by comparing feature map calculated by pretrained YOLO model.
i.e.

In a frame, choose a pixel and save an image that contains the pixel.
Calculate feature map of the image using pretrained YOLO model.
In the next frame, find best matching candidate with above feature map.

I think this is possible, but not sure it's correct.
And if possible, how can I implement this?


text:
CNN model perfromance vaires with subset of validation dataset
I am training a resnet50 CNN model using fastai.The data is imbalanced, so I am doing undersampling.
first approach I tried to undersample only the training set, and the validation set is still imbalanced and my model ignores minority class totally, 0 F1 score.
Second approach, I tried to undersample both set and now my model is showing some F1 score for both classes.
I peformed 5 fold CV and its all same result.
Now, the validation set in second apporach is subset of first set. Also, validation set doesnt contribute in model learning, so I am not sure why the model behaves differently, though they are trained on same trainign set. Any idea?
Sample code
        train1, test1 = createTrainValDf(df)

        ## Oversample the training set
        train2 = undersample(train1, mal)
        #test2 = undersample(test1, mal)
        #train = sample(train, mal,int(400 * 0.8))
        ## expand it
        train_expanded = expandDf(train2, False)
        test_expanded = expandDf(test1, True)

        ## create data loader
        dataset_train = zfDataset(root, train_expanded)
        dataset_test = zfDataset(root, test_expanded)
        len(dataset_train), len(dataset_test)
        train_loader = DataLoader(dataset_train, batch_size=8, num_workers=8, pin_memory=True, shuffle=True)
        val_loader = DataLoader(dataset_test, batch_size=8, num_workers=8, pin_memory=True, shuffle= True)
        data_loaders = DataLoaders(train_loader, val_loader)

        ## start training
        learn = Learner(data_loaders, MVCNN(2), loss_func=CrossEntropyLossFlat(), metrics=[error_rate, accuracy])
        torch.cuda.set_device(0)

        learn.model.cuda()
        learn.unfreeze()
        learn.fit_one_cycle(10,lr_max=slice(1e-6, 1e-4),cbs=[EarlyStoppingCallback(monitor='accuracy', min_delta=0.01, patience=4),SaveModelCallback(monitor='accuracy', min_delta=0.001, fname=mal +"_a")])

def undersample(df, mal):
    c1,  c2 = df['Class'].value_counts()
    if c1 < c2:
        val= c1
    else:
        val = c2
    print(df['Class'].value_counts())
    class1  = df[df["Class"]==df['Class'].value_counts().index[0]]
    class2  = df[df["Class"]==df['Class'].value_counts().index[1]]
    df_1 = class1.sample(val, replace = False, random_state=45)
    df_2 = class2.sample(val, replace = False, random_state=45)
    df_m = pd.concat([df_1, df_2])
    print("After undersample: " + str(len(df_1)) + " " + str(len(df_2)))
    return df_m


text:
Why skip gram doesnt just use the probabilities as the encoded vector?
I am very confused but this is what's on my head now:

The skip-gram algorithm just multiplies hot-encoded-words with a weights-matrix,
and since the word is hot encoded it is just multiplying a row of the matrix
And so this matrix W will end up being the probabilities that we are predicting, or at least will be ordered in the same way.

So what's the advantage of this algorithm? What exactly is figuring out?
Wouldnt just a probability vector for each word, computed from the neighbours in a huge pool of words serve the same purpose without any optimization?
One of the Blogs I read is this one, for example.


text:
Finding an optimal action score function for Multi-Armed Bandit Problem
Considering a multi-armed bandit problem where there are :
C: number of machines
T: timesteps
m(i) , v(i) = mean and variance of i-th machine's reward distribution
A(i) = Selected Machine index at timestep i
R(i) = Received Reward at timestep i : ~ N(m(A(i)),v(A(i))

(all indexes start from 1)

If we decide to follow this policy:

For steps i = 1 to C selecting machine i in other words A(i) = i for i <= C
For steps i > C selecting machine which has  the highest score (Z is score function) : Z(j, i , R(1 to i-1), A(1 to i-1)) where j is machine's index and i is timestep

So we would have our expectation for the total reward as :
$$
\mathbb{E}[R_{total}] = \sum_{i=1}^T{\mathbb{E}[R(i)]} = \sum_{i=1}^C{m(i)} + \sum_{i=C+1}^T{\sum_{j=1}^C{m(j)*Pr(A(i) = j)}}
$$
And also we have:
$$
Pr(A(i) = j) = \prod_{k \neq j}{Pr( Z(\textbf{j}, i , R([1... i-1]), A([1... i-1])) >Z(\textbf{k}, i , R([1... i-1]), A([1...i-1])))}
$$
so we have this objective of finding unknown function Z which maximizes $\mathbb{E}[R_{total}]$:
$$
\DeclareMathOperator*{\argmax}{arg\,max}
Z = \argmax_{Z()}{\mathbb{E}[R_{total}]} = \argmax_{Z}{\sum_{i=C+1}^T{\sum_{j=1}^C{m(j)*Pr(A(i) = j)}}}
$$
(I purned out first term in $\mathbb{E}[R_{total}]$ since it is a constant)
I know there are well-known techniques like UCB, epsilon-greedy ,... however I think there should be an optimal Z function even if we dont have any information about mean and variance of reward distributions, because at least we know that they are normally distributed in this case.
My questions are :

Is there any well known technique to solve such problems ? where
we don't have any specific form for the function which we are trying
to find ?
Is my assumption correct about existence of an optimal Z function ?


text:
What is the best approach to remove this additional container from the cropped image?
I'm working on a computer vision application in Python to analyze images of ice cream cuttings to measure the amount of variegate(ie. fruit syrup or fudge) compared to the base ice cream. My approach is to crop the ice cream, generate a mask including only the cropped image (removing any additional background after cropping), transform the image, and finally count black pixels (variegate) compared to white pixels(ice cream base). The results can be seen in the first picture
I'm using the rembg package and remove function with the code seen below for my cropping:
from rembg import remove
image_crop = rembg.remove(image)
image_crop_arr = np.array(image_crop, dtype=np.uint8)

The problem is that the remove function is including the ice cream container(see the picture above), and if the photo is not taken vertically a fair bit of the container is included. This throws off my calculations and color scale for transforming.
What is the best approach to remove this additional container from the cropped image?

Train a custom CNN to generate masks (sounds like a lot of work)?
Increase the edge factor to remove say 10 extra pixels from the cropped line?
Modify the remove function and its U2 training?
Are there other simple approaches I'm not considering

I tried drawing a rectangular mask around the center of the image to capture the ice cream and remove the container, but the ice cream is not rectangular, introducing an error.
I annotated 30 or so images with the idea of making a custom mask to train an image cropping algorithm to better select the shape of the ice cream cutting from the background and ice cream container, which is seen in the image below. Is this a good approach to take for training a custom model? If so how many more annotated photos do you think a CNN or other model would required? I can only buy and eat so much ice cream. :)

Thank you for any feedback!!!


text:
Feature extraction from log-mel spectrograms using CNNs
I am currently working on an ASR-related project in which I would like to combine Convolutional Neural Network with GRU Network and CTC loss function.
The idea is to use the CNN to extract representative features from log-mel spectrograms, and then pass the resulting feature maps as input to the GRU network, after first reducing the dimensions of the maps to (Batch Size x C = 1 x H x W).
I have read the publications on this topic, but I have not found information on whether such a solution makes sense. I know that log-mel spectrograms contain features extracted from audio files, but I would like to make the features more meaningful.
I was planning to use the feature extraction module from the VGG-16 network, but my spectrograms have dimensions of 1x23xW, where W ranges from 600 to 1500 (I made the padding up to the maximum width in the batch), and I cannot then use this module to fine-tune the model and apply it to the GRU because of the discrepancy in the dimensions of the images.
Can you tell me what kind of CNN to use to extract features from spectrograms of such dimensions? I would also appreciate knowing if it makes sense to use CNNs in such a case.


text:
How can I transform a signal into another using supervised learning?
I'm trying to transform a signal into another using supervised learning. My main goal is to create a model capable to transform a raw signal (Blue Line) into something similar to the "ideal" one (Green Line).
This is what I have done right now:
And these are the results:
Since my model has to operate online, the signals, are divided in moving windows. Also, my model take as input the blue line and has to output something like the green line, but as you can see is not working at all.
I tried with different layers, like Conv1D, Dense and may other, but is not working.

Do you have any suggestion?

Do you know why my model, everytime it is making a prediction (red line) always start with a peak?

Please, don't provide screenshots, because they make it difficult to refer to specific statements in the code. Just copy and paste the relevant code. However, note that programming questions are off-topic. Code should only be provided if it helps to understand the problem or question. Thanks.


text:
DDIM scheduler scaling the denoising model input depending on the current timestep
I can't find any resources on scaling the denoising model input depending on the current timestep for diffusion models. Just briefly mentioned in the appendix of the paper , but not much more. Does anyone have a source on a comparison of doing vs omitting it?
Here's the huggingface diffusers implementation


text:
How can I normalize features while preserving information about the original values?
I am trying to feed a neural network stock prices of an instrument. To ensure training stability, I normalize the inputs to have mean=0 and std=1.
However, I thought that for stock prices, the absolute prices of the instrument would also be relevant. This is due to the psychological effect of "round numbers", meaning we like to see clean numbers as important markers. The information of these markers is lost when normalizing.
How can I set up the input to not lose this viable information that gets lost when normalizing?
My initial thought was to supply the model with the important zones by providing them as extra features (e.g. the first round number above and below). But this adds extra (perhaps unneeded) complexity for the model. What are your suggestions? Am I missing an important aspect here?


text:
Connecting Human poses with BB
I am trying to estimate the crossing patterns of pedestrians based on their poses. I have a large dataset that contains videos named JAAD dataset. I want to make a prediction of the crossing based on the detected poses. I dont have the annotation for the poses but I have annotations for the Bounding Boxes. Can you please provide me with steps on how to achieve that. I am confused on using that on a large scale dataset.
Input is my image/frames data
I have the Bounding boxes labels around the pedestrians and those Bounding boxes are labelled mentioning whether the Pedestrian will cross the road or not.
I dont know how to connect the Bounding boxes of the pedestrians with keypoint poses extracted over a number of frames.

I have modified my answer to give a better insight on my problem

Thanks for the update. I have removed my comment (and will remove this one), since you have adressed it, and it is good to keep things tidy and focused. Other people who know about this sort of ML problem may ask for more clarification - but I cannot think of anything else to clarify.


text:
AI-driven tool for generating or finding short, context-aware jokes for online forum posts (GPT-4 not effective)
I've tried using GPT-4 to generate jokes with various prompts for my online forum posts, but most of the generated jokes were unfunny. For example, I asked my AI for a joke, and it said "your coding skills." I'm looking for an alternative tool or approach to generate short jokes (max two sentences) that can be used in informal conversations and are funny to most people who know the context. Alternatively, a tool that can search for existing jokes online and suggest them based on my post's content would also be helpful.
Here are the characteristics of the jokes I like:

Two-sentence long at most
The majority of the people who know the context would say it's funny
Natural to use in informal conversations

My ideal workflow is:

Write a post without jokes
Copy and paste the post into the tool
Receive a list of jokes sorted by relevance and popularity
Pick one of the suggested jokes
Get a new version of the post that integrates the joke naturally

Since GPT-4 didn't produce satisfactory results, are there any other AI-driven tools or models that could help me achieve this, or tools that can search for existing jokes online based on my post's content? What approach would you recommend for generating or finding context-aware jokes that fit my criteria? Any advice or resources would be appreciated.

Humour is hard. Your best bet for an answer here is probably going to be using the same or very similar model. Hope someone can help. In the meantime, consider that a sense of humour is very personal, so any example of a success with input and output would be useful. It's not clear from your description for instance if you just want a joke to follow the subject matter, like a comment in a talk, or that it should tie directly to statements already made in the text


text:
Do we have reversed recursive feature elimination (RFE)?
We usually use RFE to eliminate less-important features to improve model performance.
I wonder if we have a reversed RFE, which intentionally remove important features?
The intention for this is to test how well can less-important features predict.


text:
i have encountered some issues while using Stable Diffusion. It generates some strange limbs for me
My generation method involves using the original image along with SAM to extract masks for the images. Then I use OpenPose to fix the pose of the person and keep the clothes unchanged while generating different individuals.
However, the generated limbs are appearing strangely. Does anyone have a solution or any suggestions for improvement? Thank you, everyone.

Try adding to the prompt "perfect fingers", "beautiful hands", (etc.) and to the negative prompt the opposite, "missing fingers", "deformed fingers", etc.


text:
Early binary classification of timeseries
I'm trying to figure out how to solve this problem that I'll try to explain in the next few lines. I have a timeseries of length ~200k values and every 700 points I have a label that indicates the status of the signal. In this medical problem every 700 points I know if the signal is in a pathological or healthy status. The goal of the framework I want to implement is to understand if I can correctly predict, early in time, if the signal is going to be pathological in order to raise warning.
I have tried different approach so far, but none of them really works. For example I have tried to classify using a sliding window of size 700 and predict the label in the "classic" way with different classifier. In order to implement early prediction I simply shifted the labels backwards (i.e. 1st sliding window in input and label of the next 700 point). Actually I did not consider the signals as a timeseries but always as vectors not related in time.
Can someone give me some tips on how I can solve this problem considering the time factor ?

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.


text:
Normalisation in feature extraction using pre-trained model
I have a dataset with medical images. I want to implement a network for super-resolution using GANs. One of the criteria of the optimisation is a perceptual loss. For that I will use a pretrained vgg network, trained on imagenet solely to extract features. Essentially, this vgg network is used as a feature extractor. I feed my network with data normalized with the medical dataset statistics. Therefore the output are images with the dataset statistics as well.
When I want to extract features from the output of my network should I simply pass the output of my network to the vgg since it is already normalized with the medical dataset statistics or do I need to denormalize back the network output and then normalize with the imagenet statistics?


text:
Exploring NLP Techniques for Transforming Web Content into Engaging Q&A Formats
I'm looking for innovative methods or tools that leverage natural language processing (NLP) to transform web content into an interactive Q&A format. NLP has gotten so good that I no longer program (NLP) with my hands, and I believe it can make online content more engaging, akin to the programmed learning approach used in books like Quick Calculus and Little Schemer (https://en.wikipedia.org/wiki/Programmed_learning).
Current experiments with large language models (LLMs) to generate questions and answers have shown limitations:

Tedious manual copy-pasting
Token limitations
Irrelevant or unhelpful questions
Loss of original formatting
Potential hallucinations

I'm seeking an NLP-based solution with the following characteristics:

User-friendly, preferably as a browser extension
Quick activation via click or keyboard shortcut
No token limit
Generation of meaningful questions
Integration of questions with corresponding answers
Preservation of the original webpage's appearance
Use of existing text for answers

Based on previous suggestions, I've considered an approach that involves:

Extracting webpage text using Mozilla's Readability
Generating questions with Haystack's QuestionGenerator
Locating answers using Haystack's Reader
Inserting questions and answers into the webpage's DOM

However, I'm eager to explore alternative ideas and techniques. Are there other NLP-powered tools or methodologies that could effectively accomplish this objective? I appreciate any insights or recommendations!


text:
How much is the acceptable percentage for Random Forest in Landslides prediction?
RF had been developed to overcome overfitting in decision trees but in some cases RF still experiences overfitting in landslide prediction, which varies from 2% to 12%. How much overfitting is acceptable? and how much datasets is considered good enough to use RF. it was said that the sample size should be 20 times greater than the variables in order to use RF but still sometimes RF have a bad prediction compared to logistic regressionin certain cases even though the sample size meets the criteria.I hope somebody can enlighten me with this issue.


text:
Datasets for conversation topic classification with focus on chat
Are there good datasets or even pretrained models for classifying chat lines? I'd like to infer the topic people are talking about and possibly topic changes.
One of the problems with data that is available for training is very specific bias. There are, for example, large sets of chatlogs of tech support channels, but they have only a few topics and all of them are technical. In general seems it hard to find on which data to train a network that generalizes for different kind of channels with a more or sometimes less fixed topic without training on that.
If you look into non-technical topics of chat rooms you have other focuses, flirt chats are common, but there are also chat rooms which focus for example on the related forum for aquarium owners. Now the aquarium owners probably talk about the very basic topic like weather and, of course, aquariums.
Also data sets like Tweets are probably a bad approximation as most Tweets are self-contained and many chat lines only make sense in the context of a few lines before.


text:
What is the most modern technique for generating a video from an image+driver video?
NVIDEA's Maxine and Live Portrait microservices look very promising but they are still in early access. But if you dig into Live Portrait it seems to be  built off of a three year old github repo. Example from the repo:

Another big one I have found is the first-order-model repo which is a little older and seems to do about the same kind of thing:

I would think there would be a lot of advancements in the last three years. Are these the best libraries to use if you want something off the shelf? Is there a name for this particular type of technology or class of algorithms?


text:
Meaning of Objective and Risk in DLIB HOG-SVM detector
I am using dlib simple object detector for training a HOG-SVM object detector. Everything is working fine when I test manually. However, I can't find any resources that tell me what is the meaning of some of the metrices that are shown while training. These are:

Objective - What is the objective function?
Objective Gap - Is it the difference between the objective function of the current and previous iteration?
Risk - No idea what this is.
Risk Gap - Evidently no idea what this is.

I can intuitively understand that the lower the above metrices the better the model is. However I have no formal way to define the above or explain what the metrices are.
Can someone please explain the metrices in the list? Some good resource to get a bit more enlightenment will also be good.


text:
Does ChatGPT have access to real-time data?
I wanted to see if ChatGPT knows the current time or not, and it persisted that it does not have access to any real-time data and its knowledge is limited to the year 2021 and before. But how does it know the date?

I also noticed its responses become better and better over time. Is it because it is directly instructed the way it should respond to some prompts?


text:
Is there a chess engine whose architecture is composed purely of ranked/weighted constraints that then generate candidate moves for search?
Chess can be seen as a search for a move with many constraints on it. In the human way of searching for a move, we think to ourselves something like "I need to find a move that both moves the queen while protecting my knight."
Is there a chess engine whose architecture is composed purely of ranked/weighted constraints that then generate candidate moves for search?
I know that more "brute force" algorithms are in vogue due to alpha-beta, but this architecture would have the advantage of being highly explainable to a human player.
Is anyone aware of a program with a similar hard-coded heuristics/constraint-based architecture?


text:
Episodic Learning vs. Meta Learning in few-shot setting
As far as I understand, episodic learning involves training the model on episodes of tasks, where each task consists of a query set Q and support set S. On each episode the model is trained on the samples in S and then tested on query in Q. How does Meta-learning relate to this? Is episodic learning a precondition for meta-learning or can there be meta-learning without episodic learning or vice versa? All papers that I come across in few-shot learning (in the NER context) seem to use these terms somewhat interchangeably and I never found a real definition. I understand that Meta Learning is a "learning to learn" approach, where the model is updated based on each episode with the hope that it learns to generalize to unseen tasks better. But that must be the case in every episodic learning approach? otherwise it would not make sense to train on episodes.


text:
Regarding the use of Time2Vec as positional encoding for Timeseries Transformer
Although the transformer architecture was originally designed for NLP, there exists several articles and papers that attempt to apply the same architecture for numerical timeseries classification. These are some notable examples:

https://towardsdatascience.com/the-time-series-transformer-2a521a0efad3
https://towardsdatascience.com/time2vec-for-time-series-features-encoding-a03a4f3f937e
https://towardsdatascience.com/stock-predictions-with-state-of-the-art-transformer-and-time-embeddings-3a4485237de6

Based on the above, it seems that the usage of time2vec for positional encoding is prevalent. However, my concern is that all these articles use timeseries values as inputs to time2vec (e.g., prices or sales) rather thanthe actual temporal information (i.e., a time index t=0,1,2,3..). This seems problematic as:

This is not a positional encoding, but an enrichment of feature representation
Even the word2vec paper (If I understood it correctly) mentions that it is designed to work on a time related feature

Several persons have asked similar questions in other sites, for example this is taken from the first article:

Why is the feature being encoded in time2Vec and not the actual time
index? How does encoding the feature provide positional encoding?

Yet, I was not able to find any explanations. So, can someone please resolve this? Is this design approach a widespread misinterpretation of positional encoding?
Note: Even if time2vec is applied on a time index, it should probably be a global time index created before batching/windowing the data, because the local time index within the batch is arbitrary.


text:
Label transformation vs Methods in Imblanced Regression for Imbalanced Regression tasks
I've seen some papers discussing the imbalanced regression recently and was wondering what's the benefit of this line of approaches compared to conventional data transformations (e.g., Square-root, Log transform or Box-cox)??
Papers in Imbalanced Regression

Delving into Deep Imbalanced Regression, Yang et al., ICML-21
Balanced MSE for Imbalanced Visual Regression, Ren et al., CVPR-22
RankSim: Ranking Similarity Regularization for Imb Reg, Gong et al., ICML-22


text:
Several kinds of edges in a GNN
I have an existing implementation (written by somebody else) of an MPNN using the graph_nets library. The graph net is based on a tree, but has 4 times as many edges: if U is the parent of V and R is the root of the tree, then the graph net has the edges (U, V), (V, U), (R, V) and (V, R).
I think it makes sense to have a separate MLP for each kind of edge. So I would have for each edge a single feature, whose value is an integer from 0 to 3, and the edge function would select one of 4 MLPs and apply it.
Does this make sense? Is there a way to implement this with graph_nets? How?


text:
If not chosen all the data in the train partition, is it still k-fold cross validation?
I have a dataset of 900 images, distributed across 6 classes, with 150 images per class. To develop a classifier and assess its performance, I will utilize k-fold cross-validation. In this case, I will employ 3-fold cross-validation.
For each fold, I will allocate 70% of the data for training purposes, leaving the remaining 30% for testing. Consequently, within the training partition, there will be 105 images per class. However, during the training phase, I will only select 20 images per class to train the model. When evaluating the model, I will assess its performance on the entire test partition.
To report the overall performance of the model, I will calculate the average test accuracy across the 3 folds and present this averaged accuracy as the final performance metric.
Despite utilizing a subset of the training partition, can this approach still be referred to as "3-fold cross validation"?


text:
Extract multiple records from raw text using open AI API function calls
Trying to extract records from pdf. The plan was to convert pdf data to raw text and use open AI api calls to extract the data in a desired format (csv). This is because the pdf data is very unstructured. While I do get records back in the output, I get only the 1st one from every page when there are multiple records. What can I do to get all records back in the desired format. Further I use a code to get back a csv , but the issue is with API response and not handling JSON to CSV
Raw data : https://pastebin.com/fKKyJCTB
functions = [
    {
        "name": "extract_permit_data",
        "description": "Extract data from a permit record and add it to the database.",
        "parameters": {
            "type": "object",
            "properties": {
                "permit_number": {
                    "type": "string",
                    "description": "The unique permit number."
                },
                "permit_type": {
                    "type": "string",
                    "description": "The type of permit."
                },
                "address": {
                    "type": "string",
                    "description": "The address associated with the permit."
                },
                "valuation": {
                    "type": "number",
                    "description": "The valuation associated with the permit."
                },
                "applied_date": {
                    "type": "string",
                    "format": "date",
                    "description": "The date the permit was applied for."
                },
                "permit_subtype": {
                    "type": "string",
                    "description": "The subtype of the permit."
                },
                "parcel_number": {
                    "type": "string",
                    "description": "The parcel number associated with the permit."
                },
                "total_fees": {
                    "type": "number",
                    "description": "The total fees associated with the permit."
                },
                "issued_date": {
                    "type": "string",
                    "format": "date",
                    "description": "The date the permit was issued."
                },
                "status": {
                    "type": "string",
                    "description": "The status of the permit."
                },
                "description": {
                    "type": "string",
                    "description": "The description of the permit."
                },
                "subdivision": {
                    "type": "string",
                    "description": "The subdivision associated with the permit."
                },
                "total_paid": {
                    "type": "number",
                    "description": "The total amount paid for the permit."
                },
                "contractor": {
                    "type": "string",
                    "description": "The contractor associated with the permit."
                },
                "contractor_address": {
                    "type": "string",
                    "description": "The contractor's address."
                },
                "contractor_phone_number": {
                    "type": "string",
                    "description": "The contractor's phone number."
                },
                "owner_name": {
                    "type": "string",
                    "description": "The name of the owner associated with the permit."
                },
                "owner_address": {
                    "type": "string",
                    "description": "The owner's address."
                },
                "owner_phone_number": {
                    "type": "string",
                    "description": "The owner's phone number."
                },
                "applicant_name": {
                    "type": "string",
                    "description": "The name of the applicant."
                },
                "applicant_address": {
                    "type": "string",
                    "description": "The applicant's address."
                },
                "applicant_phone_number": {
                    "type": "string",
                    "description": "The applicant's phone number."
                }
            },
            "required": ["permit_number", "permit_type", "address", "valuation", "applied_date", "permit_subtype", "parcel_number", "total_fees", "issued_date", "status", "description", "subdivision", "total_paid", "contractor", "contractor_address", "contractor_phone_number", "owner_name", "owner_address", "applicant_name", "applicant_address", "applicant_phone_number"],
        },
    }
]
messages = [
                    {"role": "system", "content": "You are a helpful assistant that extracts all solar permit records information and other details from raw text containing multiple permits indicated by permit unique permit numbers into JSON for a database."},
                    {"role": "user", "content": 'Extract each record with permit numbers, permit status, permit address, contractor/applicant,owner, issue date, permit type, sub-type, valuation , work description , Storage/Battery Manufacturer Name and kw rating from raw text fpr each record: ' + text}
]

# Call the model
response = openai.ChatCompletion.create(
                    model='gpt-3.5-turbo-0613',
                    functions=functions,
                    messages=messages,
                    temperature=0
                )
# Get result
result = response.choices[0]['message']['function_call']['arguments']'''


text:
Difference in quantization regarding transpose_conv2d / conv2d

I'm trying to implement a transpose_conv2d function using padding/dilation of the input and calling a regular conv2d function. My approach is calculating the new input shape, padding and dilating the original input into new shape and calling regular conv2d with the same accumulator-scale, offset etc.
background: my task is to implement the workflow and codegen of a transposed_conv2d layer in ApacheTVM on gemmini accelerator. Codegen works for now, but the 'net' seems to provide wrong output.
Dataflow is bare minimum: qnn.conv2d_transpose -> nn.bias_add -> qnn.requantize
Codegen is based on regular conv2d (which is proven to work) while changing output shape, function calls etc.
Is there a difference in the way quantization works regarding transposed/regular convolutions? I'm using the TFLite frontend with int8 weights, inputs and outputs.
Gemmini convolutions fuse qnn.conv2d, nn.bias_add and qnn.requantize into a single function (see: Gemmini - A note about quantization). But since calculating the new bias should not be affected by padding/dilation, I don't suspect the issue here.
Any ideas appreciated. Thanks!


text:
Mining overlapping orthogonal clusters from high dimensional data
What are the recommended strategies for identifying overlapping and somewhat orthogonal clusters in a large, high-dimensional dataset?
As an illustration, consider a dataset comprised of various recipes represented as text embeddings. I'm looking for an approach that would result in overlapping clusters, such as those associated with different cuisines, meal types (e.g., soup, main course, dessert), and other categories (like vegetarian dishes).
To clarify, the expectation isn't to obtain these precise clusters or to segregate them into orthogonal groups, this is just a general example. Of course, in the real dataset, I would not be able to specify the clusters I expect (e.g. as labels) upfront.
I'm unsure about what objective I should be optimizing in this context. I'd appreciate any guidance or insights!


text:
Pyramid Vision Transformer V2: Complexity of spacial reduction attention (SRA)
I'm currently reading the paper PVT v2: Improved Baselines with Pyramid Vision Transformer, where the authors improve a transformer architecture that can be used as a backbone for multiple computer vision tasks such as classification, object detection, and image segmentation. In section 3.2 of the paper, they propose an approach to further reduce the complexity of the attention operation by computationally reducing the size of the inputs K and V to the attention operation.

First, to reduce the high computational cost caused by
attention operations, we propose linear spatial reduction attention layer
Different from
SRA, which uses convolutions for spatial reduction, linear
SRA uses average pooling to reduce the spatial dimension
(i.e., $h\times w$) to a fixed size (i.e., $P\times P$) before the attention
operation. So linear SRA enjoys linear computational
and memory costs like a convolutional layer. Specifically,
given an input of size $h\times w\times c$, the complexity of SRA and
linear SRA is:
\begin{gathered}
\Omega(\text { SRA })=\frac{2 h^2 w^2 c}{R^2}+h w c^2 R^2, \\
\Omega(\text { Linear SRA })=2 h w P^2 c,
\end{gathered}

Now, I get the idea behind the minimal complexity of Linear SRA: if we double $h,w$, or $c$, the number of times we would do average pooling would also double, and the 2 is there since we operate on $K$ and $V$. I don't see how they derived the complexity for SRA; however, maybe someone familiar with at least the original paper where SRA was proposed could enlighten me. Sadly, the authors haven't answered two similar questions raised in the corresponding GitHub repo.


text:
How can we implement specific face makeovers with Stable Diffusion?
I need suggestions on what should be the exact process to achieve this use case. I have seen tools like this but I am not sure how they are operating on the backend and which techniques and APIs are they using.
I am working on an AI Hair stylist App, that allows users to upload their own images as a training set and my App allows them to wear different hairstyles of their choice, this is to allow them to dream how they would look with a specific hairstyle.
I tried training the custom model with LoRA and on top of SD was able to generate the portraits, but how can I specifically target the hairs area and put them in different poses, styles etc altogether?
Thanks in anticipation for your time.


text:
How does one decide the probability distribution for an LLM during RLHF?
I was looking into how KL divergence is used in LLMs to prevent reward hacking within the course Generative AI with LLMs on Coursera (if this redirects to the homepage, the article is on week 3). As mentioned before, they talk about the use of KL divergence as a penalty against the model generating text that makes no sense to the original prompt but maximises the reward against the 3Hs (or whichever benchmark is used).
However, from what I've seen on KL divergence, it requires 2 probability distributions (in this case, the original LLM and the RLHF trained LLM). However what probability distribution is used in this case? This is considering that the entire prompt is generated before the metrics can be evaluated.


text:
Update OpenAI embedding based on own domain corpus
I have a large domain corpus. Is there anyway to update the word/sentence/document embedding obtained from OpenAI embedding API based on my own domain corpus? There may be some words in my corpus that are close to each other but far from each other in OpenAI embedding space.
Any tutorials or guidance will be helpful.


text:
Why is my super-computer scale PPO not scaling well?
Hi I basically have PPO as implemented in stable-baselines3 and so far it is not scaling well at all which is very concerning. The basic parallelism strategy is very similar to OpenAI five's training strategy: each worker has PPO with batch size 4096, parallel environment execution & 1 training step (to avoid stale gradients) & 4 steps per environment. Then each worker averages its weight updates then the loop repeats.
Why would this setup fail to scale across 1000's of cores? I've been for example training this on BiPedalWalker-Hardcore-v3, and it asymptotes at about 0 reward (up from -90).
P.S. if this is not enough information, then I'll add more.


text:
A technique to show what tokens are relatively predicted by an LLM
I’m picturing a technique where you can see what an LLM is likely to respond with, which updates in real time.
It’s a bit trippy, but it’s like GitHub Copilot, in that there is predicted text while you type, but it’s predicting what an LLM would say in response.
It updates its prediction for any change in word of your current input.
So if I just type the word “The”, the prediction might show the average of a bunch of repeated LLM responses, maybe “I’m sorry, I didn’t catch that, could you please ask again?” or something.
Like Google Translate, maybe there are 3 main variations on what answers you’re expecting, so there’s the main one and the alternatives listed below it.
Now when you continue typing, to “The book”, the predicted responses update.
However, it shows in relative terms what changed the most by the addition of the token “book”, so you can see / get a sense for specifically how that token changes the model’s “understanding”, in that context.
For example, you could color-code or size-code words to show which words appear in the predicted output which are more unique or distinctive. Like by adding “book” into the input context window, the output might indicate the presence of highly unique tokens in the predicted output, like “library”, “read”, etc.
There is a lot you could do with this.
I see it as maybe being based on a kind of constructed “calculus” of LLM inputs and outputs.
You have to find a way to define the average of any N strings. If the average of two strings is judged highly similar, they can be treated (in that context) as synonyms; if the average is highly different, they are two different variations of output you might expect.
The average helps you determine which tokens are “unique” - because they are or are not in some average of N output strings.
Can anyone suggest how you could construct that average function?
One way would involve adding and subtracting common words between two sentences.
Another would be using an LLM to judge how similar two sentences are; ie an LLM-native approach where the LLM provides all the functions for assessing the LLMs own output.


text:
ChatGPT request/prompt structure: Put Persona into the "system" field. Add or replace?
On  playground.openapi.com
  we see a more advanced view of the chat window that chat.openai.com offers (that's the more well-known GUI shown in countlerss screenshots and tutorial videos).
On the Playground GUI, there is a textbox "system" and the default value is "You are a helpful assistant".
Should we enter any personas here in order to make it super clear what we human users intend ChatGPTto do?
(e.g. replace "You are a helpful assistant" with "You are an expert in remote sensing data analysis")
(OpenAI recommends this in their GPT best practices Documentation)
Is this an indication that OpenAI considers this "Persona Pattern" so fundamental that they have added an extra, separate textfield (for specifying the persona) in the structure of the prompt  message?
Or is this feature intended just for users of the API , to facilitate the parsing of long-running conversations (even with large intermissions)


text:
Inquiry about utilising AI in CNC machining path generation
I will begin by describing a situation. I work in laser machining control company. The essence of the problem, to which I would like to try to apply AI based tool is this:
Say I have a analytically described trajectory in 3D space. It can consist of lines, arcs, circles, NURB curves etc, anything that can be parametricaly described. I have a machine which can move at limited speed, limited acceleration, limited Jerk. In short, a machine which has real kinematic limits. I would like that machine to follow the parametric curve at some prescribed speed. As machine has real kinematic limits, it wont be able to follow trajectory exactly. For example, one cannot execute continuous corner motion. The machine should either stop, change direction of movement, and start moving again, or it can "smooth" the corned, by moving in a curve some distance $d$ away from the prescribed parametric curve. If $d$ is smaller then some prescribed constant, I am ok with that.
So let me restate the problem. I have a corridor in 3D Euclidean space which has a analytical description. I would like my magical AI tool to generate a parametric curve in that corridor which would satisfy some prescribed analytical constrains and minimize some analytical parameters.
EDIT: Maybe it could be helpful to imagine it as a game. Say it is a race game in space. The track is a round corridor in a 3D space. My goal is to stay as close to the middle of the corridor as possible. My motion is governed by some equation and objective and analytical limitations. At any point, I can change my motion equation, to adapt to the trajectory of corridor. Another rule is, that I would like to make as little of those changes of trajectory as possible. I want to find out, when I should make those choices to change my motion and how should I change my motion. The winner is the one who stayed as close to the middle as possible and who used as little changes of motion as possible. If at any point I would end up being outside the corridor, it's and instant loose
Could such tool be created? How difficult it would be? How efficient and reliable such tool could be? How one should start making such tool? How one should ensure its reliability? Is anyone aware of work which was already be done in this field?
Thank you very much for your answers and help,
Very happy to be a part of this community!
Donatas

Check this out
https://www.youtube.com/watch?v=ZMQbHMgK2rw&ab_channel=Veritasium
It seems pretty similar to what you'd like to do

What do you mean by "AI"? Magic? Machine learning? Any kind of optimization, or does it have to involve learning? Is engineering allowed, or should it discover physics, e.g. how jerk limits work, from a cost-function?


text:
Quantization Parameters when converting Quantized Transposed Convolution to Conv2D
A simple way to compute TransposedConv2d is to convert it to a regular Conv2d by padding the input value with zeros, as is described in A guide to convolution arithmetic for deep
learning. Does this process affect the way quantization has to be handled?
In my case, with the hardware I am working with, this is done by changing the bias during code compilation and setting a scale factor. I am not sure if things like zero-point will affect the computation, especially since TensorFlow uses asymmetric quantization for inputs and outputs.