mabbas125 commited on
Commit
55e1199
·
verified ·
1 Parent(s): c9d9a3a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
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
+ )