Hiddens modules bugfixes
jenkins jenkins jenkins jenkins This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days. I need to get back to this.

On Wed, Mar 20, 2024 at 6:44 PM github-actions[bot] <
***@***.***> wrote:

> This PR is stale because it has been open for 14 days with no activity.
> Remove stale label or comment or update or this will be closed in 7 days.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/NVIDIA/NeMo/pull/8466#issuecomment-2011033150>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AADQCBXYXVSTXGBJXW6C7DDYZI3QHAVCNFSM6AAAAABDSCNISGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJRGAZTGMJVGA>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
 This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days. This PR was closed because it has been inactive for 7 days since being marked as stale.
# What does this PR do ?

Hiddens modules such as `a_mim` and `vae` output a number of keys, including `{"z", "z_mean"}` for example. The current implementation supports specifying a single key to be used as the encoder output, and generally in configs this is set to `z` for those variational losses. This is not what you expect at inference time though. In that case you want the latent space to be a point estimate (the mean) rather than a noisy sampling. This PR accomplishes this by adding an optional second encoder output key to be used at inference time, and if it is not set then the current key is used for both. Inference/training is determined by checking the pytorch module property `self.training`. 

**Collection**: nlp

# Changelog 
- Add specific line by line info of high level changes in this PR.

# Usage
* You can potentially add a usage example below

```python
# Add a code snippet demonstrating how to use this 
```

# Jenkins CI
To run Jenkins, a NeMo User with write access must comment `jenkins` on the PR.

# Before your PR is "Ready for review"
**Pre checks**:
- [x] Make sure you read and followed [Contributor guidelines](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md)
- [ ] Did you write any new necessary tests?
- [ ] Did you add or update any necessary documentation?
- [ ] Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
  - [ ] Reviewer: Does the PR have correct import guards for all optional libraries?
  
**PR Type**:
- [x] New Feature
- [x] Bugfix
- [x] Documentation

If you haven't finished some of the above items you can still open "Draft" PR.


## Who can review?

Anyone in the community is free to review the PR once the checks have passed. 
[Contributor guidelines](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md) contains specific people who can review PRs to various areas.

# Additional Information
* Related to # (issue)
