tkesgin commited on
Commit
995b002
1 Parent(s): 22c8a89

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -0
README.md CHANGED
@@ -1,5 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <img src="./cosmosLLaMa2_r2.png"/>
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
4
  license: llama3
5
  ---
 
1
+ ---
2
+ license: llama3
3
+ language:
4
+ - tr
5
+ pipeline_tag: text-generation
6
+ base_model: meta-llama/Meta-Llama-3-8B
7
+ tags:
8
+ - Turkish
9
+ - turkish
10
+ - Llama
11
+ - Llama3
12
+ ---
13
+
14
  <img src="./cosmosLLaMa2_r2.png"/>
15
 
16
+
17
+ # Cosmos LLaMa Instruct
18
+
19
+ This model is a fully fine-tuned version of the "meta-llama/Meta-Llama-3-8B-Instruct" model with a 30GB Turkish dataset.
20
+
21
+ The Cosmos LLaMa Instruct is designed for text generation tasks, providing the ability to continue a given text snippet in a coherent and contextually relevant manner. Due to the diverse nature of the training data, which includes websites, books, and other text sources, this model can exhibit biases. Users should be aware of these biases and use the model responsibly.
22
+
23
+
24
+ #### Transformers pipeline
25
+
26
+ ```python
27
+ import transformers
28
+ import torch
29
+
30
+ model_id = "ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1"
31
+
32
+ pipeline = transformers.pipeline(
33
+ "text-generation",
34
+ model=model_id,
35
+ model_kwargs={"torch_dtype": torch.bfloat16},
36
+ device_map="auto",
37
+ )
38
+
39
+ messages = [
40
+ {"role": "system", "content": "Sen bir yapay zeka asistanısın. Kullanıcı sana bir görev verecek. Amacın görevi olabildiğince sadık bir şekilde tamamlamak. Görevi yerine getirirken adım adım düşün ve adımlarını gerekçelendir."},
41
+ {"role": "user", "content": "Soru: Bir arabanın deposu 60 litre benzin alabiliyor. Araba her 100 kilometrede 8 litre benzin tüketiyor. Depo tamamen doluyken araba kaç kilometre yol alabilir?"},
42
+ ]
43
+
44
+ terminators = [
45
+ pipeline.tokenizer.eos_token_id,
46
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
47
+ ]
48
+
49
+ outputs = pipeline(
50
+ messages,
51
+ max_new_tokens=256,
52
+ eos_token_id=terminators,
53
+ do_sample=True,
54
+ temperature=0.6,
55
+ top_p=0.9,
56
+ )
57
+ print(outputs[0]["generated_text"][-1])
58
+ ```
59
+
60
+ #### Transformers AutoModelForCausalLM
61
+
62
+ ```python
63
+ from transformers import AutoTokenizer, AutoModelForCausalLM
64
+ import torch
65
+
66
+ model_id = "ytu-ce-cosmos/Turkish-Llama-8b-Instruct-v0.1"
67
+
68
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
69
+ model = AutoModelForCausalLM.from_pretrained(
70
+ model_id,
71
+ torch_dtype=torch.bfloat16,
72
+ device_map="auto",
73
+ )
74
+
75
+ messages = [
76
+ {"role": "system", "content": "Sen bir yapay zeka asistanısın. Kullanıcı sana bir görev verecek. Amacın görevi olabildiğince sadık bir şekilde tamamlamak. Görevi yerine getirirken adım adım düşün ve adımlarını gerekçelendir."},
77
+ {"role": "user", "content": "Soru: Bir arabanın deposu 60 litre benzin alabiliyor. Araba her 100 kilometrede 8 litre benzin tüketiyor. Depo tamamen doluyken araba kaç kilometre yol alabilir?"},
78
+ ]
79
+
80
+ input_ids = tokenizer.apply_chat_template(
81
+ messages,
82
+ add_generation_prompt=True,
83
+ return_tensors="pt"
84
+ ).to(model.device)
85
+
86
+ terminators = [
87
+ tokenizer.eos_token_id,
88
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
89
+ ]
90
+
91
+ outputs = model.generate(
92
+ input_ids,
93
+ max_new_tokens=256,
94
+ eos_token_id=terminators,
95
+ do_sample=True,
96
+ temperature=0.6,
97
+ top_p=0.9,
98
+ )
99
+ response = outputs[0][input_ids.shape[-1]:]
100
+ print(tokenizer.decode(response, skip_special_tokens=True))
101
+ ```
102
+
103
+
104
+ # Acknowledgments
105
+ - Thanks to the generous support from the Hugging Face team, it is possible to download models from their S3 storage 🤗
106
+ - Computing resources used in this work were provided by the National Center for High Performance Computing of Turkey (UHeM) under grant numbers 1016912023 and
107
+ 1018512024
108
+ - Research supported with Cloud TPUs from Google's TPU Research Cloud (TRC)
109
+
110
+ ### Contact
111
+ COSMOS AI Research Group, Yildiz Technical University Computer Engineering Department <br>
112
+ https://cosmos.yildiz.edu.tr/ <br>
113
114
+
115
  ---
116
  license: llama3
117
  ---