MCPcopy
hub / github.com/jindongwang/transferlearning / test

Function test

code/clip/test_clip.py:132–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

130 f_n.write(s + '\n')
131
132def test():
133 args = get_args()
134 imagenet_r, imagenetr_labels = load_data(DATA_FOLDER[args.dataset])
135 model, processor = load_model(CLIP_MODELS[args.model])
136 res, acc = classify_imagenetr(
137 imagenet_r, imagenetr_labels, model, processor, device='cuda')
138 res = np.array(res)
139 np.savetxt('res.txt', res, fmt='%d')
140 print(acc)
141
142def sweep():
143 # Gives all results from all datasets across all models

Callers 1

test_clip.pyFile · 0.70

Calls 4

classify_imagenetrFunction · 0.85
get_argsFunction · 0.70
load_dataFunction · 0.70
load_modelFunction · 0.70

Tested by

no test coverage detected