🚀 BLaIR-roberta-base
BLaIR(即“Bridging Language and Items for Retrieval and Recommendation”的縮寫)是一系列在2023年亞馬遜評論數據集上預訓練的語言模型。該模型基於*(商品元數據, 語言上下文)*對進行訓練,使其能夠:
- 為推薦和檢索任務生成強大的商品文本表示;
- 根據簡單或複雜的語言上下文預測最相關的商品。
[📑 論文] · [💻 代碼] · [🌐 2023年亞馬遜評論數據集] · [🤗 Huggingface數據集] · [🔬 McAuley實驗室]
🚀 快速開始
模型詳情
使用HuggingFace調用模型
import torch
from transformers import AutoModel, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("hyp1231/blair-roberta-base")
model = AutoModel.from_pretrained("hyp1231/blair-roberta-base")
language_context = 'I need a product that can scoop, measure, and rinse grains without the need for multiple utensils and dishes. It would be great if the product has measurements inside and the ability to rinse and drain all in one. I just have to be careful not to pour too much accidentally.'
item_metadata = [
'Talisman Designs 2-in-1 Measure Rinse & Strain | Holds up to 2 Cups | Food Strainer | Fruit Washing Basket | Strainer & Colander for Kitchen Sink | Dishwasher Safe - Dark Blue. The Measure Rinse & Strain by Talisman Designs is a 2-in-1 kitchen colander and strainer that will measure and rinse up to two cups. Great for any type of food from rice, grains, beans, fruit, vegetables, pasta and more. After measuring, fill with water and swirl to clean. Strain then pour into your pot, pan, or dish. The convenient size is easy to hold with one hand and is compact to fit into a kitchen cabinet or pantry. Dishwasher safe and food safe.',
'FREETOO Airsoft Gloves Men Tactical Gloves for Hiking Cycling Climbing Outdoor Camping Sports (Not Support Screen Touch).'
]
texts = [language_context] + item_metadata
inputs = tokenizer(texts, padding=True, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
embeddings = model(**inputs, return_dict=True).last_hidden_state[:, 0]
embeddings = embeddings / embeddings.norm(dim=1, keepdim=True)
print(embeddings[0] @ embeddings[1])
print(embeddings[0] @ embeddings[2])
📄 許可證
本項目採用MIT許可證。
📚 引用
如果您發現2023年亞馬遜評論數據集、BLaIR模型檢查點、Amazon - C4數據集或我們的腳本/代碼有幫助,請引用以下論文。
@article{hou2024bridging,
title={Bridging Language and Items for Retrieval and Recommendation},
author={Hou, Yupeng and Li, Jiacheng and He, Zhankui and Yan, An and Chen, Xiusi and McAuley, Julian},
journal={arXiv preprint arXiv:2403.03952},
year={2024}
}
📞 聯繫我們
如果您遇到了問題或有任何建議/疑問,請提交一個issue,或者通過電子郵件聯繫Yupeng Hou:yphou@ucsd.edu。