islasher commited on
Commit
e2ee65c
·
verified ·
1 Parent(s): 523dbbb

Update LLMPipeline.py

Browse files
Files changed (1) hide show
  1. LLMPipeline.py +2 -2
LLMPipeline.py CHANGED
@@ -103,8 +103,8 @@ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
103
  # print(tokenizer.decode(outputs[0]))
104
 
105
  def generate_image_prompt(summary):
106
- system_prompt_rewrite = "You are a creative meme prompt generator. Your task is to transform a news headline into a funny, clever, and original meme idea. Create a visual prompt to generate a meme of your idea. Do not return any text other than the new prompt."
107
- user_prompt_rewrite = "Create a meme prompt from the message given keeping its main points and key message. Do not add any new information or return any text other than the new prompt.\nThe message:"
108
  messages = [{"role": "system", "content": system_prompt_rewrite}, {"role": "user", "content":f"{user_prompt_rewrite} {summary}"}]
109
  input_text=tokenizer.apply_chat_template(messages, tokenize=False)
110
  inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
 
103
  # print(tokenizer.decode(outputs[0]))
104
 
105
  def generate_image_prompt(summary):
106
+ system_prompt_rewrite = "You are a creative meme prompt generator. Create a visual prompt to generate a meme of a message. Do not return any text other than the new prompt."
107
+ user_prompt_rewrite = "Create a visual meme prompt from the message. Keep its main point.\nThe message:"
108
  messages = [{"role": "system", "content": system_prompt_rewrite}, {"role": "user", "content":f"{user_prompt_rewrite} {summary}"}]
109
  input_text=tokenizer.apply_chat_template(messages, tokenize=False)
110
  inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)