Spaces:
Runtime error
Runtime error
fixed err
Browse files
app.py
CHANGED
@@ -7,9 +7,12 @@ with init_empty_weights():
|
|
7 |
tokenizer = AutoTokenizer.from_pretrained("Cognitive-Lab/LLama3-Gaja-Hindi-8B-v0.1")
|
8 |
model = AutoModelForCausalLM.from_pretrained("Cognitive-Lab/LLama3-Gaja-Hindi-8B-v0.1")
|
9 |
|
|
|
|
|
|
|
10 |
# Move the model to the GPU if available; otherwise, keep it on the CPU
|
11 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
12 |
-
model
|
13 |
|
14 |
# Define a function to run inference
|
15 |
def generate_response(prompt, max_new_tokens=30):
|
|
|
7 |
tokenizer = AutoTokenizer.from_pretrained("Cognitive-Lab/LLama3-Gaja-Hindi-8B-v0.1")
|
8 |
model = AutoModelForCausalLM.from_pretrained("Cognitive-Lab/LLama3-Gaja-Hindi-8B-v0.1")
|
9 |
|
10 |
+
# Load the model weights after initialization
|
11 |
+
model.load_state_dict(torch.load("path/to/your/model/pytorch_model.bin"))
|
12 |
+
|
13 |
# Move the model to the GPU if available; otherwise, keep it on the CPU
|
14 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
15 |
+
model.to(device)
|
16 |
|
17 |
# Define a function to run inference
|
18 |
def generate_response(prompt, max_new_tokens=30):
|