Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

问一下这个是为什么呢? #28

Open
citePerson opened this issue Sep 24, 2024 · 3 comments
Open

问一下这个是为什么呢? #28

citePerson opened this issue Sep 24, 2024 · 3 comments

Comments

@citePerson
Copy link

image

运行train_model_ner.py
loss_fn = nn.CrossEntropyLoss()
loss函数报错。
image
image

@jsksxs360
Copy link
Owner

你好,经测试 train_model_ner.py 是可以正常运行的。你是否修改了代码?

特别注意 loss = loss_fn(pred.permute(0, 2, 1), y) 这一行,需要调换一下维度。

torch==2.0.1
transformers==4.34.0

@jsksxs360
Copy link
Owner

You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
/Users/sxu/miniconda3/envs/inst/lib/python3.8/site-packages/transformers/optimization.py:411: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning
  warnings.warn(
Epoch 1/3
-------------------------------
loss: 1.614589:   0%|                        | 4/5216 [00:03<1:07:20,  1.29it/s]

@jsksxs360
Copy link
Owner

建议在 Linux 环境下运行代码,Windows 下运行可能会遇到各种问题。

新版 Windows 都自带 Linux 子系统,也可以在该系统下运行,如果不清楚的话可以搜索一下 WSL2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants