Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- arguments.yaml +16 -18
- environ.txt +2 -2
- script.sh +28 -29
- slice_1219/config.json +0 -0
- slice_1219/latest +1 -0
- slice_1219/preprocessor_config.json +28 -0
- slice_1219/processor_config.json +5 -0
- slice_1219/pytorch_model.bin +3 -0
- slice_1219/special_tokens_map.json +37 -0
- slice_1219/tokenizer.json +0 -0
- slice_1219/tokenizer_config.json +0 -0
- slice_1219/zero_to_fp32.py +760 -0
- slice_2438/config.json +0 -0
- slice_2438/latest +1 -0
- slice_2438/preprocessor_config.json +28 -0
- slice_2438/processor_config.json +5 -0
- slice_2438/pytorch_model.bin +3 -0
- slice_2438/special_tokens_map.json +37 -0
- slice_2438/tokenizer.json +0 -0
- slice_2438/tokenizer_config.json +0 -0
- slice_2438/zero_to_fp32.py +760 -0
- slice_3657/config.json +0 -0
- slice_3657/latest +1 -0
- slice_3657/preprocessor_config.json +28 -0
- slice_3657/processor_config.json +5 -0
- slice_3657/pytorch_model.bin +3 -0
- slice_3657/special_tokens_map.json +37 -0
- slice_3657/tokenizer.json +0 -0
- slice_3657/tokenizer_config.json +0 -0
- slice_3657/zero_to_fp32.py +760 -0
- slice_4876/17435091731.0/complex.json +212 -0
- slice_4876/17435091731.0/conv.json +212 -0
- slice_4876/17435091731.0/detail.json +212 -0
- slice_4876/Evaluation.log +23 -0
- slice_4876/config.json +0 -0
- slice_4876/preprocessor_config.json +28 -0
- slice_4876/processor_config.json +5 -0
- slice_4876/pytorch_model.bin +3 -0
- slice_4876/raw_outputs__aifs4su_yaodong_hantao_align-anything_outputs_chameleon_sft_top1-20_slice_4876.pkl +3 -0
- slice_4876/special_tokens_map.json +37 -0
- slice_4876/tokenizer.json +0 -0
- slice_4876/tokenizer_config.json +0 -0
- wandb/debug-internal.log +16 -16
- wandb/debug.log +30 -30
- wandb/run-20250331_122302-ihc2u2rd/files/output.log +3 -0
- wandb/run-20250331_122302-ihc2u2rd/files/requirements.txt +258 -0
- wandb/run-20250331_122302-ihc2u2rd/files/wandb-metadata.json +102 -0
- wandb/run-20250331_122302-ihc2u2rd/logs/debug-core.log +7 -0
- wandb/run-20250331_122302-ihc2u2rd/logs/debug-internal.log +7 -0
.gitattributes
CHANGED
|
@@ -36,3 +36,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
wandb/run-20250331_174515-0lcg01si/run-0lcg01si.wandb filter=lfs diff=lfs merge=lfs -text
|
| 37 |
wandb/run-20250329_013436-woy6qs03/run-woy6qs03.wandb filter=lfs diff=lfs merge=lfs -text
|
| 38 |
wandb/run-20250401_092824-bd2o51v8/run-bd2o51v8.wandb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 36 |
wandb/run-20250331_174515-0lcg01si/run-0lcg01si.wandb filter=lfs diff=lfs merge=lfs -text
|
| 37 |
wandb/run-20250329_013436-woy6qs03/run-woy6qs03.wandb filter=lfs diff=lfs merge=lfs -text
|
| 38 |
wandb/run-20250401_092824-bd2o51v8/run-bd2o51v8.wandb filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
wandb/run-20250331_122302-ihc2u2rd/run-ihc2u2rd.wandb filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
wandb/run-20250331_122755-sbnwzgn9/run-sbnwzgn9.wandb filter=lfs diff=lfs merge=lfs -text
|
arguments.yaml
CHANGED
|
@@ -6,48 +6,46 @@ data_cfgs:
|
|
| 6 |
eval_split: {}
|
| 7 |
eval_subset: {}
|
| 8 |
eval_template: {}
|
| 9 |
-
train_data_files:
|
| 10 |
-
train_datasets: /aifs4su/yaodong/hantao/datasets/
|
| 11 |
-
train_name:
|
| 12 |
train_optional_args: []
|
| 13 |
train_size: {}
|
| 14 |
-
train_split:
|
| 15 |
-
train_template:
|
| 16 |
logger_cfgs:
|
| 17 |
cache_dir: {}
|
| 18 |
log_project: align-anything
|
| 19 |
-
log_run_name:
|
| 20 |
log_type: wandb
|
| 21 |
-
output_dir: ../outputs/
|
| 22 |
-
save_total_limit:
|
| 23 |
model_cfgs:
|
| 24 |
model_max_length: 4096
|
| 25 |
-
model_name_or_path: /aifs4su/yaodong/hantao/models/
|
| 26 |
trust_remote_code: true
|
| 27 |
special_tokens: {}
|
| 28 |
train_cfgs:
|
| 29 |
adam_betas:
|
| 30 |
- 0.9
|
| 31 |
- 0.95
|
|
|
|
| 32 |
bf16: true
|
| 33 |
ds_cfgs: ds_z3_config.json
|
| 34 |
epochs: 3
|
| 35 |
-
eval_interval:
|
| 36 |
-
eval_strategy:
|
| 37 |
fp16: false
|
| 38 |
freeze_language_model: false
|
| 39 |
-
|
| 40 |
-
freeze_vision_tower: true
|
| 41 |
-
gradient_accumulation_steps: 1
|
| 42 |
gradient_checkpointing: true
|
| 43 |
-
learning_rate:
|
| 44 |
load_checkpoint: false
|
| 45 |
lr_scheduler_type: cosine
|
| 46 |
lr_warmup_ratio: 0.03
|
|
|
|
| 47 |
per_device_eval_batch_size: 1
|
| 48 |
per_device_train_batch_size: 1
|
| 49 |
-
|
| 50 |
-
save_checkpoint: false
|
| 51 |
-
scale_coeff: 0.1
|
| 52 |
seed: 42
|
| 53 |
weight_decay: 0.0
|
|
|
|
| 6 |
eval_split: {}
|
| 7 |
eval_subset: {}
|
| 8 |
eval_template: {}
|
| 9 |
+
train_data_files: pre_tokenized/train.pt
|
| 10 |
+
train_datasets: /aifs4su/yaodong/hantao/datasets/MMInstruct-GPT4V_mistral-7b_cosi_cut/merged/top1-20
|
| 11 |
+
train_name: {}
|
| 12 |
train_optional_args: []
|
| 13 |
train_size: {}
|
| 14 |
+
train_split: {}
|
| 15 |
+
train_template: {}
|
| 16 |
logger_cfgs:
|
| 17 |
cache_dir: {}
|
| 18 |
log_project: align-anything
|
| 19 |
+
log_run_name: sft
|
| 20 |
log_type: wandb
|
| 21 |
+
output_dir: ../outputs/chameleon_sft/top1-20
|
| 22 |
+
save_total_limit: 12
|
| 23 |
model_cfgs:
|
| 24 |
model_max_length: 4096
|
| 25 |
+
model_name_or_path: /aifs4su/yaodong/hantao/models/chameleon-7b-hf
|
| 26 |
trust_remote_code: true
|
| 27 |
special_tokens: {}
|
| 28 |
train_cfgs:
|
| 29 |
adam_betas:
|
| 30 |
- 0.9
|
| 31 |
- 0.95
|
| 32 |
+
adam_epsilon: 1.0e-08
|
| 33 |
bf16: true
|
| 34 |
ds_cfgs: ds_z3_config.json
|
| 35 |
epochs: 3
|
| 36 |
+
eval_interval: 1000
|
| 37 |
+
eval_strategy: steps
|
| 38 |
fp16: false
|
| 39 |
freeze_language_model: false
|
| 40 |
+
gradient_accumulation_steps: 16
|
|
|
|
|
|
|
| 41 |
gradient_checkpointing: true
|
| 42 |
+
learning_rate: 2.0e-05
|
| 43 |
load_checkpoint: false
|
| 44 |
lr_scheduler_type: cosine
|
| 45 |
lr_warmup_ratio: 0.03
|
| 46 |
+
max_grad_norm: 1.0
|
| 47 |
per_device_eval_batch_size: 1
|
| 48 |
per_device_train_batch_size: 1
|
| 49 |
+
save_checkpoint: true
|
|
|
|
|
|
|
| 50 |
seed: 42
|
| 51 |
weight_decay: 0.0
|
environ.txt
CHANGED
|
@@ -156,7 +156,7 @@ LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd
|
|
| 156 |
MANPATH=/usr/mpi/gcc/openmpi-4.1.7a1/share/man:/cm/shared/apps/slurm/current/man:/cm/local/apps/environment-modules/4.5.3/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/cm/local/apps/environment-modules/current/share/man:/cm/local/apps/environment-modules/current/share/man
|
| 157 |
MANPATH_modshare=/usr/local/share/man:1:/usr/mpi/gcc/openmpi-4.1.7a1/share/man:1:/cm/local/apps/environment-modules/current/share/man:1:/cm/local/apps/environment-modules/4.5.3/share/man:1:/usr/local/man:1:/usr/share/man:1:/cm/shared/apps/slurm/current/man:1
|
| 158 |
MASTER_ADDR=127.0.0.1
|
| 159 |
-
MASTER_PORT=
|
| 160 |
MIG_PARTED_CHECKPOINT_FILE=/var/lib/nvidia-mig-manager/checkpoint.json
|
| 161 |
MIG_PARTED_CONFIG_FILE=/etc/nvidia-mig-manager/config.yaml
|
| 162 |
MIG_PARTED_HOOKS_FILE=/etc/nvidia-mig-manager/hooks.yaml
|
|
@@ -205,7 +205,7 @@ VSCODE_GIT_ASKPASS_NODE=/home/yangyaodong/.vscode-server/cli/servers/Stable-e54c
|
|
| 205 |
VSCODE_GIT_IPC_HANDLE=/run/user/1028/vscode-git-bbbbf321f6.sock
|
| 206 |
VSCODE_IPC_HOOK_CLI=/run/user/1028/vscode-ipc-e2edf668-dca9-4331-a6ac-7d4507f653ce.sock
|
| 207 |
WANDB_API_KEY=7e2dcc0c310ebcb7cdcafd5e9320d6be55cf1a33
|
| 208 |
-
WANDB_SERVICE=2-
|
| 209 |
WORLD_SIZE=8
|
| 210 |
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
|
| 211 |
XDG_RUNTIME_DIR=/run/user/1028
|
|
|
|
| 156 |
MANPATH=/usr/mpi/gcc/openmpi-4.1.7a1/share/man:/cm/shared/apps/slurm/current/man:/cm/local/apps/environment-modules/4.5.3/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/cm/local/apps/environment-modules/current/share/man:/cm/local/apps/environment-modules/current/share/man
|
| 157 |
MANPATH_modshare=/usr/local/share/man:1:/usr/mpi/gcc/openmpi-4.1.7a1/share/man:1:/cm/local/apps/environment-modules/current/share/man:1:/cm/local/apps/environment-modules/4.5.3/share/man:1:/usr/local/man:1:/usr/share/man:1:/cm/shared/apps/slurm/current/man:1
|
| 158 |
MASTER_ADDR=127.0.0.1
|
| 159 |
+
MASTER_PORT=63047
|
| 160 |
MIG_PARTED_CHECKPOINT_FILE=/var/lib/nvidia-mig-manager/checkpoint.json
|
| 161 |
MIG_PARTED_CONFIG_FILE=/etc/nvidia-mig-manager/config.yaml
|
| 162 |
MIG_PARTED_HOOKS_FILE=/etc/nvidia-mig-manager/hooks.yaml
|
|
|
|
| 205 |
VSCODE_GIT_IPC_HANDLE=/run/user/1028/vscode-git-bbbbf321f6.sock
|
| 206 |
VSCODE_IPC_HOOK_CLI=/run/user/1028/vscode-ipc-e2edf668-dca9-4331-a6ac-7d4507f653ce.sock
|
| 207 |
WANDB_API_KEY=7e2dcc0c310ebcb7cdcafd5e9320d6be55cf1a33
|
| 208 |
+
WANDB_SERVICE=2-3667125-tcp-localhost-37113
|
| 209 |
WORLD_SIZE=8
|
| 210 |
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
|
| 211 |
XDG_RUNTIME_DIR=/run/user/1028
|
script.sh
CHANGED
|
@@ -15,37 +15,36 @@
|
|
| 15 |
# limitations under the License.
|
| 16 |
# ==============================================================================
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
MODEL_NAME_OR_PATH="/aifs4su/yaodong/hantao/models/llava-v1.6-vicuna-7b-hf" # model path
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
for DATASET_NAME in ${DATASETS_NAME[@]}; do
|
| 25 |
-
TRAIN_DATASETS="/
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
--output_dir ${OUTPUT_DIR} \
|
| 48 |
-
--save_total_limit 3 \
|
| 49 |
-
--train_batch_size 8 \
|
| 50 |
-
--epochs 3
|
| 51 |
done
|
|
|
|
| 15 |
# limitations under the License.
|
| 16 |
# ==============================================================================
|
| 17 |
|
| 18 |
+
MODEL_NAME_OR_PATH="/aifs4su/yaodong/hantao/models/chameleon-7b-hf" # model path
|
| 19 |
|
|
|
|
| 20 |
|
| 21 |
+
TRAIN_DATASETS_ROOT="/aifs4su/yaodong/hantao/datasets/MMInstruct-GPT4V_mistral-7b_cosi_cut/merged" # dataset path
|
| 22 |
+
|
| 23 |
+
DATASETS_NAME=("top1-20" "top1-80")
|
| 24 |
+
# DATASETS_NAME=("top1-20")
|
| 25 |
+
|
| 26 |
|
| 27 |
for DATASET_NAME in ${DATASETS_NAME[@]}; do
|
| 28 |
+
TRAIN_DATASETS="${TRAIN_DATASETS_ROOT}/${DATASET_NAME}" # dataset name
|
| 29 |
+
TRAIN_DATA_FILES="pre_tokenized/train.pt" # dataset name
|
| 30 |
+
|
| 31 |
+
OUTPUT_DIR="../outputs/chameleon_sft/${DATASET_NAME}" # output dir
|
| 32 |
+
|
| 33 |
+
# For wandb online logging
|
| 34 |
+
export WANDB_API_KEY="7e2dcc0c310ebcb7cdcafd5e9320d6be55cf1a33"
|
| 35 |
+
|
| 36 |
+
# Source the setup script
|
| 37 |
+
source ./setup.sh
|
| 38 |
+
|
| 39 |
+
# Execute deepspeed command
|
| 40 |
+
deepspeed \
|
| 41 |
+
--master_port ${MASTER_PORT} \
|
| 42 |
+
--module align_anything.trainers.text_image_to_text_image.sft \
|
| 43 |
+
--model_name_or_path ${MODEL_NAME_OR_PATH} \
|
| 44 |
+
--train_datasets ${TRAIN_DATASETS} \
|
| 45 |
+
--train_data_files ${TRAIN_DATA_FILES} \
|
| 46 |
+
--output_dir ${OUTPUT_DIR} \
|
| 47 |
+
--save_total_limit 12 \
|
| 48 |
+
--train_batch_size 16 \
|
| 49 |
+
--epochs 3
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
done
|
slice_1219/config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_1219/latest
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
global_step76
|
slice_1219/preprocessor_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": {
|
| 3 |
+
"height": 512,
|
| 4 |
+
"width": 512
|
| 5 |
+
},
|
| 6 |
+
"do_center_crop": true,
|
| 7 |
+
"do_convert_rgb": true,
|
| 8 |
+
"do_normalize": true,
|
| 9 |
+
"do_rescale": true,
|
| 10 |
+
"do_resize": true,
|
| 11 |
+
"image_mean": [
|
| 12 |
+
1.0,
|
| 13 |
+
1.0,
|
| 14 |
+
1.0
|
| 15 |
+
],
|
| 16 |
+
"image_processor_type": "ChameleonImageProcessor",
|
| 17 |
+
"image_std": [
|
| 18 |
+
1.0,
|
| 19 |
+
1.0,
|
| 20 |
+
1.0
|
| 21 |
+
],
|
| 22 |
+
"processor_class": "ChameleonProcessor",
|
| 23 |
+
"resample": 1,
|
| 24 |
+
"rescale_factor": 0.0078,
|
| 25 |
+
"size": {
|
| 26 |
+
"shortest_edge": 512
|
| 27 |
+
}
|
| 28 |
+
}
|
slice_1219/processor_config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_seq_length": 1024,
|
| 3 |
+
"image_token": "<image>",
|
| 4 |
+
"processor_class": "ChameleonProcessor"
|
| 5 |
+
}
|
slice_1219/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c34cfc54d1a896f55f21d02de32ba24f7fcbe4c98f10e3cbd983eb2ad562f2b1
|
| 3 |
+
size 14086364170
|
slice_1219/special_tokens_map.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<pad>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "<reserved08706>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "<unk>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
+
}
|
slice_1219/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_1219/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_1219/zero_to_fp32.py
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
|
| 3 |
+
# Copyright (c) Microsoft Corporation.
|
| 4 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 5 |
+
|
| 6 |
+
# DeepSpeed Team
|
| 7 |
+
|
| 8 |
+
# This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
|
| 9 |
+
# copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
|
| 10 |
+
# the future. Once extracted, the weights don't require DeepSpeed and can be used in any
|
| 11 |
+
# application.
|
| 12 |
+
#
|
| 13 |
+
# example:
|
| 14 |
+
# python zero_to_fp32.py . output_dir/
|
| 15 |
+
# or
|
| 16 |
+
# python zero_to_fp32.py . output_dir/ --safe_serialization
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import torch
|
| 20 |
+
import glob
|
| 21 |
+
import math
|
| 22 |
+
import os
|
| 23 |
+
import re
|
| 24 |
+
import gc
|
| 25 |
+
import json
|
| 26 |
+
import numpy as np
|
| 27 |
+
from tqdm import tqdm
|
| 28 |
+
from collections import OrderedDict
|
| 29 |
+
from dataclasses import dataclass
|
| 30 |
+
|
| 31 |
+
# while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
|
| 32 |
+
# DeepSpeed data structures it has to be available in the current python environment.
|
| 33 |
+
from deepspeed.utils import logger
|
| 34 |
+
from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
|
| 35 |
+
FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
|
| 36 |
+
FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
@dataclass
|
| 40 |
+
class zero_model_state:
|
| 41 |
+
buffers: dict()
|
| 42 |
+
param_shapes: dict()
|
| 43 |
+
shared_params: list
|
| 44 |
+
ds_version: int
|
| 45 |
+
frozen_param_shapes: dict()
|
| 46 |
+
frozen_param_fragments: dict()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
debug = 0
|
| 50 |
+
|
| 51 |
+
# load to cpu
|
| 52 |
+
device = torch.device('cpu')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def atoi(text):
|
| 56 |
+
return int(text) if text.isdigit() else text
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def natural_keys(text):
|
| 60 |
+
'''
|
| 61 |
+
alist.sort(key=natural_keys) sorts in human order
|
| 62 |
+
http://nedbatchelder.com/blog/200712/human_sorting.html
|
| 63 |
+
(See Toothy's implementation in the comments)
|
| 64 |
+
'''
|
| 65 |
+
return [atoi(c) for c in re.split(r'(\d+)', text)]
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def get_model_state_file(checkpoint_dir, zero_stage):
|
| 69 |
+
if not os.path.isdir(checkpoint_dir):
|
| 70 |
+
raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
|
| 71 |
+
|
| 72 |
+
# there should be only one file
|
| 73 |
+
if zero_stage <= 2:
|
| 74 |
+
file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
|
| 75 |
+
elif zero_stage == 3:
|
| 76 |
+
file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
|
| 77 |
+
|
| 78 |
+
if not os.path.exists(file):
|
| 79 |
+
raise FileNotFoundError(f"can't find model states file at '{file}'")
|
| 80 |
+
|
| 81 |
+
return file
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def get_checkpoint_files(checkpoint_dir, glob_pattern):
|
| 85 |
+
# XXX: need to test that this simple glob rule works for multi-node setup too
|
| 86 |
+
ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
|
| 87 |
+
|
| 88 |
+
if len(ckpt_files) == 0:
|
| 89 |
+
raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
|
| 90 |
+
|
| 91 |
+
return ckpt_files
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def get_optim_files(checkpoint_dir):
|
| 95 |
+
return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def get_model_state_files(checkpoint_dir):
|
| 99 |
+
return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def parse_model_states(files):
|
| 103 |
+
zero_model_states = []
|
| 104 |
+
for file in files:
|
| 105 |
+
state_dict = torch.load(file, map_location=device, weights_only=False)
|
| 106 |
+
|
| 107 |
+
if BUFFER_NAMES not in state_dict:
|
| 108 |
+
raise ValueError(f"{file} is not a model state checkpoint")
|
| 109 |
+
buffer_names = state_dict[BUFFER_NAMES]
|
| 110 |
+
if debug:
|
| 111 |
+
print("Found buffers:", buffer_names)
|
| 112 |
+
|
| 113 |
+
# recover just the buffers while restoring them to fp32 if they were saved in fp16
|
| 114 |
+
buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
|
| 115 |
+
param_shapes = state_dict[PARAM_SHAPES]
|
| 116 |
+
|
| 117 |
+
# collect parameters that are included in param_shapes
|
| 118 |
+
param_names = []
|
| 119 |
+
for s in param_shapes:
|
| 120 |
+
for name in s.keys():
|
| 121 |
+
param_names.append(name)
|
| 122 |
+
|
| 123 |
+
# update with frozen parameters
|
| 124 |
+
frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
|
| 125 |
+
if frozen_param_shapes is not None:
|
| 126 |
+
if debug:
|
| 127 |
+
print(f"Found frozen_param_shapes: {frozen_param_shapes}")
|
| 128 |
+
param_names += list(frozen_param_shapes.keys())
|
| 129 |
+
|
| 130 |
+
# handle shared params
|
| 131 |
+
shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
|
| 132 |
+
|
| 133 |
+
ds_version = state_dict.get(DS_VERSION, None)
|
| 134 |
+
|
| 135 |
+
frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
|
| 136 |
+
|
| 137 |
+
z_model_state = zero_model_state(buffers=buffers,
|
| 138 |
+
param_shapes=param_shapes,
|
| 139 |
+
shared_params=shared_params,
|
| 140 |
+
ds_version=ds_version,
|
| 141 |
+
frozen_param_shapes=frozen_param_shapes,
|
| 142 |
+
frozen_param_fragments=frozen_param_fragments)
|
| 143 |
+
zero_model_states.append(z_model_state)
|
| 144 |
+
|
| 145 |
+
return zero_model_states
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def parse_optim_states(files, ds_checkpoint_dir):
|
| 149 |
+
total_files = len(files)
|
| 150 |
+
state_dicts = []
|
| 151 |
+
for f in tqdm(files, desc='Loading checkpoint shards'):
|
| 152 |
+
state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
|
| 153 |
+
# immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
|
| 154 |
+
# and also handle the case where it was already removed by another helper script
|
| 155 |
+
state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
|
| 156 |
+
state_dicts.append(state_dict)
|
| 157 |
+
|
| 158 |
+
if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
|
| 159 |
+
raise ValueError(f"{files[0]} is not a zero checkpoint")
|
| 160 |
+
zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
|
| 161 |
+
world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
|
| 162 |
+
|
| 163 |
+
# For ZeRO-2 each param group can have different partition_count as data parallelism for expert
|
| 164 |
+
# parameters can be different from data parallelism for non-expert parameters. So we can just
|
| 165 |
+
# use the max of the partition_count to get the dp world_size.
|
| 166 |
+
|
| 167 |
+
if type(world_size) is list:
|
| 168 |
+
world_size = max(world_size)
|
| 169 |
+
|
| 170 |
+
if world_size != total_files:
|
| 171 |
+
raise ValueError(
|
| 172 |
+
f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
|
| 173 |
+
"Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
# the groups are named differently in each stage
|
| 177 |
+
if zero_stage <= 2:
|
| 178 |
+
fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
|
| 179 |
+
elif zero_stage == 3:
|
| 180 |
+
fp32_groups_key = FP32_FLAT_GROUPS
|
| 181 |
+
else:
|
| 182 |
+
raise ValueError(f"unknown zero stage {zero_stage}")
|
| 183 |
+
|
| 184 |
+
fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
|
| 185 |
+
return zero_stage, world_size, fp32_flat_groups
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
|
| 189 |
+
"""
|
| 190 |
+
Returns fp32 state_dict reconstructed from ds checkpoint
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
- ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
|
| 194 |
+
|
| 195 |
+
"""
|
| 196 |
+
print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
|
| 197 |
+
|
| 198 |
+
optim_files = get_optim_files(ds_checkpoint_dir)
|
| 199 |
+
zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
|
| 200 |
+
print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
|
| 201 |
+
|
| 202 |
+
model_files = get_model_state_files(ds_checkpoint_dir)
|
| 203 |
+
|
| 204 |
+
zero_model_states = parse_model_states(model_files)
|
| 205 |
+
print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
|
| 206 |
+
|
| 207 |
+
if zero_stage <= 2:
|
| 208 |
+
return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 209 |
+
exclude_frozen_parameters)
|
| 210 |
+
elif zero_stage == 3:
|
| 211 |
+
return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 212 |
+
exclude_frozen_parameters)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def _zero2_merge_frozen_params(state_dict, zero_model_states):
|
| 216 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 217 |
+
return
|
| 218 |
+
|
| 219 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 220 |
+
frozen_param_fragments = zero_model_states[0].frozen_param_fragments
|
| 221 |
+
|
| 222 |
+
if debug:
|
| 223 |
+
num_elem = sum(s.numel() for s in frozen_param_shapes.values())
|
| 224 |
+
print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 225 |
+
|
| 226 |
+
wanted_params = len(frozen_param_shapes)
|
| 227 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 228 |
+
avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
|
| 229 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 230 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 231 |
+
|
| 232 |
+
total_params = 0
|
| 233 |
+
total_numel = 0
|
| 234 |
+
for name, shape in frozen_param_shapes.items():
|
| 235 |
+
total_params += 1
|
| 236 |
+
unpartitioned_numel = shape.numel()
|
| 237 |
+
total_numel += unpartitioned_numel
|
| 238 |
+
|
| 239 |
+
state_dict[name] = frozen_param_fragments[name]
|
| 240 |
+
|
| 241 |
+
if debug:
|
| 242 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 243 |
+
|
| 244 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
def _has_callable(obj, fn):
|
| 248 |
+
attr = getattr(obj, fn, None)
|
| 249 |
+
return callable(attr)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 253 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 254 |
+
|
| 255 |
+
# Reconstruction protocol:
|
| 256 |
+
#
|
| 257 |
+
# XXX: document this
|
| 258 |
+
|
| 259 |
+
if debug:
|
| 260 |
+
for i in range(world_size):
|
| 261 |
+
for j in range(len(fp32_flat_groups[0])):
|
| 262 |
+
print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
|
| 263 |
+
|
| 264 |
+
# XXX: memory usage doubles here (zero2)
|
| 265 |
+
num_param_groups = len(fp32_flat_groups[0])
|
| 266 |
+
merged_single_partition_of_fp32_groups = []
|
| 267 |
+
for i in range(num_param_groups):
|
| 268 |
+
merged_partitions = [sd[i] for sd in fp32_flat_groups]
|
| 269 |
+
full_single_fp32_vector = torch.cat(merged_partitions, 0)
|
| 270 |
+
merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
|
| 271 |
+
avail_numel = sum(
|
| 272 |
+
[full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
|
| 273 |
+
|
| 274 |
+
if debug:
|
| 275 |
+
wanted_params = sum([len(shapes) for shapes in param_shapes])
|
| 276 |
+
wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
|
| 277 |
+
# not asserting if there is a mismatch due to possible padding
|
| 278 |
+
print(f"Have {avail_numel} numels to process.")
|
| 279 |
+
print(f"Need {wanted_numel} numels in {wanted_params} params.")
|
| 280 |
+
|
| 281 |
+
# params
|
| 282 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 283 |
+
# out-of-core computing solution
|
| 284 |
+
total_numel = 0
|
| 285 |
+
total_params = 0
|
| 286 |
+
for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
|
| 287 |
+
offset = 0
|
| 288 |
+
avail_numel = full_single_fp32_vector.numel()
|
| 289 |
+
for name, shape in shapes.items():
|
| 290 |
+
|
| 291 |
+
unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
|
| 292 |
+
total_numel += unpartitioned_numel
|
| 293 |
+
total_params += 1
|
| 294 |
+
|
| 295 |
+
if debug:
|
| 296 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 297 |
+
state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
|
| 298 |
+
offset += unpartitioned_numel
|
| 299 |
+
|
| 300 |
+
# Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
|
| 301 |
+
# avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
|
| 302 |
+
# paddings performed in the code it's almost impossible to predict the exact numbers w/o the
|
| 303 |
+
# live optimizer object, so we are checking that the numbers are within the right range
|
| 304 |
+
align_to = 2 * world_size
|
| 305 |
+
|
| 306 |
+
def zero2_align(x):
|
| 307 |
+
return align_to * math.ceil(x / align_to)
|
| 308 |
+
|
| 309 |
+
if debug:
|
| 310 |
+
print(f"original offset={offset}, avail_numel={avail_numel}")
|
| 311 |
+
|
| 312 |
+
offset = zero2_align(offset)
|
| 313 |
+
avail_numel = zero2_align(avail_numel)
|
| 314 |
+
|
| 315 |
+
if debug:
|
| 316 |
+
print(f"aligned offset={offset}, avail_numel={avail_numel}")
|
| 317 |
+
|
| 318 |
+
# Sanity check
|
| 319 |
+
if offset != avail_numel:
|
| 320 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 321 |
+
|
| 322 |
+
print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 326 |
+
exclude_frozen_parameters):
|
| 327 |
+
state_dict = OrderedDict()
|
| 328 |
+
|
| 329 |
+
# buffers
|
| 330 |
+
buffers = zero_model_states[0].buffers
|
| 331 |
+
state_dict.update(buffers)
|
| 332 |
+
if debug:
|
| 333 |
+
print(f"added {len(buffers)} buffers")
|
| 334 |
+
|
| 335 |
+
if not exclude_frozen_parameters:
|
| 336 |
+
_zero2_merge_frozen_params(state_dict, zero_model_states)
|
| 337 |
+
|
| 338 |
+
_zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 339 |
+
|
| 340 |
+
# recover shared parameters
|
| 341 |
+
for pair in zero_model_states[0].shared_params:
|
| 342 |
+
if pair[1] in state_dict:
|
| 343 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 344 |
+
|
| 345 |
+
return state_dict
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
def zero3_partitioned_param_info(unpartitioned_numel, world_size):
|
| 349 |
+
remainder = unpartitioned_numel % world_size
|
| 350 |
+
padding_numel = (world_size - remainder) if remainder else 0
|
| 351 |
+
partitioned_numel = math.ceil(unpartitioned_numel / world_size)
|
| 352 |
+
return partitioned_numel, padding_numel
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
|
| 356 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 357 |
+
return
|
| 358 |
+
|
| 359 |
+
if debug:
|
| 360 |
+
for i in range(world_size):
|
| 361 |
+
num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
|
| 362 |
+
print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 363 |
+
|
| 364 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 365 |
+
wanted_params = len(frozen_param_shapes)
|
| 366 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 367 |
+
avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
|
| 368 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 369 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 370 |
+
|
| 371 |
+
total_params = 0
|
| 372 |
+
total_numel = 0
|
| 373 |
+
for name, shape in zero_model_states[0].frozen_param_shapes.items():
|
| 374 |
+
total_params += 1
|
| 375 |
+
unpartitioned_numel = shape.numel()
|
| 376 |
+
total_numel += unpartitioned_numel
|
| 377 |
+
|
| 378 |
+
param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
|
| 379 |
+
state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
|
| 380 |
+
|
| 381 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 382 |
+
|
| 383 |
+
if debug:
|
| 384 |
+
print(
|
| 385 |
+
f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
class GatheredTensor:
|
| 392 |
+
"""
|
| 393 |
+
A pseudo tensor that collects partitioned weights.
|
| 394 |
+
It is more memory efficient when there are multiple groups.
|
| 395 |
+
"""
|
| 396 |
+
|
| 397 |
+
def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
|
| 398 |
+
self.flat_groups = flat_groups
|
| 399 |
+
self.flat_groups_offset = flat_groups_offset
|
| 400 |
+
self.offset = offset
|
| 401 |
+
self.partitioned_numel = partitioned_numel
|
| 402 |
+
self.shape = shape
|
| 403 |
+
self.dtype = self.flat_groups[0][0].dtype
|
| 404 |
+
|
| 405 |
+
def contiguous(self):
|
| 406 |
+
"""
|
| 407 |
+
Merge partitioned weights from flat_groups into a single tensor.
|
| 408 |
+
"""
|
| 409 |
+
end_idx = self.offset + self.partitioned_numel
|
| 410 |
+
world_size = len(self.flat_groups)
|
| 411 |
+
pad_flat_param_chunks = []
|
| 412 |
+
|
| 413 |
+
for rank_i in range(world_size):
|
| 414 |
+
# for each rank, we need to collect weights from related group/groups
|
| 415 |
+
flat_groups_at_rank_i = self.flat_groups[rank_i]
|
| 416 |
+
start_group_id = None
|
| 417 |
+
end_group_id = None
|
| 418 |
+
for group_id in range(len(self.flat_groups_offset)):
|
| 419 |
+
if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
|
| 420 |
+
start_group_id = group_id
|
| 421 |
+
if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
|
| 422 |
+
end_group_id = group_id
|
| 423 |
+
break
|
| 424 |
+
# collect weights from related group/groups
|
| 425 |
+
for group_id in range(start_group_id, end_group_id + 1):
|
| 426 |
+
flat_tensor = flat_groups_at_rank_i[group_id]
|
| 427 |
+
start_offset = self.offset - self.flat_groups_offset[group_id]
|
| 428 |
+
end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
|
| 429 |
+
pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
|
| 430 |
+
|
| 431 |
+
# collect weights from all ranks
|
| 432 |
+
pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
|
| 433 |
+
param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
|
| 434 |
+
return param
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 438 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 439 |
+
avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
|
| 440 |
+
|
| 441 |
+
# Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
|
| 442 |
+
# param, re-consolidating each param, while dealing with padding if any
|
| 443 |
+
|
| 444 |
+
# merge list of dicts, preserving order
|
| 445 |
+
param_shapes = {k: v for d in param_shapes for k, v in d.items()}
|
| 446 |
+
|
| 447 |
+
if debug:
|
| 448 |
+
for i in range(world_size):
|
| 449 |
+
print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
|
| 450 |
+
|
| 451 |
+
wanted_params = len(param_shapes)
|
| 452 |
+
wanted_numel = sum(shape.numel() for shape in param_shapes.values())
|
| 453 |
+
# not asserting if there is a mismatch due to possible padding
|
| 454 |
+
avail_numel = fp32_flat_groups[0].numel() * world_size
|
| 455 |
+
print(f"Trainable params: Have {avail_numel} numels to process.")
|
| 456 |
+
print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
|
| 457 |
+
|
| 458 |
+
# params
|
| 459 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 460 |
+
# out-of-core computing solution
|
| 461 |
+
offset = 0
|
| 462 |
+
total_numel = 0
|
| 463 |
+
total_params = 0
|
| 464 |
+
flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
|
| 465 |
+
for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
|
| 466 |
+
unpartitioned_numel = shape.numel()
|
| 467 |
+
total_numel += unpartitioned_numel
|
| 468 |
+
total_params += 1
|
| 469 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 470 |
+
|
| 471 |
+
if debug:
|
| 472 |
+
print(
|
| 473 |
+
f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 474 |
+
)
|
| 475 |
+
|
| 476 |
+
# memory efficient tensor
|
| 477 |
+
tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
|
| 478 |
+
state_dict[name] = tensor
|
| 479 |
+
offset += partitioned_numel
|
| 480 |
+
|
| 481 |
+
offset *= world_size
|
| 482 |
+
|
| 483 |
+
# Sanity check
|
| 484 |
+
if offset != avail_numel:
|
| 485 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 486 |
+
|
| 487 |
+
print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 491 |
+
exclude_frozen_parameters):
|
| 492 |
+
state_dict = OrderedDict()
|
| 493 |
+
|
| 494 |
+
# buffers
|
| 495 |
+
buffers = zero_model_states[0].buffers
|
| 496 |
+
state_dict.update(buffers)
|
| 497 |
+
if debug:
|
| 498 |
+
print(f"added {len(buffers)} buffers")
|
| 499 |
+
|
| 500 |
+
if not exclude_frozen_parameters:
|
| 501 |
+
_zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
|
| 502 |
+
|
| 503 |
+
_zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 504 |
+
|
| 505 |
+
# recover shared parameters
|
| 506 |
+
for pair in zero_model_states[0].shared_params:
|
| 507 |
+
if pair[1] in state_dict:
|
| 508 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 509 |
+
|
| 510 |
+
return state_dict
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
def to_torch_tensor(state_dict, return_empty_tensor=False):
|
| 514 |
+
"""
|
| 515 |
+
Convert state_dict of GatheredTensor to torch tensor
|
| 516 |
+
"""
|
| 517 |
+
torch_state_dict = {}
|
| 518 |
+
converted_tensors = {}
|
| 519 |
+
for name, tensor in state_dict.items():
|
| 520 |
+
tensor_id = id(tensor)
|
| 521 |
+
if tensor_id in converted_tensors: # shared tensors
|
| 522 |
+
shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
|
| 523 |
+
torch_state_dict[name] = shared_tensor
|
| 524 |
+
else:
|
| 525 |
+
converted_tensors[tensor_id] = name
|
| 526 |
+
if return_empty_tensor:
|
| 527 |
+
torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
|
| 528 |
+
else:
|
| 529 |
+
torch_state_dict[name] = tensor.contiguous()
|
| 530 |
+
return torch_state_dict
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 534 |
+
tag=None,
|
| 535 |
+
exclude_frozen_parameters=False,
|
| 536 |
+
lazy_mode=False):
|
| 537 |
+
"""
|
| 538 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
|
| 539 |
+
``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
|
| 540 |
+
via a model hub.
|
| 541 |
+
|
| 542 |
+
Args:
|
| 543 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder
|
| 544 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
|
| 545 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 546 |
+
- ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
|
| 547 |
+
Convert the pesduo tensor to torch tensor by ``.contiguous()``
|
| 548 |
+
|
| 549 |
+
Returns:
|
| 550 |
+
- pytorch ``state_dict``
|
| 551 |
+
|
| 552 |
+
A typical usage might be ::
|
| 553 |
+
|
| 554 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 555 |
+
# do the training and checkpoint saving
|
| 556 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
|
| 557 |
+
model = model.cpu() # move to cpu
|
| 558 |
+
model.load_state_dict(state_dict)
|
| 559 |
+
# submit to model hub or save the model to share with others
|
| 560 |
+
|
| 561 |
+
In this example the ``model`` will no longer be usable in the deepspeed context of the same
|
| 562 |
+
application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 563 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 564 |
+
|
| 565 |
+
If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
|
| 566 |
+
|
| 567 |
+
Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
|
| 568 |
+
You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
|
| 569 |
+
the checkpoint. Or you can load state_dict in lazy mode ::
|
| 570 |
+
|
| 571 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 572 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
|
| 573 |
+
for name, lazy_tensor in state_dict.item():
|
| 574 |
+
tensor = lazy_tensor.contiguous() # to cpu
|
| 575 |
+
print(name, tensor)
|
| 576 |
+
# del tensor to release memory if it no longer in use
|
| 577 |
+
"""
|
| 578 |
+
if tag is None:
|
| 579 |
+
latest_path = os.path.join(checkpoint_dir, 'latest')
|
| 580 |
+
if os.path.isfile(latest_path):
|
| 581 |
+
with open(latest_path, 'r') as fd:
|
| 582 |
+
tag = fd.read().strip()
|
| 583 |
+
else:
|
| 584 |
+
raise ValueError(f"Unable to find 'latest' file at {latest_path}")
|
| 585 |
+
|
| 586 |
+
ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
|
| 587 |
+
|
| 588 |
+
if not os.path.isdir(ds_checkpoint_dir):
|
| 589 |
+
raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
|
| 590 |
+
|
| 591 |
+
state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
|
| 592 |
+
if lazy_mode:
|
| 593 |
+
return state_dict
|
| 594 |
+
else:
|
| 595 |
+
return to_torch_tensor(state_dict)
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
|
| 599 |
+
output_dir,
|
| 600 |
+
max_shard_size="5GB",
|
| 601 |
+
safe_serialization=False,
|
| 602 |
+
tag=None,
|
| 603 |
+
exclude_frozen_parameters=False):
|
| 604 |
+
"""
|
| 605 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
|
| 606 |
+
loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
|
| 607 |
+
|
| 608 |
+
Args:
|
| 609 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 610 |
+
- ``output_dir``: directory to the pytorch fp32 state_dict output files
|
| 611 |
+
- ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
|
| 612 |
+
- ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
|
| 613 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 614 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 615 |
+
"""
|
| 616 |
+
|
| 617 |
+
# Dependency pre-check
|
| 618 |
+
if safe_serialization:
|
| 619 |
+
try:
|
| 620 |
+
from safetensors.torch import save_file
|
| 621 |
+
except ImportError:
|
| 622 |
+
print('If you want to use `safe_serialization`, please `pip install safetensors`')
|
| 623 |
+
raise
|
| 624 |
+
if max_shard_size is not None:
|
| 625 |
+
try:
|
| 626 |
+
from huggingface_hub import split_torch_state_dict_into_shards
|
| 627 |
+
except ImportError:
|
| 628 |
+
print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
|
| 629 |
+
raise
|
| 630 |
+
|
| 631 |
+
# Convert zero checkpoint to state_dict
|
| 632 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 633 |
+
tag,
|
| 634 |
+
exclude_frozen_parameters,
|
| 635 |
+
lazy_mode=True)
|
| 636 |
+
|
| 637 |
+
# Shard the model if it is too big.
|
| 638 |
+
weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
|
| 639 |
+
if max_shard_size is not None:
|
| 640 |
+
filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
|
| 641 |
+
# an memory-efficient approach for sharding
|
| 642 |
+
empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
|
| 643 |
+
state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
|
| 644 |
+
filename_pattern=filename_pattern,
|
| 645 |
+
max_shard_size=max_shard_size)
|
| 646 |
+
else:
|
| 647 |
+
from collections import namedtuple
|
| 648 |
+
StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
|
| 649 |
+
state_dict_split = StateDictSplit(is_sharded=False,
|
| 650 |
+
filename_to_tensors={weights_name: list(state_dict.keys())})
|
| 651 |
+
|
| 652 |
+
# Save the model by shard
|
| 653 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 654 |
+
filename_to_tensors = state_dict_split.filename_to_tensors.items()
|
| 655 |
+
for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
|
| 656 |
+
shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
|
| 657 |
+
shard_state_dict = to_torch_tensor(shard_state_dict)
|
| 658 |
+
output_path = os.path.join(output_dir, shard_file)
|
| 659 |
+
if safe_serialization:
|
| 660 |
+
save_file(shard_state_dict, output_path, metadata={"format": "pt"})
|
| 661 |
+
else:
|
| 662 |
+
torch.save(shard_state_dict, output_path)
|
| 663 |
+
# release the memory of current shard
|
| 664 |
+
for tensor_name in list(shard_state_dict.keys()):
|
| 665 |
+
del state_dict[tensor_name]
|
| 666 |
+
del shard_state_dict[tensor_name]
|
| 667 |
+
del shard_state_dict
|
| 668 |
+
gc.collect()
|
| 669 |
+
|
| 670 |
+
# Save index if sharded
|
| 671 |
+
if state_dict_split.is_sharded:
|
| 672 |
+
index = {
|
| 673 |
+
"metadata": state_dict_split.metadata,
|
| 674 |
+
"weight_map": state_dict_split.tensor_to_filename,
|
| 675 |
+
}
|
| 676 |
+
save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
|
| 677 |
+
save_index_file = os.path.join(output_dir, save_index_file)
|
| 678 |
+
with open(save_index_file, "w", encoding="utf-8") as f:
|
| 679 |
+
content = json.dumps(index, indent=2, sort_keys=True) + "\n"
|
| 680 |
+
f.write(content)
|
| 681 |
+
|
| 682 |
+
|
| 683 |
+
def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
|
| 684 |
+
"""
|
| 685 |
+
1. Put the provided model to cpu
|
| 686 |
+
2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
|
| 687 |
+
3. Load it into the provided model
|
| 688 |
+
|
| 689 |
+
Args:
|
| 690 |
+
- ``model``: the model object to update
|
| 691 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 692 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 693 |
+
|
| 694 |
+
Returns:
|
| 695 |
+
- ``model`: modified model
|
| 696 |
+
|
| 697 |
+
Make sure you have plenty of CPU memory available before you call this function. If you don't
|
| 698 |
+
have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
|
| 699 |
+
conveniently placed for you in the checkpoint folder.
|
| 700 |
+
|
| 701 |
+
A typical usage might be ::
|
| 702 |
+
|
| 703 |
+
from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
|
| 704 |
+
model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
|
| 705 |
+
# submit to model hub or save the model to share with others
|
| 706 |
+
|
| 707 |
+
Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
|
| 708 |
+
of the same application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 709 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 710 |
+
|
| 711 |
+
"""
|
| 712 |
+
logger.info(f"Extracting fp32 weights")
|
| 713 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
| 714 |
+
|
| 715 |
+
logger.info(f"Overwriting model with fp32 weights")
|
| 716 |
+
model = model.cpu()
|
| 717 |
+
model.load_state_dict(state_dict, strict=False)
|
| 718 |
+
|
| 719 |
+
return model
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
if __name__ == "__main__":
|
| 723 |
+
parser = argparse.ArgumentParser()
|
| 724 |
+
parser.add_argument("checkpoint_dir",
|
| 725 |
+
type=str,
|
| 726 |
+
help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
|
| 727 |
+
parser.add_argument("output_dir",
|
| 728 |
+
type=str,
|
| 729 |
+
help="directory to the pytorch fp32 state_dict output files"
|
| 730 |
+
"(e.g. path/checkpoint-12-output/)")
|
| 731 |
+
parser.add_argument(
|
| 732 |
+
"--max_shard_size",
|
| 733 |
+
type=str,
|
| 734 |
+
default="5GB",
|
| 735 |
+
help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
|
| 736 |
+
"lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
|
| 737 |
+
"We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
|
| 738 |
+
"without CPU OOM issues.")
|
| 739 |
+
parser.add_argument(
|
| 740 |
+
"--safe_serialization",
|
| 741 |
+
default=False,
|
| 742 |
+
action='store_true',
|
| 743 |
+
help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
|
| 744 |
+
parser.add_argument("-t",
|
| 745 |
+
"--tag",
|
| 746 |
+
type=str,
|
| 747 |
+
default=None,
|
| 748 |
+
help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
|
| 749 |
+
parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
|
| 750 |
+
parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
|
| 751 |
+
args = parser.parse_args()
|
| 752 |
+
|
| 753 |
+
debug = args.debug
|
| 754 |
+
|
| 755 |
+
convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
|
| 756 |
+
args.output_dir,
|
| 757 |
+
max_shard_size=args.max_shard_size,
|
| 758 |
+
safe_serialization=args.safe_serialization,
|
| 759 |
+
tag=args.tag,
|
| 760 |
+
exclude_frozen_parameters=args.exclude_frozen_parameters)
|
slice_2438/config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_2438/latest
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
global_step152
|
slice_2438/preprocessor_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": {
|
| 3 |
+
"height": 512,
|
| 4 |
+
"width": 512
|
| 5 |
+
},
|
| 6 |
+
"do_center_crop": true,
|
| 7 |
+
"do_convert_rgb": true,
|
| 8 |
+
"do_normalize": true,
|
| 9 |
+
"do_rescale": true,
|
| 10 |
+
"do_resize": true,
|
| 11 |
+
"image_mean": [
|
| 12 |
+
1.0,
|
| 13 |
+
1.0,
|
| 14 |
+
1.0
|
| 15 |
+
],
|
| 16 |
+
"image_processor_type": "ChameleonImageProcessor",
|
| 17 |
+
"image_std": [
|
| 18 |
+
1.0,
|
| 19 |
+
1.0,
|
| 20 |
+
1.0
|
| 21 |
+
],
|
| 22 |
+
"processor_class": "ChameleonProcessor",
|
| 23 |
+
"resample": 1,
|
| 24 |
+
"rescale_factor": 0.0078,
|
| 25 |
+
"size": {
|
| 26 |
+
"shortest_edge": 512
|
| 27 |
+
}
|
| 28 |
+
}
|
slice_2438/processor_config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_seq_length": 1024,
|
| 3 |
+
"image_token": "<image>",
|
| 4 |
+
"processor_class": "ChameleonProcessor"
|
| 5 |
+
}
|
slice_2438/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6194fbc263562d1e15a078a30e9561bfb7c1655542ae2dfdf5084123d5327bf2
|
| 3 |
+
size 14086364170
|
slice_2438/special_tokens_map.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<pad>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "<reserved08706>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "<unk>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
+
}
|
slice_2438/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_2438/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_2438/zero_to_fp32.py
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
|
| 3 |
+
# Copyright (c) Microsoft Corporation.
|
| 4 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 5 |
+
|
| 6 |
+
# DeepSpeed Team
|
| 7 |
+
|
| 8 |
+
# This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
|
| 9 |
+
# copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
|
| 10 |
+
# the future. Once extracted, the weights don't require DeepSpeed and can be used in any
|
| 11 |
+
# application.
|
| 12 |
+
#
|
| 13 |
+
# example:
|
| 14 |
+
# python zero_to_fp32.py . output_dir/
|
| 15 |
+
# or
|
| 16 |
+
# python zero_to_fp32.py . output_dir/ --safe_serialization
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import torch
|
| 20 |
+
import glob
|
| 21 |
+
import math
|
| 22 |
+
import os
|
| 23 |
+
import re
|
| 24 |
+
import gc
|
| 25 |
+
import json
|
| 26 |
+
import numpy as np
|
| 27 |
+
from tqdm import tqdm
|
| 28 |
+
from collections import OrderedDict
|
| 29 |
+
from dataclasses import dataclass
|
| 30 |
+
|
| 31 |
+
# while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
|
| 32 |
+
# DeepSpeed data structures it has to be available in the current python environment.
|
| 33 |
+
from deepspeed.utils import logger
|
| 34 |
+
from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
|
| 35 |
+
FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
|
| 36 |
+
FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
@dataclass
|
| 40 |
+
class zero_model_state:
|
| 41 |
+
buffers: dict()
|
| 42 |
+
param_shapes: dict()
|
| 43 |
+
shared_params: list
|
| 44 |
+
ds_version: int
|
| 45 |
+
frozen_param_shapes: dict()
|
| 46 |
+
frozen_param_fragments: dict()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
debug = 0
|
| 50 |
+
|
| 51 |
+
# load to cpu
|
| 52 |
+
device = torch.device('cpu')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def atoi(text):
|
| 56 |
+
return int(text) if text.isdigit() else text
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def natural_keys(text):
|
| 60 |
+
'''
|
| 61 |
+
alist.sort(key=natural_keys) sorts in human order
|
| 62 |
+
http://nedbatchelder.com/blog/200712/human_sorting.html
|
| 63 |
+
(See Toothy's implementation in the comments)
|
| 64 |
+
'''
|
| 65 |
+
return [atoi(c) for c in re.split(r'(\d+)', text)]
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def get_model_state_file(checkpoint_dir, zero_stage):
|
| 69 |
+
if not os.path.isdir(checkpoint_dir):
|
| 70 |
+
raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
|
| 71 |
+
|
| 72 |
+
# there should be only one file
|
| 73 |
+
if zero_stage <= 2:
|
| 74 |
+
file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
|
| 75 |
+
elif zero_stage == 3:
|
| 76 |
+
file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
|
| 77 |
+
|
| 78 |
+
if not os.path.exists(file):
|
| 79 |
+
raise FileNotFoundError(f"can't find model states file at '{file}'")
|
| 80 |
+
|
| 81 |
+
return file
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def get_checkpoint_files(checkpoint_dir, glob_pattern):
|
| 85 |
+
# XXX: need to test that this simple glob rule works for multi-node setup too
|
| 86 |
+
ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
|
| 87 |
+
|
| 88 |
+
if len(ckpt_files) == 0:
|
| 89 |
+
raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
|
| 90 |
+
|
| 91 |
+
return ckpt_files
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def get_optim_files(checkpoint_dir):
|
| 95 |
+
return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def get_model_state_files(checkpoint_dir):
|
| 99 |
+
return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def parse_model_states(files):
|
| 103 |
+
zero_model_states = []
|
| 104 |
+
for file in files:
|
| 105 |
+
state_dict = torch.load(file, map_location=device, weights_only=False)
|
| 106 |
+
|
| 107 |
+
if BUFFER_NAMES not in state_dict:
|
| 108 |
+
raise ValueError(f"{file} is not a model state checkpoint")
|
| 109 |
+
buffer_names = state_dict[BUFFER_NAMES]
|
| 110 |
+
if debug:
|
| 111 |
+
print("Found buffers:", buffer_names)
|
| 112 |
+
|
| 113 |
+
# recover just the buffers while restoring them to fp32 if they were saved in fp16
|
| 114 |
+
buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
|
| 115 |
+
param_shapes = state_dict[PARAM_SHAPES]
|
| 116 |
+
|
| 117 |
+
# collect parameters that are included in param_shapes
|
| 118 |
+
param_names = []
|
| 119 |
+
for s in param_shapes:
|
| 120 |
+
for name in s.keys():
|
| 121 |
+
param_names.append(name)
|
| 122 |
+
|
| 123 |
+
# update with frozen parameters
|
| 124 |
+
frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
|
| 125 |
+
if frozen_param_shapes is not None:
|
| 126 |
+
if debug:
|
| 127 |
+
print(f"Found frozen_param_shapes: {frozen_param_shapes}")
|
| 128 |
+
param_names += list(frozen_param_shapes.keys())
|
| 129 |
+
|
| 130 |
+
# handle shared params
|
| 131 |
+
shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
|
| 132 |
+
|
| 133 |
+
ds_version = state_dict.get(DS_VERSION, None)
|
| 134 |
+
|
| 135 |
+
frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
|
| 136 |
+
|
| 137 |
+
z_model_state = zero_model_state(buffers=buffers,
|
| 138 |
+
param_shapes=param_shapes,
|
| 139 |
+
shared_params=shared_params,
|
| 140 |
+
ds_version=ds_version,
|
| 141 |
+
frozen_param_shapes=frozen_param_shapes,
|
| 142 |
+
frozen_param_fragments=frozen_param_fragments)
|
| 143 |
+
zero_model_states.append(z_model_state)
|
| 144 |
+
|
| 145 |
+
return zero_model_states
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def parse_optim_states(files, ds_checkpoint_dir):
|
| 149 |
+
total_files = len(files)
|
| 150 |
+
state_dicts = []
|
| 151 |
+
for f in tqdm(files, desc='Loading checkpoint shards'):
|
| 152 |
+
state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
|
| 153 |
+
# immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
|
| 154 |
+
# and also handle the case where it was already removed by another helper script
|
| 155 |
+
state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
|
| 156 |
+
state_dicts.append(state_dict)
|
| 157 |
+
|
| 158 |
+
if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
|
| 159 |
+
raise ValueError(f"{files[0]} is not a zero checkpoint")
|
| 160 |
+
zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
|
| 161 |
+
world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
|
| 162 |
+
|
| 163 |
+
# For ZeRO-2 each param group can have different partition_count as data parallelism for expert
|
| 164 |
+
# parameters can be different from data parallelism for non-expert parameters. So we can just
|
| 165 |
+
# use the max of the partition_count to get the dp world_size.
|
| 166 |
+
|
| 167 |
+
if type(world_size) is list:
|
| 168 |
+
world_size = max(world_size)
|
| 169 |
+
|
| 170 |
+
if world_size != total_files:
|
| 171 |
+
raise ValueError(
|
| 172 |
+
f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
|
| 173 |
+
"Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
# the groups are named differently in each stage
|
| 177 |
+
if zero_stage <= 2:
|
| 178 |
+
fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
|
| 179 |
+
elif zero_stage == 3:
|
| 180 |
+
fp32_groups_key = FP32_FLAT_GROUPS
|
| 181 |
+
else:
|
| 182 |
+
raise ValueError(f"unknown zero stage {zero_stage}")
|
| 183 |
+
|
| 184 |
+
fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
|
| 185 |
+
return zero_stage, world_size, fp32_flat_groups
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
|
| 189 |
+
"""
|
| 190 |
+
Returns fp32 state_dict reconstructed from ds checkpoint
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
- ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
|
| 194 |
+
|
| 195 |
+
"""
|
| 196 |
+
print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
|
| 197 |
+
|
| 198 |
+
optim_files = get_optim_files(ds_checkpoint_dir)
|
| 199 |
+
zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
|
| 200 |
+
print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
|
| 201 |
+
|
| 202 |
+
model_files = get_model_state_files(ds_checkpoint_dir)
|
| 203 |
+
|
| 204 |
+
zero_model_states = parse_model_states(model_files)
|
| 205 |
+
print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
|
| 206 |
+
|
| 207 |
+
if zero_stage <= 2:
|
| 208 |
+
return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 209 |
+
exclude_frozen_parameters)
|
| 210 |
+
elif zero_stage == 3:
|
| 211 |
+
return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 212 |
+
exclude_frozen_parameters)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def _zero2_merge_frozen_params(state_dict, zero_model_states):
|
| 216 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 217 |
+
return
|
| 218 |
+
|
| 219 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 220 |
+
frozen_param_fragments = zero_model_states[0].frozen_param_fragments
|
| 221 |
+
|
| 222 |
+
if debug:
|
| 223 |
+
num_elem = sum(s.numel() for s in frozen_param_shapes.values())
|
| 224 |
+
print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 225 |
+
|
| 226 |
+
wanted_params = len(frozen_param_shapes)
|
| 227 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 228 |
+
avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
|
| 229 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 230 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 231 |
+
|
| 232 |
+
total_params = 0
|
| 233 |
+
total_numel = 0
|
| 234 |
+
for name, shape in frozen_param_shapes.items():
|
| 235 |
+
total_params += 1
|
| 236 |
+
unpartitioned_numel = shape.numel()
|
| 237 |
+
total_numel += unpartitioned_numel
|
| 238 |
+
|
| 239 |
+
state_dict[name] = frozen_param_fragments[name]
|
| 240 |
+
|
| 241 |
+
if debug:
|
| 242 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 243 |
+
|
| 244 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
def _has_callable(obj, fn):
|
| 248 |
+
attr = getattr(obj, fn, None)
|
| 249 |
+
return callable(attr)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 253 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 254 |
+
|
| 255 |
+
# Reconstruction protocol:
|
| 256 |
+
#
|
| 257 |
+
# XXX: document this
|
| 258 |
+
|
| 259 |
+
if debug:
|
| 260 |
+
for i in range(world_size):
|
| 261 |
+
for j in range(len(fp32_flat_groups[0])):
|
| 262 |
+
print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
|
| 263 |
+
|
| 264 |
+
# XXX: memory usage doubles here (zero2)
|
| 265 |
+
num_param_groups = len(fp32_flat_groups[0])
|
| 266 |
+
merged_single_partition_of_fp32_groups = []
|
| 267 |
+
for i in range(num_param_groups):
|
| 268 |
+
merged_partitions = [sd[i] for sd in fp32_flat_groups]
|
| 269 |
+
full_single_fp32_vector = torch.cat(merged_partitions, 0)
|
| 270 |
+
merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
|
| 271 |
+
avail_numel = sum(
|
| 272 |
+
[full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
|
| 273 |
+
|
| 274 |
+
if debug:
|
| 275 |
+
wanted_params = sum([len(shapes) for shapes in param_shapes])
|
| 276 |
+
wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
|
| 277 |
+
# not asserting if there is a mismatch due to possible padding
|
| 278 |
+
print(f"Have {avail_numel} numels to process.")
|
| 279 |
+
print(f"Need {wanted_numel} numels in {wanted_params} params.")
|
| 280 |
+
|
| 281 |
+
# params
|
| 282 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 283 |
+
# out-of-core computing solution
|
| 284 |
+
total_numel = 0
|
| 285 |
+
total_params = 0
|
| 286 |
+
for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
|
| 287 |
+
offset = 0
|
| 288 |
+
avail_numel = full_single_fp32_vector.numel()
|
| 289 |
+
for name, shape in shapes.items():
|
| 290 |
+
|
| 291 |
+
unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
|
| 292 |
+
total_numel += unpartitioned_numel
|
| 293 |
+
total_params += 1
|
| 294 |
+
|
| 295 |
+
if debug:
|
| 296 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 297 |
+
state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
|
| 298 |
+
offset += unpartitioned_numel
|
| 299 |
+
|
| 300 |
+
# Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
|
| 301 |
+
# avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
|
| 302 |
+
# paddings performed in the code it's almost impossible to predict the exact numbers w/o the
|
| 303 |
+
# live optimizer object, so we are checking that the numbers are within the right range
|
| 304 |
+
align_to = 2 * world_size
|
| 305 |
+
|
| 306 |
+
def zero2_align(x):
|
| 307 |
+
return align_to * math.ceil(x / align_to)
|
| 308 |
+
|
| 309 |
+
if debug:
|
| 310 |
+
print(f"original offset={offset}, avail_numel={avail_numel}")
|
| 311 |
+
|
| 312 |
+
offset = zero2_align(offset)
|
| 313 |
+
avail_numel = zero2_align(avail_numel)
|
| 314 |
+
|
| 315 |
+
if debug:
|
| 316 |
+
print(f"aligned offset={offset}, avail_numel={avail_numel}")
|
| 317 |
+
|
| 318 |
+
# Sanity check
|
| 319 |
+
if offset != avail_numel:
|
| 320 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 321 |
+
|
| 322 |
+
print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 326 |
+
exclude_frozen_parameters):
|
| 327 |
+
state_dict = OrderedDict()
|
| 328 |
+
|
| 329 |
+
# buffers
|
| 330 |
+
buffers = zero_model_states[0].buffers
|
| 331 |
+
state_dict.update(buffers)
|
| 332 |
+
if debug:
|
| 333 |
+
print(f"added {len(buffers)} buffers")
|
| 334 |
+
|
| 335 |
+
if not exclude_frozen_parameters:
|
| 336 |
+
_zero2_merge_frozen_params(state_dict, zero_model_states)
|
| 337 |
+
|
| 338 |
+
_zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 339 |
+
|
| 340 |
+
# recover shared parameters
|
| 341 |
+
for pair in zero_model_states[0].shared_params:
|
| 342 |
+
if pair[1] in state_dict:
|
| 343 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 344 |
+
|
| 345 |
+
return state_dict
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
def zero3_partitioned_param_info(unpartitioned_numel, world_size):
|
| 349 |
+
remainder = unpartitioned_numel % world_size
|
| 350 |
+
padding_numel = (world_size - remainder) if remainder else 0
|
| 351 |
+
partitioned_numel = math.ceil(unpartitioned_numel / world_size)
|
| 352 |
+
return partitioned_numel, padding_numel
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
|
| 356 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 357 |
+
return
|
| 358 |
+
|
| 359 |
+
if debug:
|
| 360 |
+
for i in range(world_size):
|
| 361 |
+
num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
|
| 362 |
+
print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 363 |
+
|
| 364 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 365 |
+
wanted_params = len(frozen_param_shapes)
|
| 366 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 367 |
+
avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
|
| 368 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 369 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 370 |
+
|
| 371 |
+
total_params = 0
|
| 372 |
+
total_numel = 0
|
| 373 |
+
for name, shape in zero_model_states[0].frozen_param_shapes.items():
|
| 374 |
+
total_params += 1
|
| 375 |
+
unpartitioned_numel = shape.numel()
|
| 376 |
+
total_numel += unpartitioned_numel
|
| 377 |
+
|
| 378 |
+
param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
|
| 379 |
+
state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
|
| 380 |
+
|
| 381 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 382 |
+
|
| 383 |
+
if debug:
|
| 384 |
+
print(
|
| 385 |
+
f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
class GatheredTensor:
|
| 392 |
+
"""
|
| 393 |
+
A pseudo tensor that collects partitioned weights.
|
| 394 |
+
It is more memory efficient when there are multiple groups.
|
| 395 |
+
"""
|
| 396 |
+
|
| 397 |
+
def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
|
| 398 |
+
self.flat_groups = flat_groups
|
| 399 |
+
self.flat_groups_offset = flat_groups_offset
|
| 400 |
+
self.offset = offset
|
| 401 |
+
self.partitioned_numel = partitioned_numel
|
| 402 |
+
self.shape = shape
|
| 403 |
+
self.dtype = self.flat_groups[0][0].dtype
|
| 404 |
+
|
| 405 |
+
def contiguous(self):
|
| 406 |
+
"""
|
| 407 |
+
Merge partitioned weights from flat_groups into a single tensor.
|
| 408 |
+
"""
|
| 409 |
+
end_idx = self.offset + self.partitioned_numel
|
| 410 |
+
world_size = len(self.flat_groups)
|
| 411 |
+
pad_flat_param_chunks = []
|
| 412 |
+
|
| 413 |
+
for rank_i in range(world_size):
|
| 414 |
+
# for each rank, we need to collect weights from related group/groups
|
| 415 |
+
flat_groups_at_rank_i = self.flat_groups[rank_i]
|
| 416 |
+
start_group_id = None
|
| 417 |
+
end_group_id = None
|
| 418 |
+
for group_id in range(len(self.flat_groups_offset)):
|
| 419 |
+
if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
|
| 420 |
+
start_group_id = group_id
|
| 421 |
+
if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
|
| 422 |
+
end_group_id = group_id
|
| 423 |
+
break
|
| 424 |
+
# collect weights from related group/groups
|
| 425 |
+
for group_id in range(start_group_id, end_group_id + 1):
|
| 426 |
+
flat_tensor = flat_groups_at_rank_i[group_id]
|
| 427 |
+
start_offset = self.offset - self.flat_groups_offset[group_id]
|
| 428 |
+
end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
|
| 429 |
+
pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
|
| 430 |
+
|
| 431 |
+
# collect weights from all ranks
|
| 432 |
+
pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
|
| 433 |
+
param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
|
| 434 |
+
return param
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 438 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 439 |
+
avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
|
| 440 |
+
|
| 441 |
+
# Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
|
| 442 |
+
# param, re-consolidating each param, while dealing with padding if any
|
| 443 |
+
|
| 444 |
+
# merge list of dicts, preserving order
|
| 445 |
+
param_shapes = {k: v for d in param_shapes for k, v in d.items()}
|
| 446 |
+
|
| 447 |
+
if debug:
|
| 448 |
+
for i in range(world_size):
|
| 449 |
+
print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
|
| 450 |
+
|
| 451 |
+
wanted_params = len(param_shapes)
|
| 452 |
+
wanted_numel = sum(shape.numel() for shape in param_shapes.values())
|
| 453 |
+
# not asserting if there is a mismatch due to possible padding
|
| 454 |
+
avail_numel = fp32_flat_groups[0].numel() * world_size
|
| 455 |
+
print(f"Trainable params: Have {avail_numel} numels to process.")
|
| 456 |
+
print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
|
| 457 |
+
|
| 458 |
+
# params
|
| 459 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 460 |
+
# out-of-core computing solution
|
| 461 |
+
offset = 0
|
| 462 |
+
total_numel = 0
|
| 463 |
+
total_params = 0
|
| 464 |
+
flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
|
| 465 |
+
for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
|
| 466 |
+
unpartitioned_numel = shape.numel()
|
| 467 |
+
total_numel += unpartitioned_numel
|
| 468 |
+
total_params += 1
|
| 469 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 470 |
+
|
| 471 |
+
if debug:
|
| 472 |
+
print(
|
| 473 |
+
f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 474 |
+
)
|
| 475 |
+
|
| 476 |
+
# memory efficient tensor
|
| 477 |
+
tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
|
| 478 |
+
state_dict[name] = tensor
|
| 479 |
+
offset += partitioned_numel
|
| 480 |
+
|
| 481 |
+
offset *= world_size
|
| 482 |
+
|
| 483 |
+
# Sanity check
|
| 484 |
+
if offset != avail_numel:
|
| 485 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 486 |
+
|
| 487 |
+
print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 491 |
+
exclude_frozen_parameters):
|
| 492 |
+
state_dict = OrderedDict()
|
| 493 |
+
|
| 494 |
+
# buffers
|
| 495 |
+
buffers = zero_model_states[0].buffers
|
| 496 |
+
state_dict.update(buffers)
|
| 497 |
+
if debug:
|
| 498 |
+
print(f"added {len(buffers)} buffers")
|
| 499 |
+
|
| 500 |
+
if not exclude_frozen_parameters:
|
| 501 |
+
_zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
|
| 502 |
+
|
| 503 |
+
_zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 504 |
+
|
| 505 |
+
# recover shared parameters
|
| 506 |
+
for pair in zero_model_states[0].shared_params:
|
| 507 |
+
if pair[1] in state_dict:
|
| 508 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 509 |
+
|
| 510 |
+
return state_dict
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
def to_torch_tensor(state_dict, return_empty_tensor=False):
|
| 514 |
+
"""
|
| 515 |
+
Convert state_dict of GatheredTensor to torch tensor
|
| 516 |
+
"""
|
| 517 |
+
torch_state_dict = {}
|
| 518 |
+
converted_tensors = {}
|
| 519 |
+
for name, tensor in state_dict.items():
|
| 520 |
+
tensor_id = id(tensor)
|
| 521 |
+
if tensor_id in converted_tensors: # shared tensors
|
| 522 |
+
shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
|
| 523 |
+
torch_state_dict[name] = shared_tensor
|
| 524 |
+
else:
|
| 525 |
+
converted_tensors[tensor_id] = name
|
| 526 |
+
if return_empty_tensor:
|
| 527 |
+
torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
|
| 528 |
+
else:
|
| 529 |
+
torch_state_dict[name] = tensor.contiguous()
|
| 530 |
+
return torch_state_dict
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 534 |
+
tag=None,
|
| 535 |
+
exclude_frozen_parameters=False,
|
| 536 |
+
lazy_mode=False):
|
| 537 |
+
"""
|
| 538 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
|
| 539 |
+
``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
|
| 540 |
+
via a model hub.
|
| 541 |
+
|
| 542 |
+
Args:
|
| 543 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder
|
| 544 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
|
| 545 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 546 |
+
- ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
|
| 547 |
+
Convert the pesduo tensor to torch tensor by ``.contiguous()``
|
| 548 |
+
|
| 549 |
+
Returns:
|
| 550 |
+
- pytorch ``state_dict``
|
| 551 |
+
|
| 552 |
+
A typical usage might be ::
|
| 553 |
+
|
| 554 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 555 |
+
# do the training and checkpoint saving
|
| 556 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
|
| 557 |
+
model = model.cpu() # move to cpu
|
| 558 |
+
model.load_state_dict(state_dict)
|
| 559 |
+
# submit to model hub or save the model to share with others
|
| 560 |
+
|
| 561 |
+
In this example the ``model`` will no longer be usable in the deepspeed context of the same
|
| 562 |
+
application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 563 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 564 |
+
|
| 565 |
+
If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
|
| 566 |
+
|
| 567 |
+
Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
|
| 568 |
+
You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
|
| 569 |
+
the checkpoint. Or you can load state_dict in lazy mode ::
|
| 570 |
+
|
| 571 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 572 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
|
| 573 |
+
for name, lazy_tensor in state_dict.item():
|
| 574 |
+
tensor = lazy_tensor.contiguous() # to cpu
|
| 575 |
+
print(name, tensor)
|
| 576 |
+
# del tensor to release memory if it no longer in use
|
| 577 |
+
"""
|
| 578 |
+
if tag is None:
|
| 579 |
+
latest_path = os.path.join(checkpoint_dir, 'latest')
|
| 580 |
+
if os.path.isfile(latest_path):
|
| 581 |
+
with open(latest_path, 'r') as fd:
|
| 582 |
+
tag = fd.read().strip()
|
| 583 |
+
else:
|
| 584 |
+
raise ValueError(f"Unable to find 'latest' file at {latest_path}")
|
| 585 |
+
|
| 586 |
+
ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
|
| 587 |
+
|
| 588 |
+
if not os.path.isdir(ds_checkpoint_dir):
|
| 589 |
+
raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
|
| 590 |
+
|
| 591 |
+
state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
|
| 592 |
+
if lazy_mode:
|
| 593 |
+
return state_dict
|
| 594 |
+
else:
|
| 595 |
+
return to_torch_tensor(state_dict)
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
|
| 599 |
+
output_dir,
|
| 600 |
+
max_shard_size="5GB",
|
| 601 |
+
safe_serialization=False,
|
| 602 |
+
tag=None,
|
| 603 |
+
exclude_frozen_parameters=False):
|
| 604 |
+
"""
|
| 605 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
|
| 606 |
+
loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
|
| 607 |
+
|
| 608 |
+
Args:
|
| 609 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 610 |
+
- ``output_dir``: directory to the pytorch fp32 state_dict output files
|
| 611 |
+
- ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
|
| 612 |
+
- ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
|
| 613 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 614 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 615 |
+
"""
|
| 616 |
+
|
| 617 |
+
# Dependency pre-check
|
| 618 |
+
if safe_serialization:
|
| 619 |
+
try:
|
| 620 |
+
from safetensors.torch import save_file
|
| 621 |
+
except ImportError:
|
| 622 |
+
print('If you want to use `safe_serialization`, please `pip install safetensors`')
|
| 623 |
+
raise
|
| 624 |
+
if max_shard_size is not None:
|
| 625 |
+
try:
|
| 626 |
+
from huggingface_hub import split_torch_state_dict_into_shards
|
| 627 |
+
except ImportError:
|
| 628 |
+
print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
|
| 629 |
+
raise
|
| 630 |
+
|
| 631 |
+
# Convert zero checkpoint to state_dict
|
| 632 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 633 |
+
tag,
|
| 634 |
+
exclude_frozen_parameters,
|
| 635 |
+
lazy_mode=True)
|
| 636 |
+
|
| 637 |
+
# Shard the model if it is too big.
|
| 638 |
+
weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
|
| 639 |
+
if max_shard_size is not None:
|
| 640 |
+
filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
|
| 641 |
+
# an memory-efficient approach for sharding
|
| 642 |
+
empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
|
| 643 |
+
state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
|
| 644 |
+
filename_pattern=filename_pattern,
|
| 645 |
+
max_shard_size=max_shard_size)
|
| 646 |
+
else:
|
| 647 |
+
from collections import namedtuple
|
| 648 |
+
StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
|
| 649 |
+
state_dict_split = StateDictSplit(is_sharded=False,
|
| 650 |
+
filename_to_tensors={weights_name: list(state_dict.keys())})
|
| 651 |
+
|
| 652 |
+
# Save the model by shard
|
| 653 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 654 |
+
filename_to_tensors = state_dict_split.filename_to_tensors.items()
|
| 655 |
+
for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
|
| 656 |
+
shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
|
| 657 |
+
shard_state_dict = to_torch_tensor(shard_state_dict)
|
| 658 |
+
output_path = os.path.join(output_dir, shard_file)
|
| 659 |
+
if safe_serialization:
|
| 660 |
+
save_file(shard_state_dict, output_path, metadata={"format": "pt"})
|
| 661 |
+
else:
|
| 662 |
+
torch.save(shard_state_dict, output_path)
|
| 663 |
+
# release the memory of current shard
|
| 664 |
+
for tensor_name in list(shard_state_dict.keys()):
|
| 665 |
+
del state_dict[tensor_name]
|
| 666 |
+
del shard_state_dict[tensor_name]
|
| 667 |
+
del shard_state_dict
|
| 668 |
+
gc.collect()
|
| 669 |
+
|
| 670 |
+
# Save index if sharded
|
| 671 |
+
if state_dict_split.is_sharded:
|
| 672 |
+
index = {
|
| 673 |
+
"metadata": state_dict_split.metadata,
|
| 674 |
+
"weight_map": state_dict_split.tensor_to_filename,
|
| 675 |
+
}
|
| 676 |
+
save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
|
| 677 |
+
save_index_file = os.path.join(output_dir, save_index_file)
|
| 678 |
+
with open(save_index_file, "w", encoding="utf-8") as f:
|
| 679 |
+
content = json.dumps(index, indent=2, sort_keys=True) + "\n"
|
| 680 |
+
f.write(content)
|
| 681 |
+
|
| 682 |
+
|
| 683 |
+
def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
|
| 684 |
+
"""
|
| 685 |
+
1. Put the provided model to cpu
|
| 686 |
+
2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
|
| 687 |
+
3. Load it into the provided model
|
| 688 |
+
|
| 689 |
+
Args:
|
| 690 |
+
- ``model``: the model object to update
|
| 691 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 692 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 693 |
+
|
| 694 |
+
Returns:
|
| 695 |
+
- ``model`: modified model
|
| 696 |
+
|
| 697 |
+
Make sure you have plenty of CPU memory available before you call this function. If you don't
|
| 698 |
+
have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
|
| 699 |
+
conveniently placed for you in the checkpoint folder.
|
| 700 |
+
|
| 701 |
+
A typical usage might be ::
|
| 702 |
+
|
| 703 |
+
from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
|
| 704 |
+
model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
|
| 705 |
+
# submit to model hub or save the model to share with others
|
| 706 |
+
|
| 707 |
+
Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
|
| 708 |
+
of the same application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 709 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 710 |
+
|
| 711 |
+
"""
|
| 712 |
+
logger.info(f"Extracting fp32 weights")
|
| 713 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
| 714 |
+
|
| 715 |
+
logger.info(f"Overwriting model with fp32 weights")
|
| 716 |
+
model = model.cpu()
|
| 717 |
+
model.load_state_dict(state_dict, strict=False)
|
| 718 |
+
|
| 719 |
+
return model
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
if __name__ == "__main__":
|
| 723 |
+
parser = argparse.ArgumentParser()
|
| 724 |
+
parser.add_argument("checkpoint_dir",
|
| 725 |
+
type=str,
|
| 726 |
+
help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
|
| 727 |
+
parser.add_argument("output_dir",
|
| 728 |
+
type=str,
|
| 729 |
+
help="directory to the pytorch fp32 state_dict output files"
|
| 730 |
+
"(e.g. path/checkpoint-12-output/)")
|
| 731 |
+
parser.add_argument(
|
| 732 |
+
"--max_shard_size",
|
| 733 |
+
type=str,
|
| 734 |
+
default="5GB",
|
| 735 |
+
help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
|
| 736 |
+
"lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
|
| 737 |
+
"We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
|
| 738 |
+
"without CPU OOM issues.")
|
| 739 |
+
parser.add_argument(
|
| 740 |
+
"--safe_serialization",
|
| 741 |
+
default=False,
|
| 742 |
+
action='store_true',
|
| 743 |
+
help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
|
| 744 |
+
parser.add_argument("-t",
|
| 745 |
+
"--tag",
|
| 746 |
+
type=str,
|
| 747 |
+
default=None,
|
| 748 |
+
help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
|
| 749 |
+
parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
|
| 750 |
+
parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
|
| 751 |
+
args = parser.parse_args()
|
| 752 |
+
|
| 753 |
+
debug = args.debug
|
| 754 |
+
|
| 755 |
+
convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
|
| 756 |
+
args.output_dir,
|
| 757 |
+
max_shard_size=args.max_shard_size,
|
| 758 |
+
safe_serialization=args.safe_serialization,
|
| 759 |
+
tag=args.tag,
|
| 760 |
+
exclude_frozen_parameters=args.exclude_frozen_parameters)
|
slice_3657/config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_3657/latest
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
global_step228
|
slice_3657/preprocessor_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": {
|
| 3 |
+
"height": 512,
|
| 4 |
+
"width": 512
|
| 5 |
+
},
|
| 6 |
+
"do_center_crop": true,
|
| 7 |
+
"do_convert_rgb": true,
|
| 8 |
+
"do_normalize": true,
|
| 9 |
+
"do_rescale": true,
|
| 10 |
+
"do_resize": true,
|
| 11 |
+
"image_mean": [
|
| 12 |
+
1.0,
|
| 13 |
+
1.0,
|
| 14 |
+
1.0
|
| 15 |
+
],
|
| 16 |
+
"image_processor_type": "ChameleonImageProcessor",
|
| 17 |
+
"image_std": [
|
| 18 |
+
1.0,
|
| 19 |
+
1.0,
|
| 20 |
+
1.0
|
| 21 |
+
],
|
| 22 |
+
"processor_class": "ChameleonProcessor",
|
| 23 |
+
"resample": 1,
|
| 24 |
+
"rescale_factor": 0.0078,
|
| 25 |
+
"size": {
|
| 26 |
+
"shortest_edge": 512
|
| 27 |
+
}
|
| 28 |
+
}
|
slice_3657/processor_config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_seq_length": 1024,
|
| 3 |
+
"image_token": "<image>",
|
| 4 |
+
"processor_class": "ChameleonProcessor"
|
| 5 |
+
}
|
slice_3657/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:72165262cd88b65a8f8d7bd428e84a0b331b591ec81af0719bfd26fe2b17c8f8
|
| 3 |
+
size 14086364170
|
slice_3657/special_tokens_map.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<pad>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "<reserved08706>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "<unk>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
+
}
|
slice_3657/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_3657/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_3657/zero_to_fp32.py
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
|
| 3 |
+
# Copyright (c) Microsoft Corporation.
|
| 4 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 5 |
+
|
| 6 |
+
# DeepSpeed Team
|
| 7 |
+
|
| 8 |
+
# This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
|
| 9 |
+
# copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
|
| 10 |
+
# the future. Once extracted, the weights don't require DeepSpeed and can be used in any
|
| 11 |
+
# application.
|
| 12 |
+
#
|
| 13 |
+
# example:
|
| 14 |
+
# python zero_to_fp32.py . output_dir/
|
| 15 |
+
# or
|
| 16 |
+
# python zero_to_fp32.py . output_dir/ --safe_serialization
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import torch
|
| 20 |
+
import glob
|
| 21 |
+
import math
|
| 22 |
+
import os
|
| 23 |
+
import re
|
| 24 |
+
import gc
|
| 25 |
+
import json
|
| 26 |
+
import numpy as np
|
| 27 |
+
from tqdm import tqdm
|
| 28 |
+
from collections import OrderedDict
|
| 29 |
+
from dataclasses import dataclass
|
| 30 |
+
|
| 31 |
+
# while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
|
| 32 |
+
# DeepSpeed data structures it has to be available in the current python environment.
|
| 33 |
+
from deepspeed.utils import logger
|
| 34 |
+
from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
|
| 35 |
+
FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
|
| 36 |
+
FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
@dataclass
|
| 40 |
+
class zero_model_state:
|
| 41 |
+
buffers: dict()
|
| 42 |
+
param_shapes: dict()
|
| 43 |
+
shared_params: list
|
| 44 |
+
ds_version: int
|
| 45 |
+
frozen_param_shapes: dict()
|
| 46 |
+
frozen_param_fragments: dict()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
debug = 0
|
| 50 |
+
|
| 51 |
+
# load to cpu
|
| 52 |
+
device = torch.device('cpu')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def atoi(text):
|
| 56 |
+
return int(text) if text.isdigit() else text
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def natural_keys(text):
|
| 60 |
+
'''
|
| 61 |
+
alist.sort(key=natural_keys) sorts in human order
|
| 62 |
+
http://nedbatchelder.com/blog/200712/human_sorting.html
|
| 63 |
+
(See Toothy's implementation in the comments)
|
| 64 |
+
'''
|
| 65 |
+
return [atoi(c) for c in re.split(r'(\d+)', text)]
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def get_model_state_file(checkpoint_dir, zero_stage):
|
| 69 |
+
if not os.path.isdir(checkpoint_dir):
|
| 70 |
+
raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
|
| 71 |
+
|
| 72 |
+
# there should be only one file
|
| 73 |
+
if zero_stage <= 2:
|
| 74 |
+
file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
|
| 75 |
+
elif zero_stage == 3:
|
| 76 |
+
file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
|
| 77 |
+
|
| 78 |
+
if not os.path.exists(file):
|
| 79 |
+
raise FileNotFoundError(f"can't find model states file at '{file}'")
|
| 80 |
+
|
| 81 |
+
return file
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def get_checkpoint_files(checkpoint_dir, glob_pattern):
|
| 85 |
+
# XXX: need to test that this simple glob rule works for multi-node setup too
|
| 86 |
+
ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
|
| 87 |
+
|
| 88 |
+
if len(ckpt_files) == 0:
|
| 89 |
+
raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
|
| 90 |
+
|
| 91 |
+
return ckpt_files
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def get_optim_files(checkpoint_dir):
|
| 95 |
+
return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def get_model_state_files(checkpoint_dir):
|
| 99 |
+
return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def parse_model_states(files):
|
| 103 |
+
zero_model_states = []
|
| 104 |
+
for file in files:
|
| 105 |
+
state_dict = torch.load(file, map_location=device, weights_only=False)
|
| 106 |
+
|
| 107 |
+
if BUFFER_NAMES not in state_dict:
|
| 108 |
+
raise ValueError(f"{file} is not a model state checkpoint")
|
| 109 |
+
buffer_names = state_dict[BUFFER_NAMES]
|
| 110 |
+
if debug:
|
| 111 |
+
print("Found buffers:", buffer_names)
|
| 112 |
+
|
| 113 |
+
# recover just the buffers while restoring them to fp32 if they were saved in fp16
|
| 114 |
+
buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
|
| 115 |
+
param_shapes = state_dict[PARAM_SHAPES]
|
| 116 |
+
|
| 117 |
+
# collect parameters that are included in param_shapes
|
| 118 |
+
param_names = []
|
| 119 |
+
for s in param_shapes:
|
| 120 |
+
for name in s.keys():
|
| 121 |
+
param_names.append(name)
|
| 122 |
+
|
| 123 |
+
# update with frozen parameters
|
| 124 |
+
frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
|
| 125 |
+
if frozen_param_shapes is not None:
|
| 126 |
+
if debug:
|
| 127 |
+
print(f"Found frozen_param_shapes: {frozen_param_shapes}")
|
| 128 |
+
param_names += list(frozen_param_shapes.keys())
|
| 129 |
+
|
| 130 |
+
# handle shared params
|
| 131 |
+
shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
|
| 132 |
+
|
| 133 |
+
ds_version = state_dict.get(DS_VERSION, None)
|
| 134 |
+
|
| 135 |
+
frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
|
| 136 |
+
|
| 137 |
+
z_model_state = zero_model_state(buffers=buffers,
|
| 138 |
+
param_shapes=param_shapes,
|
| 139 |
+
shared_params=shared_params,
|
| 140 |
+
ds_version=ds_version,
|
| 141 |
+
frozen_param_shapes=frozen_param_shapes,
|
| 142 |
+
frozen_param_fragments=frozen_param_fragments)
|
| 143 |
+
zero_model_states.append(z_model_state)
|
| 144 |
+
|
| 145 |
+
return zero_model_states
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def parse_optim_states(files, ds_checkpoint_dir):
|
| 149 |
+
total_files = len(files)
|
| 150 |
+
state_dicts = []
|
| 151 |
+
for f in tqdm(files, desc='Loading checkpoint shards'):
|
| 152 |
+
state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
|
| 153 |
+
# immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
|
| 154 |
+
# and also handle the case where it was already removed by another helper script
|
| 155 |
+
state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
|
| 156 |
+
state_dicts.append(state_dict)
|
| 157 |
+
|
| 158 |
+
if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
|
| 159 |
+
raise ValueError(f"{files[0]} is not a zero checkpoint")
|
| 160 |
+
zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
|
| 161 |
+
world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
|
| 162 |
+
|
| 163 |
+
# For ZeRO-2 each param group can have different partition_count as data parallelism for expert
|
| 164 |
+
# parameters can be different from data parallelism for non-expert parameters. So we can just
|
| 165 |
+
# use the max of the partition_count to get the dp world_size.
|
| 166 |
+
|
| 167 |
+
if type(world_size) is list:
|
| 168 |
+
world_size = max(world_size)
|
| 169 |
+
|
| 170 |
+
if world_size != total_files:
|
| 171 |
+
raise ValueError(
|
| 172 |
+
f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
|
| 173 |
+
"Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
# the groups are named differently in each stage
|
| 177 |
+
if zero_stage <= 2:
|
| 178 |
+
fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
|
| 179 |
+
elif zero_stage == 3:
|
| 180 |
+
fp32_groups_key = FP32_FLAT_GROUPS
|
| 181 |
+
else:
|
| 182 |
+
raise ValueError(f"unknown zero stage {zero_stage}")
|
| 183 |
+
|
| 184 |
+
fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
|
| 185 |
+
return zero_stage, world_size, fp32_flat_groups
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
|
| 189 |
+
"""
|
| 190 |
+
Returns fp32 state_dict reconstructed from ds checkpoint
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
- ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
|
| 194 |
+
|
| 195 |
+
"""
|
| 196 |
+
print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
|
| 197 |
+
|
| 198 |
+
optim_files = get_optim_files(ds_checkpoint_dir)
|
| 199 |
+
zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
|
| 200 |
+
print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
|
| 201 |
+
|
| 202 |
+
model_files = get_model_state_files(ds_checkpoint_dir)
|
| 203 |
+
|
| 204 |
+
zero_model_states = parse_model_states(model_files)
|
| 205 |
+
print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
|
| 206 |
+
|
| 207 |
+
if zero_stage <= 2:
|
| 208 |
+
return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 209 |
+
exclude_frozen_parameters)
|
| 210 |
+
elif zero_stage == 3:
|
| 211 |
+
return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 212 |
+
exclude_frozen_parameters)
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def _zero2_merge_frozen_params(state_dict, zero_model_states):
|
| 216 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 217 |
+
return
|
| 218 |
+
|
| 219 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 220 |
+
frozen_param_fragments = zero_model_states[0].frozen_param_fragments
|
| 221 |
+
|
| 222 |
+
if debug:
|
| 223 |
+
num_elem = sum(s.numel() for s in frozen_param_shapes.values())
|
| 224 |
+
print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 225 |
+
|
| 226 |
+
wanted_params = len(frozen_param_shapes)
|
| 227 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 228 |
+
avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
|
| 229 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 230 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 231 |
+
|
| 232 |
+
total_params = 0
|
| 233 |
+
total_numel = 0
|
| 234 |
+
for name, shape in frozen_param_shapes.items():
|
| 235 |
+
total_params += 1
|
| 236 |
+
unpartitioned_numel = shape.numel()
|
| 237 |
+
total_numel += unpartitioned_numel
|
| 238 |
+
|
| 239 |
+
state_dict[name] = frozen_param_fragments[name]
|
| 240 |
+
|
| 241 |
+
if debug:
|
| 242 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 243 |
+
|
| 244 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
def _has_callable(obj, fn):
|
| 248 |
+
attr = getattr(obj, fn, None)
|
| 249 |
+
return callable(attr)
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 253 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 254 |
+
|
| 255 |
+
# Reconstruction protocol:
|
| 256 |
+
#
|
| 257 |
+
# XXX: document this
|
| 258 |
+
|
| 259 |
+
if debug:
|
| 260 |
+
for i in range(world_size):
|
| 261 |
+
for j in range(len(fp32_flat_groups[0])):
|
| 262 |
+
print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
|
| 263 |
+
|
| 264 |
+
# XXX: memory usage doubles here (zero2)
|
| 265 |
+
num_param_groups = len(fp32_flat_groups[0])
|
| 266 |
+
merged_single_partition_of_fp32_groups = []
|
| 267 |
+
for i in range(num_param_groups):
|
| 268 |
+
merged_partitions = [sd[i] for sd in fp32_flat_groups]
|
| 269 |
+
full_single_fp32_vector = torch.cat(merged_partitions, 0)
|
| 270 |
+
merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
|
| 271 |
+
avail_numel = sum(
|
| 272 |
+
[full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
|
| 273 |
+
|
| 274 |
+
if debug:
|
| 275 |
+
wanted_params = sum([len(shapes) for shapes in param_shapes])
|
| 276 |
+
wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
|
| 277 |
+
# not asserting if there is a mismatch due to possible padding
|
| 278 |
+
print(f"Have {avail_numel} numels to process.")
|
| 279 |
+
print(f"Need {wanted_numel} numels in {wanted_params} params.")
|
| 280 |
+
|
| 281 |
+
# params
|
| 282 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 283 |
+
# out-of-core computing solution
|
| 284 |
+
total_numel = 0
|
| 285 |
+
total_params = 0
|
| 286 |
+
for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
|
| 287 |
+
offset = 0
|
| 288 |
+
avail_numel = full_single_fp32_vector.numel()
|
| 289 |
+
for name, shape in shapes.items():
|
| 290 |
+
|
| 291 |
+
unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
|
| 292 |
+
total_numel += unpartitioned_numel
|
| 293 |
+
total_params += 1
|
| 294 |
+
|
| 295 |
+
if debug:
|
| 296 |
+
print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
|
| 297 |
+
state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
|
| 298 |
+
offset += unpartitioned_numel
|
| 299 |
+
|
| 300 |
+
# Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
|
| 301 |
+
# avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
|
| 302 |
+
# paddings performed in the code it's almost impossible to predict the exact numbers w/o the
|
| 303 |
+
# live optimizer object, so we are checking that the numbers are within the right range
|
| 304 |
+
align_to = 2 * world_size
|
| 305 |
+
|
| 306 |
+
def zero2_align(x):
|
| 307 |
+
return align_to * math.ceil(x / align_to)
|
| 308 |
+
|
| 309 |
+
if debug:
|
| 310 |
+
print(f"original offset={offset}, avail_numel={avail_numel}")
|
| 311 |
+
|
| 312 |
+
offset = zero2_align(offset)
|
| 313 |
+
avail_numel = zero2_align(avail_numel)
|
| 314 |
+
|
| 315 |
+
if debug:
|
| 316 |
+
print(f"aligned offset={offset}, avail_numel={avail_numel}")
|
| 317 |
+
|
| 318 |
+
# Sanity check
|
| 319 |
+
if offset != avail_numel:
|
| 320 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 321 |
+
|
| 322 |
+
print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 326 |
+
exclude_frozen_parameters):
|
| 327 |
+
state_dict = OrderedDict()
|
| 328 |
+
|
| 329 |
+
# buffers
|
| 330 |
+
buffers = zero_model_states[0].buffers
|
| 331 |
+
state_dict.update(buffers)
|
| 332 |
+
if debug:
|
| 333 |
+
print(f"added {len(buffers)} buffers")
|
| 334 |
+
|
| 335 |
+
if not exclude_frozen_parameters:
|
| 336 |
+
_zero2_merge_frozen_params(state_dict, zero_model_states)
|
| 337 |
+
|
| 338 |
+
_zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 339 |
+
|
| 340 |
+
# recover shared parameters
|
| 341 |
+
for pair in zero_model_states[0].shared_params:
|
| 342 |
+
if pair[1] in state_dict:
|
| 343 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 344 |
+
|
| 345 |
+
return state_dict
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
def zero3_partitioned_param_info(unpartitioned_numel, world_size):
|
| 349 |
+
remainder = unpartitioned_numel % world_size
|
| 350 |
+
padding_numel = (world_size - remainder) if remainder else 0
|
| 351 |
+
partitioned_numel = math.ceil(unpartitioned_numel / world_size)
|
| 352 |
+
return partitioned_numel, padding_numel
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
|
| 356 |
+
if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
|
| 357 |
+
return
|
| 358 |
+
|
| 359 |
+
if debug:
|
| 360 |
+
for i in range(world_size):
|
| 361 |
+
num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
|
| 362 |
+
print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
|
| 363 |
+
|
| 364 |
+
frozen_param_shapes = zero_model_states[0].frozen_param_shapes
|
| 365 |
+
wanted_params = len(frozen_param_shapes)
|
| 366 |
+
wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
|
| 367 |
+
avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
|
| 368 |
+
print(f'Frozen params: Have {avail_numel} numels to process.')
|
| 369 |
+
print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
|
| 370 |
+
|
| 371 |
+
total_params = 0
|
| 372 |
+
total_numel = 0
|
| 373 |
+
for name, shape in zero_model_states[0].frozen_param_shapes.items():
|
| 374 |
+
total_params += 1
|
| 375 |
+
unpartitioned_numel = shape.numel()
|
| 376 |
+
total_numel += unpartitioned_numel
|
| 377 |
+
|
| 378 |
+
param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
|
| 379 |
+
state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
|
| 380 |
+
|
| 381 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 382 |
+
|
| 383 |
+
if debug:
|
| 384 |
+
print(
|
| 385 |
+
f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
class GatheredTensor:
|
| 392 |
+
"""
|
| 393 |
+
A pseudo tensor that collects partitioned weights.
|
| 394 |
+
It is more memory efficient when there are multiple groups.
|
| 395 |
+
"""
|
| 396 |
+
|
| 397 |
+
def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
|
| 398 |
+
self.flat_groups = flat_groups
|
| 399 |
+
self.flat_groups_offset = flat_groups_offset
|
| 400 |
+
self.offset = offset
|
| 401 |
+
self.partitioned_numel = partitioned_numel
|
| 402 |
+
self.shape = shape
|
| 403 |
+
self.dtype = self.flat_groups[0][0].dtype
|
| 404 |
+
|
| 405 |
+
def contiguous(self):
|
| 406 |
+
"""
|
| 407 |
+
Merge partitioned weights from flat_groups into a single tensor.
|
| 408 |
+
"""
|
| 409 |
+
end_idx = self.offset + self.partitioned_numel
|
| 410 |
+
world_size = len(self.flat_groups)
|
| 411 |
+
pad_flat_param_chunks = []
|
| 412 |
+
|
| 413 |
+
for rank_i in range(world_size):
|
| 414 |
+
# for each rank, we need to collect weights from related group/groups
|
| 415 |
+
flat_groups_at_rank_i = self.flat_groups[rank_i]
|
| 416 |
+
start_group_id = None
|
| 417 |
+
end_group_id = None
|
| 418 |
+
for group_id in range(len(self.flat_groups_offset)):
|
| 419 |
+
if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
|
| 420 |
+
start_group_id = group_id
|
| 421 |
+
if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
|
| 422 |
+
end_group_id = group_id
|
| 423 |
+
break
|
| 424 |
+
# collect weights from related group/groups
|
| 425 |
+
for group_id in range(start_group_id, end_group_id + 1):
|
| 426 |
+
flat_tensor = flat_groups_at_rank_i[group_id]
|
| 427 |
+
start_offset = self.offset - self.flat_groups_offset[group_id]
|
| 428 |
+
end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
|
| 429 |
+
pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
|
| 430 |
+
|
| 431 |
+
# collect weights from all ranks
|
| 432 |
+
pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
|
| 433 |
+
param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
|
| 434 |
+
return param
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
|
| 438 |
+
param_shapes = zero_model_states[0].param_shapes
|
| 439 |
+
avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
|
| 440 |
+
|
| 441 |
+
# Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
|
| 442 |
+
# param, re-consolidating each param, while dealing with padding if any
|
| 443 |
+
|
| 444 |
+
# merge list of dicts, preserving order
|
| 445 |
+
param_shapes = {k: v for d in param_shapes for k, v in d.items()}
|
| 446 |
+
|
| 447 |
+
if debug:
|
| 448 |
+
for i in range(world_size):
|
| 449 |
+
print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
|
| 450 |
+
|
| 451 |
+
wanted_params = len(param_shapes)
|
| 452 |
+
wanted_numel = sum(shape.numel() for shape in param_shapes.values())
|
| 453 |
+
# not asserting if there is a mismatch due to possible padding
|
| 454 |
+
avail_numel = fp32_flat_groups[0].numel() * world_size
|
| 455 |
+
print(f"Trainable params: Have {avail_numel} numels to process.")
|
| 456 |
+
print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
|
| 457 |
+
|
| 458 |
+
# params
|
| 459 |
+
# XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
|
| 460 |
+
# out-of-core computing solution
|
| 461 |
+
offset = 0
|
| 462 |
+
total_numel = 0
|
| 463 |
+
total_params = 0
|
| 464 |
+
flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
|
| 465 |
+
for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
|
| 466 |
+
unpartitioned_numel = shape.numel()
|
| 467 |
+
total_numel += unpartitioned_numel
|
| 468 |
+
total_params += 1
|
| 469 |
+
partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
|
| 470 |
+
|
| 471 |
+
if debug:
|
| 472 |
+
print(
|
| 473 |
+
f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
|
| 474 |
+
)
|
| 475 |
+
|
| 476 |
+
# memory efficient tensor
|
| 477 |
+
tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
|
| 478 |
+
state_dict[name] = tensor
|
| 479 |
+
offset += partitioned_numel
|
| 480 |
+
|
| 481 |
+
offset *= world_size
|
| 482 |
+
|
| 483 |
+
# Sanity check
|
| 484 |
+
if offset != avail_numel:
|
| 485 |
+
raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
|
| 486 |
+
|
| 487 |
+
print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
|
| 491 |
+
exclude_frozen_parameters):
|
| 492 |
+
state_dict = OrderedDict()
|
| 493 |
+
|
| 494 |
+
# buffers
|
| 495 |
+
buffers = zero_model_states[0].buffers
|
| 496 |
+
state_dict.update(buffers)
|
| 497 |
+
if debug:
|
| 498 |
+
print(f"added {len(buffers)} buffers")
|
| 499 |
+
|
| 500 |
+
if not exclude_frozen_parameters:
|
| 501 |
+
_zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
|
| 502 |
+
|
| 503 |
+
_zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
|
| 504 |
+
|
| 505 |
+
# recover shared parameters
|
| 506 |
+
for pair in zero_model_states[0].shared_params:
|
| 507 |
+
if pair[1] in state_dict:
|
| 508 |
+
state_dict[pair[0]] = state_dict[pair[1]]
|
| 509 |
+
|
| 510 |
+
return state_dict
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
def to_torch_tensor(state_dict, return_empty_tensor=False):
|
| 514 |
+
"""
|
| 515 |
+
Convert state_dict of GatheredTensor to torch tensor
|
| 516 |
+
"""
|
| 517 |
+
torch_state_dict = {}
|
| 518 |
+
converted_tensors = {}
|
| 519 |
+
for name, tensor in state_dict.items():
|
| 520 |
+
tensor_id = id(tensor)
|
| 521 |
+
if tensor_id in converted_tensors: # shared tensors
|
| 522 |
+
shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
|
| 523 |
+
torch_state_dict[name] = shared_tensor
|
| 524 |
+
else:
|
| 525 |
+
converted_tensors[tensor_id] = name
|
| 526 |
+
if return_empty_tensor:
|
| 527 |
+
torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
|
| 528 |
+
else:
|
| 529 |
+
torch_state_dict[name] = tensor.contiguous()
|
| 530 |
+
return torch_state_dict
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 534 |
+
tag=None,
|
| 535 |
+
exclude_frozen_parameters=False,
|
| 536 |
+
lazy_mode=False):
|
| 537 |
+
"""
|
| 538 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
|
| 539 |
+
``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
|
| 540 |
+
via a model hub.
|
| 541 |
+
|
| 542 |
+
Args:
|
| 543 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder
|
| 544 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
|
| 545 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 546 |
+
- ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
|
| 547 |
+
Convert the pesduo tensor to torch tensor by ``.contiguous()``
|
| 548 |
+
|
| 549 |
+
Returns:
|
| 550 |
+
- pytorch ``state_dict``
|
| 551 |
+
|
| 552 |
+
A typical usage might be ::
|
| 553 |
+
|
| 554 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 555 |
+
# do the training and checkpoint saving
|
| 556 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
|
| 557 |
+
model = model.cpu() # move to cpu
|
| 558 |
+
model.load_state_dict(state_dict)
|
| 559 |
+
# submit to model hub or save the model to share with others
|
| 560 |
+
|
| 561 |
+
In this example the ``model`` will no longer be usable in the deepspeed context of the same
|
| 562 |
+
application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 563 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 564 |
+
|
| 565 |
+
If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
|
| 566 |
+
|
| 567 |
+
Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
|
| 568 |
+
You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
|
| 569 |
+
the checkpoint. Or you can load state_dict in lazy mode ::
|
| 570 |
+
|
| 571 |
+
from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
|
| 572 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
|
| 573 |
+
for name, lazy_tensor in state_dict.item():
|
| 574 |
+
tensor = lazy_tensor.contiguous() # to cpu
|
| 575 |
+
print(name, tensor)
|
| 576 |
+
# del tensor to release memory if it no longer in use
|
| 577 |
+
"""
|
| 578 |
+
if tag is None:
|
| 579 |
+
latest_path = os.path.join(checkpoint_dir, 'latest')
|
| 580 |
+
if os.path.isfile(latest_path):
|
| 581 |
+
with open(latest_path, 'r') as fd:
|
| 582 |
+
tag = fd.read().strip()
|
| 583 |
+
else:
|
| 584 |
+
raise ValueError(f"Unable to find 'latest' file at {latest_path}")
|
| 585 |
+
|
| 586 |
+
ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
|
| 587 |
+
|
| 588 |
+
if not os.path.isdir(ds_checkpoint_dir):
|
| 589 |
+
raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
|
| 590 |
+
|
| 591 |
+
state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
|
| 592 |
+
if lazy_mode:
|
| 593 |
+
return state_dict
|
| 594 |
+
else:
|
| 595 |
+
return to_torch_tensor(state_dict)
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
|
| 599 |
+
output_dir,
|
| 600 |
+
max_shard_size="5GB",
|
| 601 |
+
safe_serialization=False,
|
| 602 |
+
tag=None,
|
| 603 |
+
exclude_frozen_parameters=False):
|
| 604 |
+
"""
|
| 605 |
+
Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
|
| 606 |
+
loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
|
| 607 |
+
|
| 608 |
+
Args:
|
| 609 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 610 |
+
- ``output_dir``: directory to the pytorch fp32 state_dict output files
|
| 611 |
+
- ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
|
| 612 |
+
- ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
|
| 613 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 614 |
+
- ``exclude_frozen_parameters``: exclude frozen parameters
|
| 615 |
+
"""
|
| 616 |
+
|
| 617 |
+
# Dependency pre-check
|
| 618 |
+
if safe_serialization:
|
| 619 |
+
try:
|
| 620 |
+
from safetensors.torch import save_file
|
| 621 |
+
except ImportError:
|
| 622 |
+
print('If you want to use `safe_serialization`, please `pip install safetensors`')
|
| 623 |
+
raise
|
| 624 |
+
if max_shard_size is not None:
|
| 625 |
+
try:
|
| 626 |
+
from huggingface_hub import split_torch_state_dict_into_shards
|
| 627 |
+
except ImportError:
|
| 628 |
+
print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
|
| 629 |
+
raise
|
| 630 |
+
|
| 631 |
+
# Convert zero checkpoint to state_dict
|
| 632 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
|
| 633 |
+
tag,
|
| 634 |
+
exclude_frozen_parameters,
|
| 635 |
+
lazy_mode=True)
|
| 636 |
+
|
| 637 |
+
# Shard the model if it is too big.
|
| 638 |
+
weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
|
| 639 |
+
if max_shard_size is not None:
|
| 640 |
+
filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
|
| 641 |
+
# an memory-efficient approach for sharding
|
| 642 |
+
empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
|
| 643 |
+
state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
|
| 644 |
+
filename_pattern=filename_pattern,
|
| 645 |
+
max_shard_size=max_shard_size)
|
| 646 |
+
else:
|
| 647 |
+
from collections import namedtuple
|
| 648 |
+
StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
|
| 649 |
+
state_dict_split = StateDictSplit(is_sharded=False,
|
| 650 |
+
filename_to_tensors={weights_name: list(state_dict.keys())})
|
| 651 |
+
|
| 652 |
+
# Save the model by shard
|
| 653 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 654 |
+
filename_to_tensors = state_dict_split.filename_to_tensors.items()
|
| 655 |
+
for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
|
| 656 |
+
shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
|
| 657 |
+
shard_state_dict = to_torch_tensor(shard_state_dict)
|
| 658 |
+
output_path = os.path.join(output_dir, shard_file)
|
| 659 |
+
if safe_serialization:
|
| 660 |
+
save_file(shard_state_dict, output_path, metadata={"format": "pt"})
|
| 661 |
+
else:
|
| 662 |
+
torch.save(shard_state_dict, output_path)
|
| 663 |
+
# release the memory of current shard
|
| 664 |
+
for tensor_name in list(shard_state_dict.keys()):
|
| 665 |
+
del state_dict[tensor_name]
|
| 666 |
+
del shard_state_dict[tensor_name]
|
| 667 |
+
del shard_state_dict
|
| 668 |
+
gc.collect()
|
| 669 |
+
|
| 670 |
+
# Save index if sharded
|
| 671 |
+
if state_dict_split.is_sharded:
|
| 672 |
+
index = {
|
| 673 |
+
"metadata": state_dict_split.metadata,
|
| 674 |
+
"weight_map": state_dict_split.tensor_to_filename,
|
| 675 |
+
}
|
| 676 |
+
save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
|
| 677 |
+
save_index_file = os.path.join(output_dir, save_index_file)
|
| 678 |
+
with open(save_index_file, "w", encoding="utf-8") as f:
|
| 679 |
+
content = json.dumps(index, indent=2, sort_keys=True) + "\n"
|
| 680 |
+
f.write(content)
|
| 681 |
+
|
| 682 |
+
|
| 683 |
+
def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
|
| 684 |
+
"""
|
| 685 |
+
1. Put the provided model to cpu
|
| 686 |
+
2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
|
| 687 |
+
3. Load it into the provided model
|
| 688 |
+
|
| 689 |
+
Args:
|
| 690 |
+
- ``model``: the model object to update
|
| 691 |
+
- ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
|
| 692 |
+
- ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
|
| 693 |
+
|
| 694 |
+
Returns:
|
| 695 |
+
- ``model`: modified model
|
| 696 |
+
|
| 697 |
+
Make sure you have plenty of CPU memory available before you call this function. If you don't
|
| 698 |
+
have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
|
| 699 |
+
conveniently placed for you in the checkpoint folder.
|
| 700 |
+
|
| 701 |
+
A typical usage might be ::
|
| 702 |
+
|
| 703 |
+
from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
|
| 704 |
+
model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
|
| 705 |
+
# submit to model hub or save the model to share with others
|
| 706 |
+
|
| 707 |
+
Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
|
| 708 |
+
of the same application. i.e. you will need to re-initialize the deepspeed engine, since
|
| 709 |
+
``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
|
| 710 |
+
|
| 711 |
+
"""
|
| 712 |
+
logger.info(f"Extracting fp32 weights")
|
| 713 |
+
state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
|
| 714 |
+
|
| 715 |
+
logger.info(f"Overwriting model with fp32 weights")
|
| 716 |
+
model = model.cpu()
|
| 717 |
+
model.load_state_dict(state_dict, strict=False)
|
| 718 |
+
|
| 719 |
+
return model
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
if __name__ == "__main__":
|
| 723 |
+
parser = argparse.ArgumentParser()
|
| 724 |
+
parser.add_argument("checkpoint_dir",
|
| 725 |
+
type=str,
|
| 726 |
+
help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
|
| 727 |
+
parser.add_argument("output_dir",
|
| 728 |
+
type=str,
|
| 729 |
+
help="directory to the pytorch fp32 state_dict output files"
|
| 730 |
+
"(e.g. path/checkpoint-12-output/)")
|
| 731 |
+
parser.add_argument(
|
| 732 |
+
"--max_shard_size",
|
| 733 |
+
type=str,
|
| 734 |
+
default="5GB",
|
| 735 |
+
help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
|
| 736 |
+
"lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
|
| 737 |
+
"We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
|
| 738 |
+
"without CPU OOM issues.")
|
| 739 |
+
parser.add_argument(
|
| 740 |
+
"--safe_serialization",
|
| 741 |
+
default=False,
|
| 742 |
+
action='store_true',
|
| 743 |
+
help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
|
| 744 |
+
parser.add_argument("-t",
|
| 745 |
+
"--tag",
|
| 746 |
+
type=str,
|
| 747 |
+
default=None,
|
| 748 |
+
help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
|
| 749 |
+
parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
|
| 750 |
+
parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
|
| 751 |
+
args = parser.parse_args()
|
| 752 |
+
|
| 753 |
+
debug = args.debug
|
| 754 |
+
|
| 755 |
+
convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
|
| 756 |
+
args.output_dir,
|
| 757 |
+
max_shard_size=args.max_shard_size,
|
| 758 |
+
safe_serialization=args.safe_serialization,
|
| 759 |
+
tag=args.tag,
|
| 760 |
+
exclude_frozen_parameters=args.exclude_frozen_parameters)
|
slice_4876/17435091731.0/complex.json
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"question": "What might have happened prior to this moment?",
|
| 4 |
+
"correct_answer": "It's plausible that prior to this moment, the person standing next to the overturned skateboard might have attempted a trick or maneuver on the skateboard, which resulted in either a failed attempt or a wipeout. As a consequence, the skateboard ended up upside down on the ground, with its wheels pointed upward. The person, possibly the skateboarder, is standing next to it, possibly pondering their next move, contemplating a retry or assessing any potential damage to the skateboard.",
|
| 5 |
+
"response": "",
|
| 6 |
+
"score": false,
|
| 7 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, insight, or speculation regarding the scenario described in the question. Therefore, it receives a score of 0 for not contributing to the user's request for information or analysis.\n\nAssistant 2, on the other hand, offered a plausible scenario that could explain why the skateboard is upside down, suggesting that the person might have attempted a trick or maneuver that didn't go as planned, leading to the skateboard ending up in that position. This response is helpful as it provides a logical explanation based on the context given, showing an understanding of skateboarding activities and the common outcomes of failed attempts. The assistant's response is relevant to the question, accurate given the context of skateboarding, and detailed enough to paint a clear picture of what might have happened prior to the moment described. Therefore, it receives a score of 8 for its comprehensive and plausible explanation."
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"question": "What might be the reason for the car to be parked on the side of the road?",
|
| 11 |
+
"correct_answer": "The most plausible reason for the car to be parked on the side of the road is that it is utilizing the available parking spot with parking meters. In the image, the car is parked next to two parking meters, which indicates that the driver has parked the car to follow parking regulations and likely paid for their parking session. The car might be parked there so the driver or passengers can go to a nearby building, shop, or participate in any other activities in the area. Parking meters are commonly used in urban and commercial areas to manage and regulate limited street parking spaces, and it's reasonable to assume the driver is abiding by these parking rules.",
|
| 12 |
+
"response": "",
|
| 13 |
+
"score": false,
|
| 14 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, explanation, or insight regarding the reason for the car being parked on the side of the road. Therefore, it receives a score of 0 due to the lack of content in its response.\n\nAssistant 2, on the other hand, provided a detailed and plausible explanation based on the context given, which included the presence of parking meters next to the parked car. The assistant inferred that the car was parked legally in a designated parking spot, likely paid for, and speculated on the possible reasons the driver or passengers had for parking there, such as visiting nearby buildings or shops. This response was relevant, accurate to the context provided, and included a reasonable level of detail that directly addressed the user's question. Therefore, Assistant 2 receives a score of 8 for its comprehensive and contextually appropriate response."
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"question": "What precautions has the little girl taken to stay dry in the rain?",
|
| 18 |
+
"correct_answer": "The little girl in the image has taken several precautions to stay dry in the rain. She is wearing a ladybug-patterned raincoat, which protects her clothes from getting wet, along with a pair of green rubber rain boots to keep her feet dry. Additionally, the little girl is holding a matching ladybug-patterned umbrella to shield herself from the rain. These precautions ensure that she remains comfortable and dry during wet weather conditions.",
|
| 19 |
+
"response": "",
|
| 20 |
+
"score": false,
|
| 21 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, provided a detailed and accurate response to the question. It correctly identified the precautions the little girl has taken to stay dry in the rain, including wearing a raincoat, rubber boots, and using an umbrella. The response is relevant to the question, accurately describes the precautions based on the context provided, and includes a sufficient level of detail to understand how the girl is protected from the rain. Therefore, Assistant 2 receives a score of 8. The deduction from a perfect score is due to the lack of any additional insights or suggestions that could have further enriched the answer, such as the importance of waterproof materials in rain gear, which would have provided a more comprehensive understanding of the precautions."
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"question": "What factors may have led the cat to choose this location for sleep?",
|
| 25 |
+
"correct_answer": "The cat may have chosen to sleep on the red couch for several reasons. The couch appears to be plush and comfortable, providing a soft surface for the cat to curl up and maintain its body heat. Cats also prefer quiet and low-traffic areas to rest. The couch may be located in such an area, providing a sense of security for the cat while sleeping. Furthermore, felines are known to be attracted to soft and warm materials, making the red velvet seat an appealing spot for relaxation. It's also common for cats to sleep in locations familiar to them or near their human companions, so the couch might be a place where the cat often spends time or feels safe.",
|
| 26 |
+
"response": "",
|
| 27 |
+
"score": false,
|
| 28 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail. \n\nAssistant 2, on the other hand, offered a detailed and relevant answer, explaining several plausible reasons why a cat might choose to sleep on a red plush couch. The response includes considerations of the couch's comfort and warmth, the importance of a quiet and secure environment, the attraction to soft materials, and the possibility of the location being familiar or close to the cat's human companions. This answer is informative, directly addresses the question, and provides a comprehensive explanation of the factors that could influence a cat's choice of sleeping location. Therefore, Assistant 2 receives a score of 8 for its helpfulness, relevance, accuracy, and level of detail in the response."
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"question": "What can be inferred about the giraffe's habitat from this image?",
|
| 32 |
+
"correct_answer": "From the image, it can be inferred that the giraffe's habitat is likely a natural environment with an abundance of greenery. The giraffe is standing tall among several bright green trees, which suggests that the area is rich in vegetation and provides plenty of food sources for the giraffe, such as leaves. This natural habitat is likely suitable for giraffes to thrive and maintain their unique characteristics, such as their long necks, which are adapted for reaching leaves on tall trees.",
|
| 33 |
+
"response": "",
|
| 34 |
+
"score": false,
|
| 35 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information or inference about the giraffe's habitat based on the image. Therefore, it receives a score of 0 for not contributing any content relevant to the user's query.\n\nAssistant 2, on the other hand, offered a detailed inference about the giraffe's habitat based on the description of the image. The assistant deduced that the giraffe's environment is a natural one, abundant in greenery, which is essential for the giraffe's diet and lifestyle. This response is relevant, accurate to the extent that it aligns with what can be inferred from an image of a giraffe eating leaves, and provides a level of detail that helps the user understand the habitat requirements of giraffes. Therefore, Assistant 2 receives a score of 8 for its informative and relevant response. The deduction made by Assistant 2 is logical and based on the information that could be inferred from the description of the image, making it a helpful contribution to the query."
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"question": "What challenges might the staff encounter with handling luggage in the lobby?",
|
| 39 |
+
"correct_answer": "In the image, a cart is filled with numerous pieces of luggage, including suitcases, bags, and backpacks, in the lobby of a commercial business. The staff responsible for handling the luggage might face several challenges such as:\n\n1. Efficiently organizing and placing the luggage on the cart to prevent any damages or items from falling off during transportation.\n2. Identifying and keeping track of each guest's belongings to avoid misplacement or mixing up the luggage.\n3. Maneuvering the heavily loaded cart without causing hindrances to other guests in the lobby while ensuring their safety.\n4. Carrying or transporting the luggage to the guests' rooms in a timely manner to maintain customer satisfaction and efficient use of staff resources.\n\nTo overcome these challenges, staff might need proper training in luggage handling, organization, and customer service skills. Maintaining clear luggage tags and taking note of each item could help them ensure accurate delivery to the corresponding guests' rooms.",
|
| 40 |
+
"response": "",
|
| 41 |
+
"score": false,
|
| 42 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, advice, or insight into the challenges staff might encounter with handling luggage in the lobby. Therefore, it receives a score of 0 for not contributing any content to address the user's query.\n\nAssistant 2, on the other hand, provided a detailed and relevant response to the question. It outlined specific challenges staff might face, such as efficiently organizing luggage on the cart, identifying and keeping track of guests' belongings, maneuvering the cart in a busy lobby, and ensuring timely delivery of luggage to guest rooms. Additionally, it suggested solutions like proper training and maintaining clear luggage tags to overcome these challenges. The response was well-structured, informative, and directly addressed the question with practical insights, earning it a score of 8. The deduction comes from not incorporating the visual content description into the analysis, which could have provided a more tailored response to the specific scenario depicted in the image. However, the response was still highly relevant and useful in the context provided."
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"question": "What might be the purpose of this table arrangement?",
|
| 46 |
+
"correct_answer": "The table arrangement, which includes a folded newspaper with sunglasses on top, an apple, several books, and a teddy bear, might serve several purposes. It could be a leisurely reading spot where someone has gathered essentials for a relaxing and comfortable reading experience. The items on the table each serve a specific purpose; the folded newspaper and books provide reading material, the sunglasses protect the reader's eyes when reading outdoors or under bright light, the apple serves as a healthy snack, and the teddy bear adds a cozy and comfortable touch to the arrangement. This combination of items indicates an intention to create an inviting space for both reading and personal enjoyment.",
|
| 47 |
+
"response": "",
|
| 48 |
+
"score": false,
|
| 49 |
+
"gpt_response": "0 6\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, despite the initial context only mentioning sunglasses laying on a folded newspaper, expanded the scenario to include an apple, several books, and a teddy bear, which were not mentioned in the provided context. This indicates a deviation from the given context, affecting the relevance and accuracy of the response. However, the response was well-articulated, providing a detailed and imaginative explanation of a possible purpose for the table arrangement, suggesting a leisurely reading spot setup. This shows an effort to engage with the question and provide a thoughtful answer, which could be helpful if the context had indeed included those additional items. Therefore, Assistant 2 receives a score of 6 for its attempt to provide a detailed and coherent response, despite the inaccuracies in relation to the provided context."
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"question": "What challenges might the woman on the motorcycle face in this situation?",
|
| 53 |
+
"correct_answer": "The woman on the motorcycle might face challenges navigating the dirt road, especially because of the presence of multiple objects and living beings on the road. In the image, a cow is nearby, along with two other smaller cows, two men, and a dog. Dirt roads can be uneven, dusty, and unpredictable, making it important for the woman to maneuver cautiously to avoid any potential accidents. Additionally, she needs to be aware of the animals and people around her to ensure both her safety and the safety of others. This situation requires her to be vigilant, slow down when necessary, and carefully navigate through the environment.",
|
| 54 |
+
"response": "",
|
| 55 |
+
"score": false,
|
| 56 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance in terms of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and relevant response to the question. It accurately described potential challenges the woman on the motorcycle might face, such as navigating a dirt road with multiple obstacles, including animals and people. The assistant's mention of the need for vigilance, cautious maneuvering, and awareness of the surroundings directly addresses the question's concerns about potential challenges. The response is well-detailed, mentioning specific obstacles like a cow, smaller cows, men, and a dog, which adds to the relevance and accuracy of the answer. However, it's important to note that the assistant added details not provided in the context (like the specific number and types of animals), which could potentially mislead if those details were inaccurate according to the original image description. Despite this, the response is still highly relevant and helpful in understanding the challenges faced by the woman on the motorcycle. Therefore, Assistant 2 receives a score of 8, with points deducted for potentially adding details not present in the original context."
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"question": "What environmental impact might these planes' activity have on the birds?",
|
| 60 |
+
"correct_answer": "The presence of two large passenger jets flying in close proximity to the beach filled with birds can have a negative impact on the avian population. The noise generated by the engines can be stressful and disruptive for the birds, potentially resulting in altered behaviors, flight patterns, or even relocation from the area. In addition, the airplanes could pose a risk of bird strikes, in which birds collide with the planes, leading to injuries or fatalities for the birds and damage to the aircraft. This highlights the importance of maintaining safe distances between airplanes and wildlife habitats in order to minimize the risk of adverse effects on both the environment and aviation.",
|
| 61 |
+
"response": "",
|
| 62 |
+
"score": false,
|
| 63 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail. \n\nAssistant 2, on the other hand, offered a detailed analysis of the potential environmental impact of planes' activities on birds. The response is relevant to the question, accurately identifying key concerns such as noise pollution, stress and disruption to bird behavior, altered flight patterns, potential relocation, and the risk of bird strikes. The explanation is detailed, directly addressing the question with specific potential impacts and highlighting the importance of maintaining safe distances between airplanes and wildlife habitats. This response is informative, directly relevant to the user's query, and provides a comprehensive overview of the environmental implications of the described scenario. Therefore, Assistant 2 receives a score of 8 for its thorough and accurate response."
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"question": "Why might the man be holding the clothes on hangers?",
|
| 67 |
+
"correct_answer": "The man might be holding the clothes on hangers because he is preparing to pack his suitcase for a trip or has just arrived at his destination and is unpacking his belongings. By holding the clothes on hangers, he can avoid wrinkles and ensure that the garments remain in good condition for wearing during his journey or at his destination. The presence of a suitcase in front of him supports this idea, as it is commonly used for transportation and storage of personal belongings when traveling.",
|
| 68 |
+
"response": "",
|
| 69 |
+
"score": false,
|
| 70 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and plausible explanation for why the man might be holding clothes on hangers. The assistant suggested that the man could be either preparing to pack his suitcase for a trip or unpacking upon arrival, highlighting the practical reason to keep clothes on hangers to avoid wrinkles and maintain their condition. This response is helpful as it provides a clear and logical explanation, relevant to the context of traveling with clothes. The accuracy cannot be directly verified without more context, but the explanation is reasonable and aligns with common practices related to travel and garment care. The level of detail, including the mention of the suitcase and the purpose it serves in the scenario, enhances the quality of the response. Therefore, Assistant 2 receives a score of 8 for its comprehensive and thoughtful answer."
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"question": "What might be the reason behind the man's thumbs-up gesture while on the phone?",
|
| 74 |
+
"correct_answer": "It is likely that the man is giving a thumbs-up gesture while talking on the phone to express a positive emotion or to signal agreement, approval, or satisfaction with the conversation he is having. This non-verbal communication can be conveyed to the people around him or to the person taking the picture of him while on the phone call. The man might be receiving good news, agreeing with the person on the phone, or sharing his excitement with the group of people surrounding him in the room. The specific reason cannot be precisely determined from the image alone, but it does indicate a positive sentiment associated with the phone call.",
|
| 75 |
+
"response": "",
|
| 76 |
+
"score": false,
|
| 77 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, analysis, or insight regarding the man's thumbs-up gesture while on the phone. Therefore, it receives a score of 0 for not contributing to the user's query in any manner.\n\nAssistant 2, on the other hand, offered a detailed and thoughtful analysis of the possible reasons behind the man's gesture. It suggested that the thumbs-up could express positive emotions, agreement, approval, or satisfaction related to the phone conversation. The response was relevant to the question, accurately reflecting common interpretations of the thumbs-up gesture in the context of a phone call. It also provided a level of detail that helps the user understand various scenarios in which such a gesture might be used, even though it correctly noted that the specific reason couldn't be determined without more context. Therefore, Assistant 2 receives a score of 8 for its comprehensive and insightful response."
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"question": "Why might these giraffes be gathering near the same tree?",
|
| 81 |
+
"correct_answer": "In the image, there are four giraffes gathered near the same tree in their natural habitat, a grass field with dry brush. Giraffes may gather near the same tree for various reasons. One common reason is to feed, as their long necks enable them to reach high branches for fresh leaves and foliage, which is a primary part of their diet. Giraffes are also social animals, so they may gather around the same tree to interact with each other and maintain their social bonds. Furthermore, the tree can provide shade in the hot African sun, offering a place for the giraffes to rest and regulate their body temperature.",
|
| 82 |
+
"response": "",
|
| 83 |
+
"score": false,
|
| 84 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and relevant response to the question about why giraffes might be gathering near the same tree. The assistant mentioned several plausible reasons, including feeding on the high branches that giraffes can reach with their long necks, social interaction among the giraffes, and seeking shade under the tree to regulate body temperature in the hot African sun. This response is helpful as it addresses the question directly and provides multiple explanations that are accurate based on known giraffe behavior. The level of detail is appropriate for the question, including the context of their natural habitat and the social nature of giraffes. Therefore, Assistant 2 receives a score of 8."
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"question": "What challenges could the duck face while walking along the paved road?",
|
| 88 |
+
"correct_answer": "While walking along the paved road, the duck may face various challenges. Firstly, the duck could be at risk of encountering vehicles, which might not notice or expect to see wildlife on the road. This could put the duck in danger of being hit or injured by passing traffic. Secondly, the duck might struggle to find appropriate food sources on or near the paved road, as opposed to its natural habitat, such as a body of water or a grassy area, where it would have easier access to its regular diet.\n\nFurthermore, the duck might be exposed to potential predators, like domestic pets or other animals that live in urban environments, increasing the risk of harm for the duck. Lastly, walking on the paved concrete surface could be less comfortable for the duck than walking on softer natural ground, causing discomfort over time. Overall, the duck's safety and well-being may be compromised by navigating this environment that is not adapted to its natural behaviors and needs.",
|
| 89 |
+
"response": "",
|
| 90 |
+
"score": false,
|
| 91 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, advice, or insight regarding the challenges a duck (though the context mentions a goose, the question refers to a duck) might face while walking along a paved road. Therefore, it receives a score of 0 due to the lack of any content in its response.\n\nAssistant 2, on the other hand, provided a detailed and relevant answer to the question. It correctly identified and elaborated on several potential challenges a duck could face while walking along a paved road, such as the risk of encountering vehicles, difficulty finding food, exposure to predators, and discomfort from walking on a hard surface. The response was well-structured, informative, and directly addressed the question with appropriate depth, making it helpful and relevant to the user's inquiry. Thus, Assistant 2 receives a score of 8. The reason for not scoring higher is due to the initial confusion in the context (goose mentioned, but the question is about a duck), which was not clarified or corrected in the response, and there might be room for even more detailed exploration of each point or additional challenges not mentioned. However, overall, Assistant 2's performance was strong in providing a comprehensive answer to the question posed."
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"question": "Imagine you are walking down this street; how would you know the time or which direction the sidewalk leads?",
|
| 95 |
+
"correct_answer": "As you walk down this quiet street, you can easily tell the time by looking at the tall clock that is mounted on a pole along the sidewalk. This clock stands out significantly, making it easily noticeable. Regarding the direction of the sidewalk, the presence of potted plants, bicycles, and cars suggest that this is a well-maintained and organized street. As you follow the sidewalk further, you will see that it is lined with trees, potted plants, and parked bicycles and cars, guiding you in the direction it leads. Additionally, the building next to the clock also gives you context for the orientation and direction of the street.",
|
| 96 |
+
"response": "",
|
| 97 |
+
"score": false,
|
| 98 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which means it failed to offer any information or insight that could be evaluated. Therefore, it receives a score of 0 for not contributing to the user's request for information.\n\nAssistant 2, on the other hand, crafted a response that creatively interpreted the context provided by the user. It described how one could tell the time by looking at the clock on the short tower and inferred the direction of the sidewalk based on the arrangement of potted plants, bicycles, and cars. This response is helpful and relevant to the user's question, showing a good level of detail in describing how the scene's elements contribute to understanding the time and sidewalk direction. However, the response could have been improved by directly addressing the specifics of how the clock's visibility aids in telling the time (e.g., mentioning if the clock has large, readable numbers or if it's illuminated at night) and by providing more precise indicators of directionality (e.g., the flow of traffic or the orientation of the potted plants and bicycles). Therefore, Assistant 2 receives a score of 7 for its imaginative and contextually appropriate response, despite the lack of specific details that could have enhanced its usefulness."
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"question": "What could be a reason for the cat's interest in the laptop?",
|
| 102 |
+
"correct_answer": "The cat may be interested in the laptop due to the light coming from the screen, the movement of the cursor, or the sounds produced by the laptop, such as keystrokes or notifications. Cats are known to be naturally curious creatures and are often attracted to objects that stimulate their senses. The visual display, warmth emanating from the device, and interactive nature of the laptop could be appealing to the cat, prompting it to sit on the desk and face the open laptop. Additionally, the cat may simply be seeking its owner's attention or wanting to be close to them while they use the laptop.",
|
| 103 |
+
"response": "",
|
| 104 |
+
"score": false,
|
| 105 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail. \n\nAssistant 2, on the other hand, offered a detailed and relevant explanation for why a cat might be interested in an open laptop. The response included various plausible reasons such as the attraction to the light from the screen, the movement of the cursor, sounds produced by the laptop, and the warmth it emits. Additionally, it mentioned the cat's natural curiosity and the possibility of seeking the owner's attention or wanting to be close to them, which are insightful observations about cat behavior. This answer is helpful, relevant to the question, accurate based on common knowledge about cats, and detailed in its coverage of possible reasons for the cat's interest. Therefore, Assistant 2 receives a score of 8. The deduction from a perfect score is due to the potential for even more detailed exploration of cat behavior or the inclusion of scientific insights into why cats might find laptops appealing, which could have provided an even richer response. However, the answer as it stands is informative and well-constructed."
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"question": "What purpose does the umbrella serve on the beach?",
|
| 109 |
+
"correct_answer": "The colorful umbrella set up on the beach serves several purposes. First, it provides shade from the sun, which helps protect people from direct sunlight and the associated harmful UV rays, reducing the risk of sunburn and heatstroke. Second, it offers a comfortable spot to relax, rest, and enjoy the beach ambiance without being exposed to the intense sun or heat. Finally, the umbrella creates a designated area for beach-goers to keep their belongings and have a visible landmark to locate their spot quickly when in the crowded beach environment.",
|
| 110 |
+
"response": "The umbrella serves as a shelter for the children, providing them with a place to rest and enjoy the sun.",
|
| 111 |
+
"score": false,
|
| 112 |
+
"gpt_response": "6 9\n\nAssistant 1 provides a brief and somewhat accurate response, focusing solely on the umbrella serving as a shelter for children to rest and enjoy the sun. This answer is somewhat relevant and accurate but lacks detail and does not consider the broader purposes an umbrella serves on the beach, such as protection from UV rays for anyone, not just children. The response is straightforward but misses the opportunity to provide a more comprehensive explanation of the umbrella's utility.\n\nAssistant 2, on the other hand, offers a detailed and comprehensive explanation of the purposes served by a beach umbrella. It correctly identifies the primary function of providing shade and protection from harmful UV rays, which is crucial for all beach-goers, not just children. Additionally, it mentions the comfort provided by having a shaded spot to relax and the practical aspect of marking a spot on a crowded beach. The response is relevant, accurate, and includes a level of detail that gives a fuller understanding of the umbrella's purpose, making it more helpful to someone seeking to understand the various benefits of using an umbrella on the beach.\n\nTherefore, Assistant 2 receives a higher score for its thoroughness, relevance, and accuracy, while Assistant 1, although providing a correct but limited perspective, receives a lower score due to its lack of detail and narrower focus."
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"question": "What might be the reason behind these people taking apart their video game controllers?",
|
| 116 |
+
"correct_answer": "A plausible reason for the two people taking apart their video game controllers could be that they need to replace the batteries inside. Video game remote controls generally operate on batteries, and over time, the batteries may drain and require replacement for the controllers to continue functioning properly. These people might have experienced the controllers not working or functioning sub-optimally, leading them to disassemble the remotes on a wooden table to access and replace the batteries. This action ensures their gaming experience remains uninterrupted and enjoyable.",
|
| 117 |
+
"response": "",
|
| 118 |
+
"score": false,
|
| 119 |
+
"gpt_response": "0 6\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2 offered a plausible reason for why the two individuals might be taking apart their video game controllers, focusing on the need to replace batteries. This response is relevant to the context of maintaining or troubleshooting video game controllers, which often involves dealing with power issues. The explanation is coherent and provides a logical scenario that could explain the observed activity. However, the response could be improved by considering a wider range of possible reasons for disassembling a controller, such as cleaning, repairing button responsiveness, or custom modifications, which are also common. The level of detail is adequate for the scenario provided but lacks depth in exploring other potential motivations. Therefore, Assistant 2 receives a score of 6 for providing a relevant and plausible explanation but not considering a broader range of reasons or providing more detailed insights into the process of taking apart video game controllers."
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"question": "What potential factors could make these suitcases valuable?",
|
| 123 |
+
"correct_answer": "Several factors could make the two stacked suitcases valuable. In the image, they are described as antique, which suggests that they are potentially rare or have some historical significance. Their age and rarity could contribute to their value. Additionally, they are made of leather, which is a material known for its durability and, in some cases, luxury. The suitcases also differ in color, featuring black, brown, and yellow tones, which may attract buyers due to their aesthetic appeal or the desire to own a unique piece of luggage. Furthermore, the presence of price tags on the luggage indicates that they are being sold, drawing attention to their perceived value in the market. Collectors or enthusiasts of vintage items may find these suitcases valuable due to their material, design, age, and distinct appearance.",
|
| 124 |
+
"response": "",
|
| 125 |
+
"score": false,
|
| 126 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a detailed analysis of the factors that could contribute to the value of the two suitcases. The response included considerations of the suitcases being antique, made of leather, having a unique color scheme, and the presence of price tags as indicators of value. This answer is relevant to the question, accurate based on the information provided in the context, and detailed in its exploration of various factors that could contribute to the suitcases' value. Therefore, Assistant 2 receives a score of 8. The deduction from a perfect score is due to the mention of specific details (e.g., price tags, exact colors) that were not provided in the user's question or context, which could potentially mislead if those details were assumed rather than directly observed from the image. However, the overall quality of the response in terms of relevance, accuracy, and level of detail is high, justifying the score."
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"question": "What activity might have recently taken place around this table and what could be its aftermath?",
|
| 130 |
+
"correct_answer": "A meal or gathering might have recently taken place around this table, as evidenced by the variety of dirty dishes, utensils, and drinkware present on it. The aftermath of this meal or event could involve the need to clean up and wash the dirty dishes, glasses, and eating utensils. Items on the table include plates, forks, spoons, cups, and a bottle, which are typically used during such occasions. Participants might have engaged in conversation, shared food and beverages, and enjoyed each other's company at this table. Once the gathering is complete, disposing of any leftovers and cleaning the table area would be necessary to prepare it for the next use.",
|
| 131 |
+
"response": "",
|
| 132 |
+
"score": false,
|
| 133 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and relevant response to the question. It inferred that a meal or gathering might have recently taken place, based on the presence of dirty dishes, utensils, and drinkware. The assistant also discussed the aftermath of such an event, including the need for cleaning up. This response is helpful as it accurately interprets the scene described in the question and provides a logical explanation of the events that might have occurred, as well as their consequences. The level of detail regarding the types of items on the table (plates, forks, spoons, cups, and a bottle) and the activities (conversation, sharing food and beverages) enhances the quality of the response. Therefore, Assistant 2 receives a score of 8 for its comprehensive and accurate reply."
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"question": "What unique taste combinations can be found in this box of doughnuts?",
|
| 137 |
+
"correct_answer": "The box contains a variety of doughnuts with unique taste combinations. Among the four doughnuts, there are cake doughnuts, a glazed doughnut, and one with a mix of nuts and coconut as toppings. These different toppings and textures provide a diverse selection for those who want to try various flavors and types of doughnuts. Combining the flavors of nuts and coconut on one doughnut, in particular, offers a unique taste experience that blends the richness of nuts with the tropical sweetness of coconut. Thus, the box offers a selection that caters to different preferences and invites people to discover new taste combinations.",
|
| 138 |
+
"response": "",
|
| 139 |
+
"score": false,
|
| 140 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed response that described the variety of doughnuts in the box, including cake doughnuts, a glazed doughnut, and one with a mix of nuts and coconut as toppings. This response is relevant to the question about unique taste combinations in the box of doughnuts. The assistant's mention of specific types of doughnuts and the unique combination of nuts and coconut provides a clear and engaging description that would likely be helpful and interesting to the user. The level of detail, including the description of the doughnuts and the focus on the unique taste experience provided by the combination of nuts and coconut, is commendable. However, without the visual content or more specific details about all the doughnuts in the box, the response's accuracy and completeness are somewhat limited. Therefore, Assistant 2 receives a score of 7 for its effort to describe the doughnuts' variety and taste combinations, despite the lack of visual confirmation or exhaustive detail about every doughnut in the box."
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"question": "What is the connection between the objects in the image?",
|
| 144 |
+
"correct_answer": "In the image, a cell phone is displayed between earbuds and two jewels. The connection between these objects is that they can represent luxury, personal belongings, or daily essential items. The cell phone and earbuds are electronic devices used for communication and entertainment purposes. Both are commonly used in daily life to maintain contact with others, listen to music, or utilize various applications. The jewels, on the other hand, symbolize wealth, luxury, and exclusivity. These items seem to be placed with the intention of emphasizing the cell phone's premium value, associating it with luxury and high quality, potentially for advertising or product display purposes.",
|
| 145 |
+
"response": "",
|
| 146 |
+
"score": false,
|
| 147 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, analysis, or insight regarding the connection between the objects in the image. Therefore, it receives a score of 0 due to the lack of any content in its response.\n\nAssistant 2, on the other hand, offered a detailed explanation connecting the objects in the image. It interpreted the presence of a cell phone, earbuds, and jewels as indicative of luxury, personal belongings, or daily essentials. The response elaborates on how each item fits into these categories, providing a plausible interpretation that the items might be used to emphasize the premium value of the cell phone, possibly for advertising or product display purposes. This answer is relevant, accurate to the context provided, and detailed, making it helpful for someone trying to understand the potential connection between these objects. Therefore, Assistant 2 receives a score of 8 for its comprehensive and insightful analysis."
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"question": "What measures may be taken by the dog's owner to make the dog feel comfortable in the room?",
|
| 151 |
+
"correct_answer": "The dog owner seems to have taken several measures to make their dog feel comfortable in the room. Based on the image, an adorable husky dog has a designated dog bed to sleep in, providing cushioning and a cozy space for rest. The room is also dimly lit or dark, which contributes to a calmer atmosphere that promotes sleep and relaxation. There might be other considerations, such as room temperature or air circulation, that aid in creating a comfortable environment for the dog. It's essential for pet owners to ensure that their pets have a secure and comfortable space to rest in order to maintain their well-being and happiness.",
|
| 152 |
+
"response": "",
|
| 153 |
+
"score": false,
|
| 154 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, despite the lack of direct access to the image and relying on the provided context, made an effort to infer and provide a detailed response based on the scenario described. The assistant speculated about the presence of a dog bed and a dimly lit room, which are reasonable assumptions given the context. It also mentioned the importance of room temperature and air circulation for the dog's comfort, showing an understanding of factors that contribute to a comfortable environment for pets. While the response could not be verified for accuracy against the actual image, it demonstrated a thoughtful approach to the question, considering various aspects of a dog's comfort. Therefore, Assistant 2 receives a score of 7 for its attempt to provide a comprehensive answer based on the given context."
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"question": "What benefits come from having a fruit tree near a building's window?",
|
| 158 |
+
"correct_answer": "Having a fruit tree, like the apple tree shown in the image, near a building's window offers several benefits. Firstly, it provides easy access to fresh and healthy fruits, in this case, apples, which can be enjoyed by the residents. This can promote healthy eating habits and encourage local food sources. Secondly, a fruit tree in close proximity can enhance the aesthetic appeal of the surrounding area, with its vibrant colors and foliage, creating a pleasant view from the window. Moreover, the tree can contribute to the local ecosystem by supporting insects, birds, and other wildlife, promoting biodiversity. Finally, the tree can also offer shade during hot weather and help with temperature regulation by cooling down the close environment, potentially reducing the need for air conditioning and thus lowering energy costs.",
|
| 159 |
+
"response": "",
|
| 160 |
+
"score": false,
|
| 161 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information, advice, or insight regarding the benefits of having a fruit tree near a building's window. Therefore, it receives a score of 0 due to the lack of content in its response.\n\nAssistant 2, on the other hand, provided a detailed and relevant answer that covered multiple benefits of having a fruit tree near a building's window. The response mentioned the advantage of having easy access to fresh fruits, the aesthetic appeal of the tree, its contribution to the local ecosystem, and the potential for energy savings through natural cooling. This answer is informative, relevant to the question, and offers a comprehensive view of the various benefits, thus earning a score of 8. The score is not perfect because the response assumes the presence of an apple tree, which was not specified in the user's question or context provided to me, indicating a slight inaccuracy in assuming details not provided. However, the general benefits listed would apply to most fruit trees, making the response broadly applicable and useful."
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"question": "How can one infer that the man in the image is drawing attention to himself?",
|
| 165 |
+
"correct_answer": "The man in the image is drawing attention to himself due to his unconventional appearance and fashion choices. He is sporting bright purple hair, which is not a common hair color and stands out from the norm. Additionally, the man is wearing a purple shirt and tie, which also contributes to his bold and eye-catching ensemble. His unique and colorful appearance is likely to grab the attention of passersby as he walks down the street talking on his cell phone.",
|
| 166 |
+
"response": "",
|
| 167 |
+
"score": false,
|
| 168 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate. There's no information, insight, or analysis offered in response to the user's query about how the man's appearance might draw attention to himself.\n\nAssistant 2, on the other hand, offered a detailed explanation that directly addresses the user's question. The response highlights the man's unconventional choice of hair color and his matching outfit, which are both elements that can make someone stand out in a crowd. The mention of him talking on his cell phone while sporting this unique look adds to the narrative that he is drawing attention to himself, although this detail seems to be inferred rather than directly observed from the image description provided in the context. The response could have been improved by acknowledging that the inference is based on typical societal norms regarding hair color and fashion, and by clarifying that the assumption about the cell phone is an addition to the scenario rather than a detail confirmed by the image. Nonetheless, the response is relevant, accurate to the extent of the information provided, and detailed in its analysis of why the man's appearance would draw attention. Therefore, Assistant 2 receives a score of 7 for its helpful and insightful response, despite the minor assumption made about the man talking on his cell phone."
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"question": "What benefits do umbrella hats provide to the couple on this rainy day?",
|
| 172 |
+
"correct_answer": "On this rainy day, the umbrella hats provide the couple several benefits as they sit on top of a bridge near the ocean with their dog. First, the umbrella hats enable them to keep their hands free, allowing them to hold their dog's leash, interact with each other, and perform other tasks without holding a traditional umbrella. Second, the umbrella hats protect their heads and upper bodies from getting wet due to rain, making their outdoor experience more comfortable. Additionally, the novel and fun nature of the umbrella hats can be a conversation starter and bring some humor to their day despite the gloomy weather.",
|
| 173 |
+
"response": "The umbrella hats provide a shelter for the couple on this rainy day. The hats are designed to be waterproof and can protect the couple from the rain. This makes the couple more comfortable and safe during the rainy day.",
|
| 174 |
+
"score": false,
|
| 175 |
+
"gpt_response": "7 8\n\nAssistant 1 provided a straightforward answer, focusing on the primary function of umbrella hats, which is to provide shelter and protection from the rain. The response was relevant and accurate, highlighting the waterproof nature of the hats and their role in making the couple more comfortable and safe during a rainy day. However, the answer lacked detail and did not explore the potential additional benefits or situational context that could enrich the response, resulting in a score of 7.\n\nAssistant 2, on the other hand, offered a more detailed and contextualized answer. It not only mentioned the basic benefit of keeping the couple dry but also expanded on the practical advantages of having hands free, which is particularly useful when managing a pet or needing to interact with the environment. Additionally, Assistant 2 touched on the social and emotional benefits, such as the hats being a conversation starter and adding humor to a gloomy day. This response was more comprehensive, considering the situational context (sitting on a bridge near the ocean with their dog) and the multifaceted benefits of umbrella hats. Therefore, Assistant 2 received a higher score of 8 for providing a more detailed and contextually rich answer. However, it's important to note that the specific detail about being on a bridge was not mentioned in the provided context, which introduces an assumption not directly supported by the given information. Despite this, the overall quality of the response was enhanced by the additional details and considerations."
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"question": "What could be a potential occasion for this arrangement?",
|
| 179 |
+
"correct_answer": "The image shows a neatly arranged suit, complete with a white shirt, red tie, and black shoes, laid out on a bed. This preparation could suggest a potential upcoming formal occasion, such as a job interview, a wedding, a business meeting, or an important event requiring a professional attire. The person is likely getting his outfit ready in advance to ensure proper presentation, and to avoid rushing or forgetting any essential elements of the attire on the day of the event.",
|
| 180 |
+
"response": "",
|
| 181 |
+
"score": false,
|
| 182 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance in terms of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, despite the initial misunderstanding that there was an image to analyze (which there wasn't, as the user only provided a textual description), offered a thoughtful and detailed response. The assistant suggested several potential occasions for wearing a white shirt, red tie, and black shoes, such as a job interview, a wedding, a business meeting, or an important event requiring professional attire. This response is helpful and relevant to the user's question, providing a broad perspective on the types of formal occasions that might call for such an outfit. The level of detail, including the rationale for preparing the outfit in advance, enhances the quality of the response. However, the mention of an image and the preparation of the outfit on a bed were based on an incorrect assumption, slightly detracting from the accuracy. Despite this, the overall helpfulness and relevance of the response merit a score of 7."
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"question": "What may be a potential obstacle for the house construction in its current state?",
|
| 186 |
+
"correct_answer": "In the current state of the house construction with wooden studs and a partially-built staircase, a potential obstacle that might occur is the incomplete structure being exposed to external elements like rain, snow, or strong winds. These conditions can potentially damage the building materials, delay construction work, and cause additional unexpected costs for repairing or replacing materials. It is essential for the builders to properly cover the construction site and store materials accordingly to protect them from potential damage when not in use.",
|
| 187 |
+
"response": "",
|
| 188 |
+
"score": false,
|
| 189 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, provided a detailed and relevant response to the potential obstacle for house construction in its current state, specifically mentioning the risk posed by external elements like rain, snow, or strong winds. This answer is helpful as it identifies a common and significant issue in construction, offers insight into the consequences of such an obstacle (damage to materials, delays, and additional costs), and implicitly suggests the importance of protecting the construction site and materials. The response is accurate, considering the general knowledge about construction processes and the potential risks involved. It is also sufficiently detailed, giving a clear picture of the potential problem and its implications. Therefore, Assistant 2 receives a score of 8 for its comprehensive and informative answer."
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"question": "What might be the reason behind this gathering?",
|
| 193 |
+
"correct_answer": "It appears that the group of people are gathered for a wine tasting or celebration in which they are enjoying various types of wine. They are seen standing and sitting around a table with several wine bottles and holding wine glasses. Their smiles and the friendly atmosphere indicate that it's a social event where they have gathered to indulge in sampling different wines, engage in conversations, and enjoy each other's company.",
|
| 194 |
+
"response": "",
|
| 195 |
+
"score": false,
|
| 196 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and relevant response based on the context provided. The assistant inferred that the gathering is for a wine tasting or celebration, deducing this from the description of people enjoying various types of wine, the presence of several wine bottles, and the overall friendly atmosphere. This response is helpful as it directly addresses the user's question with a plausible explanation. It is relevant because it matches the context of a group of people tasting wine at a celebration. The accuracy cannot be directly verified without the original image or additional context, but the inference made is logical given the described scenario. The level of detail, including the description of the setting and the behavior of the people, enhances the quality of the response. Therefore, Assistant 2 receives a score of 8 for its comprehensive and reasoned answer."
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"question": "What could be a potential concern for the baby elephant in this setting?",
|
| 200 |
+
"correct_answer": "A potential concern for the baby elephant standing alone inside the pen could be the lack of social interaction with other elephants. Elephants are highly social creatures and form strong bonds within their family units. The absence of other elephants in the enclosure might lead to feelings of loneliness, stress, and anxiety for the baby elephant. It is crucial for the mental and emotional well-being of elephants, especially young ones, to have regular opportunities to interact with their peers and family members in a naturalistic, supportive environment. By addressing this concern, the caretakers of the baby elephant can help ensure its psychological well-being and overall health.",
|
| 201 |
+
"response": "",
|
| 202 |
+
"score": false,
|
| 203 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail. \n\nAssistant 2, on the other hand, offered a detailed and relevant response addressing a potential concern for the baby elephant being alone in the pen. The explanation about elephants being highly social creatures and the importance of social interaction for their mental and emotional well-being is accurate and informative. This response is helpful for someone looking to understand the implications of isolating a baby elephant from its peers and family members. The level of detail regarding the psychological well-being and overall health of the elephant adds value to the response, making it comprehensive. Therefore, Assistant 2 receives a score of 8, reflecting its performance in providing a detailed, accurate, and relevant answer to the question posed."
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"question": "How might the art installation encourage interaction among people?",
|
| 207 |
+
"correct_answer": "The art installation, featuring an oversized wooden bench and two massive animal art sculptures, encourages interaction among people by providing a visually intriguing and inviting space to sit or gather. People are naturally drawn to the unique and whimsical nature of these installations, sparking curiosity and conversation among those who encounter them. The oversized bench provides seating for multiple individuals, prompting people to sit down, rest, or socialize while admiring the giant painted feline heads and other artworks on display. Additionally, the installations capture the attention of passersby, creating a shared experience and a sense of community among those who visit the area. The artistic environment stimulates discussion and appreciation of the art, facilitating social interactions and connections among those who gather near the sculptures and oversized bench.",
|
| 208 |
+
"response": "",
|
| 209 |
+
"score": false,
|
| 210 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and imaginative response to how an art installation featuring an oversized wooden bench and two massive animal art sculptures could encourage interaction among people. The assistant described the installations as visually intriguing and inviting, which would naturally draw people in and spark curiosity and conversation. The mention of the oversized bench facilitating seating for multiple individuals encourages socialization, while the unique nature of the installations creates a shared experience and fosters a sense of community. This response is helpful as it provides a clear and vivid picture of how the art installation could function as a social catalyst. It is relevant to the question, accurate in its depiction of typical human behavior in response to public art, and detailed in its description of the potential interactions. Therefore, Assistant 2 receives a score of 8 for its comprehensive and engaging response."
|
| 211 |
+
}
|
| 212 |
+
]
|
slice_4876/17435091731.0/conv.json
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"question": "What is the position of the skateboard in the image?",
|
| 4 |
+
"correct_answer": "The skateboard in the image is in an upside-down position, with its wheels pointing up and laying on the ground.",
|
| 5 |
+
"response": "",
|
| 6 |
+
"score": false,
|
| 7 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, gave a clear and direct answer to the user's question, stating that \"The skateboard in the image is in an upside-down position, with its wheels pointing up and laying on the ground.\" This response is helpful as it directly addresses the user's query, relevant to the context provided, accurate based on the description of the skateboard's position, and sufficiently detailed for the user to understand the skateboard's orientation without seeing the image. Thus, Assistant 2 receives a score of 8. The deduction in points is due to the lack of additional details that could have been provided, such as the condition of the skateboard or its surroundings, which might have been inferred from the context or the detailed description of the image provided in the system's explanation. However, given the information available, Assistant 2's response is commendable."
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"question": "What is the main focus of the image?",
|
| 11 |
+
"correct_answer": "The main focus of the image is a car parked on the side of the road, next to a parking meter.",
|
| 12 |
+
"response": "The main focus of the image is the black SUV, which is prominently displayed in the center of the image.",
|
| 13 |
+
"score": false,
|
| 14 |
+
"gpt_response": "7 8\n\nBoth assistants provided answers that are relevant and somewhat accurate based on the context provided. However, without the actual image or the detailed descriptions and bounding box coordinates, it's challenging to determine the absolute accuracy of each response. Therefore, the evaluation is based on the assumption that both descriptions could plausibly match the image based on the context given.\n\nAssistant 1's response is slightly less detailed as it only mentions the black SUV and its position in the center of the image. The mention of the SUV being \"prominently displayed\" adds a bit of detail regarding the composition of the image, suggesting that the car is a significant element within it. However, the lack of additional context or description of the surroundings makes this response less comprehensive.\n\nAssistant 2 provides a bit more context by mentioning the car is parked next to a parking meter. This additional detail not only confirms the car's location (on the side of the road) but also adds an element to the scene that helps the reader visualize the setting more clearly. The mention of a parking meter implies a certain type of environment (likely urban) and suggests the car is legally parked, which adds a layer of detail about the scene.\n\nBoth responses are helpful and relevant, but Assistant 2's answer is slightly more informative due to the additional context provided. Therefore, Assistant 2 receives a higher score. The scores reflect the level of detail and the ability to convey a clearer image of the scene to the reader, which is crucial for questions based on visual content."
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"question": "What is the pattern on the little girl's umbrella and raincoat?",
|
| 18 |
+
"correct_answer": "The little girl's umbrella and raincoat both have a ladybug pattern on them.",
|
| 19 |
+
"response": "",
|
| 20 |
+
"score": false,
|
| 21 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which means it failed to offer any information or insight regarding the pattern on the little girl's umbrella and raincoat. Therefore, it receives a score of 0 for not contributing to the user's query in any manner.\n\nAssistant 2, on the other hand, directly answered the user's question by stating that the little girl's umbrella and raincoat both have a ladybug pattern on them. This response is helpful, relevant, and accurate based on the context provided. It directly addresses the user's query with a clear and concise answer, making it easy for the user to understand the pattern on the little girl's items without needing further clarification. Therefore, Assistant 2 receives a score of 10 for effectively and accurately responding to the user's question."
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"question": "What is the cat doing on the red couch?",
|
| 25 |
+
"correct_answer": "The cat is curled up and sleeping on the red couch.",
|
| 26 |
+
"response": "",
|
| 27 |
+
"score": false,
|
| 28 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0, as it failed to fulfill the user's request for information.\n\nAssistant 2 directly answered the user's question by stating that \"The cat is curled up and sleeping on the red couch.\" This response is both accurate and relevant, directly addressing the user's query based on the provided context. It succinctly describes the cat's activity and its location, matching the information given in the context. There's no additional detail required for this specific question, making the response perfectly adequate. Thus, Assistant 2 receives a score of 10 for effectively and accurately responding to the user's question."
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"question": "What is the main focus of the image?",
|
| 32 |
+
"correct_answer": "The main focus of the image is the head of a giraffe, shown in a close-up headshot.",
|
| 33 |
+
"response": "",
|
| 34 |
+
"score": false,
|
| 35 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a specific answer by stating that the main focus of the image is the head of a giraffe, described as a close-up headshot. This response is helpful as it directly addresses the user's question about the main focus of the image. It is relevant and accurate based on the context provided, assuming the description of the image indeed matches the content. The level of detail is appropriate for the question, as it specifies the part of the giraffe (the head) that is the focus, and further describes the nature of the shot (close-up headshot). Therefore, Assistant 2 receives a score of 8 for its performance."
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"question": "Where is the cart with luggage bags located?",
|
| 39 |
+
"correct_answer": "The cart with luggage bags is located in a lobby.",
|
| 40 |
+
"response": "",
|
| 41 |
+
"score": false,
|
| 42 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2 provided a specific location (a lobby) for the cart with luggage bags. While this response assumes a context that was not explicitly provided by the user, it does offer a plausible scenario where one might find a cart filled with suitcases and bags. This answer could be considered helpful if the user was indeed visualizing or referring to a common scenario involving luggage carts, such as in hotels or airports. However, without access to the image or the descriptive sentences and bounding box coordinates mentioned in the system's note, it's impossible to verify the accuracy of Assistant 2's response. Given these limitations, Assistant 2's response is somewhat helpful and relevant, assuming a common context, but lacks detail and cannot be verified for accuracy. Thus, it receives a moderate score of 5."
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"question": "What objects are on the table in the image?",
|
| 46 |
+
"correct_answer": "The objects on the table in the image include a folded newspaper, sunglasses, books, an apple, and a teddy bear.",
|
| 47 |
+
"response": "",
|
| 48 |
+
"score": false,
|
| 49 |
+
"gpt_response": "0 4\n\nAssistant 1 did not provide any response to the user's question, which means it failed to offer any information or assistance. Therefore, it receives a score of 0 for not contributing to the user's request for information about the objects on the table in the image.\n\nAssistant 2, on the other hand, attempted to answer the question by listing objects that are supposedly on the table in the image. However, the response included items (books, an apple, and a teddy bear) that were not mentioned in the context provided by the user. The only objects confirmed to be in the image by the user's context were sunglasses and a folded newspaper. This indicates that Assistant 2's response was partially inaccurate as it added objects not verified by the given context. Despite this, Assistant 2 did engage with the question and provided a detailed response, albeit with inaccuracies. Therefore, it receives a score of 4 for its effort to provide a detailed answer but with significant inaccuracies regarding the content of the image as described in the context."
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"question": "Is the person riding a motorbike or scooter?",
|
| 53 |
+
"correct_answer": "The person is riding a motorbike, which can also be referred to as a motorcycle or a moped. In this case, the terms motorcycle, scooter, and moped are used interchangeably to describe the same vehicle the woman is riding.",
|
| 54 |
+
"response": "",
|
| 55 |
+
"score": false,
|
| 56 |
+
"gpt_response": "0 4\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2 attempted to answer the question but provided incorrect information by conflating the terms motorcycle, scooter, and moped. These terms do not describe the same type of vehicle interchangeably; motorcycles and scooters are different types of two-wheeled vehicles, with mopeds being a subclass of scooters characterized by their engine size and speed capabilities. The response shows an effort to provide an answer but fails in accuracy and specificity. The lack of distinction between these vehicle types can lead to confusion, especially without visual confirmation from the described image. Therefore, Assistant 2 receives a score of 4 for attempting to address the question but significantly lacking in accuracy and relevant detail."
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"question": "How many airplanes are visible in the image?",
|
| 60 |
+
"correct_answer": "There are two large passenger airplanes visible in the image.",
|
| 61 |
+
"response": "",
|
| 62 |
+
"score": false,
|
| 63 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, directly answered the user's question by stating that there are two large passenger airplanes visible in the image. This response is relevant and accurate based on the context provided. However, the answer lacks detail about the surroundings, such as the water and birds mentioned in the context, which could have made the response more comprehensive. Despite this, Assistant 2's response directly addresses the user's question, making it helpful and relevant. Therefore, it receives a score of 8 for its direct and accurate, albeit brief, answer."
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"question": "What is the man doing in the image?",
|
| 67 |
+
"correct_answer": "In the image, the man is holding up clothes on hangers, possibly in some hanger bags, and appears to be preparing for travel, as a suitcase is also in front of him.",
|
| 68 |
+
"response": "",
|
| 69 |
+
"score": false,
|
| 70 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a plausible interpretation of the scene based on the description provided by the user. The assistant inferred that the man is possibly preparing for travel, which is a reasonable assumption given the presence of clothes on hangers (potentially in hanger bags) and a suitcase. This response is helpful as it provides context to the user's observation, relevant to the visual cues mentioned, accurate based on the information given, and detailed enough to paint a clear picture of the scenario. However, without visual confirmation or more detailed description of the image, the assumption about preparing for travel remains speculative, which prevents a perfect score. Thus, Assistant 2 receives a score of 7 for its effort to contextualize and interpret the scene accurately based on the given description."
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"question": "What is the man doing in the image?",
|
| 74 |
+
"correct_answer": "The man in the image is using his cell phone and giving a thumbs up, possibly posing for a picture.",
|
| 75 |
+
"response": "",
|
| 76 |
+
"score": false,
|
| 77 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a concise and relevant answer based on the context provided. The assistant inferred that the man is using his cell phone and giving a thumbs up, possibly for a picture, which aligns well with the context given. This response is helpful as it directly addresses the user's question, is relevant to the described image, accurately interprets the actions of the man based on the description, and provides a reasonable level of detail given the simplicity of the question. Thus, Assistant 2 receives a score of 7. The deduction from a perfect score is due to the lack of additional insights or elaboration that could have been provided, such as potential reasons for the man's gesture or the context in which it might be occurring, which would have added depth to the answer."
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"question": "How many giraffes are depicted in the image?",
|
| 81 |
+
"correct_answer": "There are four giraffes in the image.",
|
| 82 |
+
"response": "",
|
| 83 |
+
"score": false,
|
| 84 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0, as it failed to contribute any information or answer to the query.\n\nAssistant 2, on the other hand, provided a specific answer to the question by stating that there are four giraffes in the image. This response directly addresses the user's query with a clear and precise answer, assuming the description of the visual content accurately matches the number of giraffes depicted. Without access to the image or the descriptive sentences and bounding box coordinates mentioned, the evaluation can only be based on the assumption that Assistant 2's response is accurate. Given this assumption, Assistant 2's response is helpful, relevant, and accurate, warranting a score of 10. The level of detail is not applicable in this context since the question requires a straightforward numerical answer, which Assistant 2 provided effectively."
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"question": "What type of bird is pictured in the image?",
|
| 88 |
+
"correct_answer": "A white duck is pictured in the image.",
|
| 89 |
+
"response": "",
|
| 90 |
+
"score": true,
|
| 91 |
+
"gpt_response": "0 0\n\nBoth Assistant 1 and Assistant 2 failed to provide any response to the user's question regarding the type of bird pictured in the image. Assistant 1 did not provide any answer, leaving the response section completely blank. This indicates a total lack of attempt to address the user's query, making it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, provided an answer but incorrectly identified the bird as a \"white duck\" when the context clearly states that the bird in question is a goose. This misidentification directly contradicts the information given in the context, leading to a score of 0 as well. The response is inaccurate and irrelevant to the specific query, despite an attempt to provide an answer.\n\nIn summary, neither assistant provided a satisfactory response to the user's question. Assistant 1 failed to attempt an answer, while Assistant 2 provided an incorrect response, leading to the lowest possible score for both."
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"question": "What is the main object featured in the image?",
|
| 95 |
+
"correct_answer": "The main object featured in the image is the clock mounted on a pole or a short tower, standing on the sidewalk next to a building.",
|
| 96 |
+
"response": "",
|
| 97 |
+
"score": false,
|
| 98 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a clear and direct answer to the question, identifying the main object in the image as the clock mounted on a pole or a short tower. This response is relevant and accurate based on the context provided. Although the description is somewhat basic and does not delve into details about the clock's appearance, the surrounding environment, or the exact positioning of the potted plants, it directly addresses the question. The assistant could have enhanced its response by incorporating more details from the context, such as the appearance of the clock, the style of the tower, or the arrangement of the potted plants along the sidewalk. However, given the information provided in the prompt, Assistant 2's response is sufficiently informative to merit a score of 8. It accurately identifies the main object as described in the context, but a more detailed description could have provided a more comprehensive understanding of the scene."
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"question": "What is the main focus of the image?",
|
| 102 |
+
"correct_answer": "The main focus of the image is a cat or kitten sitting on or next to a laptop computer.",
|
| 103 |
+
"response": "",
|
| 104 |
+
"score": false,
|
| 105 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0, as it failed to contribute any information or insight regarding the user's query.\n\nAssistant 2, on the other hand, offered a concise and relevant answer to the question by identifying the main focus of the image as a cat or kitten sitting on or next to a laptop computer. This response is directly relevant to the user's query and accurately describes the main focus of the image based on the context provided. Although the response could benefit from additional details, such as the color of the laptop or the position of the kitten (facing the laptop), it still provides a clear and accurate description of the main subject of the image. Therefore, Assistant 2 receives a score of 8 for its helpful and accurate response, despite the lack of extensive detail."
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"question": "What is the main object in the image?",
|
| 109 |
+
"correct_answer": "The main object in the image is a colorful striped umbrella standing on the beach.",
|
| 110 |
+
"response": "The main object in the image is a colorful and vibrant rainbow.",
|
| 111 |
+
"score": false,
|
| 112 |
+
"gpt_response": "2 9\n\nAssistant 1's response inaccurately identifies the main object in the image as a \"colorful and vibrant rainbow,\" which does not align with the context provided, stating that the main object is a \"colorful umbrella sitting by the beach.\" This response is misleading and does not accurately describe the main object based on the given context. Therefore, it receives a low score for its lack of relevance and accuracy.\n\nAssistant 2, on the other hand, correctly identifies the main object as a \"colorful striped umbrella standing on the beach,\" which is consistent with the context provided. This response is accurate, relevant, and directly addresses the user's question with an appropriate level of detail. It correctly interprets the context and provides a precise answer, making it highly useful and informative for the user. Thus, it receives a high score for its accuracy, relevance, and level of detail in the response."
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"question": "How many people are involved in taking apart the video game controllers?",
|
| 116 |
+
"correct_answer": "There are two people involved in taking apart the video game controllers.",
|
| 117 |
+
"response": "",
|
| 118 |
+
"score": false,
|
| 119 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2 directly answered the user's question by stating, \"There are two people involved in taking apart the video game controllers.\" This response is helpful, relevant, and accurate based on the context provided. Although the answer lacks detail, the question did not require an elaborate response. Given the straightforward nature of the inquiry, Assistant 2's concise answer fully addresses what was asked without the need for additional information. Thus, it receives a score of 10."
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"question": "What is the color of the two suitcases in the image?",
|
| 123 |
+
"correct_answer": "The colors of the two suitcases in the image are black and brown with yellow details.",
|
| 124 |
+
"response": "",
|
| 125 |
+
"score": false,
|
| 126 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0, as it failed to fulfill the user's request for information.\n\nAssistant 2, on the other hand, provided a detailed description of the colors of the two suitcases, mentioning that they are black and brown with yellow details. This response is assumed to be accurate and relevant to the user's question, as it directly addresses the query about the color of the suitcases. The level of detail, including the mention of yellow details, suggests a thorough observation and description of the image, which is helpful for the user. Therefore, Assistant 2 receives a score of 10 for its performance, as it successfully provided a relevant, accurate, and detailed answer to the user's question."
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"question": "What are the main objects on the table in the image?",
|
| 130 |
+
"correct_answer": "The main objects on the table in the image are plates, glasses, eating utensils, and possibly a bottle of something.",
|
| 131 |
+
"response": "",
|
| 132 |
+
"score": false,
|
| 133 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, despite the lack of visual data processing capability, made an educated guess based on the context provided by the user. The response included a general list of items that one would expect to find on a table full of dirty dishes, such as plates, glasses, eating utensils, and possibly a bottle. This answer is helpful to some extent as it aligns with common expectations for the described scenario, shows relevance to the context, and includes a reasonable level of detail given the constraints. However, without access to the image, the accuracy of the response cannot be fully assessed, but the answer is sensible given the context. Therefore, Assistant 2 receives a score of 7 for making a reasonable attempt to provide a relevant and detailed response based on the information available."
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"question": "How many doughnuts are in the box?",
|
| 137 |
+
"correct_answer": "There are four doughnuts in the box.",
|
| 138 |
+
"response": "",
|
| 139 |
+
"score": false,
|
| 140 |
+
"gpt_response": "0 1\n\nAssistant 1 did not provide any answer to the question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, despite the lack of visual information provided in the prompt, made a specific claim that there are four doughnuts in the box. This response, while it cannot be verified against the actual content of the image due to the nature of this evaluation, at least attempts to answer the user's question. It provides a direct answer which could be seen as helpful if the user was looking for a straightforward response. However, without access to the image or the descriptive sentences and bounding box coordinates mentioned, there's no way to assess the accuracy of this claim. Given the lack of verifiable details and the assumption that Assistant 2's response is a guess, it receives a score of 1 for at least attempting to provide a specific answer.\n\nIn summary, Assistant 1's lack of response results in the lowest possible score. Assistant 2's attempt to provide an answer, despite the inability to verify its accuracy, offers a minimal level of engagement with the user's question, warranting a slightly higher score."
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"question": "What objects are next to the cellphone in the image?",
|
| 144 |
+
"correct_answer": "In the image, the cellphone is next to a pair of earbuds and two jewels.",
|
| 145 |
+
"response": "",
|
| 146 |
+
"score": false,
|
| 147 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0, as it failed to fulfill the user's request for information.\n\nAssistant 2 accurately described the objects next to the cellphone based on the given context, which implies that the assistant understood the question and provided a relevant and accurate answer. The response is concise and directly addresses the user's query without unnecessary details, making it highly relevant and helpful. Given the nature of the question, which requires a straightforward answer, the level of detail provided by Assistant 2 is appropriate. Thus, Assistant 2 receives a score of 10 for effectively meeting the user's needs with an accurate and relevant response."
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"question": "What breed is the dog in the image?",
|
| 151 |
+
"correct_answer": "The dog in the image is a husky.",
|
| 152 |
+
"response": "",
|
| 153 |
+
"score": true,
|
| 154 |
+
"gpt_response": "0 0\n\nBoth Assistant 1 and Assistant 2 cannot be accurately evaluated based on the information provided. Assistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of attempt to answer the user's query. Assistant 2 claimed that the dog in the image is a husky, but without access to the image or the descriptive sentences and bounding box coordinates mentioned in the system's note, there is no way to verify the accuracy of this claim. Therefore, Assistant 2 also receives a score of 0 because the evaluation criteria require an assessment based on accuracy, relevance, and level of detail in relation to the provided context, which is not possible to ascertain from the given setup. The scores reflect the inability to evaluate the assistants' performance accurately rather than a judgment on the quality of their responses under normal circumstances."
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"question": "What type of tree is outside the window with brick siding?",
|
| 158 |
+
"correct_answer": "There is an apple tree outside the window with brick siding.",
|
| 159 |
+
"response": "",
|
| 160 |
+
"score": false,
|
| 161 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, provided a specific answer by stating there is an apple tree outside the window with brick siding. However, without access to the image or the descriptive sentences and bounding box coordinates mentioned in the system's note, it's impossible to verify the accuracy of this response. Assuming the assistant's response is based on the provided context (which we cannot see), it at least attempted to answer the question, showing a level of helpfulness and relevance. The response lacks detail since it does not describe why it concluded the tree is an apple tree, nor does it reference the visual content or bounding box coordinates that could have supported its claim. Therefore, Assistant 2 receives a score of 5 for making an attempt to answer but not providing a detailed or verifiable response."
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"question": "What is the man doing in the image?",
|
| 165 |
+
"correct_answer": "The man in the image is walking down the street while talking on his cell phone.",
|
| 166 |
+
"response": "",
|
| 167 |
+
"score": false,
|
| 168 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a specific action that the man in the image is performing, which is \"walking down the street while talking on his cell phone.\" This response is partially helpful as it addresses the question about what the man is doing. However, it does not mention the man's hair color, which was a significant detail provided in the context. This omission affects the relevance and accuracy of the response, as it does not fully capture the unique characteristics of the man described in the context. Nonetheless, the response does provide a clear and detailed action, which is why it receives a score of 5. The score reflects that while the assistant provided some useful information, it failed to incorporate all relevant details from the context, leading to an incomplete answer."
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"question": "What type of hats are the man and woman wearing?",
|
| 172 |
+
"correct_answer": "The man and woman are wearing umbrella hats, which are designed to provide protection from the rain.",
|
| 173 |
+
"response": "",
|
| 174 |
+
"score": false,
|
| 175 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, provided a direct answer to the question by stating that the man and woman are wearing umbrella hats designed to protect from the rain. This response is relevant and accurate based on the context provided. However, the answer lacks detail about the specific features or variations of umbrella hats, which could have enhanced the quality of the response. For instance, mentioning the practicality of umbrella hats in freeing up the hands or their novelty aspect could have provided a more comprehensive answer. Despite this, Assistant 2's response directly addresses the question with a correct identification of the type of hats, earning it a score of 7 for its relevance and accuracy, albeit with room for improvement in detail and depth."
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"question": "What are the main items of clothing visible in the image?",
|
| 179 |
+
"correct_answer": "The main items of clothing visible in the image are a white shirt, a red tie, and black shoes.",
|
| 180 |
+
"response": "",
|
| 181 |
+
"score": false,
|
| 182 |
+
"gpt_response": "0 10\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2 accurately listed the main items of clothing as described in the context, which are a white shirt, a red tie, and black shoes. This response directly addresses the user's question with a clear and concise answer, demonstrating a high level of relevance and accuracy. Since the question did not require an in-depth explanation or additional details beyond identifying the items of clothing, the level of detail provided by Assistant 2 is appropriate for the context. Thus, Assistant 2 receives a score of 10 for effectively meeting the user's needs with an accurate and relevant response."
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"question": "What stage is the house in regarding its construction?",
|
| 186 |
+
"correct_answer": "The house is in the beginning stages of its construction, with the wooden structure, studs, and staircase partially built but not yet completed.",
|
| 187 |
+
"response": "",
|
| 188 |
+
"score": false,
|
| 189 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a specific answer by describing the house as being in the beginning stages of its construction, mentioning the wooden structure, studs, and staircase being partially built but not yet completed. This response is helpful as it gives a clear picture of the construction phase the house is in, relevant to the user's question, accurate based on the description provided, and detailed enough to understand the current state of the house's construction. Thus, Assistant 2 receives a score of 7. The reason for not scoring higher is due to the lack of information on other aspects of the beginning stages of construction, such as foundation work, which might also be relevant to the user's question. However, without the visual content, it's challenging to provide a more detailed assessment."
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"question": "How many people are visible in the image?",
|
| 193 |
+
"correct_answer": "There are three people visible in the image - two women and one man.",
|
| 194 |
+
"response": "",
|
| 195 |
+
"score": true,
|
| 196 |
+
"gpt_response": "0 0\n\nBoth Assistant 1 and Assistant 2 provided responses without any visible input or description of an image, which makes it impossible to evaluate their performance based on the provided context. Since the task involves analyzing an image to determine the number of people visible, and there is no image or detailed description provided in the text, neither assistant could have accurately answered the question. Assistant 1 did not provide any response, which results in a score of 0 due to the lack of attempt to answer the question. Assistant 2 made a specific claim about the number and gender of people visible in the image, but without access to the image or a detailed description, this response is baseless and cannot be verified for accuracy, relevance, or detail. Therefore, Assistant 2 also receives a score of 0. The evaluation is based solely on the information provided and the impossibility of accurately responding to the user's question without visual or detailed descriptive input."
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"question": "What is the color of the elephant in the image?",
|
| 200 |
+
"correct_answer": "The color of the elephant in the image is grey.",
|
| 201 |
+
"response": "",
|
| 202 |
+
"score": false,
|
| 203 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance based on helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2 provided a direct answer to the user's question by stating the color of the elephant as grey. This response assumes the typical color of elephants without seeing the image, which could be considered a reasonable guess given the lack of visual data processing capability. However, the answer lacks specificity and does not acknowledge the inability to view the image, which could mislead users into thinking the assistant has visual capabilities. Despite this, it attempted to answer based on common knowledge about elephants, so it receives a score of 5 for making an effort to provide a relevant response. The score reflects the attempt to provide an answer but also considers the lack of acknowledgment regarding the assistant's limitations in processing visual content."
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"question": "What kind of objects are included in the art installation?",
|
| 207 |
+
"correct_answer": "The art installation includes a display of large artworks, such as an oversized bench, painted feline heads, and potentially other artistic sculptures or images.",
|
| 208 |
+
"response": "",
|
| 209 |
+
"score": false,
|
| 210 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the art installation, mentioning specific objects such as an oversized bench and painted feline heads, along with a general mention of \"other artistic sculptures or images.\" This response is helpful as it gives a clear idea of what the art installation includes, is relevant to the question asked, appears accurate based on the information provided, and includes a satisfactory level of detail about the objects included in the installation. Thus, Assistant 2 receives a score of 8. The reason for not scoring higher is due to the lack of information about the context of the art installation (e.g., its theme, purpose, or the artists involved), which could have provided a more comprehensive understanding. However, given the constraints of the question, Assistant 2's response is notably informative and relevant."
|
| 211 |
+
}
|
| 212 |
+
]
|
slice_4876/17435091731.0/detail.json
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"question": "Can you elaborate on the elements of the picture provided?",
|
| 4 |
+
"correct_answer": "In the image, a person wearing camo shorts is standing on a cement surface next to an overturned skateboard. The skateboard is laying upside down with its wheels pointing up, giving a sense of it having been flipped or potentially used for a trick. The boy appears to be standing in front of the skateboard, engaging with it or possibly preparing for his next move.",
|
| 5 |
+
"response": "",
|
| 6 |
+
"score": false,
|
| 7 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene based on the context provided. The assistant described the person's attire (camo shorts), the position of the skateboard (upside down with wheels pointing up), and the surface on which the person and skateboard are located (cement). This response is helpful as it gives a clear visual representation of the scene, relevant to the user's request for elaboration on the elements of the picture, accurate based on the context given, and detailed in its description of the skateboard's position and the person's attire and actions. Therefore, Assistant 2 receives a score of 7 for effectively addressing the user's request with a detailed and relevant response."
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"question": "Can you elaborate on the elements of the picture provided?",
|
| 11 |
+
"correct_answer": "The scene features a black car parked on the side of the road next to a parking meter. There is another parking meter slightly further ahead of the car. The car is parked in front of a building, which seems to be the destination for the driver. \n\nAdditionally, there are other vehicles in the image. A gray car is situated further behind the black car, and a truck can be seen in the background on the right side. Moreover, there is another vehicle barely visible on the left side of the scene.",
|
| 12 |
+
"response": "The image provides a detailed description of the vehicle, including its color, model, and specifications.",
|
| 13 |
+
"score": false,
|
| 14 |
+
"gpt_response": "4 8\n\nAssistant 1 provided a very generic response that did not delve into the specifics of the image described in the context. It mentioned a \"detailed description of the vehicle, including its color, model, and specifications,\" but failed to provide any actual details from the image, such as the presence of other vehicles, the parking meter, or the building in front of which the car is parked. This lack of specificity and direct reference to the elements present in the image makes the response less helpful and relevant to the user's request for an elaboration on the elements of the picture. Therefore, it scores lower in terms of helpfulness, relevance, accuracy, and level of detail.\n\nAssistant 2, on the other hand, offered a much more detailed and accurate description of the scene depicted in the image. It not only mentioned the black car and its position relative to a parking meter but also described the presence of other vehicles, including their colors and relative positions. Additionally, it noted the building in front of which the car is parked, providing a more comprehensive view of the scene. This response is significantly more helpful and relevant to the user's request, as it provides a detailed elaboration on the elements of the picture. It scores higher in terms of helpfulness, relevance, accuracy, and level of detail due to its thorough and specific description of the scene.\n\nThe scores reflect the difference in the level of detail and accuracy provided by the two assistants, with Assistant 2 offering a more comprehensive and relevant response to the user's question."
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"question": "Analyze the image in a comprehensive and detailed manner.",
|
| 18 |
+
"correct_answer": "The image features a little girl dressed for the rain, wearing a ladybug-patterned raincoat and green rubber boots. She is holding a matching red and black dotted umbrella with a ladybug design, prepared to protect herself from the rain. The girl stands in the foreground of the scene, capturing attention. Behind her, there is a car partially visible at the top part of the image.",
|
| 19 |
+
"response": "",
|
| 20 |
+
"score": false,
|
| 21 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate. There's no analysis, description, or any form of answer that could be assessed for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a detailed description of the image, focusing on the little girl, her attire, and the umbrella she holds. The response captures the essence of the scene with the girl prepared for rain in her ladybug-themed outfit and green boots, and also mentions the background element of a partially visible car. This description is relevant and accurate based on the context provided. However, the response could have been improved with more detailed analysis or inclusion of the environment's description beyond the car, assuming more was visible in the image. The level of detail is adequate but not comprehensive, as it primarily focuses on the girl and only briefly mentions the background. Therefore, Assistant 2 receives a score of 7 for providing a relevant and accurate description, though it lacks a comprehensive analysis of the entire scene."
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"question": "Write a detailed description of the given image.",
|
| 25 |
+
"correct_answer": "A tan and black cat is curled up and comfortably asleep on a vibrant red couch. The cat is situated towards the center of the plush seat. The red couch itself is prominent in the image, occupying a large portion of the frame. The peaceful sleeping cat adds a sense of warmth and coziness to the scene.",
|
| 26 |
+
"response": "",
|
| 27 |
+
"score": false,
|
| 28 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's request for a detailed description of the given image, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a concise yet descriptive account of the scene. The assistant described the cat's coloration as tan and black, its position on the couch, and the color and prominence of the couch itself. This response provides a clear mental image of the scene, incorporating details about the cat's position, the couch's appearance, and the overall ambiance of coziness and warmth. The description is relevant to the user's request, accurate based on the context provided, and detailed enough to give a good understanding of the scene without seeing the image. Therefore, Assistant 2 receives a score of 8. The deduction in points is due to the lack of extremely detailed description that could include more about the cat's posture, the texture of the couch, or the surrounding environment, which could have made the description even more vivid. However, within the constraints of the information provided, Assistant 2's response is commendable."
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"question": "What is this photo about'?",
|
| 32 |
+
"correct_answer": "The image is a clear and colorful close up of a giraffe's head, showcasing its beautiful features. The giraffe is standing tall among several bright green trees, likely in its natural habitat. It appears to be chewing on some leaves, while its face is turned to the side, providing a detailed view of its profile.",
|
| 33 |
+
"response": "",
|
| 34 |
+
"score": false,
|
| 35 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed and vivid description of the scene depicted in the photo, based on the context provided. The assistant's response included information about the giraffe's activity (chewing on leaves), its position (standing tall among green trees), and the setting (likely in its natural habitat), which aligns well with the context given. This description is helpful for someone who cannot see the image, making the response relevant and accurate. The level of detail provided, such as the mention of the giraffe's head being in profile and the description of the setting, enhances the quality of the response. Therefore, Assistant 2 receives a score of 8, as it successfully conveyed the essence of the image through its description, although there's always room for improvement in terms of adding even more detail or providing additional context about giraffes or their habitat that could enrich the response further."
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"question": "Describe the following image.",
|
| 39 |
+
"correct_answer": "The scene is set in a lobby at a commercial business, where a wheeled luggage cart is filled with various suitcases and bags. There are a number of luggage bags, including two backpacks, one near the front of the cart and another near the back, as well as multiple suitcases placed on different sections of the cart. \n\nA handbag is also visible, placed near the front of the cart. Two people are present in the scene: one person standing near the left side and another person on the right side, possibly engaging in conversation or waiting to transport their luggage to their rooms.",
|
| 40 |
+
"response": "",
|
| 41 |
+
"score": false,
|
| 42 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which means it failed to fulfill the task of describing the image. Therefore, it receives a score of 0 for not contributing any information relevant to the user's request.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, including the presence of a wheeled luggage cart filled with various suitcases and bags, the specific mention of two backpacks and a handbag, and the presence of two people possibly engaging in conversation or waiting. This response is helpful, relevant, and accurate based on the context provided. It also includes a level of detail that would give the reader a good understanding of the scene without seeing the image. Therefore, Assistant 2 receives a score of 8. The deduction comes from not knowing the exact accuracy of the description in relation to the image (since the image is not provided), and there's always room for improvement in terms of providing even more detailed descriptions, such as the color or design of the bags, the appearance of the people, or the exact setting within the lobby. However, within the constraints provided, Assistant 2's response is commendable."
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"question": "Can you elaborate on the elements of the picture provided?",
|
| 46 |
+
"correct_answer": "The image displays a table with a folded newspaper and sunglasses lying on top of it. Behind the newspaper and sunglasses, there is an apple sitting on the table. The scene also features several books arranged near the apple and the newspaper.\n\nIn addition to the books, there is a teddy bear placed behind the apple, adding a friendly and cozy touch to the overall setting. With this assortment of items, the scene appears to be a peaceful and relaxing space for reading and leisure.",
|
| 47 |
+
"response": "",
|
| 48 |
+
"score": false,
|
| 49 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the user's question, which means it failed to offer any information or insight regarding the image described in the question. Therefore, it receives a score of 0 due to the lack of any content in its response.\n\nAssistant 2, on the other hand, provided a detailed description of the scene, including the presence of a folded newspaper, sunglasses, an apple, several books, and a teddy bear. This response adds context and visual elements that were not mentioned in the user's initial description, assuming the presence of these additional items without direct evidence from the user's query. While the description is imaginative and detailed, it introduces elements that were not confirmed to be in the image, which could lead to inaccuracies in the depiction of the scene. Therefore, Assistant 2 receives a score of 5 for its effort to describe the scene but loses points for potentially adding details not present in the original image, which could mislead the user or misrepresent the content of the image."
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"question": "Explain the visual content of the image in great detail.",
|
| 53 |
+
"correct_answer": "The scene showcases a dirt road, with a woman riding a motorcycle in the middle of the road. She is accompanied by a man walking alongside her, with another man further down the road. Various animals, including three cows, are also present in the scene, suggesting a rural setting. The main cow is positioned to the right of the motorcycle while two smaller cows can be seen on the left side of the road. The people and animals all appear to be going in the same direction down the dirt road.",
|
| 54 |
+
"response": "",
|
| 55 |
+
"score": false,
|
| 56 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which means it failed to fulfill the user's request for a detailed explanation of the visual content of the image. Therefore, it receives a score of 0, as it did not contribute any information or insight into the image's content.\n\nAssistant 2, on the other hand, offered a detailed description of the scene depicted in the image, including the presence of a woman on a motorcycle, a man walking alongside her, another man further down the road, and various animals such as cows. This response provides a clear and vivid picture of the scene, which aligns well with the user's request for a detailed explanation of the visual content. The mention of the rural setting, the positioning of the cows in relation to the motorcycle, and the direction in which the people and animals are moving all contribute to a comprehensive understanding of the scene. Therefore, Assistant 2 receives a score of 7 for its helpfulness, relevance, accuracy, and level of detail in describing the image. The score is not higher due to the lack of specific details that could have been inferred or included, such as the expressions on the subjects' faces, the time of day, or more precise descriptions of the surroundings, which could have provided an even richer understanding of the scene."
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"question": "What do you see happening in this image?",
|
| 60 |
+
"correct_answer": "The scene captures a picturesque view of two large passenger jets, one in the air and one on the ground. They are flying over a beautiful beach filled with various birds. Many birds can be seen scattered across the scene, both near the water and around the area. The blue water in the background adds a calming touch to the image.",
|
| 61 |
+
"response": "",
|
| 62 |
+
"score": false,
|
| 63 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, or level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene based on the user's question. The assistant described the presence of two large passenger jets, one in the air and one on the ground, and mentioned their location over a beach with various birds scattered around. The mention of the blue water adds to the vividness of the description, making it easier for someone who cannot see the image to visualize the scene. This response is helpful, relevant, and detailed, providing a clear picture of what is happening in the image. However, without the actual image or the detailed bounding box coordinates and object descriptions, it's challenging to assess the absolute accuracy of the description. Assuming the description aligns well with the image based on the given context, Assistant 2's response is quite informative and engaging, meriting a score of 7. The deduction comes from not being able to verify the accuracy of the description against the actual image content and the bounding box coordinates provided in the context, which were not utilized in the response."
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"question": "Can you describe the main features of this image for me?",
|
| 67 |
+
"correct_answer": "The image depicts a man standing near a window, holding two clothing hangers with garments in both hands, one red and one white. In front of him, there is a suitcase, possibly indicating that he is preparing for travel or organizing his belongings. The man appears to be showing or comparing these clothes while packing his luggage.",
|
| 68 |
+
"response": "",
|
| 69 |
+
"score": false,
|
| 70 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which means it failed to fulfill the task of describing the main features of the image. Therefore, it receives a score of 0 for not contributing any information or insight into the image's content.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, including the man's actions (holding two clothing hangers with garments), the colors of the garments (one red and one white), and the context (standing near a window with a suitcase, possibly indicating preparation for travel). This response is helpful, relevant, and accurate based on the given context, providing a clear picture of the scene to someone who cannot see the image. The level of detail, including the mention of the suitcase and the possible scenario of preparing for travel, adds value to the description. Therefore, Assistant 2 receives a score of 7 for its comprehensive and informative response, which would significantly aid a user in understanding the image's content without seeing it. The deduction from a perfect score is due to the lack of information about the environment beyond the immediate focus on the man and his actions, which could have provided a more rounded description of the scene."
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"question": "Can you describe the main features of this image for me?",
|
| 74 |
+
"correct_answer": "The image depicts a group of people gathered inside a room, creating a lively social atmosphere. A man is prominently featured in the scene, holding a cell phone to his ear and smiling with a thumbs-up gesture, possibly posing for a picture or simply enjoying the conversation.\n\nThere are multiple other people in the room, adding to the gathering and engaging in various conversations. The scene also has two cups visible, one on the left side of the room and another on the right side, indicating that the gathering may be a casual social event.",
|
| 75 |
+
"response": "",
|
| 76 |
+
"score": false,
|
| 77 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, attempted to describe the scene based on the user's question. However, the description provided by Assistant 2 introduces elements that were not mentioned in the context provided by the user, such as the presence of multiple people and two cups, suggesting a social gathering. Since the user's context only mentioned a man giving a thumbs up while on his phone, Assistant 2's response adds details that are not supported by the given context, which could lead to inaccuracies in the description. Despite this, Assistant 2's effort to provide a detailed scene description shows an attempt to be helpful and to add depth to the answer, which is why it receives a score of 5. The score reflects the attempt to provide a detailed response but also takes into account the inaccuracies and assumptions made beyond the provided context."
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"question": "Write a detailed description of the given image.",
|
| 81 |
+
"correct_answer": "The image showcases a group of four giraffes standing in their natural habitat, a grassy field with some dry brush. They are dispersed across the field, with one giraffe positioned more towards the left, and the other three clustered closer together on the right side. The giraffes appear to be grazing peacefully or engaging in social interactions. A tree can be seen in the scene, providing shade and a point of interest for the giraffes to gather around.",
|
| 82 |
+
"response": "",
|
| 83 |
+
"score": false,
|
| 84 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's request for a detailed description of the image, which results in a score of 0 due to the lack of content to evaluate. Without any attempt to describe the image, it fails to meet the criteria for helpfulness, relevance, accuracy, and level of detail.\n\nAssistant 2, on the other hand, offered a detailed description of the image, mentioning the number of giraffes, their positioning within the grassy field, their activities, and the presence of a tree. This response is helpful as it gives a clear visual representation of the scene described in the user's context. The level of detail, including the description of the giraffes' distribution across the field and their engagement in activities, adds to the relevance and accuracy of the description. However, the description could be improved by specifying the types of social interactions or the exact nature of the grassy field, such as the height of the grass or the color, which could provide a more vivid image. Therefore, Assistant 2 receives a score of 7 for its effort to describe the scene accurately and in detail, though there is room for improvement in terms of providing an even more comprehensive description."
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"question": "What do you see happening in this image?",
|
| 88 |
+
"correct_answer": "The image features a single white bird, likely a duck or a goose, walking along a paved road. The bird appears to be closely examining the ground as it walks. The road runs adjacent to a patch of grass, providing a contrasting backdrop for the scene. The bird occupies a predominant part of the image, offering a close-up view of its action.",
|
| 89 |
+
"response": "",
|
| 90 |
+
"score": false,
|
| 91 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which means it failed to offer any information, description, or insight regarding the image in question. Therefore, it receives a score of 0 due to the complete lack of content in its response.\n\nAssistant 2, on the other hand, provided a detailed description of the scene depicted in the image. It identified the main subject as a white bird, likely a duck or a goose, and described its activity (walking along a paved road and examining the ground) and its environment (a road adjacent to a patch of grass). This response is helpful as it gives a clear and vivid picture of the scene to someone who cannot see the image. The level of detail, including the bird's behavior and the setting, makes the description relevant and accurate based on the context provided. However, without specific information on the accuracy of the bird's identification (duck or goose) and without the bounding box coordinates or more precise details about the surroundings that might have been included in the image description, there's a slight room for improvement in accuracy and detail. Therefore, Assistant 2 receives a score of 8, reflecting its comprehensive and relevant response with minor room for enhancement in precision and completeness."
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"question": "Describe the following image.",
|
| 95 |
+
"correct_answer": "The image features a quiet street with a tall clock mounted on a pole at the side of the pavement, near a building. The pole stands prominently on the empty sidewalk, offering a convenient time-keeping source for pedestrians.\n\nThere are a few potted plants along the sidewalk, adding a touch of greenery to the scene. Bicycles can also be seen parked nearby, and a couple of cars are parked further down the street. A person is walking in the background, adding some life to the otherwise calm environment.",
|
| 96 |
+
"response": "",
|
| 97 |
+
"score": false,
|
| 98 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, mentioning the clock on a pole (which aligns with the \"short tower\" description), the potted plants along the sidewalk, parked bicycles, cars further down the street, and a person walking in the background. This response is helpful as it provides a vivid picture of the scene described in the question, making it relevant and accurate based on the given context. The level of detail, including the mention of bicycles, cars, and a pedestrian, adds depth to the description, enhancing the visualization of the scene for someone who cannot see the image. Therefore, Assistant 2 receives a score of 7. The score is not higher because, without the actual image or bounding box coordinates, it's challenging to verify the complete accuracy of the additional details (like the exact positioning of objects and the presence of bicycles and cars) mentioned in the description. However, based on the information provided in the context and question, Assistant 2's response is considered to be of good quality."
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"question": "What is this photo about'?",
|
| 102 |
+
"correct_answer": "The image features a cat sitting on a wooden desk, intently staring at a black laptop computer that is open in front of it. The desk is quite organized, with several books spread around, both on the left and right sides of the laptop. Some books are neatly piled and others are laid out individually. The scene could be interpreted as the cat appearing to use the laptop or showing interest in what's on the screen.",
|
| 103 |
+
"response": "",
|
| 104 |
+
"score": false,
|
| 105 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, mentioning the cat, the laptop, the wooden desk, and the arrangement of books around the laptop. This response is helpful as it provides a vivid picture of the scene described in the question, showing relevance to the user's query. The accuracy cannot be fully assessed without the actual image, but based on the given context, the response seems plausible and aligns with the typical scenarios involving cats and laptops. The level of detail is commendable, as it includes not just the main subjects (the cat and the laptop) but also the setting (the wooden desk and the arrangement of books), which enriches the description. Therefore, Assistant 2 receives a score of 7 for its comprehensive and detailed response."
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"question": "What do you think is going on in this snapshot?",
|
| 109 |
+
"correct_answer": "The image features a colorful striped umbrella on the beach, with its vibrant appearance attracting attention. The umbrella is firmly positioned in the sand, providing shade and comfort for visitors. The umbrella sits near the ocean, offering a lovely view of the water and contributing to the pleasant beach atmosphere.",
|
| 110 |
+
"response": "",
|
| 111 |
+
"score": false,
|
| 112 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a descriptive interpretation of the scene based on the user's context. The response captures the essence of what might be happening in the snapshot by describing the colorful umbrella's appearance and its purpose on the beach. The assistant mentions the umbrella's vibrant appearance, its position in the sand, the shade it provides, and its contribution to the beach atmosphere, which aligns well with the context provided by the user. This response is helpful as it gives a vivid picture of the scene, relevant to the user's query, accurate based on the context given, and detailed in its description of the umbrella's role and appearance. Therefore, Assistant 2 receives a score of 7 for its performance. The deduction in points is due to the lack of any imaginative or additional insights that could have enriched the response further, such as mentioning potential beachgoers' activities under the umbrella or the general ambiance of the beach setting, which could have provided a more comprehensive understanding of the scene."
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"question": "What are the key elements in this picture?",
|
| 116 |
+
"correct_answer": "The scene features two people at a wooden dining table, where they are working on taking apart their video game remote controllers, possibly in order to replace the batteries. Each person is handling a separate remote, being careful and precise in their actions.\n\nThe table spans the entirety of the scene and a laptop is visible on the left side of the table. It seems the people might be following instructions or looking for additional guidance during the process of disassembling the controllers.",
|
| 117 |
+
"response": "",
|
| 118 |
+
"score": false,
|
| 119 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene based on the context provided. The assistant described the setting (a wooden dining table), the activity (two people taking apart video game remote controllers), the presence of a laptop which suggests they might be following online instructions, and the careful manner in which the individuals are handling the controllers. This response is helpful as it gives a clear picture of what is happening in the scene, relevant to the question asked, accurate based on the context given, and detailed with the inclusion of the environment and the possible reason for the disassembly (to replace batteries). Therefore, Assistant 2 receives a score of 7 for its comprehensive and informative response."
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"question": "Analyze the image in a comprehensive and detailed manner.",
|
| 123 |
+
"correct_answer": "The image features two antique suitcases made of leather, stacked one on top of the other. The top suitcase is black, while the bottom one has a combination of brown and yellow colors. Both suitcases are prominently displayed side by side, taking up a large portion of the image. They appear to be vintage luggage, possibly available for purchase with price tags attached, showcasing their classic design and craftsmanship.",
|
| 124 |
+
"response": "",
|
| 125 |
+
"score": false,
|
| 126 |
+
"gpt_response": "0 5\n\nAssistant 1 did not provide any response to the user's question, which results in a score of 0 due to the lack of content, helpfulness, relevance, accuracy, and level of detail.\n\nAssistant 2, while providing a response, made several assumptions not supported by the provided context. The description includes details about the colors and possible vintage nature of the suitcases, as well as a speculative note about price tags and their purpose (possibly for sale), which cannot be verified based on the given context that does not actually include an image or its detailed description. However, the attempt to describe the suitcases and their arrangement shows an effort to engage with the question, providing some level of detail and creativity in the response. Therefore, Assistant 2 receives a score of 5 for making an effort to provide a detailed response, despite the inaccuracies and assumptions made due to the lack of actual visual content to analyze. The score reflects the attempt to provide a comprehensive analysis based on an imagined scenario, which could be somewhat helpful if the context were accurate. However, the inaccuracies and speculative nature of the response limit its overall effectiveness and relevance."
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"question": "Describe the following image.",
|
| 130 |
+
"correct_answer": "The image showcases a dining table filled with various dirty dishes, eating utensils, and a bottle. The table has plates and glasses scattered across it. There are at least two cups on the table, with one positioned on the left and another on the right side. \n\nTwo forks can be seen, one resting on a small white plate and the other located towards the left side of the table. A spoon is also present, placed near the left corner of the table. Additionally, there is a bottle located in the upper central area of the table.",
|
| 131 |
+
"response": "",
|
| 132 |
+
"score": false,
|
| 133 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene depicted in the image. The response included information about the number and placement of dishes, cups, utensils, and a bottle on the table, which aligns with the context provided. This description suggests a high level of relevance and accuracy, assuming it matches the content of the image accurately. The level of detail, including the specific locations of items (left, right, central areas of the table), enhances the helpfulness of the response for someone who cannot see the image. Based on these criteria, Assistant 2 receives a score of 8. The deduction from a perfect score is due to the lack of information on the overall condition of the table beyond the dishes and utensils, such as any food remnants or the table's surface condition, which could have provided a more comprehensive description. However, without the actual image or the bounding box data mentioned, the evaluation is based solely on the provided context and the assumption that Assistant 2's description accurately reflects the image content."
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"question": "Write a detailed description of the given image.",
|
| 137 |
+
"correct_answer": "The image features a box filled with four different kinds of doughnuts sitting on a table. Each doughnut appears to have a unique design or topping. One of the doughnuts is a cake-style doughnut, while another has nuts and coconut on top. The third doughnut appears to be a glazed one, and the last doughnut also has various toppings. The doughnuts are positioned inside the box in close proximity to one another, showcasing their delicious variety.",
|
| 138 |
+
"response": "",
|
| 139 |
+
"score": false,
|
| 140 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which results in a score of 0 due to the lack of content to evaluate for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a detailed description of the image in question. The response included information about the number of doughnuts, their types, and specific toppings, which aligns well with the user's request for a detailed description of the image. This indicates a good level of relevance and detail, making the response helpful for someone trying to understand the contents of the image without seeing it. However, without the actual image for direct comparison, it's challenging to assess the accuracy of the description fully. Assuming the description matches the image accurately based on the given context, Assistant 2's response would be quite helpful and relevant, warranting a score of 7. The deduction in points is due to the inability to verify the accuracy of specific details about the doughnuts' appearance and the lack of bounding box coordinates, which were mentioned in the system's request but not addressed in the response."
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"question": "Can you elaborate on the elements of the picture provided?",
|
| 144 |
+
"correct_answer": "In this image, there is a small cell phone displayed on a table. The cell phone is positioned between a set of earbuds and two jewel-like objects, which might be functioning as paperweights or decorative pieces. The close-up shot showcases these items laying near each other, creating a scene that combines technology and luxury.",
|
| 145 |
+
"response": "",
|
| 146 |
+
"score": false,
|
| 147 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which results in a score of 0 due to the lack of content to evaluate. There is no helpfulness, relevance, accuracy, or level of detail to assess since there is no answer provided.\n\nAssistant 2, on the other hand, offered a descriptive response based on the context provided. The assistant described the scene by mentioning a small cell phone displayed on a table, positioned between a set of earbuds and two jewel-like objects. This description suggests an understanding of the scene's composition, including the elements present and their arrangement. The mention of the jewels possibly functioning as paperweights or decorative pieces adds a speculative but insightful touch, indicating an attempt to interpret the scene beyond mere description. This response is helpful as it provides a clear visualization of the scene, relevant to the user's request for elaboration on the elements of the picture. The accuracy cannot be fully assessed without seeing the actual image, but the response seems plausible based on the context given. The level of detail is moderate, with specific mentions of the objects and their potential purpose, which aids in creating a mental image of the scene. Therefore, Assistant 2 receives a score of 7 for its effort to describe and interpret the scene accurately and with a reasonable level of detail."
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"question": "What are the key elements in this picture?",
|
| 151 |
+
"correct_answer": "The image shows a large, adorable husky dog sleeping peacefully on a dog bed in a room. The room has a somewhat dark ambiance, making the scene feel cozy and comfortable. \n\nIn the same room, there are two chairs, one positioned towards the center and another one closer to the right side. Additionally, there are two potted plants, one situated slightly behind and to the right of the dog and the other placed further to the right in the room. The presence of these elements gives the room a warm, inviting atmosphere.",
|
| 152 |
+
"response": "",
|
| 153 |
+
"score": false,
|
| 154 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, including the key elements such as the dog's breed (a husky), the dog bed, the ambiance of the room, the presence of chairs, and potted plants. This response is helpful as it gives a clear and vivid picture of the scene, relevant to the user's question about the key elements in the picture. The accuracy cannot be fully assessed without the actual image or the descriptive sentences and bounding box coordinates mentioned but based on the provided context, Assistant 2's response seems plausible and detailed, indicating a high level of attention to detail. Therefore, Assistant 2 receives a score of 8, reflecting its performance in providing a comprehensive and engaging description of the scene."
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"question": "Describe the following image.",
|
| 158 |
+
"correct_answer": "The image features a window with wood shading and brick siding on the exterior of a building. Outside the window, an apple tree with branches filled with ripe, red fruit can be seen. The tree appears to be quite fruitful, as many apples are ready for picking. Some apples are hanging close to the window, while others can be spotted at various heights and positions throughout the tree. The combination of the shuttered window and the fruit tree creates an aesthetically pleasing scene.",
|
| 159 |
+
"response": "",
|
| 160 |
+
"score": false,
|
| 161 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to fulfill the task of describing the image. Therefore, it receives a score of 0, as it offered no information, helpfulness, relevance, accuracy, or level of detail regarding the image described in the question.\n\nAssistant 2, on the other hand, provided a detailed description of the image, mentioning key elements such as the window with wood shading, brick siding, and the presence of an apple tree with ripe, red fruit. The description includes details about the positioning of the apples and the overall aesthetic of the scene, which aligns well with the context provided in the question. This response is helpful, relevant, and accurate, offering a high level of detail that allows the reader to visualize the scene without seeing the image. Therefore, Assistant 2 receives a score of 8. The reason for not scoring higher is due to the lack of information about the bounding box coordinates, which were mentioned in the system's request but not addressed in the response. However, since the primary task was to describe the image, and Assistant 2 did so effectively, it still scores highly."
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"question": "What do you see happening in this image?",
|
| 165 |
+
"correct_answer": "The image features a man with a striking appearance, walking down the street while talking on his cell phone. He has colored his hair purple and is wearing a loud outfit, including a purple shirt and tie. The man also carries a handbag, which adds to his distinctive look.\n\nThere are two bicycles in the scene, one occupying a large area in the middle of the frame and the other located on the right side. Both bicycles are parked along the street, consistent with the urban setting.",
|
| 166 |
+
"response": "",
|
| 167 |
+
"score": false,
|
| 168 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to offer any information or description related to the image in question. Therefore, it receives a score of 0 for not contributing any content that could be evaluated for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, including the man's appearance and actions (walking down the street, talking on his cell phone, his purple hair, and his outfit), as well as mentioning additional elements like the two bicycles and their positions. This response is helpful as it provides a vivid picture of the scene to someone who cannot see the image, making it relevant and accurate based on the context provided. The level of detail, including the description of the man's outfit and the positioning of the bicycles, enhances the quality of the response. Therefore, Assistant 2 receives a score of 8, reflecting its effectiveness in conveying a detailed and accurate description of the image based on the information provided."
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"question": "Can you describe the main features of this image for me?",
|
| 172 |
+
"correct_answer": "The image depicts a man and a woman sitting on top of a bridge, both wearing umbrella hats. The quirky umbrella hats provide them with some cover from the rainy weather. A dog is accompanying the couple, taking a break with them on the bridge. \n\nThe surrounding area has a view of the ocean, and there are boats visible in the water. One boat can be found close to the right edge of the scene, while two other boats are in the middle and the far left side of the frame. Additional umbrellas can be spotted in the area, signifying that other pedestrians have also sought shelter from the rain.",
|
| 173 |
+
"response": "The main features of this image are the three individuals standing in a row, with the person in the middle being the most prominent.",
|
| 174 |
+
"score": false,
|
| 175 |
+
"gpt_response": "4 6\n\nAssistant 1's response is quite vague and does not match the context provided. It mentions three individuals standing in a row with the middle person being the most prominent, which does not align with the description of a couple wearing umbrella hats next to the ocean. This response lacks detail and specificity about the scene, such as the setting (next to the ocean), the presence of umbrella hats, and the overall atmosphere. Therefore, it receives a lower score for its lack of relevance and accuracy.\n\nAssistant 2 provides a more detailed and imaginative description that somewhat aligns with the context of people wearing umbrella hats next to the ocean. It introduces additional elements like the bridge, the dog, and the rainy weather, which were not mentioned in the context but could be inferred as creative liberties to enrich the scene. However, this response also introduces inaccuracies by specifying the characters' positions (sitting on top of a bridge) and activities that were not part of the original context. Despite these inaccuracies, Assistant 2's response is more engaging and provides a richer visual description, including the mention of the ocean and boats, which aligns more closely with the context than Assistant 1's response. Therefore, it receives a higher score for its creativity and attempt to provide a detailed scene, despite the inaccuracies and added elements not present in the original context."
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"question": "Describe the following image.",
|
| 179 |
+
"correct_answer": "The image shows a neatly laid out outfit on top of a bed. The outfit consists of a white shirt with a red tie placed over it and a pair of black shoes nearby. The arrangement of the attire suggests that it could be a uniform or a suit, all set out and ready to wear for a formal event or a professional occasion. The overall appearance of the photograph is visually pleasing and well-organized.",
|
| 180 |
+
"response": "",
|
| 181 |
+
"score": false,
|
| 182 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which results in a score of 0 due to the lack of content to evaluate. Without any attempt to describe the image or engage with the user's request, it fails to meet the criteria for helpfulness, relevance, accuracy, or level of detail.\n\nAssistant 2, on the other hand, offered a detailed description of the image, incorporating elements such as the layout of the outfit, the types of clothing items present, and the context in which they might be used (e.g., a formal event or professional occasion). This response is helpful as it gives the user a clear and vivid picture of the scene, relevant to the user's request for a description of the image, accurate based on the information provided in the context, and detailed in its depiction of the arrangement and potential use of the outfit. Therefore, Assistant 2 receives a score of 8, reflecting its effectiveness in addressing the user's query with a comprehensive and engaging description."
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"question": "What is this photo about'?",
|
| 186 |
+
"correct_answer": "The image shows the beginning stages of a house under construction. The wooden structure is still being built, and there are lots of wooden studs visible throughout the scene, indicating work in progress. Additionally, a partially-built staircase can be seen within the house, giving an idea of the floor plan layout.\n\nDespite the house still being under construction, a bed and a TV are already present in the area. The bed is located near the center of the image, with the TV placed to its left. This shows that some household items have been brought in, probably in anticipation of the house's completion.",
|
| 187 |
+
"response": "",
|
| 188 |
+
"score": false,
|
| 189 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene based on the information provided in the hypothetical image. The response includes information about the construction stage of the house, the presence of wooden studs indicating ongoing work, a partially-built staircase providing insight into the floor plan, and the premature placement of household items such as a bed and a TV. This response is helpful as it gives a comprehensive overview of the construction progress and the early arrangement of furniture, making it relevant and accurate based on the described content. The level of detail, including the specific mention of the bed and TV's placement, enhances the quality of the response. Therefore, Assistant 2 receives a score of 8 for its informative and detailed answer."
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"question": "What do you see happening in this image?",
|
| 193 |
+
"correct_answer": "The image shows a group of people at a celebration, likely participating in a wine tasting event. There are a total of six people, with three young adults prominently in the foreground. A man wearing glasses stands in the middle, flanked by a couple of women on either side. They are all holding wine glasses, enjoying the event and smiling.\n\nAt the table, there are several wine bottles dispersed along its surface, showing the variety of options available for tasting. Additionally, there is a handbag placed on the table, possibly belonging to one of the women attending the event. \n\nTwo more people are visible in the background. They are smiling and making conversation while engaging in the celebration with the others.",
|
| 194 |
+
"response": "",
|
| 195 |
+
"score": false,
|
| 196 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene based on the user's question. The response includes the number of people present, their activities, and specific details like the presence of wine bottles and a handbag on the table, which suggests a high level of attention to detail. The assistant's ability to infer that the event is likely a wine tasting celebration from the context provided by the user shows relevance and accuracy in understanding and describing the scene. The description of the people's actions and the setting contributes to the helpfulness of the response. However, without access to the actual image and the bounding box coordinates, it's impossible to verify the exact accuracy of the description, such as the number of people and their actions. Assuming the description aligns well with the provided context, Assistant 2's response is informative and relevant, warranting a score of 8. The deduction in points is due to the inability to verify the precise accuracy of the details mentioned against the actual image content and the provided bounding box coordinates."
|
| 197 |
+
},
|
| 198 |
+
{
|
| 199 |
+
"question": "What do you think is going on in this snapshot?",
|
| 200 |
+
"correct_answer": "The image depicts a baby elephant standing alone inside an enclosure. The elephant is positioned towards the center of the pen with a large sand dune, or dirt mount, nearby. In the background, there is a brick building that serves as part of the exhibit. The grey elephant stands calmly, occupying the majority of the scene in this pen.",
|
| 201 |
+
"response": "",
|
| 202 |
+
"score": false,
|
| 203 |
+
"gpt_response": "0 7\n\nAssistant 1 did not provide any response to the user's question, which makes it impossible to evaluate its performance on the criteria of helpfulness, relevance, accuracy, and level of detail. Therefore, it receives a score of 0.\n\nAssistant 2, on the other hand, offered a detailed description of the scene based on the user's question. The assistant described the baby elephant's position within the pen, mentioned the presence of a large sand dune or dirt mount, and noted the background featuring a brick building that is part of the exhibit. This response is helpful as it gives a clear picture of the scene to someone who cannot see the image. It is relevant to the user's question about what is going on in the snapshot, accurate based on the information provided, and detailed with descriptions of the elephant's surroundings. Therefore, Assistant 2 receives a score of 7 for its performance. The deduction from a perfect score is due to the lack of speculative or interpretive information about why the elephant is alone or what the situation implies beyond the physical description, which could have provided a more comprehensive answer to the user's implied query about the context or the elephant's condition."
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"question": "Explain the visual content of the image in great detail.",
|
| 207 |
+
"correct_answer": "The image features an art installation placed on a city street. The display consists of a large, oversized wooden bench and two massive animal art sculptures, which appear to be painted feline heads. \n\nThere are several people in the scene, with two people sitting near the art display, one person standing nearby, and another person further to the left. A parked car is visible behind the bench, close to the edge of the street. Additionally, a backpack can be seen on the ground, closer to the left side of the bench.",
|
| 208 |
+
"response": "",
|
| 209 |
+
"score": false,
|
| 210 |
+
"gpt_response": "0 8\n\nAssistant 1 did not provide any response to the question, which means it failed to fulfill the task of explaining the visual content of the image. Therefore, it receives a score of 0, as it did not contribute any information or description related to the user's request.\n\nAssistant 2, on the other hand, offered a detailed description of the scene, mentioning key elements such as the oversized wooden bench, massive animal art sculptures resembling feline heads, the presence of people in various positions around the art installation, a parked car, and a backpack on the ground. This response is helpful as it gives a clear and vivid picture of the scene on the city street, aligning well with the user's request for a detailed explanation of the visual content. The description is relevant and accurate based on the context provided, and it includes a level of detail that would allow someone who cannot see the image to visualize the scene. Therefore, Assistant 2 receives a score of 8, reflecting its effectiveness in addressing the user's query with a detailed and relevant response. The deduction in points could be attributed to the lack of precise information about the location of the objects in relation to each other beyond the basic description, which could have provided an even clearer understanding of the scene."
|
| 211 |
+
}
|
| 212 |
+
]
|
slice_4876/Evaluation.log
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2025-04-01 20:09:01,480 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 2 |
+
2025-04-01 20:09:01,482 - Evaluation - INFO - task: conv
|
| 3 |
+
2025-04-01 20:09:01,483 - Evaluation - INFO - model_id: 1,
|
| 4 |
+
2025-04-01 20:09:01,484 - Evaluation - INFO - average: 4.5,
|
| 5 |
+
2025-04-01 20:09:01,485 - Evaluation - INFO - question: 30,
|
| 6 |
+
2025-04-01 20:09:01,485 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 7 |
+
2025-04-01 20:19:21,294 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 8 |
+
2025-04-01 20:19:21,295 - Evaluation - INFO - task: detail
|
| 9 |
+
2025-04-01 20:19:21,295 - Evaluation - INFO - model_id: 1,
|
| 10 |
+
2025-04-01 20:19:21,296 - Evaluation - INFO - average: 3.7,
|
| 11 |
+
2025-04-01 20:19:21,297 - Evaluation - INFO - question: 30,
|
| 12 |
+
2025-04-01 20:19:21,297 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 13 |
+
2025-04-01 20:21:08,262 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 14 |
+
2025-04-01 20:21:08,262 - Evaluation - INFO - task: complex
|
| 15 |
+
2025-04-01 20:21:08,263 - Evaluation - INFO - model_id: 1,
|
| 16 |
+
2025-04-01 20:21:08,264 - Evaluation - INFO - average: 5.6,
|
| 17 |
+
2025-04-01 20:21:08,264 - Evaluation - INFO - question: 30,
|
| 18 |
+
2025-04-01 20:21:08,265 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 19 |
+
2025-04-01 20:21:08,266 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
| 20 |
+
2025-04-01 20:21:08,267 - Evaluation - INFO - model_id: 1,
|
| 21 |
+
2025-04-01 20:21:08,267 - Evaluation - INFO - total_average: 4.6,
|
| 22 |
+
2025-04-01 20:21:08,268 - Evaluation - INFO - total_question: 90,
|
| 23 |
+
2025-04-01 20:21:08,269 - Evaluation - INFO - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
slice_4876/config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_4876/preprocessor_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": {
|
| 3 |
+
"height": 512,
|
| 4 |
+
"width": 512
|
| 5 |
+
},
|
| 6 |
+
"do_center_crop": true,
|
| 7 |
+
"do_convert_rgb": true,
|
| 8 |
+
"do_normalize": true,
|
| 9 |
+
"do_rescale": true,
|
| 10 |
+
"do_resize": true,
|
| 11 |
+
"image_mean": [
|
| 12 |
+
1.0,
|
| 13 |
+
1.0,
|
| 14 |
+
1.0
|
| 15 |
+
],
|
| 16 |
+
"image_processor_type": "ChameleonImageProcessor",
|
| 17 |
+
"image_std": [
|
| 18 |
+
1.0,
|
| 19 |
+
1.0,
|
| 20 |
+
1.0
|
| 21 |
+
],
|
| 22 |
+
"processor_class": "ChameleonProcessor",
|
| 23 |
+
"resample": 1,
|
| 24 |
+
"rescale_factor": 0.0078,
|
| 25 |
+
"size": {
|
| 26 |
+
"shortest_edge": 512
|
| 27 |
+
}
|
| 28 |
+
}
|
slice_4876/processor_config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_seq_length": 1024,
|
| 3 |
+
"image_token": "<image>",
|
| 4 |
+
"processor_class": "ChameleonProcessor"
|
| 5 |
+
}
|
slice_4876/pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31cafeffac3898480fe09b302de7f840e79eff80d440d5a03f3cd84115ff6b4e
|
| 3 |
+
size 14086364170
|
slice_4876/raw_outputs__aifs4su_yaodong_hantao_align-anything_outputs_chameleon_sft_top1-20_slice_4876.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2ff88d9d7441fbc705e091b90be62ccf7b75b03c2537876e99d2b3427e536ea
|
| 3 |
+
size 5119148
|
slice_4876/special_tokens_map.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<pad>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "<reserved08706>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "<unk>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
+
}
|
slice_4876/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
slice_4876/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
wandb/debug-internal.log
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
-
{"time":"2025-
|
| 2 |
-
{"time":"2025-
|
| 3 |
-
{"time":"2025-
|
| 4 |
-
{"time":"2025-
|
| 5 |
-
{"time":"2025-
|
| 6 |
-
{"time":"2025-
|
| 7 |
-
{"time":"2025-
|
| 8 |
-
{"time":"2025-
|
| 9 |
-
{"time":"2025-
|
| 10 |
-
{"time":"2025-
|
| 11 |
-
{"time":"2025-
|
| 12 |
-
{"time":"2025-
|
| 13 |
-
{"time":"2025-
|
| 14 |
-
{"time":"2025-
|
| 15 |
-
{"time":"2025-
|
| 16 |
-
{"time":"2025-
|
|
|
|
| 1 |
+
{"time":"2025-03-31T12:27:55.747825997+08:00","level":"INFO","msg":"stream: starting","core version":"0.19.8","symlink path":"../outputs/chameleon_sft/top1-20/wandb/run-20250331_122755-sbnwzgn9/logs/debug-core.log"}
|
| 2 |
+
{"time":"2025-03-31T12:27:55.962374562+08:00","level":"INFO","msg":"created new stream","id":"sbnwzgn9"}
|
| 3 |
+
{"time":"2025-03-31T12:27:55.962429859+08:00","level":"INFO","msg":"stream: started","id":"sbnwzgn9"}
|
| 4 |
+
{"time":"2025-03-31T12:27:55.962449368+08:00","level":"INFO","msg":"writer: Do: started","stream_id":"sbnwzgn9"}
|
| 5 |
+
{"time":"2025-03-31T12:27:55.962464651+08:00","level":"INFO","msg":"handler: started","stream_id":"sbnwzgn9"}
|
| 6 |
+
{"time":"2025-03-31T12:27:55.962474301+08:00","level":"INFO","msg":"sender: started","stream_id":"sbnwzgn9"}
|
| 7 |
+
{"time":"2025-03-31T12:27:56.222111303+08:00","level":"INFO","msg":"Starting system monitor"}
|
| 8 |
+
{"time":"2025-03-31T13:47:40.894138435+08:00","level":"INFO","msg":"Stopping system monitor"}
|
| 9 |
+
{"time":"2025-03-31T13:47:40.89589821+08:00","level":"INFO","msg":"Stopped system monitor"}
|
| 10 |
+
{"time":"2025-03-31T13:47:42.22989654+08:00","level":"INFO","msg":"stream: closing","id":"sbnwzgn9"}
|
| 11 |
+
{"time":"2025-03-31T13:47:42.229960668+08:00","level":"WARN","msg":"sender: received Exit record more than once, ignoring"}
|
| 12 |
+
{"time":"2025-03-31T13:47:42.393283539+08:00","level":"INFO","msg":"fileTransfer: Close: file transfer manager closed"}
|
| 13 |
+
{"time":"2025-03-31T13:47:42.610356347+08:00","level":"INFO","msg":"handler: closed","stream_id":"sbnwzgn9"}
|
| 14 |
+
{"time":"2025-03-31T13:47:42.610403554+08:00","level":"INFO","msg":"writer: Close: closed","stream_id":"sbnwzgn9"}
|
| 15 |
+
{"time":"2025-03-31T13:47:42.610417305+08:00","level":"INFO","msg":"sender: closed","stream_id":"sbnwzgn9"}
|
| 16 |
+
{"time":"2025-03-31T13:47:42.610688408+08:00","level":"INFO","msg":"stream: closed","id":"sbnwzgn9"}
|
wandb/debug.log
CHANGED
|
@@ -1,32 +1,32 @@
|
|
| 1 |
-
2025-
|
| 2 |
-
2025-
|
| 3 |
-
2025-
|
| 4 |
-
2025-
|
| 5 |
-
2025-
|
| 6 |
-
2025-
|
| 7 |
-
2025-
|
| 8 |
-
2025-
|
| 9 |
-
2025-
|
| 10 |
-
config: {'train_cfgs': {'save_checkpoint':
|
| 11 |
-
2025-
|
| 12 |
-
2025-
|
| 13 |
-
2025-
|
| 14 |
-
2025-
|
| 15 |
-
2025-
|
| 16 |
-
2025-
|
| 17 |
-
2025-
|
| 18 |
-
2025-
|
| 19 |
-
2025-
|
| 20 |
-
2025-
|
| 21 |
-
2025-
|
| 22 |
-
2025-
|
| 23 |
-
2025-
|
| 24 |
-
2025-
|
| 25 |
-
2025-
|
| 26 |
-
2025-
|
| 27 |
-
2025-
|
| 28 |
-
2025-
|
| 29 |
-
2025-
|
| 30 |
Traceback (most recent call last):
|
| 31 |
File "/aifs4su/yaodong/miniconda3/envs/hantao_llama/lib/python3.11/site-packages/wandb/sdk/wandb_run.py", line 2352, in _atexit_cleanup
|
| 32 |
self._on_finish()
|
|
@@ -44,4 +44,4 @@ Traceback (most recent call last):
|
|
| 44 |
File "/aifs4su/yaodong/miniconda3/envs/hantao_llama/lib/python3.11/concurrent/futures/thread.py", line 169, in submit
|
| 45 |
raise RuntimeError('cannot schedule new futures after '
|
| 46 |
RuntimeError: cannot schedule new futures after interpreter shutdown
|
| 47 |
-
2025-
|
|
|
|
| 1 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_setup.py:_flush():67] Current SDK version is 0.19.8
|
| 2 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_setup.py:_flush():67] Configure stats pid to 3667125
|
| 3 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_setup.py:_flush():67] Loading settings from /home/yangyaodong/.config/wandb/settings
|
| 4 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_setup.py:_flush():67] Loading settings from /aifs4su/yaodong/hantao/align-anything/scripts/wandb/settings
|
| 5 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_setup.py:_flush():67] Loading settings from environment variables
|
| 6 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_init.py:setup_run_log_directory():647] Logging user logs to ../outputs/chameleon_sft/top1-20/wandb/run-20250331_122755-sbnwzgn9/logs/debug.log
|
| 7 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_init.py:setup_run_log_directory():648] Logging internal logs to ../outputs/chameleon_sft/top1-20/wandb/run-20250331_122755-sbnwzgn9/logs/debug-internal.log
|
| 8 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_init.py:init():761] calling init triggers
|
| 9 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_init.py:init():766] wandb.init called with sweep_config: {}
|
| 10 |
+
config: {'train_cfgs': {'save_checkpoint': True, 'load_checkpoint': False, 'ds_cfgs': 'ds_z3_config.json', 'epochs': 3, 'seed': 42, 'per_device_train_batch_size': 1, 'per_device_eval_batch_size': 1, 'gradient_accumulation_steps': 16, 'gradient_checkpointing': True, 'learning_rate': 2e-05, 'lr_scheduler_type': 'cosine', 'lr_warmup_ratio': 0.03, 'weight_decay': 0.0, 'adam_betas': [0.9, 0.95], 'adam_epsilon': 1e-08, 'bf16': True, 'fp16': False, 'eval_strategy': 'steps', 'eval_interval': 1000, 'freeze_language_model': False, 'max_grad_norm': 1.0}, 'data_cfgs': {'train_datasets': '/aifs4su/yaodong/hantao/datasets/MMInstruct-GPT4V_mistral-7b_cosi_cut/merged/top1-20', 'train_template': {}, 'train_size': {}, 'train_split': {}, 'train_name': {}, 'train_data_files': 'pre_tokenized/train.pt', 'train_optional_args': [], 'eval_datasets': {}, 'eval_template': {}, 'eval_size': {}, 'eval_split': {}, 'eval_subset': {}, 'eval_data_files': {}, 'eval_optional_args': []}, 'logger_cfgs': {'log_type': 'wandb', 'log_project': 'align-anything', 'log_run_name': 'sft', 'output_dir': '../outputs/chameleon_sft/top1-20', 'cache_dir': {}, 'save_total_limit': 12}, 'model_cfgs': {'model_name_or_path': '/aifs4su/yaodong/hantao/models/chameleon-7b-hf', 'trust_remote_code': True, 'model_max_length': 4096}, 'special_tokens': {}, '_wandb': {}}
|
| 11 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_init.py:init():784] starting backend
|
| 12 |
+
2025-03-31 12:27:55,740 INFO MainThread:3667125 [wandb_init.py:init():788] sending inform_init request
|
| 13 |
+
2025-03-31 12:27:55,744 INFO MainThread:3667125 [backend.py:_multiprocessing_setup():101] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
|
| 14 |
+
2025-03-31 12:27:55,744 INFO MainThread:3667125 [wandb_init.py:init():798] backend started and connected
|
| 15 |
+
2025-03-31 12:27:55,747 INFO MainThread:3667125 [wandb_init.py:init():891] updated telemetry
|
| 16 |
+
2025-03-31 12:27:55,758 INFO MainThread:3667125 [wandb_init.py:init():915] communicating run to backend with 90.0 second timeout
|
| 17 |
+
2025-03-31 12:27:56,216 INFO MainThread:3667125 [wandb_init.py:init():990] starting run threads in backend
|
| 18 |
+
2025-03-31 12:27:56,466 INFO MainThread:3667125 [wandb_run.py:_console_start():2375] atexit reg
|
| 19 |
+
2025-03-31 12:27:56,466 INFO MainThread:3667125 [wandb_run.py:_redirect():2227] redirect: wrap_raw
|
| 20 |
+
2025-03-31 12:27:56,466 INFO MainThread:3667125 [wandb_run.py:_redirect():2292] Wrapping output streams.
|
| 21 |
+
2025-03-31 12:27:56,466 INFO MainThread:3667125 [wandb_run.py:_redirect():2315] Redirects installed.
|
| 22 |
+
2025-03-31 12:27:56,469 INFO MainThread:3667125 [wandb_init.py:init():1032] run started, returning control to user process
|
| 23 |
+
2025-03-31 13:47:40,856 INFO MainThread:3667125 [wandb_run.py:_finish():2112] finishing run htlou/align-anything/sbnwzgn9
|
| 24 |
+
2025-03-31 13:47:40,858 INFO MainThread:3667125 [wandb_run.py:_atexit_cleanup():2340] got exitcode: 0
|
| 25 |
+
2025-03-31 13:47:40,858 INFO MainThread:3667125 [wandb_run.py:_restore():2322] restore
|
| 26 |
+
2025-03-31 13:47:40,859 INFO MainThread:3667125 [wandb_run.py:_restore():2328] restore done
|
| 27 |
+
2025-03-31 13:47:41,859 INFO MainThread:3667125 [wandb_run.py:_restore():2322] restore
|
| 28 |
+
2025-03-31 13:47:41,860 INFO MainThread:3667125 [wandb_run.py:_restore():2328] restore done
|
| 29 |
+
2025-03-31 13:47:41,860 ERROR MainThread:3667125 [wandb_run.py:_atexit_cleanup():2361] Problem finishing run
|
| 30 |
Traceback (most recent call last):
|
| 31 |
File "/aifs4su/yaodong/miniconda3/envs/hantao_llama/lib/python3.11/site-packages/wandb/sdk/wandb_run.py", line 2352, in _atexit_cleanup
|
| 32 |
self._on_finish()
|
|
|
|
| 44 |
File "/aifs4su/yaodong/miniconda3/envs/hantao_llama/lib/python3.11/concurrent/futures/thread.py", line 169, in submit
|
| 45 |
raise RuntimeError('cannot schedule new futures after '
|
| 46 |
RuntimeError: cannot schedule new futures after interpreter shutdown
|
| 47 |
+
2025-03-31 13:47:42,228 INFO MsgRouterThr:3667125 [mailbox.py:close():129] Closing mailbox, abandoning 2 handles.
|
wandb/run-20250331_122302-ihc2u2rd/files/output.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
***** Running training *****
|
| 2 |
+
Resuming from checkpoint 1/3 epoch : 0%| | 0/14637 [00:00<?, ?it/s]`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`.
|
| 3 |
+
Training 1/3 epoch (loss 3.4756): 1%|██▍ | 145/14637 [02:22<3:46:24, 1.07it/s]
|
wandb/run-20250331_122302-ihc2u2rd/files/requirements.txt
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
maskrcnn_benchmark==0.0.0
|
| 2 |
+
webdataset==0.2.111
|
| 3 |
+
websockets==15.0.1
|
| 4 |
+
typer==0.15.2
|
| 5 |
+
blobfile==3.0.0
|
| 6 |
+
pooch==1.8.2
|
| 7 |
+
filelock==3.18.0
|
| 8 |
+
referencing==0.36.2
|
| 9 |
+
matplotlib==3.10.1
|
| 10 |
+
cachetools==5.5.2
|
| 11 |
+
python-dateutil==2.9.0.post0
|
| 12 |
+
gmpy2==2.2.1
|
| 13 |
+
uvloop==0.21.0
|
| 14 |
+
nvidia-cusparselt-cu12==0.6.2
|
| 15 |
+
clip==0.2.0
|
| 16 |
+
httpcore==1.0.7
|
| 17 |
+
charset-normalizer==3.3.2
|
| 18 |
+
torchlibrosa==0.1.0
|
| 19 |
+
contourpy==1.3.1
|
| 20 |
+
multiprocess==0.70.16
|
| 21 |
+
nest-asyncio==1.6.0
|
| 22 |
+
Werkzeug==3.1.3
|
| 23 |
+
aiofiles==23.2.1
|
| 24 |
+
six==1.17.0
|
| 25 |
+
torch==2.6.0
|
| 26 |
+
sse-starlette==2.2.1
|
| 27 |
+
typing_extensions==4.12.2
|
| 28 |
+
xgrammar==0.1.16
|
| 29 |
+
psutil==7.0.0
|
| 30 |
+
kiwisolver==1.4.8
|
| 31 |
+
moviepy==2.1.2
|
| 32 |
+
frozenlist==1.5.0
|
| 33 |
+
jiter==0.9.0
|
| 34 |
+
einops==0.8.1
|
| 35 |
+
flash_attn==2.7.4.post1
|
| 36 |
+
PySocks==1.7.1
|
| 37 |
+
regex==2024.11.6
|
| 38 |
+
markdown-it-py==3.0.0
|
| 39 |
+
ruff==0.11.2
|
| 40 |
+
docker-pycreds==0.4.0
|
| 41 |
+
nvidia-nvtx-cu12==12.4.127
|
| 42 |
+
pyparsing==3.2.3
|
| 43 |
+
resampy==0.4.3
|
| 44 |
+
tokenizers==0.21.0
|
| 45 |
+
frechet-audio-distance==0.1.2
|
| 46 |
+
aiohappyeyeballs==2.6.1
|
| 47 |
+
llamafactory==0.9.3.dev0
|
| 48 |
+
msgspec==0.19.0
|
| 49 |
+
httpx==0.28.1
|
| 50 |
+
encodec==0.1.1
|
| 51 |
+
ffmpy==0.5.0
|
| 52 |
+
jsonschema==4.23.0
|
| 53 |
+
imageio-ffmpeg==0.6.0
|
| 54 |
+
mkl_random==1.2.8
|
| 55 |
+
fairscale==0.4.13
|
| 56 |
+
soxr==0.5.0.post1
|
| 57 |
+
lark==1.2.2
|
| 58 |
+
gradio==5.21.0
|
| 59 |
+
absl-py==2.2.1
|
| 60 |
+
dnspython==2.7.0
|
| 61 |
+
networkx==3.4.2
|
| 62 |
+
h5py==3.13.0
|
| 63 |
+
hjson==3.1.0
|
| 64 |
+
tensorboard==2.19.0
|
| 65 |
+
aiosignal==1.3.2
|
| 66 |
+
pip==25.0
|
| 67 |
+
nvidia-cublas-cu12==12.4.5.8
|
| 68 |
+
llguidance==0.7.11
|
| 69 |
+
zipp==3.21.0
|
| 70 |
+
ftfy==6.3.1
|
| 71 |
+
peft==0.15.0
|
| 72 |
+
attrs==25.3.0
|
| 73 |
+
trl==0.9.6
|
| 74 |
+
requests==2.32.3
|
| 75 |
+
progressbar==2.5
|
| 76 |
+
sniffio==1.3.1
|
| 77 |
+
pycountry==24.6.1
|
| 78 |
+
lxml==5.3.1
|
| 79 |
+
starlette==0.46.1
|
| 80 |
+
pytest==7.2.0
|
| 81 |
+
Markdown==3.7
|
| 82 |
+
mdurl==0.1.2
|
| 83 |
+
pyzmq==26.3.0
|
| 84 |
+
safetensors==0.5.3
|
| 85 |
+
opencv-python==4.6.0.66
|
| 86 |
+
prometheus-fastapi-instrumentator==7.1.0
|
| 87 |
+
shellingham==1.5.4
|
| 88 |
+
torchvision==0.21.0
|
| 89 |
+
pluggy==1.5.0
|
| 90 |
+
timm==1.0.15
|
| 91 |
+
multidict==6.2.0
|
| 92 |
+
semantic-version==2.10.0
|
| 93 |
+
airportsdata==20250224
|
| 94 |
+
numba==0.60.0
|
| 95 |
+
MarkupSafe==2.1.5
|
| 96 |
+
pydantic_core==2.33.0
|
| 97 |
+
imageio==2.37.0
|
| 98 |
+
nvidia-nccl-cu12==2.21.5
|
| 99 |
+
dill==0.3.8
|
| 100 |
+
msgpack==1.1.0
|
| 101 |
+
sentry-sdk==2.24.1
|
| 102 |
+
rpds-py==0.24.0
|
| 103 |
+
grpcio==1.71.0
|
| 104 |
+
fastrlock==0.8.3
|
| 105 |
+
python-json-logger==3.3.0
|
| 106 |
+
cffi==1.17.1
|
| 107 |
+
gradio_client==1.7.2
|
| 108 |
+
PyYAML==6.0.2
|
| 109 |
+
tensorboard-data-server==0.7.2
|
| 110 |
+
termcolor==2.5.0
|
| 111 |
+
torchaudio==2.6.0
|
| 112 |
+
triton==3.2.0
|
| 113 |
+
fastapi==0.115.12
|
| 114 |
+
clint==0.5.1
|
| 115 |
+
lazy_loader==0.4
|
| 116 |
+
depyf==0.18.0
|
| 117 |
+
mkl_fft==1.3.11
|
| 118 |
+
annotated-types==0.7.0
|
| 119 |
+
scikit-learn==1.6.1
|
| 120 |
+
wget==3.2
|
| 121 |
+
setuptools==75.8.0
|
| 122 |
+
args==0.1.0
|
| 123 |
+
certifi==2025.1.31
|
| 124 |
+
click==8.1.8
|
| 125 |
+
python-dotenv==1.1.0
|
| 126 |
+
laion_clap==1.1.5
|
| 127 |
+
Pygments==2.19.1
|
| 128 |
+
tomlkit==0.13.2
|
| 129 |
+
idna==3.7
|
| 130 |
+
propcache==0.3.1
|
| 131 |
+
platformdirs==4.3.7
|
| 132 |
+
align-anything==0.0.1.dev0
|
| 133 |
+
ray==2.44.1
|
| 134 |
+
cloudpickle==3.1.1
|
| 135 |
+
deepspeed==0.16.5
|
| 136 |
+
smmap==5.0.2
|
| 137 |
+
distro==1.9.0
|
| 138 |
+
fonttools==4.56.0
|
| 139 |
+
typing-inspection==0.4.0
|
| 140 |
+
braceexpand==0.1.7
|
| 141 |
+
decorator==5.2.1
|
| 142 |
+
diskcache==5.6.3
|
| 143 |
+
yt-dlp==2025.3.27
|
| 144 |
+
shtab==1.7.1
|
| 145 |
+
gguf==0.10.0
|
| 146 |
+
interegular==0.3.3
|
| 147 |
+
compressed-tensors==0.9.2
|
| 148 |
+
pandas==2.2.3
|
| 149 |
+
huggingface-hub==0.29.3
|
| 150 |
+
pyarrow==19.0.1
|
| 151 |
+
lm-format-enforcer==0.10.11
|
| 152 |
+
GitPython==3.1.44
|
| 153 |
+
xxhash==3.5.0
|
| 154 |
+
packaging==24.2
|
| 155 |
+
setproctitle==1.3.5
|
| 156 |
+
llvmlite==0.43.0
|
| 157 |
+
tiktoken==0.9.0
|
| 158 |
+
mpmath==1.3.0
|
| 159 |
+
email_validator==2.2.0
|
| 160 |
+
nvidia-ml-py==12.570.86
|
| 161 |
+
pydantic==2.11.0
|
| 162 |
+
xformers==0.0.29.post2
|
| 163 |
+
httptools==0.6.4
|
| 164 |
+
librosa==0.11.0
|
| 165 |
+
pytorch-fid==0.3.0
|
| 166 |
+
hpsv2==1.2.0
|
| 167 |
+
nvidia-cudnn-cu12==9.1.0.70
|
| 168 |
+
iniconfig==2.1.0
|
| 169 |
+
sympy==1.13.1
|
| 170 |
+
safehttpx==0.1.6
|
| 171 |
+
jsonschema-specifications==2024.10.1
|
| 172 |
+
Jinja2==3.1.6
|
| 173 |
+
tyro==0.8.14
|
| 174 |
+
h11==0.14.0
|
| 175 |
+
aiohttp==3.11.14
|
| 176 |
+
diffusers==0.32.2
|
| 177 |
+
tqdm==4.67.1
|
| 178 |
+
blake3==1.0.4
|
| 179 |
+
vllm==0.8.2
|
| 180 |
+
scipy==1.10.1
|
| 181 |
+
audioread==3.0.1
|
| 182 |
+
proglog==0.1.10
|
| 183 |
+
fire==0.7.0
|
| 184 |
+
sentencepiece==0.2.0
|
| 185 |
+
pytz==2025.2
|
| 186 |
+
nvidia-nvjitlink-cu12==12.4.127
|
| 187 |
+
nvidia-curand-cu12==10.3.5.147
|
| 188 |
+
numpy==1.26.4
|
| 189 |
+
tzdata==2025.2
|
| 190 |
+
python-multipart==0.0.20
|
| 191 |
+
urllib3==2.3.0
|
| 192 |
+
pycryptodomex==3.22.0
|
| 193 |
+
yarl==1.18.3
|
| 194 |
+
outlines==0.1.11
|
| 195 |
+
nvidia-cusolver-cu12==11.6.1.9
|
| 196 |
+
pydub==0.25.1
|
| 197 |
+
mistral_common==1.5.4
|
| 198 |
+
pycparser==2.22
|
| 199 |
+
pytest-split==0.8.0
|
| 200 |
+
datasets==3.4.1
|
| 201 |
+
soundfile==0.13.1
|
| 202 |
+
transformers==4.50.0
|
| 203 |
+
image-reward==1.5
|
| 204 |
+
wcwidth==0.2.13
|
| 205 |
+
nvidia-cuda-nvrtc-cu12==12.4.127
|
| 206 |
+
groovy==0.1.2
|
| 207 |
+
nvidia-cuda-runtime-cu12==12.4.127
|
| 208 |
+
astor==0.8.1
|
| 209 |
+
anyio==4.9.0
|
| 210 |
+
wandb==0.19.8
|
| 211 |
+
joblib==1.4.2
|
| 212 |
+
fsspec==2024.12.0
|
| 213 |
+
accelerate==1.5.2
|
| 214 |
+
py-cpuinfo==9.0.0
|
| 215 |
+
docstring_parser==0.16
|
| 216 |
+
partial-json-parser==0.2.1.1.post5
|
| 217 |
+
nvidia-cusparse-cu12==12.3.1.170
|
| 218 |
+
protobuf==3.20.3
|
| 219 |
+
outlines_core==0.1.26
|
| 220 |
+
nvidia-cufft-cu12==11.2.1.3
|
| 221 |
+
cycler==0.12.1
|
| 222 |
+
uvicorn==0.34.0
|
| 223 |
+
orjson==3.10.16
|
| 224 |
+
av==14.2.0
|
| 225 |
+
Brotli==1.0.9
|
| 226 |
+
cupy-cuda12x==13.4.1
|
| 227 |
+
openai==1.69.0
|
| 228 |
+
rich==13.9.4
|
| 229 |
+
importlib_metadata==8.6.1
|
| 230 |
+
ninja==1.11.1.4
|
| 231 |
+
wheel==0.45.1
|
| 232 |
+
pillow==10.4.0
|
| 233 |
+
prometheus_client==0.21.1
|
| 234 |
+
threadpoolctl==3.6.0
|
| 235 |
+
gitdb==4.0.12
|
| 236 |
+
watchfiles==1.0.4
|
| 237 |
+
nvidia-cuda-cupti-cu12==12.4.127
|
| 238 |
+
opencv-python-headless==4.11.0.86
|
| 239 |
+
mkl-service==2.4.0
|
| 240 |
+
rich-toolkit==0.14.0
|
| 241 |
+
fastapi-cli==0.0.7
|
| 242 |
+
llamafactory==0.9.3.dev0
|
| 243 |
+
typing_extensions==4.12.2
|
| 244 |
+
tomli==2.0.1
|
| 245 |
+
zipp==3.19.2
|
| 246 |
+
wheel==0.43.0
|
| 247 |
+
jaraco.text==3.12.1
|
| 248 |
+
packaging==24.2
|
| 249 |
+
autocommand==2.2.2
|
| 250 |
+
jaraco.functools==4.0.1
|
| 251 |
+
jaraco.collections==5.1.0
|
| 252 |
+
platformdirs==4.2.2
|
| 253 |
+
more-itertools==10.3.0
|
| 254 |
+
inflect==7.3.1
|
| 255 |
+
jaraco.context==5.3.0
|
| 256 |
+
typeguard==4.3.0
|
| 257 |
+
backports.tarfile==1.2.0
|
| 258 |
+
importlib_metadata==8.0.0
|
wandb/run-20250331_122302-ihc2u2rd/files/wandb-metadata.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"os": "Linux-5.15.0-1040-nvidia-x86_64-with-glibc2.35",
|
| 3 |
+
"python": "CPython 3.11.11",
|
| 4 |
+
"startedAt": "2025-03-31T04:23:02.690330Z",
|
| 5 |
+
"args": [
|
| 6 |
+
"--local_rank=0",
|
| 7 |
+
"--model_name_or_path",
|
| 8 |
+
"/aifs4su/yaodong/hantao/models/chameleon-7b-hf",
|
| 9 |
+
"--train_datasets",
|
| 10 |
+
"/aifs4su/yaodong/hantao/datasets/MMInstruct-GPT4V_mistral-7b_cosi_cut/merged/top1-20",
|
| 11 |
+
"--train_data_files",
|
| 12 |
+
"pre_tokenized/train.pt",
|
| 13 |
+
"--output_dir",
|
| 14 |
+
"../outputs/chameleon_sft/top1-20",
|
| 15 |
+
"--save_total_limit",
|
| 16 |
+
"12",
|
| 17 |
+
"--train_batch_size",
|
| 18 |
+
"16",
|
| 19 |
+
"--epochs",
|
| 20 |
+
"3"
|
| 21 |
+
],
|
| 22 |
+
"program": "-m align_anything.trainers.text_image_to_text_image.sft",
|
| 23 |
+
"git": {
|
| 24 |
+
"remote": "git@github.com-hantao:PKU-Alignment/align-anything.git",
|
| 25 |
+
"commit": "106588f9802757a3283c1aff1f33ea9afd737f31"
|
| 26 |
+
},
|
| 27 |
+
"email": "2200017789@stu.pku.edu.cn",
|
| 28 |
+
"root": "../outputs/chameleon_sft/top1-20",
|
| 29 |
+
"host": "dgx-075",
|
| 30 |
+
"executable": "/aifs4su/yaodong/miniconda3/envs/hantao_llama/bin/python",
|
| 31 |
+
"cpu_count": 112,
|
| 32 |
+
"cpu_count_logical": 224,
|
| 33 |
+
"gpu": "NVIDIA H800",
|
| 34 |
+
"gpu_count": 8,
|
| 35 |
+
"disk": {
|
| 36 |
+
"/": {
|
| 37 |
+
"total": "1888556142592",
|
| 38 |
+
"used": "44032839680"
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
"memory": {
|
| 42 |
+
"total": "2164195545088"
|
| 43 |
+
},
|
| 44 |
+
"cpu": {
|
| 45 |
+
"count": 112,
|
| 46 |
+
"countLogical": 224
|
| 47 |
+
},
|
| 48 |
+
"gpu_nvidia": [
|
| 49 |
+
{
|
| 50 |
+
"name": "NVIDIA H800",
|
| 51 |
+
"memoryTotal": "85520809984",
|
| 52 |
+
"cudaCores": 16896,
|
| 53 |
+
"architecture": "Hopper"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"name": "NVIDIA H800",
|
| 57 |
+
"memoryTotal": "85520809984",
|
| 58 |
+
"cudaCores": 16896,
|
| 59 |
+
"architecture": "Hopper"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"name": "NVIDIA H800",
|
| 63 |
+
"memoryTotal": "85520809984",
|
| 64 |
+
"cudaCores": 16896,
|
| 65 |
+
"architecture": "Hopper"
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"name": "NVIDIA H800",
|
| 69 |
+
"memoryTotal": "85520809984",
|
| 70 |
+
"cudaCores": 16896,
|
| 71 |
+
"architecture": "Hopper"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "NVIDIA H800",
|
| 75 |
+
"memoryTotal": "85520809984",
|
| 76 |
+
"cudaCores": 16896,
|
| 77 |
+
"architecture": "Hopper"
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"name": "NVIDIA H800",
|
| 81 |
+
"memoryTotal": "85520809984",
|
| 82 |
+
"cudaCores": 16896,
|
| 83 |
+
"architecture": "Hopper"
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"name": "NVIDIA H800",
|
| 87 |
+
"memoryTotal": "85520809984",
|
| 88 |
+
"cudaCores": 16896,
|
| 89 |
+
"architecture": "Hopper"
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"name": "NVIDIA H800",
|
| 93 |
+
"memoryTotal": "85520809984",
|
| 94 |
+
"cudaCores": 16896,
|
| 95 |
+
"architecture": "Hopper"
|
| 96 |
+
}
|
| 97 |
+
],
|
| 98 |
+
"slurm": {
|
| 99 |
+
"conf": "/cm/shared/apps/slurm/var/etc/slurm/slurm.conf"
|
| 100 |
+
},
|
| 101 |
+
"cudaVersion": "12.2"
|
| 102 |
+
}
|
wandb/run-20250331_122302-ihc2u2rd/logs/debug-core.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"time":"2025-03-31T12:23:02.065326541+08:00","level":"INFO","msg":"main: starting server","port-filename":"/tmp/tmp556n_w2z/port-3446402.txt","pid":3446402,"log-level":0,"disable-analytics":false,"shutdown-on-parent-exit":false}
|
| 2 |
+
{"time":"2025-03-31T12:23:02.066840259+08:00","level":"INFO","msg":"Will exit if parent process dies.","ppid":3446402}
|
| 3 |
+
{"time":"2025-03-31T12:23:02.066820525+08:00","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":37983,"Zone":""}}
|
| 4 |
+
{"time":"2025-03-31T12:23:02.243155014+08:00","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:40900"}
|
| 5 |
+
{"time":"2025-03-31T12:23:02.691791961+08:00","level":"INFO","msg":"handleInformInit: received","streamId":"ihc2u2rd","id":"127.0.0.1:40900"}
|
| 6 |
+
{"time":"2025-03-31T12:23:02.915258386+08:00","level":"INFO","msg":"handleInformInit: stream started","streamId":"ihc2u2rd","id":"127.0.0.1:40900"}
|
| 7 |
+
{"time":"2025-03-31T12:25:27.263952947+08:00","level":"INFO","msg":"received shutdown signal","signal":15}
|
wandb/run-20250331_122302-ihc2u2rd/logs/debug-internal.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"time":"2025-03-31T12:23:02.693593301+08:00","level":"INFO","msg":"stream: starting","core version":"0.19.8","symlink path":"../outputs/chameleon_sft/top1-20/wandb/run-20250331_122302-ihc2u2rd/logs/debug-core.log"}
|
| 2 |
+
{"time":"2025-03-31T12:23:02.915193082+08:00","level":"INFO","msg":"created new stream","id":"ihc2u2rd"}
|
| 3 |
+
{"time":"2025-03-31T12:23:02.915252357+08:00","level":"INFO","msg":"stream: started","id":"ihc2u2rd"}
|
| 4 |
+
{"time":"2025-03-31T12:23:02.915298914+08:00","level":"INFO","msg":"handler: started","stream_id":"ihc2u2rd"}
|
| 5 |
+
{"time":"2025-03-31T12:23:02.915314471+08:00","level":"INFO","msg":"writer: Do: started","stream_id":"ihc2u2rd"}
|
| 6 |
+
{"time":"2025-03-31T12:23:02.915322112+08:00","level":"INFO","msg":"sender: started","stream_id":"ihc2u2rd"}
|
| 7 |
+
{"time":"2025-03-31T12:23:03.311308553+08:00","level":"INFO","msg":"Starting system monitor"}
|