Wajdi1976 commited on
Commit
6d11f40
·
verified ·
1 Parent(s): 0a4a69f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -2
README.md CHANGED
@@ -1,7 +1,7 @@
1
  ---
2
  base_model: inceptionai/jais-adapted-7b-chat
3
  language:
4
- - en
5
  license: apache-2.0
6
  tags:
7
  - text-generation-inference
@@ -9,6 +9,9 @@ tags:
9
  - unsloth
10
  - llama
11
  - trl
 
 
 
12
  ---
13
 
14
  # Uploaded model
@@ -16,7 +19,62 @@ tags:
16
  - **Developed by:** Wajdi1976
17
  - **License:** apache-2.0
18
  - **Finetuned from model :** inceptionai/jais-adapted-7b-chat
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
1
  ---
2
  base_model: inceptionai/jais-adapted-7b-chat
3
  language:
4
+ - ar
5
  license: apache-2.0
6
  tags:
7
  - text-generation-inference
 
9
  - unsloth
10
  - llama
11
  - trl
12
+ datasets:
13
+ - Wajdi1976/Tunisian_Derja_Dataset
14
+ library_name: transformers
15
  ---
16
 
17
  # Uploaded model
 
19
  - **Developed by:** Wajdi1976
20
  - **License:** apache-2.0
21
  - **Finetuned from model :** inceptionai/jais-adapted-7b-chat
22
+ -
23
+ ## Usage
24
+ Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:
25
+
26
+ ```sh
27
+ pip install unsloth
28
+ ```
29
+ ### First, Load the Model
30
+ ```python
31
+ from unsloth import FastLanguageModel
32
+ import torch
33
+ max_seq_length = 600 # Choose any! We auto support RoPE Scaling internally!
34
+ dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
35
+ load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
36
+ model, tokenizer = FastLanguageModel.from_pretrained(
37
+ model_name = "Wajdi1976/jais_arabic_tunisien_derija",
38
+ max_seq_length = max_seq_length,
39
+ dtype = dtype,
40
+ load_in_4bit = load_in_4bit,
41
+ )
42
+ ```
43
+
44
+ ### Second, Try the model
45
+ ```python
46
+ prompt_ar=" يمكنك الإجابة باللهجة التونسية فقط.\n\nأكمل المحادثة أدناه بين [|Human|] و [|AI|]:\n### Input: [|Human|] {Question}\n### Response: [|AI|]"
47
+ device = "cuda" if torch.cuda.is_available() else "cpu"
48
+ FastLanguageModel.for_inference(model)
49
+ if tokenizer.pad_token is None:
50
+ tokenizer.pad_token = tokenizer.eos_token
51
+ def get_response(text, tokenizer=tokenizer, model=model):
52
+ tokenized = tokenizer(text, return_tensors="pt")
53
+ input_ids, attention_mask = tokenized['input_ids'].to(device), tokenized['attention_mask'].to(device)
54
+ input_len = input_ids.shape[-1]
55
+ generate_ids = model.generate(
56
+ input_ids,
57
+ attention_mask=attention_mask,
58
+ top_p=1,
59
+ temperature=0.3,
60
+ max_length=600,
61
+ min_length=input_len + 4,
62
+ repetition_penalty=1.2,
63
+ do_sample=True,
64
+ pad_token_id=tokenizer.pad_token_id
65
+ )
66
+ response = tokenizer.batch_decode(
67
+ generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True
68
+ )[0]
69
+ response = response.split("### Response :")[-1].lstrip()
70
+ return response
71
+
72
+ ques = " احكي معايا باللهجة التونسية"
73
+ text = prompt_ar.format_map({'Question': ques})
74
+ print(get_response(text))
75
+ ```
76
+ - Response: بالطبع نجم نجاوب على سؤالك واللهجه التونسية هي نوع من اللهجات اللي تتكلم في بلاد اسمها تونس كيفما فما برشا لهجات مختلفة كيما الإنجليزية أو الإسبانية الناس في العالم يتكلموا لغات متنوعة أما اللهجة التونسى هيا الطريقة الخاصة بالكلام للناس في البلاد هذيك يعني كان تسألني سؤال بالهججه تونسي نحب نعاونك باش نفهموه
77
 
78
  This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
79
 
80
+ [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)