From 4c0cd7c15f7b2dd73c2506627e880bd3d0da443d Mon Sep 17 00:00:00 2001 From: "Yao, Matrix" Date: Thu, 31 Jul 2025 15:32:14 +0000 Subject: [PATCH 1/4] xpu enable Signed-off-by: Yao, Matrix --- examples/corda_finetuning/preprocess.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/corda_finetuning/preprocess.py b/examples/corda_finetuning/preprocess.py index 15bb18cb6b..765242f15e 100644 --- a/examples/corda_finetuning/preprocess.py +++ b/examples/corda_finetuning/preprocess.py @@ -38,8 +38,11 @@ def main(args): # Setting random seed of numpy and torch np.random.seed(args.seed) torch.manual_seed(args.seed) - torch.cuda.manual_seed_all(args.seed) - torch.backends.cudnn.deterministic = True + if torch.cuda.is_available(): + torch.cuda.manual_seed_all(args.seed) + elif torch.xpu.is_available(): + torch.xpu.manual_seed_all(args.seed) + torch.use_deterministic_algorithms(True) # Load model model_id = args.model_id From 559a9077680c61dd77e7a21fcfa00b8c9078bf90 Mon Sep 17 00:00:00 2001 From: "Yao, Matrix" Date: Thu, 31 Jul 2025 17:24:17 +0000 Subject: [PATCH 2/4] update README Signed-off-by: Yao, Matrix --- examples/corda_finetuning/README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/corda_finetuning/README.md b/examples/corda_finetuning/README.md index 9f5d0a8ff3..0f5488f2d0 100644 --- a/examples/corda_finetuning/README.md +++ b/examples/corda_finetuning/README.md @@ -150,7 +150,10 @@ corda_config = CordaConfig( #### Knowledge-preserved adaptation mode ```bash -CUDA_VISIBLE_DEVICES=0 python -u preprocess.py --model_id="meta-llama/Llama-2-7b-hf" \ +export CUDA_VISIBLE_DEVICES=0 # force to use devcie 0 of CUDA GPU +export ZE_AFFINITY_MASK=0 # force to use device 0 of Intel XPU + +python -u preprocess.py --model_id="meta-llama/Llama-2-7b-hf" \ --r 128 --seed 233 \ --save_model --save_path {path_to_residual_model} \ --calib_dataset "nqopen" @@ -165,7 +168,10 @@ Arguments: #### Instruction-previewed adaptation mode ```bash -CUDA_VISIBLE_DEVICES=0 python -u preprocess.py --model_id="meta-llama/Llama-2-7b-hf" \ +export CUDA_VISIBLE_DEVICES=0 # force to use devcie 0 of CUDA GPU +export ZE_AFFINITY_MASK=0 # force to use device 0 of Intel XPU + +python -u preprocess.py --model_id="meta-llama/Llama-2-7b-hf" \ --r 128 --seed 233 \ --save_model --save_path {path_to_residual_model} \ --first_eigen --calib_dataset "MetaMATH" @@ -248,4 +254,4 @@ Note that this conversion is not supported if `rslora` is used in combination wi booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems}, year={2024}, } -``` \ No newline at end of file +``` From 6d61dff7285ce1ed72840cdfce5b0899ab0ff64e Mon Sep 17 00:00:00 2001 From: Yao Matrix Date: Mon, 4 Aug 2025 07:48:35 -0700 Subject: [PATCH 3/4] Update examples/corda_finetuning/README.md Co-authored-by: Benjamin Bossan --- examples/corda_finetuning/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/corda_finetuning/README.md b/examples/corda_finetuning/README.md index 0f5488f2d0..6e63dc2ba4 100644 --- a/examples/corda_finetuning/README.md +++ b/examples/corda_finetuning/README.md @@ -150,7 +150,7 @@ corda_config = CordaConfig( #### Knowledge-preserved adaptation mode ```bash -export CUDA_VISIBLE_DEVICES=0 # force to use devcie 0 of CUDA GPU +export CUDA_VISIBLE_DEVICES=0 # force to use device 0 of CUDA GPU export ZE_AFFINITY_MASK=0 # force to use device 0 of Intel XPU python -u preprocess.py --model_id="meta-llama/Llama-2-7b-hf" \ From 8ef3665a221599c52e909878f9871178abb97731 Mon Sep 17 00:00:00 2001 From: Yao Matrix Date: Mon, 4 Aug 2025 07:48:42 -0700 Subject: [PATCH 4/4] Update examples/corda_finetuning/README.md Co-authored-by: Benjamin Bossan --- examples/corda_finetuning/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/corda_finetuning/README.md b/examples/corda_finetuning/README.md index 6e63dc2ba4..d39d2cc09e 100644 --- a/examples/corda_finetuning/README.md +++ b/examples/corda_finetuning/README.md @@ -168,7 +168,7 @@ Arguments: #### Instruction-previewed adaptation mode ```bash -export CUDA_VISIBLE_DEVICES=0 # force to use devcie 0 of CUDA GPU +export CUDA_VISIBLE_DEVICES=0 # force to use device 0 of CUDA GPU export ZE_AFFINITY_MASK=0 # force to use device 0 of Intel XPU python -u preprocess.py --model_id="meta-llama/Llama-2-7b-hf" \