File size: 3,110 Bytes
936459a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
export WANDB_MODE=disabled
export CUDA_LAUNCH_BLOCKING=0

DATASET=Instruments
BASE_MODEL=$datain/v-yinju/llama-7b
ITEM_MODEL=$datain/v-yinju/rqvae-zzx/models/instruments/Apr-01-2024_01-25-11/best_collision_model.pth
USER_MODEL=$datain/v-yinju/rqvae-zzx/models/instruments/user/Apr-23-2024_03-36-04/best_collision_model.pth
DATA_PATH=$datain/v-yinju/rqvae-zzx/data
OUTPUT_DIR=$datain/v-yinju/rq-llama/v11.2/Ins

torchrun --nproc_per_node=8 pre-train.py \
    --base_model $BASE_MODEL \
    --item_model $ITEM_MODEL \
    --user_model $USER_MODEL \
    --output_dir $OUTPUT_DIR \
    --dataset $DATASET \
    --data_path $DATA_PATH \
    --per_device_batch_size 6 \
    --gradient_accumulation_steps 2 \
    --learning_rate 5e-4 \
    --epochs 4 \
    --weight_decay 0.01 \
    --save_and_eval_strategy epoch \
    --deepspeed ./config/ds_z2_fp16.json \
    --dataloader_num_workers 4 \
    --only_train_response \
    --tasks seqrec,itemsearch,inters2title,inters2description,preferenceobtain,item2index,index2item,intertitles2item,query2item,usersearch,user2pref,pref2user \
    --train_prompt_sample_num 1,1,1,1,1,1,1,1,1,1,1,1 \
    --train_data_sample_num 0,0,0,0,0,0,0,0,0,0,0,0 \
    --index_file .index.json \
    --user_index_file .user-index.json \
    --fp16

cd convert
nohup ./convert.sh $OUTPUT_DIR >convert.log 2>&1 &
cd ..

CKPT_PATH=$datain/v-yinju/rq-llama/v11.2/Ins

python generate_embeddings.py \
    --ckpt_path $CKPT_PATH \
    --item_save_path $CKPT_PATH/embeddings.item.tsv \
    --user_save_path $CKPT_PATH/embeddings.user.tsv \
    --device_map 0

python generate_indices.py \
    --ckpt_path $CKPT_PATH \
    --item_data_path $CKPT_PATH/embeddings.item.tsv \
    --user_data_path $CKPT_PATH/embeddings.user.tsv \
    --save_path $CKPT_PATH \
    --device_map 0

# DATASET=Games
# BASE_MODEL=/datain/v-yinju/llama-7b
# ITEM_MODEL=/datain/v-yinju/rqvae-zzx/models/games/Apr-18-2024_01-51-46/best_collision_model.pth
# USER_MODEL=/datain/v-yinju/rqvae-zzx/models/games/user/Jun-17-2024_18-40-36/best_collision_model.pth
# DATA_PATH=/datain/v-yinju/rqvae-zzx/data
# OUTPUT_DIR=/datain/v-yinju/rq-llama/v11/Games

# torchrun --nproc_per_node=8 pre-train.py \
#     --base_model $BASE_MODEL \
#     --item_model $ITEM_MODEL \
#     --user_model $USER_MODEL \
#     --output_dir $OUTPUT_DIR \
#     --dataset $DATASET \
#     --data_path $DATA_PATH \
#     --per_device_batch_size 6 \
#     --gradient_accumulation_steps 2 \
#     --learning_rate 5e-5 \
#     --epochs 4 \
#     --weight_decay 0.01 \
#     --save_and_eval_strategy epoch \
#     --deepspeed ./config/ds_z2_fp16.json \
#     --dataloader_num_workers 4 \
#     --only_train_response \
#     --tasks seqrec,itemsearch,inters2title,inters2description,preferenceobtain,item2index,index2item,intertitles2item,query2item,usersearch,user2pref,pref2user \
#     --train_prompt_sample_num 1,1,1,1,1,1,1,1,1,1,1,1 \
#     --train_data_sample_num 0,0,0,0,0,0,0,0,0,0,0,0 \
#     --index_file .index.json \
#     --user_index_file .user-index.json \
#     --fp16

# cd convert
# nohup ./convert.sh $OUTPUT_DIR >convert.log 2>&1 &
# cd ..