MCPcopy Create free account
hub / github.com/LaurentMazare/diffusers-rs / ensure_data_dir

Function ensure_data_dir

scripts/get_weights.py:11–27  ·  view source on GitHub ↗
(safetensors)

Source from the content-addressed store, hash-verified

9vocab_filename = "bpe_simple_vocab_16e6.txt"
10
11def ensure_data_dir(safetensors):
12 print("Ensuring empty data directory...")
13
14 if os.path.exists(data_path):
15 # Fail if conflicting files exist
16 files = os.listdir(data_path)
17 newfiles = [x for name in safetensors for x in (f"{name}.bin", f"{name}.safetensors")]
18 newfiles += [vocab_filename, f"{vocab_filename}.gz"]
19 conflicts = set(files) & set(newfiles)
20 if len(conflicts) != 0:
21 print("Error: please remove the following files from data directory:")
22 print(conflicts)
23 sys.exit("Found conflicting files in data directory.")
24 else:
25 os.mkdir(data_path)
26
27 print("Found no conflicts!")
28
29def get_safetensors(safetensors, weight_bits):
30 for name, url in safetensors.items():

Callers 1

get_weights.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected