pavan01729 commited on
Commit
e0396b0
·
verified ·
1 Parent(s): 69d4a04

Update model card with comprehensive documentation

Browse files
Files changed (1) hide show
  1. README.md +106 -60
README.md CHANGED
@@ -1,65 +1,111 @@
1
  ---
2
- library_name: peft
3
- license: other
4
- base_model: meta-llama/Meta-Llama-3-8B-Instruct
5
  tags:
6
- - llama-factory
7
  - lora
8
- - generated_from_trainer
9
- model-index:
10
- - name: llama-traces
11
- results: []
 
12
  ---
13
 
14
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
15
- should probably proofread and complete it, then remove this comment. -->
16
-
17
- # llama-traces
18
-
19
- This model is a fine-tuned version of [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) on the test_tool_calling dataset.
20
- It achieves the following results on the evaluation set:
21
- - Loss: 0.2230
22
-
23
- ## Model description
24
-
25
- More information needed
26
-
27
- ## Intended uses & limitations
28
-
29
- More information needed
30
-
31
- ## Training and evaluation data
32
-
33
- More information needed
34
-
35
- ## Training procedure
36
-
37
- ### Training hyperparameters
38
-
39
- The following hyperparameters were used during training:
40
- - learning_rate: 5e-05
41
- - train_batch_size: 2
42
- - eval_batch_size: 2
43
- - seed: 42
44
- - gradient_accumulation_steps: 4
45
- - total_train_batch_size: 8
46
- - optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
47
- - lr_scheduler_type: cosine
48
- - lr_scheduler_warmup_ratio: 0.1
49
- - num_epochs: 5.0
50
-
51
- ### Training results
52
-
53
- | Training Loss | Epoch | Step | Validation Loss |
54
- |:-------------:|:------:|:----:|:---------------:|
55
- | 0.2127 | 2.5031 | 100 | 0.2533 |
56
- | 0.1242 | 5.0 | 200 | 0.2230 |
57
-
58
-
59
- ### Framework versions
60
-
61
- - PEFT 0.15.2
62
- - Transformers 4.52.4
63
- - Pytorch 2.6.0+cu124
64
- - Datasets 3.6.0
65
- - Tokenizers 0.21.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ license: mit
5
  tags:
 
6
  - lora
7
+ - tool-calling
8
+ - llama3
9
+ - instruction-tuning
10
+ - json-generation
11
+ base_model: meta-llama/Meta-Llama-3-8B-Instruct
12
  ---
13
 
14
+ # Tool-Calling LoRA for LLaMA-3-8B-Instruct
15
+
16
+ This is a LoRA (Low-Rank Adaptation) model fine-tuned on tool-calling datasets to enhance the model's ability to generate structured JSON responses for tool execution.
17
+
18
+ ## Model Details
19
+
20
+ - **Base Model**: meta-llama/Meta-Llama-3-8B-Instruct
21
+ - **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
22
+ - **LoRA Rank**: 16
23
+ - **LoRA Alpha**: 32
24
+ - **Training Dataset**: Custom tool-calling dataset with 357 samples
25
+ - **Training Epochs**: 5
26
+ - **Learning Rate**: 5.0e-5
27
+
28
+ ## Usage
29
+
30
+ ### Load the Model
31
+
32
+ ```python
33
+ from transformers import AutoTokenizer, AutoModelForCausalLM
34
+ from peft import PeftModel
35
+
36
+ # Load base model and tokenizer
37
+ base_model = AutoModelForCausalLM.from_pretrained(
38
+ "meta-llama/Meta-Llama-3-8B-Instruct",
39
+ torch_dtype=torch.bfloat16,
40
+ device_map="auto"
41
+ )
42
+ tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
43
+
44
+ # Load and merge LoRA
45
+ model = PeftModel.from_pretrained(base_model, "YOUR_USERNAME/llama-traces")
46
+ model = model.merge_and_unload()
47
+
48
+ # Generate tool-calling responses
49
+ def generate_tool_call(prompt):
50
+ inputs = tokenizer(prompt, return_tensors="pt")
51
+ outputs = model.generate(
52
+ **inputs,
53
+ max_new_tokens=512,
54
+ temperature=0.7,
55
+ do_sample=True,
56
+ pad_token_id=tokenizer.eos_token_id
57
+ )
58
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
59
+
60
+ # Example usage
61
+ prompt = "Check the weather in New York"
62
+ response = generate_tool_call(prompt)
63
+ print(response)
64
+ ```
65
+
66
+ ### Expected Output Format
67
+
68
+ The model generates structured JSON responses like:
69
+ ```json
70
+ {
71
+ "trace_id": "002",
72
+ "steps": [
73
+ {
74
+ "action": "call_api",
75
+ "api": "weather_api",
76
+ "arguments": {"location": "New York"}
77
+ },
78
+ {
79
+ "action": "respond",
80
+ "message": "The weather in New York is currently sunny with a temperature of 72°F."
81
+ }
82
+ ]
83
+ }
84
+ ```
85
+
86
+ ## Training Details
87
+
88
+ - **Dataset**: Custom tool-calling dataset with instruction/input/output format
89
+ - **Template**: llama3 chat template
90
+ - **Cutoff Length**: 4096 tokens
91
+ - **Batch Size**: 2 (effective batch size: 8 with gradient accumulation)
92
+ - **Optimizer**: AdamW with cosine learning rate scheduling
93
+ - **Warmup Ratio**: 0.1
94
+
95
+ ## Performance
96
+
97
+ The model shows improved capability in:
98
+ - Generating structured JSON responses
99
+ - Following tool-calling patterns
100
+ - Maintaining context for multi-step tool execution
101
+ - Producing consistent output formats
102
+
103
+ ## Limitations
104
+
105
+ - Requires the base LLaMA-3-8B-Instruct model to function
106
+ - May generate invalid JSON in some edge cases
107
+ - Performance depends on the quality of the training data
108
+
109
+ ## License
110
+
111
+ This model is released under the MIT License.