MCPcopy Create free account
hub / github.com/DragonisCV/RAM / get_module_from_name

Method get_module_from_name

scripts/analysis_utils.py:132–143  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

130 hook_list = []
131 name_list = []
132 def get_module_from_name(name):
133 name_parts = name.split('.')[:-1]
134 module_name = 'self.model'
135
136 for part in name_parts:
137 if part == 'mask_token' or part == 'weight' or part == 'bias':
138 continue
139 if part.isdigit():
140 module_name += f'[{part}]'
141 else:
142 module_name += f'.{part}'
143 return module_name, '.'.join(name_parts)
144
145 for name,param in self.model.named_parameters():
146 module_name,name = get_module_from_name(name)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected