Skip to content

Instantly share code, notes, and snippets.

View Leumastai's full-sized avatar
🏠
Working from home

Samuel Taiwo Leumastai

🏠
Working from home
View GitHub Profile
@Leumastai
Leumastai / flops_calculator.py
Created July 4, 2023 22:37
fvcore flops calculator fo pytorch model
$ from fvcore.nn import FlopCountAnalysis
$ flops = FlopCountAnalysis(model, input)
$ flops.total()
-> 274656
$ flops.by_operator()
-> Counter({'conv': 194616, 'addmm': 80040})
$ flops.by_module()
-> Counter({'': 274656, 'conv1': 48600,
-> 'conv2': 146016, 'fc1': 69120,
-> 'fc2': 10080, 'fc3': 840})
@Leumastai
Leumastai / youtube_video_scraper.py
Last active November 14, 2021 01:44
Script to scrape adn download youtube video
#Uncomment code if you're running virtually
""" %%capture
import sys
!pip install selenium
#!apt-get update # to update ubuntu to correctly run apt install
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') """
pip install pytube==11.0.1
@Leumastai
Leumastai / image_scraper.py
Created November 8, 2021 01:42
Script to scrape images from google images
#Uncomment the code below if running on Google Colab
""" %%capture
import sys
!pip install selenium
#!apt-get update # to update ubuntu to correctly run apt install
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') """