Update README.md
Browse files
README.md
CHANGED
|
@@ -1,208 +1,143 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
| 3 |
library_name: peft
|
| 4 |
-
pipeline_tag: text-generation
|
| 5 |
tags:
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
## Model Details
|
| 19 |
-
|
| 20 |
-
### Model Description
|
| 21 |
-
|
| 22 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
- **Developed by:** [More Information Needed]
|
| 27 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 28 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 29 |
-
- **Model type:** [More Information Needed]
|
| 30 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 31 |
-
- **License:** [More Information Needed]
|
| 32 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 33 |
-
|
| 34 |
-
### Model Sources [optional]
|
| 35 |
-
|
| 36 |
-
<!-- Provide the basic links for the model. -->
|
| 37 |
-
|
| 38 |
-
- **Repository:** [More Information Needed]
|
| 39 |
-
- **Paper [optional]:** [More Information Needed]
|
| 40 |
-
- **Demo [optional]:** [More Information Needed]
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
###
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
### Out-of-Scope Use
|
| 59 |
-
|
| 60 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
## Bias, Risks, and Limitations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 67 |
-
|
| 68 |
-
[More Information Needed]
|
| 69 |
-
|
| 70 |
-
### Recommendations
|
| 71 |
-
|
| 72 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 73 |
-
|
| 74 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 75 |
-
|
| 76 |
-
## How to Get Started with the Model
|
| 77 |
-
|
| 78 |
-
Use the code below to get started with the model.
|
| 79 |
-
|
| 80 |
-
[More Information Needed]
|
| 81 |
|
| 82 |
## Training Details
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
### Training Procedure
|
| 91 |
-
|
| 92 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 93 |
-
|
| 94 |
-
#### Preprocessing [optional]
|
| 95 |
-
|
| 96 |
-
[More Information Needed]
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
#### Training Hyperparameters
|
| 100 |
-
|
| 101 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 102 |
-
|
| 103 |
-
#### Speeds, Sizes, Times [optional]
|
| 104 |
-
|
| 105 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 106 |
-
|
| 107 |
-
[More Information Needed]
|
| 108 |
-
|
| 109 |
-
## Evaluation
|
| 110 |
-
|
| 111 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 112 |
-
|
| 113 |
-
### Testing Data, Factors & Metrics
|
| 114 |
-
|
| 115 |
-
#### Testing Data
|
| 116 |
-
|
| 117 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Factors
|
| 122 |
-
|
| 123 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
#### Metrics
|
| 128 |
-
|
| 129 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 130 |
-
|
| 131 |
-
[More Information Needed]
|
| 132 |
-
|
| 133 |
-
### Results
|
| 134 |
-
|
| 135 |
-
[More Information Needed]
|
| 136 |
-
|
| 137 |
-
#### Summary
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
## Model Examination [optional]
|
| 142 |
-
|
| 143 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 144 |
-
|
| 145 |
-
[More Information Needed]
|
| 146 |
-
|
| 147 |
-
## Environmental Impact
|
| 148 |
-
|
| 149 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 150 |
-
|
| 151 |
-
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).
|
| 152 |
-
|
| 153 |
-
- **Hardware Type:** [More Information Needed]
|
| 154 |
-
- **Hours used:** [More Information Needed]
|
| 155 |
-
- **Cloud Provider:** [More Information Needed]
|
| 156 |
-
- **Compute Region:** [More Information Needed]
|
| 157 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 158 |
|
| 159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
-
|
| 162 |
|
| 163 |
-
|
|
|
|
|
|
|
| 164 |
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
|
|
|
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
|
|
|
|
|
|
|
| 172 |
|
| 173 |
-
|
| 174 |
|
| 175 |
-
|
|
|
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
-
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
|
|
|
| 190 |
|
| 191 |
-
|
|
|
|
| 192 |
|
| 193 |
-
|
| 194 |
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
-
##
|
| 200 |
|
| 201 |
-
|
| 202 |
|
| 203 |
-
|
| 204 |
|
| 205 |
-
|
| 206 |
-
### Framework versions
|
| 207 |
|
| 208 |
-
|
|
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
library_name: peft
|
|
|
|
| 7 |
tags:
|
| 8 |
+
- text-generation
|
| 9 |
+
- transformers
|
| 10 |
+
- peft
|
| 11 |
+
- lora
|
| 12 |
+
- qwen
|
| 13 |
+
- qwen2
|
| 14 |
+
- reddit
|
| 15 |
+
- llama-factory
|
| 16 |
+
datasets:
|
| 17 |
+
- olmo-data/dolma-v1_6-reddit
|
| 18 |
+
base_model: Qwen/Qwen2-0.5B
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# Qwen2-0.5B Reddit LoRA Adapter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
**Repo:** [iko-01/LLaMA-1](https://huggingface.co/iko-01/LLaMA-1)
|
| 25 |
+
**Base model:** [Qwen/Qwen2-0.5B](https://huggingface.co/Qwen/Qwen2-0.5B)
|
| 26 |
+
**Adapter type:** LoRA (via LLaMA-Factory + QLoRA)
|
| 27 |
+
**Intended use:** Simulating casual, Reddit-style comments, discussions, and thread replies
|
| 28 |
|
| 29 |
+
## Model Description
|
| 30 |
|
| 31 |
+
This is a **LoRA adapter** fine-tuned on top of **Qwen2-0.5B** using a filtered subset of Reddit posts & comments from the Dolma dataset (v1.6 Reddit portion).
|
| 32 |
|
| 33 |
+
The model is trained to generate informal, conversational text typical of Reddit threads — including sarcasm, memes references, casual opinions, upvotes/downvotes vibe, and natural thread continuations.
|
| 34 |
|
| 35 |
+
Despite the repository name (`LLaMA-1`), this is **not** a LLaMA model — it is purely **Qwen2** architecture.
|
| 36 |
|
| 37 |
+
### Key Characteristics
|
| 38 |
|
| 39 |
+
- Extremely lightweight (only ~0.5B base + small LoRA adapter)
|
| 40 |
+
- Runs comfortably on consumer GPUs, laptops, or even decent CPUs
|
| 41 |
+
- Fast inference (very suitable for local prototyping, chatbots, Reddit simulators, etc.)
|
| 42 |
+
- Casual / internet / meme-friendly tone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
## Training Details
|
| 45 |
|
| 46 |
+
- **Framework:** LLaMA-Factory
|
| 47 |
+
- **Training method:** QLoRA (4-bit base quantization + LoRA)
|
| 48 |
+
- **Dataset size:** ~6,000 high-quality, deduplicated Reddit samples
|
| 49 |
+
- **Hardware:** Google Colab T4 (single GPU)
|
| 50 |
+
- **Training duration:** ≈ 30 minutes
|
| 51 |
+
- **Hyperparameters:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
| Parameter | Value |
|
| 54 |
+
|------------------------|-----------|
|
| 55 |
+
| LoRA rank (r) | 32 |
|
| 56 |
+
| LoRA alpha | 64 |
|
| 57 |
+
| Learning rate | 2e-4 |
|
| 58 |
+
| Batch size | 2 |
|
| 59 |
+
| Gradient accumulation | 16 |
|
| 60 |
+
| Epochs | 3 |
|
| 61 |
+
| Optimizer | AdamW |
|
| 62 |
+
| Warmup ratio | 0.03 |
|
| 63 |
|
| 64 |
+
## Usage
|
| 65 |
|
| 66 |
+
```bash
|
| 67 |
+
pip install -U transformers peft torch accelerate bitsandbytes # bitsandbytes optional but recommended
|
| 68 |
+
```
|
| 69 |
|
| 70 |
+
```python
|
| 71 |
+
import torch
|
| 72 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 73 |
+
from peft import PeftModel
|
| 74 |
|
| 75 |
+
base_model_id = "Qwen/Qwen2-0.5B"
|
| 76 |
+
adapter_id = "iko-01/LLaMA-1"
|
| 77 |
|
| 78 |
+
# Load base model
|
| 79 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 80 |
+
base_model_id,
|
| 81 |
+
torch_dtype=torch.float16,
|
| 82 |
+
device_map="auto",
|
| 83 |
+
trust_remote_code=True
|
| 84 |
+
)
|
| 85 |
|
| 86 |
+
# Apply LoRA adapter
|
| 87 |
+
model = PeftModel.from_pretrained(model, adapter_id)
|
| 88 |
+
model.eval()
|
| 89 |
|
| 90 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
|
| 91 |
|
| 92 |
+
# Example prompt
|
| 93 |
+
prompt = """Continue this r/AskReddit thread:
|
| 94 |
|
| 95 |
+
After playing for 50 hours I finally"""
|
| 96 |
|
| 97 |
+
messages = [{"role": "user", "content": prompt}]
|
| 98 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 99 |
|
| 100 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 101 |
|
| 102 |
+
with torch.no_grad():
|
| 103 |
+
out = model.generate(
|
| 104 |
+
**inputs,
|
| 105 |
+
max_new_tokens=120,
|
| 106 |
+
temperature=0.75,
|
| 107 |
+
top_p=0.92,
|
| 108 |
+
repetition_penalty=1.08,
|
| 109 |
+
do_sample=True
|
| 110 |
+
)
|
| 111 |
|
| 112 |
+
response = tokenizer.decode(out[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
|
| 113 |
+
print(response)
|
| 114 |
+
```
|
| 115 |
|
| 116 |
+
### Example Outputs
|
| 117 |
|
| 118 |
+
**Prompt:**
|
| 119 |
+
`Complete this r/gaming discussion: After playing for 50 hours I finally`
|
| 120 |
|
| 121 |
+
**Typical model output:**
|
| 122 |
+
`...realized the main story is mid but the side content is actually peak. The open world exploration in the frozen north hits different. Spent like 6 hours just fishing and upgrading my house and I don't even feel bad about it lmao. Anyone else 100% the fishing minigame before the final boss?`
|
| 123 |
|
| 124 |
+
## Limitations & Responsible Use
|
| 125 |
|
| 126 |
+
- **Model size** — Being a 0.5B model, it has limited world knowledge, reasoning depth, and coherence over very long contexts compared to 7B+ models.
|
| 127 |
+
- **Reddit bias** — The training data comes from Reddit → expect informal language, slang, sarcasm, exaggeration, memes, controversial/hot-take opinions, and sometimes toxic phrasing.
|
| 128 |
+
- **Hallucinations** — Can confidently generate plausible but incorrect facts, especially outside popular Reddit topics.
|
| 129 |
+
- **Not for production / sensitive use** — Not suitable for factual Q&A, customer support, education, legal/medical advice, or any high-stakes application.
|
| 130 |
+
- **English only** — The fine-tune was done exclusively on English Reddit content.
|
| 131 |
|
| 132 |
+
Use this model mainly for **creative**, **entertainment**, or **research** purposes (e.g. generating synthetic discussion data, building Reddit-style bots, style transfer experiments).
|
| 133 |
|
| 134 |
+
## Citation / Thanks
|
| 135 |
|
| 136 |
+
If you use this adapter in your work, feel free to mention:
|
| 137 |
|
| 138 |
+
> Fine-tuned with LLaMA-Factory on Qwen2-0.5B using Reddit data from Dolma.
|
| 139 |
|
| 140 |
+
Big thanks to the Qwen team, LLaMA-Factory contributors, and AllenAI (Dolma dataset).
|
|
|
|
| 141 |
|
| 142 |
+
Happy hacking! 🚀
|
| 143 |
+
```
|