baohuynhbk14 commited on
Commit
ca55e17
·
1 Parent(s): 8f8d1e9

Update model references and titles to reflect new versioning scheme

Browse files
Files changed (4) hide show
  1. app.py +6 -10
  2. controller.py +1 -1
  3. gradio_web_server.py +2 -2
  4. model_worker.py +1 -12
app.py CHANGED
@@ -124,7 +124,7 @@ def vote_last_response(state, liked, request: gr.Request):
124
  conv_data = {
125
  "tstamp": round(time.time(), 4),
126
  "like": liked,
127
- "model": 'InternVL2.5-78B',
128
  "state": state.dict(),
129
  "ip": request.client.host,
130
  }
@@ -155,7 +155,7 @@ def vote_selected_response(
155
  "tstamp": round(time.time(), 4),
156
  "like": data.liked,
157
  "index": data.index,
158
- "model": 'InternVL2.5-78B',
159
  "state": state.dict(),
160
  "ip": request.client.host,
161
  }
@@ -230,7 +230,7 @@ def http_bot(
230
  max_input_tiles,
231
  request: gr.Request,
232
  ):
233
- model_name = 'InternVL2.5-78B'
234
  logger.info(f"http_bot. ip: {request.client.host}")
235
  start_tstamp = time.time()
236
  if hasattr(state, "skip_next") and state.skip_next:
@@ -320,11 +320,7 @@ def http_bot(
320
  return
321
 
322
  ai_response = state.return_last_message()
323
- if "<ref>" in ai_response:
324
- returned_image = find_bounding_boxes(state, ai_response)
325
- returned_image = [returned_image] if returned_image else []
326
- state.update_message(Conversation.ASSISTANT, ai_response, returned_image)
327
-
328
  state.end_of_current_turn()
329
 
330
  yield (
@@ -415,7 +411,7 @@ function createWaveAnimation() {
415
  text.style.color = 'transparent';
416
  text.style.fontSize = '28px';
417
  text.style.width = 'auto';
418
- text.textContent = 'InternVL2';
419
  text.style.fontWeight = 'bold';
420
  i += 1;
421
  }, 200);
@@ -442,7 +438,7 @@ def build_demo():
442
  )
443
 
444
  with gr.Blocks(
445
- title="InternVL-Chat",
446
  theme=gr.themes.Default(),
447
  css=block_css,
448
  ) as demo:
 
124
  conv_data = {
125
  "tstamp": round(time.time(), 4),
126
  "like": liked,
127
+ "model": 'Vintern-1B-v3',
128
  "state": state.dict(),
129
  "ip": request.client.host,
130
  }
 
155
  "tstamp": round(time.time(), 4),
156
  "like": data.liked,
157
  "index": data.index,
158
+ "model": 'Vintern-1B-v3',
159
  "state": state.dict(),
160
  "ip": request.client.host,
161
  }
 
230
  max_input_tiles,
231
  request: gr.Request,
232
  ):
233
+ model_name = 'Vintern-1B-v3'
234
  logger.info(f"http_bot. ip: {request.client.host}")
235
  start_tstamp = time.time()
236
  if hasattr(state, "skip_next") and state.skip_next:
 
320
  return
321
 
322
  ai_response = state.return_last_message()
323
+
 
 
 
 
324
  state.end_of_current_turn()
325
 
326
  yield (
 
411
  text.style.color = 'transparent';
412
  text.style.fontSize = '28px';
413
  text.style.width = 'auto';
414
+ text.textContent = 'Vintern-1B';
415
  text.style.fontWeight = 'bold';
416
  i += 1;
417
  }, 200);
 
438
  )
439
 
440
  with gr.Blocks(
441
+ title="Vintern-Chat",
442
  theme=gr.themes.Default(),
443
  css=block_css,
444
  ) as demo:
controller.py CHANGED
@@ -115,7 +115,7 @@ class Controller:
115
  def extract_key(s):
116
  if 'Pro' in s:
117
  return 999
118
- match = re.match(r'InternVL2-(\d+)B', s)
119
  if match:
120
  return int(match.group(1))
121
  return -1
 
115
  def extract_key(s):
116
  if 'Pro' in s:
117
  return 999
118
+ match = re.match(r'Vintern-(\d+)B', s)
119
  if match:
120
  return int(match.group(1))
121
  return -1
gradio_web_server.py CHANGED
@@ -44,9 +44,9 @@ def write2file(path, content):
44
  def sort_models(models):
45
  def custom_sort_key(model_name):
46
  # InternVL-Chat-V1-5 should be the first item
47
- if model_name == "InternVL-Chat-V1-5":
48
  return (1, model_name) # 1 indicates highest precedence
49
- elif model_name.startswith("InternVL-Chat-V1-5-"):
50
  return (1, model_name) # 1 indicates highest precedence
51
  else:
52
  return (0, model_name) # 0 indicates normal order
 
44
  def sort_models(models):
45
  def custom_sort_key(model_name):
46
  # InternVL-Chat-V1-5 should be the first item
47
+ if model_name == "Vintern-1B-v3":
48
  return (1, model_name) # 1 indicates highest precedence
49
+ elif model_name.startswith("Vintern-1B-v3"):
50
  return (1, model_name) # 1 indicates highest precedence
51
  else:
52
  return (0, model_name) # 0 indicates normal order
model_worker.py CHANGED
@@ -130,12 +130,7 @@ def split_model(model_name):
130
  device_map = {}
131
  world_size = torch.cuda.device_count()
132
  num_layers = {
133
- "InternVL2-8B": 32,
134
- "InternVL2-26B": 48,
135
- "InternVL2-40B": 60,
136
- "InternVL2-Llama3-76B": 80,
137
- "InternVL2-78B": 80,
138
- "InternVL2-Pro": 80,
139
  }[model_name]
140
  # Since the first GPU will be used for ViT, treat it as half a GPU.
141
  num_layers_per_gpu = math.ceil(num_layers / (world_size - 0.5))
@@ -207,12 +202,6 @@ class ModelWorker:
207
  tokenizer = AutoTokenizer.from_pretrained(
208
  model_path, trust_remote_code=True, use_fast=False
209
  )
210
- tokens_to_keep = ["<box>", "</box>", "<ref>", "</ref>"]
211
- tokenizer.additional_special_tokens = [
212
- item
213
- for item in tokenizer.additional_special_tokens
214
- if item not in tokens_to_keep
215
- ]
216
  self.tokenizer = tokenizer
217
 
218
  if device == "auto":
 
130
  device_map = {}
131
  world_size = torch.cuda.device_count()
132
  num_layers = {
133
+ "Vintern-1B-v3": 24,
 
 
 
 
 
134
  }[model_name]
135
  # Since the first GPU will be used for ViT, treat it as half a GPU.
136
  num_layers_per_gpu = math.ceil(num_layers / (world_size - 0.5))
 
202
  tokenizer = AutoTokenizer.from_pretrained(
203
  model_path, trust_remote_code=True, use_fast=False
204
  )
 
 
 
 
 
 
205
  self.tokenizer = tokenizer
206
 
207
  if device == "auto":