Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One shot user flow tweaks #2195

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/sparseml/transformers/finetune/data/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from sparseml.transformers.utils.preprocessing_functions import (
PreprocessingFunctionRegistry,
)
from sparsezoo.utils.helpers import import_from_path
# from sparsezoo.utils.helpers import import_from_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the issue here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this was giving you issue might be a sparsezoo version issue



@TextGenerationDataset.register(name="custom", alias=["json", "csv"])
Expand Down
5 changes: 4 additions & 1 deletion src/sparseml/transformers/finetune/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ def one_shot(self, stage: Optional[str] = None):
"""
_LOGGER.info("*** One Shot ***")

tokenized_dataset = self.get_dataset_split("calibration")
if "labels" in tokenized_dataset.column_names:
tokenized_dataset = tokenized_dataset.remove_columns("labels")
Comment on lines +154 to +156
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the issue here? if this is relatively safe to keep, then leave a comment on why this specific column needs to be removed

calib_data = format_calibration_data(
tokenized_dataset=self.get_dataset_split("calibration"),
tokenized_dataset=tokenized_dataset,
num_calibration_samples=self._data_args.num_calibration_samples,
accelerator=self.trainer.accelerator,
)
Expand Down
12 changes: 8 additions & 4 deletions src/sparseml/transformers/integration_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,14 @@ def create_data_loader(
source_path = source_path or model.name_or_path
if tokenizer is None:
if sequence_length is None:
raise ValueError(
"Sequence length for the transformer model export missing. "
"Provide it manually using sequence_length argument"
)
if hasattr(model.config, "max_position_embeddings"):
sequence_length = model.config.max_position_embeddings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a _LOGGER.info here that you are using the default and what the value is

else:
raise ValueError(
"Sequence length for the transformer model export missing and "
"could not detect using model.config.max_position_embeddings"
"Provide it manually using sequence_length argument"
)
tokenizer = initialize_tokenizer(config.name_or_path, sequence_length, task)
data_args = _parse_data_args(data_args or {})

Expand Down
Loading