Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
|
| 4 |
+
license: mit
|
| 5 |
+
language:
|
| 6 |
+
- ml
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+

|
| 11 |
+
|
| 12 |
+
# QuantFactory/MalayaLLM_Gemma_7B_Instruct_V1-GGUF
|
| 13 |
+
This is quantized version of [VishnuPJ/MalayaLLM_Gemma_7B_Instruct_V1](https://huggingface.co/VishnuPJ/MalayaLLM_Gemma_7B_Instruct_V1) created using llama.cpp
|
| 14 |
+
|
| 15 |
+
# Original Model Card
|
| 16 |
+
|
| 17 |
+
# MalayaLLM: Gemma [മലയാളം/Malayalam]
|
| 18 |
+
|
| 19 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/64e65800e44b2668a56f9731/bipVMulaNJ9um46ecYpR4.png" alt="Baby MalayaLLM" width="300" height="200">
|
| 20 |
+
|
| 21 |
+
# Introducing the Developer:
|
| 22 |
+
Discover the mind behind this model and stay updated on their contributions to the field
|
| 23 |
+
https://www.linkedin.com/in/vishnu-prasad-j/
|
| 24 |
+
|
| 25 |
+
# Model description
|
| 26 |
+
The MalayaLLM models have been improved and customized expanding upon the groundwork laid by the original Gemma model.
|
| 27 |
+
|
| 28 |
+
- **Model type:** A 7B Gemma finetuned model on Malayalam tokens.
|
| 29 |
+
- **Language(s):** Malayalam and English
|
| 30 |
+
- **Datasets:** [CohereForAI/aya_dataset](https://huggingface.co/datasets/CohereForAI/aya_dataset)
|
| 31 |
+
- **Source Model:** [MalayaLLM_Gemma_7B_Base_V1](https://huggingface.co/VishnuPJ/MalayaLLM_Gemma_7B_Base_V1)
|
| 32 |
+
- **GGUF Model:** [MalayaLLM_Gemma_7B_Instruct_V1_GGUF](https://huggingface.co/VishnuPJ/MalayaLLM_Gemma_7B_Instruct_V1_GGUF)
|
| 33 |
+
- **Training Precision:** `float16`
|
| 34 |
+
- **Github Repo:** [MalayaLLM-Gemma](https://github.com/VishnuPJ/MalayaLLM-Gemma/tree/main)
|
| 35 |
+
|
| 36 |
+
# Model Update
|
| 37 |
+
Latest Gemma2-9B trained model is here :[MalayaLLM:Gemma-2-9B](https://huggingface.co/collections/VishnuPJ/malayallm-malayalam-gemma-2-9b-6689843413da7de7c57b5b8c)
|
| 38 |
+
|
| 39 |
+
## A simple example code
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
|
| 43 |
+
#!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
| 44 |
+
#!pip install --no-deps xformers "trl<0.9.0" peft accelerate bitsandbytes
|
| 45 |
+
|
| 46 |
+
import sentencepiece as spm
|
| 47 |
+
from unsloth import FastLanguageModel
|
| 48 |
+
import torch
|
| 49 |
+
max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
|
| 50 |
+
dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
|
| 51 |
+
load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
|
| 52 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 53 |
+
model_name="VishnuPJ/MalayaLLM_Gemma_7B_Instruct_V1",
|
| 54 |
+
max_seq_length=max_seq_length,
|
| 55 |
+
dtype=dtype,
|
| 56 |
+
load_in_4bit=load_in_4bit,
|
| 57 |
+
)
|
| 58 |
+
EOS_TOKEN = tokenizer.eos_token # Must add EOS_TOKEN
|
| 59 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
| 60 |
+
#### Giving Instruction with Input
|
| 61 |
+
'''
|
| 62 |
+
alpaca_prompt_1 = """ഒരു ചുമതല വിവരിക്കുന്ന ഒരു നിർദ്ദേശം ചുവടെയുണ്ട്.
|
| 63 |
+
അഭ്യർത്ഥന ശരിയായി പൂർത്തിയാക്കുന്ന ഒരു പ്രതികരണം എഴുതുക.".
|
| 64 |
+
### നിർദ്ദേശം:
|
| 65 |
+
{}
|
| 66 |
+
### ഇൻപുട്ട്:
|
| 67 |
+
{}
|
| 68 |
+
### പ്രതികരണം:
|
| 69 |
+
{}"""
|
| 70 |
+
inputs = tokenizer([
|
| 71 |
+
alpaca_prompt_1.format(
|
| 72 |
+
# "Continue the fibonnaci sequence.", # instruction
|
| 73 |
+
"""താഴെ ഉള്ള വാക്യത്തിൽ "അത്" എന്ന് പറയുന്നത് എന്തിനെ ആണ് ?""", # instruction
|
| 74 |
+
""" ഒരു വാഹനം കയറ്റം കയറുക ആയിരുന്നു .അതിൽ 4 ആൾക്കാർ ഉണ്ടായിരുന്നു. """, # input
|
| 75 |
+
"", # output - leave this blank for generation!
|
| 76 |
+
)
|
| 77 |
+
], return_tensors = "pt").to("cuda")
|
| 78 |
+
outputs = model.generate(**inputs, max_new_tokens=128, use_cache=True)
|
| 79 |
+
# Printing the result
|
| 80 |
+
print(tokenizer.batch_decode(outputs)[0].split("പ്രതികരണം:\n")[-1])
|
| 81 |
+
'''
|
| 82 |
+
## Giving Instruction only.
|
| 83 |
+
alpaca_prompt_2 = """ഒരു ചുമതല വിവരിക്കുന്ന ഒരു നിർദ്ദേശം ചുവടെയുണ്ട്.
|
| 84 |
+
അഭ്യർത്ഥന ശരിയായി പൂർത്തിയാക്കുന്ന ഒരു പ്രതികരണം എഴുതുക.".
|
| 85 |
+
### നിർദ്ദേശം:
|
| 86 |
+
{}
|
| 87 |
+
### പ്രതികരണം:
|
| 88 |
+
{}"""
|
| 89 |
+
while True:
|
| 90 |
+
# Taking user input for the instruction
|
| 91 |
+
instruction = input("Enter the instruction (or type 'exit' to quit): ")
|
| 92 |
+
if instruction.lower() == 'exit':
|
| 93 |
+
break
|
| 94 |
+
# Preparing the input for the model
|
| 95 |
+
inputs = tokenizer([
|
| 96 |
+
alpaca_prompt_2.format(
|
| 97 |
+
instruction,
|
| 98 |
+
"", # output - leave this blank for generation!
|
| 99 |
+
)
|
| 100 |
+
], return_tensors="pt").to("cuda")
|
| 101 |
+
# Generating the output
|
| 102 |
+
outputs = model.generate(**inputs, max_new_tokens=128, use_cache=True)
|
| 103 |
+
# Printing the result
|
| 104 |
+
print(tokenizer.batch_decode(outputs)[0].split("പ്രതികരണം:\n")[-1])
|
| 105 |
+
print("Program terminated.")
|
| 106 |
+
''''
|
| 107 |
+
```
|
| 108 |
+
## Example Output
|
| 109 |
+
```
|
| 110 |
+
Enter instruction (or 'exit' to end): ഒരു സമചതുരത്തിന്റെ ഒരു വശം 4 cm ആണെങ്കിൽ , അതിന്റെ area കണ്ടുപിടിക്കുക..
|
| 111 |
+
സമചതുരത്തിന്റെ area 16 cm2 ആണ്.<eos>.
|
| 112 |
+
Enter instruction (or 'exit' to end): ഇന്ത്യയുടെ അടുത്ത് സ്ഥിതി ചെയുന്ന നാല് രാജ്യങ്ങളുടെ പേര് പറയുക.
|
| 113 |
+
"ഇന്ത്യയ്ക്ക് സമീപമുള്ള നാല് രാജ്യങ്ങൾ ഇവയാണ്:
|
| 114 |
+
- നേപ്പാൾ
|
| 115 |
+
- ഭൂട്ടാൻ
|
| 116 |
+
- ടിബറ്റ് (ചൈന)
|
| 117 |
+
- പാകിസ്ഥാൻ"<eos>
|
| 118 |
+
Enter instruction (or 'exit' to end):exit
|
| 119 |
+
```
|
| 120 |
+
## Made Using UNSLOTH
|
| 121 |
+
|
| 122 |
+
Thanks to [Unsloth](https://github.com/unslothai/unsloth), the process of fine-tuning large language models (LLMs) has become much easier and more efficient.
|
| 123 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/64e65800e44b2668a56f9731/WPt_FKUWDdc6--l_Qnb-G.png" alt="Unsloth" width="300" height="200">
|
| 124 |
+
|
| 125 |
+
# 🌟Happy coding💻🌟
|