Paddle I have a promblem when i use the palm

j1dl9f46  于 2022-10-20  发布在  其他
关注(0)|答案(4)|浏览(210)

I met a mistake when I reference the official palm example (Example 6: Joint Training of Dialogue Intent Recognition and Slot Filling) to train myself task .
the error message : all error stack information: unspecified launch failure at (/paddle/paddle/fluid/framework/details/op_handle_base.cc:39)
FatalError: cudaStreamSynchronize raises error: unspecified launch failure, errono: 4: unspecified launch failure at (/paddle/paddle/fluid/platform/device_context.cc:331)

ttp71kqs

ttp71kqs1#

Could you please provide more training details?
Does example6 mentioned refer to tagging ?

laawzig2

laawzig22#

Could you please provide more training details?
Does example6 mentioned refer to tagging ?

my code:

import paddlepalm as palm
import json

configs

max_seqlen = 128
batch_size = 16
num_epochs = 20
print_steps = 5
lr = 2e-5
num_classes_intent = 8
weight_decay = 0.01
num_classes_slot = 80
dropout_prob = 0.1
random_seed = 0
vocab_path = '/home/aistudio/pretrain_models/pretrain/ERNIE-v1-zh-base/vocab.txt'

train_slot = '/home/aistudio/backdata/datatrainsub.tsv'
train_intent = '/home/aistudio/backdata/datatrain.tsv'

config = json.load(open('/home/aistudio/pretrain_models/pretrain/ERNIE-v1-zh-base/ernie_config.json'))
input_dim = config['hidden_size']

step 1-1: create readers

seq_label_reader = palm.reader.ClassifyReader(vocab_path, max_seqlen, seed=random_seed)
cls_reader = palm.reader.ClassifyReader(vocab_path, max_seqlen, seed=random_seed)

step 1-2: load train data

seq_label_reader.load_data(train_slot, batch_size=batch_size, num_epochs=None)
cls_reader.load_data(train_intent, batch_size=batch_size, num_epochs=None)

step 2: create a backbone of the model to extract text features

ernie = palm.backbone.ERNIE.from_config(config)

step 3: register readers with ernie backbone

seq_label_reader.register_with(ernie)
cls_reader.register_with(ernie)

step 4: create task output heads

seq_label_head = palm.head.Classify(num_classes_slot, input_dim, dropout_prob)
cls_head = palm.head.Classify(num_classes_intent, input_dim, dropout_prob)

step 5-1: create task trainers and multiHeadTrainer

trainer_seq_label = palm.Trainer("slot", mix_ratio=1.0)
trainer_cls = palm.Trainer("intent", mix_ratio=1.0)
trainer = palm.MultiHeadTrainer([trainer_seq_label, trainer_cls])

# step 5-2: build forward graph with backbone and task head

loss2 = trainer_seq_label.build_forward(ernie, seq_label_head)
loss1 = trainer_cls.build_forward(ernie, cls_head)
loss_var = trainer.build_forward()

step 6-1*: enable warmup for better fine-tuning

n_steps = seq_label_reader.num_examples * 1.5 * num_epochs // batch_size
warmup_steps = int(0.1 * n_steps)
sched = palm.lr_sched.TriangularSchedualer(warmup_steps, n_steps)

step 6-2: build a optimizer

adam = palm.optimizer.Adam(loss_var, lr, sched)

step 6-3: build backward graph

trainer.build_backward(optimizer=adam, weight_decay=weight_decay)

step 7: fit readers to trainer

trainer.fit_readers_with_mixratio([seq_label_reader, cls_reader], "slot", num_epochs)

step 8-1*: load pretrained model

trainer.load_pretrain('/home/aistudio/pretrain_models/pretrain/ERNIE-v1-zh-base')

step 8-2*: set saver to save models during training

trainer.set_saver(save_path='outputs/', save_steps=300)

step 8-3: start training

trainer.train(print_steps=10)

my dataset(tsv):
label text_a
900 消毒
900 高空危险排查
900 群租查安全隐患
900 查群租房
900 查群租户安全隐患
900 查群租安全隐患
900 查群租房安全隐患

##########

I only modified the official example. To run two classification tasks.

eoxn13cs

eoxn13cs3#

Perhaps the problem is located in

seq_label_reader = palm.reader.ClassifyReader(vocab_path, max_seqlen, seed=random_seed)
cls_reader = palm.reader.ClassifyReader(vocab_path, max_seqlen, seed=random_seed)

Your task data is Chinese and should be organized with UTF-8 encoding, but the default lang (language) in PALM readers is english. Hence attemps to set lang='cn' for seq_label_reader and cls_reader . In addition, please ensure the file encoding is utf-8 .

daupos2t

daupos2t4#

Perhaps the problem is located in

seq_label_reader = palm.reader.ClassifyReader(vocab_path, max_seqlen, seed=random_seed)
cls_reader = palm.reader.ClassifyReader(vocab_path, max_seqlen, seed=random_seed)

Your task data is Chinese and should be organized with UTF-8 encoding, but the default lang (language) in PALM readers is english. Hence attemps to set lang='cn' for seq_label_reader and cls_reader . In addition, please ensure the file encoding is utf-8 .

Thank you for your answer,But it didn't work,The official example ( Example 1: Classification) uses the Chinese too, I changed this task to a single classification(reference Example 1 ) and it didn't work either.

相关问题