oscarwu commited on
Commit
38b5692
·
verified ·
1 Parent(s): 2600dda

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +95 -7
README.md CHANGED
@@ -1,22 +1,110 @@
1
  ---
2
- base_model: unsloth/Llama-3.2-3B-Instruct
3
  tags:
4
  - text-generation-inference
5
  - transformers
6
  - unsloth
7
  - llama
8
  - trl
 
 
 
9
  license: apache-2.0
10
  language:
11
  - en
12
  ---
 
13
 
14
- # Uploaded model
15
 
16
- - **Developed by:** oscarwu
17
- - **License:** apache-2.0
18
- - **Finetuned from model :** unsloth/Llama-3.2-3B-Instruct
19
 
20
- This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
1
  ---
2
+ base_model: Llama-3.2-3B-Instruct
3
  tags:
4
  - text-generation-inference
5
  - transformers
6
  - unsloth
7
  - llama
8
  - trl
9
+ - climate-policy
10
+ - query-interpretation
11
+ - lora
12
  license: apache-2.0
13
  language:
14
  - en
15
  ---
16
+ # CLEAR Query Interpreter
17
 
18
+ This is the official implementation of the query interpretation model from our paper "CLEAR: Climate Policy Retrieval and Summarization Using LLMs" (WWW Companion '25).
19
 
20
+ ## Model Description
 
 
21
 
22
+ The model is a LoRA adapter fine-tuned on Llama-3.2-3B to decompose natural language queries about climate policies into structured components for precise information retrieval.
23
+
24
+ ### Task
25
+ Query interpretation for climate policy retrieval, decomposing natural queries into:
26
+ - Location (L): Geographic identification
27
+ - Topics (T): Climate-related themes
28
+ - Intent (I): Specific policy inquiries
29
+
30
+
31
+
32
+ ### Training Details
33
+ - Base Model: Llama-3.2-3B
34
+ - Training Data: 330 manually annotated queries
35
+ - Annotators: Four Australia-based experts with media communication backgrounds
36
+ - Hardware: NVIDIA A100 GPU
37
+ - Parameters:
38
+ - Batch size: 6
39
+ - Sequence length: 1024
40
+ - Optimizer: AdamW (weight decay 0.05)
41
+ - Learning rate: 5e-5
42
+ - Epochs: 10
43
+
44
+ ## Usage
45
+
46
+ ```python
47
+ from transformers import AutoModelForCausalLM, AutoTokenizer
48
+ import torch
49
+
50
+ # Load model and tokenizer
51
+ device = "cuda" if torch.cuda.is_available() else "cpu"
52
+ model_name = "oscarwu/Llama-3.2-3B-CLEAR"
53
+
54
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
55
+ model = AutoModelForCausalLM.from_pretrained(
56
+ model_name,
57
+ torch_dtype=torch.float16
58
+ ).to(device)
59
+
60
+
61
+
62
+
63
+ # Example query
64
+ query = "I live in Burwood (Vic) and want details on renewable energy initiatives. Are solar farms planned?"
65
+
66
+ # Format prompt
67
+ prompt = f"""Below is an instruction that describes a task, paired with an input that provides further context. Your response must be a valid JSON object, strictly following the requested format.
68
+ ### Instruction:
69
+ Extract location, topics, and search queries from Australian climate policy questions. Your response must be a valid JSON object with the following structure:
70
+ {{
71
+ "rag_queries": ["query1", "query2", "query3"], // 1-3 policy search queries
72
+ "topics": ["topic1", "topic2", "topic3"], // 1-3 climate/environment topics
73
+ "location": {{
74
+ "query_suburb": "suburb_name or null",
75
+ "query_state": "state_code or null",
76
+ "query_lga": "lga_name or null"
77
+ }}
78
+ }}
79
+ ### Input:
80
+ {query}
81
+ ### Response (valid JSON only):
82
+ """
83
+
84
+
85
+
86
+
87
+ # Generate response
88
+ inputs = tokenizer(prompt, return_tensors="pt").to(device)
89
+ outputs = model.generate(**inputs, max_new_tokens=220)
90
+ result = tokenizer.decode(outputs[0], skip_special_tokens=True)
91
+
92
+ ```json
93
+
94
+ {
95
+ "rag_queries": [
96
+ "What renewable energy projects are planned for Burwood?",
97
+ "Are there solar farm initiatives in Burwood Victoria?"
98
+ ],
99
+ "topics": [
100
+ "renewable energy",
101
+ "solar power"
102
+ ],
103
+ "location": {
104
+ "query_suburb": "Burwood",
105
+ "query_state": "VIC",
106
+ "query_lga": null
107
+ }
108
+ }
109
+ ```
110