peft icon indicating copy to clipboard operation
peft copied to clipboard

PeftModelForSeq2SeqLM.generate() does not accept positional arguments

Open pminervini opened this issue 2 years ago • 5 comments

This is easy to fix; I will submit a pull request ASAP.

Traceback (most recent call last):
[..]
    out = model.generate(
TypeError: PeftModelForSeq2SeqLM.generate() takes 1 positional argument but 2 were given

pminervini avatar Mar 29 '23 22:03 pminervini

@pminervini yes, AFAIK to call generate you need to give explicit key word arguments; input_ids=input_ids, attention_mask=attention_mask, etc.

younesbelkada avatar Mar 30 '23 07:03 younesbelkada

For reference this is what we do in tests: https://github.com/huggingface/peft/blob/542f2470e7679768f594692fc7f59e83f48585a8/tests/test_peft_model.py#L177

younesbelkada avatar Mar 30 '23 07:03 younesbelkada

For reference this is what we do in tests: https://github.com/huggingface/peft/blob/542f2470e7679768f594692fc7f59e83f48585a8/tests/test_peft_model.py#L177

If you folks want things to stay this way, I can close the issue!

pminervini avatar Mar 30 '23 07:03 pminervini

cc @pacman100 !

younesbelkada avatar Mar 30 '23 07:03 younesbelkada

Hello, @pminervini, it would be great to support positional args too if that can be done in a clean way. Looking forward to your PR.

pacman100 avatar Mar 30 '23 07:03 pacman100

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

github-actions[bot] avatar Apr 29 '23 15:04 github-actions[bot]