when run: ./finetune_lora.sh,
got: TypeError: Object of type Tensor is not JSON serializable .
detail:
Traceback (most recent call last):
File "/home/david/qw/Llama2-Chinese0/train/sft/finetune_clm_lora.py", line 694, in
main()
File "/home/david/qw/Llama2-Chinese0/train/sft/finetune_clm_lora.py", line 655, in main
train_result = trainer.train(resume_from_checkpoint=checkpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 1624, in train
return inner_training_loop(
^^^^^^^^^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 2029, in _inner_training_loop
self._maybe_log_save_evaluate(tr_loss, grad_norm, model, trial, epoch, ignore_keys_for_eval)
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 2423, in _maybe_log_save_evaluate
self._save_checkpoint(model, trial, metrics=metrics)
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 2525, in _save_checkpoint
self.state.save_to_json(os.path.join(staging_output_dir, TRAINER_STATE_NAME))
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer_callback.py", line 113, in save_to_json
json_string = json.dumps(dataclasses.asdict(self), indent=2, sort_keys=True) + "\n"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/init.py", line 238, in dumps
**kw).encode(obj)
^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 202, in encode
chunks = list(chunks)
^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 432, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 326, in _iterencode_list
yield from chunks
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 439, in _iterencode
o = _default(o)
^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type Tensor is not JSON serializable
0%| | 20/12320 [02:45<28:15:36, 8.27s/it]
[2024-02-22 18:10:12,142] [INFO] [launch.py:316:sigkill_handler] Killing subprocess 33581
when run: ./finetune_lora.sh, got: TypeError: Object of type Tensor is not JSON serializable .
detail: Traceback (most recent call last): File "/home/david/qw/Llama2-Chinese0/train/sft/finetune_clm_lora.py", line 694, in
main()
File "/home/david/qw/Llama2-Chinese0/train/sft/finetune_clm_lora.py", line 655, in main
train_result = trainer.train(resume_from_checkpoint=checkpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 1624, in train
return inner_training_loop(
^^^^^^^^^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 2029, in _inner_training_loop
self._maybe_log_save_evaluate(tr_loss, grad_norm, model, trial, epoch, ignore_keys_for_eval)
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 2423, in _maybe_log_save_evaluate
self._save_checkpoint(model, trial, metrics=metrics)
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer.py", line 2525, in _save_checkpoint
self.state.save_to_json(os.path.join(staging_output_dir, TRAINER_STATE_NAME))
File "/home/david/anaconda3/envs/llama2/lib/python3.11/site-packages/transformers/trainer_callback.py", line 113, in save_to_json
json_string = json.dumps(dataclasses.asdict(self), indent=2, sort_keys=True) + "\n"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/init.py", line 238, in dumps
**kw).encode(obj)
^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 202, in encode
chunks = list(chunks)
^^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 432, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 326, in _iterencode_list
yield from chunks
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
yield from chunks
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 439, in _iterencode
o = _default(o)
^^^^^^^^^^^
File "/home/david/anaconda3/envs/llama2/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type Tensor is not JSON serializable
0%| | 20/12320 [02:45<28:15:36, 8.27s/it]
[2024-02-22 18:10:12,142] [INFO] [launch.py:316:sigkill_handler] Killing subprocess 33581
Thanks very much.