Upload 18 files
Browse files- inference.py +1 -1
- modeling_mmalaya.py +3 -3
inference.py
CHANGED
|
@@ -43,7 +43,7 @@ def main(args):
|
|
| 43 |
stopping_criteria = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)
|
| 44 |
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, timeout=20.0)
|
| 45 |
# 加载图像
|
| 46 |
-
image = Image.open('./
|
| 47 |
image_tensor = image_processor(image, return_tensors='pt')['pixel_values'].half().cuda()
|
| 48 |
# 推理
|
| 49 |
with torch.inference_mode():
|
|
|
|
| 43 |
stopping_criteria = KeywordsStoppingCriteria(keywords, tokenizer, input_ids)
|
| 44 |
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, timeout=20.0)
|
| 45 |
# 加载图像
|
| 46 |
+
image = Image.open('./chang_chen.jpg').convert("RGB")
|
| 47 |
image_tensor = image_processor(image, return_tensors='pt')['pixel_values'].half().cuda()
|
| 48 |
# 推理
|
| 49 |
with torch.inference_mode():
|
modeling_mmalaya.py
CHANGED
|
@@ -8,9 +8,9 @@ import math
|
|
| 8 |
from transformers import AutoConfig, AutoModelForCausalLM
|
| 9 |
from transformers.modeling_outputs import CausalLMOutputWithPast
|
| 10 |
|
| 11 |
-
from
|
| 12 |
-
from mmalaya_arch import MMAlayaMetaModel, MMAlayaMetaForCausalLM
|
| 13 |
-
from configuration_mmalaya import MMAlayaMPTConfig
|
| 14 |
|
| 15 |
|
| 16 |
class MMAlayaMPTModel(MMAlayaMetaModel, MPTModel):
|
|
|
|
| 8 |
from transformers import AutoConfig, AutoModelForCausalLM
|
| 9 |
from transformers.modeling_outputs import CausalLMOutputWithPast
|
| 10 |
|
| 11 |
+
from .modeling_mpt import MPTConfig, MPTForCausalLM, MPTModel
|
| 12 |
+
from .mmalaya_arch import MMAlayaMetaModel, MMAlayaMetaForCausalLM
|
| 13 |
+
from .configuration_mmalaya import MMAlayaMPTConfig
|
| 14 |
|
| 15 |
|
| 16 |
class MMAlayaMPTModel(MMAlayaMetaModel, MPTModel):
|