--- license: mit datasets: - mhhmm/typescript-instruct-20k base_model: - google/gemma-4-12B tags: - typescript - finetuned - spaceoutpl - unsloth - code - text-generation - instruct - programming - gemma - lora - javascript --- # Gemma-4-12B TypeScript This model is a specialized, fine-tuned version of [Google's Gemma-4 12B](https://huggingface.co/google/gemma-4-12B) designed specifically for TypeScript code generation, refactoring, and instruction. It was fine-tuned efficiently using the [Unsloth](https://github.com/unslothai/unsloth) library by [spaceoutpl]. ## 💻 Model Details * **Base Model:** google/gemma-4-12B * **License:** MIT * **Language:** English / TypeScript * **Fine-tuning Framework:** Unsloth * **Dataset:** [mhhmm/typescript-instruct-20k](https://huggingface.co/datasets/mhhmm/typescript-instruct-20k) ## 🚀 Intended Use This model is ideal for developers and researchers looking for an AI assistant heavily specialized in the TypeScript ecosystem. Use cases include: * **Code Generation:** Writing complex TypeScript functions, interfaces, and types. * **Code Refactoring:** Converting standard JavaScript to strictly-typed TypeScript. * **Instruction & Explanation:** Explaining TypeScript errors, generics, utility types, and best practices. ## 🛠️ Getting Started You can load this model directly using the `transformers` library. Since it was trained with Unsloth, you can also utilize Unsloth's optimized inference engines for faster generation. ### Installation ```bash pip install transformers torch accelerate ``` ### Usage (Hugging Face Transformers) ```python from transformers import AutoTokenizer, AutoModelForCausalLM import torch model_id = "spaceoutpl/gemma-4-12B-typescript" # Update with your actual repo name tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained( model_id, device_map="auto", torch_dtype=torch.bfloat16 ) prompt = "Write a generic TypeScript function to fetch and strictly type data from an API." inputs = tokenizer(prompt, return_tensors="pt").to("cuda") outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## 📊 Training Data The model was fine-tuned on the `mhhmm/typescript-instruct-20k` dataset, which contains 20,000 high-quality instructional pairs focusing on TypeScript programming concepts, syntax, and problem-solving. ## ⚠️ Limitations & Biases * **Hallucinations:** Like all LLMs, the model may occasionally generate plausible-looking but syntactically incorrect or non-compiling TypeScript code. Always test generated code in your environment. * **Knowledge Cutoff:** The model's knowledge is limited to the training data of the base Gemma-4 model and the specific TypeScript dataset used for fine-tuning. It may not reflect the absolute latest TypeScript beta features.