Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ZX-ModelCloud committed Dec 20, 2024
1 parent 75c6673 commit 12c5f07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gptqmodel/models/definitions/ovis.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OvisGPTQ(BaseGPTQModel):

IGNORE_ID = -100

def preprocess_inputs(self, sample: Dict) -> Dict:
def preprocess_dataset(self, sample: Dict) -> Dict:
text_max_length = 832
conversations = copy.deepcopy(sample["conversations"])
images = [fetch_image(sample)]
Expand Down Expand Up @@ -59,7 +59,7 @@ def prepare_dataset(
batch_size: int = 1,
tokenizer=None, ):
calib_data = []
for batch in batched(calibration_dataset, batch_size, self.preprocess_inputs):
for batch in batched(calibration_dataset, batch_size, self.preprocess_dataset):
pixel_values, input_ids, labels = tuple([instance[key] for instance in batch]
for key in ("pixel_values", "input_ids", "labels"))
input_ids = torch.nn.utils.rnn.pad_sequence(
Expand Down
4 changes: 2 additions & 2 deletions gptqmodel/models/definitions/qwen2_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Qwen2VLGPTQ(BaseGPTQModel):
}
}

def preprocess_inputs(self, sample: Dict) -> Dict:
def preprocess_dataset(self, sample: Dict) -> Dict:
return sample

def prepare_dataset(
Expand All @@ -68,7 +68,7 @@ def prepare_dataset(
tokenizer=None, ):
processor = Qwen2VLProcessor.from_pretrained(self.model_id_or_path)
calib_data = []
for batch in batched(calibration_dataset, batch_size, process_func=self.preprocess_inputs):
for batch in batched(calibration_dataset, batch_size, process_func=self.preprocess_dataset):
text = processor.apply_chat_template(
batch, tokenize=False, add_generation_prompt=True
)
Expand Down

0 comments on commit 12c5f07

Please sign in to comment.