Downloads · 30 days
12
29% of all-time downloads
sylvester-francis/typescript-slm-7b
typescript-slm-7b 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 peft. The card lists the license as mit.
Standard 7B TypeScript model for TypeScript code generation, optimized for React, Next.js, Angular, and Node.js.
Downloads · 30 days
12
29% of all-time downloads
All-time downloads
41
Public
Repo size
1.9 GB
Likes
0
Public
Click a slice to open those files.
.pt1.3 GB · 49%
From the Hugging Face model README
Standard 7B TypeScript model for TypeScript code generation, optimized for React, Next.js, Angular, and Node.js.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = "Qwen/Qwen2.5-Coder-7B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
base_model,
device_map="auto",
torch_dtype="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, "sylvester-francis/typescript-slm-7b")
# Generate code
prompt = "Write a React component with TypeScript:"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))