google colabでのTPUを用いた機械学習が実行できない

実現したいこと

  • このモデルをgoogle colabのTPUを用いて実装したい.https://github.com/rowanz/merlot
  • modelディレクトリ内でpython train.py configs/merlot.yamlを実行したい.

前提

modelディレクトリ内でpython train.py configs/merlot.yamlを実行しようとしたところ,HTTPエラーが発生しました.

発生している問題・エラーメッセージ

Traceback (most recent call last): File "train.py", line 9, in <module> config = NeatConfig.from_args("Pretraining script", default_config_file='configs/v0a-base.yaml') File "../utils/neat_config.py", line 119, in from_args return cls.from_yaml(args.config_file) File "../utils/neat_config.py", line 41, in from_yaml return cls.from_dict(config_dict, orig_config_file=config_file) File "../utils/neat_config.py", line 66, in from_dict config['device']['tpu_run_config'] = get_tpu_run_config(config['device']) File "../utils/neat_config.py", line 133, in get_tpu_run_config tpu_name, zone=device_config.get('tpu_zone', None), project=device_config.get('gcp_project', None)) File "/usr/local/envs/merlot/lib/python3.7/site-packages/tensorflow_core/python/distribute/cluster_resolver/tpu_cluster_resolver.py", line 332, in __init__ zone_path = compat.as_str(self._request_compute_metadata('instance/zone')) File "/usr/local/envs/merlot/lib/python3.7/site-packages/tensorflow_core/python/distribute/cluster_resolver/tpu_cluster_resolver.py", line 124, in _request_compute_metadata resp = urlopen(req) File "/usr/local/envs/merlot/lib/python3.7/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/usr/local/envs/merlot/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/usr/local/envs/merlot/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/usr/local/envs/merlot/lib/python3.7/urllib/request.py", line 569, in error return self._call_chain(*args) File "/usr/local/envs/merlot/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/usr/local/envs/merlot/lib/python3.7/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

該当のソースコード

tpu_cluster_resolver.pyでエラーが発生している箇所を抜粋します.

python

1 def _request_compute_metadata(self, path):2 req = Request('%s/computeMetadata/v1/%s' % (_GCE_METADATA_ENDPOINT, path),3 headers={'Metadata-Flavor': 'Google'})4 resp = urlopen(req)5 return compat.as_bytes(resp.read())6 7...8 9if not zone and should_resolve:10 zone_path = compat.as_str(self._request_compute_metadata('instance/zone'))11 zone = zone_path.split('/')[-1]12 self._project = project 13 self._zone = zone

_GCE_METADATA_ENDPOINT=http://metadata.google.internalであり,このURLにアクセスできないエラーだと考えられます.このURLに飛ぼうとするとこのURLにはアクセスできませんと表示されます.

試したこと

色々調べて,VMインスタンスにアクセスできていないのかなと思ったのですがgoogle colabでは詳細なVMインスタンスの情報を見ることができないようでした.
何かgoogle colabの設定がおかしいのでしょうか?教えていただけると助かります.

補足情報(FW/ツールのバージョンなど)

TPU,python 3.7

コメントを投稿

0 コメント