MCPcopy Index your code
hub / github.com/huggingface/diffusers / shave_segments

Function shave_segments

scripts/convert_i2vgen_to_diffusers.py:91–98  ·  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

89
90
91def shave_segments(path, n_shave_prefix_segments=1):
92 """
93 Removes segments. Positive values shave the first segments, negative shave the last segments.
94 """
95 if n_shave_prefix_segments >= 0:
96 return ".".join(path.split(".")[n_shave_prefix_segments:])
97 else:
98 return ".".join(path.split(".")[:n_shave_prefix_segments])
99
100
101def renew_temp_conv_paths(old_list, n_shave_prefix_segments=0):

Callers 2

renew_resnet_pathsFunction · 0.70

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…