LLM: Explicitly close pickle file pointer before removing temporary directory (#9120)

* fp close
This commit is contained in:
Zhao Changmin 2023-10-10 14:57:23 +08:00 committed by GitHub
parent 0e09dd926b
commit 1709beba5b

View file

@ -179,6 +179,7 @@ def lazyload(
f"but get {pickle_paths}. ")
pickle_fp = zf.open(pickle_paths[0], 'r')
state_dict = _load(pickle_fp, None, pickle, pickle_file=pickle_paths[0][:-4], zip_file=zf)
fp.close() # Otherwise on windows this may be marked as reading
return state_dict