mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-12-15 11:20:35 +08:00
merge data part to the text stream
This commit is contained in:
@@ -19,7 +19,9 @@ class DataCollatorForVis2Seq:
|
||||
texts.append(text)
|
||||
images.append(example["images"][0])
|
||||
|
||||
batch = self.processor(text=texts, images=images, return_tensors="pt", padding=True)
|
||||
batch = self.processor(
|
||||
text=texts, images=images, return_tensors="pt", padding=True
|
||||
)
|
||||
|
||||
labels = batch["input_ids"].clone()
|
||||
if self.processor.tokenizer.pad_token_id is not None:
|
||||
@@ -27,3 +29,14 @@ class DataCollatorForVis2Seq:
|
||||
batch["labels"] = labels
|
||||
|
||||
return batch
|
||||
|
||||
|
||||
@dataclass
|
||||
class DataCollatorForMLLM:
|
||||
processor: AutoProcessor
|
||||
|
||||
def __call__(self, examples):
|
||||
print(examples[0].keys())
|
||||
print(examples[0]["input_ids"])
|
||||
batch = {}
|
||||
return batch
|
||||
|
||||
Reference in New Issue
Block a user