docs stringclasses 4
values | category stringlengths 3 31 | thread stringlengths 7 255 | href stringlengths 42 278 | question stringlengths 0 30.3k | context stringlengths 0 24.9k | marked int64 0 1 |
|---|---|---|---|---|---|---|
huggingface | Beginners | Speechbrain for Spanish | https://discuss.huggingface.co/t/speechbrain-for-spanish/10046 | I could’n find any spanish model just like “asr-crdnn-commonvoice-fr” (speechbrain/asr-crdnn-commonvoice-fr · Hugging Face 1)
How can I improve/fine-tune speechbrain pre-trained model with additional language speeches in particular Spanish ??? | You can search for other ASR models in Models - Hugging Face, but as you mentioned there are no speechbrain models for Spanish at the moment.
For speechbrain specific questions, their Discourse might be a place where you get better answers. https://speechbrain.discourse.group/ 1 They also have a ASR from scratch colab ... | 0 |
huggingface | Beginners | Sentence similarity | https://discuss.huggingface.co/t/sentence-similarity/7496 | Hi all,
I have a question.
I have a dataset containing questions and answers from a specific domain. My goal is to find the find the X most similar questions to a query.
for example:
user: “What is python?”
dataset questions: [“What is python?”, “What does python means?”, “Is it python?”, “Is it a python snake?”, “Is i... | Hi,
I would suggest to try 3-4 models from the Sentence similarity task filter 6.
image1797×1193 426 KB
There is an easy way to do it: use accelerated inference for each model from Colab notebook. It may help you to see if some of them is really giving the high weight t the “What does python means?” question from you... | 0 |
huggingface | Beginners | ValueError: Expected input batch_size (16) to match target batch_size (64) | https://discuss.huggingface.co/t/valueerror-expected-input-batch-size-16-to-match-target-batch-size-64/1569 | I’ve modeled my training script on the information in the finetuning with custom datasets documentation (https://huggingface.co/transformers/custom_datasets.html 7).
I have both a custom dataset and a custom model (I used the run_language_modeling.py script to pretrain the roberta-base model with our raw texts).
when ... | Tried this using roberta-base as the model as well, and get the same error. | 0 |
huggingface | Beginners | What do we mean by POS or NEG in sentiment analysis? | https://discuss.huggingface.co/t/what-do-we-mean-by-pos-or-neg-in-sentiment-analysis/10001 | In Sentiment Analysis when we say that a statement is Positive or Negative, what do we mean by these.
For example, someone says “iPhone is good device”, so this is a positive sentence from the Apple Company view side, however that is a Negative one from Samsung Company side. | Where did you get the Samsung example from? By positive and negative we mean the sentiment that is attached to an utterance. Is it positive (good) or negative (bad). Both your examples, with Apple and Samsung, should be good. | 0 |
huggingface | Beginners | Additional random tqdm progress bars while Training | https://discuss.huggingface.co/t/additional-random-tqdm-progress-bars-while-training/10004 | Hi,
Suddently, I started getting additional progress bars while training. Here is the snapshot. I realized that I am getting train_batch_size (8 in this case) bars between every training step update progress bar. It only started from today. All these additional print statements are drastically slowing down the training... | Is this on TPU? | 0 |
huggingface | Beginners | How to compare two corpus? | https://discuss.huggingface.co/t/how-to-compare-two-corpus/9138 | Hi, I want to compare two corpora and extract the similar sentences present in both the corpus. what is the best way to do this? | For the same task I used sentence-similarity models, like this one
huggingface.co
Models - Hugging Face
The I would suggest that you try to use “Accelerated inference” as the easiest way to test if it helps you.
image1581×901 129 KB | 0 |
huggingface | Beginners | Different results from `model.generate` depending on batch size? | https://discuss.huggingface.co/t/different-results-from-model-generate-depending-on-batch-size/9992 | I seem to be getting very different results from model.generate for Question Generation with ProphetNet depending on how many questions I’m generating at once.
from transformers import ProphetNetTokenizer, ProphetNetForConditionalGeneration, ProphetNetConfig
model = ProphetNetForConditionalGeneration.from_pretrained('... | Found out about attention_mask, but passing it makes no difference
question_ids = model.generate(inputs['input_ids'], attention_mask=inputs['attention_mask'], num_beams=5, early_stopping=True) | 0 |
huggingface | Beginners | Missing vocab in gpt2 model? | https://discuss.huggingface.co/t/missing-vocab-in-gpt2-model/8491 | Hi there!
I’m new to this forum so I hope I’m posting this in the right place…
I am new to using gpt2/HuggingFace library but am trying to figure out how to use it for my purposes. I am currently trying to compare the probability of prediction tokens from GPT2 to actual tokens in an excerpt (Using a random book for now... | I’m a beginner as well but from what I have seen is that you would actually encode this word and then, as your tokenizer doesn’t have it, it would return you a list of tokens that corresponds to that word. then you would just do the average of the word tokens probabilities | 0 |
huggingface | Beginners | Is Eval and Validation same in Trainer API? | https://discuss.huggingface.co/t/is-eval-and-validation-same-in-trainer-api/9948 | Hi, I am a bit confused if the eval dataset parameter is used during the training.
#Trainer itself.
trainer = Trainer(
model,
args,
train_dataset=tokenized_datasets_train,
eval_dataset=tokenized_datasets_val,
tokenizer=tokenizer,
compute_metrics=compute_metrics,
data_collator = data_collator... | Yes, it’s the default dataset used for that method (which will be used if you pass an eval_strategy to evaluate every epoch or n steps). | 0 |
huggingface | Beginners | Is there a DataCollator for Question Answering? | https://discuss.huggingface.co/t/is-there-a-datacollator-for-question-answering/9915 | Hi there,
I can find several Data Collators, for example one for Masked Language modelling ( DataCollatorForLanguageModeling ). That way we have been able to pretrain our custom language model.
Now we would like to train on a Question Answering downstream task using the Squad v2 dataset. However, we can’t find a DataCo... | You should have a look at the official question answering examples 5. | 0 |
huggingface | Beginners | RuntimeError: CUDA out of memory. Tried to allocate 1.91 GiB (GPU 0; 15.78 GiB total capacity; 12.36 GiB already allocated; 302.75 MiB free; 14.16 GiB reserved in total by PyTorch) | https://discuss.huggingface.co/t/runtimeerror-cuda-out-of-memory-tried-to-allocate-1-91-gib-gpu-0-15-78-gib-total-capacity-12-36-gib-already-allocated-302-75-mib-free-14-16-gib-reserved-in-total-by-pytorch/9483 | Hi,
I am trying to train a language model from scratch, but when I try to train my model, I get this error:
RuntimeError: CUDA out of memory. Tried to allocate 1.91 GiB (GPU 0; 15.78 GiB total capacity; 12.36 GiB already allocated; 302.75 MiB free; 14.16 GiB reserved in total by PyTorch)
Can anyone help me?
I am so cl... | maybe you can try lower your per_gpu_batch_size in TrainingArguments. | 0 |
huggingface | Beginners | An efficient way of loading a model that was saved with torch.save | https://discuss.huggingface.co/t/an-efficient-way-of-loading-a-model-that-was-saved-with-torch-save/9814 | Hello, after fine-tuning a bert_model from huggingface’s transformers (specifically ‘bert-base-cased’). I can’t seem to load the model efficiently.
My model class is as following:
1. import torch
2. import torch.nn as nn
3. class Model(nn.Module):
4. def __init__(self, model_name='bert_model'):
5. super(Model, se... | Instead of
R00:
class Model(nn.Module):
you can do
class Model(PreTrainedModel):
This allows you to use the built-in save and load mechanisms. Instead of torch.save you can do model.save_pretrained("your-save-dir/) 1. After that you can load the model with Model.from_pretrained("your-save-dir/"). | 0 |
huggingface | Beginners | Training Model on CPU instead of GPU | https://discuss.huggingface.co/t/training-model-on-cpu-instead-of-gpu/9810 | I am using the transformer’s trainer API to train a BART model on server. The GPU space is enough, however, the training process only runs on CPU instead of GPU.
I tried to use cuda and jit from numba like this example to add function decorators, but it still doesn’t help.
What is the reason of it using CPU instead of... | The GPU will be automatically used by the Trainer, if that’s not the case, make sure you have properly installed your NVIDIA drivers and PyTorch.
Basically
import torch
torch.cuda.is_available()
should print True. | 0 |
huggingface | Beginners | Request to reset my API key | https://discuss.huggingface.co/t/request-to-reset-my-api-key/9781 | Hello, I leaked my API key in Github, and would like some help to reset it. I posted about this request around two weeks ago (My old post 2) but I haven’t gotten a reply on that yet. Apologies for posting about this topic twice, but I found it weird that the previous post hasn’t even gotten a view. Thanks in advance! @... | Hi @sakuttomon, sorry for missing your old request! I just renewed your API key, you can find the new one in your profile 2. | 0 |
huggingface | Beginners | Label smoothing and compute_metrics in Trainer | https://discuss.huggingface.co/t/label-smoothing-and-compute-metrics-in-trainer/9778 | I’m using RobertaForMaskedLM model with a Trainer and I’m passing a compute_metrics function.
Within the function I typically do something like this:
mask = p.label_ids != -100
labels = p.label_ids[mask]
predictions = np.argmax(p.predictions, axis=-1)[mask]
accuracy_metric.compute(predictions=predictions, references=la... | Ah yes, the labels should not necessarily be modified inplace, this looks like a bug.
This PR 4 should fix it. | 0 |
huggingface | Beginners | Wandb does not display train/eval loss except for last one | https://discuss.huggingface.co/t/wandb-does-not-display-train-eval-loss-except-for-last-one/9170 | Hello,
I am having difficulty getting my code to log metrics periodically to wandb, so I can check that I am checkpointing correctly. Specifically, although I am running my model for 10 epochs (with 2 examples per epoch for debugging) and am requesting logging every 2 steps, my wandb output displays only the very last ... | Does wandb work any better with logging_steps=1 ? Try adding training_args.report_to = "wandb" also, as it might be needed in future transformers releases.
Do the logs from huggingface that get printed in the console print as expected or they’re also truncated? | 0 |
huggingface | Beginners | Wav2Vec2: Inner workings of the Trainer class | https://discuss.huggingface.co/t/wav2vec2-inner-workings-of-the-trainer-class/9331 | Hi all, I am following this guide 2 in order to fine-tune the model for my dataset. Reading the documentation of Wav2Vec2ForCTC, it says that the argument attention_mask must only be passed when the model’s processor has config.return_attention_mask == True. The processor that is created in the blog post, has indeed it... | The Trainer takes the datasets after preprocessing has been applied, so setting this has nothing to do with the Trainer class. | 0 |
huggingface | Beginners | Help with fine-tune BART for text infilling | https://discuss.huggingface.co/t/help-with-fine-tune-bart-for-text-infilling/9738 | Hi guys,
I am trying to fine-tune BART for text infilling task, for example, I want my model learn “Steve Jobs is founder of Apple” from “Steve Jobs [MASK] Apple”.
My questions are mainly the following three:
(1) BartModel and BartForConditionalGeneration, which one should I choose?
(2) Can you provide examples of how... | You should use BartForConditionalGeneration, since this model adds a language modeling head on top of BartModel. BartModel itself is just the encoder-decoder Transformer, without any head on top. The language modeling head on top is necessary, in order to decode the hidden states to actual predicted tokens, and to gene... | 0 |
huggingface | Beginners | Request: reset api key | https://discuss.huggingface.co/t/request-reset-api-key/9730 | Hi, I have leaked my API key in Github. May I get some help resetting it? I have read a few forum posts regarding this.Thanks in advance. @julien-c @pierric | Hi @limivan,
I changed your API key, you can find the new one in your profile 1.
Cheers,
Pierric | 0 |
huggingface | Beginners | Bigbird pretraining | https://discuss.huggingface.co/t/bigbird-pretraining/5344 | Hi,
I am curious about the new Bigbird model, and I’m trying to pretrain one for my language+domain. Running my usual pretraining script (see below) however gives me the following message, and as a result of not being able to use block sparse attention my GPU (Tesla V100) obviously runs out of memory in no time.
Attent... | I have encountered the same problem. Do you have a solution now? | 0 |
huggingface | Beginners | Type of model for PubMed article processing | https://discuss.huggingface.co/t/type-of-model-for-pubmed-article-processing/9734 | Hi everyone. I am new to NLP systems, but not to machine learning. HuggingFace seemed like a great place to start as I attempt this latest project of mine. For graduate school, I am working on building a system that can take a PubMed article as the input and output all the research questions they asked and the steps th... | For example:
Mignone, John L., et al. “Neural Stem and Progenitor Cells in Nestin‐Gfp Transgenic Mice.” Wiley Online Library, John Wiley & Sons, Ltd, 12 Jan. 2004, onlinelibrary.wiley.com/doi/10.1002/cne.10964.
"Neural stem cells generate a wide spectrum of cell types in developing and adult nervous systems. These cell... | 0 |
huggingface | Beginners | ONNX exported model outputs different value per inference call for the same input | https://discuss.huggingface.co/t/onnx-exported-model-outputs-different-value-per-inference-call-for-the-same-input/9627 | I used BertModel in my pytorch model, and appended a few layers for classification purpose.
I exported the pytorch model into ONNX model, it works but then the output value for the same model input produces different output value every time. It feels like that the model is in training mode but it is not. I exported the... | Updated reproducible Colab
colab.research.google.com
Google Colaboratory 1 | 0 |
huggingface | Beginners | Why BigBirdTokenizer can’t load my own vocab or trained BPE results? | https://discuss.huggingface.co/t/why-bigbirdtokenizer-can-t-load-my-own-vocab-or-trained-bpe-results/9700 | BigBirdTokenizer can’t load vacob results. But BERT and RoBERTa can.
tokenizer = RobertaTokenizer.from_pretrained('my_bpe', max_len=512) # right
tokenizer = BertTokenizer.from_pretrained('./data/my_vocab.txt') # right
tokenizer = BigBirdTokenizer.from_pretrained('my_bpe') # not right
175
176 def Load... | Hi , may I know in which format is the token given ? | 0 |
huggingface | Beginners | My input sentence is very long(more than 512). What should I do when I want to fintune model about classify?Thanks | https://discuss.huggingface.co/t/my-input-sentence-is-very-long-more-than-512-what-should-i-do-when-i-want-to-fintune-model-about-classify-thanks/9688 | I know I can intercept the first 512 lengths.But I don’t want to do this. This task can understand the classification of texts.
AutoModelForSequenceClassification can be directly used for classification, but the question is whether the input can be some 512 length sentences, and use pooler layer to classify ?
Or what ... | Hey @ccfeidao you might want to try one of the dedicated models like LongFormer or BigBird which have a longer context size of around 4,096 tokens. See this thread 13 for more details | 0 |
huggingface | Beginners | Longformer and sentiment analysis | https://discuss.huggingface.co/t/longformer-and-sentiment-analysis/9416 | I am trying to use longformer to do a sentiment analysis and I am wondering what the best way is to do it. I have the following code:
from transformers import LongformerTokenizer, EncoderDecoderModel
model = EncoderDecoderModel.from_pretrained(“patrickvonplaten/longformer2roberta-cnn_dailymail-fp16”)
tokenizer = Longf... | Hi,
LongFormer itself is a Transformer encoder, and that’s more than sufficient to perform sentiment analysis. You can just use LongFormerForSequenceClassification, like so:
from transformers import LongformerTokenizer, LongformerForSequenceClassification
import torch
tokenizer = LongformerTokenizer.from_pretrained('a... | 0 |
huggingface | Beginners | How to calculate the effective batch size on TPU? | https://discuss.huggingface.co/t/how-to-calculate-the-effective-batch-size-on-tpu/9656 | When training on single GPU the effective batch size is the batch size multiplied by gradient accumulation steps.
When multiple GPUs are used the we have to multiply the number of GPUs, batch size and gradient accumulation steps to get the effective batch size.
Is it the same for TPU? When I use 8 TPU cores instead of ... | Using 8 TPU cores work exactly the same as using 8 GPUs, so the effective batch size is 256. | 1 |
huggingface | Beginners | Reuse context for BERT | https://discuss.huggingface.co/t/reuse-context-for-bert/8956 | Reuse the same context in BERT Question and Answering 1
I want to reuse the same context for different questions, and tokenizing the context every time for a new question seems less efficient. How can I improve it (like reusing tokenized context)? | I’m trying to find a way to reuse a context too.
I have a large context and I don’t want to tokenize it for every question.
Did you find a way to do that? | 0 |
huggingface | Beginners | Model never predicts minority class in a binary sequence classification | https://discuss.huggingface.co/t/model-never-predicts-minority-class-in-a-binary-sequence-classification/9637 | I am new to huggingface. With the help of trainer API, I trained and evaluated a model. But whenever I use it for prediction, model predicts just one class always. It would be helpful if anyone can help me identify the bug.
my data is such that there are two text inputs.
Here is my code -
import torch
import collecti... | What you typically do with an imbalanced set in a classification problem is using class weights in your loss function. See the documentation of CrossEntropyLoss 1 and its weight parameter. However, I do not think that the Trainer currently allows custom loss functions out-of-the-box. Instead you can subclass the Traine... | 0 |
huggingface | Beginners | Reduce the number of features of BERT embeddings | https://discuss.huggingface.co/t/reduce-the-number-of-features-of-bert-embeddings/3424 | Hi everyone,
I am using a XXL BERT for my project.
I would like to test the network using an embedding dimension lesser than 768, for example, 300.
I think I could try to perform a PCA on the embeddings.
Is there an implemented solution which does this?
Many thanks in advance | Hi, actually you could use a Dense layer (from sentence-tranformers here 111 ) and go from 768 to 300 with a bit of finetuning.
If you still want to use PCA, huggingface (for what I know) doesn’t have it’s own implementation so I advice you to pick the best python library you know and use that implemlementation.
For ex... | 0 |
huggingface | Beginners | Anyone have advice on best methods to cluster BERT-embedded documents? | https://discuss.huggingface.co/t/anyone-have-advice-on-best-methods-to-cluster-bert-embedded-documents/801 | I am interested in using the feature extractor to get BERT embeddings for a corpus of documents. I am interested in clustering these documents (open to different algorithms/similarity metrics) at this point. However, I am assuming that dimensionality of the embeddings might be a problem. Has anyone done clustering on e... | Hello @afractalthought,
You can try Sentence transformer which is much better for clustering from feature extraction than vanilla BERT or RoBERTa. When applying cosine similarity on the sentence embedding from this model, documents with semantic similarity should get a higher similarity score and clustering should get... | 0 |
huggingface | Beginners | Returning logits from Trainer.predict() | https://discuss.huggingface.co/t/returning-logits-from-trainer-predict/9314 | Hello!
I would like to perform some operations on the output probability distributions of an AutoModelForSequenceClassification model so, I was wondering if it is possible to return the logits rather than predicted class labels from the transformers.Trainer.predict() method. | The predict method does return the logits, as well as the labels. | 0 |
huggingface | Beginners | Sentence Transformers paraphrase-MiniLM fine-tuning error | https://discuss.huggingface.co/t/sentence-transformers-paraphrase-minilm-fine-tuning-error/9612 | Hi @nreimers,
Really love your sentence transformers. I’m currently using them as base models to fine-tune them on a 3-class classification task using the standard hf trainer.
This works very well with paraphrase-distilroberta-base-v2, but when I use variants of MiniLM-L6-v2 (I tried paraphrase-MiniLM-L6-v2 and flax-se... | Hi @MoritzLaurer
Happy to hear that.
I think the issue can be that the max length is not defined for these models. Then, the text is not truncated to 512 word pieces.
Is it possible to set in the trainer the max_length for the input text?
Currently adding these models to the performance metrics. Yes, the flax-sentence-... | 0 |
huggingface | Beginners | How is compute_metrics working internally? | https://discuss.huggingface.co/t/how-is-compute-metrics-working-internally/9269 | Hi everyone, I am following this blog post Fine-Tune XLSR-Wav2Vec2 for low-resource ASR with 🤗 Transformers 1 on fine-tuning an ASR model, and there is something I don’t understand about the compute_metrics function.
In the notebook, we want to compute the Word Error Rate for the validation set, every eval_steps steps... | The compute_metrics function takes the predictions and labels over the whole evaluation dataset and computes the metrics from them. | 0 |
huggingface | Beginners | What model checkpoint do I use if I trained a Word Piece tokenizer? | https://discuss.huggingface.co/t/what-model-checkpoint-do-i-use-if-i-trained-a-word-piece-tokenizer/9256 | Hi,
I have just trained my own tokenizer from scratch, which is a Word Piece model like BERT, and I have saved it.
From there, I am now wanting to train my own language model from scratch using the tokenizer I trained beforehand.
However, referring to the code below, what do I change my model_checkpoint to?
model_check... | You should change it to "bert-base-cased" for instance. | 0 |
huggingface | Beginners | Transformers: WordLevel tokenizer produces strange vocabulary | https://discuss.huggingface.co/t/transformers-wordlevel-tokenizer-produces-strange-vocabulary/9470 | Training the WordLevel tokenizer I receive strange vocabulary. Bellow is my code:
data = [
"Beautiful is better than ugly."
"Explicit is better than implicit."
"Simple is better than complex."
"Complex is better than complicated."
"Flat is better than nested."
"Sparse is better than dense."
... | Your data should be a list of lists. | 0 |
huggingface | Beginners | Questions about default checkpointing behavior (train v. val) | https://discuss.huggingface.co/t/questions-about-default-checkpointing-behavior-train-v-val/9106 | Hello,
I had a few questions about how Huggingface checkpoint behavior changes depending on the arguments to the Trainer.
In the documentation, I noticed that by default:
because evaluation_strategy is ‘no’, evaluation is never run during training. Reference was here: Trainer — transformers 4.7.0 documentation 1
beca... | Hi there, here are the answers:
No, by default the model checkpointing only saves model to resume training later if something goes wrong, but there is no best model loading logic unless you use load_best_model_at_end. You will then need to set an eval_strategy and a save_strategy that match (either epoch or steps)
... | 0 |
huggingface | Beginners | How can I trace trainer.state.log_history in Multi-GPU environment? | https://discuss.huggingface.co/t/how-can-i-trace-trainer-state-log-history-in-multi-gpu-environment/9345 | Hello.
I am trying to train RoBERTa model from scratch.
I successfully train model with Trainer.
But, When I check the trainer.state.log_history, there was nothing.
This situation occurred only on Multi-GPU training.
When I use Single-GPU, log_history was exist.
How can I get log_history in Multi-GPU training? | I found the answer by myself.
In TrainingArguments, just set log_on_each_node=True. | 0 |
huggingface | Beginners | How can I check mlm accuracy during training RoBERTa? | https://discuss.huggingface.co/t/how-can-i-check-mlm-accuracy-during-training-roberta/3164 | Hello.
I try to train RoBERTa from scratch. There are the code and printed log below. From the code, I can check the mlm loss, but I couldn’t find options for mlm accuracy. Is there anything I can do for check mlm acc?
from transformers import RobertaConfig
config = RobertaConfig(
num_hidden_layers=4,
hidde... | You have to add two things to check your accuracy. First you should define an evaluation strategy, to regularly evaluate your model on the validation set (in TrainingArguments, add evaluation_strategy="steps" to evaluate every eval_steps steps or evaluation_strategy="epoch" to evaluate every epoch).
Then you need to ad... | 0 |
huggingface | Beginners | Any tutorials for distilling (e.g. GPT2)? | https://discuss.huggingface.co/t/any-tutorials-for-distilling-e-g-gpt2/8599 | I’m trying to read up on knowledge distillation and as an exercise, I’d like to fine-tune a GPT2-medium model on a specific generation task and then distill it down to a small GPT2 model. Could someone point me towards a colab or tutorial that I could use to learn hands-on how to do this? Thanks | @ComfortEagle did you ever find a good tutorial? | 0 |
huggingface | Beginners | K fold cross validation | https://discuss.huggingface.co/t/k-fold-cross-validation/5765 | Hi,
I use Trainer() to fine-tune bert-base-cased model on NER task.I split my dataset with sklearn.model_selection.train_test_split .
Now, I want to use k fold cross validation to split dataset and fine-tune the model.
Does anyone try the same way? plz tell me if you have any ideas. | one suggestion would be to use the split functionality of datasets to create your folds as described here: Splits and slicing — datasets 1.6.0 documentation 324
then you could use a loop to fine-tune on each fold with the trainer and aggregate the predictions per fold | 0 |
huggingface | Beginners | How can I load models from any remote url | https://discuss.huggingface.co/t/how-can-i-load-models-from-any-remote-url/9452 | Hi,
I want to set up a http file server (simples case would be http localhost) that will contain my models or simply fork a github repository with pretrained models. I see that when loading a pretrained model a transformers or sentence-transformers libraries try to get files from huggingface.co by default. Is there a w... | you can try to paas your http server as param like this:
proxies = {"http": "http://localhost:8000"}
mode = AutoModelForSequenceClassification.from_pretrained(proxies) | 0 |
huggingface | Beginners | Fine-Tuning BERT Question Answering sequence output problem | https://discuss.huggingface.co/t/fine-tuning-bert-question-answering-sequence-output-problem/7878 | While following instructions on Fine-tuning with custom datasets — transformers 4.7.0 documentation 3 using TensorFlow Keras, model fit produces below problem and fail to start training
from transformers import TFAutoModelForQuestionAnswering
model = TFAutoModelForQuestionAnswering.from_pretrained("bert-base-multiling... | The error here was because they asked to use return_dict = False but in TF during model compilation, we have to set run_eagerly=True in order to actually make sense of the return_dict parameter.
According to documentation:
return_dict (bool, optional) – Whether or not to return a ModelOutput instead of a plain tuple. T... | 0 |
huggingface | Beginners | Overwrite attention heads in BartForConditionalGeneration | https://discuss.huggingface.co/t/overwrite-attention-heads-in-bartforconditionalgeneration/7059 | Hi,
I am looking to overwrite the attention heads in the Bart model, following the below process:
Run the model on an article with the keyword parameter: “Covid”
Save the encoder/decoder heads for this article
Run the model on another article, also with the keyword parameter: “Covid”
As a proxy for making this model ‘... | I’m curious to know how this is possible, also. I’ve found no methods in transformers to allow this. | 0 |
huggingface | Beginners | Train loss is decreasing, but accuracy remain the same | https://discuss.huggingface.co/t/train-loss-is-decreasing-but-accuracy-remain-the-same/3244 | this is the train and development cell for multi-label classification task using Roberta (BERT). the first part is training and second part is development (validation). train_dataloader is my train dataset and dev_dataloader is development dataset. my question is: why train loss is decreasing step by step, but accuracy... | This means you are overfitting (training loss diminished but no improvement in validation loss/accuracy) so you should try using any technique that helps reduce overfitting: weight decay, more dropout, data augmentation (if applicable)… | 0 |
huggingface | Beginners | [HELP] RuntimeError: CUDA error: device-side assert triggered | https://discuss.huggingface.co/t/help-runtimeerror-cuda-error-device-side-assert-triggered/9418 | Hello,
I am following this tutorial on how to train my language model from scratch: notebooks/language_modeling_from_scratch.ipynb at master · huggingface/notebooks · GitHub 3
However, when I pass everything to my trainer:
from transformers import DataCollatorForLanguageModeling
data_collator = DataCollatorForLanguageM... | My advice is always: if you have a CUDA error, run your code on CPU and check if you’re getting a more helpful error message. | 0 |
huggingface | Beginners | Fine-tune mt5 on Question Answering with run_qa | https://discuss.huggingface.co/t/fine-tune-mt5-on-question-answering-with-run-qa/3818 | Hello everyone, I wanted to fine tune a mt5 model on QA with run_qa.py but it doesn’t work.
I’m a beginner so I have no idea what to do to solve the problem. Does anyone know how to make it work? | Are you sure MT5 can do Question Answering? Would BERT be better?
I can’t help, but I suggest you give a few more details: what happens when it “doesn’t work”? | 0 |
huggingface | Beginners | Reduce number of cores | https://discuss.huggingface.co/t/reduce-number-of-cores/9449 | Hello,
when I fine-tune my BERT model on our company’s server I nearly take on all our capacity. Is there any way to reduce the number of used cores? | what does the number of used cores mean?
what dl library you use? pytorch or tensorflow
i assume you fine-tune with pytorch, and the cores means gpu device.
generally, there are two ways to limit the gpu usage:
set visible device environment variable
# n means your gpu device id
export CUDA_VISIBLE_DEVICES=0,1,2,..n... | 0 |
huggingface | Beginners | Transformers with additional external data | https://discuss.huggingface.co/t/transformers-with-additional-external-data/8041 | Hello.
Working with pretrained BERT model for regression task. I have idea that dataset has usefull not text feature, which can help to improve result. Is it possible to modify my model so that the text field is processed by bert taking into account this useful feature?
class MyModel(torch.nn.Module):
def __init__(... | Hi,
Did you finalize combining context vector + manual features? | 0 |
huggingface | Beginners | [HELP] RuntimeError: CUDA error - when training my model? | https://discuss.huggingface.co/t/help-runtimeerror-cuda-error-when-training-my-model/9231 | Hello everyone,
I am encountering an error when training my language model from scratch, having trained a tokenizer beforehand.
I have just trained my tokenizer from scratch on a WordPiece model like BERT, following this notebook: notebooks/tokenizer_training.ipynb at master · huggingface/notebooks · GitHub
I then save... | Hi @anon58275033
I think that could indeed be the issue. Since the tokenizer has a different vocabulary size this is likely incompatible with the config you are loading which contains the vocab size of the original model. You can fix it with:
config = AutoConfig.from_pretrained(model_checkpoint, vocab_size=len(tokenize... | 0 |
huggingface | Beginners | Multi-class Classification Basics | https://discuss.huggingface.co/t/multi-class-classification-basics/9411 | Hello,
I got a really basic question on the whole BERT/finetune BERT for classification topic:
I got a dataset with customer reviews which consists of 7 different labels such as “Customer Service”, “Tariff”, “Provider related” etc. .
My dataset contains 12700 not labelled customer reviews and I labelled 1100 reviews fo... | marlon89:
Could it be enough to take an existing BERT model and fine-tune it with AutoModelForSequenceClassification on my specific task?
Yes. You can use “bert-base-uncased” for example.
marlon89:
Are the 1100 labelled reviews (around 150 per each class) enough to train that?
Yes, that’s the power of trans... | 0 |
huggingface | Beginners | Most efficient multi-label classifier? | https://discuss.huggingface.co/t/most-efficient-multi-label-classifier/9296 | Background
I’m trying to train a model in Tensorflow to classify text according to a fixed set of 5 labels. For example, let’s say I feed my model the following text:
“my advice is that you go ahead with your plans to learn Python, because its syntax is easy for beginners. It’s also great for snake lovers like me!”
A... | I am facing the same problem and as none replied yet I wanted to ask if you got any updates/new thoughts on this? Cheers | 0 |
huggingface | Beginners | Multi-Label Product (Query) Classification | https://discuss.huggingface.co/t/multi-label-product-query-classification/6283 | Hi all,
I am looking for a transformers model for MULTI-LABEL query (product) classification that is pre-trained on product title or query data. Basically, the user will search for a product (query), we have to classify it into a set of classes/categories. Please let me know if you know of any such model. I would real... | You got an answer to this? I am facing the same problem right now | 0 |
huggingface | Beginners | The datasets.map function does not load cached dataset | https://discuss.huggingface.co/t/the-datasets-map-function-does-not-load-cached-dataset/8905 | I am using the run_mlm.py provided in the transformers repository to pretrain bert. The dataset is of version 1.8.0. Since the used dataset Wikipedia is large, I hope the processing is one time and can be reused later. However, I find it always re-computing instead of load from the disk. I don’t think I changed any par... | Hi ! new_fingerprint is computed automatically by taking into account:
the previous dataset fingerprint
a hash of your map function
a hash of the parameters passed to map
So as long as you don’t change your code and you keep the same parameters, the fingerprint will stay the same and the dataset will be reloaded from... | 0 |
huggingface | Beginners | Batch sizes / 2 GPUs + Windows 10 = 1 GPU? | https://discuss.huggingface.co/t/batch-sizes-2-gpus-windows-10-1-gpu/9349 | Hope you can help. Basically I just need some guidance/reassurance around how batch sizes are calculated when 2 GPUs are installed but I think (!) on Windows only 1 GPU can be/is being used.
Scenario:
Remoting into PC with 2 NVIDIA GPUs running Windows 10
(someone else’s machine so no option of installing Linux)
... | I saw this post involving @BramVanroy about setting CUDA_VISIBLE_DEVICES=0 to use just one of the 2 GPUs installed (I assume named 0 and 1). But is there any way to verify that only 1 GPU is being used when running the script? And I suppose even if so, doesn’t necessarily clarify how per_device_train_batch_size = 4 is ... | 0 |
huggingface | Beginners | T5 for conditional generation: getting started | https://discuss.huggingface.co/t/t5-for-conditional-generation-getting-started/1284 | Hi, I have as specific task for which I’d like to use T5.
Inputs look like
some words <SPECIAL_TOKEN1> some other words <SPECIAL_TOKEN2>
Training Outputs are a certain combination of the (some words) and (some other words). The goal is to have T5 learn the composition function that takes the inputs to the outputs, wher... | You can choose whatever format that works well for you, only thing to note is your dataset or collatorshould return input_ids, attention_mask and labels.
To add new tokens
tokenizer.add_tokens(list_of_new_tokens)
# resize the embeddings
model.resize_token_embeddings(len(tokenizer))
Using task prefix is optional... | 0 |
huggingface | Beginners | Predicting with Token Classifier on data with no gold labels | https://discuss.huggingface.co/t/predicting-with-token-classifier-on-data-with-no-gold-labels/9373 | Hello everyone,
I am implementing a token classification model, following the example in the github repo (transformers/run_ner.py at master · huggingface/transformers · GitHub 1). I have adapted it for my particular task, and I can train and test a model on data for which I have gold labels. Now I want to use the same ... | Hi,
If you’re using a fast tokenizer (such as BertTokenizerFast), you can add use the offsets to know if a token is a special token/the first wordpiece of a word or not. Small example:
from transformers import BertTokenizerFast
tokenizer = BertTokenizerFast.from_pretrained("bert-base-uncased")
text = "hello my name is... | 0 |
huggingface | Beginners | How to fine tune LUKE for NER? | https://discuss.huggingface.co/t/how-to-fine-tune-luke-for-ner/6122 | Hello. I am wondering if I can fine-tune LUKE with my own dataset of NER. I am aware that LUKE has a unique model so the code in the example notebook is off the table. I am aware that Studio Ousia has fine-tuning code with GitHub - studio-ousia/luke: LUKE -- Language Understanding with Knowledge-based Embeddings 18, bu... | Hi Kerenza
Were you able to make any progress on fine-tuning LukeForEntitySpanClassification for custom labels? Actually, I am also looking to fine-tune Luke for a NER task with multi-token entities. Any help is much appreciated.
Thanks | 0 |
huggingface | Beginners | How can I sample with BART for conditional generation? | https://discuss.huggingface.co/t/how-can-i-sample-with-bart-for-conditional-generation/8939 | Hi there,
I’m currently working with BART for conditional generation and would like to generate some good old-fashioned sampled outputs (i.e. nothing fancy and no beam search) for experimentation.
According to the very nice blog post 4 by @patrickvonplaten, this should be possible by providing do_sample=True and top_k=... | Answering my own question here in case anyone ever runs into the same issue.
The argument num_beams used by .generate() defaults to the value specified in the model’s config file (e.g. config.json). If this value is > 1, decoding will be performed with beam search (either regular or sampled).
So, the simple fix is to e... | 0 |
huggingface | Beginners | Cannot encode/tokenize my Dataset Dictionary | https://discuss.huggingface.co/t/cannot-encode-tokenize-my-dataset-dictionary/9327 | Hello everyone,
I am trying to finetune my Sentiment Analysis Model. Therefore, I have splitted my pandas Dataframe (column with reviews, column with sentiment scores) into a train and test Dataframe and transformed everything into a Dataset Dictionary:
#Creating Dataset Objects
dataset_train = datasets.Dataset.from_pa... | Found the error on my own as I had to specify the column which had to be tokenized. The correct Tokenizer function would be:
def tokenize(batch):
return tokenizer(batch["text"], padding=True, truncation=True)
instead of
def tokenize(batch):
return tokenizer(batch, padding=True, truncation=True) | 0 |
huggingface | Beginners | From Pandas Dataframe to Huggingface Dataset | https://discuss.huggingface.co/t/from-pandas-dataframe-to-huggingface-dataset/9322 | Hello everyone,
I am doing a tutorial on how to finetune pretrained Sentiment Analysis Classifier and all the finetuning part is based on a HuggingFace Dataset. Is there a way to transform a pandas Dataframe to a HuggingFace Dataset? Would help me alot with my data preprocessing… | You can have a look at here: link 176 | 0 |
huggingface | Beginners | Saved models do not work after being loaded | https://discuss.huggingface.co/t/saved-models-do-not-work-after-being-loaded/9282 | Hi. I fine-tuned 4 Wav2Vec2 models with different settins, following by letter this guide 2. After I finished training, I saved the models using model_name.save_pretrained(PATH). After saving, I immediately loaded the model to see if it works properly, and it worked.
Today, I wanted to check something and I loaded one ... | I think I’ve figured it out. I will post it here, so that if someone else comes here with the same issue, they can perhaps be assisted by my answer.
It turns out that it was my mistake, as even though I was loading an old model, I was using a new processor (tokenizer/feature extractor). Now, the problem here is that wh... | 0 |
huggingface | Beginners | How to get [CLS] embeddings from BertForTokenClassification model | https://discuss.huggingface.co/t/how-to-get-cls-embeddings-from-bertfortokenclassification-model/9276 | Sorry for the issue, I don’t really write any code but only use the example code as a tool.
I trained with my own NER dataset with the transformers example code.
I want to get sentence embedding from the model I trained with the token classification example code here (this is the older version of example code by the wa... | Hi @slecraphi
Just to elaborate on @ehalit’s correct approach here your example adapted for token classification:
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertForTokenClassification.from_pretrained('bert-base-uncased')
inputs = tokenizer("Hello, my dog is cute", return_tensors='pt')
output... | 1 |
huggingface | Beginners | RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking arugment for argument index in method wrapper_index_select) | https://discuss.huggingface.co/t/runtimeerror-expected-all-tensors-to-be-on-the-same-device-but-found-at-least-two-devices-cpu-and-cuda-0-when-checking-arugment-for-argument-index-in-method-wrapper-index-select/9255 | I am working in a Google Coalab session with a HuggingFace DistilBERT model which I have fine tuned against some data.
I am getting the following error when I try to evaluate a restored copy of my model:-
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when ... | I think after you load the model, it is no longer on GPU, try
model = AutoModelForSequenceClassification.from_pretrained(output_dir).to(device) | 0 |
huggingface | Beginners | KeyError: “Invalid key: slice(0, 1000, None). Please first select a split | https://discuss.huggingface.co/t/keyerror-invalid-key-slice-0-1000-none-please-first-select-a-split/9089 | Hi,
I am trying to train a tokenizer and execute the following line of code:
new_tokenizer = tokenizer.train_new_from_iterator(batch_iterator(), vocab_size=25000)
Though, when I execute it, I get this error:
KeyError: "Invalid key: slice(0, 1000, None). Please first select a split. For example: `my_dataset_dictionary[... | Hi ! Your batch_iterator must be iterating on a Dataset object, however it looks like you try to iterate over a DatasetDict (it maps split names to Dataset objects).
To fix your code, you just have to replace dataset by dataset["train"] in your definition of batch_iterator.
Let me know if that works or if if you have o... | 0 |
huggingface | Beginners | What is the best way to fine-tune ViT with a custom dataset? | https://discuss.huggingface.co/t/what-is-the-best-way-to-fine-tune-vit-with-a-custom-dataset/9233 | I have checked out the course and I have come across tutorials for fine-tuning pre-trained models for NLP tasks.
But I would really like to use the Vision Transformer 1 model for classifying images that I have. I have about 1.8k images belonging to 3 categories, and I would like to use ViT for classification. I want to... | Hi there! I made some demos on how to fine-tune ViT on a custom dataset here:
github.com
Transformers-Tutorials/VisionTransformer at master ·... 10
master/VisionTransformer
This repository contains demos I made with the Transformers library by HuggingFace. - Transformers-Tutorials/Vis... | 0 |
huggingface | Beginners | Is there a way to correctly load a pre-trained transformers model without the configuration file? | https://discuss.huggingface.co/t/is-there-a-way-to-correctly-load-a-pre-trained-transformers-model-without-the-configuration-file/9184 | I would like to fine-tune a pre-trained transformers model on Question Answering. The model was pre-trained on large engineering & science related corpora.
I have been provided a “checkpoint.pt” file containing the weights of the model. They have also provided me with a “bert_config.json” file but I am not sure if this... | This is telling you that the checkpoint that they gave you also includes the state of other things. So they also saved the state of the optimizer and not just the state of the model. It seems that you need to only load the “model” key. Maybe there is a better way than this, but I think you can do:
MODEL_PATH = "./chec... | 0 |
huggingface | Beginners | How to save my tokenizer using save_pretrained? | https://discuss.huggingface.co/t/how-to-save-my-tokenizer-using-save-pretrained/9189 | I have just followed this tutorial on how to train my own tokenizer.
Now, from training my tokenizer, I have wrapped it inside a Transformers object, so that I can use it with the transformers library:
from transformers import BertTokenizerFast
new_tokenizer = BertTokenizerFast(tokenizer_object=tokenizer)
Then, I try... | You are saving the wrong tokenizer ;-). new_tokenizer.save_pretrained(xxx) should work. | 0 |
huggingface | Beginners | What is the purpose of save_pretrained()? | https://discuss.huggingface.co/t/what-is-the-purpose-of-save-pretrained/9167 | Hello everyone. I hope my question is not too silly, but there is something that confuses me.
Let’s say I load a huggingface model using from_pretrained() method, and then finetune it using the Trainer class. Now, via TrainingArguments, I get the chance to define an argument called output_dir. If I specify a directory ... | Hi there! The question is a bit weird in the sense you are asking: “Why does the model have this method when the Trainer has that model?”. The base answer is: " because they are two different objects."
Not everyone uses the Trainer to train their model, so there needs to be a method directly on the model to properly sa... | 0 |
huggingface | Beginners | Unable to use custom dataset when training a tokenizer | https://discuss.huggingface.co/t/unable-to-use-custom-dataset-when-training-a-tokenizer/9120 | Hello,
I am following this tutorial here: notebooks/tokenizer_training.ipynb at master · huggingface/notebooks · GitHub 1
So, using this code, I add my custom dataset:
from datasets import load_dataset
dataset = load_dataset('csv', data_files=['/content/drive/MyDrive/mydata.csv'])
Then, I use this code to take a look ... | When asking for help on the forum, please paste all relevant code. In this case, you did not past the definition of batch_iterator.
If you are following the notebook, you did not load one dataset, but several (with a split for train/validation/test) which is why you get this error. You should add the split="train" argu... | 0 |
huggingface | Beginners | Object has no attribute ‘parameters’ | https://discuss.huggingface.co/t/object-has-no-attribute-parameters/9144 | I am running the following code:-
from tqdm.auto import tqdm
progress_bar = tqdm(range(num_training_steps))
model.train()
for epoch in range(num_epochs):
for batch in train_dataloader:
batch = {k: v.to(device) for k, v in batch.items()}
outputs = model(**batch)
loss = outputs.loss
... | I’m confused as the stack trace you are copying is not with the error you mention. The stack trace has a problem of indexing in the dataframe you apparently used for the labels, and as the final error says, it can’t find the label at index 1002. | 0 |
huggingface | Beginners | Padding causes wrong predictions? | https://discuss.huggingface.co/t/padding-causes-wrong-predictions/9152 | Hello guys,
I am trying out multiclass text classification using DistilBERT. It is a dataset with user feedback on a product and there are 4 categories.
0 - Good - “easy to use”
1 - Bad - “slow and constant crashing”
2 - Questions - “can you add feature x and y?”
3 - Others - “NIL”
I am following the guide here 1, I pa... | Please have a look at the course, in particular this section 9. You need to pass the attention mask returned by the tokenizer to have you model ignore padding. | 0 |
huggingface | Beginners | I can’t concatenate_datasets because features are not sorted. How do I sort it? | https://discuss.huggingface.co/t/i-cant-concatenate-datasets-because-features-are-not-sorted-how-do-i-sort-it/6243 | Hi guys,
I’m trying to concatenate two datasets that share some common features.
But these two datasets have features in a different order.
It’s like:
DatasetDict({
train: Dataset({
features: ['__index_level_0__', 'answers', 'context', 'document_id', 'id', 'question', 'title'],
num_rows: 3952
})... | hey @jeffnlp, i don’t think you can concatenate DatasetDict objects with concatenate_datasets - as described in the docs 3 this function expects a list of Dataset objects.
what happens if you try iterating over both DatasetDict objects and building up a new one that concatenates the Datasets objects as follows:
ds1 = D... | 0 |
huggingface | Beginners | Unsupported value type BatchEncoding | https://discuss.huggingface.co/t/unsupported-value-type-batchencoding/8924 | Hi
I’m a HuggingFace Newbie and I’m trying to fine tune DistilBERT for a three label sentiment classification task.
To do so I am using as a guide the HuggingFace Course 2. Hence I am using the following code to train my model:-
model = TFAutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=3)
lr_... | The problem lies in the training data, but you did not share how you built it, so we can’t help you see what’s wrong. | 0 |
huggingface | Beginners | Is there a way to finetune GPT2 775M on 16GB VRAM and 24GB RAM? | https://discuss.huggingface.co/t/is-there-a-way-to-finetune-gpt2-775m-on-16gb-vram-and-24gb-ram/9040 | I was able to finetune GPT2 355M 2048 sequence, without FP16, all fit in VRAM.
But no luck with GPT2 755M. Obviously didn’t fit to VRAM, so I used FP16 and DeepSpeed CPU offload, That way I got 9GB VRAM free, but out of RAM.
Did someone succeed with GPT2 training for 775M with 16GB VRAM? | Now I’m able to run training with block size 1568.
Free VRAM 1593MiB, free RAM 14GB
Feel like there is a room to run block size 2048… | 0 |
huggingface | Beginners | How to adjust the learning rate after N number of epochs? | https://discuss.huggingface.co/t/how-to-adjust-the-learning-rate-after-n-number-of-epochs/8644 | I am using Hugginface’s Trainer. How to adjust the learning rate after N number of epochs? For example, I have an initial learning rate set to lr=2e-6 , and I would like to change the learning rate to lr=1e-6 after the first epoch and stay on it the rest of the training.
I tried this so far:
optimizer = AdamW(model.par... | Were you able to resolve this? I have a similar problem where I want to implement adaptive learning rate during training. | 0 |
huggingface | Beginners | Pre-training & fine-tuning BERT on specific domain with custom dataset | https://discuss.huggingface.co/t/pre-training-fine-tuning-bert-on-specific-domain-with-custom-dataset/6672 | Hallo,
I need some help with training BERT and thought maybe I can ask you here…
I am trying to train a BERT model for a specific domain, similar to BioBERT, but for some other field.
So, for achieving my plans, I run the run_mlm.py script which I found on transformers/examples/pytorch/language-modeling at master · hug... | Hi there!
I’m using your question to ask one related to the run_ner.py script (maybe you could help on this one, since it is extremely basic)! I’m trying to build an extractive summariser using this latter.
I’m starting with all this so I am at level 0, and am trying to understand how to fit this script to my own data?... | 0 |
huggingface | Beginners | How do I fine-tune a zero-shot learning model to my task? | https://discuss.huggingface.co/t/how-do-i-fine-tune-a-zero-shot-learning-model-to-my-task/6758 | How would you improve the performance of zero-shot models considering you will be obtaining 1) feedback on the predictions made by the model and 2) labeled examples.
I want to do classification in Spanish and with very specialized legal text. The facebook/bart-large-mnli and joeddav/xlm-roberta-large-xnli models seem t... | Hey, Any luck on zero-shot finetuning? | 0 |
huggingface | Beginners | I want to custom my data set in speech recognition wav2vec | https://discuss.huggingface.co/t/i-want-to-custom-my-data-set-in-speech-recognition-wav2vec/8172 | hello,
i’m really bignner but i have to make my own data set wich is in wave format fine tuned to wav2vec model so i really need help about what to do in details . | Hello wzr97.
I am not sure if I understand your question correctly, and I am also fairly new to everything myself.
But this blog might contain the answer to your question.
huggingface.co
Fine-Tune Wav2Vec2 for English ASR in Hugging Face with 🤗 Transformers 15 | 0 |
huggingface | Beginners | Creating a Rick Sanchez chat bot with Transformers and Chai | https://discuss.huggingface.co/t/creating-a-rick-sanchez-chat-bot-with-transformers-and-chai/9078 | Hey,
I made a notebook tutorial to try and make it as simple as possible to train and deploy a DialoGPT bot.
It uses dialogue from Rick and Morty to train a Rick bot and then deploys the bot onto Chai 5, a platform for creating and interacting with conversational AI’s.
RickBotChai1530×2892 277 KB
By the end of this t... | This is cool! In your notebook it says you upload the model to huggingface - do you have a link to the model page? I wanna check it out! | 0 |
huggingface | Beginners | Shared public/private models are gone | https://discuss.huggingface.co/t/shared-public-private-models-are-gone/9035 | Hi there,
I uploaded public and private models a week ago (and the public model has over a hundred downloads so far). However, I just found out that they are gone in my profile page. Can anyone tell me what is going on here? I certainly didn’t delete the models. Is this related to model sharing policy that I might be m... | Oh my! I thought I was the only one going crazy! My models are also gone from my page, nor can they be searched. I similarly didn’t touch the models at all over the past few days… What’s odd is that I can still view and clone them if I visit their old direct links as per usual, like this 1 for example.
There seems to b... | 0 |
huggingface | Beginners | Different versions of ‘wav2vec2’ model and their differences | https://discuss.huggingface.co/t/different-versions-of-wav2vec2-model-and-their-differences/8996 | Hey everyone. I want to use wav2vec2 to perform ASR using data in my language (Greek). As such, I took a look at the various wav2vec2 pretrained models that exist in the model hub, and there are two things I don’t understand:
Some versions, like this facebook/wav2vec2-large-lv60 · Hugging Face, say in the description t... | A mistake I noticed in my post: the first link is meant to redirect to this version of wav2vec: facebook/wav2vec2-large-xlsr-53 · Hugging Face 1 | 0 |
huggingface | Beginners | Continue pre-training of Greek BERT with domain specific dataset | https://discuss.huggingface.co/t/continue-pre-training-of-greek-bert-with-domain-specific-dataset/4005 | Hello,
I want to further pre-train Greek BERT of the library on a domain specific dataset in MLM task to improve results. The downstream task of BERT will be sequence classification. I found that the library also provides scripts 35 for that. In the example RoBERTa is further trained on wikitext-2-raw-v1. As I saw here... | You should fine-tune the model on whatever task you want to perform. If you’d like to use it for sequence classification, then that’s what you should train it on i.e. exchange the head for a Sequence-Classification one.
This should be of help: BERT — transformers 4.3.0 documentation 46
This may help you understand how ... | 0 |
huggingface | Beginners | Can t5 be used to text-generation? | https://discuss.huggingface.co/t/can-t5-be-used-to-text-generation/1075 | Hello to all,
I’m following this tutorial: https://huggingface.co/blog/how-to-generate 78
which says: " Auto-regressive language generation is now available for GPT2 , XLNet , OpenAi-GPT , CTRL , TransfoXL , XLM , Bart , T5 in both PyTorch and Tensorflow >= 2.0!"
so I wanted to try to do the same, they just ch... | My mistake, reading the documentation is required that the first token is the task, for example ‘summarize’. | 0 |
huggingface | Beginners | [Question] Why does vocab size determine training parameters | https://discuss.huggingface.co/t/question-why-does-vocab-size-determine-training-parameters/8961 | I have a not so smart question: Why does the vocab size increase training parameters by a lot?
The following configuration:
from transformers import RobertaConfig
config = RobertaConfig(
vocab_size=48000,
max_position_embeddings=514,
num_attention_heads=12,
num_hidden_layers=6,
type_vocab_size=1,
)
... | I’m not sure where you question is, all your math is correct and yes, the embedding matrix is responsible for a looot of the model parameters. | 0 |
huggingface | Beginners | [HELP] Special tokens not appearing as predicted tokens! | https://discuss.huggingface.co/t/help-special-tokens-not-appearing-as-predicted-tokens/8910 | Hello,
I require some urgent help!
I trained a masked language model on a Twitter dataset, with each tweet containing one emoji. Then, I used the following code to add the emojis as special tokens:
num_added_toks = tokenizer.add_tokens(['😃',
'😄',
'😁',
'😆',
'😅',
'😂',
'🤣',
'🧔🏿♂️'])
print('We have added', num_ad... | I see one emoji in the last predictions. Mostly, it’s that the model is not used to seeing those, so it probably needs to be trained longer. | 0 |
huggingface | Beginners | How to fine-tune Bert on STS-B task? | https://discuss.huggingface.co/t/how-to-fine-tune-bert-on-sts-b-task/8950 | Hi, I am new to NLP and trying to reproduce fine-tune results of Bert. However, the STS-B task troubles me, from what I understand, the STS-B task is a regression task, but Bert treats it as a classification task. I do not quite know the transformation between scores and labels in detail, is anybody willing to give me ... | This is all dealt with in the loss function: a model that is tasked with classification or regression is the same roughly, it just outputs a different number of labels. Inside the code of BertModelForSequenceClassification 16, you can see there is a test that picks a different loss function depending on the problem_typ... | 0 |
huggingface | Beginners | How can I convert a model created with fairseq? | https://discuss.huggingface.co/t/how-can-i-convert-a-model-created-with-fairseq/564 | Hi,
I fine tuned facebook’s model mbart.cc25 for machine translation with Fairseq, it saved its model as checkpoint_*.pt. How can I use it now with Transformers, is it possible? Thanks | Unless the naming conventions that are used in transformers are the same as in fairseq, this is not possible out of the box. However, with a bit of digging you should be able to map them.
@sshleifer will know the answer. | 0 |
huggingface | Beginners | Data format for BertForSequenceClassification with num_labels > 2 | https://discuss.huggingface.co/t/data-format-for-bertforsequenceclassification-with-num-labels-2/4156 | Hi,
I have a multilabel task (num_labels=8) and I want to use BertForSequenceClassification using Trainer to train the model.
But I get the following error:
ValueError: Expected input batch_size (8) to match target batch_size (64).
I assume that the problem is the data format of the labels. Currently, my label is a 8... | Hi @maxpower, I think the format of your dataset is fine but I think you have to change the model’s loss function to use a sigmoid instead of a softmax on the logits (i.e. BCEWithLogitsLoss). You can see a skeleton + hacky Colab in this thread: Fine-Tune for MultiClass or MultiLabel-MultiClass - #8 by lewtun 100 | 0 |
huggingface | Beginners | How to move huggingface’s pretrained model to another machine? | https://discuss.huggingface.co/t/how-to-move-huggingfaces-pretrained-model-to-another-machine/8909 | Hi everyone, I’m having two computers, let’s call them A and B.
On my computer A, I have my huggingface’s textattack/bert-base-uncased-imdb model already downloaded.
My computer B, however, does not have access to the internet and cannot download the model.
A and B can communicate through ssh. Now I’m trying to move th... | Computer B is still trying to access the internet to check if there is a new version of the model you are using. You have to set the environment variable TRANSFORMERS_OFFLINE to some truthy value (like yes) | 0 |
huggingface | Beginners | How do I change my username or email? | https://discuss.huggingface.co/t/how-do-i-change-my-username-or-email/8855 | And how do I close my account? Thanks. | cc @pierric | 0 |
huggingface | Beginners | Creating a custom tokenizer for Roberta | https://discuss.huggingface.co/t/creating-a-custom-tokenizer-for-roberta/2809 | RobertaTokenizerFast seems to be ignoring my Lowercase() normaliser. I’ve created a custom tokeniser as follows:
tokenizer = Tokenizer(BPE(unk_token="<unk>", end_of_word_suffix="</w>"))
tokenizer.normalizer = Lowercase()
tokenizer.pre_tokenizer = Sequence([Whitespace(), Digits(individual_digits=False), Punctuation()])
... | Ahh, figured it out, it should be
tokenizer.save("./models/roberta/tokenizer.json")
not
tokenizer.save("./models/roberta/config.json") | 0 |
huggingface | Beginners | Which encoding does GPT2 vocabulary file use? | https://discuss.huggingface.co/t/which-encoding-does-gpt2-vocabulary-file-use/8875 | I wanted to investigate a little, how tokenizer works. But the model trained in Russian language (mostly), and I see garbage instead of tokens. I tried obvious variants like open in UTF-8, that didn’t help. | Well, I checked that json vocabulary loads as gibberish:
import json
with open("/content/notebooks/ru-gpts/models/gpt3large/vocab.json", "r", encoding="utf-8") as f:
vocab = json.load(f)
list(vocab.items())[1000:1010]
[('Ñĥма', 1000),
('Ġпи', 1001),
('Ġn', 1002),
('ĠнеÑĤ', 1003),
('иÑĤа', 1004),
('ÑĢ... | 0 |
huggingface | Beginners | Are images generated by DALL·E mini free to use? | https://discuss.huggingface.co/t/are-images-generated-by-dall-e-mini-free-to-use/8854 | Hi, I found DALL·E mini via Twitter. My question is in the topic title: May I use images generated from my prompts in DALL·E mini? Thanks. | cc @boris who may know more about the licensing of dall-e’s outputs (my guess is it’s fine!) | 0 |
huggingface | Beginners | How to save, load and use my text classification model? | https://discuss.huggingface.co/t/how-to-save-load-and-use-my-text-classification-model/8837 | Hi,
I have followed this text classification tutorial: notebooks/text_classification.ipynb at master · huggingface/notebooks · GitHub 4
However, the tutorial does not show how to save, load and use my text classification model.
Any help on how to use my saved model for classifying a sentence?
Thanks! | Once you have pushed your model to the hub, you can use it like any other model, in a pipeline or directly with the from_pretrained method. | 0 |
huggingface | Beginners | What does “encodings.update(…)” do? | https://discuss.huggingface.co/t/what-does-encodings-update-do/8781 | Hello,
I’m working thru the Question Answering with SQuAD 2.0 module.
I’m stuck in this function:
def add_token_positions(encodings, answers):
start_positions = []
end_positions = []
for i in range(len(answers)):
start_positions.append(encodings.char_to_token(i, answers[i]['answer_start']))
... | This is a Python method for any dictionary, it adds the content of the dictionary passed (so here the "start_positions" and "end_positions") to the encodings. | 0 |
huggingface | Beginners | How can i use torch.optim.lr_scheduler.MultiStepLR with Trainer? | https://discuss.huggingface.co/t/how-can-i-use-torch-optim-lr-scheduler-multisteplr-with-trainer/8743 | Is there any way to change learning rate scheduler by using Pytorch’s MultiStepLR with Trainer? | You can pass your own optimizer and scheduler to the Trainer. See the documentation 11 for more information. | 0 |
huggingface | Beginners | CPU Multiprocessing for Text Generation | https://discuss.huggingface.co/t/cpu-multiprocessing-for-text-generation/5861 | Hello. I’m trying to use multiprocessing when generating summaries on text within a data frame. The pool.map() command just hangs when I run it on a custom generate function. I tried debugging by removing every line of the generate function (shown below) and it seems to work fine if I remove the model.generate() part.
... | I have the same issue for prediction with AutoModelForSequenceClassification. pool.map() just hangs, while a Python map works fine. | 0 |
huggingface | Beginners | How to fine-tune T5-base model? | https://discuss.huggingface.co/t/how-to-fine-tune-t5-base-model/8478 | I want to fine-tune T5 model. but there is issue in running this script.
my code:-
!python /content/transformers/examples/language-modeling/run_clm.py
–model_name_or_path t5-base
–train_file /content/train.txt
–do_train
–learning_rate=1e-4
–per_device_train_batch_size=4
–output_dir /tmp/test-clm
This code is not workin... | Please use Preformatted text block for your codes, you can create this block automatically by pressing Ctrl+E:
!python /content/transformers/examples/language-modeling/run_clm.py
–model_name_or_path t5-base
–train_file /content/train.txt
–do_train
–learning_rate=1e-4
–per_device_train_batch_size=4
–output_dir /tmp/test... | 0 |
huggingface | Beginners | How to freeze some layers of BertModel | https://discuss.huggingface.co/t/how-to-freeze-some-layers-of-bertmodel/917 | I have a pytorch model with BertModel as the main part and a custom head. I want to freeze the embedding layer and the first few encoding layers, so that I can fine-tune the attention weights of the last few encoding layers and the weights of the custom layers.
I tried:
ct = 0
for child in model.children():
ct += 1
if... | You should not rely on the order returned by the parameters method as it does not necessarily match the order of the layers in your model. Instead, you should use it on specific part of your models:
modules = [L1bb.embeddings, *L1bb.encoder.layer[:5]] #Replace 5 by what you want
for module in mdoules:
for param in ... | 1 |
huggingface | Beginners | Ideas for beginner-friendlier TPU-VM clm training | https://discuss.huggingface.co/t/ideas-for-beginner-friendlier-tpu-vm-clm-training/8351 | Hello All,
I’ve recently started trying out TPU-VMs and wanted to train distilgpt2 from scratch on an non English language. I’ve had a rather rough start but did manage to overcome and get the training going.
Following the advice from Suraj Patil 3, I decided to write a list of things which can make this experience a b... | Follow this tutorial 7 to set-up and connect to your TPU-VM
Add your local bin path to the PATH environment variable, If you do not know your local user name, type:
whoami
#In my case, the user is ‘dadler’, so replace ‘dadler’ in the following block with your own user:
nano ~/.bashrc
#Add the following line at the bo... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.