pratikshourabh commited on
Commit
82df588
Β·
verified Β·
1 Parent(s): d26d948

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +2038 -38
README.md CHANGED
@@ -1,30 +1,36 @@
1
- # indAI
2
-
3
- > A custom-trained open-source language model for text generation and conversational AI.
4
-
5
- [![Hugging Face](https://img.shields.io/badge/Hugging%20Face-indAI-yellow?logo=huggingface)](https://huggingface.co/pratikshourabh/indAI)
6
- [![Python](https://img.shields.io/badge/Python-3.10%2B-blue?logo=python)](https://www.python.org/)
7
- [![PyTorch](https://img.shields.io/badge/PyTorch-2.x-ee4c2c?logo=pytorch)](https://pytorch.org/)
8
- [![Transformers](https://img.shields.io/badge/Transformers-Hugging%20Face-orange?logo=huggingface)](https://huggingface.co/docs/transformers)
 
 
 
 
 
 
 
9
 
 
 
 
 
10
  ---
11
 
12
- ## 🧠 About
 
 
13
 
14
- **indAI** is a custom-trained causal language model developed by **Pratik Shourabh**.
15
 
16
- The project focuses on experimenting with:
17
 
18
- - Custom language-model training
19
- - Large-scale dataset processing
20
- - Text generation
21
- - Conversational AI
22
- - Fine-tuning
23
- - Natural Language Processing
24
- - GPU-based model training
25
- - Model evaluation and optimization
26
 
27
- indAI is an actively developed experimental AI project.
28
 
29
  ---
30
 
@@ -33,34 +39,2028 @@ indAI is an actively developed experimental AI project.
33
  - πŸ€– Causal language generation
34
  - πŸ’¬ Conversational prompting
35
  - ⚑ GPU-accelerated inference
36
- - 🧩 Hugging Face Transformers compatible
37
  - πŸ“¦ SafeTensors model weights
38
- - πŸ”§ Custom training pipeline
39
- - πŸ“š Custom dataset training
40
- - ☁️ Can be used with Kaggle GPUs
41
- - 🐍 Python API
42
- - πŸ”Œ Easy integration into AI applications
 
 
 
43
 
44
  ---
45
 
46
- ## πŸ“¦ Model
47
 
48
- | Property | Value |
49
  |---|---|
50
- | **Model** | `pratikshourabh/indAI` |
51
- | **Architecture** | Causal Language Model |
52
- | **Framework** | PyTorch |
53
- | **Transformers** | Hugging Face Transformers |
54
-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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ library_name: transformers
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - text-generation
8
+ - causal-language-model
9
+ - conversational-ai
10
+ - language-model
11
+ - custom-trained
12
+ - pytorch
13
+ - transformers
14
+ - safetensors
15
+ - generative-ai
16
 
17
+ # Add these only after confirming them:
18
+ # license: apache-2.0
19
+ # base_model:
20
+ # - YOUR_BASE_MODEL
21
  ---
22
 
23
+ # 🧠 indAI
24
+
25
+ > A custom-trained causal language model for text generation and conversational AI.
26
 
27
+ **indAI** is a custom-trained language model developed by **Pratik Shourabh** using the PyTorch and Hugging Face Transformers ecosystem.
28
 
29
+ The project explores custom dataset processing, language-model training, text generation, conversational AI, evaluation, and GPU-based inference.
30
 
31
+ **Model ID:** `pratikshourabh/indAI`
 
 
 
 
 
 
 
32
 
33
+ > **Status:** Experimental / Active Development
34
 
35
  ---
36
 
 
39
  - πŸ€– Causal language generation
40
  - πŸ’¬ Conversational prompting
41
  - ⚑ GPU-accelerated inference
42
+ - 🧠 Custom training pipeline
43
  - πŸ“¦ SafeTensors model weights
44
+ - πŸ€— Hugging Face Transformers compatibility
45
+ - 🐍 Python support
46
+ - ☁️ Kaggle GPU support
47
+ - 🌐 REST API integration
48
+ - 🟨 JavaScript / Node.js integration
49
+ - 🐘 PHP integration
50
+ - πŸ“± Mobile-app integration through an API
51
+ - πŸ”§ Configurable generation parameters
52
 
53
  ---
54
 
55
+ # πŸ“¦ Model Information
56
 
57
+ | Property | Details |
58
  |---|---|
59
+ | Model | `pratikshourabh/indAI` |
60
+ | Task | Text Generation |
61
+ | Architecture | Causal Language Model |
62
+ | Framework | PyTorch |
63
+ | Library | Hugging Face Transformers |
64
+ | Weights | SafeTensors |
65
+ | Author | Pratik Shourabh |
66
+ | Status | Experimental |
67
+
68
+ > Replace/add the exact base model, parameter count, context length, license, dataset size, and training configuration when those values are confirmed.
69
+
70
+ ---
71
+
72
+ # 🧠 How indAI Works
73
+
74
+ At a high level:
75
+
76
+ ```text
77
+ User Prompt
78
+ β”‚
79
+ β–Ό
80
+ Tokenizer
81
+ β”‚
82
+ β–Ό
83
+ Token IDs
84
+ β”‚
85
+ β–Ό
86
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
87
+ β”‚ indAI β”‚
88
+ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
89
+ β”‚
90
+ β–Ό
91
+ Next-token prediction
92
+ β”‚
93
+ β–Ό
94
+ Generated tokens
95
+ β”‚
96
+ β–Ό
97
+ Tokenizer
98
+ β”‚
99
+ β–Ό
100
+ Text Response
101
+ ```
102
+
103
+ ---
104
+
105
+ # πŸ“ Repository Structure
106
+
107
+ The Hugging Face repository contains the model configuration, weights, tokenizer, and generation configuration.
108
+
109
+ Typical structure:
110
+
111
+ ```text
112
+ indAI/
113
+ β”‚
114
+ β”œβ”€β”€ config.json
115
+ β”œβ”€β”€ generation_config.json
116
+ β”œβ”€β”€ model.safetensors
117
+ β”œβ”€β”€ tokenizer.json
118
+ β”œβ”€β”€ tokenizer_config.json
119
+ └── training_state.pt
120
+ ```
121
+
122
+ ### `config.json`
123
+
124
+ Defines the model architecture and configuration.
125
+
126
+ ### `model.safetensors`
127
+
128
+ Contains the trained model weights.
129
+
130
+ ### `tokenizer.json`
131
+
132
+ Contains tokenizer vocabulary and tokenization configuration.
133
+
134
+ ### `tokenizer_config.json`
135
+
136
+ Contains tokenizer-specific settings.
137
+
138
+ ### `generation_config.json`
139
+
140
+ Contains generation-related defaults.
141
+
142
+ ### `training_state.pt`
143
+
144
+ Contains training-related state information.
145
+
146
+ ---
147
+
148
+ # πŸ’» Requirements
149
+
150
+ Recommended:
151
+
152
+ ```text
153
+ Python 3.10+
154
+ PyTorch
155
+ Transformers
156
+ Accelerate
157
+ SentencePiece
158
+ Hugging Face Hub
159
+ ```
160
+
161
+ For GPU inference:
162
+
163
+ ```text
164
+ NVIDIA GPU
165
+ CUDA-compatible PyTorch
166
+ ```
167
+
168
+ ---
169
+
170
+ # πŸ“₯ Installation
171
+
172
+ Install the required packages:
173
+
174
+ ```bash
175
+ pip install -U torch transformers accelerate sentencepiece huggingface_hub
176
+ ```
177
+
178
+ Verify PyTorch:
179
+
180
+ ```bash
181
+ python -c "import torch; print(torch.__version__)"
182
+ ```
183
+
184
+ Check CUDA:
185
+
186
+ ```bash
187
+ python -c "import torch; print(torch.cuda.is_available())"
188
+ ```
189
 
190
  ---
191
 
192
  # πŸš€ Quick Start
193
 
194
+ The simplest way to load indAI:
195
+
196
+ ```python
197
+ import torch
198
+
199
+ from transformers import (
200
+ AutoTokenizer,
201
+ AutoModelForCausalLM
202
+ )
203
+
204
+ MODEL_ID = "pratikshourabh/indAI"
205
+
206
+ tokenizer = AutoTokenizer.from_pretrained(
207
+ MODEL_ID
208
+ )
209
+
210
+ model = AutoModelForCausalLM.from_pretrained(
211
+ MODEL_ID,
212
+ torch_dtype="auto",
213
+ device_map="auto"
214
+ )
215
+
216
+ model.eval()
217
+
218
+ print("indAI loaded successfully!")
219
+ ```
220
+
221
+ ---
222
+
223
+ # πŸ“ Generate Text
224
+
225
+ ```python
226
+ import torch
227
+
228
+ from transformers import (
229
+ AutoTokenizer,
230
+ AutoModelForCausalLM
231
+ )
232
+
233
+ MODEL_ID = "pratikshourabh/indAI"
234
+
235
+ tokenizer = AutoTokenizer.from_pretrained(
236
+ MODEL_ID
237
+ )
238
+
239
+ model = AutoModelForCausalLM.from_pretrained(
240
+ MODEL_ID,
241
+ torch_dtype="auto",
242
+ device_map="auto"
243
+ )
244
+
245
+ model.eval()
246
+
247
+ prompt = "Hello, how are you?"
248
+
249
+ inputs = tokenizer(
250
+ prompt,
251
+ return_tensors="pt"
252
+ ).to(model.device)
253
+
254
+ with torch.no_grad():
255
+
256
+ outputs = model.generate(
257
+ **inputs,
258
+ max_new_tokens=150,
259
+ temperature=0.7,
260
+ top_p=0.9,
261
+ do_sample=True,
262
+ repetition_penalty=1.1
263
+ )
264
+
265
+ generated_tokens = outputs[
266
+ 0
267
+ ][
268
+ inputs["input_ids"].shape[-1]:
269
+ ]
270
+
271
+ response = tokenizer.decode(
272
+ generated_tokens,
273
+ skip_special_tokens=True
274
+ )
275
+
276
+ print(response)
277
+ ```
278
+
279
+ ---
280
+
281
+ # πŸ’¬ Interactive Python Chat
282
+
283
+ Create `chat.py`:
284
+
285
+ ```python
286
+ import torch
287
+
288
+ from transformers import (
289
+ AutoTokenizer,
290
+ AutoModelForCausalLM
291
+ )
292
+
293
+ MODEL_ID = "pratikshourabh/indAI"
294
+
295
+ print("Loading indAI...")
296
+
297
+ tokenizer = AutoTokenizer.from_pretrained(
298
+ MODEL_ID
299
+ )
300
+
301
+ if tokenizer.pad_token is None:
302
+ tokenizer.pad_token = tokenizer.eos_token
303
+
304
+ model = AutoModelForCausalLM.from_pretrained(
305
+ MODEL_ID,
306
+ torch_dtype="auto",
307
+ device_map="auto"
308
+ )
309
+
310
+ model.eval()
311
+
312
+ print()
313
+ print("======================================")
314
+ print(" indAI Chat")
315
+ print("======================================")
316
+ print("Type 'exit' to quit.")
317
+ print()
318
+
319
+ while True:
320
+
321
+ question = input("You: ")
322
+
323
+ if question.strip().lower() in {
324
+ "exit",
325
+ "quit",
326
+ "bye"
327
+ }:
328
+ print("Goodbye!")
329
+ break
330
+
331
+ if not question.strip():
332
+ continue
333
+
334
+ inputs = tokenizer(
335
+ question,
336
+ return_tensors="pt"
337
+ ).to(model.device)
338
+
339
+ with torch.no_grad():
340
+
341
+ outputs = model.generate(
342
+ **inputs,
343
+ max_new_tokens=200,
344
+ temperature=0.7,
345
+ top_p=0.9,
346
+ do_sample=True,
347
+ repetition_penalty=1.1,
348
+ pad_token_id=tokenizer.eos_token_id
349
+ )
350
+
351
+ generated_tokens = outputs[
352
+ 0
353
+ ][
354
+ inputs["input_ids"].shape[-1]:
355
+ ]
356
+
357
+ response = tokenizer.decode(
358
+ generated_tokens,
359
+ skip_special_tokens=True
360
+ )
361
+
362
+ print()
363
+ print("indAI:", response.strip())
364
+ print()
365
+ ```
366
+
367
+ Run:
368
+
369
+ ```bash
370
+ python chat.py
371
+ ```
372
+
373
+ ---
374
+
375
+ # ☁️ Kaggle
376
+
377
+ indAI can be run in a Kaggle GPU notebook.
378
+
379
+ ## Enable GPU
380
+
381
+ ```text
382
+ Kaggle
383
+ ↓
384
+ Notebook
385
+ ↓
386
+ Settings
387
+ ↓
388
+ Accelerator
389
+ ↓
390
+ GPU
391
+ ```
392
+
393
+ Check the GPU:
394
+
395
+ ```python
396
+ import torch
397
+
398
+ print("CUDA:", torch.cuda.is_available())
399
+
400
+ if torch.cuda.is_available():
401
+ print("GPU:", torch.cuda.get_device_name(0))
402
+ ```
403
+
404
+ Install dependencies:
405
+
406
+ ```python
407
+ !pip install -q -U transformers accelerate huggingface_hub sentencepiece
408
+ ```
409
+
410
+ Load the model:
411
+
412
+ ```python
413
+ from transformers import (
414
+ AutoTokenizer,
415
+ AutoModelForCausalLM
416
+ )
417
+
418
+ MODEL_ID = "pratikshourabh/indAI"
419
+
420
+ tokenizer = AutoTokenizer.from_pretrained(
421
+ MODEL_ID
422
+ )
423
+
424
+ model = AutoModelForCausalLM.from_pretrained(
425
+ MODEL_ID,
426
+ torch_dtype="auto",
427
+ device_map="auto"
428
+ )
429
+
430
+ model.eval()
431
+ ```
432
+
433
+ ---
434
+
435
+ # πŸ” Private Hugging Face Repository
436
+
437
+ If the repository is private, authenticate using a Hugging Face access token with appropriate read permissions.
438
+
439
+ ## Environment variable
440
+
441
+ ```bash
442
+ export HF_TOKEN="YOUR_HUGGING_FACE_TOKEN"
443
+ ```
444
+
445
+ Python:
446
+
447
+ ```python
448
+ import os
449
+
450
+ HF_TOKEN = os.environ["HF_TOKEN"]
451
+ ```
452
+
453
+ Load:
454
+
455
+ ```python
456
+ tokenizer = AutoTokenizer.from_pretrained(
457
+ "pratikshourabh/indAI",
458
+ token=HF_TOKEN
459
+ )
460
+
461
+ model = AutoModelForCausalLM.from_pretrained(
462
+ "pratikshourabh/indAI",
463
+ token=HF_TOKEN,
464
+ torch_dtype="auto",
465
+ device_map="auto"
466
+ )
467
+ ```
468
+
469
+ ### Kaggle Secrets
470
+
471
+ For Kaggle, store the token using:
472
+
473
+ ```text
474
+ Kaggle
475
+ ↓
476
+ Add-ons
477
+ ↓
478
+ Secrets
479
+ ↓
480
+ HF_TOKEN
481
+ ```
482
+
483
+ Then:
484
+
485
+ ```python
486
+ import os
487
+
488
+ HF_TOKEN = os.environ["HF_TOKEN"]
489
+ ```
490
+
491
+ **Never commit a Hugging Face token to source control.**
492
+
493
+ ---
494
+
495
+ # πŸ§ͺ Kaggle One-Cell Chat
496
+
497
+ ```python
498
+ !pip install -q -U transformers accelerate huggingface_hub sentencepiece
499
+
500
+ import os
501
+ import torch
502
+
503
+ from transformers import (
504
+ AutoTokenizer,
505
+ AutoModelForCausalLM
506
+ )
507
+
508
+ MODEL_ID = "pratikshourabh/indAI"
509
+
510
+ HF_TOKEN = os.environ.get("HF_TOKEN")
511
+
512
+ if not HF_TOKEN:
513
+ raise RuntimeError(
514
+ "HF_TOKEN is missing. Add it to Kaggle Secrets."
515
+ )
516
+
517
+ print("Loading tokenizer...")
518
+
519
+ tokenizer = AutoTokenizer.from_pretrained(
520
+ MODEL_ID,
521
+ token=HF_TOKEN
522
+ )
523
+
524
+ if tokenizer.pad_token is None:
525
+ tokenizer.pad_token = tokenizer.eos_token
526
+
527
+ print("Loading model...")
528
+
529
+ model = AutoModelForCausalLM.from_pretrained(
530
+ MODEL_ID,
531
+ token=HF_TOKEN,
532
+ torch_dtype="auto",
533
+ device_map="auto"
534
+ )
535
+
536
+ model.eval()
537
+
538
+ print()
539
+ print("====================================")
540
+ print(" indAI is ready")
541
+ print("====================================")
542
+ print("Type 'exit' to stop.")
543
+ print()
544
+
545
+ while True:
546
+
547
+ question = input("You: ")
548
+
549
+ if question.strip().lower() in {
550
+ "exit",
551
+ "quit",
552
+ "bye"
553
+ }:
554
+ print("Goodbye!")
555
+ break
556
+
557
+ if not question.strip():
558
+ continue
559
+
560
+ inputs = tokenizer(
561
+ question,
562
+ return_tensors="pt"
563
+ ).to(model.device)
564
+
565
+ with torch.no_grad():
566
+
567
+ outputs = model.generate(
568
+ **inputs,
569
+ max_new_tokens=200,
570
+ temperature=0.7,
571
+ top_p=0.9,
572
+ do_sample=True,
573
+ repetition_penalty=1.1,
574
+ pad_token_id=tokenizer.eos_token_id
575
+ )
576
+
577
+ generated_tokens = outputs[
578
+ 0
579
+ ][
580
+ inputs["input_ids"].shape[-1]:
581
+ ]
582
+
583
+ answer = tokenizer.decode(
584
+ generated_tokens,
585
+ skip_special_tokens=True
586
+ )
587
+
588
+ print()
589
+ print("indAI:", answer.strip())
590
+ print()
591
+ ```
592
+
593
+ ---
594
+
595
+ # ⚑ GPU Inference
596
+
597
+ Check GPU availability:
598
+
599
+ ```python
600
+ import torch
601
+
602
+ print("CUDA available:", torch.cuda.is_available())
603
+
604
+ if torch.cuda.is_available():
605
+
606
+ print("GPU:", torch.cuda.get_device_name(0))
607
+
608
+ print("CUDA:", torch.version.cuda)
609
+ ```
610
+
611
+ Recommended loading:
612
+
613
+ ```python
614
+ model = AutoModelForCausalLM.from_pretrained(
615
+ "pratikshourabh/indAI",
616
+ torch_dtype="auto",
617
+ device_map="auto"
618
+ )
619
+ ```
620
+
621
+ `device_map="auto"` allows the Transformers/Accelerate stack to place model components automatically on available hardware.
622
+
623
+ ---
624
+
625
+ # πŸ–₯️ CPU Inference
626
+
627
+ The model can also be loaded on CPU:
628
+
629
+ ```python
630
+ model = AutoModelForCausalLM.from_pretrained(
631
+ "pratikshourabh/indAI",
632
+ torch_dtype="auto"
633
+ )
634
+
635
+ model.to("cpu")
636
+ ```
637
+
638
+ CPU inference may be considerably slower than GPU inference.
639
+
640
+ ---
641
+
642
+ # πŸŽ›οΈ Generation Parameters
643
+
644
+ ## `max_new_tokens`
645
+
646
+ Controls the maximum number of newly generated tokens.
647
+
648
+ Short:
649
+
650
+ ```python
651
+ max_new_tokens=50
652
+ ```
653
+
654
+ Normal:
655
+
656
+ ```python
657
+ max_new_tokens=200
658
+ ```
659
+
660
+ Long:
661
+
662
+ ```python
663
+ max_new_tokens=500
664
+ ```
665
+
666
+ ---
667
+
668
+ ## `temperature`
669
+
670
+ Controls sampling randomness.
671
+
672
+ More deterministic:
673
+
674
+ ```python
675
+ temperature=0.2
676
+ ```
677
+
678
+ Balanced:
679
+
680
+ ```python
681
+ temperature=0.7
682
+ ```
683
+
684
+ More diverse:
685
+
686
+ ```python
687
+ temperature=0.9
688
+ ```
689
+
690
+ ---
691
+
692
+ ## `top_p`
693
+
694
+ Controls nucleus sampling:
695
+
696
+ ```python
697
+ top_p=0.9
698
+ ```
699
+
700
+ ---
701
+
702
+ ## `top_k`
703
+
704
+ Optional vocabulary filtering:
705
+
706
+ ```python
707
+ top_k=50
708
+ ```
709
+
710
+ ---
711
+
712
+ ## `repetition_penalty`
713
+
714
+ Can help reduce repeated output:
715
+
716
+ ```python
717
+ repetition_penalty=1.1
718
+ ```
719
+
720
+ ---
721
+
722
+ ## Recommended Starting Configuration
723
+
724
+ ```python
725
+ generation_config = {
726
+ "max_new_tokens": 200,
727
+ "temperature": 0.7,
728
+ "top_p": 0.9,
729
+ "do_sample": True,
730
+ "repetition_penalty": 1.1
731
+ }
732
+ ```
733
+
734
+ These are starting points and should be evaluated for the specific model.
735
+
736
+ ---
737
+
738
+ # 🐍 Python Application Integration
739
+
740
+ ```python
741
+ import torch
742
+
743
+ from transformers import (
744
+ AutoTokenizer,
745
+ AutoModelForCausalLM
746
+ )
747
+
748
+
749
+ class IndAI:
750
+
751
+ def __init__(
752
+ self,
753
+ model_id="pratikshourabh/indAI"
754
+ ):
755
+
756
+ self.model_id = model_id
757
+
758
+ self.tokenizer = (
759
+ AutoTokenizer.from_pretrained(
760
+ model_id
761
+ )
762
+ )
763
+
764
+ self.model = (
765
+ AutoModelForCausalLM.from_pretrained(
766
+ model_id,
767
+ torch_dtype="auto",
768
+ device_map="auto"
769
+ )
770
+ )
771
+
772
+ self.model.eval()
773
+
774
+ def generate(
775
+ self,
776
+ prompt,
777
+ max_new_tokens=200,
778
+ temperature=0.7,
779
+ top_p=0.9
780
+ ):
781
+
782
+ inputs = self.tokenizer(
783
+ prompt,
784
+ return_tensors="pt"
785
+ ).to(self.model.device)
786
+
787
+ with torch.no_grad():
788
+
789
+ outputs = self.model.generate(
790
+ **inputs,
791
+ max_new_tokens=max_new_tokens,
792
+ temperature=temperature,
793
+ top_p=top_p,
794
+ do_sample=True,
795
+ repetition_penalty=1.1
796
+ )
797
+
798
+ generated_tokens = outputs[
799
+ 0
800
+ ][
801
+ inputs["input_ids"].shape[-1]:
802
+ ]
803
+
804
+ return self.tokenizer.decode(
805
+ generated_tokens,
806
+ skip_special_tokens=True
807
+ )
808
+
809
+
810
+ ai = IndAI()
811
+
812
+ response = ai.generate(
813
+ "Hello, how are you?"
814
+ )
815
+
816
+ print(response)
817
+ ```
818
+
819
+ ---
820
+
821
+ # 🌐 FastAPI REST API
822
+
823
+ For web and mobile applications, run indAI behind an API.
824
+
825
+ Install:
826
 
827
  ```bash
828
+ pip install fastapi uvicorn
829
+ ```
830
+
831
+ Create `app.py`:
832
+
833
+ ```python
834
+ import torch
835
+
836
+ from fastapi import FastAPI
837
+ from pydantic import BaseModel
838
+
839
+ from transformers import (
840
+ AutoTokenizer,
841
+ AutoModelForCausalLM
842
+ )
843
+
844
+
845
+ MODEL_ID = "pratikshourabh/indAI"
846
+
847
+
848
+ tokenizer = AutoTokenizer.from_pretrained(
849
+ MODEL_ID
850
+ )
851
+
852
+ if tokenizer.pad_token is None:
853
+ tokenizer.pad_token = tokenizer.eos_token
854
+
855
+
856
+ model = AutoModelForCausalLM.from_pretrained(
857
+ MODEL_ID,
858
+ torch_dtype="auto",
859
+ device_map="auto"
860
+ )
861
+
862
+ model.eval()
863
+
864
+
865
+ app = FastAPI(
866
+ title="indAI API",
867
+ description="REST API powered by indAI",
868
+ version="1.0.0"
869
+ )
870
+
871
+
872
+ class ChatRequest(BaseModel):
873
+
874
+ message: str
875
+
876
+ max_new_tokens: int = 200
877
+
878
+ temperature: float = 0.7
879
+
880
+ top_p: float = 0.9
881
+
882
+
883
+ class ChatResponse(BaseModel):
884
+
885
+ model: str
886
+
887
+ response: str
888
+
889
+
890
+ @app.get("/")
891
+ def root():
892
+
893
+ return {
894
+ "name": "indAI",
895
+ "model": MODEL_ID,
896
+ "status": "online"
897
+ }
898
+
899
+
900
+ @app.get("/health")
901
+ def health():
902
+
903
+ return {
904
+ "status": "healthy"
905
+ }
906
+
907
+
908
+ @app.post(
909
+ "/chat",
910
+ response_model=ChatResponse
911
+ )
912
+ def chat(request: ChatRequest):
913
+
914
+ inputs = tokenizer(
915
+ request.message,
916
+ return_tensors="pt"
917
+ ).to(model.device)
918
+
919
+ with torch.no_grad():
920
+
921
+ outputs = model.generate(
922
+ **inputs,
923
+ max_new_tokens=request.max_new_tokens,
924
+ temperature=request.temperature,
925
+ top_p=request.top_p,
926
+ do_sample=True,
927
+ repetition_penalty=1.1,
928
+ pad_token_id=tokenizer.eos_token_id
929
+ )
930
+
931
+ generated_tokens = outputs[
932
+ 0
933
+ ][
934
+ inputs["input_ids"].shape[-1]:
935
+ ]
936
+
937
+ response = tokenizer.decode(
938
+ generated_tokens,
939
+ skip_special_tokens=True
940
+ )
941
+
942
+ return {
943
+ "model": MODEL_ID,
944
+ "response": response.strip()
945
+ }
946
+ ```
947
+
948
+ Run:
949
+
950
+ ```bash
951
+ uvicorn app:app --host 0.0.0.0 --port 8000
952
+ ```
953
+
954
+ API:
955
+
956
+ ```text
957
+ http://localhost:8000
958
+ ```
959
+
960
+ Swagger:
961
+
962
+ ```text
963
+ http://localhost:8000/docs
964
+ ```
965
+
966
+ ---
967
+
968
+ # πŸ§ͺ cURL
969
+
970
+ ## Health
971
+
972
+ ```bash
973
+ curl http://localhost:8000/health
974
+ ```
975
+
976
+ Response:
977
+
978
+ ```json
979
+ {
980
+ "status": "healthy"
981
+ }
982
+ ```
983
+
984
+ ## Chat
985
+
986
+ ```bash
987
+ curl -X POST \
988
+ http://localhost:8000/chat \
989
+ -H "Content-Type: application/json" \
990
+ -d '{
991
+ "message": "Hello, how are you?",
992
+ "max_new_tokens": 200,
993
+ "temperature": 0.7,
994
+ "top_p": 0.9
995
+ }'
996
+ ```
997
+
998
+ Response:
999
+
1000
+ ```json
1001
+ {
1002
+ "model": "pratikshourabh/indAI",
1003
+ "response": "..."
1004
+ }
1005
+ ```
1006
+
1007
+ ---
1008
+
1009
+ # 🐍 Python REST Client
1010
+
1011
+ Install:
1012
+
1013
+ ```bash
1014
+ pip install requests
1015
+ ```
1016
+
1017
+ Use:
1018
+
1019
+ ```python
1020
+ import requests
1021
+
1022
+ response = requests.post(
1023
+ "http://localhost:8000/chat",
1024
+ json={
1025
+ "message": "Hello, how are you?",
1026
+ "max_new_tokens": 200,
1027
+ "temperature": 0.7,
1028
+ "top_p": 0.9
1029
+ },
1030
+ timeout=120
1031
+ )
1032
+
1033
+ response.raise_for_status()
1034
+
1035
+ data = response.json()
1036
+
1037
+ print(data["response"])
1038
+ ```
1039
+
1040
+ ---
1041
+
1042
+ # 🟨 JavaScript / Node.js
1043
+
1044
+ Node.js can call the API using `fetch`.
1045
+
1046
+ ```javascript
1047
+ const response = await fetch(
1048
+ "http://localhost:8000/chat",
1049
+ {
1050
+ method: "POST",
1051
+
1052
+ headers: {
1053
+ "Content-Type": "application/json"
1054
+ },
1055
+
1056
+ body: JSON.stringify({
1057
+ message: "Hello, how are you?",
1058
+ max_new_tokens: 200,
1059
+ temperature: 0.7,
1060
+ top_p: 0.9
1061
+ })
1062
+ }
1063
+ );
1064
+
1065
+ if (!response.ok) {
1066
+ throw new Error(
1067
+ `HTTP ${response.status}`
1068
+ );
1069
+ }
1070
+
1071
+ const data = await response.json();
1072
+
1073
+ console.log(data.response);
1074
+ ```
1075
+
1076
+ ---
1077
+
1078
+ # 🟨 JavaScript Chat Function
1079
+
1080
+ ```javascript
1081
+ async function chat(message) {
1082
+
1083
+ const response = await fetch(
1084
+ "http://localhost:8000/chat",
1085
+ {
1086
+ method: "POST",
1087
+
1088
+ headers: {
1089
+ "Content-Type": "application/json"
1090
+ },
1091
+
1092
+ body: JSON.stringify({
1093
+ message,
1094
+ max_new_tokens: 200,
1095
+ temperature: 0.7,
1096
+ top_p: 0.9
1097
+ })
1098
+ }
1099
+ );
1100
+
1101
+ if (!response.ok) {
1102
+ throw new Error(
1103
+ `HTTP ${response.status}`
1104
+ );
1105
+ }
1106
+
1107
+ const data = await response.json();
1108
+
1109
+ return data.response;
1110
+ }
1111
+
1112
+
1113
+ const answer = await chat(
1114
+ "What can you help me with?"
1115
+ );
1116
+
1117
+ console.log(answer);
1118
+ ```
1119
+
1120
+ ---
1121
+
1122
+ # 🌐 Browser JavaScript
1123
+
1124
+ If your API is configured with CORS, a browser application can call it directly.
1125
+
1126
+ ```html
1127
+ <!DOCTYPE html>
1128
+
1129
+ <html>
1130
+
1131
+ <head>
1132
+
1133
+ <meta charset="UTF-8">
1134
+
1135
+ <title>indAI Chat</title>
1136
+
1137
+ </head>
1138
+
1139
+ <body>
1140
+
1141
+ <h1>indAI</h1>
1142
+
1143
+ <input
1144
+ id="message"
1145
+ type="text"
1146
+ placeholder="Type your message..."
1147
+ >
1148
+
1149
+ <button onclick="sendMessage()">
1150
+ Send
1151
+ </button>
1152
+
1153
+ <pre id="response"></pre>
1154
+
1155
+
1156
+ <script>
1157
+
1158
+ async function sendMessage() {
1159
+
1160
+ const message =
1161
+ document.getElementById(
1162
+ "message"
1163
+ ).value;
1164
+
1165
+
1166
+ const response =
1167
+ await fetch(
1168
+ "http://localhost:8000/chat",
1169
+ {
1170
+ method: "POST",
1171
+
1172
+ headers: {
1173
+ "Content-Type":
1174
+ "application/json"
1175
+ },
1176
+
1177
+ body: JSON.stringify({
1178
+ message,
1179
+ max_new_tokens: 200,
1180
+ temperature: 0.7,
1181
+ top_p: 0.9
1182
+ })
1183
+ }
1184
+ );
1185
+
1186
+
1187
+ const data =
1188
+ await response.json();
1189
+
1190
+
1191
+ document.getElementById(
1192
+ "response"
1193
+ ).textContent =
1194
+ data.response;
1195
+ }
1196
+
1197
+ </script>
1198
+
1199
+ </body>
1200
+
1201
+ </html>
1202
+ ```
1203
+
1204
+ ---
1205
+
1206
+ # 🐘 PHP
1207
+
1208
+ PHP applications can consume the REST API using cURL.
1209
+
1210
+ ```php
1211
+ <?php
1212
+
1213
+ $url = "http://localhost:8000/chat";
1214
+
1215
+ $data = [
1216
+ "message" => "Hello, how are you?",
1217
+ "max_new_tokens" => 200,
1218
+ "temperature" => 0.7,
1219
+ "top_p" => 0.9
1220
+ ];
1221
+
1222
+ $ch = curl_init($url);
1223
+
1224
+ curl_setopt_array($ch, [
1225
+ CURLOPT_POST => true,
1226
+
1227
+ CURLOPT_RETURNTRANSFER => true,
1228
+
1229
+ CURLOPT_HTTPHEADER => [
1230
+ "Content-Type: application/json"
1231
+ ],
1232
+
1233
+ CURLOPT_POSTFIELDS =>
1234
+ json_encode($data),
1235
+
1236
+ CURLOPT_TIMEOUT => 120
1237
+ ]);
1238
+
1239
+ $response = curl_exec($ch);
1240
+
1241
+ if ($response === false) {
1242
+
1243
+ throw new Exception(
1244
+ curl_error($ch)
1245
+ );
1246
+ }
1247
+
1248
+ curl_close($ch);
1249
+
1250
+ $result = json_decode(
1251
+ $response,
1252
+ true
1253
+ );
1254
+
1255
+ echo $result["response"] ?? "";
1256
+ ```
1257
+
1258
+ ---
1259
+
1260
+ # 🐘 PHP Helper Function
1261
+
1262
+ ```php
1263
+ <?php
1264
+
1265
+ function indAIChat(
1266
+ string $message
1267
+ ): string {
1268
+
1269
+ $url =
1270
+ "http://localhost:8000/chat";
1271
+
1272
+ $payload = [
1273
+ "message" => $message,
1274
+ "max_new_tokens" => 200,
1275
+ "temperature" => 0.7,
1276
+ "top_p" => 0.9
1277
+ ];
1278
+
1279
+ $ch = curl_init($url);
1280
+
1281
+ curl_setopt_array($ch, [
1282
+ CURLOPT_POST => true,
1283
+
1284
+ CURLOPT_RETURNTRANSFER => true,
1285
+
1286
+ CURLOPT_HTTPHEADER => [
1287
+ "Content-Type: application/json"
1288
+ ],
1289
+
1290
+ CURLOPT_POSTFIELDS =>
1291
+ json_encode($payload),
1292
+
1293
+ CURLOPT_TIMEOUT => 120
1294
+ ]);
1295
+
1296
+ $response =
1297
+ curl_exec($ch);
1298
+
1299
+ if ($response === false) {
1300
+
1301
+ throw new Exception(
1302
+ curl_error($ch)
1303
+ );
1304
+ }
1305
+
1306
+ curl_close($ch);
1307
+
1308
+ $data = json_decode(
1309
+ $response,
1310
+ true
1311
+ );
1312
+
1313
+ return $data["response"] ?? "";
1314
+ }
1315
+
1316
+
1317
+ echo indAIChat(
1318
+ "Hello, how are you?"
1319
+ );
1320
+ ```
1321
+
1322
+ ---
1323
+
1324
+ # πŸŸͺ Java
1325
+
1326
+ ```java
1327
+ import java.net.URI;
1328
+ import java.net.http.HttpClient;
1329
+ import java.net.http.HttpRequest;
1330
+ import java.net.http.HttpResponse;
1331
+
1332
+ public class IndAI {
1333
+
1334
+ public static void main(String[] args)
1335
+ throws Exception {
1336
+
1337
+ String json = """
1338
+ {
1339
+ "message": "Hello, how are you?",
1340
+ "max_new_tokens": 200,
1341
+ "temperature": 0.7,
1342
+ "top_p": 0.9
1343
+ }
1344
+ """;
1345
+
1346
+ HttpClient client =
1347
+ HttpClient.newHttpClient();
1348
+
1349
+ HttpRequest request =
1350
+ HttpRequest.newBuilder()
1351
+ .uri(
1352
+ URI.create(
1353
+ "http://localhost:8000/chat"
1354
+ )
1355
+ )
1356
+ .header(
1357
+ "Content-Type",
1358
+ "application/json"
1359
+ )
1360
+ .POST(
1361
+ HttpRequest.BodyPublishers
1362
+ .ofString(json)
1363
+ )
1364
+ .build();
1365
+
1366
+ HttpResponse<String> response =
1367
+ client.send(
1368
+ request,
1369
+ HttpResponse.BodyHandlers
1370
+ .ofString()
1371
+ );
1372
+
1373
+ System.out.println(
1374
+ response.body()
1375
+ );
1376
+ }
1377
+ }
1378
+ ```
1379
+
1380
+ ---
1381
+
1382
+ # πŸ”΅ Flutter
1383
+
1384
+ For mobile applications, keep the model on a server and call the API.
1385
+
1386
+ Add:
1387
+
1388
+ ```yaml
1389
+ dependencies:
1390
+ http: ^1.0.0
1391
+ ```
1392
+
1393
+ Dart:
1394
+
1395
+ ```dart
1396
+ import 'dart:convert';
1397
+
1398
+ import 'package:http/http.dart' as http;
1399
+
1400
+
1401
+ Future<String> indAIChat(
1402
+ String message
1403
+ ) async {
1404
+
1405
+ final response = await http.post(
1406
+
1407
+ Uri.parse(
1408
+ 'https://api.example.com/chat'
1409
+ ),
1410
+
1411
+ headers: {
1412
+ 'Content-Type':
1413
+ 'application/json',
1414
+ },
1415
+
1416
+ body: jsonEncode({
1417
+
1418
+ 'message': message,
1419
+
1420
+ 'max_new_tokens': 200,
1421
+
1422
+ 'temperature': 0.7,
1423
+
1424
+ 'top_p': 0.9,
1425
+
1426
+ }),
1427
+ );
1428
+
1429
+
1430
+ if (response.statusCode != 200) {
1431
+
1432
+ throw Exception(
1433
+ 'Request failed: '
1434
+ '${response.statusCode}'
1435
+ );
1436
+
1437
+ }
1438
+
1439
+
1440
+ final data =
1441
+ jsonDecode(response.body);
1442
+
1443
+
1444
+ return data['response'];
1445
+ }
1446
+ ```
1447
+
1448
+ ---
1449
+
1450
+ # πŸ“± Recommended Mobile Architecture
1451
+
1452
+ ```text
1453
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1454
+ β”‚ Flutter / iOS β”‚
1455
+ β”‚ Android App β”‚
1456
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1457
+ β”‚
1458
+ β”‚ HTTPS
1459
+ β–Ό
1460
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1461
+ β”‚ Backend API β”‚
1462
+ β”‚ FastAPI / Node / PHP β”‚
1463
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1464
+ β”‚
1465
+ β–Ό
1466
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1467
+ β”‚ Inference Server β”‚
1468
+ β”‚ Transformers β”‚
1469
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1470
+ β”‚
1471
+ β–Ό
1472
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1473
+ β”‚ indAI β”‚
1474
+ β”‚ GPU β”‚
1475
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1476
+ ```
1477
+
1478
+ ---
1479
+
1480
+ # πŸ—οΈ Production Architecture
1481
+
1482
+ A scalable deployment can look like:
1483
+
1484
+ ```text
1485
+ Users
1486
+ β”‚
1487
+ β–Ό
1488
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1489
+ β”‚ CDN / β”‚
1490
+ β”‚ Load Bal. β”‚
1491
+ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
1492
+ β”‚
1493
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1494
+ β”‚ β”‚
1495
+ β–Ό β–Ό
1496
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1497
+ β”‚ API Server β”‚ β”‚ API Server β”‚
1498
+ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
1499
+ β”‚ β”‚
1500
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1501
+ β”‚
1502
+ β–Ό
1503
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1504
+ β”‚ Inference β”‚
1505
+ β”‚ Server β”‚
1506
+ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
1507
+ β”‚
1508
+ β–Ό
1509
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
1510
+ β”‚ indAI β”‚
1511
+ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”˜
1512
+ β”‚
1513
+ β–Ό
1514
+ GPU
1515
+ ```
1516
+
1517
+ ---
1518
+
1519
+ # πŸ” Production API Security
1520
+
1521
+ Do not expose an unauthenticated inference server to the public internet.
1522
+
1523
+ Production deployments should consider:
1524
+
1525
+ - API authentication
1526
+ - Rate limiting
1527
+ - Request validation
1528
+ - Maximum prompt length
1529
+ - Maximum output length
1530
+ - HTTPS
1531
+ - Logging
1532
+ - Monitoring
1533
+ - Abuse protection
1534
+ - Secret management
1535
+
1536
+ Example request:
1537
+
1538
+ ```http
1539
+ POST /chat
1540
+ Authorization: Bearer YOUR_API_KEY
1541
+ Content-Type: application/json
1542
+ ```
1543
+
1544
+ Never expose server-side credentials in browser JavaScript.
1545
+
1546
+ ---
1547
+
1548
+ # 🌊 Streaming
1549
+
1550
+ For real-time chat applications, streaming responses can improve perceived latency.
1551
+
1552
+ Recommended options:
1553
+
1554
+ - Server-Sent Events (SSE)
1555
+ - WebSockets
1556
+ - HTTP streaming
1557
+
1558
+ Architecture:
1559
+
1560
+ ```text
1561
+ User
1562
+ β”‚
1563
+ β–Ό
1564
+ Frontend
1565
+ β”‚
1566
+ β–Ό
1567
+ Streaming API
1568
+ β”‚
1569
+ β–Ό
1570
+ Inference Server
1571
+ β”‚
1572
+ β–Ό
1573
+ indAI
1574
+ ```
1575
+
1576
+ Streaming requires additional implementation in the API layer and generation loop.
1577
+
1578
+ ---
1579
+
1580
+ # πŸ§ͺ Example Prompts
1581
+
1582
+ Try:
1583
+
1584
+ ```text
1585
+ Hello, how are you?
1586
+
1587
+ Tell me a short story.
1588
+
1589
+ Explain artificial intelligence.
1590
+
1591
+ Explain machine learning in simple terms.
1592
+
1593
+ Write a Python function to calculate factorial.
1594
+
1595
+ Write a short paragraph about technology.
1596
+
1597
+ Summarize this text.
1598
+
1599
+ What can you help me with?
1600
+ ```
1601
+
1602
+ Model output may vary between generations when sampling is enabled.
1603
+
1604
+ ---
1605
+
1606
+ # πŸ“Š Evaluation
1607
+
1608
+ A proper model evaluation should include:
1609
+
1610
+ ## Generation Quality
1611
+
1612
+ - Coherence
1613
+ - Relevance
1614
+ - Grammar
1615
+ - Completeness
1616
+
1617
+ ## Instruction Following
1618
+
1619
+ - Direct instructions
1620
+ - Multi-step instructions
1621
+ - Formatting requirements
1622
+ - Question answering
1623
+
1624
+ ## Generalization
1625
+
1626
+ - Unseen prompts
1627
+ - Unseen examples
1628
+ - Out-of-distribution inputs
1629
+
1630
+ ## Robustness
1631
+
1632
+ - Short prompts
1633
+ - Long prompts
1634
+ - Ambiguous prompts
1635
+ - Repeated prompts
1636
+
1637
+ ## Performance
1638
+
1639
+ - Latency
1640
+ - Tokens per second
1641
+ - Peak VRAM
1642
+ - CPU memory
1643
+
1644
+ ---
1645
+
1646
+ # πŸ“ˆ Benchmark Template
1647
+
1648
+ Record actual benchmark results rather than estimated values.
1649
+
1650
+ | Metric | Value |
1651
+ |---|---:|
1652
+ | Model Version | TBD |
1653
+ | Hardware | TBD |
1654
+ | Precision | TBD |
1655
+ | Input Tokens | TBD |
1656
+ | Output Tokens | TBD |
1657
+ | Batch Size | TBD |
1658
+ | Latency | TBD |
1659
+ | Tokens / Second | TBD |
1660
+ | Peak VRAM | TBD |
1661
+
1662
+ ---
1663
+
1664
+ # πŸ‹οΈ Training Pipeline
1665
+
1666
+ The model development pipeline follows:
1667
+
1668
+ ```text
1669
+ Raw Data
1670
+ β”‚
1671
+ β–Ό
1672
+ Data Loading
1673
+ β”‚
1674
+ β–Ό
1675
+ Cleaning
1676
+ β”‚
1677
+ β–Ό
1678
+ Normalization
1679
+ β”‚
1680
+ β–Ό
1681
+ Deduplication
1682
+ β”‚
1683
+ β–Ό
1684
+ Validation
1685
+ β”‚
1686
+ β–Ό
1687
+ Tokenization
1688
+ β”‚
1689
+ β–Ό
1690
+ Train / Validation Split
1691
+ β”‚
1692
+ β–Ό
1693
+ Training
1694
+ β”‚
1695
+ β–Ό
1696
+ Evaluation
1697
+ β”‚
1698
+ β–Ό
1699
+ Checkpoint
1700
+ β”‚
1701
+ β–Ό
1702
+ Final Model
1703
+ ```
1704
+
1705
+ ---
1706
+
1707
+ # πŸ“š Dataset
1708
+
1709
+ The model was developed using a custom dataset and processing pipeline.
1710
+
1711
+ The pipeline can include:
1712
+
1713
+ - Multiple input files
1714
+ - Data cleaning
1715
+ - Normalization
1716
+ - Duplicate removal
1717
+ - Training/validation splitting
1718
+ - Tokenization
1719
+ - Sequence preparation
1720
+
1721
+ For future releases, dataset documentation should include:
1722
+
1723
+ ```text
1724
+ Raw records:
1725
+ Clean records:
1726
+ Unique records:
1727
+ Training examples:
1728
+ Validation examples:
1729
+ Training tokens:
1730
+ Validation tokens:
1731
+ ```
1732
+
1733
+ > Raw record count and final training-example count are different metrics and should be reported separately.
1734
+
1735
+ ---
1736
+
1737
+ # πŸ“‰ Training Metrics
1738
+
1739
+ Recommended metrics to record:
1740
+
1741
+ ```text
1742
+ Training Loss
1743
+ Validation Loss
1744
+ Learning Rate
1745
+ Epoch
1746
+ Training Steps
1747
+ Evaluation Loss
1748
+ ```
1749
+
1750
+ Example:
1751
+
1752
+ ```text
1753
+ Epoch 1
1754
+ Train Loss: TBD
1755
+ Validation Loss: TBD
1756
+
1757
+ Epoch 2
1758
+ Train Loss: TBD
1759
+ Validation Loss: TBD
1760
+ ```
1761
+
1762
+ ---
1763
+
1764
+ # ⚠️ Limitations
1765
+
1766
+ indAI is experimental and may:
1767
+
1768
+ - Generate incorrect information
1769
+ - Hallucinate facts
1770
+ - Produce repetitive responses
1771
+ - Produce incomplete responses
1772
+ - Misinterpret prompts
1773
+ - Fail on complex reasoning
1774
+ - Perform poorly outside its training distribution
1775
+ - Produce inconsistent responses
1776
+
1777
+ Generated output should be independently verified where accuracy matters.
1778
+
1779
+ ---
1780
+
1781
+ # πŸ”’ Responsible Use
1782
+
1783
+ Do not use indAI as the sole decision-maker for:
1784
+
1785
+ - Medical decisions
1786
+ - Legal decisions
1787
+ - Financial decisions
1788
+ - Safety-critical systems
1789
+ - High-impact automated decisions
1790
+
1791
+ Human review should be used where appropriate.
1792
+
1793
+ ---
1794
+
1795
+ # πŸ” Security
1796
+
1797
+ Never expose:
1798
+
1799
+ ```text
1800
+ HF_TOKEN
1801
+ API keys
1802
+ Private credentials
1803
+ Cloud credentials
1804
+ Database passwords
1805
+ ```
1806
+
1807
+ Do not commit:
1808
+
1809
+ ```text
1810
+ .env
1811
+ credentials.json
1812
+ tokens.txt
1813
+ private keys
1814
+ ```
1815
+
1816
+ Use environment variables or a secure secrets manager.
1817
+
1818
+ ---
1819
+
1820
+ # πŸ› Troubleshooting
1821
+
1822
+ ## Repository Not Found
1823
+
1824
+ Verify:
1825
+
1826
+ ```text
1827
+ pratikshourabh/indAI
1828
+ ```
1829
+
1830
+ If the repository is private, authenticate first.
1831
+
1832
+ ---
1833
+
1834
+ ## 401 Unauthorized
1835
+
1836
+ Authenticate:
1837
+
1838
+ ```bash
1839
+ hf auth login
1840
+ ```
1841
+
1842
+ Verify:
1843
+
1844
+ ```bash
1845
+ hf auth whoami
1846
+ ```
1847
+
1848
+ ---
1849
+
1850
+ ## CUDA Not Available
1851
+
1852
+ Check:
1853
+
1854
+ ```python
1855
+ import torch
1856
+
1857
+ print(torch.cuda.is_available())
1858
+ ```
1859
+
1860
+ If `False`, verify that:
1861
+
1862
+ - A GPU is enabled
1863
+ - CUDA-compatible PyTorch is installed
1864
+ - The runtime can access the GPU
1865
+
1866
+ ---
1867
+
1868
+ ## CUDA Out of Memory
1869
+
1870
+ Try:
1871
+
1872
+ ```python
1873
+ max_new_tokens=100
1874
+ ```
1875
+
1876
+ instead of:
1877
+
1878
+ ```python
1879
+ max_new_tokens=500
1880
+ ```
1881
+
1882
+ Also reduce batch size and input length.
1883
+
1884
+ ---
1885
+
1886
+ ## Repetitive Output
1887
+
1888
+ Try:
1889
+
1890
+ ```python
1891
+ temperature=0.7
1892
+ top_p=0.9
1893
+ repetition_penalty=1.1
1894
+ ```
1895
+
1896
+ Generation behavior is model-dependent.
1897
+
1898
+ ---
1899
+
1900
+ # πŸ›£οΈ Roadmap
1901
+
1902
+ ## Dataset
1903
+
1904
+ - [ ] Improve cleaning
1905
+ - [ ] Improve deduplication
1906
+ - [ ] Dataset quality scoring
1907
+ - [ ] Better train/validation splitting
1908
+ - [ ] Token-level statistics
1909
+
1910
+ ## Training
1911
+
1912
+ - [ ] Additional training
1913
+ - [ ] Hyperparameter experiments
1914
+ - [ ] Instruction tuning
1915
+ - [ ] Automated evaluation
1916
+ - [ ] Benchmark suite
1917
+
1918
+ ## Model
1919
+
1920
+ - [ ] Quantized version
1921
+ - [ ] Optimized inference
1922
+ - [ ] Additional model variants
1923
+ - [ ] Improved generation quality
1924
+
1925
+ ## Deployment
1926
+
1927
+ - [ ] REST API
1928
+ - [ ] Streaming API
1929
+ - [ ] Web chat
1930
+ - [ ] Mobile integration
1931
+ - [ ] Production GPU deployment
1932
+
1933
+ ---
1934
+
1935
+ # πŸ“Œ Versioning
1936
+
1937
+ Recommended release format:
1938
+
1939
+ ```text
1940
+ v0.1.0
1941
+ v0.2.0
1942
+ v0.3.0
1943
+ v1.0.0
1944
+ ```
1945
+
1946
+ Semantic versioning:
1947
+
1948
+ ```text
1949
+ MAJOR.MINOR.PATCH
1950
+ ```
1951
+
1952
+ ---
1953
+
1954
+ # πŸ“ Changelog
1955
+
1956
+ ## v0.1.0
1957
+
1958
+ Initial experimental release.
1959
+
1960
+ - Initial model training
1961
+ - Hugging Face publication
1962
+ - SafeTensors weights
1963
+ - Transformers compatibility
1964
+ - Text generation support
1965
+
1966
+ ---
1967
+
1968
+ # 🀝 Contributing
1969
+
1970
+ Contributions are welcome.
1971
+
1972
+ You can contribute by:
1973
+
1974
+ - Testing the model
1975
+ - Reporting bugs
1976
+ - Sharing benchmark results
1977
+ - Improving documentation
1978
+ - Improving preprocessing
1979
+ - Suggesting training improvements
1980
+ - Building integrations
1981
+
1982
+ ---
1983
+
1984
+ # πŸ› Reporting Issues
1985
+
1986
+ Include:
1987
+
1988
+ ```text
1989
+ Model version:
1990
+ Python version:
1991
+ PyTorch version:
1992
+ Transformers version:
1993
+ GPU:
1994
+ CUDA version:
1995
+ Operating system:
1996
+ Prompt:
1997
+ Generation parameters:
1998
+ Error message:
1999
+ ```
2000
+
2001
+ Never include private access tokens.
2002
+
2003
+ ---
2004
+
2005
+ # πŸ“– Citation
2006
+
2007
+ If you use indAI in research or an application:
2008
+
2009
+ ```bibtex
2010
+ @misc{indai,
2011
+ title={indAI},
2012
+ author={Pratik Shourabh},
2013
+ year={2026},
2014
+ publisher={Hugging Face},
2015
+ url={https://huggingface.co/pratikshourabh/indAI}
2016
+ }
2017
+ ```
2018
+
2019
+ ---
2020
+
2021
+ # πŸ”— Links
2022
+
2023
+ ### Model
2024
+
2025
+ https://huggingface.co/pratikshourabh/indAI
2026
+
2027
+ ### Author
2028
+
2029
+ https://huggingface.co/pratikshourabh
2030
+
2031
+ ---
2032
+
2033
+ # πŸ“œ License
2034
+
2035
+ The license should be explicitly specified in the Hugging Face repository.
2036
+
2037
+ If the model was derived from another base model, verify the original model's license and redistribution requirements before publishing or redistributing the resulting model.
2038
+
2039
+ ---
2040
+
2041
+ # πŸ‘¨β€πŸ’» Author
2042
+
2043
+ ## Pratik Shourabh
2044
+
2045
+ Developer and AI/ML enthusiast building custom AI models, applications, and developer tools.
2046
+
2047
+ ---
2048
+
2049
+ # πŸ™ Acknowledgements
2050
+
2051
+ Built using the open-source ecosystem:
2052
+
2053
+ - Python
2054
+ - PyTorch
2055
+ - Hugging Face Transformers
2056
+ - Hugging Face Hub
2057
+ - Accelerate
2058
+ - SafeTensors
2059
+
2060
+ ---
2061
+
2062
+ # ⭐ indAI
2063
+
2064
+ > **Custom-trained. Experimental. Continuously evolving.**
2065
+
2066
+ Built with ❀️ by **Pratik Shourabh**.