#后台运行并输入日志
nohup sh run_1_4.sh > nohup_14_aug.out 2>&1 & # &作用是后台运行,不在桌面输出 nohup永久执行命令,即使ssh断开了
wc --help
cat 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 time
print(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 keys
pretrained_dict = {k: v for k, vin pretrained_dict.items() if k in model_dict}
# 2. overwrite entries in the existing state dict
model_dict.update(pretrained_dict)
# 3. load the new state dict
model.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:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
https://blog.csdn.net/weixin_42699651/article/details/89019402