-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial draft Signed-off-by: HuiyingLi <[email protected]> * refactor wip Signed-off-by: HuiyingLi <[email protected]> * refac v2 WIP Signed-off-by: HuiyingLi <[email protected]> * update address comments and add model dump Signed-off-by: HuiyingLi <[email protected]> * remove merge script * move driver script Signed-off-by: HuiyingLi <[email protected]> * format Signed-off-by: HuiyingLi <[email protected]> * format Signed-off-by: HuiyingLi <[email protected]> * Apply isort and black reformatting Signed-off-by: HuiyingLi <[email protected]> * update with nemo2 main Signed-off-by: HuiyingLi <[email protected]> * Apply isort and black reformatting Signed-off-by: HuiyingLi <[email protected]> * cleanup import Signed-off-by: HuiyingLi <[email protected]> * merge api v3 Signed-off-by: Huiying Li <[email protected]> * cleanup Signed-off-by: Huiying Li <[email protected]> * refac merge func to transform(by ChenCui) Signed-off-by: Huiying Li <[email protected]> * read base model from io instead of user input and bug fix Signed-off-by: Huiying Li <[email protected]> * Apply isort and black reformatting Signed-off-by: HuiyingLi <[email protected]> * add docstring Signed-off-by: Huiying Li <[email protected]> * refac Signed-off-by: Huiying Li <[email protected]> * add test Signed-off-by: Huiying Li <[email protected]> * Apply isort and black reformatting Signed-off-by: HuiyingLi <[email protected]> * add trainer to model Signed-off-by: Huiying Li <[email protected]> * add copyright Signed-off-by: Huiying Li <[email protected]> * clean up Signed-off-by: Huiying Li <[email protected]> --------- Signed-off-by: HuiyingLi <[email protected]> Signed-off-by: HuiyingLi <[email protected]> Signed-off-by: Huiying Li <[email protected]> Co-authored-by: HuiyingLi <[email protected]>
- Loading branch information
Showing
5 changed files
with
216 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import argparse | ||
from dataclasses import dataclass | ||
|
||
from nemo.collections import llm | ||
|
||
|
||
@dataclass | ||
class Llama3ConfigCI(llm.Llama3Config8B): | ||
seq_length: int = 2048 | ||
num_layers: int = 2 | ||
hidden_size: int = 768 | ||
ffn_hidden_size: int = 3072 | ||
num_attention_heads: int = 8 | ||
|
||
|
||
def get_args(): | ||
parser = argparse.ArgumentParser(description='Merge LoRA weights with base LLM') | ||
parser.add_argument('--lora_checkpoint_path', type=str, help="Path to finetuned LORA checkpoint") | ||
parser.add_argument('--output_path', type=str, help="Path to save merged checkpoint") | ||
return parser.parse_args() | ||
|
||
|
||
if __name__ == '__main__': | ||
args = get_args() | ||
|
||
llm.peft.merge_lora( | ||
lora_checkpoint_path=args.lora_checkpoint_path, | ||
output_path=args.output_path, | ||
) |