Downloads · 30 days
106
9% of all-time downloads
sylvester-francis/typescript-slm-1.5b-full
typescript-slm-1.5b-full is a text generation model from sylvester-francis. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
TypeScript-SLM-1.5B is a compact, domain-specialized language model fine-tuned for TypeScript code generation, with a focus on React, Next.js, Angular, and Node.js frameworks.
Downloads · 30 days
106
9% of all-time downloads
All-time downloads
1.2K
Public
Parameters
1.5B
4.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors3.1 GB · 75%
From the Hugging Face model README
TypeScript-SLM-1.5B is a compact, domain-specialized language model fine-tuned for TypeScript code generation, with a focus on React, Next.js, Angular, and Node.js frameworks.
This repository contains the full merged model (base model + LoRA adapters) along with GGUF quantized versions ready for Ollama deployment.
// React component with TypeScript
"Create a React component with TypeScript for a user profile card"
// Next.js API route
"Write a Next.js API route that handles user authentication"
// Angular service
"Create an Angular service for managing todo items"
// Node.js Express server
"Write an Express server with TypeScript that includes CORS and error handling"
// Type definitions
"Define a TypeScript interface for a blog post with author information"
The easiest way to use this model locally is with Ollama:
# Import the model using the Modelfile
ollama create typescript-slm-1.5b -f Modelfile-q4_k_m
# Run the model
ollama run typescript-slm-1.5b "Create a React component for a todo list"
Available Quantizations:
Modelfile-q4_k_m - 4-bit quantization (~800MB, fastest)Modelfile-q6_k - 6-bit quantization (~1.2GB, balanced)Modelfile-f16 - 16-bit float (~3GB, highest quality)Use directly with the Transformers library:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "sylvester-francis/typescript-slm-1.5b-full"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Generate code
prompt = "Create a React component with TypeScript for a user profile card:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.3,
top_p=0.95,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
code = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(code)
Download GGUF files directly for use with llama.cpp:
# Download specific quantization
huggingface-cli download sylvester-francis/typescript-slm-1.5b-full \
gguf/typescript-slm-1.5b-q4_k_m.gguf --local-dir ./models
# Run with llama.cpp
./llama-cli -m ./models/gguf/typescript-slm-1.5b-q4_k_m.gguf \
-p "Create a TypeScript interface for a user profile"
The model was fine-tuned on a curated dataset of TypeScript code:
Quality Indicators:
Base Model: Qwen/Qwen2.5-Coder-1.5B-Instruct
Training Method: LoRA Fine-tuning
LoRA Rank: 64
LoRA Alpha: 128
Learning Rate: 2e-4
Batch Size: 8 (effective: 32 with gradient accumulation)
Epochs: 3
Max Sequence Length: 1024
Optimizer: AdamW
Warmup Ratio: 0.03
Based on evaluation of 100 TypeScript generation tasks:
| Metric | Score |
|---|---|
| Correct Syntax | 85% |
| Proper TypeScript Types | 72% |
| Framework Best Practices | 68% |
| Context Understanding | 1024 tokens |
| Platform | Tokens/Second |
|---|---|
| NVIDIA RTX 3090 (FP16) | ~80 tokens/s |
| Apple M2 Max (GGUF q4_k_m) | ~45 tokens/s |
| Apple M1 (GGUF q4_k_m) | ~30 tokens/s |
| CPU (GGUF q4_k_m) | ~10-15 tokens/s |
typescript-slm-1.5b-full/
├── config.json # Model configuration
├── tokenizer.json # Tokenizer configuration
├── tokenizer_config.json # Tokenizer settings
├── generation_config.json # Generation parameters
├── pytorch_model.bin # Full merged PyTorch model
├── model.safetensors # SafeTensors format
│
└── gguf/ # GGUF quantized models
├── typescript-slm-1.5b-q4_k_m.gguf # 4-bit quantization (~800MB)
├── typescript-slm-1.5b-q6_k.gguf # 6-bit quantization (~1.2GB)
├── typescript-slm-1.5b-f16.gguf # 16-bit float (~3GB)
├── Modelfile-q4_k_m # Ollama config (4-bit)
├── Modelfile-q6_k # Ollama config (6-bit)
└── Modelfile-f16 # Ollama config (16-bit)
| Format | Size | Quality | Speed | Use Case |
|---|---|---|---|---|
| q4_k_m | ~800MB | Good | Fastest | Local development, quick iteration |
| q6_k | ~1.2GB | Very Good | Fast | Production, balanced performance |
| f16 | ~3GB | Excellent | Moderate | High quality, benchmarking |
| PyTorch | ~3GB | Perfect | GPU-dependent | Fine-tuning, research |
Recommendation: Use q4_k_m for testing, q6_k for production.
This model is designed for:
| Model | Parameters | Context | Speed | Quality | Use Case |
|---|---|---|---|---|---|
| 1.5B | 1.5B | 1024 | Fastest | Good | Local dev, quick iteration |
| 7B | 7B | 2048 | Fast | Excellent | Production code |
| 7B-Reasoning | 7B | 2048 | Moderate | Excellent+ | Complex problems, debugging |
This model was created using the TypeScript SLM training pipeline:
# Train your own model
git clone https://github.com/sylvester-francis/slm-typescript-model
cd slm-typescript-model
pip install -r requirements.txt
# Run complete pipeline
python slm.py pipeline
# Deploy to Ollama
python slm.py deploy typescript-slm-1.5b
If you use this model in your research or project, please cite:
@software{typescript_slm_1.5b_2025,
author = {Francis, Sylvester},
title = {TypeScript-SLM-1.5B: Domain-Specialized Language Model for TypeScript},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/sylvester-francis/typescript-slm-1.5b-full}
}
This model is released under the MIT License.
MIT License
Copyright (c) 2025 Sylvester Francis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Keywords: typescript, react, nextjs, angular, nodejs, code-generation, llm, gguf, ollama, qwen, lora, small-language-model