Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-1.7B
|
| 4 |
+
tags:
|
| 5 |
+
- lora
|
| 6 |
+
- zsh
|
| 7 |
+
- cli
|
| 8 |
+
- autocomplete
|
| 9 |
+
- command-line
|
| 10 |
+
- peft
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# duoyuncloud/zsh-assistant-lora
|
| 14 |
+
|
| 15 |
+
This is a LoRA (Low-Rank Adaptation) adapter for [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B) fine-tuned for Zsh CLI command autocomplete.
|
| 16 |
+
|
| 17 |
+
## Model Details
|
| 18 |
+
|
| 19 |
+
### Base Model
|
| 20 |
+
- **Base Model:** [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B)
|
| 21 |
+
- **Model Type:** Causal Language Model
|
| 22 |
+
- **Task:** CLI Command Completion
|
| 23 |
+
|
| 24 |
+
### LoRA Configuration
|
| 25 |
+
- **LoRA Rank (r):** 8
|
| 26 |
+
- **LoRA Alpha:** 16
|
| 27 |
+
- **LoRA Dropout:** 0.1
|
| 28 |
+
- **Target Modules:** k_proj, q_proj, o_proj, gate_proj, v_proj, down_proj, up_proj
|
| 29 |
+
|
| 30 |
+
### Training Configuration
|
| 31 |
+
- **Epochs:** 3
|
| 32 |
+
- **Learning Rate:** 0.0002
|
| 33 |
+
- **Batch Size:** 1
|
| 34 |
+
- **Training Data:** 277 CLI command completion samples (Git, Docker, NPM, Python, Kubernetes, etc.)
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
### Using with PEFT
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 42 |
+
from peft import PeftModel
|
| 43 |
+
|
| 44 |
+
# Load base model
|
| 45 |
+
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-1.7B")
|
| 46 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-1.7B")
|
| 47 |
+
|
| 48 |
+
# Load LoRA adapter
|
| 49 |
+
model = PeftModel.from_pretrained(base_model, "duoyuncloud/zsh-assistant-lora")
|
| 50 |
+
|
| 51 |
+
# Use for inference
|
| 52 |
+
prompt = "Input: git comm\nOutput:"
|
| 53 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 54 |
+
outputs = model.generate(**inputs, max_new_tokens=50)
|
| 55 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 56 |
+
print(result)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Using with Ollama
|
| 60 |
+
|
| 61 |
+
This adapter is designed to work with the [zsh-llm-cli-autocomplete-tool](https://github.com/duoyuncloud/zsh-llm-cli-autocomplete-tool) project.
|
| 62 |
+
|
| 63 |
+
After importing to Ollama, use it as:
|
| 64 |
+
```bash
|
| 65 |
+
ollama run zsh-assistant
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Training Data
|
| 69 |
+
|
| 70 |
+
The model was fine-tuned on 277 command completion pairs covering:
|
| 71 |
+
- Git commands (status, add, commit, push, pull, etc.)
|
| 72 |
+
- Docker commands (run, build, ps, exec, etc.)
|
| 73 |
+
- NPM/Node commands (install, run, start, etc.)
|
| 74 |
+
- Python commands (-m, -c, pip, etc.)
|
| 75 |
+
- Kubernetes commands (get, apply, delete, etc.)
|
| 76 |
+
- System commands (ls, cd, mkdir, etc.)
|
| 77 |
+
|
| 78 |
+
## Limitations
|
| 79 |
+
|
| 80 |
+
- This adapter is specifically fine-tuned for CLI command completion tasks
|
| 81 |
+
- Performance may vary for other use cases
|
| 82 |
+
- The base model's limitations also apply
|
| 83 |
+
|
| 84 |
+
## Citation
|
| 85 |
+
|
| 86 |
+
If you use this adapter, please cite:
|
| 87 |
+
|
| 88 |
+
```bibtex
|
| 89 |
+
@misc{duoyuncloud_zsh_assistant_lora},
|
| 90 |
+
title={Zsh CLI Autocomplete LoRA Adapter},
|
| 91 |
+
author={Your Name},
|
| 92 |
+
year={2024},
|
| 93 |
+
publisher={Hugging Face},
|
| 94 |
+
howpublished={\url{https://huggingface.co/duoyuncloud/zsh-assistant-lora}}
|
| 95 |
+
}
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
## License
|
| 99 |
+
|
| 100 |
+
This adapter inherits the license from the base model [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B).
|