Text Generation
Transformers
PyTorch
English
gpt_neox
text-generation-inference
Inference Endpoints

Open Ended Generation

#7
by nik8482 - opened

Hi,

Is there anyway to stop the model from asking itself questions after generating an initial response? This is an example of responses I'm currently getting

image.png

Ideally I want the model to stop generating after the first response, I could reduce the max tokens length however I get responses which seem to get cut off midway

Thanks for the help!

Add "<human>:" as a stop word.

Example: (here I have ["<human>:"] inside the variable self.model_conf['stop_words'])

            self.stop_words_ids = [
                self.tokenizer(stop_word, return_tensors="pt")["input_ids"].squeeze()
                for stop_word in self.model_conf["stop_words"]
            ]
            self.stopping_criteria = StoppingCriteriaList(
                [StoppingCriteriaSub(stops=self.stop_words_ids)]
            )

and then add this as parameter to your generate() call:

stopping_criteria=self.stopping_criteria,

@szeta can you please provide a step-by-step guide for less technical savvy folks? thank you

Sven i think we work on the same project. Let's catch up. :-)

Sign up or log in to comment