category
stringclasses
107 values
title
stringlengths
15
179
question_link
stringlengths
59
147
question_body
stringlengths
53
33.8k
answer_html
stringlengths
0
28.8k
__index_level_0__
int64
0
1.58k
fine-tuning
Optaplanner benchmarking and fine tuning
https://stackoverflow.com/questions/30700617/optaplanner-benchmarking-and-fine-tuning
<p>I am current tweaking and fine tuning my installer booking assignment optimizer, just recently upgraded my library to Optaplanner 6.2.0 Final. I am using the benchmarker to observe which optimization strategy (EntityTabu, SimulatedAnnealing, with or without TailChainSwapMove) I have a few questions: <br>1) I made an...
<p>1) Do you mean like all the optional statistics that the benchmarker supports, such as the BEST_SCORE statistic (see docs) etc? All those statistics are nicely shown in the benchmark report.</p> <p>2) Try it out.</p>
1,134
fine-tuning
Fine-Tuning Keras model
https://stackoverflow.com/questions/43869553/fine-tuning-keras-model
<p>I'm working on facial expression recognition using CNN. I'm using Keras and Tensorflow as backend. My model is saved to h5 format.</p> <p>I want to retrain my network, and fine-tune my model with the VGG model.</p> <p>How can I do that with keras ? </p>
<p>Save your models architecture and weights: </p> <pre><code>json_string = model.to_json() model.save_weights('model_weights.h5') </code></pre> <p>Load model architecture and weights:</p> <pre><code>from keras.models import model_from_json model = model_from_json(json_string) model.load_weights('model_weights.h5') ...
1,135
fine-tuning
Fine tuning deep autoencoder model for mnist
https://stackoverflow.com/questions/56131203/fine-tuning-deep-autoencoder-model-for-mnist
<p>I have developed a 3 layer deep autoencoder model for the mnist dataset as I am just practicing on this toy dataset as I am beginner in this fine-tuning paradigm</p> <p>Following is the code</p> <pre><code>from keras import layers from keras.layers import Input, Dense from keras.models import Model,Sequential fro...
<h2>Problem 1</h2> <p>The problem is that you are trying to flatten a layer that is already flat: you encoder is made up of one-dimensional Desnse layers, which have shape <code>(batch_size, dim)</code>.</p> <p>The Flatten layer is expecting at least a 2D input, i.e. having a 3 dimensional shape <code>(batch_size, di...
1,136
fine-tuning
How to fine tune fine tune GitHub Copilot?
https://stackoverflow.com/questions/72554328/how-to-fine-tune-fine-tune-github-copilot
<p>We can fine tune language models like <code>BERT</code>, <code>GPT-3</code>.</p> <p>Can I fine tune <code>GitHub Copilot</code> model?</p> <p>I have already looked into examples from <a href="https://copilot.github.com/" rel="nofollow noreferrer">https://copilot.github.com/</a> but cant find the details.</p> <p>Woul...
<p>There does not seem to be a client-facing feature allowing you to fine-tune Copilot directly.</p> <p>Here are two illustration as to why this feature is, for now (Q2 2022) missing.</p> <p>The <a href="https://github.com/features/copilot" rel="nofollow noreferrer">Copilot feature page</a> initially included this:</p>...
1,137
fine-tuning
how to use XLMRoberta in fine-tuning ,
https://stackoverflow.com/questions/70255359/how-to-use-xlmroberta-in-fine-tuning
<p>There are two problems i met when i fine-tuning my code. And i was trying to use X_1 and X_2 to regress. There are different languages in the corpus.</p> <pre><code>HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/xlm-roberta-base/resolve/main/tf_model.h5 During handling of the above exception...
<p>There are several things you're better to know before diving deep into <code>huggingface</code> transformers.</p> <ol> <li>The preferred library for working with <code>huggingface</code>'s transformers is <code>PyTorch</code>.</li> <li>For several widely used models, you may find the <code>Tensorflow</code> version ...
1,138
fine-tuning
Exceed quota limits when fine tuning (Vertex ai)
https://stackoverflow.com/questions/76643013/exceed-quota-limits-when-fine-tuning-vertex-ai
<p>I'm facing an error while fine-tuning with a custom dataset on Vertex AI from the Google Cloud Platform (GCP). Here's the error message I encountered: <a href="https://i.sstatic.net/egslj.png" rel="nofollow noreferrer">enter image description here</a> I would greatly appreciate any assistance in resolving this issue...
<p>It looks like you've hit this quota for TPUv3s in <code>europe-west4</code>. <a href="https://cloud.google.com/vertex-ai/docs/quotas#custom-trained_model_quotas" rel="nofollow noreferrer">https://cloud.google.com/vertex-ai/docs/quotas#custom-trained_model_quotas</a></p> <p>You can request an increase in this quota f...
1,139
fine-tuning
Code Infilling fine-tuning with llama code
https://stackoverflow.com/questions/77739328/code-infilling-fine-tuning-with-llama-code
<p>I have a dataset of java methods and I want to fine-tune a code llm to provide accurate method names. Right now the dataset is in a .txt format with methods in text separated by a delimiter(###del###).<br /> To do this I thought about using CodeLLaMa and more specifically code infilling.<br /> From the original docu...
1,140
fine-tuning
Tensorflow: Fine tune Inception model
https://stackoverflow.com/questions/40016933/tensorflow-fine-tune-inception-model
<p>For a few days I am following the instructions here:<a href="https://github.com/tensorflow/models/tree/master/inception" rel="nofollow">https://github.com/tensorflow/models/tree/master/inception</a> for fine-tuning inception model. The problem is that my dataset is huge so converting it to TFRecords format would fil...
<p>Fine-tuning is independent of the data format; you're fine there. TFRecords promotes training and scoring speed; it shouldn't affect the quantity of iterations or epochs needed, nor the ultimate classification accuracy.</p>
1,141
fine-tuning
model fine-tuning, vanishing gradient problem
https://stackoverflow.com/questions/78645055/model-fine-tuning-vanishing-gradient-problem
<p>I am fine-tuning a <code>mistral-7b</code> with Hugging Face <code>peft</code> and quantization. In my training loop, I am printing the gradient values for each batch which seem a bit unusual.</p> <pre><code># Print gradients for name, param in model_init.named_parameters(): if param.grad is not None: ...
1,142
fine-tuning
Vertex AI API. Fine tuning the chat model
https://stackoverflow.com/questions/77394815/vertex-ai-api-fine-tuning-the-chat-model
<p>I am trying to launch Vertex AI fine tuning. I have followed the tutorial step by step:</p> <ol> <li>Created storage</li> <li>Uploaded dataset in .jsonl format</li> <li>Configured the model details etc.</li> </ol> <p>One entry in my dataset file (jsonl) looks as follows:</p> <blockquote> <p>{&quot;messages&quot;: [{...
<p><em>Posting the above comments as an answer to help community members in their research.</em></p> <p><strong>Issue 1</strong>:When trying to launch Vertex AI fine tuning chat model by clicking the &quot;start tuning&quot; button nothing happens.</p> <p><strong>Solution:</strong> The above issue was solved after enab...
1,143
fine-tuning
Keras model gets worse when fine-tuning
https://stackoverflow.com/questions/66460418/keras-model-gets-worse-when-fine-tuning
<p>I'm trying to follow the fine-tuning steps described in <a href="https://www.tensorflow.org/tutorials/images/transfer_learning#create_the_base_model_from_the_pre-trained_convnets" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/images/transfer_learning#create_the_base_model_from_the_pre-trained_convne...
<p>OK I found out what I do different that makes it NOT necessary to compile. I do not set encoder.trainable = False. What I do in the code below is equivalent</p> <pre><code>for layer in encoder.layers: layer.trainable=False </code></pre> <p>then train your model. Then you can unfreeze the encoder weights with</p>...
1,144
fine-tuning
Which layers should I freeze for fine tuning a resnet model on keras?
https://stackoverflow.com/questions/47206714/which-layers-should-i-freeze-for-fine-tuning-a-resnet-model-on-keras
<p>I already know how to do it on vgg (fine tuning the last conv block) and inception (fine tuning the top two blocks). I'd like to know which layers is recommended to freeze in order to fine tuning a resnet model.</p>
<p>I think that there is no a state of the art strategy for this but I may share you my thoughts on this topic (names of layers are similar to these presented <a href="https://github.com/fchollet/keras/blob/master/keras/applications/resnet50.py" rel="noreferrer">here</a>:</p> <ol> <li><p>In case of having a lot of dat...
1,145
fine-tuning
What are the differences between fine tuning and few shot learning?
https://stackoverflow.com/questions/72611335/what-are-the-differences-between-fine-tuning-and-few-shot-learning
<p>I am trying to understand the concept of <code>fine-tuning</code> and <code>few-shot</code> learning.</p> <p>I understand the need for fine-tuning. It is essentially tuning a pre-trained model to a specific downstream task. However, recently I have seen a plethora of blog posts stating zero-shot learning, one-shot l...
<p>Fine tuning - When you already have a model trained to perform the task you want but on a different dataset, you initialise using the pre-trained weights and train it on target (usually smaller) dataset (usually with a smaller learning rate).</p> <p>Few shot learning - When you want to train a model on any task usin...
1,146
fine-tuning
Error &quot;invalidPayload&quot; with Microsoft Azure OpenAI fine-tuning
https://stackoverflow.com/questions/74088197/error-invalidpayload-with-microsoft-azure-openai-fine-tuning
<p>When wanting to run a fine-tune request via the REST API I get the following error message:</p> <pre><code>&quot;error&quot;: { &quot;code&quot;: &quot;invalidPayload&quot;, &quot;message&quot;: &quot;The fineTune field is required.&quot; } </code></pre> <p>Also, in the fine-tuning wizard I get a message s...
<p>It looks like you may not have the correct subscription level for Azure OpenAI. You may need to upgrade your subscription in order to use the fine-tuning feature.</p>
1,147
fine-tuning
KerasLayer model increased size after fine-tuning
https://stackoverflow.com/questions/69529302/keraslayer-model-increased-size-after-fine-tuning
<p>I am working with Universal Sentence Encoder (v4) as TF KerasLayer. I load the model, fine-tune and save it back to the file. The original size of the model is 1GB, but if I fine-tune it (without adding any Dense Layer) the size increased to 3GB. If I just load and save the model (without fine-tuning) the size remai...
1,148
fine-tuning
openai.error.InvalidRequestError: The specified base model does not support fine-tuning. when fine-tune Azure OpenAI model
https://stackoverflow.com/questions/77083082/openai-error-invalidrequesterror-the-specified-base-model-does-not-support-fine
<p>I'm running the following Python code for a fine-tune OpenAI task:</p> <pre class="lang-py prettyprint-override"><code>import openai from openai import cli import time import shutil import json openai.api_key = &quot;*********************&quot; openai.api_base = &quot;https://*********************&quot; openai.ap...
<blockquote> <p>openai.error.InvalidRequestError: The specified base model does not support fine-tuning.</p> </blockquote> <p>According to <a href="https://learn.microsoft.com/en-us/answers/questions/1353932/when-fine-tune-models-in-azure-openai-will-be-avai" rel="nofollow noreferrer">MS-Q&amp;A</a> by AshokPeddakotla-...
1,149
fine-tuning
What does fine-tuning a multilingual checkpoint mean?
https://stackoverflow.com/questions/76826638/what-does-fine-tuning-a-multilingual-checkpoint-mean
<p>I'm fine-tuning a SetFit model on a French dataset and following the guide in <a href="https://huggingface.co/blog/setfit" rel="nofollow noreferrer">huggingface</a>. They mention this point on the site that I didn't quite understand</p> <blockquote> <p>&quot;🌎 Multilingual support: SetFit can be used with any Sente...
<p>What the point in the guide suggests is that multilingual models fine-tuned using <code>SetFit</code> method generalize well even on languages they did not see during the <code>SetFit</code> fine-tuning process. This seems to be generally true for multilingual language models but it probably does not do any damage t...
1,150
fine-tuning
How can I check a confusion_matrix after fine-tuning with custom datasets?
https://stackoverflow.com/questions/68691450/how-can-i-check-a-confusion-matrix-after-fine-tuning-with-custom-datasets
<p>This question is the same with <a href="https://datascience.stackexchange.com/questions/99815/how-can-i-check-a-confusion-matrix-after-fine-tuning-with-custom-datasets">How can I check a confusion_matrix after fine-tuning with custom datasets?</a>, on Data Science Stack Exchange.</p> <h2>Background</h2> <p>I would l...
<p>What you could do in this situation is to iterate on the validation set(or on the test set for that matter) and manually create a list of <code>y_true</code> and <code>y_pred</code>.</p> <pre><code>import torch import torch.nn.functional as F from sklearn import metrics y_preds = [] y_trues = [] for index,val_text...
1,151
fine-tuning
The Impact of Pretraining on Fine-tuning and Inference
https://stackoverflow.com/questions/78737176/the-impact-of-pretraining-on-fine-tuning-and-inference
<p>I am working on a binary prediction classification task, primarily focusing on fine-tuning a BERT model to learn the association between CVEs and CWEs. I've structured my task into three phases: first, using a large dataset of CVE and CWE for MLM pretraining; then using the pretrained model weights for fine-tuning; ...
1,152
fine-tuning
Tesseract fine tuning Cant open lstmbox
https://stackoverflow.com/questions/72182929/tesseract-fine-tuning-cant-open-lstmbox
<br /> im trying to fine tune tesseract 4.1.1 in my WSL shell. Doing that im following [this](https://www.statworx.com/en/content-hub/blog/fine-tuning-tesseract-ocr-for-german-invoices/) tutorial. I have created a number of .tiff files and now are trying to generate the corresponding .box files using lstmbox. ``` tesse...
<p>Error <code>read_params_file: Cant't open...</code> means that tesseract can not find defined configuration file (<code>lstmbox</code>). If your installation process did not installed it you can download it (and others) from <a href="https://github.com/tesseract-ocr/tesseract/tree/main/tessdata/configs" rel="nofoll...
1,153
fine-tuning
MXnet fine-tune save model
https://stackoverflow.com/questions/44473612/mxnet-fine-tune-save-model
<p>I'm using mxnet's fine-tune example to fine-tune my own data with this code: </p> <p><a href="https://github.com/dmlc/mxnet/blob/master/example/image-classification/fine-tune.py" rel="nofollow noreferrer">https://github.com/dmlc/mxnet/blob/master/example/image-classification/fine-tune.py</a></p> <p>By viewing comm...
<p><a href="http://mxnet.io/api/python/callback.html" rel="nofollow noreferrer">http://mxnet.io/api/python/callback.html</a></p> <p>Try to use the mx.callback API.</p> <pre><code>module.fit(iterator, num_epoch=n_epoch, ... epoch_end_callback = mx.callback.do_checkpoint("mymodel", 1)) Start training with [cpu(0)] Epo...
1,154
fine-tuning
Continual pre-training vs. Fine-tuning a language model with MLM
https://stackoverflow.com/questions/68461204/continual-pre-training-vs-fine-tuning-a-language-model-with-mlm
<p>I have some custom data I want to use to <em><strong>further pre-train</strong></em> the BERT model. I’ve tried the two following approaches so far:</p> <ol> <li>Starting with a pre-trained BERT checkpoint and continuing the pre-training with Masked Language Modeling (<code>MLM</code>) + Next Sentence Prediction (<c...
<p>The answer is a mere difference in the terminology used. When the model is trained on a large generic corpus, it is called 'pre-training'. When it is adapted to a particular task or dataset it is called as 'fine-tuning'.</p> <p>Technically speaking, in either cases ('pre-training' or 'fine-tuning'), there are update...
1,155
fine-tuning
Unsupervised fine-tuning on custom documents after the supervised fine tuning on general question-answers dataset. Will it be useful for GPT-2 model?
https://stackoverflow.com/questions/76489469/unsupervised-fine-tuning-on-custom-documents-after-the-supervised-fine-tuning-on
<p>I know the formal way of training a GPT2 model on custom documents is to first do semi-supervised fine tuning on the text of the documents followed by supervised fine-tuning on question answers from the same documents. But the sole purpose of supervised fine-tuning being to acquire style of answering question, is it...
<p>It is very difficult to say this methodology would 'work' reliably for use cases. One approach I have tried is taking a base model and <a href="https://huggingface.co/learn/nlp-course/chapter7/6" rel="nofollow noreferrer">causally</a> fine-tuning it on the documents at hand. Following this, you can take a publicly c...
1,156
fine-tuning
Multiple gpu fine-tuning does not accelerate?
https://stackoverflow.com/questions/79351083/multiple-gpu-fine-tuning-does-not-accelerate
<p>I am experimenting using single or multiple GPUs for LLM fine-tuning by changing the CUDA_VISIBLE_DEVICES variable in the following cmd:</p> <pre><code>CUDA_VISIBLE_DEVICES=0,1 accelerate launch --multi_gpu finetuning_with_lora_HfArgumentParser.py \ --model_name &quot;/root/123/local_model&quot; \ --train_json_path ...
1,157
fine-tuning
fine-tuning from an existing checkpoint: meaning of &quot;steps&quot;
https://stackoverflow.com/questions/45193033/fine-tuning-from-an-existing-checkpoint-meaning-of-steps
<p>In <a href="https://github.com/tensorflow/models/blob/master/slim/scripts/finetune_inception_v3_on_flowers.sh" rel="nofollow noreferrer">this example</a> of fine-tuning an InceptionV3 model on the Flowers training set, there are two parts which say:</p> <pre><code># Fine-tune only the new layers for 1000 steps. </c...
<p>A step means a gradient descent step on a minibatch of examples. The example tunes for 1000 steps and then for 500 further steps to show how the performance improves after fine tuning.</p>
1,158
fine-tuning
Imbalanced fine-tuning of inception v3 network (tensorflow)
https://stackoverflow.com/questions/41348902/imbalanced-fine-tuning-of-inception-v3-network-tensorflow
<p>I am doing fine-tuning on the pretrained on the Image-net Challenge, inception v3 network of tensorflow. In my classification problem I am using 2 classes because I want to understand if an image contains food or not. My dataset is imbalanced because I have a lot more images on the non-food class (which makes sense ...
1,159
fine-tuning
Fine-tuning an open-source LLM for a new language?
https://stackoverflow.com/questions/76561780/fine-tuning-an-open-source-llm-for-a-new-language
<p>What are the most suitable open source LLMs and frameworks for fine-tuning? I intend to use this model in a quite specific domain, perhaps a physics mentor for a school. How long might it take (with 3070 Ti 11Gb) to achieve acceptable accuracy for this purpose? I assume that the process of fine-tuning a new language...
1,160
fine-tuning
Fine-tuning PyTorch: No deepcopy
https://stackoverflow.com/questions/68636072/fine-tuning-pytorch-no-deepcopy
<p>Regarding fine-tuning CNNs in PyTorch, as per <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" rel="nofollow noreferrer">SAVING AND LOADING MODELS</a>:</p> <blockquote> <p>If you only plan to keep the best performing model (according to the acquired validation loss), … You must serialize b...
<p>You’re still following the tutorial’s instructions. Note this part of the tutorial:</p> <blockquote> <p>You must serialize <code>best_model_state</code> or use <code>best_model_state = deepcopy(model.state_dict())</code></p> </blockquote> <p>You serialized the best model’s state (wrote it to disk), so you don’t need...
1,161
fine-tuning
Python: fine tuning several fits functions
https://stackoverflow.com/questions/15551956/python-fine-tuning-several-fits-functions
<p>I need a hand to fine tune the plot resulting from my code. the code is really rude, but basically it serves to fit some data, that have two peaks in the ditribution of counts versus time. The rising part of each peak is fitted with a gaussian, and the decaying part with an exponential. I need to fine tuning the fit...
<p>Using trigonometric series can handle very well this problem in order to create a continuous function. The example below works if pasted after your code. You can change the number of terms in the trigonometric series if you need.</p> <p><img src="https://i.sstatic.net/dJ38m.png" alt="enter image description here"><...
1,162
fine-tuning
BERT always predicts same class (Fine-Tuning)
https://stackoverflow.com/questions/64675655/bert-always-predicts-same-class-fine-tuning
<p>I am fine-tuning BERT on a financial news dataset. Unfortunately BERT seems to be trapped in a local minimum. It is content with learning to always predict the same class.</p> <ul> <li>balancing the dataset didnt work</li> <li>tuning parameters didnt work as well</li> </ul> <p>I am honestly not sure what is causing ...
<p>For multi-class classification/sentiment analysis using BERT the 'neutral' class HAS TO BE 2!! It CANNOT be between 'negative' = 0 and 'positive' = 2</p>
1,163
fine-tuning
Fine-Tuning EfficientNetB0 with pretrained &#39;imagenet&#39; is not reproducIble
https://stackoverflow.com/questions/78922573/fine-tuning-efficientnetb0-with-pretrained-imagenet-is-not-reproducible
<p>I am encountering an issue with fine-tuning an EfficientNetB0 model that was originally pretrained on ImageNet.</p> <ul> <li><p>Model Training and Fine-Tuning: I start with an EfficientNetB0 model pretrained on ImageNet and fine-tune it on my specific dataset.</p> </li> <li><p>Saving the Model: After fine-tuning, I ...
1,164
fine-tuning
Fine tuning custom keras model
https://stackoverflow.com/questions/57702247/fine-tuning-custom-keras-model
<p>I have a keras model which is trained on 5 classes,The final layers of the model look like so</p> <pre><code>dr_steps = Dropout(0.25)(Dense(128, activation = 'relu')(gap_dr)) out_layer = Dense(5, activation = 'softmax')(dr_steps) model = Model(inputs = [in_lay], outputs = [out_layer]) </code></pre> <p>What I want to...
<p>Here,</p> <pre class="lang-py prettyprint-override"><code>model = Model(inputs = [in_lay], outputs = [out_layer]) weights_path = 'weights.best.hdf5' </code></pre> <p>this <strong>out_layer</strong> should have the same dimension(5 classes) described inside <strong>weights.best.hdf5</strong>. </p> <p>So, <code>t_y...
1,165
fine-tuning
Fine tuning PIG for local execution
https://stackoverflow.com/questions/4460727/fine-tuning-pig-for-local-execution
<p>I'm using PIG latin for log processing because its expressiveness in a problem where the data is not big enough to worry about setting up a whole hadoop cluster. I'm running PIG in local mode but I think that it isn't using all the cores it has available (16 at the moment), monitoring the CPU shows 200% of CPU usage...
<p><a href="http://wiki.apache.org/pig/PigExecutionModel">Pig's documentation</a> makes it clear that local operation is intended to be run single-threaded, taking different code paths for certain functions that would otherwise use distributed sort. As a result, optimizing for Pig's local mode seems like the wrong solu...
1,166
fine-tuning
Fine-tuning SSD Lite in torchvision
https://stackoverflow.com/questions/71094251/fine-tuning-ssd-lite-in-torchvision
<p>I want to fine-tune an object detector in PyTorch. For that, I was using this tutorial:</p> <p><a href="https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html" rel="nofollow noreferrer">https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html</a></p> <p>However, FastRCNN model is not suitab...
<p>if your goal is to create a model with a custom num_classes, then you could just:</p> <ol> <li>Set the new custom class in the initialization of torchvision.</li> <li>Load the default pretrained model explicitly.</li> <li>Match the shape, and discard the weights with different shapes.</li> <li>Load the adjusted pret...
1,167
fine-tuning
How to save fine tuning LLM model?
https://stackoverflow.com/questions/78631565/how-to-save-fine-tuning-llm-model
<p>I am doing fine-tuning of a model and then I want to save this model to convert it to the GGUF format to use in Ollama. However, when converting to the GGUF format, I get the following error: ValueError: Can not map tensor 'model.layers.0.mlp.down_proj.weight.absmax'.</p> <p>I'm not sure if I am saving it correctly....
1,168
fine-tuning
Nginx url rewrite fine tuning
https://stackoverflow.com/questions/19272219/nginx-url-rewrite-fine-tuning
<p>I'm having trouble fine tuning a regex for Nginx url rewrite rules, What I am trying to do is take the first two pieces of the url and convert them to variables (nothing too fancy, and should be simple). </p> <p>e.g. I type in <a href="http://www.webserver.com/piece1/piece2" rel="nofollow">http://www.webserver.com...
<p>Seems as if / is also recognized by "."...try: </p> <pre><code>location / { rewrite ^/([^/]+)/([^/]+)/? /rewtest.php?val1=$1&amp;val2=$2 last; return 404;} } </code></pre>
1,169
fine-tuning
Fine tuning on MXNet other than FC layers
https://stackoverflow.com/questions/49567237/fine-tuning-on-mxnet-other-than-fc-layers
<p>Im new to MXNet and I was wondering if any one knows how to fine tune more layers in CNN other than only the FC layers. All the examples that Im looking at, have fine tuning only on the FC layers. In Keras this can be easily done and more blocks of ConvNets other than FC block can be fine tuned: <a href="https://git...
<p>Answer depends on whether you are using the imperative (Gluon) or symbolic API. </p> <h2>If you are using the imperative (Gluon) API:</h2> <p>Instead of creating <code>gluon.Trainer</code> with all parameters (<code>net.collect_params()</code>), you can provide a subset of those parameters that you want to train. ...
1,170
fine-tuning
Keras accuracy discrepancy in fine-tuned model
https://stackoverflow.com/questions/45399535/keras-accuracy-discrepancy-in-fine-tuned-model
<h1>Background</h1> <p>While fine tuning a classification model in Keras, it printed <code>val_acc: 0.8456</code>. <a href="https://pythonexample.com/snippet/python/transfer_learning_keras_01py_gengho_python" rel="nofollow noreferrer">This code</a> was used for fine-tuning.</p> <p>After fine-tuning, manually loading ...
<p>You're using different preprocessing for training and testing. Specifically,</p> <pre><code>rescale = 1./255 </code></pre> <p>is used for training, but</p> <pre><code>x = vgg19.preprocess_input(x) </code></pre> <p>is used for testing.</p> <p>What <code>imagenet_utils.preprocess_input()</code> does is subtractin...
1,171
fine-tuning
Fine-tuning model&#39;s classifier layer with new label
https://stackoverflow.com/questions/67158554/fine-tuning-models-classifier-layer-with-new-label
<p>I would like to fine-tune already fine-tuned BertForSequenceClassification model with new dataset containing just 1 additional label which hasn't been seen by model before.</p> <p>By that, I would like to add 1 new label to the set of labels that model is currently able of classifying properly.</p> <p>Moreover, I do...
<p>You can just extend the weights and bias of your model with new values. Please have a look at the commented example below:</p> <pre class="lang-py prettyprint-override"><code>#This is the section that loads your model #I will just use an pretrained model for this example import torch from torch import nn from transf...
1,172
fine-tuning
Fine tuning transition delays - CSS
https://stackoverflow.com/questions/34891345/fine-tuning-transition-delays-css
<p>I'm working on a website with a left navigation bar and I need some help fine-tuning the transition delays. Here's the website: <a href="http://104.193.173.104/modx/index.php" rel="nofollow">http://104.193.173.104/modx/index.php</a></p> <p><strong>Desktop</strong></p> <ul> <li>Starts wide (240px) with social icons...
1,173
fine-tuning
Fine tuning a pretrained language model with Simple Transformers
https://stackoverflow.com/questions/61482810/fine-tuning-a-pretrained-language-model-with-simple-transformers
<p>In his article 'Language Model Fine-Tuning For Pre-Trained Transformers' Thilina Rajapakse (<a href="https://medium.com/skilai/language-model-fine-tuning-for-pre-trained-transformers-b7262774a7ee" rel="nofollow noreferrer">https://medium.com/skilai/language-model-fine-tuning-for-pre-trained-transformers-b7262774a7ee...
<h3>Question 1</h3> <p>Yes, the input to the <code>train_model()</code> and <code>eval_model()</code> methods need to be a single file.</p> <p><em>Dynamically loading from multiple files will likely be supported in the future</em></p> <h3>Question 2</h3> <p>Yes, you can use <code>bert-base-multilingual-cased</code> mod...
1,174
fine-tuning
Fine tuning a model - base_model Dropout in inference or training mode?
https://stackoverflow.com/questions/71006896/fine-tuning-a-model-base-model-dropout-in-inference-or-training-mode
<p>In the TensorFlow documentation it is highlighted that it is important during fine tuning to set the base_model to ’inference mode’ setting the parameter <code>training = False</code> when calling the <code>base_model</code>. The reason to do so is because of the <code>tf.keras.layers.BatchNormalization</code> layer...
1,175
fine-tuning
does tf slim fine tuning require gpu?
https://stackoverflow.com/questions/44773074/does-tf-slim-fine-tuning-require-gpu
<p>Actually I am trying to fine tune inceptionV3 model using tf slim fine tuning example on git hub it is giving me this error :</p> <p>InvalidArgumentError (see above for traceback): Cannot assign a device to node 'InceptionV3/AuxLogits/Conv2d_2b_1x1/biases/RMSProp_1': Could not satisfy explicit device specification ...
<p>Please provide more information about your Tensorflow installation (GPU or CPU installation). If you are running a GPU Tensorflow version this probably is raising the error.</p>
1,176
fine-tuning
How to test a model before fine-tuning in Pytorch Lightning?
https://stackoverflow.com/questions/69249187/how-to-test-a-model-before-fine-tuning-in-pytorch-lightning
<p>Doing things on Google Colab.</p> <ul> <li>transformers: 4.10.2</li> <li>pytorch-lightning: 1.2.7</li> </ul> <pre class="lang-py prettyprint-override"><code>import torch from torch.utils.data import DataLoader from transformers import BertJapaneseTokenizer, BertForSequenceClassification import pytorch_lightning as p...
<p>The <code>Trainer</code> needs to call its <code>.fit()</code> in order to set up a lot of things and then only you can do <code>.test()</code> or other methods.</p> <p>You are right about putting a <code>.fit()</code> just before <code>.test()</code> but the fit call needs to a valid one. You have to feed a dataloa...
1,177
fine-tuning
Fine-tuning of OpeanAI model with unsupervised set, not supervised
https://stackoverflow.com/questions/75722268/fine-tuning-of-opeanai-model-with-unsupervised-set-not-supervised
<p>I want GPT-3 model to know everything about my domain area, for example my inbox. I want to be able to ask it questions like &quot;Have I even had a Silicon Valley Bank account?&quot; and get correct response. I've familiarized myself with <a href="https://platform.openai.com/docs/guides/fine-tuning" rel="nofollow n...
<p>You can generate training set of prompt/completion pairs based on your knowledge base via various techniques such as:</p> <ul> <li>summarizations (for example via GPT models);</li> <li>generated Q/A via GPT;</li> <li>cloze-style questions (again you can utilize GPT itself to suggest such questions);</li> </ul> <p>Us...
1,178
fine-tuning
Fine-tuning of multilingual translation models (Huggingface Transformers, Helsinki)
https://stackoverflow.com/questions/76201629/fine-tuning-of-multilingual-translation-models-huggingface-transformers-helsin
<p>I want to fine-tune pre-trained multilingual Models from the Huggingface transformers library (MarianMT in this case) for domain-specific translation. I want the models to be able to translate between 5 different languages. I have domain-specific datasets for every sentence pair (e.g. de-en, en-de, de-es, es-de and ...
1,179
fine-tuning
Cost-Effective Methods for Fine-Tuning LLMs with RAFT
https://stackoverflow.com/questions/78892614/cost-effective-methods-for-fine-tuning-llms-with-raft
<p>I'm new to LLMs and fine-tuning in general so please bear with me if I've made obvious mistakes!</p> <p><em>I have no GPU/cloud based platform other than a free tral GCP account.</em></p> <p>I'm trying to fine-tune an LLM using the RAFT method (Retrieval Augmented Fine-Tuning). The goal is to enhance the mode's abil...
1,180
fine-tuning
Fine tuning T5 not converging
https://stackoverflow.com/questions/76932312/fine-tuning-t5-not-converging
<p>I am new in this world of transformers and NLP, and I am having a problem when fine tuning T5 for my specific use case.</p> <p>What I want to achieve, is that the model receives an input text, and outputs a JSON (as a string) of the relevant information in the text.</p> <p>There are 3 formats that the model can resp...
<p>It's been almost a year - did you solve this?</p> <p>I see two possible issues with your approach.</p> <p>(1) Trying to model randomness (?) You said:</p> <blockquote> <p>I've built a Python script to generate the inputs and labels as random as possible.</p> </blockquote> <p>If I understand correct - you are creatin...
1,181
fine-tuning
fine-tuning a CNN from a lower fc layer
https://stackoverflow.com/questions/32536426/fine-tuning-a-cnn-from-a-lower-fc-layer
<p>I've noticed that most fine-tuning of CNN over new dataset is done only on the "last" fully connected (fc) layer.</p> <p>I'm interested in fine-tuning from the "first" fully connected layer: that is, I want to use mid-level features from convolution and pooling layers as they are, (supposing it's trained on ImageNe...
<p>Theoretically, the deeper you fine-tune, the better your model fits your data. So, if you could fine-tune the whole model - the better. </p> <p>So, what's the catch, you must be asking, why don't everyone fine-tune the whole model?<br> First, fine-tuning the whole model involves lots and lots of parameters, in ord...
1,182
fine-tuning
Is Caffe Net Surgery requires fine tuning?
https://stackoverflow.com/questions/51464821/is-caffe-net-surgery-requires-fine-tuning
<p>I am new at Caffe and I want to use already trained caffeNet model with ImageNet. I applied net surgery by removing a convolutional intermediate conv4 layer. </p> <pre><code>'layer { name: "relu3" type: "ReLU" bottom: "conv3" top: "conv3" } layer { name: "relu5-new" type: "ReLU" ...
<p>The original net you started with had <code>conv4</code> between <code>conv3</code> and <code>conv5</code>: this means the filters (weights) of <code>conv5</code> were expecting certain number of inputs and certain "order" or "meaning" of inputs. Once you removed <code>conv4</code>, you had to alter <code>conv5</cod...
1,183
fine-tuning
Fine-Tuning with Custom Dataset: Formatting and Best Practices
https://stackoverflow.com/questions/79238709/fine-tuning-with-custom-dataset-formatting-and-best-practices
<p>I’m working on a domain-specific problem where no pre-existing datasets are available. I’ve manually collected some examples and initially used them in Large Language Model (LLM) prompts (few-shot learning). However, the results are not very good, and i am doing fine-tuning for better outcomes.</p> <p>I’ve created m...
1,184
fine-tuning
Fine tuning flair ner model
https://stackoverflow.com/questions/75824467/fine-tuning-flair-ner-model
<p>I am trying to fine tune flair ner model using these lines of code:</p> <pre><code>embedding_types = [WordEmbeddings('glove'), WordEmbeddings('extvec'), WordEmbeddings('crawl'),] embeddings = StackedEmbeddings(embeddings=embedding_types) pretrained_model = SequenceTagger.load('ner') trainer : ModelTrai...
<p>The error you are getting should be solved just by upgrading flair</p> <pre><code>pip install --upgrade flair </code></pre> <p>However, there is an error in the concept on how you are doing this. First, you are not passing the embeddings nor to the trainer nor to the tagger. This makes sense if what you want to do i...
1,185
fine-tuning
Fine Tuning Pretrained Model MobileNet_V3_Large PyTorch
https://stackoverflow.com/questions/69321848/fine-tuning-pretrained-model-mobilenet-v3-large-pytorch
<p>I am trying to add a layer to fine-tune the MobileNet_V3_Large pre-trained model. I looked around at the PyTorch docs but they don't have a tutorials for this specific pre-trained model. I did find that I can fine-tune MobileNet_V2 with:</p> <pre class="lang-py prettyprint-override"><code>model_ft =models.mobilenet_...
<p>For V3 Large, you should do</p> <pre><code>model_ft = models.mobilenet_v3_large(pretrained=True, progress=True) model_ft.classifier[-1] = nn.Linear(1280, your_number_of_classes) </code></pre> <p>(This would also work for V2, but the code you posted would not work for V3 correctly).</p> <p>To see the structure of you...
1,186
fine-tuning
Fine-tuning method listFiles
https://stackoverflow.com/questions/36764442/fine-tuning-method-listfiles
<p>Can anyone help in tuning this method? When I log the "files" - it only takes around 5 seconds. But takes more than 10 minutes before returning the "fileInfo"</p> <pre><code>// fileSystem is HDFS // dateNow = java.util.Date // basePath = new Path("/") // filePattern = "*.sf" private Map&lt;String, Long&gt; listFil...
<p>You Said </p> <p><strong>When I log the "files" - it only takes around 5 seconds</strong></p> <pre><code> RemoteIterator&lt;LocatedFileStatus&gt; files = fileSystem.listFiles(basePath, true); </code></pre> <p><strong>Yes</strong>. Because this part of the code only checks the <code>File</code> present at that pat...
1,187
fine-tuning
Encoding issues on OpenAI predictions after fine-tuning
https://stackoverflow.com/questions/69928517/encoding-issues-on-openai-predictions-after-fine-tuning
<p>I'm following <a href="https://beta.openai.com/docs/guides/fine-tuning/create-a-fine-tuned-model" rel="noreferrer">this OpenAI tutorial</a> about fine-tuning.</p> <p>I already generated the dataset with the openai tool. The problem is that the outputs encoding (inference result) is mixing UTF-8 with non UTF-8 charac...
<p>I faced the same issue dealing with Portuguese strings.</p> <p>Try to use <code>.encode(&quot;cp1252&quot;).decode()</code> after the string:</p> <pre><code>&quot;Cuéntame algo de ti&quot;.encode(&quot;cp1252&quot;).decode() </code></pre> <p>This should result in:</p> <pre><code>&quot;Cuéntame algo de ti&quot; </co...
1,188
fine-tuning
TTS Tacotron2 Fine-tuning: Missing Layers and No Output Sound
https://stackoverflow.com/questions/77520193/tts-tacotron2-fine-tuning-missing-layers-and-no-output-sound
<p>I’m attempting to use <a href="https://github.com/coqui-ai/TTS" rel="nofollow noreferrer">TTS</a> to fine tune a Tacotron2 TTS model. If it makes a difference, I'm using Python 3.9.1 and I'm fine-tuning the latest <code>tts_models--en--ljspeech--tacotron2-DDC</code>.</p> <p>During the fine-tuning process, when I loa...
1,189
fine-tuning
Apache configuration fine tuning
https://stackoverflow.com/questions/23852763/apache-configuration-fine-tuning
<p>I run a very simple website (basically a redirect based on a php database) which gets on average 5 visits per second throughout the day, but at peak times (usually 2-3 times a day), this may go up to even 300 visits/s or more. I've modified the default apache settings as follows (based on various info found online a...
<p>maybe you need to enable mod_cache with mod_mem_cache, another parameter that i always configure is ulimits: </p> <ul> <li>nofile to get more sockets</li> <li>nproc to get more processes</li> </ul> <p><a href="http://www.webperformance.com/load-testing/blog/2012/12/setting-apache2-ulimit-for-maximum-prefork-perfor...
1,190
fine-tuning
Fine-Tuning Pyannote Model for VAD Task — Issues After Training
https://stackoverflow.com/questions/79372052/fine-tuning-pyannote-model-for-vad-task-issues-after-training
<p>I try to fine-tune pre train Pyannote model for VAD task. I can fine-tune it for Segmentation task and everything goes well and I can improve the model results.</p> <p>Here is the code how I fine-tune it:</p> <pre><code>pretrained = Model.from_pretrained(config[&quot;pretrained_model_path&quot;]) registry.load_datab...
1,191
fine-tuning
BERT Model Fine Tuning and migrating to TF2
https://stackoverflow.com/questions/66253543/bert-model-fine-tuning-and-migrating-to-tf2
<p>I executed this excellent tutorial: <a href="https://towardsdatascience.com/building-a-multi-label-text-classifier-using-bert-and-tensorflow-f188e0ecdc5d" rel="nofollow noreferrer">https://towardsdatascience.com/building-a-multi-label-text-classifier-using-bert-and-tensorflow-f188e0ecdc5d</a></p> <p>I understood mos...
<p>Use the official bert example : <a href="https://www.tensorflow.org/tutorials/text/classify_text_with_bert" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/classify_text_with_bert</a></p>
1,192
fine-tuning
How to use pre-trained models for text classification?Comparing a fine-tuned model with a pre-trained model without fine-tuning
https://stackoverflow.com/questions/73250207/how-to-use-pre-trained-models-for-text-classification-comparing-a-fine-tuned-mod
<p>I want to know how much the fine-tuned model improves compared to the model without fine-tuning.I want to compare the performance of the pre-trained model(BERT) and the model(fine-tuned BERT) obtained by fine-tuning the pre-trained model on text classification.I know how to fine-tune BERT for text classification, bu...
<p>What you are trying to do does not make sense. The naive BERT model was retrained using a combination of masked language modelling objective and next sentence prediction. So, all it can do is predicting masked tokens, predicting if a pair of given sentence can be next to each other in a text. Most importantly, it ca...
1,193
fine-tuning
Problem in fine tuning DeepLabV3Plus using keras_cv for Semantic Segmentation
https://stackoverflow.com/questions/79645357/problem-in-fine-tuning-deeplabv3plus-using-keras-cv-for-semantic-segmentation
<p>I'm using <code>open-images-v7</code> dataset (accessing via <code>fiftyone</code> lib) and <code>keras_cv</code> lib to fine tune <code>DeepLabV3Plus</code> with <code>mobilenet_v3_small</code> backbone, but the accuracy doesn't improve with epochs at all, and I'm getting shape warning.</p> <p><strong>Dataset Prepa...
<p>The loss function, as you have defined it, expects values in the form of probability values for a given class. If you do not apply an activation function to the model output, raw values (<strong>logits</strong>) are fed into the loss function.</p> <p>You can perform training without using an activation function, but...
1,194
fine-tuning
Loss when starting fine tuning is higher than loss from transfer learning
https://stackoverflow.com/questions/72548173/loss-when-starting-fine-tuning-is-higher-than-loss-from-transfer-learning
<p>Since I start fine tuning with the weights learned by transfer learning, I would expect the loss to be the same or less. However it looks like it starts fine tuning using a different set of starting weights.</p> <p>Code to start transfer learning:</p> <pre><code>base_model = tf.keras.applications.MobileNetV2(input_s...
<p>According to Tensorflow, Keras page on Transfer learning and fine-tuning <a href="https://keras.io/guides/transfer_learning" rel="nofollow noreferrer">link</a>. The params of the Batch Norm layer should be left alone.</p> <blockquote> <p>Importantly, although the base model becomes trainable, it is still running in ...
1,195
fine-tuning
What is Fine Tuning in reference to Neural Network?
https://stackoverflow.com/questions/56680727/what-is-fine-tuning-in-reference-to-neural-network
<p>I'm going through a few research papers based on neural network, where I came across the word Fine Tuning on pre-trained CNN network. What does it actually do?</p>
<p><strong>Pre-trained:</strong></p> <p>Firstly we have to understand pre-trained model. Pre-trained models are the models which weights are already trained by someone on a data-set. e.g VGG16 is trained on image-net. Now we want to classify imagenet images. than we can say that If we use pre-trained VGG16 we can class...
1,196
fine-tuning
Nodejs worker pool fine tuning
https://stackoverflow.com/questions/79201418/nodejs-worker-pool-fine-tuning
<p>If I understood correctly:</p> <ol> <li>by default nodejs provides a worker pool, whose size can be tuned with UV_THREADPOOL_SIZE (default: 4)</li> <li>a cpu or io intensive task can use thread from this worker pool (this is the case for node modules like DNS or Crypto) or create a dedicated worker pool</li> <li>tot...
1,197
fine-tuning
Fine-tuning BERT on SequenceClassification using Transformers framework
https://stackoverflow.com/questions/64805769/fine-tuning-bert-on-sequenceclassification-using-transformers-framework
<p>I am currently fine-tuning a BERT model on a sequence classification task. To do this, I am using the transformers framework. This requires a Batch input in a Trainer: <a href="https://huggingface.co/transformers/_modules/transformers/trainer.html" rel="nofollow noreferrer">https://huggingface.co/transformers/_modul...
1,198
fine-tuning
Fine tuning LayoutLmv3 using Cord-V2 dataset
https://stackoverflow.com/questions/78606543/fine-tuning-layoutlmv3-using-cord-v2-dataset
<p>I'm working on fine-tuning LayoutLMv3 using the CORD-v2 dataset. I'm struggling with the data preprocessing part, specifically on how to correctly extract the total amount (TTC) from the images. The examples I've found online seem to use the older CORD dataset, which has a different format. The new CORD-v2 dataset o...
<p><em>I found a solution, you should create a label map for the data you want to extract, then Scale Bounding Boxes after that, and Detect Currency in Text because the problem is the dataset has a lot of different currencies and languages also so this is what I did</em></p> <p>label_map = { &quot;total.total_price&quo...
1,199
text classification
Text classification vs. Sentence classification
https://stackoverflow.com/questions/23460996/text-classification-vs-sentence-classification
<p>What's the difference between the two? Articles seem to treat them differently... that is, a paper would show research on either text classification <strong>or</strong> on sentence classification.</p> <p>I wonder - if one applied sentence classification on a whole text, and then classified the paragraph according t...
<p>Task, problem is about <strong>what to do</strong> not <strong>how</strong>. So it does not matter <strong>how</strong> you approach text classification it is always text classification if you <strong>classify text</strong>. That's all. You could toss a coin to classify it, it would still "count as proper text class...
1,200
text classification
Multilabel Text Classification using TensorFlow
https://stackoverflow.com/questions/35400065/multilabel-text-classification-using-tensorflow
<p>The text data is organized as vector with 20,000 elements, like [2, 1, 0, 0, 5, ...., 0]. i-th element indicates the frequency of the i-th word in a text. </p> <p>The ground truth label data is also represented as vector with 4,000 elements, like [0, 0, 1, 0, 1, ...., 0]. i-th element indicates whether the i-th l...
<p>Change relu to sigmoid of output layer. Modify cross entropy loss to explicit mathematical formula of sigmoid cross entropy loss (explicit loss was working in my case/version of tensorflow )</p> <pre><code>import tensorflow as tf # hidden Layer class HiddenLayer(object): def __init__(self, input, n_in, n_out):...
1,201
text classification
Text Classification using NLTK3 error?
https://stackoverflow.com/questions/27572923/text-classification-using-nltk3-error
<p>I'm working on Arabic text classification using NLTK3.. I got the following error ,can you please help me to figure out the bug</p> <pre><code>"calssifier =NaiveBayesClassifier.train(train_set) File "/usr/local/lib/python2.7/dist-packages/nltk/classify/naivebayes.py", line 194, in train for fname, fval in fea...
<p><strong>train_set</strong> is a string, when it should have been a dict.</p>
1,202
text classification
Feature Selection in Text Classification
https://stackoverflow.com/questions/10309203/feature-selection-in-text-classification
<p>I'm currently studying on text classification, focusing on feature selection. Can anyone suggest me any software/program that I can use for text classification that provides feature selection function (particularly Information Gain, Chi Square, Odds Ratio, Mutual Information, etc.)? </p> <p>Thanks and best regards ...
1,203
text classification
unsupervised text classification with php
https://stackoverflow.com/questions/15305817/unsupervised-text-classification-with-php
<p>Are there any pre-made libraries for PHP that can be used to help with tasks involving unsupervised text classification <sup><a href="http://en.wikipedia.org/wiki/Document_classification#Automatic_document_classification" rel="nofollow">information</a></sup>?</p> <p>I've looked around the site at other questions, b...
<p><a href="https://github.com/gburtini/Learning-Library-for-PHP" rel="nofollow">https://github.com/gburtini/Learning-Library-for-PHP</a></p> <p>Some general unsupervised algorithms already implemented here. Maybe it will be you useful for you.</p>
1,204
text classification
classification report for multilabel text classification?
https://stackoverflow.com/questions/67751096/classification-report-for-multilabel-text-classification
<p>I'm working on multilabel text classification. I'm tried to print the classification report for the machine learning but its print for each class alone. how I can get the classification report for all classes together? This part of the code</p> <p>this code for the labels</p> <pre><code>categories = list(data_raw.co...
<p>Use <strong>without</strong> <code>test[category]</code> and provide the whole test set which contains all classes that you build your model for.</p> <pre><code>print(&quot;\nClassification report : \n&quot;, metrics.classification_report(y_test, predictions)) </code></pre> <p>Where <code>y_test</code> is ground tru...
1,205
text classification
BERT Text Classification
https://stackoverflow.com/questions/67140627/bert-text-classification
<p>I am new to BERT and try to learn BERT Fine-Tuning for Text Classification via a coursera course <a href="https://www.coursera.org/projects/fine-tune-bert-tensorflow/" rel="nofollow noreferrer">https://www.coursera.org/projects/fine-tune-bert-tensorflow/</a></p> <p>Based on the course, I would like to compare the te...
<p>Maybe try adding precision and recall to a custom callback function so you can inspect what's going on. I've added a debug point in (<code>pdb.set_trace()</code>) so the process will pause once the first epoch has ended and you can step through each point to investigate the data.</p> <pre><code>from sklearn.metrics ...
1,206
text classification
TensorFlow - Text Classification using Neural Networks
https://stackoverflow.com/questions/33705284/tensorflow-text-classification-using-neural-networks
<p>Is there any example on how can TensorFlow be used for text classification using neural networks?</p>
<p>I've started putting together a set of examples for text classification on DBPedia dataset (predicting class of object from its description) as part of examples for <strong>Scikit Flow</strong>: <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/text_classification.py" rel="nofol...
1,207
text classification
How to do Text classification using word2vec
https://stackoverflow.com/questions/49643974/how-to-do-text-classification-using-word2vec
<p>I want to perform text classification using word2vec. I got vectors of words.</p> <pre><code>ls = [] sentences = lines.split(".") for i in sentences: ls.append(i.split()) model = Word2Vec(ls, min_count=1, size = 4) words = list(model.wv.vocab) print(words) vectors = [] for word in words: vectors.append(mode...
<p>You already have the array of word vectors using <code>model.wv.syn0</code>. If you print it, you can see an array with each corresponding vector of a word.</p> <p>You can see an example here using <strong>Python3</strong>:</p> <pre><code>import pandas as pd import os import gensim import nltk as nl from sklearn.lin...
1,208
text classification
Text classification using Weka
https://stackoverflow.com/questions/22587682/text-classification-using-weka
<p>I'm a beginner to Weka and I'm trying to use it for text classification. I have seen how to StringToWordVector filter for classification. My question is, is there any way to add more features to the text I'm classifying? For example, if I wanted to add POS tags and named entity tags to the text, how would I use thes...
<p>It depends of the format of your dataset and the preprocessing steps you perform. For instance, let us suppose that you have pre-POS-tagged your texts, looking like:</p> <blockquote> <p>The_det dog_n barks_v ._p</p> </blockquote> <p>So you can build an specific tokenizer (see <code>weka.core.tokenizers</code>) t...
1,209
text classification
How to do text classification with DeepPavlov
https://stackoverflow.com/questions/53445949/how-to-do-text-classification-with-deeppavlov
<p>I am interested in doing text classification with <a href="http://deeppavlov.ai" rel="nofollow noreferrer">DeepPavlov</a> chatbot framework. </p> <p>The problem is I don't have enough training data. Ideally, I would like to do text classification with just few samples for each class.</p>
<p>You should check out <a href="http://deeppavlov.ai" rel="noreferrer">DeepPavlov's</a> <a href="https://github.com/deepmipt/DeepPavlov/blob/master/deeppavlov/configs/faq/" rel="noreferrer">autoFAQ models</a>. There models were specifically developed to be effective when training data is limited.</p> <p>There are few...
1,210
text classification
Text Classification - DNN
https://stackoverflow.com/questions/60962683/text-classification-dnn
<p>I am performing text classification using a Deep Neural network. My problem is that I am receiving high accuracy 98 on train data whereas my validation accuracy is 49.</p> <p>I have tried the following:</p> <ol> <li>Shuffled the data</li> <li>My train and validation data is 80:20 split</li> <li>I am using 100 dime...
<p>Your model is clearly overfitting. Standard tricks to prevent overfitting are:</p> <ul> <li>Adding dropout,</li> <li>L2 regularization,</li> <li>Trying a smaller model.</li> </ul> <p>It is rather unusual to use convolutions and LSTMs at the same time (although it is perfectly fine). Perhaps keeping only one of the...
1,211
text classification
multiclass text classification
https://stackoverflow.com/questions/65656826/multiclass-text-classification
<p>Why my <code>lstm</code> model is getting better accuracy than my bi <code>lstm</code> model? (multi-class text classification with 5 classes using word2vec and <code>lstm</code>) I tried to find the answer in any paper but I can't find it, almost all the paper said <code>bilstm</code> can improve the accuracy, can ...
1,212
text classification
Text Classification with word2vec
https://stackoverflow.com/questions/57525190/text-classification-with-word2vec
<p>I am doing text classification and plan to use word2vec word embeddings. I have used gensim module for word2vec Training.</p> <p>I have tried several Options. But I am getting error that word 'xyz' not in vocabulary. I am not able to find my mistake.</p> <h1>Text processing</h1> <pre><code>def clean_text(text): ...
<p>Not all words from <em>corpus</em> will be kept in the word2vec model. </p> <p>Replace:</p> <pre><code>vocab_size = len(tokenizer.word_index) + 1 </code></pre> <p>With:</p> <pre><code>vocab_size = len(words) </code></pre> <p>And replace:</p> <pre><code>for word, i in tokenizer.word_index.items(): </code></pre>...
1,213
text classification
How to represent text documents as feature vectors for text classification?
https://stackoverflow.com/questions/9273536/how-to-represent-text-documents-as-feature-vectors-for-text-classification
<p>I have around 10,000 text documents.</p> <p>How to represent them as feature vectors, so that I can use them for text classification?</p> <p>Is there any tool which does the feature vector representation automatically?</p>
<p>The easiest approach is to go with the <a href="http://en.wikipedia.org/wiki/Bag_of_words_model">bag of words</a> model. You represent each document as an unordered collection of words.</p> <p>You probably want to strip out punctuation and you may want to ignore case. You might also want to remove common words like...
1,214
text classification
LSTM Text Classification Bad Accuracy Keras
https://stackoverflow.com/questions/51962128/lstm-text-classification-bad-accuracy-keras
<p>I'm going crazy in this project. This is multi-label text-classification with lstm in keras. My model is this: </p> <pre><code>model = Sequential() model.add(Embedding(max_features, embeddings_dim, input_length=max_sent_len, mask_zero=True, weights=[embedding_weights] )) model.add(Dropout(0.25)) model.add(LSTM(out...
<p>In last layer, the activation function you are using is <code>sigmoid</code>, so <code>binary_crossentropy</code> should be used. Incase you want to use <code>categorical_crossentropy</code> then use <code>softmax</code> as activation function in last layer.</p> <p>Now, coming to the other part of your model, since...
1,215
text classification
Text Classification Using spaCy
https://stackoverflow.com/questions/73457037/text-classification-using-spacy
<p>I was trying to do some text classification with spacy but i get an error about my vucabulary being empty.</p> <p>I tried a classic dataset but i get the same error, i've seen some suggestion to split the text part but i have many lines not a huge one.</p> <p>this is the code:</p> <pre><code># df_amazon = pd.read_c...
<p>It looks like you're just using the spaCy tokenizer? I'm not sure what's going on, but you should check the output of the tokenizer on your documents.</p> <p>Note that while I think you can use the tokenizer that way, it would be more typical to use a blank pipeline, like this:</p> <pre><code>import spacy nlp = spac...
1,216
text classification
Text Classification using MALLET
https://stackoverflow.com/questions/31367381/text-classification-using-mallet
<p>I'm new to using Mallet. I usually use WEKA for classification, and now I'm trying to use Mallet for text classification. In Weka, there are attributes (such as word length or top-n word occurrence) that we choose ourselves and make the .arff file. </p> <p>I have read about the input format for Mallet in <a href="h...
<p>-How do we tell this document belongs to a certain class?:</p> <p>You can have one folder per class, for example: C:/Corpus/Class1 C:/Corpus/Class2 C:/Corpus/Classn and each folder contains the documents which belong to that class.</p> <p>How do we assign attribute in the input format?</p> <p>If you want to know ...
1,217
text classification
Stemming in Text Classification - Degrades Accuracy?
https://stackoverflow.com/questions/22603332/stemming-in-text-classification-degrades-accuracy
<p>I am implementing a text classification system using Mahout. I have read stop-words removal and stemming helps to improve accuracy of Text classification. In my case removing stop-words giving better accuracy, but stemming is not helping much. I found 3-5% decrease in accuracy after applying stemmer. I tried with po...
<p>First of all, you need to understand <em>why</em> stemming normally improve accuracy. Imagine following sentence in a training set: </p> <blockquote> <p>He played below-average football in 2013, but was viewed as an ascending player before that and can play guard or center.</p> </blockquote> <p>and following in ...
1,218
text classification
Mallet vs Weka for text classification
https://stackoverflow.com/questions/7953935/mallet-vs-weka-for-text-classification
<p>Which product (Mallet or Weka) is better for text classification task:</p> <ol> <li>Simpler to train</li> <li>Better results</li> <li>Documentation</li> </ol> <p>I'm new for this problem so any comments will be great</p>
<p>MALLET is much easier to use and does most of its job invisibly. You don't have to convert the format of anything either, you just give it text files and it gives you back results.</p> <p>Weka requires converting the text into a particular format (the Weka script for doing so it so slow and inefficient that I would...
1,219
text classification
Text Classification and VIF
https://stackoverflow.com/questions/68411148/text-classification-and-vif
<p>Does VIF matter when it comes to dealing with Text Classification. I have a large dataset, after tokenizing the text, I have 400 columns of stemmed words. After running tests for VIF, I noticed that most variable's VIF were less than 5. The remaining VIF's fluctuated between 6-37, should I be removing these variable...
1,220
text classification
Model.fit Value Error (Text Classification Model)
https://stackoverflow.com/questions/60104840/model-fit-value-error-text-classification-model
<p>I need your help please...</p> <p>I am trying go get the following Text Classification Module working:</p> <pre class="lang-py prettyprint-override"><code> # Train and validate model. history = model.fit(x_train, train_labels, epochs=epochs, callbacks=callbacks, ...
1,221
text classification
Text Classification with Python
https://stackoverflow.com/questions/64353644/text-classification-with-python
<p>HI i am new to python programming language, based on the various reference i have build the text classification model using logistic regression, Below is the code.</p> <pre><code>from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer import pandas as ...
<p>Please try:</p> <pre><code>reverse_top_10_varieties = {idx:i[0] for idx, i in enumerate(counter.most_common(50))} [reverse_top_10_varieties[id] for id in y_pred] </code></pre> <p>and see if this solves your problem</p>
1,222
text classification
Centroid algorithm for text classification, tools?
https://stackoverflow.com/questions/10663854/centroid-algorithm-for-text-classification-tools
<p>As discussed <a href="http://classes.seattleu.edu/computer_science/csse470/Madani/ABCs.html#centroid" rel="nofollow">here</a>, Do you know of any tools which provides a centroid algorithm for text classification in java?</p>
<p><a href="http://scikit-learn.org/" rel="nofollow">scikit-learn</a> includes this as the class <a href="http://scikit-learn.org/stable/modules/neighbors.html#nearest-centroid-classifier" rel="nofollow"><code>NearestCentroid</code></a>. It also includes an implementation of L2-normalized tf-idf.</p> <p>[Disclaimer: I...
1,223
text classification
Keyword based text classification
https://stackoverflow.com/questions/62127122/keyword-based-text-classification
<p>I want to classify some texts based on available keywords in each class. In other words, I have a list of keywords for each category. I need some heuristic methods using these keywords and determine top similar categories for each text. I should say that in the current phase of the project, I didn't want to use a ma...
1,224
text classification
Text classification NaiveBayes Accord.NET
https://stackoverflow.com/questions/59123503/text-classification-naivebayes-accord-net
<p>I am particularly new to accord.net</p> <p>My case: Classifying short text of various length into 100+ different categories.</p> <p>Input sample (10k Records in a .csv file)</p> <p>Text ------------------------- Category</p> <p>Cabinet -------------------- Furniture and Fittings</p> <p>Coffee Table ------------...
1,225
text classification
Text classification extract tags from text
https://stackoverflow.com/questions/8990804/text-classification-extract-tags-from-text
<p>I have a lucene index with a lot of text data, each item has a description, I want to extract the more common words from the description and generate tags to classify each item based on the description, is there a lucene.net library for doing this or any other library for text classification?</p>
<p>No, lucene.net can make search, index, text normalization, "find more like this" funtionalty, but not a text classification.</p> <p>What to suggest to you depends from your requirements. So, maybe more description needed. But, generally, easiest way try to use external services. All external services have REST API,...
1,226
text classification
Deploying a text classification model on new (unseen) text
https://stackoverflow.com/questions/64536994/deploying-a-text-classification-model-on-new-unseen-text
<p>I am working on a text classification problem. I have attached a simple dummy snippet of a text classification model I have trained.</p> <p>How do I deploy the model on new_text? When the model is used on <code>check_predictions</code>, it classifies text correctly, however, when new data is used, the classification...
<p>Whatever (new) text you are feeding into your model must go through the exact same preprocessing steps as your training data - here the <code>CountVectorizer</code> as already fitted with your <code>X_train</code>:</p> <pre><code>new_data_vectorized = cv.transform(new_data) # NOT fit_transform new_predictions = nai...
1,227
text classification
Generate PMML for text classification pipeline in python
https://stackoverflow.com/questions/44560823/generate-pmml-for-text-classification-pipeline-in-python
<p>I am trying to generate PMML (using jpmml-sklearn) for text classification pipeline. The last line in the code - sklearn2pmml(Textpipeline, "TextMiningClassifier.pmml", with_repr = True) - crashes.</p> <pre><code>from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import CountVector...
<p>You need to use PMML-compatible text tokenization function. The default implementation is class <code>sklearn2pmml.feature_extraction.text.Splitter</code>:</p> <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer from sklearn2pmml.feature_extraction.text import Splitter vectorizer = TfidfVectoriz...
1,228
text classification
Training LLM to perform text classification
https://stackoverflow.com/questions/76476765/training-llm-to-perform-text-classification
<p>I am trying to perform text classification using GPTNeo, using the tweet_eval dataset from huggingface. I am following this example <a href="https://huggingface.co/docs/transformers/tasks/sequence_classification" rel="nofollow noreferrer">https://huggingface.co/docs/transformers/tasks/sequence_classification</a>, bu...
<p>I think it could be your python version in anaconda. When I load OPT from facebook with Anaconda Python 3.6, it also missing the key <code>opt</code> but when I uninstall anaconda and use Python 3.8, it load successfully.</p>
1,229
text classification
Text preprocessing for text classification using fastText
https://stackoverflow.com/questions/62244474/text-preprocessing-for-text-classification-using-fasttext
<p>What text preprocessing produces the best results for supervised text classification using <a href="https://github.com/facebookresearch/fastText" rel="nofollow noreferrer">fastText</a>?</p> <p>The official documentation shows a only a <a href="https://fasttext.cc/docs/en/supervised-tutorial.html#preprocessing-the-d...
<p>There is no general answer. It very much depends on what task you are trying to solve, how big data you have, and what language the text is in. Usually, if you have enough data, simple tokenization that you described is all you need.</p> <p><em>Lemmatization</em>: FastText computes the word embeddings from embeddin...
1,230
text classification
Encoding data&#39;s label for text classification
https://stackoverflow.com/questions/38710993/encoding-datas-label-for-text-classification
<p>I am doing a project in clinical text classification. In my corpus ,data are already labelled by code (For examples: 768.2, V13.02, V13.09, 599.0 ...). I already separated text and labels then using word-embedded for text. I am going to feed them into convolution neural network. However, the labels are needs to enco...
<p>Discrete text label is easily convertible to discrete numeric data by creating an enumeration mapping. For example, assuming the labels "Yes", "No" and "Maybe":</p> <pre><code>No -&gt; 0 Yes -&gt; 1 Maybe -&gt; 2 </code></pre> <p>And now you have numeric data, which can later be converted back (as long as the...
1,231
text classification
text classification using svm
https://stackoverflow.com/questions/17700308/text-classification-using-svm
<p>i read this article :<strong>A hybrid classification method of k nearest neighbor, Bayesian methods and genetic algorithm</strong> <br> it's proposed to use genetic algorithm in order to improve text classification<br> i want to replace Genetic algorithm with SVM but i don't know if it works or not<br> i mean i do n...
<p>SVM and Genetic Algorithms are in fact completely different methods. SVM is basicaly a <strong>classification</strong> tool, while genetic algorithms are <strong>meta optimisation heuristic</strong>. Unfortunately I do not have access to the cited paper, but I can hardly imagine, how putting sVM in the place of GA c...
1,232
text classification
Does stemming harm precision in text classification?
https://stackoverflow.com/questions/10369479/does-stemming-harm-precision-in-text-classification
<p>I have read stemming harms precision but improves recall in text classification. How does that happen? When you stem you increase the number of matches between the query and the sample documents right?</p>
<p>It's always the same, if you raise recall, your doing a generalisation. Because of that, you're losing precision. Stemming merge words together.</p> <blockquote> <p>On the one hand, words which ought to be merged together (such as "adhere" and "adhesion") may remain distinct after stemming; on the other, words wh...
1,233