Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
+
import os
|
4 |
+
|
5 |
+
# Explicitly set the cache directory
|
6 |
+
# cache_dir = 'D:/huggingface_cache'
|
7 |
+
|
8 |
+
# Check the current working directory
|
9 |
+
print("Current working directory:", os.getcwd())
|
10 |
+
|
11 |
+
# Load the tokenizer and model with cache_dir
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained("chatdb/natural-sql-7b")
|
13 |
+
model = AutoModelForCausalLM.from_pretrained(
|
14 |
+
"chatdb/natural-sql-7b",
|
15 |
+
device_map="auto",
|
16 |
+
torch_dtype=torch.float16,
|
17 |
+
)
|