#后台运行并输入日志nohup sh run_1_4.sh > nohup_14_aug.out 2>&1 & # &作用是后台运行,不在桌面输出 nohup永久执行命令,即使ssh断开了wc --helpcat file | wc -l # 查看文件总共有多少行ls file | wc -l # 查看目录下总共有多少个文件du -h -d 0 /sdf/RRC_V4_20200521/ # 查看文件/文件夹大小CUDA_VISIBLE_DEVICES=7 python -m ipdb train.py # debug python
import timeprint(time.strftime('%Y_%m_%d_%H_%M_%S', time.localtime()))# 加载的模型的参数 多余 当前模型本身的参数model_dict = model.state_dict()pretrained_dict = torch.load('file.pth.tar')# 1. filter out unnecessary keyspretrained_dict = {k: v for k, vin pretrained_dict.items() if k in model_dict}# 2. overwrite entries in the existing state dictmodel_dict.update(pretrained_dict)# 3. load the new state dictmodel.load_state_dict(model_dict)# 加载的模型参数 少于 当前模型本身的参数model.load_state_dict(checkpoint['state_dict'],strict=False)#load_state_dict严格匹配参数的键名称#strict=False表示只加载与键值匹配的参数,并忽略其他参数键。
遍历文件夹:
def walkFile(file):for root, dirs, files in os.walk(file):# root 表示当前正在访问的文件夹路径# dirs 表示该文件夹下的子目录名list# files 表示该文件夹下的文件list# 遍历文件for f in files:print(os.path.join(root, f))# 遍历所有的文件夹for d in dirs:print(os.path.join(root, d))
export PATH=/usr/local/cuda-10.2/bin:$PATHexport LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
https://blog.csdn.net/weixin_42699651/article/details/89019402
