对huggingface的训练完成的结果的目录结构进行说明
目录结构
├── all_results.json
├── config.json
├── eval_results.json
├── preprocessor_config.json
├── pytorch_model.bin
├── runs
│ └── Apr20_11-09-24_wac209
│ ├── 1681960165.2226455
│ │ └── events.out.tfevents.1681960165.wac209
│ ├── events.out.tfevents.1681960165.wac209
│ └── events.out.tfevents.1681960176.wac209
├── train_results.json
├── trainer_state.json
└── training_args.bin
all_results.json:一个JSON文件,包含每个epoch的训练和验证结果。
config.json:一个JSON文件,包含模型的配置信息,例如模型的架构、超参数等等。
eval_results.json:一个JSON文件,包含验证集上的结果。
preprocessor_config.json:一个JSON文件,包含预处理器的配置信息,例如tokenizer的参数等等。
pytorch_model.bin:一个二进制文件,包含训练好的PyTorch模型的参数。
runs:一个目录,包含TensorBoard日志文件,用于可视化训练过程中的指标和图形。 tensforboard –logdir runs 即可查看
train_results.json:一个JSON文件,包含训练集上的结果。
trainer_state.json:一个JSON文件,包含训练过程中Trainer对象的状态信息,例如当前epoch、当前step等等。
training_args.bin:一个二进制文件,包含训练脚本的参数,例如训练数据的路径、训练的超参数等等。
#cat all_results.json
{
“epoch”: 6.0,
“eval_accuracy”: 0.7272727272727273,
“eval_loss”: 1.4200994968414307,
“eval_runtime”: 0.1368,
“eval_samples_per_second”: 80.438,
“eval_steps_per_second”: 14.625,
“train_loss”: 1.4368099636501737,
“train_runtime”: 10.7547,
“train_samples_per_second”: 49.095,
“train_steps_per_second”: 3.347
}%
#cat eval_results.json
{
“epoch”: 6.0,
“eval_accuracy”: 0.7272727272727273,
“eval_loss”: 1.4200994968414307,
“eval_runtime”: 0.1368,
“eval_samples_per_second”: 80.438,
“eval_steps_per_second”: 14.625
}% ➜ vit-base-disney cat trainer_state.json
{
“best_metric”: null,
“best_model_checkpoint”: null,
“epoch”: 6.0,
“global_step”: 36,
“is_hyper_param_search”: false,
“is_local_process_zero”: true,
“is_world_process_zero”: true,
“log_history”: [
{
“epoch”: 1.67,
“learning_rate”: 0.00014444444444444444,
“loss”: 2.1824,
“step”: 10
},
{
“epoch”: 3.33,
“learning_rate”: 8.888888888888889e-05,
“loss”: 1.4562,
“step”: 20
},
{
“epoch”: 5.0,
“learning_rate”: 3.3333333333333335e-05,
“loss”: 1.0267,
“step”: 30
},
{
“epoch”: 6.0,
“step”: 36,
“total_flos”: 4.091907095248896e+16,
“train_loss”: 1.4368099636501737,
“train_runtime”: 10.7547,
“train_samples_per_second”: 49.095,
“train_steps_per_second”: 3.347
}
],
“max_steps”: 36,
“num_train_epochs”: 6,
“total_flos”: 4.091907095248896e+16,
“trial_name”: null,
“trial_params”: null
}
#模型的配置信息
cat config.json
{
“_name_or_path”: “google/vit-base-patch16-224-in21k”,
“architectures”: [
“ViTForImageClassification”
],
“attention_probs_dropout_prob”: 0.0,
“encoder_stride”: 16,
“hidden_act”: “gelu”,
“hidden_dropout_prob”: 0.0,
“hidden_size”: 768,
“id2label”: {
“0”: “\u514b\u8389\u65af”,
“1”: “\u5510\u8001\u9e2d”,
“10”: “\u9edb\u4e1d”,
“2”: “\u5947\u5947”,
“3”: “\u5e03\u9c81\u6258”,
“4”: “\u661f\u9edb\u9732”,
“5”: “\u73b2\u5a1c\u8d1d\u5c14”,
“6”: “\u7c73\u5947”,
“7”: “\u7c73\u59ae”,
“8”: “\u8482\u8482”,
“9”: “\u9ad8\u98de”
},
“image_size”: 224,
“initializer_range”: 0.02,
“intermediate_size”: 3072,
“label2id”: {
“\u514b\u8389\u65af”: “0”,
“\u5510\u8001\u9e2d”: “1”,
“\u5947\u5947”: “2”,
“\u5e03\u9c81\u6258”: “3”,
“\u661f\u9edb\u9732”: “4”,
“\u73b2\u5a1c\u8d1d\u5c14”: “5”,
“\u7c73\u5947”: “6”,
“\u7c73\u59ae”: “7”,
“\u8482\u8482”: “8”,
“\u9ad8\u98de”: “9”,
“\u9edb\u4e1d”: “10”
},
“layer_norm_eps”: 1e-12,
“model_type”: “vit”,
“num_attention_heads”: 12,
“num_channels”: 3,
“num_hidden_layers”: 12,
“patch_size”: 16,
“problem_type”: “single_label_classification”,
“qkv_bias”: true,
“torch_dtype”: “float32”,
“transformers_version”: “4.28.1”
}