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

Add FreebaseQA to tasks and gauntlet #1115

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
support quantization_config in om_conf for not prequantized models
  • Loading branch information
moeiniamir committed May 7, 2024
commit a912099959c4a5c013ff015404b8dbfc7f0e5f5c
12 changes: 9 additions & 3 deletions llmfoundry/models/hf/hf_causal_lm.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
from typing import TYPE_CHECKING, Any, Dict, Mapping

from composer.models.huggingface import peft_installed
from composer.utils import dist, get_device
from composer.utils import dist
from omegaconf import DictConfig
from transformers import (AutoConfig, AutoModelForCausalLM, PretrainedConfig,
PreTrainedModel, PreTrainedTokenizerBase)
@@ -203,15 +203,21 @@ def _autoset_attn_implementation_monkeypatch(
if resolved_init_device == 'cpu':
if om_model_config.pretrained:
device_map = None
if 'quantization_config' in config.to_dict() and config.quantization_config['quant_method'] == "gptq":
device_map = get_device(None)._device
pre_quantized = config.to_dict().get('quantization_config', None)
if pre_quantized and pre_quantized['quant_method'] == "gptq":
device_map = 'auto'
quantization_config = om_model_config.get('quantization_config', None)
if quantization_config:
from transformers.quantizers.auto import AutoQuantizationConfig
quantization_config = AutoQuantizationConfig.from_dict(quantization_config)
model = AutoModelForCausalLM.from_pretrained(
pretrained_model_name_or_path,
trust_remote_code=trust_remote_code,
use_auth_token=use_auth_token,
load_in_8bit=load_in_8bit,
config=config,
device_map=device_map,
quantization_config=quantization_config,
)
else:
model = AutoModelForCausalLM.from_config(