yusufcakmak commited on
Commit
4357647
1 Parent(s): da64ba3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -0
README.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - tr
4
+ - en
5
+ pipeline_tag: text-generation
6
+ ---
7
+ <img src="https://huggingface.co/Trendyol/Trendyol-LLM-7b-chat-v0.1/resolve/main/llama-tr-image.jpeg"
8
+ alt="drawing" width="400"/>
9
+ # **Trendyol LLM**
10
+ Trendyol LLM is a generative model that is based on LLaMa2 7B model. This is the repository for the chat model.
11
+
12
+ ## Model Details
13
+
14
+ **Model Developers** Trendyol
15
+
16
+ **Variations** base and chat variations.
17
+
18
+ **Input** Models input text only.
19
+
20
+ **Output** Models generate text only.
21
+
22
+ **Model Architecture** Trendyol LLM is an auto-regressive language model (based on LLaMa2 7b) that uses an optimized transformer architecture. The chat version is fine-tuned on 180K instruction sets with the following trainables by using LoRA:
23
+
24
+ - **lr**=1e-4
25
+ - **lora_rank**=64
26
+ - **lora_alpha**=128
27
+ - **lora_trainable**=q_proj,v_proj,k_proj,o_proj,gate_proj,down_proj,up_proj
28
+ - **modules_to_save**=embed_tokens,lm_head
29
+ - **lora_dropout**=0.05
30
+ - **fp16**=True
31
+ - **max_seq_length**=1024
32
+
33
+ <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/peft/lora_diagram.png"
34
+ alt="drawing" width="600"/>
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from transformers import AutoModelForCausalLM, LlamaTokenizer, pipeline
40
+
41
+ model_id = "CHANGE_ME_AFTER_MODEL_UPLOAD"
42
+ tokenizer = LlamaTokenizer.from_pretrained(model_id)
43
+ model = AutoModelForCausalLM.from_pretrained(model_id,
44
+ device_map='auto',
45
+ load_in_8bit=True)
46
+
47
+ sampling_params = dict(do_sample=True, temperature=0.3, top_k=50, top_p=0.9)
48
+
49
+ pipe = pipeline("text-generation",
50
+ model=model,
51
+ tokenizer=tokenizer,
52
+ device_map="auto",
53
+ max_new_tokens=1024,
54
+ return_full_text=True,
55
+ repetition_penalty=1.1
56
+ )
57
+
58
+ DEFAULT_SYSTEM_PROMPT = "Sen yardımcı bir asistansın ve sana verilen talimatlar doğrultusunda en iyi cevabı üretmeye çalışacaksın.\n"
59
+
60
+ TEMPLATE = (
61
+ "[INST] <<SYS>>\n"
62
+ "{system_prompt}\n"
63
+ "<</SYS>>\n\n"
64
+ "{instruction} [/INST]"
65
+ )
66
+
67
+ def generate_prompt(instruction, system_prompt=DEFAULT_SYSTEM_PROMPT):
68
+ return TEMPLATE.format_map({'instruction': instruction,'system_prompt': system_prompt})
69
+
70
+ def generate_output(user_query, sys_prompt=DEFAULT_SYSTEM_PROMPT):
71
+ prompt = generate_prompt(user_query, sys_prompt)
72
+ outputs = pipe(prompt,
73
+ **sampling_params
74
+ )
75
+ return outputs[0]["generated_text"].split("[/INST]")[-1]
76
+
77
+ user_query = "Türkiye'de kaç il var?"
78
+ response = generate_output(user_query)
79
+ ```
80
+
81
+ ## Limitations, Risks, Bias, and Ethical Considerations
82
+
83
+ ### Limitations and Known Biases
84
+
85
+ - **Primary Function and Application:** Trendyol LLM, an autoregressive language model, is primarily designed to predict the next token in a text string. While often used for various applications, it is important to note that it has not undergone extensive real-world application testing. Its effectiveness and reliability across diverse scenarios remain largely unverified.
86
+
87
+ - **Language Comprehension and Generation:** The model is primarily trained in standard English and Turkish. Its performance in understanding and generating slang, informal language, or other languages may be limited, leading to potential errors or misinterpretations.
88
+
89
+ - **Generation of False Information:** Users should be aware that Trendyol LLM may produce inaccurate or misleading information. Outputs should be considered as starting points or suggestions rather than definitive answers.
90
+
91
+ ### Risks and Ethical Considerations
92
+
93
+ - **Potential for Harmful Use:** There is a risk that Trendyol LLM could be used to generate offensive or harmful language. We strongly discourage its use for any such purposes and emphasize the need for application-specific safety and fairness evaluations before deployment.
94
+
95
+ - **Unintended Content and Bias:** The model was trained on a large corpus of text data, which was not explicitly checked for offensive content or existing biases. Consequently, it may inadvertently produce content that reflects these biases or inaccuracies.
96
+
97
+ - **Toxicity:** Despite efforts to select appropriate training data, the model is capable of generating harmful content, especially when prompted explicitly. We encourage the open-source community to engage in developing strategies to minimize such risks.
98
+
99
+ ### Recommendations for Safe and Ethical Usage
100
+
101
+ - **Human Oversight:** We recommend incorporating a human curation layer or using filters to manage and improve the quality of outputs, especially in public-facing applications. This approach can help mitigate the risk of generating objectionable content unexpectedly.
102
+
103
+ - **Application-Specific Testing:** Developers intending to use Trendyol LLM should conduct thorough safety testing and optimization tailored to their specific applications. This is crucial, as the model’s responses can be unpredictable and may occasionally be biased, inaccurate, or offensive.
104
+
105
+ - **Responsible Development and Deployment:** It is the responsibility of developers and users of Trendyol LLM to ensure its ethical and safe application. We urge users to be mindful of the model's limitations and to employ appropriate safeguards to prevent misuse or harmful consequences.