Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -20,18 +20,10 @@ MAX_FRAMES = 64
|
|
20 |
|
21 |
model_name = "openbmb/MiniCPM-o-2_6"
|
22 |
|
23 |
-
repo = AutoModel.from_pretrained(
|
24 |
-
model_name,
|
25 |
-
init_vision=True,
|
26 |
-
init_audio=True,
|
27 |
-
init_tts=False,
|
28 |
-
trust_remote_code=True,
|
29 |
-
attn_implementation="sdpa",
|
30 |
-
torch_dtype=torch.bfloat16,
|
31 |
-
)
|
32 |
-
repo = repo.eval().to(DEVICE)
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
34 |
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
|
|
|
35 |
css = '''
|
36 |
.gradio-container{max-width: 560px !important}
|
37 |
h1{text-align:center}
|
@@ -82,8 +74,8 @@ def generate(image, video, audio, instruction=DEFAULT_INPUT, sampling=False, tem
|
|
82 |
params = {
|
83 |
"image": media,
|
84 |
"msgs": inputs,
|
85 |
-
"tokenizer": tokenizer,
|
86 |
-
"processor": processor,
|
87 |
"sampling": sampling,
|
88 |
"temperature": temperature,
|
89 |
"top_p": top_p,
|
|
|
20 |
|
21 |
model_name = "openbmb/MiniCPM-o-2_6"
|
22 |
|
23 |
+
repo = AutoModel.from_pretrained(model_name, trust_remote_code=True, attn_implementation="sdpa", torch_dtype=torch.bfloat16).to(DEVICE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
25 |
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
|
26 |
+
|
27 |
css = '''
|
28 |
.gradio-container{max-width: 560px !important}
|
29 |
h1{text-align:center}
|
|
|
74 |
params = {
|
75 |
"image": media,
|
76 |
"msgs": inputs,
|
77 |
+
#"tokenizer": tokenizer,
|
78 |
+
#"processor": processor,
|
79 |
"sampling": sampling,
|
80 |
"temperature": temperature,
|
81 |
"top_p": top_p,
|