The inaccurate flop results after several rounds
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- machine-learning, performance
Direzione di ricerca
Parti dalla chiamata a profiler.get_model_profile e riproduci le misurazioni ripetute usando il ciclo test_model fornito e una forma di input fissa. Confronta FLOPs, MACs, parametri e latenza dei round successivi con il primo round; il lavoro è completato quando il profiling ripetuto dello stesso modello e dello stesso input non fa aumentare i FLOPs.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi I tried to use the method "get_model_profile" to get the latency and flop for my model. To get avoid of the influence from randomness, I used this method in a for loop for several times, and then an average operation would be done.
However, I found the results for the following rounds of the first one are not correct, which is far away from the theoritical result. As shown in the fig below, you could see the flops is increasing with the round, which is not correct, since I gave the same size of input into the model.
And this is the code:
def test_model(model, input_shape, warmup=20, num_tests=1000):
results = []
for _ in range(num_tests):
#from profiler import get_model_profile
flops, macs, params, latency = profiler.get_model_profile(
model=model,
input_shape=input_shape,
print_profile=False,
detailed=True,
module_depth=-1,
top_modules=1,
warm_up=warmup,
as_string=False
)
del sys.modules['profiler']
results.append((flops/10**9, macs/10**9, params/10**3, latency*10**3))
df = pd.DataFrame(results, columns=['FLOPs', 'MACs', 'Params', 'Latency'])
return df
df_swin = test_model(Swin, (batch_size, math.prod(input_resolution), dim), warmup=warmup, num_tests=num_tests)
I tried to modify this code, and found if I could assign the model again in a different iteration with the profiler imported again, then the result is correct, shown in the fig below.
And the following is the modified code.
def test_model(input_shape, warmup=20, num_tests=1000):
results = []
for _ in range(num_tests):
#from profiler import get_model_profile
import profiler
model = MySwinTransformerModel(dim, input_resolution, num_heads, window_size, mlp_ratio, depth).to(device)
# model = MyTensorizedTransformerModel(dim, input_resolution, num_heads, n_proj, mlp_ratio, depth).to(device)
flops, macs, params, latency = profiler.get_model_profile(
model=model,
input_shape=input_shape,
print_profile=False,
detailed=True,
module_depth=-1,
top_modules=1,
warm_up=warmup,
as_string=False
)
del sys.modules['profiler']
results.append((flops/10**9, macs/10**9, params/10**3, latency*10**3))
df = pd.DataFrame(results, columns=['FLOPs', 'MACs', 'Params', 'Latency'])
return df
- Lingua principale
- Python
- Stelle
- 6.8k
- Fork
- 1.1k
- Merge medio
- 2g 16h
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di deepspeedai/DeepSpeedExamples
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
deepspeedai/DeepSpeedExamples#996 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
deepspeedai/DeepSpeedExamples#995 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
deepspeedai/DeepSpeedExamples#989 ·
-
moe example 404 Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
deepspeedai/DeepSpeedExamples#984 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
deepspeedai/DeepSpeedExamples#979 · 6 commenti ·
Tutte le issue di deepspeedai/DeepSpeedExamples
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·