4AI / LS-LLaMA

A Simple but Powerful SOTA NER Model | Official Code For Label Supervised LLaMA Finetuning
https://arxiv.org/abs/2310.01208
MIT License
131 stars 20 forks source link

TypeError: LlamaDecoderLayer.__init__() missing 1 required positional argument: 'layer_idx' #11

Closed frankdarkluo closed 7 months ago

frankdarkluo commented 7 months ago

When I am using the modeling_llama.py in your code. I run into the issue:

File "/home/xxx/DPO-eval/modeling_llama.py", line 59, in <listcomp>
self.layers = nn.ModuleList([LlamaDecoderLayer(config) for _ in range(config.num_hidden_layers)])
TypeError: LlamaDecoderLayer.__init__() missing 1 required positional argument: 'layer_idx'

My transformer version is updated to 4.37.1.

In addition, I wonder if huggingface has a wrapped version of your "UnmaskingLlamaForSequenceClassification" and "UnmaskingLlamaForTokenClassification"?

SeanLee97 commented 7 months ago

hi @frankdarkluo, It seems that the implementation of LLaMA in Transformers has been updated. Could you degrade the transformers version to "transformers==4.32.1"? We are finding solutions to be compatible with the new version.

qiuhaolu commented 7 months ago

I met this same error.

SeanLee97 commented 7 months ago

I met this same error.

@qiuhaolu have you tried to downgrade the transformers to 4.32.1?

qiuhaolu commented 7 months ago

I met this same error.

@qiuhaolu have you tried to downgrade the transformers to 4.32.1?

Yes it works now. Thank you.