Merge pull request #1695 from Samge0/dev

Improve:"CUDA_VISIBLE_DEVICES" read from the env

Former-commit-id: fbc6220692ba3a20c749eeda1d8c3abe1a037537
This commit is contained in:
hoshi-hiyouga 2023-12-01 15:56:18 +08:00 committed by GitHub
commit 6e094e491e

View File

@ -44,7 +44,8 @@ def can_quantize(finetuning_type: str) -> Dict[str, Any]:
def gen_cmd(args: Dict[str, Any]) -> str: def gen_cmd(args: Dict[str, Any]) -> str:
args.pop("disable_tqdm", None) args.pop("disable_tqdm", None)
args["plot_loss"] = args.get("do_train", None) args["plot_loss"] = args.get("do_train", None)
cmd_lines = ["CUDA_VISIBLE_DEVICES=0 python src/train_bash.py "] cuda_visible_devices = os.environ.get('CUDA_VISIBLE_DEVICES') or "0"
cmd_lines = [f"CUDA_VISIBLE_DEVICES={cuda_visible_devices} python src/train_bash.py "]
for k, v in args.items(): for k, v in args.items():
if v is not None and v != "": if v is not None and v != "":
cmd_lines.append(" --{} {} ".format(k, str(v))) cmd_lines.append(" --{} {} ".format(k, str(v)))