Update README.md
Browse files
README.md
CHANGED
@@ -18,7 +18,7 @@ RoPE support is not yet complete, but it has been confirmed that the perplexity
|
|
18 |
|
19 |
2024/07/30
|
20 |
- [Ryzen AI Software 1.2](https://ryzenai.docs.amd.com/en/latest/) has been released. Please note that this model is based on [Ryzen AI Software 1.1](https://ryzenai.docs.amd.com/en/1.1/index.html) and operation with 1.2 has not been confirmed.
|
21 |
-
|
22 |
|
23 |
|
24 |
|
@@ -93,6 +93,10 @@ You are a highly skilled professional translator. You are a native speaker of En
|
|
93 |
|
94 |
if __name__ == "__main__":
|
95 |
|
|
|
|
|
|
|
|
|
96 |
set_seed(123)
|
97 |
p = psutil.Process()
|
98 |
p.cpu_affinity([0, 1, 2, 3])
|
@@ -100,7 +104,7 @@ if __name__ == "__main__":
|
|
100 |
|
101 |
tokenizer = AutoTokenizer.from_pretrained("llama3.1-8b_translate-amd-npu")
|
102 |
tokenizer.pad_token_id = tokenizer.add_special_tokens({'pad_token': '<|finetune_right_pad_id|>'})
|
103 |
-
ckpt = "llama3.1_8b_translate_w_bit_4_awq_amd.pt"
|
104 |
|
105 |
model = torch.load(ckpt)
|
106 |
model.eval()
|
@@ -112,24 +116,14 @@ if __name__ == "__main__":
|
|
112 |
m.device = "aie"
|
113 |
m.quantize_weights()
|
114 |
|
115 |
-
terminators = [
|
116 |
-
tokenizer.eos_token_id,
|
117 |
-
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
118 |
-
]
|
119 |
-
model = torch.load(ckpt)
|
120 |
-
model.eval()
|
121 |
-
model = model.to(torch.bfloat16)
|
122 |
-
|
123 |
-
for n, m in model.named_modules():
|
124 |
-
if isinstance(m, qlinear.QLinearPerGrp):
|
125 |
-
print(f"Preparing weights of layer : {n}")
|
126 |
-
m.device = "aie"
|
127 |
-
m.quantize_weights()
|
128 |
|
129 |
|
130 |
-
print("Translate Japanese to English.", "1月1日は日本の祝日です。その日は日曜日で、5日ぶりに雨が降りました")
|
131 |
-
print("Translate English to Japanese.", "It’s raining cats and dogs.")
|
|
|
|
|
132 |
|
|
|
133 |
|
134 |
```
|
135 |
|
|
|
18 |
|
19 |
2024/07/30
|
20 |
- [Ryzen AI Software 1.2](https://ryzenai.docs.amd.com/en/latest/) has been released. Please note that this model is based on [Ryzen AI Software 1.1](https://ryzenai.docs.amd.com/en/1.1/index.html) and operation with 1.2 has not been confirmed.
|
21 |
+
- [amd/RyzenAI-SW 1.2](https://github.com/amd/RyzenAI-SW) was announced on July 29, 2024. This sample for [amd/RyzenAI-SW 1.1](https://github.com/amd/RyzenAI-SW/tree/1.1). Please note that the folder and script contents have been completely changed.
|
22 |
|
23 |
|
24 |
|
|
|
93 |
|
94 |
if __name__ == "__main__":
|
95 |
|
96 |
+
|
97 |
+
transformers.logging.set_verbosity_error()
|
98 |
+
logging.disable(logging.CRITICAL)
|
99 |
+
|
100 |
set_seed(123)
|
101 |
p = psutil.Process()
|
102 |
p.cpu_affinity([0, 1, 2, 3])
|
|
|
104 |
|
105 |
tokenizer = AutoTokenizer.from_pretrained("llama3.1-8b_translate-amd-npu")
|
106 |
tokenizer.pad_token_id = tokenizer.add_special_tokens({'pad_token': '<|finetune_right_pad_id|>'})
|
107 |
+
ckpt = r"llama3.1-8b_translate-amd-npu\llama3.1_8b_translate_w_bit_4_awq_amd.pt"
|
108 |
|
109 |
model = torch.load(ckpt)
|
110 |
model.eval()
|
|
|
116 |
m.device = "aie"
|
117 |
m.quantize_weights()
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
+
print(translation("Translate Japanese to English.", "1月1日は日本の祝日です。その日は日曜日で、5日ぶりに雨が降りました"))
|
122 |
+
print(translation("Translate English to Japanese.", "It’s raining cats and dogs."))
|
123 |
+
print(translation("Translate French to Japanese.", "Après la pluie, le beau temps"))
|
124 |
+
print(translation("Translate Mandarin to Japanese.", "说曹操曹操就到"))
|
125 |
|
126 |
+
|
127 |
|
128 |
```
|
129 |
|