Update app.py
Browse files
app.py
CHANGED
|
@@ -66,14 +66,13 @@ transformers.utils.logging.enable_explicit_format()
|
|
| 66 |
model_id = "microsoft/bitnet-b1.58-2B-4T-bf16"
|
| 67 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 68 |
hf_save_dir = "./bitnet"
|
| 69 |
-
|
| 70 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 71 |
if torch.cuda.is_available():
|
| 72 |
print("CUDA is available. Using GPU:", torch.cuda.get_device_name(0))
|
| 73 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16)
|
| 74 |
else:
|
| 75 |
print("CUDA not available; using CPU.")
|
| 76 |
-
|
| 77 |
|
| 78 |
model.to(device)
|
| 79 |
print(f"Loaded pre-trained Hugging Face model '{model_id}'.")
|
|
|
|
| 66 |
model_id = "microsoft/bitnet-b1.58-2B-4T-bf16"
|
| 67 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 68 |
hf_save_dir = "./bitnet"
|
| 69 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 70 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 71 |
if torch.cuda.is_available():
|
| 72 |
print("CUDA is available. Using GPU:", torch.cuda.get_device_name(0))
|
|
|
|
| 73 |
else:
|
| 74 |
print("CUDA not available; using CPU.")
|
| 75 |
+
|
| 76 |
|
| 77 |
model.to(device)
|
| 78 |
print(f"Loaded pre-trained Hugging Face model '{model_id}'.")
|