add token_perf_callback
State: open | Pull request: yes
Labels: name: stale

# What does this PR do ?

Add performence in token-level in `nemo/utils/exp_manager.py`, in which the manager will log `effective_tokens_per_second_per_device` and `total_tokens_per_second_per_device` for each training step.

**Collection**: [Note which collection this PR will affect]

# Changelog 
- Add specific line by line info of high level changes in this PR.

# Usage
* You can potentially add a usage example below

To open the performance output, setting `log_step_token_performance` in `config.yaml`. Note that the output maybe overhead with lightning logger, we suggest using `mlflow` to record the metrics.

```python
# Add a code snippet demonstrating how to use this 
```

# GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

# Before your PR is "Ready for review"
**Pre checks**:
- [ ] 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
- [ ] Bugfix
- [ ] 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)


<!-- pylint-output-strict-mode-false -->

beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base.

---

Your code was analyzed with PyLint. The following annotations have been identified:

```
************* Module nemo.utils.exp_manager
nemo/utils/exp_manager.py:445:0: C0301: Line too long (120/119) (line-too-long)
nemo/utils/exp_manager.py:470:0: C0301: Line too long (124/119) (line-too-long)
nemo/utils/exp_manager.py:474:0: C0301: Line too long (122/119) (line-too-long)
nemo/utils/exp_manager.py:479:0: C0301: Line too long (127/119) (line-too-long)
nemo/utils/exp_manager.py:493:0: C0301: Line too long (120/119) (line-too-long)
nemo/utils/exp_manager.py:500:0: C0301: Line too long (120/119) (line-too-long)
nemo/utils/exp_manager.py:501:0: C0301: Line too long (126/119) (line-too-long)
nemo/utils/exp_manager.py:503:0: C0301: Line too long (136/119) (line-too-long)
nemo/utils/exp_manager.py:505:0: C0301: Line too long (139/119) (line-too-long)
nemo/utils/exp_manager.py:515:0: C0301: Line too long (123/119) (line-too-long)
nemo/utils/exp_manager.py:516:0: C0301: Line too long (128/119) (line-too-long)
nemo/utils/exp_manager.py:517:0: C0301: Line too long (132/119) (line-too-long)
nemo/utils/exp_manager.py:518:0: C0301: Line too long (127/119) (line-too-long)
nemo/utils/exp_manager.py:606:0: C0301: Line too long (122/119) (line-too-long)
nemo/utils/exp_manager.py:698:0: C0301: Line too long (208/119) (line-too-long)
nemo/utils/exp_manager.py:699:0: C0301: Line too long (230/119) (line-too-long)
nemo/utils/exp_manager.py:701:0: C0301: Line too long (178/119) (line-too-long)
nemo/utils/exp_manager.py:738:0: C0301: Line too long (136/119) (line-too-long)
nemo/utils/exp_manager.py:873:0: C0301: Line too long (121/119) (line-too-long)
nemo/utils/exp_manager.py:881:0: C0301: Line too long (156/119) (line-too-long)
nemo/utils/exp_manager.py:928:0: C0301: Line too long (141/119) (line-too-long)
nemo/utils/exp_manager.py:936:0: C0301: Line too long (152/119) (line-too-long)
nemo/utils/exp_manager.py:1206:0: C0301: Line too long (142/119) (line-too-long)
nemo/utils/exp_manager.py:1230:0: C0301: Line too long (154/119) (line-too-long)
nemo/utils/exp_manager.py:1296:0: C0301: Line too long (120/119) (line-too-long)
nemo/utils/exp_manager.py:1315:0: C0301: Line too long (123/119) (line-too-long)
nemo/utils/exp_manager.py:1341:0: C0301: Line too long (121/119) (line-too-long)
nemo/utils/exp_manager.py:99:0: C0115: Missing class docstring (missing-class-docstring)
nemo/utils/exp_manager.py:114:0: C0115: Missing class docstring (missing-class-docstring)
nemo/utils/exp_manager.py:140:0: C0115: Missing class docstring (missing-class-docstring)
nemo/utils/exp_manager.py:149:0: C0115: Missing class docstring (missing-class-docstring)
nemo/utils/exp_manager.py:158:0: C0115: Missing class docstring (missing-class-docstring)
nemo/utils/exp_manager.py:169:0: C0115: Missing class docstring (missing-class-docstring)
nemo/utils/exp_manager.py:284:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:287:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:290:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:293:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:296:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:299:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:302:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:305:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:343:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:346:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:349:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:352:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:393:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:396:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:1222:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:1323:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:1342:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:1345:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/utils/exp_manager.py:1361:0: C0116: Missing function or method docstring (missing-function-docstring)

-----------------------------------
Your code has been rated at 9.21/10
```

---

Mitigation guide:

* Add sensible and useful docstrings to functions and methods
* For trivial methods like getter/setters, consider adding `# pylint: disable=C0116` inside the function itself
* To disable multiple functions/methods at once, put a `# pylint: disable=C0116` before the first and a `# pylint: enable=C0116` after the last.

By applying these rules, we reduce the occurance of this message in future.

Thank you for improving NeMo's documentation!

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.