1TuanPham commited on
Commit
f674f65
1 Parent(s): bed2d73

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -1
README.md CHANGED
@@ -58,22 +58,58 @@ Recommend keeping the system prompt in english.
58
 
59
  Use the code below to get started with the model.
60
  ```python
 
61
  from torch.cuda.amp import autocast
62
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, pipeline
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  model_name = "1TuanPham/T-Llama"
65
  model = AutoModelForCausalLM.from_pretrained(model_name,
66
  torch_dtype=torch.bfloat16,
67
  use_cache=True,
 
68
  )
69
  tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
70
  streamer = TextStreamer(tokenizer, skip_special_tokens=True)
71
  pipe = pipeline("text-generation", model=base_model, tokenizer=tokenizer, streamer=streamer)
72
 
73
  with autocast():
74
- output_default = pipe("Phạm Nhật Vượng là ", pad_token_id=50256, max_new_tokens=128)
75
 
76
  ```
 
 
 
 
 
 
 
 
 
77
  ## Training Details
78
 
79
  **Hardware Type:**
 
58
 
59
  Use the code below to get started with the model.
60
  ```python
61
+ import torch
62
  from torch.cuda.amp import autocast
63
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, pipeline
64
 
65
+
66
+ def prompt_format(system_prompt, instruction):
67
+ prompt = f"""{system_prompt}
68
+
69
+ ####### Instruction:
70
+
71
+ {instruction}
72
+
73
+ %%%%%%% Response:
74
+
75
+ """
76
+ return prompt
77
+
78
+ system_prompt = """
79
+ You're an AI Large Language Model developed(created) by an AI developer named Tuấn, the architecture of you is decoder-based LM, your task are to think loudly step by step before give a good and relevant response
80
+ to the user request, answer in the language the user preferred.
81
+
82
+ The AI has been trained to answer questions, provide recommendations, and help with decision making. The AI thinks outside the box and follows the user requests
83
+ """
84
+ instruction = "Xin chào"
85
+
86
+ formatted_prompt = prompt_format(system_prompt, instruction)
87
+ print(formatted_prompt)
88
+
89
+
90
  model_name = "1TuanPham/T-Llama"
91
  model = AutoModelForCausalLM.from_pretrained(model_name,
92
  torch_dtype=torch.bfloat16,
93
  use_cache=True,
94
+ device_map="auto"
95
  )
96
  tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
97
  streamer = TextStreamer(tokenizer, skip_special_tokens=True)
98
  pipe = pipeline("text-generation", model=base_model, tokenizer=tokenizer, streamer=streamer)
99
 
100
  with autocast():
101
+ output_default = pipe(formatted_prompt, pad_token_id=50256, max_new_tokens=128)
102
 
103
  ```
104
+ Example output:
105
+ ```bash
106
+ Xin chào! Tôi là một AI được phát triển bởi một AI nhà phát triển tên là Tuấn. Tôi được thiết kế để giúp đỡ người dùng bằng cách trả lời các câu hỏi, đưa ra đề xuất và hỗ trợ trong quá trình ra quyết định.
107
+ Tôi có thể hỗ trợ bạn bằng cách nghĩ ra các câu trả lời hay và phù hợp cho các câu hỏi của bạn.
108
+ ```
109
+
110
+ Here is a kaggle script to quickly test the model:
111
+ https://www.kaggle.com/code/tuanphamm/t-llama-test
112
+
113
  ## Training Details
114
 
115
  **Hardware Type:**