MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / shave_segments

Function shave_segments

diffusers/scripts/convert_zero123_to_diffusers.py:198–205  ·  view source on GitHub ↗

Removes segments. Positive values shave the first segments, negative shave the last segments.

(path, n_shave_prefix_segments=1)

Source from the content-addressed store, hash-verified

196
197
198def shave_segments(path, n_shave_prefix_segments=1):
199 """
200 Removes segments. Positive values shave the first segments, negative shave the last segments.
201 """
202 if n_shave_prefix_segments >= 0:
203 return ".".join(path.split(".")[n_shave_prefix_segments:])
204 else:
205 return ".".join(path.split(".")[:n_shave_prefix_segments])
206
207
208def renew_resnet_paths(old_list, n_shave_prefix_segments=0):

Callers 4

renew_resnet_pathsFunction · 0.70
renew_vae_resnet_pathsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected