Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

NLP Collective

Questions

Browse questions with relevant NLP tags

38,710 questions

2 votes
1 answer
46 views

Transformers LlamaForCasualLM class: base_model Attribute Mystery

Question: I'm experiencing a question with the transformers library, specifically with the pipeline initialization. When I access the base_model attribute of a LlamaForCausalLM model, it seems to ...
Hank Wang's user avatar
0 votes
0 answers
23 views

NLTagger sentimentScore always returns 0.0 [closed]

I’m using NLTagger with the .sentimentScore tag scheme to analyze text sentiment. The setup is straightforward, and the code looks like this: import NaturalLanguage struct Scorer { let tagger = ...
Shubham B's user avatar
Advice
0 votes
1 replies
32 views

Organisation/Person tagging using Spacy

We’re working on a problem where our master dataset contains names of organizations and individuals, but some entries are untagged. We only have the names (no additional details such as email or ...
MJ17's user avatar
  • 109
0 votes
0 answers
61 views

IndexError: index -1 is out of bounds for dimension 0 with size 0

I am currently experimenting with modifying the KV cache of the LLaVA model in order to perform controlled interventions during generation (similar to cache-steering methods in recent research). The ...
Pulkit Mittal's user avatar
0 votes
0 answers
32 views

Inconsistent name normalization when extracting data using OpenAI API (gpt-4.0-mini)

I'm using the OpenAI API (gpt-4.0-mini) to extract and normalize names from social media posts. However, even with strict prompting, the output sometimes contains slightly different spellings for the ...
Mohaned Shaheen's user avatar
1 vote
0 answers
119 views

Transformers 'could not import module pipeline' to jupyter notebook

I need to to run a series of pre-trained fine-tuned models from Hugging Face to Jupyter notebook. I have updated to the latest version of both PyTorch and Transformers, but when I run the code from ...
Alex Colville's user avatar
1 vote
1 answer
69 views

Xcode Can't Find swift-transformers Package

I'm trying to implement Speech-to-Text transcription in my Swift app using Hugging Face's swift-transformers package to run Whisper models locally. I've added the package to my Xcode project, but when ...
Zaid's user avatar
  • 425
1 vote
1 answer
96 views

Memory usage keeps increasing when extracting embeddings via sentence-transformers

I have a set of about 100M paragraph-sized strings (multilingual) I am extracting embeddings for, but the memory usage keeps increasing until I start overflowing into disk swap: model = ...
Layman's user avatar
  • 1,076
0 votes
1 answer
68 views

Generating response with KV Cached System Prompt throws error when Input Tokens are less than Prompt Tokens

I am trying to run Mistral-7B-Instruct-v0.2. Each run is PROMPT + details[i]. PROMPT has instructions on how to generate JSON based on details. As the prefix part of each input is same; kind of like a ...
acdhemtos's user avatar
1 vote
1 answer
57 views

Output of for loop filling down in dataframe instead of returning corresponding values for each row

I'm using SpaCy to process a series of sentences and return the five most common words in each sentence. My goal is to store the output of that frequency analysis (using Counter) in a column beside ...
cmr's user avatar
  • 23
0 votes
0 answers
82 views

Transformers with Python 3.12.3 produce lots of errors

I got Python 3.12.3 on an Ubuntu server. I tried to install transformers, tokenizers, datasets and accelerate to use the Seq2SeqTrainer in the transformers. I used a virtual environment for the ...
Raptor's user avatar
  • 54.4k
0 votes
0 answers
85 views

Torch example transformer with TransformerDecoder

In the torch example provided here https://github.com/pytorch/examples/tree/main/word_language_model, tansformer only uses torch.TransformerEncoder and torch.TransformerDecoder is overwritten with a ...
cuneyttyler's user avatar
  • 1,395
0 votes
0 answers
31 views

T5-small generates only padding tokens during validation/test in PyTorch Lightning

I'm fine-tuning T5-small using PyTorch Lightning and encountering a strange issue during validation and test steps. The Problem: During validation_step and test_step, model.generate() consistently ...
GeraniumCat's user avatar
3 votes
0 answers
109 views

How does one log the operations done on a GPU during the execution of Python code?

I have encountered a particular problem while executing a function from the transformers library of huggingface on an Intel GPU wheel of torch. Since I am doing something I normally shouldn't be ...
Logarithmnepnep's user avatar
0 votes
0 answers
62 views

Utilizing GPU with RNN models which takes it's output as input [torch]

I have a machine-translation model. In this model, I calculate a vector for a given sentence and I take this vector, aggregate with each generated output of RNN and put it into RNN again for ...
cuneyttyler's user avatar
  • 1,395
1 vote
0 answers
67 views

How to pass P_map: dict[str, torch.Tensor] to PEFT (LoRA)?

My proxy goal is to change LoRA from h = (W +BA)x to h = (W + BAP)x. Preliminary code attached for your reference My actual goal is to train a model with the following loss: 〖Θ ̃=(arg min)┬Δ ̂ 〗⁡〖‖𝑓_(...
Jason Rich Darmawan's user avatar
1 vote
2 answers
157 views

How to fix “Expected all tensors to be on the same device” when running inference with Qwen3-VL-4B-Instruct?

I am trying to run the code example for run some inference on the model Qwen/Qwen3-VL-4B-Instruct model: from transformers import Qwen3VLForConditionalGeneration, AutoProcessor # default: Load the ...
Franck Dernoncourt's user avatar
0 votes
0 answers
66 views

Streamlit app throwing "NotFittedError: idf vector is not fitted" even though TF-IDF pipeline is fitted and works locally

I trained a sentiment classification model using a scikit-learn Pipeline that includes a TfidfVectorizer and LogisticRegression classifier. Everything works perfectly on my local machine, but when I ...
MOSAB FATAH's user avatar
0 votes
0 answers
47 views

Training data format for SpanCategorizer when using custom suggester function

I'm taking a stab at building my own claim extraction pipeline (first time spaCy user). Upstream in my pipeline, I feed n amount of docs to NER in the en_core_web_sm pretrained model in order to ...
muelikath_8's user avatar
2 votes
1 answer
60 views

Angle Embedder in Python Messing Up Logging Config

I wrote another question on this earlier, but could not pinpoint the issue on my side, here, I am giving a minimal reproducible code. System Angle version 0.5.6 UV 0.8.22 Python 3.12 Ubuntu 24.04 I ...
Della's user avatar
  • 1,730
1 vote
0 answers
52 views

Transformer model outputs degrade after ONNX export — what could be causing this?

I’ve exported a fine-tuned BERT-based QA model to ONNX for faster inference, but I’m noticing that the predictions from the ONNX model are consistently less accurate than those from the original ...
vinoth's user avatar
  • 41
-1 votes
2 answers
74 views

LangChain HuggingFace ChatHuggingFace raises StopIteration with any model

I’m trying to use LangChain’s Hugging Face integration to chat with the model TinyLlama/TinyLlama-1.1B-Chat-v1.0 for the very first time, but I’m getting a StopIteration error when calling .invoke(). ...
forstudy's user avatar
9 votes
2 answers
2k views

RemoteEntryNotFoundError with downloading models from Hugging Face in Kaggle

Recently i have started to get some strange errors, for example RemoteEntryNotFoundError: 404 Client Error. (Request ID: Root=1-68e82630-293b962044bc3e6c1453ec73;43987a97-e033-4590-951e-829a3c87d2cb) ...
Алиса Алексеевна's user avatar
0 votes
0 answers
55 views

ONNX Runtime Helsinki-NLP in Java

has anyone managed to translate something using Helsinki-NLP and ONNX Runtime in Java? Using a Python script, I generated these files: ├── encoder_model.onnx ├── decoder_model.onnx ├── ...
minizibi's user avatar
  • 393
3 votes
2 answers
184 views

Multimodal embedding requires video first, then image - why?

I am working with OmniEmbed model (https://huggingface.co/Tevatron/OmniEmbed-v0.1), which is built on Qwen2.5 7B. My goal is to get a multimodal embedding for images and videos. I have the following ...
n_arch's user avatar
  • 76
-1 votes
1 answer
58 views

How to reconstruct sentences from mean-pooled embeddings (embedding inversion) [closed]

I’m working on a research problem where I want to reconstruct or paraphrase sentences starting from synthetic embeddings. The embeddings are global (mean-pooled), not token-level, so they lose ...
melissa mattos's user avatar
0 votes
0 answers
51 views

Training with spaCy from command line, don't know why gpu-id not recognized

I am having the hardest of times getting my training session to use my gpu 0 which by every measure is present and correctly setup with cuda 12.2. When I try to do python -m spacy train base_config....
demongolem's user avatar
  • 9,764
1 vote
1 answer
117 views

How to make Microsoft Presidio detect and mask Indian names and unusual text patterns in banking data?

I’m working on anonymizing PII in banking text using Microsoft Presidio . The built-in PERSON recognizer (which uses spaCy under the hood) works for some Western names and when the sentence is clear ...
karthik's user avatar
  • 11
0 votes
0 answers
78 views

How to solve device mismatch issue when using offloading with QwenImageEditPlus pipeline and GGUF weights

After failing to make the QwenImageEditPlus run (https://huggingface.co/spaces/discord-community/README/discussions/9#68d260e32053323e6bfab30c), I tried a different approach (thanks to all the example ...
Siladittya's user avatar
  • 1,215
0 votes
0 answers
97 views

pippy examples: torch._dynamo.exc.UserError: It looks like one of the outputs with type <class transformers.cache_utils.DynamicCache> is not supported

when the program starts to initialize pipeline object, a unexpected error was thrown: [rank0]: Traceback (most recent call last): [rank0]: File "/root/anaconda3/envs/polar/lib/python3.12/site-...
Aerith's user avatar
  • 1
2 votes
1 answer
89 views

How to integrate a lightweight image-to-text model into a React Native app?

I am trying to integrate an image-to-text model into a React Native mobile app. My requirements: The model should support image + text input → text output. It should be lightweight enough to run on ...
Vivek's user avatar
  • 11
-2 votes
1 answer
151 views

I need a Python implementation of my Longest Possible Common Subsequence (LPCS) algorithm [closed]

Please be merciful - I've never asked a question here (I've answered a few) and am a total Python noob. I developed an algorithm in SQL Server to compute the Longest Possible Common Subsequence (LPCS) ...
Alan Burstein's user avatar
2 votes
1 answer
76 views

How can I extract symptoms/diseases from a running transcription?

I'm working on a project where I'm attempting to extract medical symptoms from a running transcription. I'm using SocketIO to get mic audio and then using Whisper to transcribe the audio into text ...
saksham shankar's user avatar
2 votes
1 answer
143 views

RuntimeError: Expected all tensors to be on the same device when using local HuggingFace model in LangChain Agent

I'm building a simple agent using LangChain that leverages a locally-hosted HuggingFace model (gpt-oss-20b). I'm using the transformers pipeline and wrapping it in LangChain's HuggingFacePipeline. The ...
meysam's user avatar
  • 194
3 votes
0 answers
52 views

Azure ML Endpoint Fails with HFValidationError even after using pathlib.Path

I am trying to deploy a fine-tuned Mistral-7B model on an Azure ML Online Endpoint. The deployment repeatedly fails during the init() phase of the scoring script with an huggingface_hub.errors....
User's user avatar
  • 157
0 votes
1 answer
80 views

PermissionError: [Errno 13] Permission denied: 'Qwen3-0.6B-SFT'

I am getting the following error when running training, using the TRL library in the following HuggingFace space: vishaljoshi24/trl-4-dnd. My SDK is Docker and as far as I'm aware there are not ...
Vishal Joshi's user avatar
-1 votes
1 answer
466 views

ModuleNotFoundError for transformers.pipeline after installing PyTorch for CUDA

I'm a bit stumped on an issue that just popped up. My code, which uses the transformers library, was running perfectly fine until I tried to install a CUDA-compatible version of PyTorch. Everything ...
meysam's user avatar
  • 194
1 vote
1 answer
90 views

KeyError: 'Cache only has 0 layers, attempted to access layer with index 0'

raise KeyError(f"Cache only has {len(self)} layers, attempted to access layer with index {layer_idx}") KeyError: 'Cache only has 0 layers, attempted to access layer with index 0' When I try ...
OctSky's user avatar
  • 11
0 votes
0 answers
207 views

Cannot import `QwenForCausalLM` after installing `v4.51.3-Qwen2.5-Omni-preview` tag; pip installs 4.52.0.dev0 instead

Description: I am trying to install the Hugging Face Transformers version that supports the Qwen2.5-Omni model. According to the official docs, the correct tag to install is v4.51.3-Qwen2.5-Omni-...
Promit Dey Sarker Arjan's user avatar
1 vote
0 answers
61 views

ValueError when resuming LoRA fine-tuning with sentence-transformers CrossEncoderTrainer: "Unrecognized model" error

I'm fine-tuning a CrossEncoder model with LoRA using sentence-transformers library on Kaggle (12-hour limit). I need to resume training from a checkpoint, but I'm getting a ValueError when trying to ...
Tuan Anh Pham's user avatar
0 votes
0 answers
56 views

How do I compute validation loss for a fine-tuned Qwen model in Hugging Face Transformers during evaluation?

I trained a Qwen model on my own dataset. Now I need to evaluate my trained model using the loss function, but I don’t know how to do it. I saw examples for other metrics such as accuracy and ...
Kathi Meyer's user avatar
0 votes
0 answers
252 views

ModuleNotFoundError: 'triton.ops' when loading 4-bit quantized model with bitsandbytes on Kaggle

I have this code: import os import torch from datasets import Dataset from transformers import ( AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TrainingArguments, ) from peft ...
Santhosh's user avatar
1 vote
2 answers
360 views

How can I match the token count used by BGE-M3 embedding model before embedding?

For my particular project, it would be very helpful to know how many tokens the BGE-M3 embedding model would break a string down into before I embed the text. I could embed the string and count the ...
ManBearPigeon's user avatar
2 votes
0 answers
89 views

How to Run an Open-Source 20B Model locally? [closed]

I have gpt oss 20b model's weights locally. What are the necessary steps to run a 20B model using transformers. in files that I downloaded is multi safetensor files. and also a .bin file. which one of ...
miky's user avatar
  • 21
2 votes
1 answer
102 views

How to stop hugging face pipeline operation

I need to stop hugging face pipeline operation. I tried to achieve this using a method from the following question, but it didn't work. I set the breakpoint on the line return flag and expected ...
Intolighter's user avatar
0 votes
0 answers
154 views

optuna, huggingface-transformers: RuntimeError, "Tensor.item() cannot be called on meta tensors" when n_jobs > 1

I'm trying to use optuna to find good hyperparameters for a fine-tuning task I'm doing with some different language models. My actual code is more complex, but here's a MWE: import torch import optuna ...
Jigsaw's user avatar
  • 449
0 votes
0 answers
49 views

The data type of the llava model uncontrollably changes to float32

I am using the llama-8b-llava model. I have made some modifications to the model, which are non-structural and do not introduce any parameters. During the model loading process, I used the torch....
ILOT's user avatar
  • 23
0 votes
0 answers
139 views

Convert SentencePiece tokenizer to ONNX

I'm developing (Python) an FAQ system based on embeddings to perform similarity queries between a user's question and the FAQ knowledge base. The FAQ needs to run on Android smartphones. I'm using the ...
ltu's user avatar
  • 177
0 votes
1 answer
88 views

How do I create a Pytorch Dataset from multiple files where each file has multiple batches

How do I create an dataset that reads in data from multiple files, but where each file has lots of rows or batches. For example, I have a partitioned parquet dataset (created with pandas.to_parquet), ...
dule arnaux's user avatar
  • 3,840
1 vote
2 answers
87 views

how to efficiently use spacy for pos tagging and ner

I am having 200 documents and I want to do NER and pos_tagging. However I find spacy to be too slow(I am running this code in google colab): for doc in nlp.pipe(dataset["text"], batch_size=...
Kishan Kumar's user avatar


1
2 3 4 5
775