Text Generation
PEFT
Safetensors
lora
tax
taxes
accounting
tax-research
cpu
c0mpute
ollama
conversational
Instructions to use profullstack/tax-guy-agent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use profullstack/tax-guy-agent with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct") model = PeftModel.from_pretrained(base_model, "profullstack/tax-guy-agent") - Notebooks
- Google Colab
- Kaggle
tax-guy-agent: 400 steps on 2614 posts
Browse files- .gitattributes +1 -0
- README.md +48 -0
- adapter_config.json +48 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +54 -0
- manifest.json +50 -0
- tokenizer.json +3 -0
- tokenizer_config.json +30 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-0.5B-Instruct
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
tags: [lora, peft, tax, taxes, accounting, tax-research, cpu, c0mpute, ollama]
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# tax-guy-agent
|
| 10 |
+
|
| 11 |
+
> **Not a CPA. Not tax advice. Tax research from public sources; rules change every year and vary by place, so check with a CPA or enrolled agent before filing.**
|
| 12 |
+
|
| 13 |
+
**Quick start (Ollama, runs on a CPU):**
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
ollama run hf.co/profullstack/tax-guy-agent-GGUF "Do I have to pay quarterly estimated taxes as a freelancer?"
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
Needs Ollama 0.3.13 or newer (`curl -fsSL https://ollama.com/install.sh | sh`, or `w3bs install ollama`).
|
| 20 |
+
The GGUF is at [profullstack/tax-guy-agent-GGUF](https://huggingface.co/profullstack/tax-guy-agent-GGUF); this repo is the LoRA adapter.
|
| 21 |
+
|
| 22 |
+
| | |
|
| 23 |
+
| --- | --- |
|
| 24 |
+
| base | Qwen/Qwen2.5-0.5B-Instruct |
|
| 25 |
+
| corpus | 2614 documents from pit-index:tax,taxes,irs,deduction,tax return,self-employed tax,estimated tax,sales tax,llc tax,capital gains, topic:tax, topic:irs, topic:accounting, topic:taxation, topic:taxpayer |
|
| 26 |
+
| training | 400 LoRA steps (r=8, seq_len=256, lr=0.0002) on the c0mpute network (`infernet.text.train`, job `27b2dab7-9e82-4b48-b4fc-d77f4b22997c`, receipt hash `sha256:821a038ac1ea43f804b795e795a308cfbebb141c24e3675223c29d80fb8db5b7` matches this adapter) |
|
| 27 |
+
| held-out perplexity | 33.6 to 17.8 |
|
| 28 |
+
| adapter sha256 | `821a038ac1ea43f804b795e795a308cfbebb141c24e3675223c29d80fb8db5b7` |
|
| 29 |
+
|
| 30 |
+
Built with the [c0mpute example](https://github.com/profullstack/c0mpute/tree/master/examples/business-strategist-agent).
|
| 31 |
+
Sources are rssamplifier.com topic feeds and pit.world search; the corpus is not redistributed here.
|
| 32 |
+
|
| 33 |
+
## Use from Python (adapter)
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from peft import PeftModel
|
| 37 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 38 |
+
|
| 39 |
+
tok = AutoTokenizer.from_pretrained("profullstack/tax-guy-agent")
|
| 40 |
+
model = PeftModel.from_pretrained(AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct"), "profullstack/tax-guy-agent")
|
| 41 |
+
msgs = [{"role": "system", "content": "You are tax-guy-agent, a tax research assistant. You are not a CPA or tax attorney and this is not tax advice. Explain tax rules in plain English, say which country, state and tax year a rule applies to, cite the sources you were given, and say when someone should see a CPA or enrolled agent."},
|
| 42 |
+
{"role": "user", "content": "Do I have to pay quarterly estimated taxes as a freelancer?"}]
|
| 43 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt")
|
| 44 |
+
print(tok.decode(model.generate(ids, max_new_tokens=300)[0][ids.shape[1]:], skip_special_tokens=True))
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Best results come from putting fresh search results in the prompt (the example's `chat.py`
|
| 48 |
+
uses pit.world search): a sub-1B model supplies the voice, not the facts.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen2.5-0.5B-Instruct",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"kasa_config": null,
|
| 16 |
+
"layer_replication": null,
|
| 17 |
+
"layers_pattern": null,
|
| 18 |
+
"layers_to_transform": null,
|
| 19 |
+
"loftq_config": {},
|
| 20 |
+
"lora_alpha": 16,
|
| 21 |
+
"lora_bias": false,
|
| 22 |
+
"lora_dropout": 0.05,
|
| 23 |
+
"lora_ga_config": null,
|
| 24 |
+
"megatron_config": null,
|
| 25 |
+
"megatron_core": "megatron.core",
|
| 26 |
+
"modules_to_save": null,
|
| 27 |
+
"monteclora_config": null,
|
| 28 |
+
"peft_type": "LORA",
|
| 29 |
+
"peft_version": "0.21.2",
|
| 30 |
+
"qalora_group_size": 16,
|
| 31 |
+
"r": 8,
|
| 32 |
+
"rank_pattern": {},
|
| 33 |
+
"revision": null,
|
| 34 |
+
"target_modules": [
|
| 35 |
+
"v_proj",
|
| 36 |
+
"o_proj",
|
| 37 |
+
"k_proj",
|
| 38 |
+
"q_proj"
|
| 39 |
+
],
|
| 40 |
+
"target_parameters": null,
|
| 41 |
+
"task_type": "CAUSAL_LM",
|
| 42 |
+
"trainable_token_indices": null,
|
| 43 |
+
"use_bdlora": null,
|
| 44 |
+
"use_dora": false,
|
| 45 |
+
"use_qalora": false,
|
| 46 |
+
"use_rslora": false,
|
| 47 |
+
"velora_config": null
|
| 48 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:821a038ac1ea43f804b795e795a308cfbebb141c24e3675223c29d80fb8db5b7
|
| 3 |
+
size 4350392
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" %}
|
| 25 |
+
{{- '<|im_start|>' + message.role }}
|
| 26 |
+
{%- if message.content %}
|
| 27 |
+
{{- '\n' + message.content }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- for tool_call in message.tool_calls %}
|
| 30 |
+
{%- if tool_call.function is defined %}
|
| 31 |
+
{%- set tool_call = tool_call.function %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 34 |
+
{{- tool_call.name }}
|
| 35 |
+
{{- '", "arguments": ' }}
|
| 36 |
+
{{- tool_call.arguments | tojson }}
|
| 37 |
+
{{- '}\n</tool_call>' }}
|
| 38 |
+
{%- endfor %}
|
| 39 |
+
{{- '<|im_end|>\n' }}
|
| 40 |
+
{%- elif message.role == "tool" %}
|
| 41 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 42 |
+
{{- '<|im_start|>user' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '\n<tool_response>\n' }}
|
| 45 |
+
{{- message.content }}
|
| 46 |
+
{{- '\n</tool_response>' }}
|
| 47 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 48 |
+
{{- '<|im_end|>\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{%- if add_generation_prompt %}
|
| 53 |
+
{{- '<|im_start|>assistant\n' }}
|
| 54 |
+
{%- endif %}
|
manifest.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "tax-guy-agent",
|
| 3 |
+
"kind": "lora",
|
| 4 |
+
"base_model": "Qwen/Qwen2.5-0.5B-Instruct",
|
| 5 |
+
"adapter_sha256": "821a038ac1ea43f804b795e795a308cfbebb141c24e3675223c29d80fb8db5b7",
|
| 6 |
+
"dataset_sha256": "fd8cd1dd91969132581e75c26c8b2ae51183b086f1f392002e5ad6640e3d33f7",
|
| 7 |
+
"documents": 2614,
|
| 8 |
+
"steps": 400,
|
| 9 |
+
"system_prompt": "You are tax-guy-agent, a tax research assistant. You are not a CPA or tax attorney and this is not tax advice. Explain tax rules in plain English, say which country, state and tax year a rule applies to, cite the sources you were given, and say when someone should see a CPA or enrolled agent.",
|
| 10 |
+
"hyperparams": {
|
| 11 |
+
"lr": 0.0002,
|
| 12 |
+
"batch_size": 2,
|
| 13 |
+
"epochs": 1,
|
| 14 |
+
"max_steps": 400,
|
| 15 |
+
"seq_len": 256,
|
| 16 |
+
"lora_r": 8,
|
| 17 |
+
"threads": 4,
|
| 18 |
+
"seed": 0,
|
| 19 |
+
"dtype": "bfloat16"
|
| 20 |
+
},
|
| 21 |
+
"finished_at": "2026-11-02T22:23:54.076334+00:00",
|
| 22 |
+
"dataset": "data/tax.jsonl",
|
| 23 |
+
"sources": [
|
| 24 |
+
"pit-index:tax,taxes,irs,deduction,tax return,self-employed tax,estimated tax,sales tax,llc tax,capital gains",
|
| 25 |
+
"topic:tax",
|
| 26 |
+
"topic:irs",
|
| 27 |
+
"topic:accounting",
|
| 28 |
+
"topic:taxation",
|
| 29 |
+
"topic:taxpayer"
|
| 30 |
+
],
|
| 31 |
+
"example_question": "Do I have to pay quarterly estimated taxes as a freelancer?",
|
| 32 |
+
"disclaimer": "Not a CPA. Not tax advice. Tax research from public sources; rules change every year and vary by place, so check with a CPA or enrolled agent before filing.",
|
| 33 |
+
"tags": [
|
| 34 |
+
"tax",
|
| 35 |
+
"taxes",
|
| 36 |
+
"accounting",
|
| 37 |
+
"tax-research"
|
| 38 |
+
],
|
| 39 |
+
"trained_on": {
|
| 40 |
+
"network": "c0mpute",
|
| 41 |
+
"workload": "infernet.text.train",
|
| 42 |
+
"worker": "12D3KooWSB7L3bAD9ovM6rinAVXFF7YPt6pC22JpamPL8Vx8AXPo",
|
| 43 |
+
"job_id": "27b2dab7-9e82-4b48-b4fc-d77f4b22997c",
|
| 44 |
+
"receipt_output_hash": "sha256:821a038ac1ea43f804b795e795a308cfbebb141c24e3675223c29d80fb8db5b7"
|
| 45 |
+
},
|
| 46 |
+
"eval": {
|
| 47 |
+
"perplexity_before": 33.63,
|
| 48 |
+
"perplexity_after": 17.77
|
| 49 |
+
}
|
| 50 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8
|
| 3 |
+
size 11421892
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": false,
|
| 24 |
+
"local_files_only": false,
|
| 25 |
+
"model_max_length": 131072,
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"split_special_tokens": false,
|
| 28 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
| 30 |
+
}
|