Questions tagged [huggingface-transformers]
Transformers is a Python library that implements various transformer NLP models in PyTorch and Tensorflow.
huggingface-transformers
3,454
questions
0
votes
0
answers
11
views
Llama 3.1 not stop generating at <|eot_id|>
I have converted the orginal Llama 3.1 weights to huggingface format and loaded the instruct version of the model using the Huggingface transofrmers libraries with these version numbers of:
...
0
votes
0
answers
7
views
Multi-label classification using Setfit
I have tried multi-label classification using setfit multiple times. The code is always crashing on my colab. Can someone please help??
from setfit import SetFitModel
from datasets import load_dataset
...
0
votes
1
answer
9
views
PanicException: AddedVocabulary bad split AFTER adding tokens to BertTokenizer
I use a BertTokenizer and add my custom tokens using add_tokens() function.
Minimal sample code here:
checkpoint = 'fnlp/bart-base-chinese'
tokenizer = BertTokenizer.from_pretrained(checkpoint)
...
0
votes
0
answers
21
views
Getting NaN training and validation loss when training BERT model on pytorch
I am training a pretrained BERT model for a NER task. When I configured the device to cuda, it causes the gradients to backpropagate and output as NaNs. This does not happen when the device is ...
0
votes
0
answers
19
views
error while running hugging face models on kaggle notebook
I am using the Llama3 model from the huggingface library on a kaggle notebook and am facing this error on running the pipeline module
I have trimmed out a major chunk of the stack trace because ...
0
votes
0
answers
36
views
Huggingface Mistral-Nemo-Instruct-2407 python script for text generation just hanging on Mac M3?
I installed pytorch, transformers, and python-dotenv to run this script:
from transformers import pipeline
from dotenv import load_dotenv
import torch
import os
import json
# from transformers import ...
0
votes
0
answers
40
views
CUDA Out of Memory Error Despite Having Multiple GPUs
I'm encountering a CUDA out-of-memory error while trying to run a PyTorch model, even though my system has multiple NVIDIA GPUs.
# Load the tokenizer and model
tokenizer = AutoTokenizer....
0
votes
0
answers
30
views
RuntimeError: mat1 and mat2 shapes cannot be multiplied (100x768 and 2048x768)
I am trying to find similarity scores between the encodings of the image and prompt (which is the label of the image). I am new to machine learning, I realise that there is an issue with some shape of ...
0
votes
1
answer
13
views
BertTokenizer vocab_size remains unchanged after adding tokens
I am using HuggingFace BertTokenizer and adding some tokens to it. Here are the codes:
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained('fnlp/bart-base-chinese')
print(...
0
votes
1
answer
14
views
SgaeMaker training: what's the correct REGEX patrern to capture metrics?
This is the pattern I've seen suggested in a few different posts on SO:
metric_definitions = [
{'Name': 'loss', 'Regex': "'loss': ([0-9]+(.|e\-)[0-9]+),?"},
{'Name': 'learning_rate', ...
0
votes
0
answers
12
views
RuntimeError with DeBERTaV3 Sequence Classification: Tensor Size Mismatch
Iam trying to fine-tune the microsoft/deberta-v3-base model for sequence classification with three labels. I have set up my tokenizer and data preprocessing, but I encounter a RuntimeError during ...
1
vote
1
answer
29
views
CPU Memory Leak While Inference Models in Infinite Loop
I'm experiencing a CPU memory leak while running a Python script that processes text using various NLP models in an infinite loop. The script includes language translation, sentiment analysis, and ...
1
vote
0
answers
9
views
Hugging Face pipeline vs manual processing produces different embeddings for Vision Transformers
I am using the transformers library with the ViTForImageClassification model ('google/vit-base-patch16-224') to extract embeddings from images. However, I am observing different embeddings when I use ...
0
votes
0
answers
18
views
RuntimeError: Failed to import transformers.training_args
I am trying to use transformers in a task of building a chatbot
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig, TrainingArguments, trainer
import torch
import time
...
0
votes
0
answers
44
views
How do I run this model in HuggingFace from Nvidia and Mistral?
The model is:
nvidia/Mistral-NeMo-12B-Instruct
And the link in HuggingFace nvidia/Mistral-NeMo-12B-Instruct
Most model pages in HuggingFace have example Python code.
But this model page doesn't have ...