Update README.md
Browse files
README.md
CHANGED
@@ -91,13 +91,17 @@ if __name__ == "__main__":
|
|
91 |
p = psutil.Process()
|
92 |
p.cpu_affinity([0, 1, 2, 3])
|
93 |
torch.set_num_threads(4)
|
|
|
|
|
94 |
|
95 |
tokenizer = AutoTokenizer.from_pretrained("ALMA-Ja-V3-amd-npu")
|
96 |
-
|
|
|
97 |
|
98 |
model = torch.load(ckpt)
|
99 |
model.eval()
|
100 |
model = model.to(torch.bfloat16)
|
|
|
101 |
|
102 |
for n, m in model.named_modules():
|
103 |
if isinstance(m, qlinear.QLinearPerGrp):
|
@@ -105,20 +109,9 @@ if __name__ == "__main__":
|
|
105 |
m.device = "aie"
|
106 |
m.quantize_weights()
|
107 |
|
108 |
-
model = torch.load(ckpt)
|
109 |
-
model.eval()
|
110 |
-
model = model.to(torch.bfloat16)
|
111 |
-
|
112 |
-
for n, m in model.named_modules():
|
113 |
-
if isinstance(m, qlinear.QLinearPerGrp):
|
114 |
-
print(f"Preparing weights of layer : {n}")
|
115 |
-
m.device = "aie"
|
116 |
-
m.quantize_weights()
|
117 |
-
|
118 |
-
print("Translate Japanese to English.", "面白きこともなき世を面白く住みなすものは心なりけり")
|
119 |
-
print("Translate English to Japanese.", "If today were the last day of your life, would you want to do what you are about to do today.")
|
120 |
-
|
121 |
|
|
|
|
|
122 |
```
|
123 |
|
124 |
![chat_image](alma-v3.png)
|
|
|
91 |
p = psutil.Process()
|
92 |
p.cpu_affinity([0, 1, 2, 3])
|
93 |
torch.set_num_threads(4)
|
94 |
+
transformers.logging.set_verbosity_error()
|
95 |
+
logging.disable(logging.CRITICAL)
|
96 |
|
97 |
tokenizer = AutoTokenizer.from_pretrained("ALMA-Ja-V3-amd-npu")
|
98 |
+
tokenizer.pad_token = tokenizer.eos_token
|
99 |
+
ckpt = r"ALMA-Ja-V3-amd-npu\alma_w_bit_4_awq_fa_amd.pt"
|
100 |
|
101 |
model = torch.load(ckpt)
|
102 |
model.eval()
|
103 |
model = model.to(torch.bfloat16)
|
104 |
+
|
105 |
|
106 |
for n, m in model.named_modules():
|
107 |
if isinstance(m, qlinear.QLinearPerGrp):
|
|
|
109 |
m.device = "aie"
|
110 |
m.quantize_weights()
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
print(translation("Translate Japanese to English.", "面白きこともなき世を面白く住みなすものは心なりけり"))
|
114 |
+
print(translation("Translate English to Japanese.", "Join me, and together we can rule the galaxy as father and son."))
|
115 |
```
|
116 |
|
117 |
![chat_image](alma-v3.png)
|