stop criteria removed (#33)
Browse files- stop criteria removed (bd60586a6b6289b6cf23424e030a3107e5ae0143)
Co-authored-by: ismail hakkı özçelik <ismailhakki37@users.noreply.huggingface.co>
346 unmodified lines3473483493503513523533543553563573583593603613623633643653663673683693503513523533543556 unmodified lines362363364382365366367346 unmodified lines prompt, our_chatbot.tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt" ).unsqueeze(0).to(our_chatbot.model.device) # Set up stopping criteria - more flexible to allow longer responses stop_str = ( our_chatbot.conversation.sep if our_chatbot.conversation.sep_style != SeparatorStyle.TWO else our_chatbot.conversation.sep2 ) # Use minimal stopping criteria to allow longer responses keywords = [] if stop_str and stop_str.strip(): keywords.append(stop_str) # Only add very basic stopping criteria to prevent infinite generation if not keywords: keywords = ["</s>", "<s>"] print(f"[DEBUG] Using stopping criteria: {keywords}") stopping_criteria = KeywordsStoppingCriteria( keywords, our_chatbot.tokenizer, input_ids ) # No stopping criteria - let model generate freely up to max_new_tokens print(f"[DEBUG] No stopping criteria - free generation up to {max_output_tokens} tokens") stopping_criteria = None # Generate response with torch.no_grad():6 unmodified lines max_new_tokens=max_output_tokens, repetition_penalty=repetition_penalty, use_cache=False, stopping_criteria=[stopping_criteria], pad_token_id=our_chatbot.tokenizer.eos_token_id, eos_token_id=our_chatbot.tokenizer.eos_token_id, length_penalty=1.0, # Don't penalize longer sequenceshandler.py+3-21