suayptalha
commited on
Commit
•
7c922db
1
Parent(s):
0cb6483
Update README.md
Browse files
README.md
CHANGED
@@ -6,44 +6,4 @@ license: apache-2.0
|
|
6 |
language:
|
7 |
- eng
|
8 |
pipeline_tag: text-generation
|
9 |
-
---
|
10 |
-
|
11 |
-
This is a Turkish finetuned Llama-3.1-8B model using InstrucTurca dataset in order to increase the Turkish capability of modern LLMs.
|
12 |
-
|
13 |
-
Note: These are only LoRA adapters. You should also import the base model itself.
|
14 |
-
|
15 |
-
Example usage:
|
16 |
-
|
17 |
-
```py
|
18 |
-
model_name = "unsloth/Meta-Llama-3.1-8B"
|
19 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype=torch.float16)
|
20 |
-
model.gradient_checkpointing_enable()
|
21 |
-
|
22 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
-
|
24 |
-
adapter_path = "suayptalha/Llama-3.1-8b-Turkish-Finetuned"
|
25 |
-
model = PeftModel.from_pretrained(model, adapter_path)
|
26 |
-
|
27 |
-
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
28 |
-
|
29 |
-
### Instruction:
|
30 |
-
{}
|
31 |
-
|
32 |
-
### Input:
|
33 |
-
{}
|
34 |
-
|
35 |
-
### Response:
|
36 |
-
{}"""
|
37 |
-
|
38 |
-
inputs = tokenizer(
|
39 |
-
[
|
40 |
-
alpaca_prompt.format(
|
41 |
-
"", #Your question here
|
42 |
-
"", #Given input here
|
43 |
-
"", #Output (for training)
|
44 |
-
)
|
45 |
-
], return_tensors = "pt").to("cuda")
|
46 |
-
|
47 |
-
outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True)
|
48 |
-
tokenizer.batch_decode(outputs)
|
49 |
-
```
|
|
|
6 |
language:
|
7 |
- eng
|
8 |
pipeline_tag: text-generation
|
9 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|