Edwin Jose Palathinkal commited on
Commit
098de9c
·
1 Parent(s): c255ac5

Add model card with HuggingFace metadata

Browse files
Files changed (1) hide show
  1. README.md +29 -151
README.md CHANGED
@@ -1,168 +1,46 @@
1
- # Namer
2
-
3
- A PyTorch transformer model that converts numbers to their English names.
4
-
5
- ## About This Project
6
-
7
- This project was **vibe coded** — meaning it was collaboratively built using AI assistance (specifically the [pi coding agent](https://github.com/earendil-works/pi) harness) through iterative conversation, exploration, and refinement. The codebase reflects a natural evolution of ideas, from initial concept to working transformer model, with AI handling implementation details, suggestions, and code generation based on high-level direction.
8
-
9
- ## 🤗 HuggingFace Model
10
-
11
- A pre-trained version of this model is available on HuggingFace:
12
 
13
- **🔗 https://huggingface.co/edwinhere/namer**
14
-
15
- ## Features
16
-
17
- - **Transformer architecture** with cross-attention mechanism
18
- - **Infinite dataset** training with early stopping
19
- - **Modular design** following Python best practices
20
- - **Type hints** throughout for better IDE support
21
- - **Comprehensive test suite** with pytest
22
- - **Modern tooling**: ruff (linting/formatting), mypy (type checking)
23
-
24
- ## Installation
25
 
26
- ```bash
27
- # Clone the repository
28
- git clone https://github.com/example/namer.git
29
- cd namer
30
 
31
- # Create virtual environment
32
- python -m venv .venv
33
- source .venv/bin/activate # On Windows: .venv\Scripts\activate
34
 
35
- # Install in development mode
36
- pip install -e ".[dev]"
37
- ```
38
 
39
  ## Usage
40
 
41
- ### Command Line Interface
42
-
43
- ```bash
44
- # Show help
45
- namer --help
46
-
47
- # Run demonstrations
48
- namer demo
49
-
50
- # Train the model
51
- namer train
52
-
53
- # Train with custom settings
54
- namer train --epochs 50 --steps 2000 --batch-size 64 --lr 0.0005
55
-
56
- # Run interactive inference
57
- namer infer
58
-
59
- # Run quick test
60
- namer test
61
- ```
62
-
63
- ### Python API
64
-
65
  ```python
66
- from namer import NamerTransformer, load_namer_model, predict_number_name
67
 
68
- # Load a trained model
69
- model = load_namer_model("namer_model.pt")
 
70
 
71
- # Predict number names
72
- name = predict_number_name(model, 123456)
73
- print(name) # "one hundred twenty three thousand four hundred fifty six"
74
  ```
75
 
76
- ## Project Structure
77
 
78
- ```
79
- namer/
80
- ├── namer/ # Main package
81
- │ ├── __init__.py # Package exports
82
- │ ├── main.py # CLI entry point
83
- │ ├── models.py # Transformer model definitions
84
- │ ├── data.py # Dataset classes
85
- │ ├── training.py # Training loop
86
- │ ├── inference.py # Inference utilities
87
- │ └── utils.py # Number-to-name conversion utilities
88
- ├── tests/ # Test suite
89
- │ ├── test_utils.py
90
- │ ├── test_models.py
91
- │ ├── test_data.py
92
- │ └── test_inference.py
93
- ├── pyproject.toml # Project configuration
94
- ├── README.md
95
- └── Makefile # Convenience commands
96
- ```
97
 
98
- ## Development
99
 
100
- ### Running Tests
101
 
102
- ```bash
103
- # Run all tests
104
- pytest
105
-
106
- # Run with coverage
107
- pytest --cov=namer --cov-report=html
108
-
109
- # Run specific test file
110
- pytest tests/test_utils.py
111
- ```
112
-
113
- ### Linting and Formatting
114
-
115
- ```bash
116
- # Check code style
117
- ruff check .
118
-
119
- # Fix auto-fixable issues
120
- ruff check --fix .
121
-
122
- # Format code
123
- ruff format .
124
-
125
- # Type checking
126
- mypy namer
127
- ```
128
-
129
- ### Makefile Commands
130
-
131
- ```bash
132
- make help # Show available commands
133
- make install # Install dependencies
134
- make train # Train the model
135
- make inference # Run interactive inference
136
- make test # Run tests
137
- make clean # Clean generated files
138
- make distclean # Deep clean including venv
139
  ```
140
-
141
- ## Model Architecture
142
-
143
- The `NamerTransformer` uses an encoder-only architecture:
144
-
145
- 1. **Digit Embedding** - Embeds digits 0-9 (plus padding token)
146
- 2. **Positional Encoding** - Sinusoidal positional embeddings
147
- 3. **Transformer Encoder** - Multi-layer encoder with self-attention
148
- 4. **Cross-Attention** - Learned output queries attend to encoded digits
149
- 5. **Output Projection** - Projects to vocabulary for each output position
150
-
151
- ## Training
152
-
153
- The model trains on an infinite dataset that generates random number-to-name mappings on-the-fly:
154
-
155
- - Numbers up to 999,999 (configurable)
156
- - Early stopping with patience (default: 10 epochs)
157
- - Cross-entropy loss with -1 padding ignored
158
- - Adam optimizer with configurable learning rate
159
-
160
- ## Requirements
161
-
162
- - Python 3.10+
163
- - PyTorch 2.0+
164
- - CUDA-capable GPU (optional, falls back to CPU)
165
-
166
- ## License
167
-
168
- MIT License - see LICENSE file for details.
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ library_name: pytorch
5
+ tags:
6
+ - name-generation
7
+ - pytorch
8
+ ---
 
 
 
9
 
10
+ # Namer
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ A PyTorch model for generating names.
 
 
 
13
 
14
+ ## Model Description
 
 
15
 
16
+ This model generates creative names based on input patterns or criteria.
 
 
17
 
18
  ## Usage
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ```python
21
+ import torch
22
 
23
+ # Load the model
24
+ model = torch.load("namer_model.pt", map_location="cpu")
25
+ model.eval()
26
 
27
+ # Use the model for inference
28
+ # (Add specific usage example based on your model's API)
 
29
  ```
30
 
31
+ ## Files
32
 
33
+ - `namer_model.pt` - Model weights
34
+ - `namer/` - Source code package
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ ## Citation
37
 
38
+ If you use this model, please cite:
39
 
40
+ ```bibtex
41
+ @software{namer,
42
+ author = {Edwin Jose Palathinkal},
43
+ title = {Namer: A name generation model},
44
+ url = {https://huggingface.co/edwinhere/namer}
45
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  ```