Spaces:
Runtime error
Runtime error
MEOW commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,25 +28,25 @@ from llama_index.llms.nvidia import NVIDIA
|
|
| 28 |
from document_processors import load_multimodal_data, load_data_from_directory
|
| 29 |
from utils import set_environment_variables
|
| 30 |
|
| 31 |
-
import torch #GPU setup environment start
|
| 32 |
-
from transformers import AutoModel, AutoTokenizer
|
| 33 |
|
| 34 |
# Check if CUDA is available and set the device
|
| 35 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 36 |
# print(f"Using device: {device}")
|
| 37 |
|
| 38 |
# Load model and tokenizer
|
| 39 |
-
model_name = "meta-llama/Llama-3.1-8B-Instruct"
|
| 40 |
-
model = AutoModel.from_pretrained(model_name).to(device)
|
| 41 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 42 |
|
| 43 |
# Example function for inference
|
| 44 |
-
def get_response(input_text):
|
| 45 |
-
inputs = tokenizer(input_text, return_tensors="pt").to(device)
|
| 46 |
-
with torch.no_grad():
|
| 47 |
-
outputs = model(**inputs)
|
| 48 |
# Process outputs here, this depends on your specific model's output
|
| 49 |
-
return "Your processed output or prediction here" #GPU setup environment end
|
| 50 |
|
| 51 |
|
| 52 |
# Set up the page configuration
|
|
|
|
| 28 |
from document_processors import load_multimodal_data, load_data_from_directory
|
| 29 |
from utils import set_environment_variables
|
| 30 |
|
| 31 |
+
# import torch #GPU setup environment start
|
| 32 |
+
# from transformers import AutoModel, AutoTokenizer
|
| 33 |
|
| 34 |
# Check if CUDA is available and set the device
|
| 35 |
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 36 |
# print(f"Using device: {device}")
|
| 37 |
|
| 38 |
# Load model and tokenizer
|
| 39 |
+
# model_name = "meta-llama/Llama-3.1-8B-Instruct"
|
| 40 |
+
# model = AutoModel.from_pretrained(model_name).to(device)
|
| 41 |
+
# tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 42 |
|
| 43 |
# Example function for inference
|
| 44 |
+
# def get_response(input_text):
|
| 45 |
+
# inputs = tokenizer(input_text, return_tensors="pt").to(device)
|
| 46 |
+
# with torch.no_grad():
|
| 47 |
+
# outputs = model(**inputs)
|
| 48 |
# Process outputs here, this depends on your specific model's output
|
| 49 |
+
# return "Your processed output or prediction here" #GPU setup environment end
|
| 50 |
|
| 51 |
|
| 52 |
# Set up the page configuration
|