Spaces:
Paused
Paused
Update app.py
Browse filesupdate model class to AutoModelForCausalLM
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import torch
|
4 |
import spaces
|
5 |
-
from transformers import
|
6 |
from huggingface_hub import login
|
7 |
|
8 |
hf_token = os.getenv("HF_TOKEN")
|
@@ -14,7 +14,7 @@ def get_model_summary(model_name):
|
|
14 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
15 |
|
16 |
# Load the model and move it to the selected device
|
17 |
-
model =
|
18 |
|
19 |
# Return the model's architecture as a string
|
20 |
return str(model)
|
|
|
2 |
import os
|
3 |
import torch
|
4 |
import spaces
|
5 |
+
from transformers import AutoModelForCausalLM
|
6 |
from huggingface_hub import login
|
7 |
|
8 |
hf_token = os.getenv("HF_TOKEN")
|
|
|
14 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
15 |
|
16 |
# Load the model and move it to the selected device
|
17 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True).to(device)
|
18 |
|
19 |
# Return the model's architecture as a string
|
20 |
return str(model)
|