MCPcopy Create free account
hub / github.com/pytorch/pytorch / get_author_map

Function get_author_map

scripts/release_notes/classifier.py:198–214  ·  view source on GitHub ↗
(data_folder: Path, regen_data, assert_stored=False)

Source from the content-addressed store, hash-verified

196
197
198def get_author_map(data_folder: Path, regen_data, assert_stored=False):
199 if not regen_data and Path(data_folder / "author_map.pkl").exists():
200 with open(data_folder / "author_map.pkl", "rb") as f:
201 return pickle.load(f)
202 else:
203 if assert_stored:
204 raise FileNotFoundError(
205 "Author map not found, you are loading for inference you need to have an author map!"
206 )
207 print("Regenerating Author Map")
208 all_data = pd.read_csv(data_folder / "commitlist.csv")
209 authors = all_data.author.unique().tolist()
210 authors.append(UNKNOWN_TOKEN)
211 author_map = {author: i for i, author in enumerate(authors)}
212 with open(data_folder / "author_map.pkl", "wb") as f:
213 pickle.dump(author_map, f)
214 return author_map
215
216
217def get_file_map(data_folder: Path, regen_data, assert_stored=False):

Callers 2

__init__Method · 0.90
trainFunction · 0.85

Calls 7

PathClass · 0.85
read_csvMethod · 0.80
uniqueMethod · 0.80
loadMethod · 0.45
tolistMethod · 0.45
appendMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…