The huggingface tag can be used for all libraries made by Hugging Face. Please ALWAYS use the more specific tags; huggingface-transformers, huggingface-tokenizers, huggingface-datasets if your question concerns one of those libraries.
Questions tagged [huggingface]
606 questions
0
votes
0 answers
Hugging Face Spaces failing to build using fast.ai because of Resampling on module PIL.Image
I keep getting the below error when I try to access my model on hugging face spaces. I am building my model in a Kaggle notebook, then downloading to a pkl file to my spaces repo and git pushing to HF spaces. Below is my ImageDataLoaders class that…

JakeGehri
- 65
- 3
0
votes
0 answers
How to add an additional label to a huggingface model?
I'm following the multiple choice QA tutorial and trying to modify it slightly to fit my data. My data is exactly the same, except that I have 5 labels instead of 4:
# original data:
from datasets import load_dataset
swag = load_dataset("swag",…

Penguin
- 1,923
- 3
- 21
- 51
0
votes
1 answer
How do a put a different classifier on top of BertForSequenceClassification?
I have a huggingface model:
model_name = 'bert-base-uncased'
model = BertForSequenceClassification.from_pretrained(model_name, num_labels=1).to(device)
How can I change the default classifier head? Since it's only a single LinearClassifier. I found…

Penguin
- 1,923
- 3
- 21
- 51
0
votes
1 answer
How do I convert a list of dictionaries to a Huggingface Dataset object?
I have a list of dictionaries:
print(type(train_dataset))
>>>
print(len(train_dataset))
>>> 4000
train_dataset[0]
>>>
{'id': '7',
'question': {'stem': 'Who is A',
'choices': [{'text': 'A is X', 'label': 'A'},
{'text': 'A is…

Penguin
- 1,923
- 3
- 21
- 51
0
votes
0 answers
Ray hyperparameter tuning fails even runs, due to CUDA GPU unavailable
I tryied running this code for hyper-parameter tuning of a bert model.
I only have one GPU, so I adapted the code to make it run only one training at a time.
This is the resulting code:
from datasets import load_dataset, load_metric
from…

juuso
- 612
- 7
- 26
0
votes
0 answers
Structure evaluation set GPT-2 text generation huggingface
I´m currently reproducing the second task (generating articles from headline) of this tutorial: https://www.modeldifferently.com/en/2021/12/generaci%C3%B3n-de-fake-news-con-gpt-2/#42-fine-tuning-to-generate-articles-from-headlines
I understand that…
0
votes
2 answers
How to resolve the hugging face error ImportError: cannot import name 'is_tokenizers_available' from 'transformers.utils'?
I was trying to use the ViTT transfomer. I got the following error with code:
from pathlib import Path
import torchvision
from typing import Callable
root = Path("~/data/").expanduser()
# root = Path(".").expanduser()
train =…

Charlie Parker
- 5,884
- 57
- 198
- 323
0
votes
0 answers
How to padding using Huggingface for Bert training
I'm using this link to train hugginface bert. But I saw different batch has different sequence length in training time. But I want to keep the same sequence length for all of the batches. How can I do that? And how does hugging face handles…

kowser66
- 125
- 1
- 8
0
votes
1 answer
Chatbot Start Prompt for GPT-J
I'm using GPT-J (EleutherAI/gpt-j-6B) as a chatbot. As a prompt, I provide a sample conversation as shown below. When now a new conversation starts, I append the input of the user to this sample conversation ("Hello, how are you doing?" in the…

BlackHawk
- 719
- 1
- 6
- 18
0
votes
0 answers
why does Huggingface's TextDatasetForNextSentencePrediction makes all the next sentence label same?
from transformers import TextDatasetForNextSentencePrediction
dataset = TextDatasetForNextSentencePrediction(
tokenizer=bert_cased_tokenizer,
file_path="/path/to/your/dataset",
block_size = 256
)
when I run this code and check all of the next…

Ritesh Panditi
- 11
- 2
0
votes
1 answer
Huggingface models: how to store a different version of a model
I have a model that I pushed to the remote using the following code:
from transformers import CLIPProcessor, CLIPModel
checkpoint = "./checkpoints-15/checkpoint-60"
model = CLIPModel.from_pretrained(checkpoint)
processor =…

Vincent Claes
- 3,960
- 3
- 44
- 62
0
votes
0 answers
Force GPT-NEO to generate despite EOS token
I'm trying to use few-shot summarization on GPT-NEO, with custom eos_token_id = '###'.
So when I generate the text, the generator has this parameter:
model.generate(inputs,
max_new_tokens = 80,
eos_token_id = tokenizer.eos_token_id)
The…

yulGM
- 894
- 1
- 5
- 14
0
votes
1 answer
how to resize the embedding vectors from huggingface bert
I try to use the tokenizer method to tokenize the sentence and then mean pool the attention mask to get the vectors for each sentence. However, the current default size embedding is 768 and I wish to reduce it to 200 instead but failed. below is my…

Learner91
- 103
- 6
0
votes
1 answer
Why do I get the error "ModuleNotFoundError: No module named 'huggan'"?
I am trying to implement this model from HuggingFace. To run the model I need to import HugGANModelHubMixin with:
from huggan.pytorch.huggan_mixin import HugGANModelHubMixin
but I get:
ModuleNotFoundError: No module named 'huggan'.
I cloned the…

Max Hager
- 536
- 4
- 13
0
votes
0 answers
RASA with Speech recognition models
Is there a way to build a voice assistant with open source Rasa and fairseq's Speeech recognition models. I have been following this reference
https://rasa.com/blog/how-to-build-a-voice-assistant-with-open-source-rasa-and-mozilla-tools/
Can anyone…

P J
- 11
- 2