huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
128.52k stars 25.49k forks source link

stop_strings not work at all #31363

Open lucasjinreal opened 3 weeks ago

lucasjinreal commented 3 weeks ago
reversed_stop_string = stop_string[::-1]

TypeError: 'NoneType' object is not subscriptable

output_ids = model.generate( input_ids, images=images_tensor, do_sample=False, temperature=0.2, max_new_tokens=1024, streamer=streamer, use_cache=True,

cache_position=None,

            pad_token_id=tokenizer.eos_token_id,
            # pad_token_id=conv.stop_token_ids,
            eos_token_id=conv.stop_token_ids,
            # stopping_criteria=[stopping_criteria],
            tokenizer=tokenizer,
            stop_strings=[conv.stop_str]
        )
zucchini-nlp commented 3 weeks ago

Hey! It will be helpful if you provide an executable code snippet to reproduce the error :)

cc @Rocketknight1

Rocketknight1 commented 2 weeks ago

Yes, this seems like conv.stop_str is None? Are you sure you're passing that correctly?