speechisalluneed commited on
Commit
10018b0
·
verified ·
1 Parent(s): f9873cc

Delete configuration_fastalm.py

Browse files
Files changed (1) hide show
  1. configuration_fastalm.py +0 -61
configuration_fastalm.py DELETED
@@ -1,61 +0,0 @@
1
- from transformers import PretrainedConfig, AutoConfig
2
-
3
- class FastALMSpeechEncoderConfig(PretrainedConfig):
4
- model_type = "fastalm_speech_encoder"
5
- def __init__(
6
- self,
7
- n_mels=128,
8
- n_ctx=1500,
9
- n_state=1280,
10
- n_head=20,
11
- n_layer=32,
12
- stage_tokens=[80, 80, 80],
13
- compression_size=50,
14
- **kwargs
15
- ):
16
- super().__init__(**kwargs)
17
- self.n_mels = n_mels
18
- self.n_ctx = n_ctx
19
- self.n_state = n_state
20
- self.n_head = n_head
21
- self.n_layer = n_layer
22
- self.stage_tokens = stage_tokens
23
- self.compression_size = compression_size
24
-
25
- class FastALMConfig(PretrainedConfig):
26
- model_type = "fastalm"
27
- def __init__(
28
- self,
29
- encoder_config=None,
30
- llm_config=None,
31
- lora_r=16,
32
- lora_a=64,
33
- llm_modules=None,
34
- low_resource=False,
35
- **kwargs
36
- ):
37
- if llm_modules is None:
38
- llm_modules = ["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]
39
-
40
- if llm_config is None:
41
- llm_config = AutoConfig.from_pretrained("Qwen/Qwen3-4B")
42
- elif isinstance(llm_config, dict):
43
- if "_name_or_path" in llm_config:
44
- llm_config = AutoConfig.from_pretrained(llm_config["_name_or_path"], **llm_config)
45
- else:
46
- llm_config = AutoConfig.from_dict(llm_config)
47
-
48
- # Encoder config 처리
49
- if encoder_config is None:
50
- encoder_config = FastALMSpeechEncoderConfig()
51
- elif isinstance(encoder_config, dict):
52
- encoder_config = FastALMSpeechEncoderConfig(**encoder_config)
53
-
54
- self.llm_config = llm_config
55
- self.encoder_config = encoder_config
56
- self.lora_r = lora_r
57
- self.lora_a = lora_a
58
- self.llm_modules = llm_modules
59
- self.low_resource = low_resource
60
-
61
- super().__init__(**kwargs)