Skip to content
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
3 changes: 2 additions & 1 deletion QEfficient/finetune/experimental/core/config_manager.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from dataclasses import asdict, dataclass, field, fields, is_dataclass
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from QEfficient.finetune.experimental.core.utils import constants

import yaml
from transformers.hf_argparser import HfArgumentParser
Expand Down Expand Up @@ -807,7 +808,7 @@ def get_model_config(self) -> Dict[str, Any]:
training_dtype = training_config.get("torch_dtype")
if training_dtype:
# Convert from training format (fp16/bf16) to model format (float16/bfloat16)
dtype_mapping = {"fp16": "float16", "bf16": "bfloat16"}
dtype_mapping = constants.DTYPE_MAPPING
model_config["torch_dtype"] = dtype_mapping.get(training_dtype, "auto")

return model_config
Expand Down
10 changes: 0 additions & 10 deletions QEfficient/finetune/experimental/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ def _resolve_auto_class(auto_class_name: str) -> Type:
)
return getattr(transformers, auto_class_name)

# def _build_quant_config(self) -> Optional[BitsAndBytesConfig]:
# if not self.model_kwargs.get("load_in_4bit"):
# return None
# return BitsAndBytesConfig(
# load_in_4bit=True,
# bnb_4bit_quant_type=self.model_kwargs.get("bnb_4bit_quant_type", "nf4"),
# bnb_4bit_compute_dtype=self.model_kwargs.get("bnb_4bit_compute_dtype", torch.float16),
# bnb_4bit_use_double_quant=self.model_kwargs.get("bnb_4bit_use_double_quant", True),
# )

def configure_model_kwargs(self) -> Dict[str, Any]:
"""Hook for subclasses to tweak HF `.from_pretrained` kwargs."""

Expand Down
1 change: 1 addition & 0 deletions QEfficient/finetune/experimental/core/utils/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DTYPE_MAPPING = {"fp16": "float16", "bf16": "bfloat16"}
Loading