"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"warnings.filterwarnings(\"ignore\")\n",
"print(f'count of gpu devices : `{torch.cuda.device_count()}`')\n",
"print(f'id of gpu device : `{torch.cuda.current_device()}`')\n",
"print(f'is cuda available : `{torch.cuda.is_available()}`')\n",
"print(f'is cuda enabled at backend : `{torch.backends.cudnn.enabled}`')\n",
"print(f'name of the instance gpu device : `{torch.cuda.get_device_name(torch.cuda.current_device())}`')\n",
"print(f'version of cuda : `{torch.backends.cudnn.version()}`')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###
initializing data
"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"--------\")\n",
"print(\"IPO\")\n",
"io_pklio0uc = f'{DMA__ADL}/0/ip__urls_cords.pkl'\n",
"def func_io_sudo_urls_cords(n=4*random.randrange(20,80)):\n",
" random.seed(268862)\n",
" Faker.seed(268862)\n",
" fake = Faker()\n",
" sudo_urls = [f'http://www.ads.{fake.domain_name()}' for _ in range(n//4)] + [f'https://www.ads.{fake.domain_name()}' for _ in range(n//4)] + [f'http://www.{fake.domain_name()}' for _ in range(n//4)] + [f'https://www.{fake.domain_name()}' for _ in range(n//4)]\n",
" sudo_urls = [sudo_urls[P]+'/'+ ''.join(random.choice(random.choice(string.digits + string.ascii_letters)) for _ in range(random.randint(20, 80))) + '?' + '&'.join([f\"param_{p}={''.join(random.choice(random.choice(string.digits + string.ascii_letters)) for _ in range(random.randint(20, 80)))}\" for p in range(1, random.randint(2, 8) + 1)]) for P in range(len(sudo_urls))]\n",
" random.shuffle(sudo_urls)\n",
" sudo_isad = [1 if('ad' in i) else 0 for i in sudo_urls]\n",
" sudo_cords = [(random.randrange(2,862268),random.randrange(2,862268)) for _ in range(n)]\n",
" random.shuffle(sudo_cords)\n",
" sudo_urls_cords = [(sudo_urls[p],(sudo_cords[p][0],sudo_cords[p][1]),sudo_isad[p]) for p in range(n)]\n",
" random.shuffle(sudo_urls_cords)\n",
" return sudo_urls_cords\n",
"if(not os.path.exists(io_pklio0uc)):\n",
" io__sudo_urls_cords = func_io_sudo_urls_cords(888) # n : multiples of '4'\n",
" pickle.dump(io__sudo_urls_cords, open(io_pklio0uc, 'wb'))\n",
"io__sudo_urls_cords = pickle.load(open(io_pklio0uc, 'rb'))\n",
"io__sudo_urls = [p[0] for p in io__sudo_urls_cords]\n",
"io__sudo_cord_x,io__sudo_cord_y = [p[1][0] for p in io__sudo_urls_cords],[p[1][1] for p in io__sudo_urls_cords]\n",
"io__sudo_isad = [p[2] for p in io__sudo_urls_cords]\n",
"for p in random.sample(io__sudo_urls_cords,4):\n",
" print(p)\n",
"print(\"--------\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###