<#13 Add Pytorch example> Pull request opened by <...
# flyte-github
a
#13 Add Pytorch example Pull request opened by kevinliao852 This pull request introduces support for migrating PyTorch plugin configurations from Flytekit v1 to Flytekit v2, along with an example demonstrating distributed PyTorch training using Flyte. The main changes include adding a transformation function for PyTorch plugin configs, updating the plugin config transformation logic to include PyTorch, and providing a new example workflow for PyTorch distributed training. PyTorch Plugin Migration Support: • Added a new transformation function
_transform_pytorch_config_v1_to_v2
in
src/flyte_migrate/_plugins/pytorch.py
to convert PyTorch plugin configs from v1 (
flytekitplugins.kfpytorch.Elastic
) to v2 (
flyteplugins.pytorch.task.Elastic
). This function also handles conversion of the
RunPolicy
sub-config. • Updated the plugin config transformation logic in
src/flyte_migrate/_plugins/__init__.py
to include the new PyTorch transformation function, and improved error messaging to mention PyTorch as a supported plugin type. • Extended the image mapping in
src/flyte_migrate/_image.py
to include a mapping from
flytekitplugins-kfpytorch
to
flyteplugins-pytorch
, ensuring correct image references during migration. PyTorch Distributed Training Example: • Added a new example in
examples/plugins/pytorch_example.py
demonstrating a distributed PyTorch training workflow using Flyte, including model definition, training, evaluation, and workflow orchestration. ## Screenshot [](https://private-user-images.githubusercontent.com/71365298/519659609-f33b459a-5329-4bc9-a667-6aa7c337fb4f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjczOTk0NTksIm5iZiI6MTc2NzM5OTE1OSwicGF0aCI6Ii83MTM2NTI5OC81MTk2NTk2MDktZjMzYjQ1OWEtNTMyOS00YmM5LWE2NjctNmFhN2MzMzdmYjRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTAzVDAwMTIzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVjODcwOGQzYTEzNzQwNzc2MTJlZWE3M2NmZWYyNTAwYWE0MDkyYTg0ZmIzZThjZDg0MGY4NDg5YzRhNzQ4OWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Qn5ugMx37_OzUOKPZAbid5qN04P9ysSFkb-2141ZRZU) flyteorg/flyte-migrate