CoolFace
Modelpublic

1DS/adapter-title-brand-mapping-Llama-2-7b-chat-hf-v1

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes11downloads
Model Card

Model Card for Model ID

<!-- Provide a quick summary of what the model is/does. -->

Model Details

Model Description

<!-- Provide a longer summary of what this model is. -->

  • —Developed by: [More Information Needed]
  • —Funded by [optional]: [More Information Needed]
  • —Shared by [optional]: [More Information Needed]
  • —Model type: [More Information Needed]
  • —Language(s) (NLP): [More Information Needed]
  • —License: [More Information Needed]
  • —Finetuned from model [optional]: [More Information Needed]

Infrence Function

def generate(title): # Define the roles and markers # Define the roles and markers prompt = prompt = f"[INST]Identify the brand from the given product title.[/INST]\n\n<TITL> {title} </TITL>\n\n"custom prompt here print("Prompt:") print(prompt) encoding = tokenizer(prompt, returntensors="pt").to("cuda:0") output = model.generate(inputids=encoding.inputids, attentionmask=encoding.attentionmask, maxnewtokens=200, dosample=True, temperature=0.01, eostokenid=tokenizer.eostokenid, topk=0) print() # Subtract the length of inputids from output to get only the model's response outputtext = tokenizer.decode(output[0, len(encoding.inputids[0]):], skipspecialtokens=False) outputtext = re.sub('\n+', '\n', outputtext) # remove excessive newline characters print("Generated Assistant Response:") print(outputtext) return outputtext