MCPcopy Create free account
hub / github.com/huggingface/transformers / __init__

Method __init__

examples/benchmarking/plot_csv_file.py:66–85  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

64
65class Plot:
66 def __init__(self, args):
67 self.args = args
68 self.result_dict = defaultdict(lambda: dict(bsz=[], seq_len=[], result={}))
69
70 with open(self.args.csv_file, newline="") as csv_file:
71 reader = csv.DictReader(csv_file)
72 for row in reader:
73 model_name = row["model"]
74 self.result_dict[model_name]["bsz"].append(int(row["batch_size"]))
75 self.result_dict[model_name]["seq_len"].append(int(row["sequence_length"]))
76 if can_convert_to_int(row["result"]):
77 # value is not None
78 self.result_dict[model_name]["result"][
79 (int(row["batch_size"]), int(row["sequence_length"]))
80 ] = int(row["result"])
81 elif can_convert_to_float(row["result"]):
82 # value is not None
83 self.result_dict[model_name]["result"][
84 (int(row["batch_size"]), int(row["sequence_length"]))
85 ] = float(row["result"])
86
87 def plot(self):
88 fig, ax = plt.subplots()

Callers

nothing calls this directly

Calls 2

can_convert_to_intFunction · 0.85
can_convert_to_floatFunction · 0.85

Tested by

no test coverage detected