text stringlengths 81 47k | source stringlengths 59 147 |
|---|---|
Question: <p>Giving the right kind of prompt to Flan T5 Language model in order to get the correct/accurate responses for a chatbot/option matching use case.</p>
<p>I am trying to use a Flan T5 model for the following task. Given a chatbot that presents the user with a list of options, the model has to do semantic opti... | https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question |
Question: <p>I see there exits two configs of the T5model - <strong>T5Model</strong> and <strong>TFT5WithLMHeadModel</strong>. I want to test this for translation tasks (eg. en-de) as they have shown in the google's original repo. Is there a way I can use this model from hugging face to test out translation tasks. I di... | https://stackoverflow.com/questions/60513592/how-to-use-huggingface-t5-model-to-test-translation-task |
Question: <p>I have deployed T5 tensorrt model on nvidia triton server and below is the config.pbtxt file, but facing problem while inferencing the model using triton client.</p>
<p>As per the config.pbtxt file there should be 4 inputs to the tensorrt model along with the decoder ids. But how can we send decoder as inp... | https://stackoverflow.com/questions/71911630/how-to-run-inference-for-t5-tensorrt-model-deployed-on-nvidia-triton |
Question: <p>I have tried to convert the model using the llama.cpp convert.py following the colab note <a href="https://colab.research.google.com/github/TrelisResearch/gguf-quantization/blob/main/HuggingFace_to_GGUF.ipynb#scrollTo=CmT3xkz0GHJN" rel="nofollow noreferrer">HERE</a>.</p>
<pre><code>
model = AutoModelForSeq... | https://stackoverflow.com/questions/77200600/i-am-trying-to-convert-a-flan-t5-pytorch-model-to-gguf-format |
Question: <p>all.</p>
<p>I'm trying to convert SwitchTransformer model to TorchScript.
(SwitchTransformer model is MoE DNN based on Google T5 model.)</p>
<p>When converting both T5 and SwitchTransforemer, there's no error for T5 but I got following error for SwitchTransformer.</p>
<pre><code>/root/HuggingFace/.HF/lib/p... | https://stackoverflow.com/questions/76473823/can-we-convert-dynamic-dnn-model-to-torchscript |
Question: <p>I need to build a question-answering system on a specific domain of Finance, I have documents data containing all the information about the field,</p>
<p>Can I fine-tune T5 pre-trained model (large) unsupervised training on the documents so it can answer related questions based on my documents corpus?<br /... | https://stackoverflow.com/questions/75459693/fine-tune-t5-pre-trained-model-on-a-specific-domain-for-question-answering |
Question: <p>I would like to use state-of-the-art LM T5 to get sentence embedding vector.
I found this repository <a href="https://github.com/UKPLab/sentence-transformers" rel="noreferrer">https://github.com/UKPLab/sentence-transformers</a>
As I know, in BERT I should take the first token as [CLS] token, and it will be... | https://stackoverflow.com/questions/64579258/sentence-embedding-using-t5 |
Question: <p>Trying to convert a <code>question-generation</code> t5 model to <code>torchscript</code> <a href="http://%5Bmodel%5D(https://huggingface.co/transformers/torchscript.html#torchscript)." rel="noreferrer">model</a>, while doing that Running into this error</p>
<p><strong>ValueError: You have to specify eithe... | https://stackoverflow.com/questions/65140400/valueerror-you-have-to-specify-either-decoder-input-ids-or-decoder-inputs-embed |
Question: <p>I have a small text dataset for translation which I want to fine-tune with <code>t5-small</code>, Here is the code which I am trying to use to finetune.</p>
<pre><code>import numpy as np
import tensorflow as tf
from transformers import TFT5ForConditionalGeneration, T5Tokenizer
model = TFT5ForConditionalGe... | https://stackoverflow.com/questions/64818504/how-to-finetune-the-huggingface-t5-model-on-custom-data |
Question: <p>I am evaluating the different flan-t5 models with few-shot chain of thought prompts which can go over the 2048 maximum token length. I am under the impression that because T5 uses relative position encoding, that it would be valid (make sense) to do zero shot on sequences longer than 2048, provided that I ... | https://stackoverflow.com/questions/76495456/is-it-valid-to-evaluate-a-flan-t5-model-on-sequences-longer-than-its-max-length |
Question: <p>I was distilling my student model (base model t5-small) based on a fine-tuned T5-xxl. Here is the config</p>
<pre><code>student_model = AutoModelForSeq2SeqLM.from_pretrained(
args.student_model_name_or_path,
torch_dtype=torch.float32,
device_map="auto",
cache_dir=args.cache_dir,
... | https://stackoverflow.com/questions/79205866/why-my-trained-t5-small-model-generate-a-mess-after-i-saved-and-loaded-the-check |
Question: <p>I am trying out a project where I use the T5EncoderModel from HuggingFace in order to obtain hidden representations of my input sentences. I have 100K sentences which I tokenize and pad as follows:</p>
<pre><code> for sentence in dataset[original]:
sentence = tokenizer(sentence, max_length=40, padd... | https://stackoverflow.com/questions/67455305/t5-encoder-model-output-all-zeros |
Question: <p>I'm trying to denoise text using a T5 model following <a href="https://huggingface.co/docs/transformers/v4.28.1/en/model_doc/t5#transformers.T5ForConditionalGeneration" rel="nofollow noreferrer">the Huggingface doc:</a></p>
<pre><code>from transformers import T5Tokenizer, T5ForConditionalGeneration
tokeniz... | https://stackoverflow.com/questions/76186015/how-to-denoise-text-using-t5 |
Question: <p>I am trying to train a T5 model using <code>simpletransformers</code>. Here is my code:</p>
<pre><code>from simpletransformers.t5 import T5Model
model_args = {
"max_seq_length": MAX_LEN,
"train_batch_size": 8,
"eval_batch_size": 8,
"num_train_epochs":... | https://stackoverflow.com/questions/74138756/use-cuda-is-set-true-even-though-it-was-specified-as-false-t5 |
Question: <p>I'm currently using HuggingFace's T5 implementation for text generation purposes. More specifically, I'm using the <code>T5ForConditionalGeneration</code> to solve a text classification problem as generation.</p>
<p>The model's performance is overall very satisfactory after training, but what I am wonderin... | https://stackoverflow.com/questions/73781510/how-to-get-the-logits-for-the-t5-model-when-using-the-generate-method-for-infe |
Question: <p>For my use case, I need to use the model.forward() instead of the model.generate() method
i.e instead of the below code</p>
<pre><code>outs = model.model.generate(input_ids=batch['source_ids'],
attention_mask=batch['source_mask'],
output_sco... | https://stackoverflow.com/questions/67328345/how-to-use-forward-method-instead-of-model-generate-for-t5-model |
Question: <p>I am trying to fine tune a T5 model for more accurate summarization, but my loss is very high and does not change with each epoch. I have tried increasing the learning rate, but the model still does not train. It seems like there is some issue with the code since the loss doesn't change at all. My input te... | https://stackoverflow.com/questions/76337204/pytorch-t5-training-loss-not-changing |
Question: <p>I am currently using a model called T0pp (<a href="https://huggingface.co/bigscience/T0pp" rel="nofollow noreferrer">https://huggingface.co/bigscience/T0pp</a>) in production and would like to speed up inference.</p>
<p>I am running the following code on an on-demand EC2 g4dn.12xlarge instance (4 Nvidia T4... | https://stackoverflow.com/questions/71210238/speeding-up-inference-of-t5-like-model |
Question: <p>I'm using the mT5 model from HuggingFace Transformers to perform some conditional generation and apply it to text classification.</p>
<p>I noticed that whatever the T5 model generates (and before it's trained sufficiently) it usually generates special tokens that look like <code><extra_id0></code> or... | https://stackoverflow.com/questions/73740232/what-do-the-extra-idx-tokens-in-t5-mean |
Question: <p>For my use case, I need to obtain the logits from T5's forward() method without inputting labels. I know that forward() and .generate() are different (<a href="https://stackoverflow.com/questions/67328345/how-to-use-forward-method-instead-of-model-generate-for-t5-model">see here</a>). I have also seen <a h... | https://stackoverflow.com/questions/73411215/getting-logits-from-t5-hugging-face-model-using-forward-method-without-labels |
Question: <p>I fintuned mT5 with new dataset for summarization task.<br />
In the inference phase, mT5 generate outputs contains <extra_id_1>, ... when the input is not mask.</p>
<p>I use the blow code to encode the input:</p>
<p>`tokenized_inputs = self.tokenizer.batch_encode_plus(<br />
[line],
max_length=self... | https://stackoverflow.com/questions/76731327/why-the-output-of-t5-model-contains-extra-id-0-when-the-input-is-not-mas |
Question: <p>I just trained a model based on the T5 network, but I managed to save it only with</p>
<pre class="lang-py prettyprint-override"><code>torch.save(model, 'trained_model')
</code></pre>
<p>Which saved the model in a single <code>trained_model</code> file.</p>
<p>When I now try to load it with</p>
<pre class=... | https://stackoverflow.com/questions/73034501/how-to-load-model-after-saving-only-with-torch-savemodel |
Question: <p>I use</p>
<pre><code> for p in model.parameters():
p.requires_grad = False
</code></pre>
<p>to freeze a T5 model (t5-small), but when I print parameters that require grad, there is still one parameter with the size <code>32121x512</code>. What is this? Is it the embeddings matrix? Shoul... | https://stackoverflow.com/questions/70352825/how-to-freeze-a-huggingface-model |
Question: <p>I trained fine tune T5 model with my dataset.</p>
<p>Here is my model class</p>
<pre><code>class QA_model(pl.LightningModule):
def __init__(self):
super().__init__()
self.model=T5ForConditionalGeneration.from_pretrained(model_t5,return_dict=True)
def forward(self,input_ids, attention_mask,lab... | https://stackoverflow.com/questions/69585470/how-to-push-nlp-model-trained-with-pytorch-in-hugging-face |
Question: <p>First of I'll start with saying that I'm a beginner when it comes to machine learning as a whole and transformers so my apologies if it's a dumb question.
I've been fine tuning t5 for the task of generating mongodb queries, but I was met with this strange output that doesn't look like as the intended one.<... | https://stackoverflow.com/questions/75851029/t5-fine-tuned-model-outputs-unk-instead-of-curly-braces-and-other-special-char |
Question: <p>I use the following code to load the saved model:</p>
<pre><code> config = T5Config.from_pretrained(
model_name_or_path,
cache_dir=model_args.cache_dir,
revision=model_args.model_revision,
use_auth_token=True if model_args.use_auth_token else None,
)
config.train_tas... | https://stackoverflow.com/questions/75075829/how-to-load-a-saved-model-for-a-hoggingface-t5-model-where-the-tokenizer-was-ext |
Question: <p>I tried to run flan-t5-xxx model from Hugging Face both in my Mac M1 and Google Colab, both have the same error:</p>
<p><code>ValueError: Need either a state_dict or a save_folder containing offloaded weights.</code></p>
<p>The code from Model Card:</p>
<pre><code>from transformers import T5Tokenizer, T5Fo... | https://stackoverflow.com/questions/76617863/flan-t5-xxl-valueerror-need-either-a-state-dict-or-a-save-folder-containin |
Question: <p>I'am trying to train T5 model using Seq2SeqTrainer.
I found out that the Config of T5 model is like below.</p>
<pre><code>T5Config {
"_name_or_path": "allenai/tk-instruct-base-def-pos",
"architectures": [
"T5ForConditionalGeneration"
],
"attention_pr... | https://stackoverflow.com/questions/76281106/can-i-add-configuration-of-dropout-rate-to-seq2seqtrainer |
Question: <p>I’m working on a multimodal model that combines audio and visual features with a T5-based encoder for a feedback generation task. However, I’m facing an issue with batch size mismatch between the projected audio/visual features and the encoder outputs, which leads to the error:</p>
<p>❌ Error in batch 1: T... | https://stackoverflow.com/questions/79588847/size-mismatch-in-multimodal-feedback-model-using-t5-audio-visual-features-th |
Question: <p>I am fine-tuning T5 LLM, with the model based on this Colab notebook from Google: <a href="https://colab.research.google.com/github/snapthat/TF-T5-text-to-text/blob/master/snapthatT5/notebooks/TF-T5-Datasets%20Training.ipynb#scrollTo=dEutWnhiWRAq" rel="nofollow noreferrer">TF-T5- Training.ipynb</a>. My cur... | https://stackoverflow.com/questions/76987203/attributeerror-adam-object-has-no-attribute-decayed-lr-when-fine-tuning-t5 |
Question: <p>I'm trying to run Flan-T5-XXL model for a "question-answering" task.
Here's how I loaded and executed the model:</p>
<pre><code>model_id = "~/Downloads/test_LLM/flan-t5-xxl"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForQuestionAnswering.from_pretrained(model_i... | https://stackoverflow.com/questions/76963864/low-score-and-wrong-answer-for-flan-t5-xxl-question-answering-task |
Question: <p>Downloaded T5-small model from SparkNLP website, and using this code (almost entirely from the examples):</p>
<pre><code> import com.johnsnowlabs.nlp.SparkNLP
import com.johnsnowlabs.nlp.annotators.seq2seq.T5Transformer
import org.apache.spark.sql.SparkSession
val spark = SparkSession.build... | https://stackoverflow.com/questions/66207669/cannot-use-sparknlp-pre-trained-t5transformer-executor-fails-with-error-no-ope |
Question: <p>I finetuned the t5 model and I want to upload it on my hugging face library.
I have my directory, where I save tokenizer and model.</p>
<pre><code>tokenizer.save_pretrained('my-t5-qa-legal')
trained_model.model.save_pretrained('my-t5-qa-legal')
</code></pre>
<p>Here are files in my directory:</p>
<pre><cod... | https://stackoverflow.com/questions/69604479/git-push-errorfatal-unable-to-access-port-number-ended-with-a |
Question: <p>I got the following error in the evaluation of a <a href="https://github.com/google-research/text-to-text-transfer-transformer" rel="nofollow noreferrer">t5</a> model:</p>
<pre><code>
model.batch_size = train_batch_size * 4
model.eval(
mixture_or_task_name="trivia_all",
checkpoint_steps=-... | https://stackoverflow.com/questions/67027987/typeerror-get-dataset-for-single-task-got-an-unexpected-keyword-argument-se |
Question: <p>I am using T5 model and tokenizer for a downstream task. I want to add certain whitespaces to the tokenizer like line ending <code>(\t)</code> and tab <code>(\t)</code>. Adding these tokens work but somehow the tokenizer always ignores the second whitespace. So, it tokenizes the sequence <code>“\n\n”</code... | https://stackoverflow.com/questions/72214408/why-does-huggingface-t5-tokenizer-ignore-some-of-the-whitespaces |
Question: <p>When using Huggingface with 'google/flan-t5-base' model, I get the error:</p>
<pre><code>RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cuda:1! (when checking argument for argument index in method wrapper__index_select)
</code></pre>
<p>I've found in... | https://stackoverflow.com/questions/79135659/how-to-use-flan-t5-with-lora-on-multi-gpu-system |
Question: <p>I am trying to fine-tune a <code>t5-base</code> model for creating appropriate question against a compliance item. Compliance iteams are paragraph of texts and my question are in the past format of them. I have trained the model, saved it and loaded it back for future usecases.</p>
<p>The problem is when I... | https://stackoverflow.com/questions/78448914/why-did-my-fine-tuning-t5-base-model-for-a-sequence-to-sequence-task-has-short-i |
Question: <p>I am playing with Hugging Face Inference API and I am trying to convert a numbered list into a cohesive prose paragraph. I have tried multiple models but I am not able to get things working.</p>
<p>I have tried GPT-2, BLOOM and T5 models, but in each case I am failing to get the prose paragraph output that... | https://stackoverflow.com/questions/79111263/formatting-a-numbered-list-into-a-cohesive-prose-paragraph-using-hugging-face-in |
Question: <p>When I train my model(my model is a transformer that its input is featured extracted from T5 model and Vit )
I have problem for set batch_size more than 2 number</p>
<pre><code>number of image is 25000 for training.
GPU is GTX 3090(24 gpu ram).
24 core multithreading CPU.
number of total parameter =363M
s... | https://stackoverflow.com/questions/74652127/problem-for-change-batch-size-in-my-model |
Question: <p>I am working on transformer and I am interested in one of the models and would like to run the source code.</p>
<p>For example, in the T5 model file, such import appears.</p>
<pre><code>from ...activations import ACT2FN
from ...file_utils import (
DUMMY_INPUTS,
DUMMY_MASK,
add_start_docstrings,
add_start_d... | https://stackoverflow.com/questions/70421506/how-to-run-py-directly-in-a-python-package |
Question: <p>I have used following embeddings:</p>
<ol>
<li>sentence-transformers/all-mpnet-base-v2</li>
<li>hkunlp/instructor-xl</li>
</ol>
<p>to get embedding</p>
<pre><code>def getEmbedding():
device = "cuda" if torch.cuda.is_available() else "cpu"
return HuggingFaceEmbeddings(mod... | https://stackoverflow.com/questions/76692329/fastchat-t5-3b-v1-0-gives-truncated-incomplete-answers |
Question: <p>I am fine-tuning a T5 model on a specific dataset and my code looks like this:</p>
<pre class="lang-py prettyprint-override"><code>accelerator = Accelerator(log_with='wandb')
tokenizer = T5Tokenizer.from_pretrained('t5-base')
model = T5ForConditionalGeneration.from_pretrained('t5-base')
accelerator.init_t... | https://stackoverflow.com/questions/77758645/get-accelerate-package-to-log-test-results-with-huggingface-trainer |
Question: <p>I git-cloned a <a href="https://github.com/farazkh80/SearchEngine" rel="nofollow noreferrer">project</a> and did all the installation. The website also launched. But I think I couldn't connect to the two files (<code>t5-base-full-seeded.ckpt</code> and <code>t5-small-full-seeded.ckpt</code>) because the pr... | https://stackoverflow.com/questions/78298468/what-is-the-issue-when-i-tried-to-add-a-pretuned-t5-model-to-the-project-from-gi |
Question: <p>I am fine tuning the T5 model for QA task (NLP).</p>
<p>I would like to use transfer learning, to see if I can get better results.</p>
<p>Initially, I used the model like:</p>
<pre><code>class QAModel(pl.LightningModule):
def __init__(self):
super().__init__()
self.model = T5ForConditionalGenerat... | https://stackoverflow.com/questions/76827306/how-many-and-which-layers-to-freeze-while-using-transfer-learning |
Question: <p>I am building a chat bot using flan-T5 model. The bot has a text window where one can give instructions like:</p>
<ul>
<li>Summarize this for me "big text goes here"</li>
</ul>
<p>Or, one might dump the text first in the chat window and then say</p>
<ul>
<li>Summarize the above text (or something... | https://stackoverflow.com/questions/75913490/conversational-bot-with-flan-t5 |
Question: <p>I downloaded the T5 model .py file(text-to-text-transfer-transformer) on the official website.</p>
<p>when i run the mtf_model.py,I found the code:</p>
<pre><code>import gin.tf
</code></pre>
<p>introduce the error:ModuleNotFoundError: No module named 'gin.tf'</p>
<p>but the code:</p>
<pre><code>import gin
... | https://stackoverflow.com/questions/75971192/modulenotfounderror-no-module-named-gin-tf-pip-install-gin-config-0-1-1-not |
Question: <p>I am creating an URDU TEXT PARAPHRASING tool for my semester.</p>
<p>I have used T5 Model and fine tuned it.</p>
<p>Now when im running this code:</p>
<pre><code>**import torch
from transformers import T5ForConditionalGeneration, T5Tokenizer
# Define your model and tokenizer
model_name = "t5-small&qu... | https://stackoverflow.com/questions/78673465/a-prepand-paraphrase-is-showig-all-the-time-after-runnig-the-code-instead-of-a |
Question: <p>Suppose you would like to train a sequence-to-sequence model like T5-small <strong>from scratch</strong> on a task where the vocabulary is quite limited compared to the tokenizer of T5 which was trained on much larger vocabulary.</p>
<p>For instance, the data have the following format:</p>
<pre><code>Can y... | https://stackoverflow.com/questions/78949531/are-there-any-potential-issues-training-a-t5-small-from-scratch-on-a-task-with-v |
Question: <p>I am converting the T5 model from pytorch to ONNX using <a href="https://github.com/onnx/models/blob/master/text/machine_comprehension/t5/dependencies/T5-export.py" rel="nofollow noreferrer">this</a> script, but I am running into an Import module error. I don't think this a structural problem as this scrip... | https://stackoverflow.com/questions/66238009/importerror-attempted-relative-import-with-no-known-parent-package-in-onnx-libr |
Question: <p>I'm trying to fine tune a t5 model for paraphrasing Farsi sentences. I'm using <a href="https://huggingface.co/erfan226/persian-t5-paraphraser" rel="nofollow noreferrer">this</a> model as my base. My dataset is a paired sentence dataset which each row is a pair of paraphrased sentences. I want to fine tune... | https://stackoverflow.com/questions/74529986/your-fast-tokenizer-does-not-have-the-necessary-information-to-save-the-vocabula |
Question: <p>I am trying to use Google's T5 for language translation. However, it is not working for German to English.</p>
<p>English to German works fine:</p>
<pre><code>self.tokenizer = AutoTokenizer.from_pretrained("t5-small")
self.model = AutoModelForSeq2SeqLM.from_pretrained("t5-small")
inputs... | https://stackoverflow.com/questions/66797042/using-googles-t5-for-translation-from-german-to-english |
Question: <h2>Issue</h2>
<p>I tried to load T5 models from the Huggingface <code>transformers</code> library in python as follows</p>
<pre><code>import pytorch
import transformers
from transformers import AutoModelForSeq2SeqLM
plm = AutoModelForSeq2SeqLM.from_pretrained('t5-small')
</code></pre>
<p>The <code>AutoModel... | https://stackoverflow.com/questions/75597709/undefined-symbol-error-when-trying-to-load-huggingfaces-t5 |
Question: <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 mode... | https://stackoverflow.com/questions/76932312/fine-tuning-t5-not-converging |
Question: <p>I'm trying to use google flan t5-large to create embeddings for a simple semantic search engine. However, the generated embeddings cosine similarity with my query is very off. Is there something I'm doing wrong?</p>
<pre class="lang-py prettyprint-override"><code>import torch
from transformers import AutoT... | https://stackoverflow.com/questions/75673222/semantic-searching-using-google-flan-t5 |
Question: <p>I am working on getting the abstractive summaries of the XSUM and the CNN DailyMail datasets using Huggingface's pre-trained BART, Pegasus, and T5 models.</p>
<p>I am confused because there already exist checkpoints of models pre-trained on the same dataset.</p>
<p>So even if I do:</p>
<pre class="lang-py ... | https://stackoverflow.com/questions/69530032/how-to-use-huggingface-pretrained-models-to-get-the-output-of-the-dataset-that-w |
Question: <p>I'm trying to fine tune the model weights from a FLAN-T5 model downloaded from hugging face. I'm trying to do this with PEFT and specifically LoRA. I'm using the code below. I'm getting an error "No executable batch size found, reached zero". It seems to be related to the "auto_find_batc... | https://stackoverflow.com/questions/77404935/peft-lora-trainer-no-executable-batch-size-found |
Question: <p>I am trying to explore <a href="https://huggingface.co/transformers/model_doc/t5.html#" rel="noreferrer">T5</a></p>
<p>this is the code</p>
<pre><code>!pip install transformers
from transformers import T5Tokenizer, T5ForConditionalGeneration
qa_input = """question: What is the capital of Syr... | https://stackoverflow.com/questions/65445651/t5tokenizer-requires-the-sentencepiece-library-but-it-was-not-found-in-your-envi |
Question: <p>I'm trying to create a machine learning model to paraphrase given Persian text. I was introduced to mt5 as a multilingual text-to-text model. However, I can't figure out how to implement this. I have gathered the data. Here's a sample of the data:
<a href="https://i.sstatic.net/qz6MC.jpg" rel="nofollow nor... | https://stackoverflow.com/questions/74149057/mt5-machine-learning-model-for-paraphrasing |
Question: <p>I am working to finetune a t5 model to summarize Amazon reviews. I am following this tutorial here: <a href="https://towardsdatascience.com/fine-tuning-a-t5-transformer-for-any-summarization-task-82334c64c81" rel="nofollow noreferrer">https://towardsdatascience.com/fine-tuning-a-t5-transformer-for-any-summ... | https://stackoverflow.com/questions/66756245/training-step-not-executing-in-pytorch-lightning |
Question: <p>I am using pytorch lightning to finetune t5 transformer on a specific task. However, I was not able to understand how the finetuning works. I always see this code :</p>
<p><code>tokenizer = AutoTokenizer.from_pretrained(hparams.model_name_or_path) model = AutoModelForSeq... | https://stackoverflow.com/questions/71781813/how-does-the-finetune-on-transformer-t5-work |
Question: <p>I use the HuggingFace's Transformers library for building a <strong>sequence-to-sequence model</strong> based on BART and T5. I carefully read the documentation and the research paper and I can't find what the input to the decoder (decoder_input_ids) should be for sequence-to-sequence tasks.</p>
<p>Should ... | https://stackoverflow.com/questions/63307009/what-decoder-input-ids-should-be-for-sequence-to-sequence-transformer-model |
Question: <p>I am facing an issue while training a t5 model. After each evaluation step, the following message is printed, which makes it impossible to maintain an overview. Do you have any ideas, on how I can avoid such behavior?</p>
<blockquote>
<p>***** Running Evaluation ***** Num examples = 819 Batch size = 32... | https://stackoverflow.com/questions/76902234/avoid-printing-generate-config-generationconfig |
Question: <p>I'm trying to fine-tune the model weights from a FLAN-T5 model downloaded from hugging face. I'm trying to do this with PEFT and specifically LoRA. I'm using the Python 3 code below. I'm running this on ubuntu server 18.04LTS with an invidia gpu that has 8GB of ram. I'm getting an error "CUDA out of m... | https://stackoverflow.com/questions/77406208/cuda-out-of-memory-error-during-peft-lora-fine-tuning |
Question: <p>Here is the model <a href="https://huggingface.co/PrimeQA/t5-base-table-question-generator" rel="nofollow noreferrer">https://huggingface.co/PrimeQA/t5-base-table-question-generator</a></p>
<p>Hugging face says that I should use the following code to use the model in transformers:</p>
<pre><code>from trans... | https://stackoverflow.com/questions/73357305/how-to-use-huggingface-transformers-with-primeqa-model |
Question: <p>I found interesting model - question generator, but can't run it. I got an error:</p>
<pre><code>Traceback (most recent call last):
File "qg.py", line 5, in <module>
model = AutoModelWithLMHead.from_pretrained("/home/user/ml-experiments/gamesgen/t5-base-finetuned-question-generat... | https://stackoverflow.com/questions/63419835/pytorch-model-saved-from-tpu-run-on-cpu |
Question: <p>I have been reading the original T5 paper 'Exploring the limits of transfer learning with a unified text-to-text transformer.' On page 11, it says "We pre-train each model for 2^19=524,288 <strong>steps</strong> on C4 before fine-tuning."</p>
<p>I am not sure what the '<strong>steps</strong>' mea... | https://stackoverflow.com/questions/75432369/in-the-original-t5-paper-what-does-step-mean |
Question: <p>I have trained a BERT model using pytorch for about a million text data for a classification task. After testing this model with new data I get False Positives and False Negatives. Now I want retrain the existing model only with FN and FP. I do not want to append the FN and FP to the exisiting dataset and ... | https://stackoverflow.com/questions/70080219/retrain-a-bert-model |
Question: <p>I am trying to train a BERT model based on an online tutorial (Coursera). The objective is to use the Quora insincere questions data to train a BERT model. The entire code is shown below:</p>
<pre><code># Function to fine-tune BERT for Text Classification
# bert_layer = hub.KerasLayer('https://tfhub.dev/te... | https://stackoverflow.com/questions/66844078/unable-to-fit-bert-model |
Question: <p>I am tokenizing the input words using bert model.
The code is :</p>
<pre><code>tokenizer = BertTokenizer.from_pretrained('bert-base-multilingual-cased',do_lower_case = False)
model = BertModel.from_pretrained("bert-base-multilingual-cased", add_pooling_layer=False, output_hidden_states=True, outp... | https://stackoverflow.com/questions/76238212/bert-model-splits-words-by-its-own |
Question: <p>I want to add a dense layer on top of the bare BERT Model transformer outputting raw hidden-states, and then fine tune the resulting model. Specifically, I am using <a href="https://huggingface.co/dbmdz/bert-base-italian-xxl-cased" rel="noreferrer">this</a> base model. This is what the model should do:</p>... | https://stackoverflow.com/questions/64156202/add-dense-layer-on-top-of-huggingface-bert-model |
Question: <p>I have bert model for named entity recognition.(config.json, model.bin, vocab.txt).
I can load model and get named entities from text with model in python</p>
<pre><code>input_text = "I live in London"
model_dir = "/content/gdrive/My Drive/models/v1"
print (get_predictions(input_text, model_dir) )
</cod... | https://stackoverflow.com/questions/61000862/load-bert-model-in-java |
Question: <p>Does Bert models need pre-processed text (Like removing special characters, stopwords, etc.) or I can directly pass my text as it is to Bert models. (HuggigFace libraries).</p>
<p><em>note</em>: Follow up question to: <a href="https://stackoverflow.com/questions/70067901/string-cleaning-preprocessing-for-b... | https://stackoverflow.com/questions/70649831/does-bert-model-need-text |
Question: <p>I am attempting to update the pre-trained BERT model using an in house corpus. I have looked at the Huggingface transformer docs and I am a little stuck as you will see below.My goal is to compute simple similarities between sentences using the cosine distance but I need to update the pre-trained model for... | https://stackoverflow.com/questions/58620282/updating-a-bert-model-through-huggingface-transformers |
Question: <p>I am using Huggingface to further train a BERT model. I saved the model using two methods: step (1) Saving the entire model using this code: <code>model.save_pretrained(save_location)</code>, and step (2) save the state_dict of the model using this code: <code>torch.save(model.state_dict(),'model.pth')</co... | https://stackoverflow.com/questions/66442648/loading-pretrained-bert-model-issue |
Question: <p>I am trying to save a fine tuned bert model. I have ran the code correctly - it works fine, and in the ipython console I am able to call getPrediction and have it result the result. </p>
<p>I have my weight files saved (highest being model.ckpt-333.data-00000-of-00001</p>
<p>I have no idea how I would go... | https://stackoverflow.com/questions/59340061/saving-a-fine-tuned-bert-model |
Question: <p>I am using <code>bert_model.save_pretrained</code> for saving the model at end as this is the command that helps in saving the model with all configurations and weights but this cannot be used in model.fit command as in callbacks saving model at each epoch does not save with save_pretrained. Can anybody he... | https://stackoverflow.com/questions/70922216/saving-bert-model-at-every-epoch-for-further-training |
Question: <p>I've been reading up on BERT and using BERT embeddings for a classification task. I've read many articles but my understanding of it still is not 100% (I have self-taught myself NLP, so my access to resources can be a bit restricted). First I'll describe my task.</p>
<p>I was planning on using BERT embeddi... | https://stackoverflow.com/questions/63476702/training-a-bert-model-and-using-the-bert-embeddings |
Question: <p>Hi I am looking to generate similar words for a word using BERT model, the same approach we use in gensim to generate most_similar word, I found the approach as:</p>
<pre><code>from transformers import BertTokenizer, BertModel
import torch
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
m... | https://stackoverflow.com/questions/69784408/compare-cosine-similarity-of-word-with-bert-model |
Question: <p>I have a doubt regarding the evaluation on the test set of my bert model. During the eval part param.requires_grad is suppose to be True or False? indipendently if I did a full fine tuning during training or not. My model is in model.eval() mode but I want to be sure to not force nothing wrong in the Model... | https://stackoverflow.com/questions/72687276/evaluate-bert-model-param-requires-grad |
Question: <p>I have a question about training BERT classification(or pretrained model).</p>
<p>BERT classifier model usually constructed 2 models. BERT model and classifier.</p>
<p>Many BERT fine tuning example code is training BERT model and classifier layer at once.
But I think, classifier is training first and BERT ... | https://stackoverflow.com/questions/68524992/bert-finetuning-is-it-right-to-train-bert-classification-model-at-once |
Question: <p>I am finetuning a BERT model for classification task,
Following code is used for the training the model.</p>
<pre><code>from transformers import Trainer, TrainingArguments, AutoConfig
from transformers import Trainer
batch_size = 8
logging_steps = len(emotions_encoded['train']) // batch_size
print(len(emo... | https://stackoverflow.com/questions/77875404/getting-permissionerror-while-saving-bert-model-checkpoint |
Question: <p>I have this code for semantic search engine built using the pre-trained bert model. I want to convert this model into tflite for deploying it to google mlkit. I want to know how to convert it. I want to know if its even possible to convert this into tflite. It might be because its mentioned on the official... | https://stackoverflow.com/questions/60967842/convert-a-bert-model-to-tflite |
Question: <p>Suppose you are pretraining a BERT model with 8 layers, 768-dim hidden states, 8 attention heads, and a sub-word vocabulary of size 40k. Also, your feed-forward hidden layer is of dimension 3072. What will be the number of parameters of the model? You can ignore the bias terms, and other parameters used co... | https://stackoverflow.com/questions/78997967/number-of-parameters-in-bert-model |
Question: <p>I`m beginner.. I'm working with Bert. However, due to the security of the company network, the following code does not receive the bert model directly.</p>
<pre><code>tokenizer = BertTokenizer.from_pretrained('bert-base-multilingual-cased', do_lower_case=False)
model = BertForSequenceClassification.from_p... | https://stackoverflow.com/questions/59701981/bert-tokenizer-model-download |
Question: <p>I am trying to use tensorflow serving to serve a keras bert model, but I have problem to predict with rest api, below are informations. Can you please help me to resolve this problem.</p>
<h1>predict output (ERROR)</h1>
<p>{
"error": "Op type not registered 'TFText>RoundRobinTrim' in bina... | https://stackoverflow.com/questions/79154761/tensorflow-serving-keras-bert-model-issue |
Question: <p>I'm quite new to NLP, and I want to calculate the similarity between a given word and each word in a given list.
I have the following code</p>
<pre><code># Load the BERT model
model_name = 'bert-base-uncased'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name... | https://stackoverflow.com/questions/75531115/bert-model-for-word-similarity |
Question: <p>After quantizing the BERT model, it works without any issue. But if I save the quantized model and load, it does not work. It shows an error message: 'LinearPackedParams' object has no attribute '_modules". I have used the same device to save and load the quantized model.</p>
<pre><code>model = Senten... | https://stackoverflow.com/questions/68226106/error-loading-quantized-bert-model-from-local-repository |
Question: <p>I'm aware that BERT has a capability in predicting a missing word within a sentence, which can be syntactically correct and semantically coherent. Below is a sample code:</p>
<pre><code>import torch
from pytorch_pretrained_bert import BertTokenizer, BertForMaskedLM
tokenizer = BertTokenizer.from_pretrain... | https://stackoverflow.com/questions/60486655/need-to-fine-tune-a-bert-model-to-predict-missing-words |
Question: <p>I finetuned two separate bert model (bert-base-uncased) on sentiment analysis and pos tagging tasks. Now, I want to feed the output of the pos tagger (batch, seqlength, hiddensize) as input to the sentiment model.The original bert-base-uncased model is in 'bertModel/' folder which contains 'model.bin' and ... | https://stackoverflow.com/questions/60297908/how-to-feed-the-output-of-a-finetuned-bert-model-as-inpunt-to-another-finetuned |
Question: <p>I'm trying to find information on how to train a BERT model, possibly from the <a href="https://huggingface.co/transformers/index.html" rel="noreferrer">Huggingface Transformers</a> library, so that the embedding it outputs are more closely related to the context o the text I'm using.</p>
<p>However, all t... | https://stackoverflow.com/questions/67136740/fine-tune-a-bert-model-for-context-specific-embeddigns |
Question: <p>I trained a Bert Model for NER. It worked fine (obviously it took time to learn). I saved the model with <code>pickle</code> as</p>
<pre><code>with open('model_pkl', 'wb') as file:
pickle.dump(model, file)
</code></pre>
<p>When I am trying to load this saved model I am getting following error. <code>A... | https://stackoverflow.com/questions/74689390/bert-model-not-loading-with-pickle |
Question: <p>I have built and trained the BERT model, using <a href="https://github.com/curiousily/Deep-Learning-For-Hackers/blob/master/18.intent-recognition-with-BERT.ipynb" rel="nofollow noreferrer">this code</a>.</p>
<p>Now I have this data:</p>
<p><a href="https://i.sstatic.net/z6ALu.png" rel="nofollow noreferrer"... | https://stackoverflow.com/questions/67356712/text-classification-using-bert-model |
Question: <p>I'm trying to build a bert model containing document as input. As bert's limitation is 512 tokens, it's unable to give accurate answer. Now, I'm trying to find NLP model/way/algorithm which should help bert model to find the correct answer.</p>
<p>I tried with document as input and was expecting accurate a... | https://stackoverflow.com/questions/76027510/qna-model-using-bert |
Question: <p>I want to train a BERT model to perform a multiclass text classification. I use transformers and followed this tutorial (<a href="https://towardsdatascience.com/multi-class-text-classification-with-deep-learning-using-bert-b59ca2f5c613" rel="nofollow noreferrer">https://towardsdatascience.com/multi-class-t... | https://stackoverflow.com/questions/64278341/bert-model-classification-with-many-classes |
Question: <p>I am working on a project that have to train a Bert model myself, and later adapts that into Pycharm for GUI and more logic. It's a binary classification model. I wrote the script, and successfully trained a Bert model in Google Colab. I did it by</p>
<pre><code>trainer.save_model(models)
</code></pre>
<p>... | https://stackoverflow.com/questions/76830364/loading-trained-bert-models-locally-in-pycharm |
Question: <p>I need to train model with input CSV, that has error message and error classification. Then when tested with just error message, it should automatically classify.</p>
<p>I've used BERT model and this is the code:</p>
<pre><code>import pandas as pd
import numpy as np
import tensorflow as tf
from transformer... | https://stackoverflow.com/questions/78936387/data-classification-doesnt-work-with-bert-model |
Question: <p>Question :
i try to use a bert model for an essay to code my sequence with a NPL models , but it takes a lot of time and befor terminate his 1 epoch he get out of connection problem , and when i increase the batch size to 16 or 32 i get memory problem , this is my code so if i have a problem please tell me... | https://stackoverflow.com/questions/78424613/google-colab-memory-problem-using-bert-model |
Question: <p>Hi I would like to print the model summary of my BERT model for text classification. I am using command print(summary(model, inputsize=(channels, height, width)). I would like to know what would be the dimensions of input_size in case of text classification?
I have use print(model) as well but the output i... | https://stackoverflow.com/questions/71248696/print-bert-model-summary-using-pytorch |
Question: <p>I am reading BERT model paper. In Masked Language Model task during pre-training BERT model, the paper said the model will choose 15% token ramdomly. In the chose token (Ti), 80% it will be replaced with [MASK] token, 10% Ti is unchanged and 10% Ti replaced with another word. I think the model just need to... | https://stackoverflow.com/questions/64013808/why-bert-model-have-to-keep-10-mask-token-unchanged |
Question: <p>I have fine tuned a BERT model on my data and saved the model using <code>model.save()</code></p>
<p>now am trying to load using the below</p>
<pre><code>from keras_radam import RAdam
from keras.models import load_model
from keras_bert import get_custom_objects
custom_object = get_custom_objects()
custo... | https://stackoverflow.com/questions/62448553/how-to-load-a-fine-tuned-bert-model |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.