mirror of
https://github.com/deepseek-ai/DeepSeek-VL.git
synced 2025-04-19 10:09:09 -04:00
chore: make format
This commit is contained in:
parent
d06f85c7f3
commit
699a77bf03
@ -132,8 +132,12 @@ def chat(args, tokenizer, vl_chat_processor, vl_gpt, generation_config):
|
|||||||
|
|
||||||
while cur_img_idx < num_images:
|
while cur_img_idx < num_images:
|
||||||
try:
|
try:
|
||||||
image_file = input(f"({cur_img_idx + 1}/{num_images}) Input the image file path: ")
|
image_file = input(
|
||||||
image_file = image_file.strip() # trim whitespaces around path, enables drop-in from for example Dolphin
|
f"({cur_img_idx + 1}/{num_images}) Input the image file path: "
|
||||||
|
)
|
||||||
|
image_file = (
|
||||||
|
image_file.strip()
|
||||||
|
) # trim whitespaces around path, enables drop-in from for example Dolphin
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print()
|
print()
|
||||||
|
@ -20,10 +20,12 @@
|
|||||||
|
|
||||||
# check if python version is above 3.10
|
# check if python version is above 3.10
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info >=(3, 10):
|
|
||||||
|
if sys.version_info >= (3, 10):
|
||||||
print("Python version is above 3.10, patching the collections module.")
|
print("Python version is above 3.10, patching the collections module.")
|
||||||
# Monkey patch collections
|
# Monkey patch collections
|
||||||
import collections
|
import collections
|
||||||
import collections.abc
|
import collections.abc
|
||||||
|
|
||||||
for type_name in collections.abc.__all__:
|
for type_name in collections.abc.__all__:
|
||||||
setattr(collections, type_name, getattr(collections.abc, type_name))
|
setattr(collections, type_name, getattr(collections.abc, type_name))
|
||||||
|
@ -338,9 +338,9 @@ class VisionTransformer(nn.Module):
|
|||||||
|
|
||||||
self.num_classes = num_classes
|
self.num_classes = num_classes
|
||||||
self.global_pool = global_pool
|
self.global_pool = global_pool
|
||||||
self.num_features = (
|
self.num_features = self.embed_dim = (
|
||||||
self.embed_dim
|
embed_dim # num_features for consistency with other models
|
||||||
) = embed_dim # num_features for consistency with other models
|
)
|
||||||
self.num_prefix_tokens = 1 if class_token else 0
|
self.num_prefix_tokens = 1 if class_token else 0
|
||||||
self.num_prefix_tokens += reg_tokens
|
self.num_prefix_tokens += reg_tokens
|
||||||
self.num_reg_tokens = reg_tokens
|
self.num_reg_tokens = reg_tokens
|
||||||
|
@ -50,9 +50,11 @@ def convert_conversation_to_prompts(conversation: Conversation):
|
|||||||
for i in range(0, len(messages), 2):
|
for i in range(0, len(messages), 2):
|
||||||
prompt = {
|
prompt = {
|
||||||
"role": messages[i][0],
|
"role": messages[i][0],
|
||||||
"content": messages[i][1][0]
|
"content": (
|
||||||
|
messages[i][1][0]
|
||||||
if isinstance(messages[i][1], tuple)
|
if isinstance(messages[i][1], tuple)
|
||||||
else messages[i][1],
|
else messages[i][1]
|
||||||
|
),
|
||||||
"images": [messages[i][1][1]] if isinstance(messages[i][1], tuple) else [],
|
"images": [messages[i][1][1]] if isinstance(messages[i][1], tuple) else [],
|
||||||
}
|
}
|
||||||
response = {"role": messages[i + 1][0], "content": messages[i + 1][1]}
|
response = {"role": messages[i + 1][0], "content": messages[i + 1][1]}
|
||||||
|
@ -10,7 +10,7 @@ authors = [{name = "DeepSeek-AI"}]
|
|||||||
license = {file = "LICENSE-CODE"}
|
license = {file = "LICENSE-CODE"}
|
||||||
urls = {homepage = "https://github.com/deepseek-ai/DeepSeek-VL"}
|
urls = {homepage = "https://github.com/deepseek-ai/DeepSeek-VL"}
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.8, <3.10"
|
requires-python = ">=3.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"torch>=2.0.1",
|
"torch>=2.0.1",
|
||||||
"transformers>=4.38.2",
|
"transformers>=4.38.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user