BERTのpre-trainingを実行 [2020/9版]

前準備
Tensorflow(GPU版)をpipでインストール。pipのバージョン違いで混乱することがあるため、私はpython -m pipでインストールした。バージョンは1.15にすること。
python -m pip ins ...特定の列を抽出 [Pandas]

import pandas as pdpd.read_csv('hoge.csv')df = df]
ネストされたリストで書くのがポイント
スクリプトをバックグラウンド起動(ログ無し) [Python][nohup]

nohup python hoge.py>/dev/null 2>&1 &
nohupで動かしたジョブの確認と削除
$ xclock 492$ jobs + Running xclock &$ kill ...requestsでSlackに画像送信 [Python]

Incoming Webhookをチャンネルにインストールし、TOKENとCHANNEL IDを取得していることが前提条件。
import requestsTOKEN = "xxxxxxxxxxxxxxxxxxx"CHANNEL ...requetsでSlackにメッセージ送信 [Python]

Incoming Webhookをチャンネルにインストールし、TOKENとCHANNEL IDを取得していることが前提条件。
import requestsTOKEN = "xxxxxxxxxxxxxxxxxxx"CHANNEL ...PythonでOnedriveにフォルダをアップロード[Odrive]

Python経由でOnedriveにアップロードする方法として、Microsoftが作成したOnedrive SDKの利用が考えられるが、このSDKは少し扱いにくい。そこで他の方法を探したところ、Odriveというウェブサービスを使っ ...
PythonがTorを使っているかどうかを確認

Torを使っているか否かをブラウザで確認することができるサイトを利用し、PythonでTorを使っているかどうかを確認するスクリプトを作成。
import urllib.request, urllib.errorfrom bs4 ...Torで接続元を匿名化しスクレイピング [Python]

環境Ubuntu 16.04
Python 3.8.2
現在のIPアドレスを確認
Python 3.8.2
現在のIPアドレスを確認
torを導入する前に、現在のIPアドレスを確認してみる。
現在のIPアドレスの取得については、過去記事でまとめたので、参考にされた ...
現在のグローバルIPアドレスを確認(複数のサイトから) [Python]

「Python IPアドレス」などで検索すると、IPを取得する方法がたくさん出てくるのだが、多くのサイトは、ひとつのサイトからの情報をあてにしているものが多い。
ひとつのサイトからの取得だと、IPアドレスを取得するサイトが ...
CounterをDictionary(辞書)に変換[Python]

import pandas as pdfrom collections import Counterd = Counter({'A': 1, 'B': 2, 'C': 3})df = pd.DataFrame.from_dict(d, or ...