Compare commits

...

2 Commits

Author SHA1 Message Date
Yaowei Zheng
b2395b25b0
[hparams] fix data args (#8863) 2025-08-08 15:35:50 +08:00
golangboy
df364998b1
[file] Resolve file lock issue when deleting safetensors on Windows (#8839) 2025-08-08 14:59:54 +08:00
3 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@ sentencepiece
tiktoken tiktoken
modelscope>=1.14.0 modelscope>=1.14.0
hf-transfer hf-transfer
safetensors<=0.5.3
# python # python
fire fire
omegaconf omegaconf

View File

@ -35,7 +35,7 @@ class DataArguments:
default=None, default=None,
metadata={"help": "The name of dataset(s) to use for evaluation. Use commas to separate multiple datasets."}, metadata={"help": "The name of dataset(s) to use for evaluation. Use commas to separate multiple datasets."},
) )
dataset_dir: Union[str, dict] = field( dataset_dir: str = field(
default="data", default="data",
metadata={"help": "Path to the folder containing the datasets."}, metadata={"help": "Path to the folder containing the datasets."},
) )

View File

@ -73,7 +73,7 @@ def fix_valuehead_checkpoint(
if safe_serialization: if safe_serialization:
path_to_checkpoint = os.path.join(output_dir, SAFE_WEIGHTS_NAME) path_to_checkpoint = os.path.join(output_dir, SAFE_WEIGHTS_NAME)
with safe_open(path_to_checkpoint, framework="pt", device="cpu") as f: with safe_open(path_to_checkpoint, framework="pt", device="cpu") as f:
state_dict: dict[str, torch.Tensor] = {key: f.get_tensor(key) for key in f.keys()} state_dict: dict[str, torch.Tensor] = {key: f.get_tensor(key).clone() for key in f.keys()}
else: else:
path_to_checkpoint = os.path.join(output_dir, WEIGHTS_NAME) path_to_checkpoint = os.path.join(output_dir, WEIGHTS_NAME)
state_dict: dict[str, torch.Tensor] = torch.load(path_to_checkpoint, map_location="cpu", weights_only=True) state_dict: dict[str, torch.Tensor] = torch.load(path_to_checkpoint, map_location="cpu", weights_only=True)