Instructions to use ISLAM-PO/MasryGPT-Flash-Adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ISLAM-PO/MasryGPT-Flash-Adapter with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("aubmindlab/aragpt2-base") model = PeftModel.from_pretrained(base_model, "ISLAM-PO/MasryGPT-Flash-Adapter") - Notebooks
- Google Colab
- Kaggle
Correct model card for adapter-only repository
Browse filesDocument the missing base model and prevent the adapter from being mistaken for a standalone model.
README.md
CHANGED
|
@@ -1,91 +1,55 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
tokenizer = GPT2Tokenizer.from_pretrained(model_path)
|
| 53 |
-
model = GPT2LMHeadModel.from_pretrained(model_path)
|
| 54 |
-
|
| 55 |
-
prompt = "Artificial intelligence in the Arabic language"
|
| 56 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
| 57 |
-
outputs = model.generate(
|
| 58 |
-
**inputs,
|
| 59 |
-
max_length=100,
|
| 60 |
-
do_sample=True,
|
| 61 |
-
top_p=0.95,
|
| 62 |
-
num_beams=5,
|
| 63 |
-
repetition_penalty=3.0,
|
| 64 |
-
no_repeat_ngram_size=3
|
| 65 |
-
)
|
| 66 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 67 |
-
```
|
| 68 |
-
|
| 69 |
-
> For full details see: `USAGE.md`, `ARCHITECTURE.md`, `TOKENIZER.md`
|
| 70 |
-
|
| 71 |
-
## Intended Uses
|
| 72 |
-
|
| 73 |
-
- Arabic text generation (stories, articles, sentence completion).
|
| 74 |
-
- Research and experimentation on Arabic language modeling.
|
| 75 |
-
- Fine-tuning for tasks such as dialogue, summarization, and generative classification.
|
| 76 |
-
|
| 77 |
-
## Limitations and Cautions
|
| 78 |
-
|
| 79 |
-
1. **Hallucination:** May generate incorrect information β verify facts independently.
|
| 80 |
-
2. **Limited context:** Only 1024 tokens (~700β900 Arabic words approx.).
|
| 81 |
-
3. **Small size:** Only 12 layers β less capable than modern large models.
|
| 82 |
-
4. **Bias:** Reflects biases in the Arabic training data.
|
| 83 |
-
5. **Start/end tokens:** `bos_token_id = eos_token_id = 0` (`<|endoftext|>`) β take care during fine-tuning.
|
| 84 |
-
|
| 85 |
-
## License and Source
|
| 86 |
-
|
| 87 |
-
- Architecture: GPT-2 (OpenAI).
|
| 88 |
-
- Check the original training-data license before commercial use.
|
| 89 |
|
| 90 |
---
|
| 91 |
-
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: peft
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
tags:
|
| 5 |
+
- peft
|
| 6 |
+
- lora
|
| 7 |
+
- adapter
|
| 8 |
+
- arabic
|
| 9 |
+
- text-generation
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# MasryGPT Flash β LoRA Adapter
|
| 13 |
+
|
| 14 |
+
## Status
|
| 15 |
+
|
| 16 |
+
This repository contains a **LoRA/PEFT adapter only**, not a standalone language model.
|
| 17 |
+
|
| 18 |
+
The repository currently includes:
|
| 19 |
+
|
| 20 |
+
- `adapter_config.json`
|
| 21 |
+
- `adapter_model.safetensors`
|
| 22 |
+
- Tokenizer support files
|
| 23 |
+
- Chat template
|
| 24 |
+
|
| 25 |
+
It does **not** include:
|
| 26 |
+
|
| 27 |
+
- A base-model `config.json`
|
| 28 |
+
- Base-model weights
|
| 29 |
+
- A complete standalone `model.safetensors`
|
| 30 |
+
- A verified base-model repository ID
|
| 31 |
+
|
| 32 |
+
## Important issue to fix before loading
|
| 33 |
+
|
| 34 |
+
The current `base_model_name_or_path` points to `ISLAM-PO/masrygpt-flash`, which is this adapter repository itself. That value must be replaced with the exact Hugging Face repository ID of the base model used during training.
|
| 35 |
+
|
| 36 |
+
Do not report this repository as a standalone model until the base checkpoint and adapter compatibility are verified.
|
| 37 |
+
|
| 38 |
+
## Required setup
|
| 39 |
+
|
| 40 |
+
1. Identify the exact base model and upload it or identify its existing Hub ID.
|
| 41 |
+
2. Set `base_model_name_or_path` in `adapter_config.json` to that exact ID.
|
| 42 |
+
3. Load the base model with `transformers`.
|
| 43 |
+
4. Load this adapter with `peft.PeftModel`.
|
| 44 |
+
|
| 45 |
+
## Intended use
|
| 46 |
+
|
| 47 |
+
Arabic text-generation experiments after the base model and adapter have been verified.
|
| 48 |
+
|
| 49 |
+
## License
|
| 50 |
+
|
| 51 |
+
The license must follow the licenses of both the base model and the training data. Verify them before redistribution or commercial use.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
---
|
| 54 |
+
|
| 55 |
+
*This card was corrected to match the files currently present in the repository.*
|