sakamomo554101 / YouyakuAI

日本語用の要約を行うデモサービス
0 stars 0 forks source link

モデルの学習パイプラインの作成(ローカル実行でOK) #16

Closed sakamomo554101 closed 2 years ago

sakamomo554101 commented 2 years ago

https://www.kubeflow.org/docs/components/pipelines/sdk/static-type-checking/#type-checking-configuration compile時に型チェックを外す方法もあるらしい(やらんけど)

sakamomo554101 commented 2 years ago

https://github.com/kubeflow/pipelines/blob/master/sdk/python/kfp/dsl/types.py#L108-L111 LocalPathにすればいけるのだろうか・・

sakamomo554101 commented 2 years ago

お、data-generatorは通った。 今度はtrainでこけた

sakamomo554101 commented 2 years ago

以下のエラーが出てる。

trainer.py: error: argument parameters: invalid dict value: '{"hyper_parameters": {"adam_epsilon": 1e-08, "early_stop_callback": false, "eval_batch_size": 8, "fp_16": false, "gradient_accumulation_steps": 1, "learning_rate": 0.0003, "max_grad_norm": 1.0, "max_input_length": 512, "max_target_length": 64, "num_train_epochs": 8, "opt_level": "O1", "pretrained_model_name": "sonoisa/t5-base-japanese", "random_seed": 1000, "seed": 42, "train_batch_size": 8, "warmup_steps": 0, "weight_decay": 0.0}}'
sakamomo554101 commented 2 years ago

docker imageを再度アップロードしてエラー解消。 dict -> stringに変更して、コード内部でstring -> dictへの変換処理を入れることにした。

次に下記エラー

Traceback (most recent call last):
  File "/component/src/trainer.py", line 158, in <module>
    model = main(artifacts.component_arguments)
  File "/component/src/trainer.py", line 76, in main
    model = train(parameters=parameters,
  File "/component/src/trainer.py", line 104, in train
    trainer.fit(model)
  File "/usr/local/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 552, in fit
    self._run(model)
  File "/usr/local/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 864, in _run
    self._call_setup_hook(model)  # allow user to setup lightning_module in accelerator environment
  File "/usr/local/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1179, in _call_setup_hook
    model.setup(stage=fn)
  File "/component/src/trainer_component.py", line 129, in setup
    self.train_dataset = self.get_dataset(file_path=train_file_path,
  File "/component/src/trainer_component.py", line 159, in get_dataset
    return LivedoorDataset(
  File "/component/src/dataset.py", line 26, in __init__
    self._build()
  File "/component/src/dataset.py", line 79, in _build
    assert len(self.data_frame.columns) == 3
sakamomo554101 commented 2 years ago

うーむ、とりあえず下記の記事の対応入れたら、大丈夫そう。 https://qiita.com/wariichi/items/988b16dc4941ccbe7af2

あと、下記ドキュメントみると、run_pipeline_func_locallyでローカル実行できそう? https://kubeflow-pipelines.readthedocs.io/en/stable/source/kfp.html

sakamomo554101 commented 2 years ago
client = kfp.Client(host='http://localhost:7777', namespace='youyakuai')

上記でkfpのクライアントを取ってみたが、list_experimentsとかをしても、何も入ってないdictが返ってくる

sakamomo554101 commented 2 years ago

https://qiita.com/f6wbl6/items/f668368222983f7f8f46 参考になりそう。

sakamomo554101 commented 2 years ago

うーん、ローカルのkubeflow向けにkubeflow SDKを使って、パイプライン実行を試みるも、以下のエラー。

kfp_server_api.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'x-powered-by': 'Express', 'content-security-policy': "default-src 'none'", 'x-content-type-options': 'nosniff', 'content-type': 'text/html; charset=utf-8', 'content-length': '164', 'date': 'Mon, 11 Oct 2021 12:38:42 GMT', 'x-envoy-upstream-service-time': '1', 'server': 'istio-envoy'})
HTTP response body: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /apis/v1beta1/experiments</pre>
</body>
</html>
sakamomo554101 commented 2 years ago

kubeflowのnotebookも試してみるか・・

sakamomo554101 commented 2 years ago

そういえば、今ローカルで立ち上がってるkubeflowのversionって、1.x系なのかな? json(v2系)は読み込めなかったんだが、、

sakamomo554101 commented 2 years ago

kubeflowのnotebook serverのDockerImageがkfpのSDKがインストールされていない場合、イメージをカスタマイズして、読み込ませる必要がある

sakamomo554101 commented 2 years ago

うーん、(kfpの)notebookからだと、RBACの都合で、アクセスできなさそう

sakamomo554101 commented 2 years ago

残件整理

sakamomo554101 commented 2 years ago

26 で対応。

残件は別issueとする。