Text Generation
Transformers
Safetensors
Indonesian
llama
unsloth
llama3
indonesia
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use afrizalha/Kancil-V1-llama3-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use afrizalha/Kancil-V1-llama3-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="afrizalha/Kancil-V1-llama3-4bit")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("afrizalha/Kancil-V1-llama3-4bit") model = AutoModelForCausalLM.from_pretrained("afrizalha/Kancil-V1-llama3-4bit", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use afrizalha/Kancil-V1-llama3-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "afrizalha/Kancil-V1-llama3-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afrizalha/Kancil-V1-llama3-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/afrizalha/Kancil-V1-llama3-4bit
- SGLang
How to use afrizalha/Kancil-V1-llama3-4bit with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "afrizalha/Kancil-V1-llama3-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afrizalha/Kancil-V1-llama3-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "afrizalha/Kancil-V1-llama3-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "afrizalha/Kancil-V1-llama3-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use afrizalha/Kancil-V1-llama3-4bit with Docker Model Runner:
docker model run hf.co/afrizalha/Kancil-V1-llama3-4bit
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,23 +1,124 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
- en
|
| 4 |
-
license: apache-2.0
|
| 5 |
tags:
|
| 6 |
-
- text-generation-inference
|
| 7 |
-
- transformers
|
| 8 |
- unsloth
|
| 9 |
-
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- **License:** apache-2.0
|
| 19 |
-
- **Finetuned from model :** unsloth/llama-3-8b-bnb-4bit
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
|
|
|
|
|
|
| 3 |
tags:
|
|
|
|
|
|
|
| 4 |
- unsloth
|
| 5 |
+
- llama3
|
| 6 |
+
- indonesia
|
| 7 |
+
license: llama3
|
| 8 |
+
datasets:
|
| 9 |
+
- catinthebag/TumpengQA
|
| 10 |
+
language:
|
| 11 |
+
- id
|
| 12 |
+
inference: false
|
| 13 |
---
|
| 14 |
+
<!DOCTYPE html>
|
| 15 |
+
<html lang="en">
|
| 16 |
+
<head>
|
| 17 |
+
<meta charset="UTF-8">
|
| 18 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 19 |
+
<title>Document Title</title>
|
| 20 |
+
<style>
|
| 21 |
+
h1 {
|
| 22 |
+
font-size: 36px;
|
| 23 |
+
color: navy;
|
| 24 |
+
font-family: 'Tahoma';
|
| 25 |
+
text-align: center;
|
| 26 |
+
}
|
| 27 |
+
</style>
|
| 28 |
+
</head>
|
| 29 |
+
<body>
|
| 30 |
+
<h1>Introducing the Kancil family of open models</h1>
|
| 31 |
+
</body>
|
| 32 |
+
</html>
|
| 33 |
+
|
| 34 |
+
<center>
|
| 35 |
+
<img src="https://imgur.com/9nG5J1T.png" alt="Kancil" width="600" height="300">
|
| 36 |
+
<p><em>Kancil is a fine-tuned version of Llama 3 8B using synthetic QA dataset generated with Llama 3 70B. Version zero of Kancil is the first generative Indonesian LLM gain functional instruction performance using solely synthetic data.</em></p>
|
| 37 |
+
<p><strong><a href="https://colab.research.google.com/drive/1526QJYfk32X1CqYKX7IA_FFcIHLXbOkx?usp=sharing" style="color: blue; font-family: Tahoma;">❕Go straight to the colab demo❕</a></strong></p>
|
| 38 |
+
<p><em style="color: seagreen;">Compatibility erorrs are fixed! The colab should work fine now.</em></p>
|
| 39 |
+
</center>
|
| 40 |
+
|
| 41 |
+
Selamat datang!
|
| 42 |
+
|
| 43 |
+
I am ultra-overjoyed to introduce you... the 🦌 Kancil! It's a fine-tuned version of Llama 3 8B with the Tumpeng, an instruction dataset of 6.7 million words. Both the model and dataset is openly available in Huggingface.
|
| 44 |
+
|
| 45 |
+
📚 The dataset was synthetically generated from Llama 3 70B. A big problem with existing Indonesian instruction dataset is they're in reality not-very-good-translations of English datasets. Llama 3 70B can generate fluent Indonesian! (with minor caveats 😔)
|
| 46 |
+
|
| 47 |
+
🦚 This follows previous efforts for collection of open, fine-tuned Indonesian models, like Merak and Cendol. However, Kancil solely leverages synthetic data in a very creative way, which makes it a very unique contribution!
|
| 48 |
+
|
| 49 |
+
### Version 1.0
|
| 50 |
+
|
| 51 |
+
This is the second working prototype, Kancil V1.
|
| 52 |
+
✨ Training
|
| 53 |
+
- 2.2x Dataset word count
|
| 54 |
+
- 2x lora parameters
|
| 55 |
+
- Rank-stabilized lora
|
| 56 |
+
- 2x fun
|
| 57 |
+
|
| 58 |
+
✨ New features
|
| 59 |
+
- Multi-turn conversation (beta; optimized for curhat/personal advice 😂)
|
| 60 |
+
- Better text generation (full or outline writing; optimized for essays)
|
| 61 |
+
- QA from text (copy paste to prompt and ask a question about it)
|
| 62 |
+
- Making slogans
|
| 63 |
+
|
| 64 |
+
This model was fine-tuned with QLoRA using the amazing Unsloth framework! It was built on top of [unsloth/llama-3-8b-bnb-4bit](https://huggingface.co/unsloth/llama-3-8b-bnb-4bit) and subsequently merged with the adapter back to 4 bit (no visible difference with merging back to fp 16).
|
| 65 |
+
|
| 66 |
+
### Uses
|
| 67 |
+
|
| 68 |
+
This model is developed with research purposes for researchers or general AI hobbyists. However, it has one big application: You can have lots of fun with it!
|
| 69 |
+
|
| 70 |
+
### Out-of-Scope Use
|
| 71 |
+
|
| 72 |
+
This is a research preview model with minimal safety curation. Do not use this model for commercial or practical applications.
|
| 73 |
+
|
| 74 |
+
You are also not allowed to use this model without having fun.
|
| 75 |
+
|
| 76 |
+
### Getting started
|
| 77 |
+
|
| 78 |
+
As mentioned, this model was trained with Unsloth. Please use its code for better experience.
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
# Install dependencies. You need GPU to run this (at least T4)
|
| 82 |
+
%%capture
|
| 83 |
+
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
| 84 |
+
!pip install --no-deps xformers trl peft accelerate bitsandbytes
|
| 85 |
+
from unsloth import FastLanguageModel
|
| 86 |
+
import torch
|
| 87 |
+
|
| 88 |
+
# Available versions
|
| 89 |
+
KancilV1 = "catinthebag/Kancil-V1-llama3-4bit"
|
| 90 |
+
|
| 91 |
+
# Load the model
|
| 92 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 93 |
+
model_name = KancilV1,
|
| 94 |
+
max_seq_length = 4096,
|
| 95 |
+
dtype = None, # Auto detect
|
| 96 |
+
load_in_4bit = True,
|
| 97 |
+
)
|
| 98 |
+
```
|
| 99 |
+
```
|
| 100 |
+
# This model was trained on this specific prompt template. Changing it might lead to performance degradations.
|
| 101 |
+
prompt_template = """<|user|>
|
| 102 |
+
{prompt}
|
| 103 |
+
|
| 104 |
+
<|assistant|>
|
| 105 |
+
{response}"""
|
| 106 |
+
|
| 107 |
+
# Start generating!
|
| 108 |
+
inputs = tokenizer(
|
| 109 |
+
[
|
| 110 |
+
prompt_template.format(
|
| 111 |
+
prompt="""Bagaimana cara memberi tahu orang tua kalau saya ditolak universitas favorit saya?""",
|
| 112 |
+
response="",)
|
| 113 |
+
], return_tensors = "pt").to("cuda")
|
| 114 |
|
| 115 |
+
outputs = model.generate(**inputs, max_new_tokens = 600, temperature=.3, use_cache = True)
|
| 116 |
+
print(tokenizer.batch_decode(outputs)[0].replace('\\n', '\n'))
|
| 117 |
+
```
|
| 118 |
|
| 119 |
+
**Note:** There is an issue with the dataset where the newline characters are interpreted as literal strings. Very sorry about this! 😔 Please keep the .replace() method to fix newline errors.
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
### Acknowledgments
|
| 122 |
|
| 123 |
+
- **Developed by:** Afrizal Hasbi Azizy
|
| 124 |
+
- **License:** Llama 3 Community License Agreement
|