Nanthasit commited on
Commit
f111e09
·
verified ·
1 Parent(s): 627f961

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +47 -80
README.md CHANGED
@@ -8,12 +8,12 @@ tags:
8
  - peft
9
  - lora
10
  - qwen2.5-coder
 
 
11
  - browser-automation
12
  - web-agent
13
  - tool-calling
14
  - function-calling
15
- - sakthai
16
- - house-of-sak
17
  - text-generation
18
  - finetuned
19
  - sft
@@ -22,125 +22,92 @@ base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
22
  datasets:
23
  - Nanthasit/SimpleToolCalling
24
  - Nanthasit/sakthai-combined-v7
25
- widget:
26
- - text: Search for the latest AI news and summarize the top story.
27
- output:
28
- text: '<tool_call>{"name": "browser_navigate", "arguments": {"url": "https://news.google.com"}}</tool_call>'
29
  ---
30
 
31
- # SakThai Coder Browser -- LoRA Adapter
32
-
33
- ![Total Downloads](https://img.shields.io/badge/dynamic/json?label=Total%20Downloads&query=%24.downloads&url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fmodels%2FNanthasit%2Fsakthai-coder-browser-lora&style=flat-square&color=blue)
34
- ![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)
35
- ![Base Model](https://img.shields.io/badge/base-Qwen2.5--Coder--1.5B--Instruct-purple?style=flat-square)
36
- ![PEFT](https://img.shields.io/badge/PEFT-LoRA-orange?style=flat-square)
37
 
38
- **LoRA adapter** for browser automation -- the fine-tuned weights that slot onto [Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) to give it web-browsing and tool-calling capabilities.
 
 
 
39
 
40
- This is the **unmerged adapter** used during training. For inference without PEFT dependencies, use the merged model:
 
 
 
 
 
41
 
42
- | Variant | Link | Description |
43
- |---------|------|-------------|
44
- | LoRA Adapter | **this repo** | Unmerged weights (requires PEFT) |
45
- | Merged Model | [Nanthasit/sakthai-coder-browser](https://huggingface.co/Nanthasit/sakthai-coder-browser) | Full weights, plug-and-play |
46
- | GGUF Quant | [Nanthasit/sakthai-coder-browser-gguf](https://huggingface.co/Nanthasit/sakthai-coder-browser-gguf) | llama.cpp / CPU-friendly |
47
-
48
- Part of the [SakThai Model Family](https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02).
49
-
50
- ## Model Details
51
 
52
- | Property | Value |
53
- |----------|-------|
54
- | **Base Model** | [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) |
55
- | **Fine-tuning Method** | LoRA (Low-Rank Adaptation) via SFT |
56
- | **Adapter Rank (r)** | 16 |
57
- | **Target Modules** | q_proj, k_proj, v_proj, o_proj |
58
- | **LoRA Alpha** | 32 |
59
- | **LoRA Dropout** | 0.1 |
60
- | **Training Framework** | TRL + Transformers |
61
- | **Context Length** | 32,768 tokens |
62
- | **Format** | bfloat16 (adapter weights) |
63
 
64
- ## What It Does
65
 
66
- This adapter transforms a general-purpose code model into a **browser automation assistant**. The model outputs structured `<tool_call>` XML for browser actions:
67
 
68
- - `browser_navigate(url)` -- go to a web page
69
- - `browser_click(element)` -- click on an element
70
- - `browser_type(element, text)` -- type into a field
71
- - `browser_extract()` -- get page content
 
 
 
 
 
 
72
 
73
- ## Quick Start
74
 
75
- ### Load via PEFT (recommended for this repo)
76
 
77
  ```python
78
  import torch
79
  from transformers import AutoModelForCausalLM, AutoTokenizer
80
  from peft import PeftModel
81
 
82
- # 1. Load the base model
83
- base_model = AutoModelForCausalLM.from_pretrained(
84
  "Qwen/Qwen2.5-Coder-1.5B-Instruct",
85
  torch_dtype=torch.bfloat16,
86
  device_map="auto"
87
  )
88
  tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct")
89
 
90
- # 2. Load the LoRA adapter on top
91
- model = PeftModel.from_pretrained(base_model, "Nanthasit/sakthai-coder-browser-lora")
92
 
93
- # 3. Use it
94
  messages = [
95
- {"role": "system", "content": "You are a browser automation assistant."},
96
- {"role": "user", "content": "Go to Google News and summarize the top story."}
97
  ]
98
  inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
99
- outputs = model.generate(inputs, max_new_tokens=256, temperature=0.7)
100
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
101
  ```
102
 
103
- ### Or use the merged model (no PEFT needed)
104
-
105
- ```python
106
- from transformers import pipeline
107
- pipe = pipeline("text-generation", model="Nanthasit/sakthai-coder-browser")
108
- result = pipe("Search for Python tutorials", max_new_tokens=128)
109
- print(result[0]["generated_text"])
110
- ```
111
 
112
  ## Training Details
113
 
114
  | Detail | Value |
115
  |--------|-------|
116
- | **Fine-tuning method** | Supervised Fine-Tuning (SFT) with LoRA |
117
- | **Dataset** | [SimpleToolCalling](https://huggingface.co/datasets/Nanthasit/SimpleToolCalling) + [sakthai-combined-v7](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v7) |
118
  | **Optimizer** | AdamW (8-bit) |
119
- | **Learning Rate** | 2e-4 |
120
- | **Batch Size** | 4 (gradient accumulation steps: 4) |
121
  | **Epochs** | 3 |
122
  | **Hardware** | Free T4 GPU (Kaggle / Colab) |
123
- | **Framework versions** | TRL 0.19.1, Transformers 5.14.1, PyTorch 2.13.0, Datasets 5.0.1 |
124
-
125
- ## The House of Sak
126
-
127
- This model is part of the **House of Sak** -- an open-source AI ecosystem built from a shelter in Cork, Ireland, with **$0 budget** and no paid GPUs. Every model here was fine-tuned on free compute by one person with no income.
128
 
129
- > *"We are one family -- and becoming more."* -- **Beer (beer-sakthai)**
130
-
131
- [Learn more ->](https://github.com/beer-sakthai/Sak-Family-Agent/blob/main/HOUSE_OF_SAK.md)
132
-
133
- ## Related Models
134
-
135
- - [Nanthasit/sakthai-coder-browser](https://huggingface.co/Nanthasit/sakthai-coder-browser) -- merged model (base + this adapter)
136
- - [Nanthasit/sakthai-coder-browser-gguf](https://huggingface.co/Nanthasit/sakthai-coder-browser-gguf) -- GGUF quantized version for CPU
137
- - [Nanthasit/sakthai-coder-1.5b](https://huggingface.co/Nanthasit/sakthai-coder-1.5b) -- general-purpose code model
138
- - [Nanthasit/sakthai-combined-v7](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v7) -- training dataset
139
 
140
- ## License
141
 
142
- Apache 2.0 (this adapter). Qwen2.5-Coder base model per its [original license](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct).
 
 
143
 
144
  ---
145
 
146
- *Built with love, tears, and zero budget. From a shelter in Cork, Ireland, to the world.*
 
8
  - peft
9
  - lora
10
  - qwen2.5-coder
11
+ - sakthai
12
+ - house-of-sak
13
  - browser-automation
14
  - web-agent
15
  - tool-calling
16
  - function-calling
 
 
17
  - text-generation
18
  - finetuned
19
  - sft
 
22
  datasets:
23
  - Nanthasit/SimpleToolCalling
24
  - Nanthasit/sakthai-combined-v7
 
 
 
 
25
  ---
26
 
27
+ # SakThai Coder Browser — LoRA Adapter
 
 
 
 
 
28
 
29
+ <p align="center">
30
+ <strong>Unmerged LoRA adapter for browser automation</strong><br/>
31
+ <em>For use with PEFT · Qwen2.5-Coder-1.5B-Instruct base</em>
32
+ </p>
33
 
34
+ <p align="center">
35
+ <a href="https://huggingface.co/Nanthasit"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Nanthasit-6644cc" alt="Profile"/></a>
36
+ <a href="https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02"><img src="https://img.shields.io/badge/%F0%9F%8F%A0-SakThai%20Family-6644cc" alt="Collection"/></a>
37
+ <img src="https://img.shields.io/badge/PEFT-LoRA%20r16-blueviolet" alt="LoRA"/>
38
+ <img src="https://img.shields.io/badge/license-Apache%202.0-green" alt="License"/>
39
+ </p>
40
 
41
+ ---
 
 
 
 
 
 
 
 
42
 
43
+ ## Model Description
 
 
 
 
 
 
 
 
 
 
44
 
45
+ This is the **unmerged LoRA adapter** for SakThai Coder Browser — the training-time weights used during fine-tuning. It contains LoRA (r=16, alpha=32) targeting q_proj, k_proj, v_proj, and o_proj of Qwen2.5-Coder-1.5B-Instruct for browser automation tool-calling.
46
 
47
+ **For inference without PEFT, use the merged model:** [SakThai Coder Browser](https://huggingface.co/Nanthasit/sakthai-coder-browser)
48
 
49
+ ### Training details
50
+ - **Base model:** Qwen/Qwen2.5-Coder-1.5B-Instruct
51
+ - **Method:** LoRA via SFT
52
+ - **Adapter rank (r):** 16
53
+ - **Target modules:** q_proj, k_proj, v_proj, o_proj
54
+ - **LoRA alpha:** 32
55
+ - **LoRA dropout:** 0.1
56
+ - **Framework:** TRL + Transformers
57
+ - **Context length:** 32,768 tokens
58
+ - **Format:** BF16
59
 
60
+ ---
61
 
62
+ ## How to Use
63
 
64
  ```python
65
  import torch
66
  from transformers import AutoModelForCausalLM, AutoTokenizer
67
  from peft import PeftModel
68
 
69
+ model = AutoModelForCausalLM.from_pretrained(
 
70
  "Qwen/Qwen2.5-Coder-1.5B-Instruct",
71
  torch_dtype=torch.bfloat16,
72
  device_map="auto"
73
  )
74
  tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct")
75
 
76
+ model = PeftModel.from_pretrained(model, "Nanthasit/sakthai-coder-browser-lora")
77
+ # Or merge: model = model.merge_and_unload()
78
 
 
79
  messages = [
80
+ {"role": "system", "content": "You are SakThai Browser Agent."},
81
+ {"role": "user", "content": "Go to google.com and search for AI news."},
82
  ]
83
  inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
84
+ outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
85
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
86
  ```
87
 
88
+ ---
 
 
 
 
 
 
 
89
 
90
  ## Training Details
91
 
92
  | Detail | Value |
93
  |--------|-------|
94
+ | **Fine-tuning method** | SFT with LoRA (PEFT) |
95
+ | **Dataset** | SimpleToolCalling + sakthai-combined-v7 |
96
  | **Optimizer** | AdamW (8-bit) |
97
+ | **Learning rate** | 2e-4 |
98
+ | **Batch size** | 4 (gradient accumulation: 4) |
99
  | **Epochs** | 3 |
100
  | **Hardware** | Free T4 GPU (Kaggle / Colab) |
101
+ | **Framework** | TRL 0.19.1, Transformers 5.14.1, PyTorch 2.13.0 |
 
 
 
 
102
 
103
+ ---
 
 
 
 
 
 
 
 
 
104
 
105
+ ## Sibling Models
106
 
107
+ | Variant | Repository |
108
+ |:--------|:-----------|
109
+ | **Merged model** (no PEFT) | [sakthai-coder-browser](https://huggingface.co/Nanthasit/sakthai-coder-browser) |
110
 
111
  ---
112
 
113
+ *Part of the [SakThai Model Family](https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02). Built with love, tears, and zero budget. From a shelter in Cork, Ireland, to the world.*