Update app.py
Browse files
app.py
CHANGED
@@ -28,14 +28,14 @@ assert device in ['cuda', 'mps']
|
|
28 |
# Load model
|
29 |
model_path = 'y0un92/test'
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
40 |
model.eval()
|
41 |
|
|
|
28 |
# Load model
|
29 |
model_path = 'y0un92/test'
|
30 |
|
31 |
+
if 'int4' in model_path:
|
32 |
+
if device == 'mps':
|
33 |
+
print('Error: running int4 model with bitsandbytes on Mac is not supported right now.')
|
34 |
+
exit()
|
35 |
+
model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
|
36 |
+
else:
|
37 |
+
model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(dtype=torch.float16)
|
38 |
+
model = model.to(device=device)
|
39 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
40 |
model.eval()
|
41 |
|