Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
---
|
| 5 |
+
language: en
|
| 6 |
+
tags:
|
| 7 |
+
- text-generation
|
| 8 |
+
- causal-lm
|
| 9 |
+
- fine-tuning
|
| 10 |
+
- unsupervised
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Model Name: olabs-ai/reflection_model
|
| 14 |
+
|
| 15 |
+
## Model Description
|
| 16 |
+
|
| 17 |
+
The `olabs-ai/reflection_model` is a fine-tuned language model based on [Meta-Llama-3.1-8B-Instruct](https://huggingface.co/Meta-Llama-3.1-8B-Instruct). It has been further fine-tuned using LoRA (Low-Rank Adaptation) for improved performance in specific tasks. This model is designed for text generation and can be used for various applications like conversational agents, content creation, and more.
|
| 18 |
+
|
| 19 |
+
## Model Details
|
| 20 |
+
|
| 21 |
+
- **Base Model**: Meta-Llama-3.1-8B-Instruct
|
| 22 |
+
- **Fine-Tuning Method**: LoRA
|
| 23 |
+
- **Architecture**: LlamaForCausalLM
|
| 24 |
+
- **Number of Parameters**: 8 Billion (Base Model)
|
| 25 |
+
- **Training Data**: [Details about the training data used for fine-tuning, if available]
|
| 26 |
+
|
| 27 |
+
## Usage
|
| 28 |
+
|
| 29 |
+
To use this model, you need to have the `transformers` and `unsloth` libraries installed. You can load the model and tokenizer as follows:
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
| 33 |
+
from unsloth import FastLanguageModel
|
| 34 |
+
|
| 35 |
+
# Load base model configuration
|
| 36 |
+
base_model_name = "olabs-ai/Meta-Llama-3.1-8B-Instruct"
|
| 37 |
+
base_config = AutoConfig.from_pretrained(base_model_name)
|
| 38 |
+
base_model = AutoModel.from_pretrained(base_model_name, config=base_config)
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
| 40 |
+
|
| 41 |
+
# Load LoRA adapter
|
| 42 |
+
adapter_config_path = "path_to_your_adapter_config.json"
|
| 43 |
+
adapter_weights_path = "path_to_your_adapter_weights"
|
| 44 |
+
|
| 45 |
+
# Use FastLanguageModel to apply LoRA adapter
|
| 46 |
+
model = FastLanguageModel.from_pretrained(
|
| 47 |
+
model_name=base_model_name,
|
| 48 |
+
adapter_weights=adapter_weights_path,
|
| 49 |
+
config=adapter_config_path
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Set inference mode for LoRA
|
| 53 |
+
FastLanguageModel.for_inference(model)
|
| 54 |
+
|
| 55 |
+
# Prepare inputs
|
| 56 |
+
custom_prompt = "What is a famous tall tower in Paris?"
|
| 57 |
+
inputs = tokenizer([custom_prompt], return_tensors="pt").to("cuda")
|
| 58 |
+
|
| 59 |
+
from transformers import TextStreamer
|
| 60 |
+
text_streamer = TextStreamer(tokenizer)
|
| 61 |
+
|
| 62 |
+
# Generate outputs
|
| 63 |
+
outputs = model.generate(**inputs, streamer=text_streamer, max_new_tokens=1000)
|