This repository was archived by the owner on Jun 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
Transformers refactor #861
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f6c8006
Customed save checkpoints for transformers trainer classes; refactoring
natuan 725edc5
Add transformers training args for SparseML
natuan 9154696
Reuse removed unused columns
natuan 578ac02
Format training args
natuan e8d426d
Move distill teacher, recipe args
natuan 4625919
Simplify MLM, token classification code
natuan 15e8b3b
Fix recipe calls in mlm and token cls
natuan decf57f
Merge branch 'main' into transformers_refactor
natuan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -21,3 +21,4 @@ | |
|
|
||
| from .question_answering import * | ||
| from .trainer import * | ||
| from .training_args import * | ||
This file contains hidden or 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 hidden or 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 hidden or 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,57 @@ | ||
| # Copyright (c) 2021 - present / Neuralmagic, Inc. 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. | ||
|
|
||
| from dataclasses import dataclass, field | ||
| from typing import Optional | ||
|
|
||
| from transformers import TrainingArguments as HFTrainingArgs | ||
|
|
||
|
|
||
| __all__ = ["TrainingArguments"] | ||
|
|
||
|
|
||
| @dataclass | ||
| class TrainingArguments(HFTrainingArgs): | ||
| """ | ||
| Training arguments specific to SparseML Transformers workflow | ||
|
|
||
| :param best_model_after_epoch (`int`, *optional*, defaults to None): | ||
| The epoch after which best model will be saved; used in conjunction | ||
| with `load_best_model_at_end` and `metric_for_best_model` training | ||
| arguments | ||
| """ | ||
|
|
||
| distill_teacher: Optional[str] = field( | ||
| default=None, | ||
| metadata={ | ||
| "help": "Teacher model (a trained text classification model)", | ||
| }, | ||
| ) | ||
| best_model_after_epoch: int = field( | ||
| default=None, | ||
| metadata={"help": "Epoch after which best model will be saved."}, | ||
| ) | ||
| recipe: Optional[str] = field( | ||
| default=None, | ||
| metadata={ | ||
| "help": ( | ||
| "Path to a SparseML sparsification recipe, see " | ||
| "https://github.com/neuralmagic/sparseml for more information" | ||
| ), | ||
| }, | ||
| ) | ||
| recipe_args: Optional[str] = field( | ||
| default=None, | ||
| metadata={"help": "Recipe arguments to be overwritten"}, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.