Questions tagged [huggingface]

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.

606 questions
2
votes
0 answers

Huggingface model inference issue

I'm trying to use my pre-trained huggingface model to predict. outputs = model( ids, mask, token_type_ids ) outputs = torch.sigmoid(outputs.last_hidden_state).cpu().detach().numpy() return outputs[0][0] The I…
ZL RONG
  • 41
  • 4
2
votes
1 answer

Model not calculating loss during training returning ValueError (Huggingface/BERT)

I'm unable to properly pass my encoded data (with hidden states) through Trainer via Huggingface. Below is the call to Trainer with arguments and the full traceback. I'm not really sure where to begin with this error as I believe I've satisfied all…
Wesson
  • 31
  • 5
2
votes
0 answers

Dealing with infs in Seq2Seq Trainer

I am trying to fine tune a hugging face model onto a Shell Code dataset (https://huggingface.co/datasets/SoLID/shellcode_i_a32) The training code is a basic hugging face trainer method but we keep running into nan/inf issues from transformers import…
2
votes
0 answers

ValueError: The model did not return a loss from the inputs, only the following keys: logits,past_key_values

I'm using Pytorch to do huggingface model finetuning with transformers library. I have torch version '1.13.0+cu117' with python 3.7.8 and CUDA 11.8. But with some copying and pastinng of others' code, I'm getting ValueError: The model did not return…
fchen92
  • 57
  • 5
2
votes
0 answers

Unable to create tensor

I am trying to train an NLP model for MLM problem, but the trainer.train function is throwing: Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' 'truncation=True' to have batched tensors with the…
2
votes
1 answer

OSError: There was a specific connection error when trying to load CompVis/stable-diffusion-v1-4:

System Info Google Colab, Free version, GPU Information [ ] The official example scripts [X] My own modified scripts Tasks [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...) [X] My own task or dataset (give details…
sogu
  • 2,738
  • 5
  • 31
  • 90
2
votes
1 answer

HuggingFace Trainer do predictions

I've been fine-tuning a Model from HuggingFace via the Trainer-Class. I went through the Training Process via trainer.train() and also tested it with trainer.evaluate(). My question is how I can run the Model on specific data. In case of a…
Infomagier
  • 171
  • 1
  • 3
  • 9
2
votes
0 answers

How to define custom entites in HuggingFace Transformers NER pipeline?

I am trying to train HuggingFace Transformers NER on custom dataset with custom entities. Is it possible to define custom entities in HuggingFace? For examples, simpletransformers NERModel offers to define custom labels while…
2
votes
1 answer

How to know if HuggingFace's pipeline text input exceeds 512 tokens

I've finetuned a Huggingface BERT model for Named Entity Recognition based on 'bert-base-uncased'. I perform inference like this: from transformers import pipeline ner_pipeline = pipeline('token-classification', model=model_folder,…
ClaudiaR
  • 3,108
  • 2
  • 13
  • 27
2
votes
1 answer

Setting Huggingface cache in Google Colab notebook to Google Drive

I am using Google Colab to implement Huggingface code. What is the best method to change huggingface cache directory in Colab environment to my Google Drive (GDrive), so that we won't need to download the cached content i.e. language models,…
2
votes
1 answer

'numpy.float64' object has no attribute 'mid'

While implementing this code for mt5 summarization of hugging face This error occurred : enter image description here 18 ) 19 # Extract the median scores ---> 20 result = {key: value.mid.fmeasure * 100 for key, value in…
2
votes
1 answer

How to pass arguments to HuggingFace TokenClassificationPipeline's tokenizer

I've finetuned a Huggingface BERT model for Named Entity Recognition. Everything is working as it should. Now I've setup a pipeline for token classification in order to predict entities out the text I provide. Even this is working fine. I know that…
2
votes
0 answers

huggingface/transformers: cache directory

I'm trying to use huggingface transformers. (Win 11, Python 3.9, jupyternotebook, virtual environment) When I ran code: from transformers import pipeline print(pipeline('sentiment-analysis')('I hate you')) I got an error : FileNotFoundError:…
PCho
  • 21
  • 1
  • 3
2
votes
0 answers

Huggingface generating chatbot response using GPT-J

I’m using EleutherAI/gpt-j-6B for a chatbot. I’m using the following prompt and the following code: prompt = "person alpha:\nhi! how are you doing?\n\nperson beta:I am fine, thank you. What are you doing?\n\nperson alpha:\nI am at home watching…
2
votes
1 answer

How to use fine-tuned model in huggingface for actual prediction after re-loading?

I'm trying to reload a DistilBertForSequenceClassification model I've fine-tuned and use that to predict some sentences into their appropriate labels (text classification). In google Colab, after successfully training the BERT model, I downloaded it…