Spaces:
Sleeping
Sleeping
test2023h5
commited on
Commit
•
80a62d4
1
Parent(s):
a4d06d8
Update main.py
Browse files
main.py
CHANGED
@@ -1,6 +1,13 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from pydantic import BaseModel
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
app = FastAPI()
|
5 |
|
6 |
# 定义一个数据模型,用于POST请求的参数
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from pydantic import BaseModel
|
3 |
|
4 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
+
from peft import PeftModel, get_peft_config
|
6 |
+
import json
|
7 |
+
import torch
|
8 |
+
|
9 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
10 |
+
|
11 |
app = FastAPI()
|
12 |
|
13 |
# 定义一个数据模型,用于POST请求的参数
|