-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[Tests] fix sharding tests #8764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
new_model = new_model.to(torch_device) | ||
|
||
torch.manual_seed(0) | ||
_, inputs_dict = self.prepare_init_args_and_inputs_for_common() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise the generator
(which is required as an input when using the ConsistencyDecoderVAE
will be consumed and its states will change in-place. So, we need to re-initialize here.
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. |
del self.weight | ||
self.W = nn.Parameter(torch.randn(embedding_size) * scale, requires_grad=False) | ||
|
||
self.weight = self.W | ||
del self.W |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary to mitigate the "tied weight tensors" error from safetensors
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayakpaul curious about codes here, may i ask for more details if possible? ;)
if seed is not None: | ||
generator.manual_seed(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was likely a mistake because if a seed
is provided you would want to use that to do: generator.manual_seed(seed)
and not generator.manual_seed(0)
using a fixed seed
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing @sayakpaul !
What does this PR do?
So the following tests pass:
Some comments in line.