hamel commited on
Commit
4a9c26f
1 Parent(s): e3a3c44

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -68
README.md CHANGED
@@ -10,11 +10,10 @@ model-index:
10
  results: []
11
  ---
12
 
13
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
14
- should probably proofread and complete it, then remove this comment. -->
15
-
16
  [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
17
- <details><summary>See axolotl config</summary>
 
 
18
 
19
  axolotl version: `0.3.0`
20
  ```yaml
@@ -107,75 +106,65 @@ special_tokens:
107
  eos_token: "</s>"
108
  unk_token: "<unk>"
109
  save_safetensors: true
 
 
 
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  ```
112
 
113
- </details><br>
114
 
115
- # hc-mistral-alpaca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- This model is a fine-tuned version of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) on the None dataset.
118
- It achieves the following results on the evaluation set:
119
- - Loss: 0.0283
120
-
121
- ## Model description
122
-
123
- More information needed
124
-
125
- ## Intended uses & limitations
126
-
127
- More information needed
128
-
129
- ## Training and evaluation data
130
-
131
- More information needed
132
-
133
- ## Training procedure
134
-
135
-
136
- The following `bitsandbytes` quantization config was used during training:
137
- - quant_method: bitsandbytes
138
- - load_in_8bit: False
139
- - load_in_4bit: True
140
- - llm_int8_threshold: 6.0
141
- - llm_int8_skip_modules: None
142
- - llm_int8_enable_fp32_cpu_offload: False
143
- - llm_int8_has_fp16_weight: False
144
- - bnb_4bit_quant_type: nf4
145
- - bnb_4bit_use_double_quant: True
146
- - bnb_4bit_compute_dtype: bfloat16
147
-
148
- ### Training hyperparameters
149
-
150
- The following hyperparameters were used during training:
151
- - learning_rate: 0.0002
152
- - train_batch_size: 16
153
- - eval_batch_size: 16
154
- - seed: 49
155
- - gradient_accumulation_steps: 4
156
- - total_train_batch_size: 64
157
- - optimizer: Adam with betas=(0.9,0.95) and epsilon=1e-05
158
- - lr_scheduler_type: cosine
159
- - lr_scheduler_warmup_steps: 20
160
- - num_epochs: 3
161
-
162
- ### Training results
163
-
164
- | Training Loss | Epoch | Step | Validation Loss |
165
- |:-------------:|:-----:|:----:|:---------------:|
166
- | 1.167 | 0.0 | 1 | 1.1641 |
167
- | 0.0518 | 0.25 | 450 | 0.0565 |
168
- | 0.0386 | 0.5 | 900 | 0.0414 |
169
- | 0.0314 | 0.75 | 1350 | 0.0357 |
170
- | 0.0278 | 1.0 | 1800 | 0.0326 |
171
- | 0.0217 | 1.25 | 2250 | 0.0311 |
172
- | 0.0206 | 1.5 | 2700 | 0.0296 |
173
- | 0.0175 | 1.75 | 3150 | 0.0285 |
174
- | 0.0271 | 2.0 | 3600 | 0.0274 |
175
- | 0.0146 | 2.25 | 4050 | 0.0288 |
176
- | 0.0126 | 2.5 | 4500 | 0.0284 |
177
- | 0.0168 | 2.75 | 4950 | 0.0284 |
178
- | 0.0118 | 3.0 | 5400 | 0.0283 |
179
 
180
 
181
  ### Framework versions
 
10
  results: []
11
  ---
12
 
 
 
 
13
  [<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
14
+
15
+
16
+ # Axolotl Config
17
 
18
  axolotl version: `0.3.0`
19
  ```yaml
 
106
  eos_token: "</s>"
107
  unk_token: "<unk>"
108
  save_safetensors: true
109
+ ```
110
+
111
+ # hc-mistral-alpaca
112
 
113
+ This model is a fine-tuned version of [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1).
114
+
115
+ See this [wandb run](https://wandb.ai/hamelsmu/hc-axolotl-mistral/runs/7dq9l9vu/overview) to see training metrics.
116
+
117
+ # Usage
118
+
119
+ You can use this model with the following code:
120
+
121
+ First, download the model
122
+
123
+ ```python
124
+ from peft import AutoPeftModelForCausalLM
125
+ from transformers import AutoTokenizer
126
+ model_id='parlance-labs/hc-mistral-alpaca'
127
+ model = AutoPeftModelForCausalLM.from_pretrained(model_id).cuda()
128
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
129
+ tokenizer.pad_token = tokenizer.eos_token
130
  ```
131
 
132
+ Then, construct the prompt template like so:
133
 
134
+ ```python
135
+ def prompt(nlq, cols):
136
+ return f"""Honeycomb is an observability platform that allows you to write queries to inspect trace data. You are an assistant that takes a natural language query (NLQ) and a list of valid columns and produce a Honeycomb query.
137
+
138
+ ### Instruction:
139
+
140
+ NLQ: "{nlq}"
141
+
142
+ Columns: {cols}
143
+
144
+ ### Response:
145
+ """
146
+
147
+ def prompt_tok(nlq, cols):
148
+ _p = prompt(nlq, cols)
149
+ input_ids = tokenizer(_p, return_tensors="pt", truncation=True).input_ids.cuda()
150
+ out_ids = model.generate(input_ids=input_ids, max_new_tokens=5000,
151
+ do_sample=False)
152
+ return tokenizer.batch_decode(out_ids.detach().cpu().numpy(),
153
+ skip_special_tokens=True)[0][len(_p):]
154
+ ```
155
+
156
+ Finally, you can get predictions like this:
157
+
158
+ ```python
159
+ nlq = "Exception count by exception and caller"
160
+ cols = ['error', 'exception.message', 'exception.type', 'exception.stacktrace', 'SampleRate', 'name', 'db.user', 'type', 'duration_ms', 'db.name', 'service.name', 'http.method', 'db.system', 'status_code', 'db.operation', 'library.name', 'process.pid', 'net.transport', 'messaging.system', 'rpc.system', 'http.target', 'db.statement', 'library.version', 'status_message', 'parent_name', 'aws.region', 'process.command', 'rpc.method', 'span.kind', 'serializer.name', 'net.peer.name', 'rpc.service', 'http.scheme', 'process.runtime.name', 'serializer.format', 'serializer.renderer', 'net.peer.port', 'process.runtime.version', 'http.status_code', 'telemetry.sdk.language', 'trace.parent_id', 'process.runtime.description', 'span.num_events', 'messaging.destination', 'net.peer.ip', 'trace.trace_id', 'telemetry.instrumentation_library', 'trace.span_id', 'span.num_links', 'meta.signal_type', 'http.route']
161
+ ```
162
+
163
+ Alternatively, you can play with this model on Replicate: [hamelsmu/honeycomb-2](https://replicate.com/hamelsmu/honeycomb-2)
164
+
165
+ # Hosted Inference
166
 
167
+ This model is hosted on Replicate: (hamelsmu/honeycomb-2)[https://replicate.com/hamelsmu/honeycomb-2], using [this config](https://github.com/hamelsmu/replicate-examples/tree/master/mistral-transformers-2).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
 
169
 
170
  ### Framework versions