feat: Add support for HindiCausalLM (convaiinnovations/hindi-foundational-model-base)
Author: NandhaKishorM
Pull request: yes

# What does this PR do?

This PR integrates the Hindi Causal Language Model developed by ConvAI Innovations (`convaiinnovations/hindi-foundational-model-base`) into the Hugging Face `transformers` library.

This allows users to easily load and use this publicly available Hindi language model using the standard `transformers` API, such as `AutoModelForCausalLM.from_pretrained(...)` and `AutoTokenizer.from_pretrained(...)`.

The PR includes:
*   `HindiCausalLMConfig`: The configuration class.
*   `HindiCausalLMTokenizer`: A `PreTrainedTokenizer` wrapper for the SentencePiece model used.
*   `HindiCausalLMHeadModel`: The main modeling class, adapted to match the original checkpoint's architecture for weight compatibility.
*   Registrations within the library's `AutoClass` framework (`AutoConfig`, `AutoTokenizer`, `AutoModelForCausalLM`).
*   A documentation page for the model.

<!-- Remove if not applicable -->

Fixes # (issue) *(<- Add GitHub issue number here if this PR addresses one, otherwise remove this line)*

## Motivation and Context

The `convaiinnovations/hindi-foundational-model-base` checkpoint provides a valuable resource for Hindi NLP tasks. However, it was originally released with custom script code (`hindi_language_model.py` included in the repo) rather than standard `transformers` model classes. Loading these weights directly with standard `transformers` classes or even initial custom attempts resulted in errors due to architectural mismatches (layer names, prefixes, normalization types, activation functions, etc.).

This PR provides the necessary "shim" code, carefully adapted from the original script, to bridge this gap. The modeling code structure, layer names, and specific implementation details (like Post-LN and GELU activation) have been designed to **exactly match the original script's implementation**, ensuring that the publicly available weights can be loaded correctly.

## Key Implementation Details & Considerations

*   **Weight Compatibility & Architecture:** The modeling code (`modeling_hindi_causal_lm.py`) implements a **flattened structure** (no separate base model class), uses **Post-Layer Normalization**, employs a **hardcoded GELU activation** in the Feed-Forward Networks, and uses standard **learned positional embeddings**. This specific architecture is required to match the structure used when the original `model.safetensors` weights were saved, resolving state dictionary mismatches encountered during debugging.
*   **Configuration Discrepancy:** The `config.json` currently available on the Hub repository for `convaiinnovations/hindi-foundational-model-base` specifies parameters like `hidden_act: "silu"`, `normalization_layer: "rmsnorm"`, and `positional_encoding_type: "rope"`. These **do not match** the actual implemented architecture (GELU, LayerNorm, Absolute/Learned Embeddings) reflected in this PR's modeling code (which is necessary to load the weights). Users loading the model should be aware that the *implemented* structure takes precedence. Ideally, the `config.json` on the Hub should be updated by the model authors to accurately reflect the trained architecture. For now, loading scripts may benefit from locally overriding the config object after loading but before model instantiation, as was done during debugging.
*   **Tokenizer Class Name Discrepancy:** The `tokenizer_config.json` on the Hub specifies `"tokenizer_class": "SentencePieceTokenizerWrapper"`. This PR defines and registers the standard name `HindiCausalLMTokenizer`. For seamless `AutoTokenizer` loading without `trust_remote_code=True`, the `tokenizer_config.json` on the Hub should ideally be updated to use `"tokenizer_class": "HindiCausalLMTokenizer"`. Current loading via `AutoTokenizer` requires `trust_remote_code=True` or direct instantiation using `HindiCausalLMTokenizer.from_pretrained(...)`.

## Files Added/Modified

*   Added `src/transformers/models/hindi_causal_lm/configuration_hindi_causal_lm.py`
*   Added `src/transformers/models/hindi_causal_lm/modeling_hindi_causal_lm.py`
*   Added `src/transformers/models/hindi_causal_lm/tokenization_hindi_causal_lm.py`
*   Added `src/transformers/models/hindi_causal_lm/__init__.py`
*   Updated `src/transformers/models/auto/configuration_auto.py`
*   Updated `src/transformers/models/auto/modeling_auto.py`
*   Updated `src/transformers/models/auto/tokenization_auto.py`
*   Added `docs/source/en/model_doc/hindi_causal_lm.md`
*   *(Potentially)* Added `tests/models/hindi_causal_lm/test_modeling_hindi_causal_lm.py`
*   *(Potentially)* Added `tests/models/hindi_causal_lm/test_tokenization_hindi_causal_lm.py`

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request), Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link to it if that's the case. *(<- Add link if available)*
- [x] Did you make sure to update the documentation with your changes? Here are the [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation). *(Added documentation page)*
- [ ] Did you write any new necessary tests? *(<- **IMPORTANT**: Tests are required for merging. Please add modeling and tokenization tests.)*


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.

Models: @ArthurZucker
Tokenizers: @ArthurZucker
Community Integration: @Narsil (Optional)

Comments:
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the `Ready for review` button (at the bottom of the PR page). This will assign reviewers and trigger CI.

Hi @NandhaKishorM!

There are some issues with this PR:
- You're committing your `.history` directory with a lot of random files. We don't want that!
- It seems like style fixes were run on files outside of `src/transformers`, like `/benchmark` and `.circleci`. We don't want those changes either, it just pollutes the PR! Please try to revert those changes and stop adding the files in `.history`.
- Ideally, this PR would use `modular` style to make it easier to review. Please see the docs [here](https://huggingface.co/docs/transformers/en/modular_transformers). You can also look for other recent model PRs to see examples of modular in action.

> Hi @NandhaKishorM!
> 
> There are some issues with this PR:
> 
> * You're committing your `.history` directory with a lot of random files. We don't want that!
> * It seems like style fixes were run on files outside of `src/transformers`, like `/benchmark` and `.circleci`. We don't want those changes either, it just pollutes the PR! Please try to revert those changes and stop adding the files in `.history`.
> * Ideally, this PR would use `modular` style to make it easier to review. Please see the docs [here](https://huggingface.co/docs/transformers/en/modular_transformers). You can also look for other recent model PRs to see examples of modular in action.

sure. I am adding a new pr, can you help me on that https://github.com/huggingface/transformers/pull/37827 
it is giving  ImportError: cannot import name 'HindiCausalLMConfig' from 'transformers' (/root/project/src/transformers/__init__.py) when imported with transformers. Direct import no problem. 
trained model available at https://huggingface.co/convaiinnovations/hindi-causal-lm 
uses custom tokenizer and custom architecture

removed history and commited

the styles have been reverted