初始化项目,由ModelHub XC社区提供模型
Model: Haldi247/TinyLlama-SFT-Alpaca Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
*.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
|
||||
130
README.md
Normal file
130
README.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
library_name: transformers
|
||||
tags:
|
||||
- instruction-tuning
|
||||
- sft
|
||||
- lora
|
||||
- tinyllama
|
||||
- alpaca
|
||||
---
|
||||
|
||||
# TinyLlama-SFT-Alpaca
|
||||
|
||||
TinyLlama-1.1B-Chat fine-tuned using Supervised Fine-Tuning (SFT) with LoRA on the yahma/alpaca-cleaned dataset as part of IBA Karachi NLP with Deep Learning Assignment 4.
|
||||
|
||||
## Model Details
|
||||
|
||||
- **Developed by:** Hadeeqa Al Islam
|
||||
- **Model type:** Causal Language Model
|
||||
- **Language:** English
|
||||
- **Finetuned from:** TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
||||
- **Training data:** yahma/alpaca-cleaned (20,000 samples)
|
||||
- **LoRA config:** r=8, lora_alpha=16, target_modules=[q_proj, v_proj]
|
||||
- **Training:** lr=2e-4, batch=4, epochs=2, fp16=True
|
||||
|
||||
## How to Get Started
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained("Haldi247/TinyLlama-SFT-Alpaca")
|
||||
model = AutoModelForCausalLM.from_pretrained("Haldi247/TinyLlama-SFT-Alpaca")
|
||||
messages = [{"role": "user", "content": "What is photosynthesis?"}]
|
||||
|
||||
## Training Details
|
||||
|
||||
- **Dataset:** yahma/alpaca-cleaned (20,000 samples after filtering)
|
||||
- **Hardware:** NVIDIA RTX 5070 Ti (16GB VRAM) via WSL2
|
||||
- **Training time:** ~14 minutes
|
||||
|
||||
### Training Procedure
|
||||
|
||||
#### Training Hyperparameters
|
||||
- **Training regime:** fp16 mixed precision
|
||||
- **Learning Rate:** 2e-4
|
||||
- **Batch Size:** 4
|
||||
- **Epochs:** 2
|
||||
|
||||
## Evaluation
|
||||
|
||||
### Testing Data, Factors & Metrics
|
||||
|
||||
#### Metrics
|
||||
- **BLEU Score**: Used to evaluate the overlap of n-grams between the model output and the ground truth.
|
||||
- **BERTScore**: Used to compute semantic similarity between the generated text and reference text using BERT embeddings.
|
||||
|
||||
### Results
|
||||
- **Average BLEU Score**: 0.4303
|
||||
- **Average BERTScore**: 0.7236
|
||||
|
||||
## Limitations
|
||||
- **Tokenization Constraints**: The training process used sequence packing to manage memory effectively. Because the model was trained with packed sequences without special tokens (to prevent cross-contamination), it may exhibit formatting issues if the inference environment does not strictly adhere to the expected chat template.
|
||||
- **Data Bias**: The model is fine-tuned on the Alpaca dataset, which may inherit biases present in the synthetic instruction data.
|
||||
- **Inference Stability**: Due to the aggressive packing strategy, users may observe repetition or formatting artifacts if the prompt structure deviates significantly from the training format.
|
||||
|
||||
#### Summary
|
||||
|
||||
|
||||
|
||||
## Model Examination [optional]
|
||||
|
||||
<!-- Relevant interpretability work for the model goes here -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Environmental Impact
|
||||
|
||||
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
||||
|
||||
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
||||
|
||||
- **Hardware Type:** [More Information Needed]
|
||||
- **Hours used:** [More Information Needed]
|
||||
- **Cloud Provider:** [More Information Needed]
|
||||
- **Compute Region:** [More Information Needed]
|
||||
- **Carbon Emitted:** [More Information Needed]
|
||||
|
||||
## Technical Specifications [optional]
|
||||
|
||||
### Model Architecture and Objective
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
### Compute Infrastructure
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Hardware
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
#### Software
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Citation [optional]
|
||||
|
||||
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
||||
|
||||
**BibTeX:**
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
**APA:**
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Glossary [optional]
|
||||
|
||||
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## More Information [optional]
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Model Card Authors [optional]
|
||||
|
||||
[More Information Needed]
|
||||
|
||||
## Model Card Contact
|
||||
|
||||
[More Information Needed]
|
||||
15
chat_template.jinja
Normal file
15
chat_template.jinja
Normal file
@@ -0,0 +1,15 @@
|
||||
{% for message in messages %}
|
||||
{% if message['role'] == 'user' %}
|
||||
{{ '<|user|>
|
||||
' + message['content'] + eos_token }}
|
||||
{% elif message['role'] == 'system' %}
|
||||
{{ '<|system|>
|
||||
' + message['content'] + eos_token }}
|
||||
{% elif message['role'] == 'assistant' %}
|
||||
{{ '<|assistant|>
|
||||
' + message['content'] + eos_token }}
|
||||
{% endif %}
|
||||
{% if loop.last and add_generation_prompt %}
|
||||
{{ '<|assistant|>' }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
32
config.json
Normal file
32
config.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"dtype": "float16",
|
||||
"eos_token_id": 2,
|
||||
"head_dim": 64,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 5632,
|
||||
"max_position_embeddings": 2048,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 22,
|
||||
"num_key_value_heads": 4,
|
||||
"pad_token_id": null,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 10000.0,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"tie_word_embeddings": false,
|
||||
"transformers_version": "5.9.0",
|
||||
"use_cache": true,
|
||||
"vocab_size": 32000
|
||||
}
|
||||
7
generation_config.json
Normal file
7
generation_config.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"max_length": 2048,
|
||||
"pad_token_id": 0,
|
||||
"transformers_version": "5.9.0"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f350c93960839daf38622c924554232aa12b6c349dac43535f048b758290bc39
|
||||
size 2200119664
|
||||
277129
tokenizer.json
Normal file
277129
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
16
tokenizer_config.json
Normal file
16
tokenizer_config.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"add_prefix_space": null,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": "<s>",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "</s>",
|
||||
"is_local": false,
|
||||
"local_files_only": false,
|
||||
"model_max_length": 2048,
|
||||
"pad_token": "</s>",
|
||||
"padding_side": "right",
|
||||
"sp_model_kwargs": {},
|
||||
"tokenizer_class": "LlamaTokenizer",
|
||||
"unk_token": "<unk>",
|
||||
"use_default_system_prompt": false
|
||||
}
|
||||
Reference in New Issue
Block a user