通过一步一步的研究,发现是huggingface的enable_input_require_grads函数将inputs_embeds变成了需要梯度的叶子结点。最终解决方案是通过clone操作将inputs_embeds再变成非叶子结点,再修改对应的embedding: inputs_embeds = inputs_embeds.clone() # shape: (batch_size, seq_len, hidden_size) input_embeds[0,0] ...
Tracker to update how we handle the inputs_embeds input, especially in generate, and how we test it. More precisely: Remove support of inputs_embeds in generate in models that don't actually support it. (Check skipped tests) Remove as ma...
🚀 Feature request Currently GenerationMixin.generate() only accepts input_ids but not inputs_embeds. Therefore this method is not usable when custom input embeddings are required. In contrast, many models do accept inputs_embeds as input...
wav*_*per 5 python deep-learning torchscript huggingface-transformers 尝试将 t5 模型转换question-generation为torchscript model,同时执行此操作时遇到此错误ValueError:您必须指定decoder_input_ids或decoder_inputs_embeds这是我在 colab 上运行的代码。!pip install -U transformers==3.0.0 !python -m nltk.dow...
import java.io.CharArrayWriter; import java.io.File; import java.io.FileReader; import java.io.Fi...
(shape=(max_len,), dtype=tf.int32, name="input_word_ids") ---> 33 sequence_output = transformer(input_word_ids)[0] 34 cls_token = sequence_output[:, 0, :] 35 out = Dense(1, activation='sigmoid')(cls_token) ValueError: You have to specify either input_ids or inputs_embeds ...
Bug description In the following code snippet, lmm is a class inherited from nn.Module which is a wrapper class huggingface model and processor. class ICVModel(pl.LightningModule): def __init__(self, lmm, icv_encoder: torch.nn.Module) ->...
0.1.8 huggingface_hub: 0.26.2 interegular: 0.3.3 packaging: 24.2 PIL: 10.4.0 psutil: 6.1.0 pydantic: 2.9.2 uvicorn: 0.32.0 uvloop: 0.21.0 zmq: 26.2.0 vllm: 0.6.3.post1 multipart: 0.0.17 openai: 1.54.4 anthropic: 0.39.0 NVIDIA Topology: GPU0 NIC0 NIC1 NIC2 NIC3 NIC4 NIC5...