Skip to content

Conversation

@0x-avi
Copy link
Contributor

@0x-avi 0x-avi commented Oct 11, 2024

What does this PR do?

fixes #9350
currently doing

text_ids = torch.zeros(batch_size, prompt_embeds.shape[1], 3).to(device=device, dtype=dtype)

results in warning:

09/03/2024 10:45:35 - INFO - __main__ - ***** Running training *****
09/03/2024 10:45:35 - INFO - __main__ -   Num examples = 26
09/03/2024 10:45:35 - INFO - __main__ -   Num batches each epoch = 26
09/03/2024 10:45:35 - INFO - __main__ -   Num Epochs = 154
09/03/2024 10:45:35 - INFO - __main__ -   Instantaneous batch size per device = 1
09/03/2024 10:45:35 - INFO - __main__ -   Total train batch size (w. parallel, distributed & accumulation) = 2
09/03/2024 10:45:35 - INFO - __main__ -   Gradient Accumulation steps = 2
09/03/2024 10:45:35 - INFO - __main__ -   Total optimization steps = 2000
Steps:   0%|                                                                                                                                                                            | 0/2000 [00:00<?, ?it/s]
Passing `txt_ids` 3d torch.Tensor is deprecated.Please remove the batch dimension and pass it as a 2d torch Tensor
Steps:   0%|                                                                                                                                                       | 0/2000 [00:01<?, ?it/s, loss=0.522, lr=5e-5]
Passing `txt_ids` 3d torch.Tensor is deprecated.Please remove the batch dimension and pass it as a 2d torch Tensor

removed batch_size and the next line that reassigns txt_ids from :

text_ids = torch.zeros(batch_size, prompt_embeds.shape[1], 3).to(device=device, dtype=dtype)

to

text_ids = torch.zeros(prompt_embeds.shape[1], 3).to(device=device, dtype=dtype) 

Copy link
Contributor

@a-r-r-o-w a-r-r-o-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@a-r-r-o-w a-r-r-o-w requested a review from yiyixuxu October 11, 2024 20:46
@0x-avi
Copy link
Contributor Author

0x-avi commented Oct 13, 2024

@yiyixuxu i think you missed this PR

@yiyixuxu
Copy link
Collaborator

@0x-74 i did! thank you!

@yiyixuxu
Copy link
Collaborator

@0x-74 can you run make style?

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@0x-avi 0x-avi requested a review from a-r-r-o-w October 15, 2024 08:41
@a-r-r-o-w a-r-r-o-w merged commit dccf39f into huggingface:main Oct 15, 2024
8 checks passed
sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
* fixed issue #9350, Tensor is deprecated

* ran make style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing txt_ids 3d torch.Tensor is deprecated.Please remove the batch dimension and pass it as a 2d torch Tensor

4 participants