Fixed the bug in bucketing.
# What does this PR do ?

Fix a bug in the bucketing which is caused by this PR: https://github.com/NVIDIA/NeMo/pull/3485
Training ASR models with bucketing feature were affected by this.

# Changelog 
Changed the way the length of a dataset is retrieved to fix the bug in the bucketing.

**PR Type**:
- [ ] New Feature
- [X] Bugfix
- [ ] Documentation
