updated
Browse files
README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model: google/codegemma-2b
|
| 6 |
+
tags:
|
| 7 |
+
- nl2bash
|
| 8 |
+
- text-to-code
|
| 9 |
+
- code-generation
|
| 10 |
+
- terminal
|
| 11 |
+
- command-line
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# zero-nl2cmds-v1: An AI Terminal Assistant Model
|
| 16 |
+
|
| 17 |
+
This is a fine-tuned version of `google/codegemma-2b` designed to translate natural language instructions into precise Linux/macOS bash commands. It's the core component for an AI-powered command-line assistant.
|
| 18 |
+
|
| 19 |
+
**Author:** Sanjayyy06
|
| 20 |
+
**Version:** 1.0
|
| 21 |
+
|
| 22 |
+
## Model Description
|
| 23 |
+
|
| 24 |
+
This model takes a simple instruction, like "create a single directory named 'api'", and outputs the corresponding bash command, `mkdir api`. It has been specifically trained and corrected to handle common command-line tasks with a high degree of literal precision.
|
| 25 |
+
|
| 26 |
+
## Intended Use
|
| 27 |
+
|
| 28 |
+
This model is intended to be the inference engine for a local command-line interface (CLI) tool. A user can type a command in plain English, and the tool will use this model to generate and execute the shell command.
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
# Example usage with the transformers library
|
| 32 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 33 |
+
|
| 34 |
+
model_name = "Sanjayyy06/zero-nl2cmds-v1"
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 36 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 37 |
+
|
| 38 |
+
prompt = "Instruction: list all files in long format\nOutput:"
|
| 39 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 40 |
+
|
| 41 |
+
# Generate the command
|
| 42 |
+
outputs = model.generate(**inputs, max_new_tokens=50)
|
| 43 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 44 |
+
# Expected output: Instruction: list all files in long format
|
| 45 |
+
# Output: ls -l
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
#Training Process
|
| 51 |
+
-The model was fine-tuned using a multi-stage process to ensure high accuracy and control over its behavior.
|
| 52 |
+
-Initial Fine-Tuning: The base google/codegemma-2b model was first fine-tuned on a 5,000-example subset of the AnishJoshi/nl2bash-custom dataset.
|
| 53 |
+
-Overfitting Correction: Early tests showed the model began to severely overfit on common patterns (e.g., generating entire project structures for a simple mkdir command).
|
| 54 |
+
-Surgical Strike: A high-quality, 500-example "correctional dataset" was created to explicitly re-teach the model the literal meaning of simple commands.
|
| 55 |
+
-Final Model: The model from step 1 was then fine-tuned for a short duration on the correctional dataset, resulting in this final version which is both knowledgeable and controllable.
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
#Citation
|
| 59 |
+
If you use this model in your work, please cite it as follows:
|
| 60 |
+
|
| 61 |
+
Code snippet
|
| 62 |
+
|
| 63 |
+
@misc{sanjayyy06_zero_nl2cmds_v1,
|
| 64 |
+
author = {Sanjayyy06},
|
| 65 |
+
title = {zero-nl2cmds-v1: A Surgically Corrected CodeGemma Model for NL-to-Bash Translation},
|
| 66 |
+
year = {2025},
|
| 67 |
+
publisher = {Hugging Face},
|
| 68 |
+
journal = {Hugging Face repository},
|
| 69 |
+
howpublished = {\url{[https://huggingface.co/Sanjayyy06/zero-nl2cmds-v1](https://huggingface.co/Sanjayyy06/zero-nl2cmds-v1)}},
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|