Model Card for Model ID
Generates possible search queries for a given product with title and dedscription. Can be used to synthetically generate search queries.
Input -> "Title: " + 《product_title》 + "Description: " + 《product_details》
Development details
Model is trained with a novel adversarial Generator-Retriever framework.
The details of the framework can be found here. Notebook with the code is available here
Using the model
from transformers import T5ForConditionalGeneration, T5Tokenizer
import torch
MODEL_ID = "prhegde/search-query-generator-ecommerce"
gen_tokenizer = T5Tokenizer.from_pretrained(MODEL_ID)
gen_model = T5ForConditionalGeneration.from_pretrained(MODEL_ID)
gen_model.eval()
prod_title = "home sweet home pine pallet wall décor"
prod_desc = "decorate your home with this rustic wood , which is made from high-quality pine pallets . this creates a beautiful rustic look for the kitchen , bedroom , or living room — great gift idea for any occasion ; perfect for holidays , birthdays , or game days"
input_sequence = "Title: " + prod_title + " - Description: " + prod_desc
input_ids = gen_tokenizer(input_sequence, return_tensors="pt").input_ids
print(f'Input: {input_sequence}')
nsent = 4
with torch.no_grad():
for i in range(nsent):
output = gen_model.generate(input_ids, max_length=35, num_beams=1, do_sample=True, repetition_penalty=1.8)
target_sequence = gen_tokenizer.decode(output[0], skip_special_tokens=True)
print(f'Target: {target_sequence}')
- Downloads last month
- 133
Inference API (serverless) has been turned off for this model.