初始化项目,由ModelHub XC社区提供模型
Model: sylvester-francis/typescript-slm-1.5b-full Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
gguf/typescript-slm-1.5b-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
395
README.md
Normal file
395
README.md
Normal file
@@ -0,0 +1,395 @@
|
||||
---
|
||||
language:
|
||||
- en
|
||||
license: mit
|
||||
library_name: transformers
|
||||
tags:
|
||||
- code
|
||||
- typescript
|
||||
- react
|
||||
- nextjs
|
||||
- angular
|
||||
- nodejs
|
||||
- qwen
|
||||
- gguf
|
||||
- ollama
|
||||
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
|
||||
datasets:
|
||||
- github-code
|
||||
model-index:
|
||||
- name: TypeScript-SLM-1.5B-Full
|
||||
results: []
|
||||
---
|
||||
|
||||
# TypeScript-SLM-1.5B-Full
|
||||
|
||||
**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.
|
||||
|
||||
## Model Description
|
||||
|
||||
- **Base Model**: [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct)
|
||||
- **Model Type**: Causal Language Model (Code Generation)
|
||||
- **Parameters**: 1.5 billion
|
||||
- **Context Length**: 1024 tokens
|
||||
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
|
||||
- **License**: MIT
|
||||
- **Language**: English (Code: TypeScript/JavaScript)
|
||||
|
||||
### Key Features
|
||||
|
||||
- ✅ Specialized in TypeScript code generation
|
||||
- ✅ Framework-aware (React, Next.js, Angular, Node.js)
|
||||
- ✅ Strongly-typed code with proper interfaces and types
|
||||
- ✅ Optimized for modern web development patterns
|
||||
- ✅ Available in multiple GGUF quantizations for Ollama
|
||||
- ✅ Fast inference on consumer hardware
|
||||
|
||||
## Intended Uses
|
||||
|
||||
### Primary Use Cases
|
||||
|
||||
- **TypeScript Code Completion**: Auto-complete TypeScript code in IDEs
|
||||
- **Component Generation**: Create React/Angular components from descriptions
|
||||
- **Type Definition**: Generate TypeScript interfaces and type aliases
|
||||
- **Code Snippets**: Quick generation of framework-specific patterns
|
||||
- **Learning Aid**: Study TypeScript and framework best practices
|
||||
|
||||
### Example Prompts
|
||||
|
||||
```typescript
|
||||
// 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"
|
||||
```
|
||||
|
||||
## How to Use
|
||||
|
||||
### Option 1: Ollama (Recommended for Local Use)
|
||||
|
||||
The easiest way to use this model locally is with Ollama:
|
||||
|
||||
```bash
|
||||
# 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)
|
||||
|
||||
### Option 2: Transformers (Python)
|
||||
|
||||
Use directly with the Transformers library:
|
||||
|
||||
```python
|
||||
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)
|
||||
```
|
||||
|
||||
### Option 3: GGUF Files (llama.cpp)
|
||||
|
||||
Download GGUF files directly for use with llama.cpp:
|
||||
|
||||
```bash
|
||||
# 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"
|
||||
```
|
||||
|
||||
## Model Details
|
||||
|
||||
### Architecture
|
||||
|
||||
- **Base**: Qwen2.5-Coder-1.5B-Instruct
|
||||
- **Modifications**: LoRA fine-tuning on TypeScript-specific data
|
||||
- **LoRA Rank**: 64
|
||||
- **LoRA Alpha**: 128
|
||||
- **Target Modules**: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
|
||||
|
||||
### Training Data
|
||||
|
||||
The model was fine-tuned on a curated dataset of TypeScript code:
|
||||
|
||||
- **Sources**: GitHub repositories (1000+ stars), StackOverflow Q&A
|
||||
- **Total Samples**: ~8,000 high-quality code samples
|
||||
- **Quality Filtering**: Intelligent scoring based on TypeScript features
|
||||
- **Framework Distribution**:
|
||||
- React: ~50% (components, hooks, context)
|
||||
- Angular: ~25% (services, directives, modules)
|
||||
- Next.js: ~15% (pages, API routes, SSR)
|
||||
- Node.js: ~10% (Express, NestJS, APIs)
|
||||
|
||||
**Quality Indicators:**
|
||||
- Proper TypeScript type annotations
|
||||
- Complete modules with imports/exports
|
||||
- Framework-specific best practices
|
||||
- Production-quality code from popular repositories
|
||||
|
||||
### Training Configuration
|
||||
|
||||
```yaml
|
||||
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
|
||||
```
|
||||
|
||||
### Training Hardware
|
||||
|
||||
- **Platform**: Google Colab A100 (40GB)
|
||||
- **Training Time**: ~30 minutes
|
||||
- **Framework**: Hugging Face TRL + PEFT
|
||||
|
||||
## Performance
|
||||
|
||||
### Code Quality Metrics
|
||||
|
||||
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 |
|
||||
|
||||
### Generation Speed
|
||||
|
||||
| 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 |
|
||||
|
||||
## Repository Contents
|
||||
|
||||
```
|
||||
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)
|
||||
```
|
||||
|
||||
## Quantization Comparison
|
||||
|
||||
| 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.
|
||||
|
||||
## Limitations
|
||||
|
||||
### Known Limitations
|
||||
|
||||
1. **Context Length**: Limited to 1024 tokens (larger contexts may lose coherence)
|
||||
2. **Complex Logic**: May struggle with very complex algorithmic tasks
|
||||
3. **Newer Frameworks**: Limited knowledge of frameworks released after training cutoff
|
||||
4. **Type Inference**: Sometimes requires explicit type annotations
|
||||
5. **Edge Cases**: May not handle all TypeScript edge cases correctly
|
||||
|
||||
### Not Recommended For
|
||||
|
||||
- ❌ Production-critical code without review
|
||||
- ❌ Security-sensitive implementations
|
||||
- ❌ Complex algorithm design
|
||||
- ❌ Large-scale refactoring
|
||||
- ❌ Framework versions beyond training data
|
||||
|
||||
### Best Used With
|
||||
|
||||
- ✅ Human review and validation
|
||||
- ✅ Existing codebase context
|
||||
- ✅ Clear, specific prompts
|
||||
- ✅ Common framework patterns
|
||||
- ✅ Learning and prototyping
|
||||
|
||||
## Ethical Considerations
|
||||
|
||||
### Intended Use
|
||||
|
||||
This model is designed for:
|
||||
- **Developer productivity**: Assisting professional developers
|
||||
- **Learning**: Helping students learn TypeScript and frameworks
|
||||
- **Prototyping**: Quick generation of boilerplate code
|
||||
|
||||
### Potential Risks
|
||||
|
||||
- **Code Quality**: Generated code should always be reviewed
|
||||
- **Security**: May generate insecure patterns if prompted
|
||||
- **Licensing**: Generated code may resemble training data patterns
|
||||
- **Bias**: May reflect patterns common in open-source code
|
||||
|
||||
### Responsible Use Guidelines
|
||||
|
||||
1. **Always Review**: Never deploy generated code without review
|
||||
2. **Test Thoroughly**: All generated code should be tested
|
||||
3. **Check Licenses**: Ensure compliance with relevant licenses
|
||||
4. **Security Audit**: Review for security vulnerabilities
|
||||
5. **Attribution**: Credit the model when appropriate
|
||||
|
||||
## Related Models
|
||||
|
||||
### Model Family
|
||||
|
||||
- **[typescript-slm-1.5b](https://huggingface.co/sylvester-francis/typescript-slm-1.5b)** - LoRA adapter only
|
||||
- **[typescript-slm-7b](https://huggingface.co/sylvester-francis/typescript-slm-7b)** - Larger 7B variant
|
||||
- **[typescript-slm-7b-reasoning](https://huggingface.co/sylvester-francis/typescript-slm-7b-reasoning)** - 7B with enhanced reasoning
|
||||
|
||||
### Comparison
|
||||
|
||||
| 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 |
|
||||
|
||||
## Training Pipeline
|
||||
|
||||
This model was created using the [TypeScript SLM training pipeline](https://github.com/sylvester-francis/slm-typescript-model):
|
||||
|
||||
```bash
|
||||
# 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
|
||||
```
|
||||
|
||||
## Citation
|
||||
|
||||
If you use this model in your research or project, please cite:
|
||||
|
||||
```bibtex
|
||||
@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}
|
||||
}
|
||||
```
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
- **Base Model**: [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) by Alibaba Cloud
|
||||
- **Training Framework**: [Hugging Face TRL](https://github.com/huggingface/trl) and [PEFT](https://github.com/huggingface/peft)
|
||||
- **GGUF Conversion**: [llama.cpp](https://github.com/ggerganov/llama.cpp) by Georgi Gerganov
|
||||
|
||||
## License
|
||||
|
||||
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.
|
||||
```
|
||||
|
||||
## Contact & Support
|
||||
|
||||
- **Issues**: https://github.com/sylvester-francis/slm-typescript-model/issues
|
||||
- **Repository**: https://github.com/sylvester-francis/slm-typescript-model
|
||||
- **HuggingFace**: https://huggingface.co/sylvester-francis
|
||||
|
||||
## Version History
|
||||
|
||||
- **v1.0.0** (2025-11-29): Initial release
|
||||
- Full merged model with LoRA adapters
|
||||
- GGUF quantizations (q4_k_m, q6_k, f16)
|
||||
- Ollama Modelfiles
|
||||
- Optimized for React, Next.js, Angular, Node.js
|
||||
|
||||
---
|
||||
|
||||
**Keywords**: typescript, react, nextjs, angular, nodejs, code-generation, llm, gguf, ollama, qwen, lora, small-language-model
|
||||
24
added_tokens.json
Normal file
24
added_tokens.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"</tool_call>": 151658,
|
||||
"<tool_call>": 151657,
|
||||
"<|box_end|>": 151649,
|
||||
"<|box_start|>": 151648,
|
||||
"<|endoftext|>": 151643,
|
||||
"<|file_sep|>": 151664,
|
||||
"<|fim_middle|>": 151660,
|
||||
"<|fim_pad|>": 151662,
|
||||
"<|fim_prefix|>": 151659,
|
||||
"<|fim_suffix|>": 151661,
|
||||
"<|im_end|>": 151645,
|
||||
"<|im_start|>": 151644,
|
||||
"<|image_pad|>": 151655,
|
||||
"<|object_ref_end|>": 151647,
|
||||
"<|object_ref_start|>": 151646,
|
||||
"<|quad_end|>": 151651,
|
||||
"<|quad_start|>": 151650,
|
||||
"<|repo_name|>": 151663,
|
||||
"<|video_pad|>": 151656,
|
||||
"<|vision_end|>": 151653,
|
||||
"<|vision_pad|>": 151654,
|
||||
"<|vision_start|>": 151652
|
||||
}
|
||||
54
chat_template.jinja
Normal file
54
chat_template.jinja
Normal file
@@ -0,0 +1,54 @@
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{{- messages[0]['content'] }}
|
||||
{%- else %}
|
||||
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
||||
{%- endif %}
|
||||
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- for message in messages %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{{- '<|im_start|>' + message.role }}
|
||||
{%- if message.content %}
|
||||
{{- '\n' + message.content }}
|
||||
{%- endif %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if tool_call.function is defined %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- message.content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- endif %}
|
||||
58
config.json
Normal file
58
config.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Qwen2ForCausalLM"
|
||||
],
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 151643,
|
||||
"dtype": "bfloat16",
|
||||
"eos_token_id": 151645,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 1536,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 8960,
|
||||
"layer_types": [
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention"
|
||||
],
|
||||
"max_position_embeddings": 32768,
|
||||
"max_window_layers": 28,
|
||||
"model_type": "qwen2",
|
||||
"num_attention_heads": 12,
|
||||
"num_hidden_layers": 28,
|
||||
"num_key_value_heads": 2,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 1000000.0,
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "4.57.3",
|
||||
"use_cache": true,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
14
generation_config.json
Normal file
14
generation_config.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"bos_token_id": 151643,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151645,
|
||||
151643
|
||||
],
|
||||
"pad_token_id": 151643,
|
||||
"repetition_penalty": 1.1,
|
||||
"temperature": 0.7,
|
||||
"top_k": 20,
|
||||
"top_p": 0.8,
|
||||
"transformers_version": "4.57.3"
|
||||
}
|
||||
9
gguf/Modelfile-q4_k_m
Normal file
9
gguf/Modelfile-q4_k_m
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM hf.co/sylvester-francis/typescript-slm-1.5b-full:gguf/typescript-slm-1.5b-q4_k_m.gguf
|
||||
|
||||
PARAMETER temperature 0.3
|
||||
PARAMETER num_ctx 8192
|
||||
PARAMETER top_p 0.95
|
||||
|
||||
SYSTEM """You are TypeScript-SLM 1.5B: a compact, domain-specialized model for TypeScript.
|
||||
You specialize in React, Next.js, Angular, and Node.js.
|
||||
Always output idiomatic, strongly-typed TypeScript with concise explanations."""
|
||||
3
gguf/typescript-slm-1.5b-q4_k_m.gguf
Normal file
3
gguf/typescript-slm-1.5b-q4_k_m.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bb53401be06a23a454a5f4345e0727f4d53fb448ab356c9d558046659f48bc79
|
||||
size 986048096
|
||||
151388
merges.txt
Normal file
151388
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:21c4b0739ed3ab032c18e737b3374efebaaa1f7f702b3a6361b291a270d0e041
|
||||
size 3087467144
|
||||
31
special_tokens_map.json
Normal file
31
special_tokens_map.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"eos_token": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "<|endoftext|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
|
||||
size 11421896
|
||||
207
tokenizer_config.json
Normal file
207
tokenizer_config.json
Normal file
@@ -0,0 +1,207 @@
|
||||
{
|
||||
"add_bos_token": false,
|
||||
"add_prefix_space": false,
|
||||
"added_tokens_decoder": {
|
||||
"151643": {
|
||||
"content": "<|endoftext|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151644": {
|
||||
"content": "<|im_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151645": {
|
||||
"content": "<|im_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151646": {
|
||||
"content": "<|object_ref_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151647": {
|
||||
"content": "<|object_ref_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151648": {
|
||||
"content": "<|box_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151649": {
|
||||
"content": "<|box_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151650": {
|
||||
"content": "<|quad_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151651": {
|
||||
"content": "<|quad_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151652": {
|
||||
"content": "<|vision_start|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151653": {
|
||||
"content": "<|vision_end|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151654": {
|
||||
"content": "<|vision_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151655": {
|
||||
"content": "<|image_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151656": {
|
||||
"content": "<|video_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"151657": {
|
||||
"content": "<tool_call>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151658": {
|
||||
"content": "</tool_call>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151659": {
|
||||
"content": "<|fim_prefix|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151660": {
|
||||
"content": "<|fim_middle|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151661": {
|
||||
"content": "<|fim_suffix|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151662": {
|
||||
"content": "<|fim_pad|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151663": {
|
||||
"content": "<|repo_name|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
},
|
||||
"151664": {
|
||||
"content": "<|file_sep|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": false
|
||||
}
|
||||
},
|
||||
"additional_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"bos_token": null,
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": {},
|
||||
"model_max_length": 32768,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user