harshit36 commited on
Commit
37367ca
·
verified ·
1 Parent(s): d11ece7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +109 -3
README.md CHANGED
@@ -1,3 +1,109 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ tags:
7
+ - LLM
8
+ - CasualLLM
9
+ - StoryLLM
10
+ - SLM
11
+ - NOVA
12
+ ---
13
+ # Nova-Casual-LLM
14
+
15
+ A lightweight and efficient transformer-based language model built with custom architecture and integrated seamlessly into the Hugging Face ecosystem.
16
+
17
+ ## Model Summary
18
+
19
+ - **Model Name**: NovaForCausalLM
20
+ - **Architecture**: Custom decoder-only transformer (`NOVA`)
21
+ - **Model Type**: `nova`
22
+ - **Use Case**: Causal Language Modeling (text generation, auto-completion)
23
+ - **Parameters**: 14,412,400 trainable parameters
24
+ - **Pretrained Tokenizer**: `PreTrainedTokenizerFast`
25
+ - **Framework**: PyTorch
26
+ - **Hugging Face Integration**: Compatible with `transformers` via custom `AutoModel` and `AutoConfig` registration.
27
+
28
+ ---
29
+
30
+ ## Files Included
31
+
32
+ | File | Description |
33
+ |---------------------------|----------------------------------------------------|
34
+ | `config.json` | Configuration of model hyperparameters |
35
+ | `model.safetensors` | Serialized model weights (efficient format) |
36
+ | `nova_modelling.py` | Custom model and config class definitions |
37
+ | `tokenizer.json` | Serialized tokenizer |
38
+ | `tokenizer_config.json` | Tokenizer configuration metadata |
39
+ | `special_tokens_map.json` | Mapping for special tokens (e.g., BOS, EOS) |
40
+ | `README.md` | Model card (you’re reading it!) |
41
+
42
+ ---
43
+
44
+ ## Model Architecture
45
+
46
+ ### `NovaForCausalLM`
47
+
48
+ The model consists of:
49
+ - Embedding layers: token + positional
50
+ - Stack of transformer decoder blocks
51
+ - Multi-head attention with 640 individual heads
52
+ - Layer normalization
53
+ - Final linear head for vocabulary logits
54
+
55
+ ### Configuration (`NovaConfig`)
56
+
57
+ ```json
58
+ {
59
+ "model_type": "nova",
60
+ "vocab_size": 6000,
61
+ "block_size": 256,
62
+ "n_embd": 640,
63
+ "n_layer": 4,
64
+ "n_head": 8
65
+ }
66
+ ```
67
+
68
+ ## 🚀 Usage
69
+
70
+ ### Step 1: Clone the repo (to get the `nova_modelling.py`)
71
+
72
+ ```bash
73
+ git clone https://huggingface.co/harshit36/Nova-Casual-LLM
74
+ cd Nova-Casual-LLM
75
+ ```
76
+
77
+ ```python
78
+ import sys
79
+ sys.path.append("./Nova-Casual-LLM/") # add current dir to path
80
+
81
+ from transformers import PreTrainedTokenizerFast
82
+ from nova_modelling import NovaConfig, NovaForCausalLM
83
+
84
+ # Load tokenizer
85
+ tokenizer = PreTrainedTokenizerFast.from_pretrained("harshit36/Nova-Casual-LLM")
86
+
87
+ # Load config
88
+ config = NovaConfig.from_pretrained("harshit36/Nova-Casual-LLM")
89
+
90
+ # Instantiate model using your custom class
91
+ model = NovaForCausalLM(config)
92
+ model = model.from_pretrained("harshit36/Nova-Casual-LLM")
93
+
94
+ # Use the model
95
+ input_ids = tokenizer("Hello world", return_tensors="pt").input_ids
96
+ output = model.generate(input_ids)
97
+ print(tokenizer.decode(output[0], skip_special_tokens=True).replace(" ","").replace("Ġ"," ").replace("Ċ","\n"))
98
+
99
+ ```
100
+
101
+ ## Intended Use
102
+
103
+ General text generation
104
+
105
+ Hybrid Positional Encoding Research model (Combination of Sinusoidal and learnable encodings)
106
+
107
+ Educational demonstrations of custom HF model integration
108
+
109
+ Rapid prototyping of transformer models