morpheushoc commited on
Commit
dc963f2
·
verified ·
1 Parent(s): 337cbfd

Upload InternVideo2_cls

Browse files
config.json CHANGED
@@ -1,12 +1,11 @@
1
  {
2
- "_attn_implementation_autoset": true,
3
  "_name_or_path": "OpenGVLab/InternVideo2-Chat-8B",
4
  "architectures": [
5
- "InternVideo2_VideoChat2"
6
  ],
7
  "auto_map": {
8
  "AutoConfig": "model_config.VideoChat2Config",
9
- "AutoModel": "OpenGVLab/InternVideo2-Chat-8B--modeling_videochat2.InternVideo2_VideoChat2"
10
  },
11
  "model_cls": "InternVideo2_VideoChat2",
12
  "model_config": {
 
1
  {
 
2
  "_name_or_path": "OpenGVLab/InternVideo2-Chat-8B",
3
  "architectures": [
4
+ "InternVideo2_cls"
5
  ],
6
  "auto_map": {
7
  "AutoConfig": "model_config.VideoChat2Config",
8
+ "AutoModel": "modeling_videochat2_cls.InternVideo2_cls"
9
  },
10
  "model_cls": "InternVideo2_VideoChat2",
11
  "model_config": {
model-00007-of-00007.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b89bcd9e80fdd0fa7fbe46a241ce5d61dafd4d9bcca1c27f4d525ba4cc852bfe
3
- size 4109221232
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:240110bc5d108ac86d9b6032701ac1dec9c0811b2642827bfad2295cfa1d4582
3
+ size 4117577080
model.safetensors.index.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "metadata": {
3
- "total_size": 33346282496
4
  },
5
  "weight_map": {
6
  "extra_query_tokens": "model-00001-of-00007.safetensors",
 
1
  {
2
  "metadata": {
3
+ "total_size": 33354638336
4
  },
5
  "weight_map": {
6
  "extra_query_tokens": "model-00001-of-00007.safetensors",
modeling_videochat2_cls.py CHANGED
@@ -21,23 +21,7 @@ class InternVideo2_cls(InternVideo2_VideoChat2):
21
  # attn_implementation="flash_attention_2",
22
  )
23
  self.lm = AutoModelForSequenceClassification.from_config(config)
24
- elif self.model_config.llm.name == 'internlm_20b':
25
- from transformers import AutoModelForSequenceClassification
26
- self.lm = AutoModelForSequenceClassification.from_pretrained(
27
- self.model_config.llm.pretrained_llm_path,
28
- torch_dtype=torch.bfloat16,
29
- trust_remote_code=True,
30
- )
31
- self.lm.gradient_checkpointing = True
32
- self.lm._set_gradient_checkpointing()
33
- elif self.model_config.llm.name == 'internlm2_5_7b':
34
- from transformers import AutoModelForSequenceClassification
35
- self.lm = AutoModelForSequenceClassification.from_pretrained(
36
- self.model_config.llm.pretrained_llm_path,
37
- torch_dtype=torch.bfloat16,
38
- trust_remote_code=True,
39
- local_files_only=True,
40
- )
41
  else:
42
  raise NotImplementedError(self.model_config.llm.name)
43
 
@@ -51,18 +35,12 @@ class InternVideo2_cls(InternVideo2_VideoChat2):
51
  self.use_lora = True
52
  from peft import get_peft_model, LoraConfig, TaskType
53
  logger.info("Use lora")
54
- if self.model_config.llm.name == 'internlm_20b':
55
- peft_config = LoraConfig(
56
- task_type=TaskType.CAUSAL_LM, inference_mode=False,
57
- r=self.model_config.llm.lora_r, lora_alpha=self.model_config.llm.lora_alpha, lora_dropout=self.model_config.llm.lora_dropout,
58
- target_modules=['wqkv', 'wo', 'w1', 'w2', 'w3', 'output']
59
- )
60
- else:
61
- peft_config = LoraConfig(
62
- task_type=TaskType.CAUSAL_LM, inference_mode=False,
63
- r=self.model_config.llm.lora_r, lora_alpha=self.model_config.llm.lora_alpha, lora_dropout=self.model_config.llm.lora_dropout,
64
- target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
65
- "gate_proj", "up_proj", "down_proj", "lm_head"]
66
  )
67
 
68
  self.lm = get_peft_model(self.lm, peft_config)
 
21
  # attn_implementation="flash_attention_2",
22
  )
23
  self.lm = AutoModelForSequenceClassification.from_config(config)
24
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  else:
26
  raise NotImplementedError(self.model_config.llm.name)
27
 
 
35
  self.use_lora = True
36
  from peft import get_peft_model, LoraConfig, TaskType
37
  logger.info("Use lora")
38
+
39
+ peft_config = LoraConfig(
40
+ task_type=TaskType.CAUSAL_LM, inference_mode=False,
41
+ r=self.model_config.llm.lora_r, lora_alpha=self.model_config.llm.lora_alpha, lora_dropout=self.model_config.llm.lora_dropout,
42
+ target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
43
+ "gate_proj", "up_proj", "down_proj"]
 
 
 
 
 
 
44
  )
45
 
46
  self.lm = get_peft_model(self.lm, peft_config)