Add deep EBMs#66
Open
nbereux wants to merge 32 commits into
Open
Conversation
Update h gradient
nbereux
commented
May 14, 2026
| def named_parameters(self) -> dict[str, np.ndarray]: | ||
| return { | ||
| name: tensor.detach().cpu().numpy() | ||
| for name, tensor in self.energy.state_dict().items() |
Contributor
Author
There was a problem hiding this comment.
Maybe use self.energy.named_parameters()
Contributor
Author
There was a problem hiding this comment.
Retire le du dossier
Contributor
Author
There was a problem hiding this comment.
Retire le du dossier
Contributor
Author
There was a problem hiding this comment.
Retire le du dossier
Contributor
Author
There was a problem hiding this comment.
Retire le du dossier
Comment on lines
+193
to
+207
| @abstractmethod | ||
| def sample_visibles( | ||
| self, chains: dict[str, Tensor], beta: float = 1.0 | ||
| ) -> dict[str, Tensor]: | ||
| """Sample the visible layer. | ||
|
|
||
| Args: | ||
| chains (dict[str, Tensor]): The parallel chains used for sampling. | ||
| beta (float, optional): The inverse temperature. Defaults to 1.0. | ||
|
|
||
| Returns: | ||
| dict[str, Tensor]: The updated chains with sampled hidden states. | ||
| """ | ||
| ... | ||
|
|
Contributor
Author
There was a problem hiding this comment.
à mettre dans la classe RBM
Comment on lines
151
to
175
| @staticmethod | ||
| @abstractmethod | ||
| def init_parameters( | ||
| num_hiddens: int, | ||
| num_visibles: int, | ||
| dataset: RBMDataset, | ||
| device: torch.device | str, | ||
| dtype: torch.dtype, | ||
| var_init: float = 1e-4, | ||
| ) -> EBM: | ||
| """Initialize the parameters of the RBM. | ||
|
|
||
| Args: | ||
| num_hiddens (int): Number of hidden units. | ||
| num_visibles (int): The number of visible units. | ||
| dataset (RBMDataset): Training dataset. | ||
| device (torch.device): PyTorch device for the parameters. | ||
| dtype (torch.dtype): PyTorch dtype for the parameters. | ||
| var_init (float, optional): Variance of the weight matrix. Defaults to 1e-4. | ||
|
|
||
| Notes: | ||
| - The number of visible units is induced from the dataset provided. | ||
| - Hidden biases are set to 0. | ||
| - Visible biases are set to the frequencies of the dataset. | ||
| - The weight matrix is initialized with a Gaussian distribution of variance `var_init`. | ||
| """ | ||
| ... |
Contributor
Author
There was a problem hiding this comment.
à mettre dans la classe RBM
Comment on lines
+218
to
+219
| kernel (Optional[Kernel]): The Markov kernel to use for sampling. Defaults to None. | ||
| kernel_params (Optional[dict]): The parameters for the Markov kernel. Defaults to None. |
Contributor
Author
There was a problem hiding this comment.
à mettre directement dans la doc de sample_state dans les deep EBMs
Contributor
Author
|
dans |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.