Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-check-transformers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ jobs:
if: (success() || failure()) && steps.install.outcome == 'success'
run: |
pytest -v tests/llmcompressor/transformers/compression
- name: Run Finetune Tests
- name: Run Data Tests
if: (success() || failure()) && steps.install.outcome == 'success'
run: |
pytest -v tests/llmcompressor/transformers/finetune
pytest -v tests/llmcompressor/transformers/data
- name: Running GPTQ Tests
if: (success() || failure()) && steps.install.outcome == 'success'
run: |
Expand Down
32 changes: 0 additions & 32 deletions examples/trl_mixin/README.md

This file was deleted.

64 changes: 0 additions & 64 deletions examples/trl_mixin/ex_trl_constant.py

This file was deleted.

79 changes: 0 additions & 79 deletions examples/trl_mixin/ex_trl_distillation.py

This file was deleted.

22 changes: 0 additions & 22 deletions examples/trl_mixin/sft_trainer.py

This file was deleted.

8 changes: 2 additions & 6 deletions src/llmcompressor/args/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Input arguments for `oneshot`, `train`, `eval` entrypoints
# Input arguments for `oneshot` and `eval` entrypoints

Parsers in `llm-compressor` define the input arguments required for various entry points, including `oneshot`, `train`, and `eval`.

Expand Down Expand Up @@ -38,8 +38,4 @@ Handles model loading and saving. For example, `ModelArguments.model` can be a H
Manages data loading and preprocessing. The dataset argument can specify a Hugging Face dataset stub or a local dataset compatible with [`load_dataset`](https://github.com/huggingface/datasets/blob/3a4e74a9ace62ecd5c9cde7dcb6bcabd65cc7857/src/datasets/load.py#L1905). The preprocessing_func is a callable function that applies custom logic, such as formatting the data using a chat template.

## RecipeArguments
Defines the model recipe. A `recipe` consists of user-defined instructions for optimizing the model. Examples of recipes can be found in the `/examples` directory.

## TrainingArguments
Specifies training parameters based on Hugging Face's [TrainingArguments class](https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py). These parameters include settings like learning rate (`learning_rate`), and the optimizer to use (`optim`).

Defines the model recipe. A `recipe` consists of user-defined instructions for optimizing the model. Examples of recipes can be found in the `/examples` directory.
1 change: 0 additions & 1 deletion src/llmcompressor/args/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
from .dataset_arguments import DatasetArguments
from .model_arguments import ModelArguments
from .recipe_arguments import RecipeArguments
from .training_arguments import TrainingArguments
from .utils import parse_args
15 changes: 4 additions & 11 deletions src/llmcompressor/args/dataset_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@dataclass
class DVCDatasetArguments:
"""
Arguments for training using DVC
Arguments for calibration using DVC
"""

dvc_data_repository: str | None = field(
Expand All @@ -28,7 +28,7 @@ class DVCDatasetArguments:
@dataclass
class CustomDatasetArguments(DVCDatasetArguments):
"""
Arguments for training using custom datasets
Arguments for calibration using custom datasets
"""

dataset_path: str | None = field(
Expand Down Expand Up @@ -78,8 +78,8 @@ class CustomDatasetArguments(DVCDatasetArguments):
@dataclass
class DatasetArguments(CustomDatasetArguments):
"""
Arguments pertaining to what data we are going to input our model for
calibration, training
Arguments pertaining to what data we are going to use for
calibration

Using `HfArgumentParser` we can turn this class into argparse
arguments to be able to specify them on the command line
Expand Down Expand Up @@ -152,13 +152,6 @@ class DatasetArguments(CustomDatasetArguments):
"in the batch (which can be faster on GPU but will be slower on TPU)."
},
)
max_train_samples: int | None = field(
default=None,
metadata={
"help": "For debugging purposes or quicker training, truncate the number "
"of training examples to this value if set."
},
)
min_tokens_per_module: float | None = field(
default=None,
metadata={
Expand Down
44 changes: 0 additions & 44 deletions src/llmcompressor/args/training_arguments.py

This file was deleted.

27 changes: 6 additions & 21 deletions src/llmcompressor/args/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@
DatasetArguments,
ModelArguments,
RecipeArguments,
TrainingArguments,
)
from llmcompressor.transformers.utils.helpers import resolve_processor_from_model_args


def parse_args(
include_training_args: bool = False, **kwargs
**kwargs,
) -> tuple[
ModelArguments,
DatasetArguments,
RecipeArguments,
TrainingArguments | None,
RecipeArguments | None,
str | None,
]:
"""
Expand All @@ -38,31 +36,18 @@ def parse_args(
src/llmcompressor/args/dataset_args.py
* RecipeArguments in
src/llmcompressor/args/recipe_args.py
* TrainingArguments in
src/llmcompressor/args/training_args.py

ModelArguments, DatasetArguments, and RecipeArguments are used for both
`oneshot` and `train`. TrainingArguments is only used for `train`.
ModelArguments, DatasetArguments, and RecipeArguments used for
oneshot.

"""

# pop output_dir, used as an attr in TrainingArguments, where oneshot is not used
output_dir = kwargs.pop("output_dir", None)

parser_args = (ModelArguments, DatasetArguments, RecipeArguments)
if include_training_args:
parser_args += (TrainingArguments,)

parser = HfArgumentParser(parser_args)
parsed_args = parser.parse_dict(kwargs)

training_args = None
if include_training_args:
model_args, dataset_args, recipe_args, training_args = parsed_args
if output_dir is not None:
training_args.output_dir = output_dir
else:
model_args, dataset_args, recipe_args = parsed_args
model_args, dataset_args, recipe_args = parsed_args

if recipe_args.recipe_args is not None:
if not isinstance(recipe_args.recipe_args, dict):
Expand All @@ -83,4 +68,4 @@ def parse_args(
# silently assign tokenizer to processor
resolve_processor_from_model_args(model_args)

return model_args, dataset_args, recipe_args, training_args, output_dir
return model_args, dataset_args, recipe_args, output_dir
1 change: 0 additions & 1 deletion src/llmcompressor/entrypoints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"""

from .oneshot import Oneshot, oneshot
from .train import train
from .model_free import model_free_ptq
from .utils import post_process, pre_process
Loading
Loading