🚀 DeepSeek Coder 1.3B TypeScript 模型
DeepSeek Coder 1.3B TypeScript 是由 CodeGPT 團隊基於 deepseek-ai/deepseek-coder-1.3b-base
模型微調而來的。它針對 TypeScript 進行了專門優化,使用了 0.5B 標記的數據集進行訓練,能夠高效、精準地生成 TypeScript 代碼。該模型採用 16K 窗口大小和填充中間任務(fill-in-the-middle),可實現項目級別的代碼補全。
模型信息
屬性 |
詳情 |
模型類型 |
基於 deepseek-ai/deepseek-coder-1.3b-base 微調的代碼生成模型 |
訓練數據 |
bigcode/the-stack-dedup、CodeGPTPlus/typescript-0-500000-seq1024 |
評估結果
該模型在評估集上取得了以下結果:
模型開發者
CodeGPT 團隊
模型參數
- 參數量:1.3B
- 輸入:僅接受文本輸入
- 輸出:僅生成文本輸出
🚀 快速開始
模型使用說明
此模型僅用於代碼補全。以下是一些使用示例。
💻 使用示例
基礎用法
在 GPU 上運行模型:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("CodeGPTPlus/deepseek-coder-1.3b-typescript",
trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("CodeGPTPlus/deepseek-coder-1.3b-typescript",
trust_remote_code=True).cuda()
input_text = """<|fim▁begin|>function quickSort(arr: number[]): number[] {
if (arr.length <= 1) {
return arr;
}
const pivot = arr[0];
const left = [];
const right = [];
<|fim▁hole|>
return [...quickSort(left), pivot, ...quickSort(right)];
}<|fim▁end|>"""
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_length=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
高級用法
使用 Ollama 運行模型
模型地址:https://ollama.ai/codegpt/deepseek-coder-1.3b-typescript
ollama run codegpt/deepseek-coder-1.3b-typescript
在 VSCode 中結合 Ollama 和 CodeGPT 進行代碼自動補全
文檔地址:https://docs.codegpt.co/docs/tutorial-features/code_autocompletion
在代碼自動補全模型選擇器中選擇 "Ollama - codegpt/deepseek-coder-1.3b-typescript"。然後在 VSCode 文本編輯器中編寫代碼或註釋,模型將通過 CodeGPT 代碼自動補全功能提供代碼建議。

填充中間任務(Fill In the Middle, FIM)
<|fim▁begin|>function quickSort(arr: number[]): number[] {
if (arr.length <= 1) {
return arr;
}
const pivot = arr[0];
const left = [];
const right = [];
<|fim▁hole|>
return [...quickSort(left), pivot, ...quickSort(right)];
}<|fim▁end|>
🔧 技術細節
訓練超參數
訓練過程中使用了以下超參數:
- 學習率:2e-05
- 訓練批次大小:20
- 評估批次大小:20
- 隨機種子:42
- 梯度累積步數:2
- 總訓練批次大小:40
- 優化器:Adam(β1=0.9,β2=0.999,ε=1e-06)
- 學習率調度器類型:餘弦退火
- 學習率調度器熱身步數:261
- 訓練輪數:1
訓練結果
訓練損失 |
輪數 |
步數 |
驗證損失 |
1.0745 |
0.0 |
1 |
0.8681 |
1.2267 |
0.05 |
1308 |
0.8130 |
1.1594 |
0.1 |
2616 |
0.8018 |
0.7674 |
0.15 |
3924 |
0.7942 |
0.6443 |
0.2 |
5232 |
0.7889 |
0.9155 |
0.25 |
6540 |
0.7847 |
0.7501 |
0.3 |
7848 |
0.7819 |
0.8835 |
0.35 |
9156 |
0.7792 |
0.7261 |
0.4 |
10464 |
0.7769 |
0.9746 |
0.45 |
11772 |
0.7748 |
0.6884 |
0.5 |
13080 |
0.7734 |
0.6104 |
0.55 |
14388 |
0.7722 |
0.8876 |
0.6 |
15696 |
0.7710 |
0.9567 |
0.65 |
17004 |
0.7703 |
0.6915 |
0.7 |
18312 |
0.7696 |
0.8874 |
0.75 |
19620 |
0.7691 |
0.6124 |
0.8 |
20928 |
0.7686 |
0.8147 |
0.85 |
22236 |
0.7684 |
0.8021 |
0.9 |
23544 |
0.7683 |
0.8665 |
0.95 |
24852 |
0.7681 |
框架版本
- Transformers:4.37.0.dev0
- Pytorch:2.0.1+cu118
- Datasets:2.16.1
- Tokenizers:0.15.0
📄 許可證
該模型使用其他許可證。

查看 Axolotl 配置
Axolotl 版本:0.3.0
base_model: deepseek-ai/deepseek-coder-1.3b-base
model_type: AutoModelForCausalLM
trust_remote_code: true
load_in_8bit: false
load_in_4bit: false
strict: false
datasets:
- path: CodeGPTPlus/typescript-0-500000-seq1024
type: completion
field: text
val_set_size: 0.001
output_dir: ./fft-out
sequence_len: 1024
adapter:
lora_model_dir:
lora_r:
lora_alpha:
lora_dropout:
lora_target_linear:
lora_fan_in_fan_out:
lora_modules_to_save:
wandb_project: deepseek_1.3_fft
wandb_entity:
wandb_watch:
wandb_name: aws_a10g
wandb_log_model: end
gradient_accumulation_steps: 2
micro_batch_size: 20
num_epochs: 1
optimizer: adamw_bnb_8bit
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 0.000001
max_grad_norm: 1.0
weight_decay: 0.1
lr_scheduler: cosine
learning_rate: 0.00002
train_on_inputs: false
group_by_length: false
bf16: true
fp16: false
tf32: false
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true
loss_watchdog_threshold: 5.0
loss_watchdog_patience: 3
hub_model_id: CodeGPTPlus/deepseek_coder_1.3b_typescript
hub_strategy: every_save
warmup_ratio: 0.01
evals_per_epoch: 20
saves_per_epoch: 3
debug:
deepspeed:
fsdp:
fsdp_config:
special_tokens:
bos_token: "<|begin▁of▁sentence|>"
eos_token: "<|end▁of▁sentence|>"
pad_token: "<|end▁of▁sentence|>"
[CodeGPT.co] | [🦙 Ollama] | [Discord] | [VSCode 擴展]