您的位置:首页 > 新闻 > 会展 > 策划公司排名_中国外协加工网最新加工订单_营销运营主要做什么_关键词seo报价

策划公司排名_中国外协加工网最新加工订单_营销运营主要做什么_关键词seo报价

2025/2/25 3:02:24 来源:https://blog.csdn.net/goodgood_UP/article/details/145736106  浏览:    关键词:策划公司排名_中国外协加工网最新加工订单_营销运营主要做什么_关键词seo报价
策划公司排名_中国外协加工网最新加工订单_营销运营主要做什么_关键词seo报价

简要介绍如何使用vscode调试transformers源码

以源码的方式安装transformers(官方手册为Editable install)

优先参考官方手册

git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e .

以下展示transformers/examples/pytorch/image-classification样例的调试方法

  • 阅读image-classification的README.md文件,可知需要下载数据集beans和ViT模型(默认为google/vit-base-patch16-224-in21k),下图是我的数据集目录:
    在这里插入图片描述

  • 配置launch.json文件,这里面需要根据自己的路径修改一些变量,仅供参考:

{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "Python Debugger: Current File","type": "debugpy","request": "launch","program": "${file}","console": "integratedTerminal"},{"name": "run_image_classification.py","type": "debugpy","request": "launch","program": "${workspaceFolder}/transformers/examples/pytorch/image-classification/run_image_classification.py","args": ["--train_dir", "transformers/examples/pytorch/image-classification/beans/data/train","--validation_dir", "transformers/examples/pytorch/image-classification/beans/data/validation","--output_dir", "./beans_outputs/","--remove_unused_columns","False","--label_column_name", "label","--do_train","--do_eval","--num_train_epochs", "5",],"console": "integratedTerminal","justMyCode": false,"env": {"PYTHONPATH": "${workspaceFolder}"}},]
}

进入调试环境即可跳转transformers源码阅读

在这里插入图片描述

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com