初始化项目,由ModelHub XC社区提供模型
Model: Lavanya177/SkyAssist-Llama Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
175
README.md
Normal file
175
README.md
Normal file
@@ -0,0 +1,175 @@
|
||||
---
|
||||
license: mit
|
||||
language:
|
||||
- en
|
||||
|
||||
library_name: transformers
|
||||
|
||||
pipeline_tag: text-generation
|
||||
|
||||
base_model: meta-llama/Llama-3.2-3B-Instruct
|
||||
|
||||
tags:
|
||||
- llama
|
||||
- qlora
|
||||
- peft
|
||||
- airline
|
||||
- customer-support
|
||||
- conversational
|
||||
- instruction-tuning
|
||||
---
|
||||
|
||||
# ✈️ SkyAssist-Llama
|
||||
|
||||
SkyAssist-Llama is a domain-specific airline customer support large language model created by fine-tuning **Meta Llama 3.2 3B Instruct** using **QLoRA (Quantized Low-Rank Adaptation)**.
|
||||
|
||||
The model is designed to generate professional, empathetic, and context-aware responses for common airline customer support scenarios, including flight delays, cancellations, baggage inquiries, booking modifications, refunds, and check-in assistance.
|
||||
|
||||
---
|
||||
|
||||
# Model Details
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| Base Model | Meta Llama 3.2 3B Instruct |
|
||||
| Fine-tuning Method | QLoRA |
|
||||
| Task | Airline Customer Support |
|
||||
| Language | English |
|
||||
| Architecture | Decoder-only Transformer |
|
||||
| Training Objective | Supervised Fine-Tuning (SFT) |
|
||||
|
||||
---
|
||||
|
||||
# Training Data
|
||||
|
||||
The model was trained on **2,666** airline customer support conversations.
|
||||
|
||||
Rather than relying on an existing airline dataset, the training data was created through a multi-stage automated pipeline that transformed general customer support conversations into realistic airline-specific interactions.
|
||||
|
||||
The dataset generation process included:
|
||||
|
||||
- Data preprocessing
|
||||
- LLM-based convertibility classification
|
||||
- Airline domain transformation
|
||||
- post-processing and cleaning
|
||||
- JSON validation
|
||||
- Sample-based manual review
|
||||
|
||||
The complete dataset is available on Hugging Face:
|
||||
|
||||
**Dataset:** https://huggingface.co/datasets/Lavanya177/airline-support-tone-clean
|
||||
|
||||
---
|
||||
|
||||
# Training Configuration
|
||||
|
||||
| Parameter | Value |
|
||||
|-----------|-------|
|
||||
| Base Model | Llama 3.2 3B Instruct |
|
||||
| Fine-Tuning Method | QLoRA |
|
||||
| LoRA Rank | 32 |
|
||||
| LoRA Alpha | 64 |
|
||||
| Learning Rate | 1e-3 |
|
||||
| Epochs | 3 |
|
||||
| Batch Size | 8 |
|
||||
| Gradient Accumulation | 4 |
|
||||
| Optimizer | AdamW |
|
||||
| Scheduler | Cosine |
|
||||
| Max Sequence Length | 2048 |
|
||||
| Precision | BF16 |
|
||||
|
||||
---
|
||||
|
||||
# Evaluation
|
||||
|
||||
| Metric | Value |
|
||||
|--------|------:|
|
||||
| Training Loss | **0.4615** |
|
||||
| Validation Loss | **0.5557** |
|
||||
| Test Loss | **0.62** |
|
||||
|
||||
The model demonstrates good convergence while maintaining strong generalization on unseen airline customer support conversations.
|
||||
|
||||
---
|
||||
|
||||
# Intended Use
|
||||
|
||||
SkyAssist-Llama is intended for:
|
||||
|
||||
- Airline customer support assistants
|
||||
- Conversational AI research
|
||||
- Educational purposes
|
||||
- Domain adaptation experiments
|
||||
- LLM fine-tuning research
|
||||
|
||||
---
|
||||
|
||||
# Limitations
|
||||
|
||||
This model:
|
||||
|
||||
- does not access live airline booking systems
|
||||
- cannot retrieve reservation details
|
||||
- cannot process ticket changes or refunds
|
||||
- may generate incorrect airline-specific policies
|
||||
- should not replace official airline customer support
|
||||
|
||||
---
|
||||
|
||||
# Usage
|
||||
|
||||
## Load the model
|
||||
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
model_name = "Lavanya177/SkyAssist-Llama"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
device_map="auto"
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
# Example
|
||||
|
||||
**System Prompt**
|
||||
|
||||
```
|
||||
You are a professional airline customer support assistant...
|
||||
```
|
||||
|
||||
**User**
|
||||
|
||||
```
|
||||
My baggage has not arrived. What should I do?
|
||||
```
|
||||
|
||||
**Assistant**
|
||||
|
||||
```
|
||||
I'm sorry to hear that your baggage has not arrived. I understand how frustrating this situation can be.
|
||||
|
||||
Please provide your baggage claim number, flight number, travel date, and destination airport so I can assist you further. If you have already reported the issue at the airport, please also share your Property Irregularity Report (PIR) reference number.
|
||||
|
||||
Once these details are available, the airline can begin tracking your baggage and provide updates on its status.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Citation
|
||||
|
||||
```bibtex
|
||||
@misc{skyassistllama2026,
|
||||
title={SkyAssist-Llama: A Domain-Specific Airline Customer Support Large Language Model},
|
||||
author={Lavanya Singh},
|
||||
year={2026}
|
||||
}
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
This project is released under the MIT License.
|
||||
93
chat_template.jinja
Normal file
93
chat_template.jinja
Normal file
@@ -0,0 +1,93 @@
|
||||
{{- bos_token }}
|
||||
{%- if custom_tools is defined %}
|
||||
{%- set tools = custom_tools %}
|
||||
{%- endif %}
|
||||
{%- if not tools_in_user_message is defined %}
|
||||
{%- set tools_in_user_message = true %}
|
||||
{%- endif %}
|
||||
{%- if not date_string is defined %}
|
||||
{%- if strftime_now is defined %}
|
||||
{%- set date_string = strftime_now("%d %b %Y") %}
|
||||
{%- else %}
|
||||
{%- set date_string = "26 Jul 2024" %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if not tools is defined %}
|
||||
{%- set tools = none %}
|
||||
{%- endif %}
|
||||
|
||||
{#- This block extracts the system message, so we can slot it into the right place. #}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{%- set system_message = messages[0]['content']|trim %}
|
||||
{%- set messages = messages[1:] %}
|
||||
{%- else %}
|
||||
{%- set system_message = "" %}
|
||||
{%- endif %}
|
||||
|
||||
{#- System message #}
|
||||
{{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
|
||||
{%- if tools is not none %}
|
||||
{{- "Environment: ipython\n" }}
|
||||
{%- endif %}
|
||||
{{- "Cutting Knowledge Date: December 2023\n" }}
|
||||
{{- "Today Date: " + date_string + "\n\n" }}
|
||||
{%- if tools is not none and not tools_in_user_message %}
|
||||
{{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
|
||||
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
|
||||
{{- "Do not use variables.\n\n" }}
|
||||
{%- for t in tools %}
|
||||
{{- t | tojson(indent=4) }}
|
||||
{{- "\n\n" }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- system_message }}
|
||||
{{- "<|eot_id|>" }}
|
||||
|
||||
{#- Custom tools are passed in a user message with some extra guidance #}
|
||||
{%- if tools_in_user_message and not tools is none %}
|
||||
{#- Extract the first user message so we can plug it in here #}
|
||||
{%- if messages | length != 0 %}
|
||||
{%- set first_user_message = messages[0]['content']|trim %}
|
||||
{%- set messages = messages[1:] %}
|
||||
{%- else %}
|
||||
{{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
|
||||
{%- endif %}
|
||||
{{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
|
||||
{{- "Given the following functions, please respond with a JSON for a function call " }}
|
||||
{{- "with its proper arguments that best answers the given prompt.\n\n" }}
|
||||
{{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
|
||||
{{- "Do not use variables.\n\n" }}
|
||||
{%- for t in tools %}
|
||||
{{- t | tojson(indent=4) }}
|
||||
{{- "\n\n" }}
|
||||
{%- endfor %}
|
||||
{{- first_user_message + "<|eot_id|>"}}
|
||||
{%- endif %}
|
||||
|
||||
{%- for message in messages %}
|
||||
{%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
|
||||
{{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
|
||||
{%- elif 'tool_calls' in message %}
|
||||
{%- if not message.tool_calls|length == 1 %}
|
||||
{{- raise_exception("This model only supports single tool-calls at once!") }}
|
||||
{%- endif %}
|
||||
{%- set tool_call = message.tool_calls[0].function %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
|
||||
{{- '{"name": "' + tool_call.name + '", ' }}
|
||||
{{- '"parameters": ' }}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{{- "}" }}
|
||||
{{- "<|eot_id|>" }}
|
||||
{%- elif message.role == "tool" or message.role == "ipython" %}
|
||||
{{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
|
||||
{%- if message.content is mapping or message.content is iterable %}
|
||||
{{- message.content | tojson }}
|
||||
{%- else %}
|
||||
{{- message.content }}
|
||||
{%- endif %}
|
||||
{{- "<|eot_id|>" }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
|
||||
{%- endif %}
|
||||
55
config.json
Normal file
55
config.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 128000,
|
||||
"dtype": "bfloat16",
|
||||
"eos_token_id": [
|
||||
128001,
|
||||
128008,
|
||||
128009
|
||||
],
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 3072,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 8192,
|
||||
"max_position_embeddings": 131072,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 24,
|
||||
"num_hidden_layers": 28,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": 128009,
|
||||
"pretraining_tp": 1,
|
||||
"quantization_config": {
|
||||
"_load_in_4bit": true,
|
||||
"_load_in_8bit": false,
|
||||
"bnb_4bit_compute_dtype": "bfloat16",
|
||||
"bnb_4bit_quant_storage": "uint8",
|
||||
"bnb_4bit_quant_type": "nf4",
|
||||
"bnb_4bit_use_double_quant": true,
|
||||
"llm_int8_enable_fp32_cpu_offload": false,
|
||||
"llm_int8_has_fp16_weight": false,
|
||||
"llm_int8_skip_modules": null,
|
||||
"llm_int8_threshold": 6.0,
|
||||
"load_in_4bit": true,
|
||||
"load_in_8bit": false,
|
||||
"quant_method": "bitsandbytes"
|
||||
},
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": {
|
||||
"factor": 32.0,
|
||||
"high_freq_factor": 4.0,
|
||||
"low_freq_factor": 1.0,
|
||||
"original_max_position_embeddings": 8192,
|
||||
"rope_type": "llama3"
|
||||
},
|
||||
"rope_theta": 500000.0,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "4.57.1",
|
||||
"use_cache": true,
|
||||
"vocab_size": 128256
|
||||
}
|
||||
13
generation_config.json
Normal file
13
generation_config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"bos_token_id": 128000,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
128001,
|
||||
128008,
|
||||
128009
|
||||
],
|
||||
"pad_token_id": 128009,
|
||||
"temperature": 0.6,
|
||||
"top_p": 0.9,
|
||||
"transformers_version": "4.57.1"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57d20ed0ec8804435c3b1d0dc5d55f2591205db725b60a616122de5b93dc02b2
|
||||
size 2242762591
|
||||
17
special_tokens_map.json
Normal file
17
special_tokens_map.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<|begin_of_text|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "<|eot_id|>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": "<|eot_id|>"
|
||||
}
|
||||
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
BIN
tokenizer.json
(Stored with Git LFS)
Normal file
Binary file not shown.
2063
tokenizer_config.json
Normal file
2063
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user