Add print statements
Browse files- modeling_cogvlm.py +5 -0
modeling_cogvlm.py
CHANGED
@@ -433,6 +433,9 @@ class CogVLMModel(CogVLMPreTrainedModel):
|
|
433 |
assert token_type_ids is not None, f"multi-modality requires `token_type_ids`!"
|
434 |
assert len(input_ids) == len(images), f"{len(input_ids)} {len(images)}"
|
435 |
inputs_embeds = self.embed_tokens(input_ids)
|
|
|
|
|
|
|
436 |
images_features = self.encode_images(images)
|
437 |
images_features = rearrange(images_features, 'b n d -> (b n) d')
|
438 |
images_features = images_features.to(dtype=inputs_embeds.dtype, device=inputs_embeds.device)
|
@@ -508,6 +511,8 @@ class CogVLMModel(CogVLMPreTrainedModel):
|
|
508 |
else:
|
509 |
position_ids = position_ids.view(-1, seq_length).long()
|
510 |
|
|
|
|
|
511 |
if inputs_embeds is None:
|
512 |
inputs_embeds = self.embed_tokens(input_ids)
|
513 |
# embed positions
|
|
|
433 |
assert token_type_ids is not None, f"multi-modality requires `token_type_ids`!"
|
434 |
assert len(input_ids) == len(images), f"{len(input_ids)} {len(images)}"
|
435 |
inputs_embeds = self.embed_tokens(input_ids)
|
436 |
+
|
437 |
+
print("First values of text embeddings:", inputs_embeds[0, :3, :3])
|
438 |
+
|
439 |
images_features = self.encode_images(images)
|
440 |
images_features = rearrange(images_features, 'b n d -> (b n) d')
|
441 |
images_features = images_features.to(dtype=inputs_embeds.dtype, device=inputs_embeds.device)
|
|
|
511 |
else:
|
512 |
position_ids = position_ids.view(-1, seq_length).long()
|
513 |
|
514 |
+
print("Input ids:", input_ids)
|
515 |
+
|
516 |
if inputs_embeds is None:
|
517 |
inputs_embeds = self.embed_tokens(input_ids)
|
518 |
# embed positions
|