HKUDS/PromptMM

★ 51⑂ 3

[WWW'2024] "PromptMM: Multi-Modal Knowledge Distillation for Recommendation with Prompt-Tuning"

About HKUDS/PromptMM

HKUDS/PromptMM is an open-source project on GitHub, mainly written in Python. [WWW'2024] "PromptMM: Multi-Modal Knowledge Distillation for Recommendation with Prompt-Tuning" It currently holds 51 stars and 3 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the AI Prompt Engineering board.

GitHub Repository Details

Repository HKUDS/PromptMM · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

PromptMM: Multi-Modal Knowledge Distillation for Recommendation with Prompt-Tuning

PyTorch implementation for WWW 2023 paper PromptMM: Multi-Modal Knowledge Distillation for Recommendation with Prompt-Tuning.

Wei Wei, Jiabin Tang, Yangqin Jiang, Lianghao Xia and Chao Huang*. (*Correspondence)

https://github.com/HKUDS/PromptMM/blob/HEAD/

Dependencies

Usage

Start training and inference as:

python ./main.py --dataset {DATASET}
Supported datasets: Amazon-Electronics, Netflix, Tiktok

Datasets

  ├─ MMSSL/ 
      ├── data/
        ├── tiktok/
        ...
  
| Dataset | | Netflix | | | Tiktok | | | | Electronics | | |:-----------:|:-:|:--------:|:---:|:-:|:--------:|:---:|:---:|:-:|:-----------:|:----:| | Modality | | V | T | | V | A | T | | V | T | | Feat. Dim. | | 512 | 768 | | 128 | 128 | 768 | | 4096 | 1024 | | User | | 43,739 | | | 14,343 | | | | 41,691 | | | Item | | 17,239 | | | 8,690 | | | | 21,479 | | | Interaction | | 609,341 | | | 276,637 | | | | 359,165 | | | Sparsity | | 99.919\% | | | 99.778\% | | | | 99.960\% | | 🚀🚀 The provided dataset is compatible with multi-modal recommender models such as MMSSL, LATTICE, and MICRO and requires no additional data preprocessing, including (1) basic user-item interactions and (2) multi-modal features.
# part of data preprocessing

#----json2mat--------------------------------------------------------------------------------------------------

import json from scipy.sparse import csr_matrix import pickle import numpy as np n_user, n_item = 39387, 23033 f = open('/home/weiw/Code/MM/MMSSL/data/clothing/train.json', 'r') train = json.load(f) row, col = [], [] for index, value in enumerate(train.keys()): for i in range(len(train[value])): row.append(int(value)) col.append(train[value][i]) data = np.ones(len(row)) train_mat = csr_matrix((data, (row, col)), shape=(n_user, n_item)) pickle.dump(train_mat, open('./train_mat', 'wb'))

# ----json2mat--------------------------------------------------------------------------------------------------

----mat2json--------------------------------------------------------------------------------------------------

train_mat = pickle.load(open('./train_mat', 'rb'))

test_mat = pickle.load(open('./test_mat', 'rb'))

val_mat = pickle.load(open('./val_mat', 'rb'))

total_mat = train_mat + test_mat + val_mat

total_mat =test_mat

total_mat = pickle.load(open('./new_mat','rb'))

total_mat = pickle.load(open('./new_mat','rb'))

total_array = total_mat.toarray() total_dict = {}

for i in range(total_array.shape[0]): total_dict[str(i)] = [index for index, value in enumerate(total_array[i]) if value!=0]

new_total_dict = {}

for i in range(len(total_dict)): # if len(total_dict[str(i)])>1: new_total_dict[str(i)]=total_dict[str(i)]

train_dict, test_dict = {}, {}

for i in range(len(new_total_dict)):

train_dict[str(i)] = total_dict[str(i)][:-1]

test_dict[str(i)] = [total_dict[str(i)][-1]]

train_json_str = json.dumps(train_dict)

test_json_str = json.dumps(new_total_dict)

with open('./new_train.json', 'w') as json_file:

# with open('./new_train_json', 'w') as json_file:

json_file.write(train_json_str)

with open('./test.json', 'w') as test_file:

with open('./new_test_json', 'w') as test_file:

test_file.write(test_json_str)

----mat2json--------------------------------------------------------------------------------------------------

https://github.com/HKUDS/PromptMM/blob/HEAD/

Acknowledgement

Acknowledgement

The structure of this code is largely based on LATTICE, MICRO. Thank them for their work.

GitHub Stars & Activity

51Stars
3Forks
0Open issues
PythonLanguage

GitHub Popularity

GitHub stars51
Forks3
Open issues0
Primary languagePython
License-
Stars gained today0
Created-
Last pushed-

Trending History

Trending statusnot on today's boards

Related AI Projects

1

microsoft / promptflow

Python★ 11,244⑂ 1,123
2

promptslab / Promptify

Python★ 4,635⑂ 364
3
4

hegelai / prompttools

Python★ 3,055⑂ 256
5

Eladlev / AutoPrompt

Python★ 3,019⑂ 264
6

microsoftarchive / promptbench

Python★ 2,821⑂ 222
7

yaojingang / yao-open-prompts

Python★ 2,817⑂ 461
8

YiVal / YiVal

Python★ 2,134⑂ 328

More AI Rankings