Updated README.md File
Browse files
README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
---
|
| 2 |
-
base_model:
|
| 3 |
-
library_name:
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
- unsloth
|
| 12 |
license: mit
|
| 13 |
language:
|
| 14 |
- en
|
| 15 |
---
|
| 16 |
-
# TinyLlama Email Reply Generator (LoRA)
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
The adapter was trained on the **Enron Email Reply Dataset** to learn professional communication patterns.
|
| 21 |
|
|
@@ -24,13 +24,62 @@ The adapter was trained on the **Enron Email Reply Dataset** to learn profession
|
|
| 24 |
## Model Overview
|
| 25 |
|
| 26 |
* **Base Model:** TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 27 |
-
* **
|
|
|
|
| 28 |
* **Task:** Email reply generation
|
| 29 |
* **Language:** English
|
| 30 |
-
* **Framework:** Unsloth + Transformers
|
| 31 |
-
* **Deployment:** Designed for local inference with FastAPI or Ollama
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
---
|
| 36 |
|
|
@@ -44,12 +93,6 @@ This model is designed for:
|
|
| 44 |
* Local AI workflows
|
| 45 |
* Research on small language models
|
| 46 |
|
| 47 |
-
Example applications include:
|
| 48 |
-
|
| 49 |
-
* Gmail Smart Reply style systems
|
| 50 |
-
* Chrome extensions for automated responses
|
| 51 |
-
* Offline AI assistants
|
| 52 |
-
|
| 53 |
---
|
| 54 |
|
| 55 |
## Training Dataset
|
|
@@ -58,7 +101,7 @@ The model was trained using the **Enron Email Reply Dataset**, which contains re
|
|
| 58 |
|
| 59 |
Dataset characteristics:
|
| 60 |
|
| 61 |
-
* ~15,000 email
|
| 62 |
* Business and professional communication
|
| 63 |
* Cleaned and formatted into instruction-style prompts
|
| 64 |
|
|
@@ -84,56 +127,7 @@ Sure, I will send the report by tomorrow.
|
|
| 84 |
* **Sequence length:** 512 tokens
|
| 85 |
* **Optimizer:** AdamW
|
| 86 |
* **Base architecture:** TinyLlama 1.1B
|
| 87 |
-
|
| 88 |
-
Only a small percentage of parameters were trained via LoRA adapters, enabling efficient training on consumer GPUs.
|
| 89 |
-
|
| 90 |
-
---
|
| 91 |
-
|
| 92 |
-
## Usage
|
| 93 |
-
|
| 94 |
-
Install dependencies:
|
| 95 |
-
|
| 96 |
-
```
|
| 97 |
-
pip install unsloth transformers accelerate bitsandbytes
|
| 98 |
-
```
|
| 99 |
-
|
| 100 |
-
Load the model:
|
| 101 |
-
|
| 102 |
-
```python
|
| 103 |
-
from unsloth import FastLanguageModel
|
| 104 |
-
|
| 105 |
-
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 106 |
-
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
| 107 |
-
load_in_4bit=True
|
| 108 |
-
)
|
| 109 |
-
|
| 110 |
-
model.load_adapter("ashankgupta/tinyllama-email-reply")
|
| 111 |
-
```
|
| 112 |
-
|
| 113 |
-
Example inference:
|
| 114 |
-
|
| 115 |
-
```python
|
| 116 |
-
email = """
|
| 117 |
-
Hi,
|
| 118 |
-
|
| 119 |
-
Can you send the invoice by tomorrow?
|
| 120 |
-
"""
|
| 121 |
-
|
| 122 |
-
prompt = f"""
|
| 123 |
-
You are an AI assistant that writes professional email replies.
|
| 124 |
-
|
| 125 |
-
Email:
|
| 126 |
-
{email}
|
| 127 |
-
|
| 128 |
-
Reply:
|
| 129 |
-
"""
|
| 130 |
-
|
| 131 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
| 132 |
-
|
| 133 |
-
output = model.generate(**inputs, max_new_tokens=120)
|
| 134 |
-
|
| 135 |
-
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
| 136 |
-
```
|
| 137 |
|
| 138 |
---
|
| 139 |
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 3 |
+
library_name: llama.cpp
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
+
- tinyllama
|
| 7 |
+
- email-reply
|
| 8 |
+
- gguf
|
| 9 |
+
- ollama
|
| 10 |
+
- local-ai
|
|
|
|
| 11 |
license: mit
|
| 12 |
language:
|
| 13 |
- en
|
| 14 |
---
|
|
|
|
| 15 |
|
| 16 |
+
# TinyLlama Email Reply Generator
|
| 17 |
+
|
| 18 |
+
A **fine-tuned TinyLlama model** for generating professional email replies from incoming emails.
|
| 19 |
|
| 20 |
The adapter was trained on the **Enron Email Reply Dataset** to learn professional communication patterns.
|
| 21 |
|
|
|
|
| 24 |
## Model Overview
|
| 25 |
|
| 26 |
* **Base Model:** TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 27 |
+
* **Format:** GGUF (Q4_K_M quantization)
|
| 28 |
+
* **Size:** ~667 MB
|
| 29 |
* **Task:** Email reply generation
|
| 30 |
* **Language:** English
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## Quick Start with GGUF
|
| 35 |
+
|
| 36 |
+
### Using Ollama (Recommended)
|
| 37 |
+
|
| 38 |
+
```bash
|
| 39 |
+
# Pull the model from Hugging Face
|
| 40 |
+
huggingface-cli download AshankGupta/tinyllama-email-reply tinyllama-chat.Q4_K_M.gguf --local-dir ./model
|
| 41 |
+
|
| 42 |
+
# Or download directly
|
| 43 |
+
curl -L -o model.gguf "https://huggingface.co/AshankGupta/tinyllama-email-reply/resolve/main/tinyllama-chat.Q4_K_M.gguf"
|
| 44 |
+
|
| 45 |
+
# Create Ollama model
|
| 46 |
+
ollama create tinyllama-email-reply -f Modelfile
|
| 47 |
+
|
| 48 |
+
# Run
|
| 49 |
+
ollama run tinyllama-email-reply
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Using llama.cpp
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
# Download GGUF file from Hugging Face
|
| 56 |
+
curl -L -o tinyllama-email-reply.Q4_K_M.gguf \
|
| 57 |
+
"https://huggingface.co/AshankGupta/tinyllama-email-reply/resolve/main/tinyllama-chat.Q4_K_M.gguf"
|
| 58 |
+
|
| 59 |
+
# Run inference
|
| 60 |
+
./llama.cpp/llama-cli -m tinyllama-email-reply.Q4_K_M.gguf -p "Write a professional email reply to: Can you send the invoice by tomorrow?"
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Using Python
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from llama_cpp import Llama
|
| 67 |
+
|
| 68 |
+
model = Llama(
|
| 69 |
+
model_path="tinyllama-chat.Q4_K_M.gguf",
|
| 70 |
+
n_ctx=1024,
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
prompt = """You are an AI assistant that writes professional email replies.
|
| 74 |
+
|
| 75 |
+
Email:
|
| 76 |
+
Can you send the invoice by tomorrow?
|
| 77 |
+
|
| 78 |
+
Reply:"""
|
| 79 |
+
|
| 80 |
+
output = model(prompt, max_tokens=120)
|
| 81 |
+
print(output["choices"][0]["text"])
|
| 82 |
+
```
|
| 83 |
|
| 84 |
---
|
| 85 |
|
|
|
|
| 93 |
* Local AI workflows
|
| 94 |
* Research on small language models
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
---
|
| 97 |
|
| 98 |
## Training Dataset
|
|
|
|
| 101 |
|
| 102 |
Dataset characteristics:
|
| 103 |
|
| 104 |
+
* ~15,000 email-reply pairs
|
| 105 |
* Business and professional communication
|
| 106 |
* Cleaned and formatted into instruction-style prompts
|
| 107 |
|
|
|
|
| 127 |
* **Sequence length:** 512 tokens
|
| 128 |
* **Optimizer:** AdamW
|
| 129 |
* **Base architecture:** TinyLlama 1.1B
|
| 130 |
+
* **Quantization:** Q4_K_M
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
---
|
| 133 |
|