Apply Github PR #127 to all HF models
Browse files
modeling_internvl_chat.py
CHANGED
|
@@ -111,7 +111,7 @@ class InternVLChatModel(PreTrainedModel):
|
|
| 111 |
B, N, C = input_embeds.shape
|
| 112 |
input_embeds = input_embeds.reshape(B * N, C)
|
| 113 |
|
| 114 |
-
if torch.distributed.get_rank() == 0:
|
| 115 |
print(f'dynamic ViT batch size: {vit_batch_size}, images per sample: {vit_batch_size / B}, dynamic token length: {N}')
|
| 116 |
|
| 117 |
input_ids = input_ids.reshape(B * N)
|
|
|
|
| 111 |
B, N, C = input_embeds.shape
|
| 112 |
input_embeds = input_embeds.reshape(B * N, C)
|
| 113 |
|
| 114 |
+
if torch.distributed.is_initialized() and torch.distributed.get_rank() == 0:
|
| 115 |
print(f'dynamic ViT batch size: {vit_batch_size}, images per sample: {vit_batch_size / B}, dynamic token length: {N}')
|
| 116 |
|
| 117 |
input_ids = input_ids.reshape(B * N)
|