mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-24 06:42:52 +08:00
fix some
Former-commit-id: 15bbcdf8d3265f4154d3937719da5e54a5963355
This commit is contained in:
parent
cc6a6f698f
commit
994049380d
@ -281,7 +281,7 @@ class CpmOPlugin(BasePlugin):
|
||||
mm_inputs = self._get_mm_inputs(images, videos, processor)
|
||||
|
||||
pattern = "(<image>./</image>)"
|
||||
images, image_sizes, _ = mm_inputs["pixel_values"], mm_inputs["image_sizes"], mm_inputs["tgt_sizes"]
|
||||
images, image_sizes = mm_inputs["pixel_values"], mm_inputs["image_sizes"]
|
||||
|
||||
image_index = 0
|
||||
for index, message in enumerate(messages):
|
||||
@ -334,6 +334,7 @@ class CpmOPlugin(BasePlugin):
|
||||
new_images.append(images[idx : idx + valid_image_nums])
|
||||
idx += valid_image_nums
|
||||
images = new_images
|
||||
|
||||
image_inputs = image_processor(
|
||||
images, do_pad=True, max_slice_nums=image_processor.max_slice_nums, return_tensors="pt"
|
||||
)
|
||||
|
@ -100,7 +100,7 @@ def load_tokenizer(model_args: "ModelArguments") -> "TokenizerModule":
|
||||
processor = AutoProcessor.from_pretrained(model_args.model_name_or_path, **init_kwargs)
|
||||
patch_processor(processor, config, tokenizer, model_args)
|
||||
except Exception as e:
|
||||
logger.info(f"Processor was not found: {e}.")
|
||||
logger.debug(f"Processor was not found: {e}.")
|
||||
processor = None
|
||||
|
||||
# Avoid load tokenizer, see:
|
||||
|
@ -138,7 +138,6 @@ def patch_model(
|
||||
add_valuehead: bool,
|
||||
) -> None:
|
||||
gen_config = model.generation_config # check and fix generation config
|
||||
if gen_config is not None:
|
||||
if not gen_config.do_sample and (
|
||||
(gen_config.temperature is not None and gen_config.temperature != 1.0)
|
||||
or (gen_config.top_p is not None and gen_config.top_p != 1.0)
|
||||
|
@ -122,6 +122,7 @@ class CustomSeq2SeqTrainer(Seq2SeqTrainer):
|
||||
labels = inputs.pop("labels", None)
|
||||
else:
|
||||
labels = inputs.get("labels")
|
||||
|
||||
loss, generated_tokens, _ = super().prediction_step(
|
||||
model, inputs, prediction_loss_only=prediction_loss_only, ignore_keys=ignore_keys, **gen_kwargs
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user