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

Function clean_main_ref_in_model_list

diffusers/utils/release.py:69–94  ·  view source on GitHub ↗

Replace the links from main doc tp stable doc in the model list of the README.

()

Source from the content-addressed store, hash-verified

67
68
69def clean_main_ref_in_model_list():
70 """Replace the links from main doc tp stable doc in the model list of the README."""
71 # If the introduction or the conclusion of the list change, the prompts may need to be updated.
72 _start_prompt = "🤗 Transformers currently provides the following architectures"
73 _end_prompt = "1. Want to contribute a new model?"
74 with open(README_FILE, "r", encoding="utf-8", newline="\n") as f:
75 lines = f.readlines()
76
77 # Find the start of the list.
78 start_index = 0
79 while not lines[start_index].startswith(_start_prompt):
80 start_index += 1
81 start_index += 1
82
83 index = start_index
84 # Update the lines in the model list.
85 while not lines[index].startswith(_end_prompt):
86 if lines[index].startswith("1."):
87 lines[index] = lines[index].replace(
88 "https://huggingface.co/docs/diffusers/main/model_doc",
89 "https://huggingface.co/docs/diffusers/model_doc",
90 )
91 index += 1
92
93 with open(README_FILE, "w", encoding="utf-8", newline="\n") as f:
94 f.writelines(lines)
95
96
97def get_version():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected