Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,14 @@
|
|
1 |
-
import torch
|
2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
import streamlit as st
|
4 |
from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
|
5 |
from clarifai_grpc.grpc.api import resources_pb2, service_pb2, service_pb2_grpc
|
6 |
from clarifai_grpc.grpc.api.status import status_code_pb2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# GPT-4 credentials
|
9 |
PAT_GPT4 = "3ca5bd8b0f2244eb8d0e4b2838fc3cf1"
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from clarifai_grpc.channel.clarifai_channel import ClarifaiChannel
|
3 |
from clarifai_grpc.grpc.api import resources_pb2, service_pb2, service_pb2_grpc
|
4 |
from clarifai_grpc.grpc.api.status import status_code_pb2
|
5 |
+
import torch
|
6 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
7 |
+
|
8 |
+
torch.set_default_device("cpu")
|
9 |
+
|
10 |
+
model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2", torch_dtype="auto", trust_remote_code=True)
|
11 |
+
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
12 |
|
13 |
# GPT-4 credentials
|
14 |
PAT_GPT4 = "3ca5bd8b0f2244eb8d0e4b2838fc3cf1"
|