Upload app1.py
Browse files
app1.py
CHANGED
|
@@ -7,13 +7,13 @@ from model.modeling_llada import LLaDAModelLM
|
|
| 7 |
import time
|
| 8 |
import re
|
| 9 |
|
| 10 |
-
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 11 |
-
print(f"Using device: {device}")
|
| 12 |
-
|
| 13 |
# Load model and tokenizer
|
| 14 |
tokenizer = AutoTokenizer.from_pretrained('GSAI-ML/LLaDA-8B-Instruct', trust_remote_code=True)
|
| 15 |
model = LLaDAModelLM.from_pretrained('GSAI-ML/LLaDA-8B-Instruct', trust_remote_code=True,
|
| 16 |
-
torch_dtype=torch.bfloat16, device_map = 'auto')
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Constants
|
| 19 |
MASK_TOKEN = "[MASK]"
|
|
|
|
| 7 |
import time
|
| 8 |
import re
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# Load model and tokenizer
|
| 11 |
tokenizer = AutoTokenizer.from_pretrained('GSAI-ML/LLaDA-8B-Instruct', trust_remote_code=True)
|
| 12 |
model = LLaDAModelLM.from_pretrained('GSAI-ML/LLaDA-8B-Instruct', trust_remote_code=True,
|
| 13 |
+
torch_dtype=torch.bfloat16, device_map = 'auto')
|
| 14 |
+
|
| 15 |
+
device = next(iter(model.parameters())).device.type
|
| 16 |
+
print(f"Using device: {device}")
|
| 17 |
|
| 18 |
# Constants
|
| 19 |
MASK_TOKEN = "[MASK]"
|