Bert语句转换器在微调期间停止/退出



我正在按照BERT指令对进行微调

这是我的代码:

from sentence_transformers import SentenceTransformer, SentencesDataset, InputExample, losses, evaluation
from torch.utils.data import DataLoader
# load model
embedder = SentenceTransformer('bert-large-nli-mean-tokens')
print("embedder loaded...")
# define your train dataset, the dataloader, and the train loss
train_dataset = SentencesDataset(x_sample["input"].tolist(), embedder)
train_dataloader = DataLoader(train_dataset, shuffle=False, batch_size=16)
train_loss = losses.CosineSimilarityLoss(embedder)
sentences1 = ['This list contains the first column', 'With your sentences', 'You want your model to evaluate on']
sentences2 = ['Sentences contains the other column', 'The evaluator matches sentences1[i] with sentences2[i]', 'Compute the cosine similarity and compares it to scores[i]']
scores = [0.3, 0.6, 0.2]
evaluator = evaluation.EmbeddingSimilarityEvaluator(sentences1, sentences2, scores)
# tune the model
embedder.fit(train_objectives=[(train_dataloader, train_loss)], 
epochs=1, 
warmup_steps=100, 
evaluator=evaluator, 
evaluation_steps=1)

在4%时,培训停止,程序存在,没有任何警告或错误。没有输出。

我不知道如何排除故障——任何帮助都会很棒。

编辑:将标题从失败更改为停止/退出,因为我不知道它是否失败了

以下是我在终端上看到的内容:Epoch:0%|杀死作用:0%|

单词";被杀死";与单词"迭代"重叠。。。也许是记忆力问题?仅供参考:我正在windows 中的ubuntu vm上使用wsl从vscode的终端运行它

在github上发现问题:https://github.com/ElderResearch/gpu_docker/issues/38

我的解决方案是将批处理和工作程序设置为一,并且非常慢

train_dataloader = DataLoader(train_dataset, shuffle=False, batch_size=1, num_workers=1)

最新更新