nkululeko 0.95.1__py3-none-any.whl → 0.95.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nkululeko/constants.py CHANGED
@@ -1,2 +1,2 @@
1
- VERSION="0.95.1"
1
+ VERSION="0.95.2"
2
2
  SAMPLING_RATE = 16000
@@ -1,15 +1,23 @@
1
1
  # mld_fset.py
2
2
  import os
3
3
  import sys
4
+ from typing import Optional, Union, List, Any, Dict
4
5
 
5
6
  import nkululeko.glob_conf as glob_conf
6
7
  from nkululeko.feat_extract.featureset import Featureset
7
8
 
8
9
 
9
10
  class MLD_set(Featureset):
10
- def __init__(self, name, data_df):
11
- super().__init__(name, data_df)
11
+ def __init__(
12
+ self,
13
+ name,
14
+ data_df,
15
+ feats_type: Optional[str] = None,
16
+ ):
17
+ super().__init__(name, data_df, feats_type)
12
18
  mld_path = self.util.config_val("FEATS", "mld.model", None)
19
+ if mld_path is None:
20
+ self.util.error("FEATS.mld.model required")
13
21
  sys.path.append(mld_path)
14
22
 
15
23
  def extract(self):
@@ -24,10 +32,10 @@ class MLD_set(Featureset):
24
32
  )
25
33
  else:
26
34
  self.util.debug("reusing previously extracted midleveldescriptor features")
27
- import midlevel_descriptors as mld
35
+ import audmld
28
36
 
29
- fex_mld = mld.MLD()
30
- self.df = fex_mld.extract_from_index(index=self.data_df, cache_path=storage)
37
+ fex_mld = audmld.Mld(num_workers=6, verbose=True)
38
+ self.df = fex_mld.process_index(index=self.data_df.index, cache_root=storage)
31
39
  self.util.debug(f"MLD feats shape: {self.df.shape}")
32
40
  # shouldn't happen
33
41
  # replace NANa with column means values
@@ -74,6 +74,11 @@ class FeatureExtractor:
74
74
 
75
75
  return TRILLset
76
76
 
77
+ elif feats_type == "mld":
78
+ from nkululeko.feat_extract.feats_mld import MLD_set
79
+
80
+ return MLD_set
81
+
77
82
  elif feats_type.startswith(
78
83
  ("wav2vec2", "hubert", "wavlm", "spkrec", "whisper", "ast", "emotion2vec")
79
84
  ):