Upload llama3.1-8b-lora-qlora-dart-llm LoRA adapter
Browse files
README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
library_name: peft
|
| 3 |
base_model: meta-llama/Llama-3.1-8B
|
| 4 |
tags:
|
|
@@ -9,15 +10,15 @@ tags:
|
|
| 9 |
- robotics
|
| 10 |
- task-planning
|
| 11 |
- construction
|
| 12 |
-
|
| 13 |
language:
|
| 14 |
- en
|
| 15 |
pipeline_tag: text-generation
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# Llama 3.1 8B - Robot Task Planning (QLoRA Fine-tuned)
|
| 19 |
|
| 20 |
-
This model is a QLoRA fine-tuned version of
|
| 21 |
|
| 22 |
The model converts natural language commands into structured task sequences for construction robots including excavators and dump trucks.
|
| 23 |
|
|
@@ -25,27 +26,43 @@ The model converts natural language commands into structured task sequences for
|
|
| 25 |
|
| 26 |
- **Base Model**: meta-llama/Llama-3.1-8B
|
| 27 |
- **Fine-tuning Method**: QLoRA (4-bit quantization + LoRA)
|
| 28 |
-
- **LoRA Rank**: 16
|
| 29 |
-
- **LoRA Alpha**: 32
|
| 30 |
- **Target Modules**: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
|
|
|
|
|
|
|
| 31 |
|
| 32 |
## Usage
|
| 33 |
|
| 34 |
```python
|
| 35 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 36 |
from peft import PeftModel
|
|
|
|
| 37 |
|
| 38 |
# Load tokenizer and base model
|
| 39 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B")
|
| 40 |
-
base_model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# Load LoRA adapter
|
| 43 |
-
model = PeftModel.from_pretrained(base_model, "YongdongWang/
|
| 44 |
|
| 45 |
# Generate robot task sequence
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 50 |
print(response)
|
| 51 |
```
|
|
@@ -54,10 +71,10 @@ print(response)
|
|
| 54 |
|
| 55 |
- **Training Data**: DART LLM Tasks - Robot command and task planning dataset
|
| 56 |
- **Domain**: Construction robotics (excavators, dump trucks, soil/rock areas)
|
| 57 |
-
- **Training Epochs**:
|
| 58 |
-
- **Batch Size**:
|
| 59 |
-
- **Learning Rate**:
|
| 60 |
-
- **Optimizer**: paged_adamw_8bit
|
| 61 |
|
| 62 |
## Capabilities
|
| 63 |
|
|
@@ -68,8 +85,45 @@ print(response)
|
|
| 68 |
|
| 69 |
## Example Output
|
| 70 |
|
| 71 |
-
The model generates structured task sequences in JSON format for robot execution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
## Limitations
|
| 74 |
|
| 75 |
-
This model is specifically trained for construction robotics scenarios and may not generalize to other domains without additional fine-tuning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: llama3.1
|
| 3 |
library_name: peft
|
| 4 |
base_model: meta-llama/Llama-3.1-8B
|
| 5 |
tags:
|
|
|
|
| 10 |
- robotics
|
| 11 |
- task-planning
|
| 12 |
- construction
|
| 13 |
+
- dart-llm
|
| 14 |
language:
|
| 15 |
- en
|
| 16 |
pipeline_tag: text-generation
|
| 17 |
---
|
| 18 |
|
| 19 |
+
# Llama 3.1 8B - DART LLM Robot Task Planning (QLoRA Fine-tuned)
|
| 20 |
|
| 21 |
+
This model is a QLoRA fine-tuned version of **meta-llama/Llama-3.1-8B** specialized for **robot task planning** in construction environments.
|
| 22 |
|
| 23 |
The model converts natural language commands into structured task sequences for construction robots including excavators and dump trucks.
|
| 24 |
|
|
|
|
| 26 |
|
| 27 |
- **Base Model**: meta-llama/Llama-3.1-8B
|
| 28 |
- **Fine-tuning Method**: QLoRA (4-bit quantization + LoRA)
|
| 29 |
+
- **LoRA Rank**: 16-32 (optimized per model size)
|
| 30 |
+
- **LoRA Alpha**: 16-32
|
| 31 |
- **Target Modules**: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
|
| 32 |
+
- **Dataset**: YongdongWang/dart_llm_tasks_pretty
|
| 33 |
+
- **Training Domain**: Construction robotics
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|
| 37 |
```python
|
| 38 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 39 |
from peft import PeftModel
|
| 40 |
+
import torch
|
| 41 |
|
| 42 |
# Load tokenizer and base model
|
| 43 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B")
|
| 44 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 45 |
+
"meta-llama/Llama-3.1-8B",
|
| 46 |
+
torch_dtype=torch.float16,
|
| 47 |
+
device_map="auto"
|
| 48 |
+
)
|
| 49 |
|
| 50 |
# Load LoRA adapter
|
| 51 |
+
model = PeftModel.from_pretrained(base_model, "YongdongWang/llama3.1-8b-lora-qlora-dart-llm")
|
| 52 |
|
| 53 |
# Generate robot task sequence
|
| 54 |
+
instruction = "Deploy Excavator 1 to Soil Area 1 for excavation"
|
| 55 |
+
prompt = f"### Instruction:\n{instruction}\n\n### Response:\n"
|
| 56 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 57 |
+
|
| 58 |
+
with torch.no_grad():
|
| 59 |
+
outputs = model.generate(
|
| 60 |
+
**inputs,
|
| 61 |
+
max_new_tokens=512,
|
| 62 |
+
do_sample=False,
|
| 63 |
+
pad_token_id=tokenizer.eos_token_id
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 67 |
print(response)
|
| 68 |
```
|
|
|
|
| 71 |
|
| 72 |
- **Training Data**: DART LLM Tasks - Robot command and task planning dataset
|
| 73 |
- **Domain**: Construction robotics (excavators, dump trucks, soil/rock areas)
|
| 74 |
+
- **Training Epochs**: 6-12 (optimized per model size)
|
| 75 |
+
- **Batch Size**: 1 (with gradient accumulation)
|
| 76 |
+
- **Learning Rate**: 1e-4 to 3e-4 (scaled by model size)
|
| 77 |
+
- **Optimizer**: paged_adamw_8bit or adamw_torch
|
| 78 |
|
| 79 |
## Capabilities
|
| 80 |
|
|
|
|
| 85 |
|
| 86 |
## Example Output
|
| 87 |
|
| 88 |
+
The model generates structured task sequences in JSON format for robot execution:
|
| 89 |
+
|
| 90 |
+
```json
|
| 91 |
+
{
|
| 92 |
+
"tasks": [
|
| 93 |
+
{
|
| 94 |
+
"instruction_function": {
|
| 95 |
+
"dependencies": [],
|
| 96 |
+
"name": "target_area_for_specific_robots",
|
| 97 |
+
"object_keywords": ["soil_area_1"],
|
| 98 |
+
"robot_ids": ["robot_excavator_01"],
|
| 99 |
+
"robot_type": null
|
| 100 |
+
},
|
| 101 |
+
"task": "target_area_for_specific_robots_1"
|
| 102 |
+
}
|
| 103 |
+
]
|
| 104 |
+
}
|
| 105 |
+
```
|
| 106 |
|
| 107 |
## Limitations
|
| 108 |
|
| 109 |
+
This model is specifically trained for construction robotics scenarios and may not generalize to other domains without additional fine-tuning.
|
| 110 |
+
|
| 111 |
+
## Citation
|
| 112 |
+
|
| 113 |
+
```bibtex
|
| 114 |
+
@misc{llama3.1_8b_lora_qlora_dart_llm,
|
| 115 |
+
title={Llama 3.1 8B Fine-tuned with QLoRA for DART LLM Tasks},
|
| 116 |
+
author={YongdongWang},
|
| 117 |
+
year={2024},
|
| 118 |
+
publisher={Hugging Face},
|
| 119 |
+
url={https://huggingface.co/YongdongWang/llama3.1-8b-lora-qlora-dart-llm}
|
| 120 |
+
}
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
## Model Card Authors
|
| 124 |
+
|
| 125 |
+
YongdongWang
|
| 126 |
+
|
| 127 |
+
## Model Card Contact
|
| 128 |
+
|
| 129 |
+
For questions or issues, please open an issue in the repository or contact the model author.
|