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
4
votes
0 answers
How to convert a Hugging Face Pytorch model (AutoTrain) to TorchScript (.pt) for deployment?
I trained an image classification model using Hugging Face's AutoTrain service which left me with the following three files:
config.json
preprocessor_config.json
pytorch_model.bin
Here's what the 2 json files look…

JakeRow123
- 141
- 1
- 2
4
votes
0 answers
Issues when using HuggingFace `accelerate` with `fp16`
I'm trying to use accelerate module to parallelize my model training. But I have troubles to use it when training models with fp16. If I load the model with torch_dtype=torch.float16, I got ValueError: Attempting to unscale FP16 gradients.. But if I…

weiqis
- 41
- 1
- 3
4
votes
1 answer
Is it possible to save the training/validation loss in a list during training in HuggingFace?
I'm currently training my model using the HuggingFace Trainer class:
from transformers import Trainer, TrainingArguments
args = TrainingArguments(
output_dir="codeparrot-ds",
per_device_train_batch_size=32,
…

Penguin
- 1,923
- 3
- 21
- 51
4
votes
2 answers
Can't load from AutoTokenizer.from_pretrained - TypeError: duplicate file name (sentencepiece_model.proto)
I'm trying to load tokenizer and seq2seq model from pretrained models.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("ozcangundes/mt5-small-turkish-summarization")
model =…

Salihcan
- 91
- 13
4
votes
1 answer
Obtaining the image iterations before final image has been generated StableDiffusionPipeline.pretrained
I am currently using the diffusers StableDiffusionPipeline (from hugging face) to generate AI images with a discord bot which I use with my friends. I was wondering if it was possible to get a preview of the image being generated before it is…

jaal kamza
- 213
- 4
- 12
4
votes
2 answers
How to handle sequences longer than 512 tokens in layoutLMV3?
How to work with sequences longer than 512 tokens. I don't wanted to use truncates =True. But actually wanted to handle the longer sequences

Jyoti yadav
- 108
- 6
4
votes
1 answer
Tokenizer.from_file() HUGGINFACE : Exception: data did not match any variant of untagged enum ModelWrapper
I am having issue loading a Tokenizer.from_file() BPE tokenizer.
When I try I am encountering this error where the line 11743 is the last last one:
Exception: data did not match any variant of untagged enum ModelWrapper at line 11743 column 3
I have…

Chiara
- 372
- 5
- 17
3
votes
0 answers
Why do I get an inconsistent memory error when loading Llama-2 from huggingface
I'm playing around with the new Llama-2 7B model, and running it on a 16GM RAM M1 pro Mac. If I load the model, Python crashes with a memory error - unless I load it via hf pipelines. I don't believe this to be a hf issue but rather something weird…

Max Niroomand
- 61
- 3
3
votes
0 answers
Big difference in the sizes of Llama 2 model files on huggingface hub depending on the format
The Llama2 7B model on huggingface (meta-llama/Llama-2-7b) has a pytorch .pth file consolidated.00.pth that is ~13.5GB in size. The hugging face transformers compatible model meta-llama/Llama-2-7b-hf has three pytorch model files that are together…

Kumar Saurabh
- 711
- 7
- 7
3
votes
3 answers
How does one set the pad token correctly (not to eos) during fine-tuning to avoid model not predicting EOS?
**tldr; what I really want to know is what is the official way to set pad token for fine tuning it wasn't set during original training, so that it doesn't not learn to predict EOS. **
colab:…

Charlie Parker
- 5,884
- 57
- 198
- 323
3
votes
1 answer
How to use sample_by="document" argument with load_dataset in Huggingface Dataset?
Problem
Hello. I am trying to use huggingface to do some malware classification. I have a 5738 malware binaries in a directory. The paths to these malware binaries are stored in a list called files. I am trying to load these binaries into a…

Luke Kurlandski
- 81
- 5
3
votes
1 answer
Indefinite wait while using Langchain and HuggingFaceHub in python
from langchain import PromptTemplate, HuggingFaceHub, LLMChain
import os
os.environ['HUGGINGFACEHUB_API_TOKEN'] = 'token'
# initialize HF LLM
flan_t5 = HuggingFaceHub(
repo_id="google/flan-t5-xl",
model_kwargs={"temperature":…

Chirag Jain
- 61
- 3
3
votes
1 answer
Langchain, Huggingface: Can't evaluate model with two different inputs
I'm evaluating a LLM on Huggingface using Langchain and Python using this code:
# https://github.com/hwchase17/langchain/blob/0e763677e4c334af80f2b542cb269f3786d8403f/docs/modules/models/llms/integrations/huggingface_hub.ipynb
from langchain import…

Jennie94
- 33
- 4
3
votes
1 answer
Hugging Face Transformers BART CUDA error: CUBLAS_STATUS_NOT_INITIALIZE
I'm trying to finetune the Facebook BART model, I'm following this article in order to classify text using my own dataset.
And I'm using the Trainer object in order to train:
training_args = TrainingArguments(
output_dir=model_directory, #…

Dolev Mitz
- 103
- 14
3
votes
0 answers
What is recommended number of threads for pytorch based on available CPU cores?
First I want to say that I don't have much experience with pytorch, ML, NLP and other related topics, so I may confuse some concepts. Sorry.
I downloaded few models from Hugging Face, organized them in one Python script and started to perform…

Amaimersion
- 787
- 15
- 28