-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
18,708 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"fp16": { | ||
"enabled": "auto", | ||
"loss_scale": 0, | ||
"loss_scale_window": 1000, | ||
"initial_scale_power": 16, | ||
"hysteresis": 2, | ||
"min_loss_scale": 1 | ||
}, | ||
|
||
"bf16": { | ||
"enabled": "auto" | ||
}, | ||
|
||
"optimizer": { | ||
"type": "AdamW", | ||
"params": { | ||
"lr": "auto", | ||
"betas": "auto", | ||
"eps": "auto", | ||
"weight_decay": "auto" | ||
} | ||
}, | ||
|
||
"zero_optimization": { | ||
"stage": 2, | ||
"allgather_partitions": true, | ||
"allgather_bucket_size": 2e8, | ||
"overlap_comm": true, | ||
"reduce_scatter": true, | ||
"reduce_bucket_size": 2e8, | ||
"contiguous_gradients": true | ||
}, | ||
|
||
"gradient_accumulation_steps": "auto", | ||
"gradient_clipping": "auto", | ||
"steps_per_print": 2000, | ||
"train_batch_size": "auto", | ||
"train_micro_batch_size_per_gpu": "auto", | ||
"wall_clock_breakdown": false | ||
} |
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,44 @@ | ||
{ | ||
"fp16": { | ||
"enabled": "auto", | ||
"loss_scale": 0, | ||
"loss_scale_window": 1000, | ||
"initial_scale_power": 16, | ||
"hysteresis": 2, | ||
"min_loss_scale": 1 | ||
}, | ||
|
||
"bf16": { | ||
"enabled": "auto" | ||
}, | ||
|
||
"optimizer": { | ||
"type": "AdamW", | ||
"params": { | ||
"lr": "auto", | ||
"betas": "auto", | ||
"eps": "auto", | ||
"weight_decay": "auto" | ||
} | ||
}, | ||
|
||
"zero_optimization": { | ||
"stage": 3, | ||
"overlap_comm": true, | ||
"contiguous_gradients": true, | ||
"sub_group_size": 1e9, | ||
"reduce_bucket_size": "auto", | ||
"stage3_prefetch_bucket_size": "auto", | ||
"stage3_param_persistence_threshold": "auto", | ||
"stage3_max_live_parameters": 1e9, | ||
"stage3_max_reuse_distance": 1e9, | ||
"stage3_gather_16bit_weights_on_model_save": true | ||
}, | ||
|
||
"gradient_accumulation_steps": "auto", | ||
"gradient_clipping": "auto", | ||
"steps_per_print": 2000, | ||
"train_batch_size": "auto", | ||
"train_micro_batch_size_per_gpu": "auto", | ||
"wall_clock_breakdown": false | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,55 @@ | ||
#!/usr/bin/env python | ||
# coding=utf-8 | ||
# Copyright 2023 Statistics and Machine Learning Research Group at HKUST. All rights reserved. | ||
"""A one-line summary of the module or program, terminated by a period. | ||
Leave one blank line. The rest of this docstring should contain an | ||
overall description of the module or program. Optionally, it may also | ||
contain a brief description of exported classes and functions and/or usage | ||
examples. | ||
Typical usage example: | ||
foo = ClassFoo() | ||
bar = foo.FunctionBar() | ||
""" | ||
import json | ||
import os | ||
import sys | ||
sys.path.remove(os.path.abspath(os.path.dirname(sys.argv[0]))) | ||
from transformers import HfArgumentParser | ||
|
||
from lmflow.datasets.dataset import Dataset | ||
from lmflow.pipeline.auto_pipeline import AutoPipeline | ||
from lmflow.models.auto_model import AutoModel | ||
from lmflow.args import ModelArguments, DatasetArguments, AutoArguments | ||
|
||
def write_json(data,path): | ||
with open(path, 'w') as f: | ||
json.dump(data, f, indent=4) | ||
|
||
pipeline_name = "inferencer" | ||
PipelineArguments = AutoArguments.get_pipeline_args_class(pipeline_name) | ||
|
||
parser = HfArgumentParser((ModelArguments, DatasetArguments, PipelineArguments)) | ||
model_args, data_args, pipeline_args = parser.parse_args_into_dataclasses() | ||
|
||
with open (pipeline_args.deepspeed, "r") as f: | ||
ds_config = json.load(f) | ||
|
||
model = AutoModel.get_model( | ||
model_args, | ||
tune_strategy='none', | ||
ds_config=ds_config, | ||
use_accelerator=pipeline_args.use_accelerator_for_evaluator | ||
) | ||
dataset = Dataset(data_args) | ||
|
||
inferencer = AutoPipeline.get_pipeline( | ||
pipeline_name=pipeline_name, | ||
model_args=model_args, | ||
data_args=data_args, | ||
pipeline_args=pipeline_args, | ||
) | ||
output_datasets, output_file = inferencer.inference(model=model, dataset=dataset, max_new_tokens=512, temperature=0.7) | ||
write_json(output_file, pipeline_args.output_result_path+'/results.json') |
Submodule lm-evaluation-harness
added at
e47e01
Oops, something went wrong.