我想将最大序列长度从128个增加到512个(最大蒸馏器可以处理)。我相信它现在只使用128个令牌,因为它输出的训练样本有一个128个值的attention_mask。这是我的密码:
import sagemaker
from sagemaker.huggingface import HuggingFace
# gets role for executing training job
role = sagemaker.get_execution_role()
hyperparameters = {
'model_name_or_path': 'distilbert-base-uncased',
'output_dir': '/opt/ml/model',
'do_predict': True,
'do_eval': True,
'do_train': True,
"train_file": "/opt/ml/input/data/train/train.csv",
"validation_file": "/opt/ml/input/data/val/val.csv",
"test_file": "/opt/ml/input/data/test/test.csv",
"num_train_epochs": 50,
"per_device_train_batch_size": 32
}
# git configuration to download our fine-tuning script
git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.6.1'}
# creates Hugging Face estimator
huggingface_estimator = HuggingFace(
entry_point='run_glue.py',
source_dir='./examples/pytorch/text-classification',
instance_type='ml.p3.8xlarge',
instance_count=1,
role=role,
git_config=git_config,
transformers_version='4.6.1',
pytorch_version='1.7.1',
py_version='py36',
#use_spot_instances = True,
#max_wait = 24*60*60+1,
hyperparameters = hyperparameters
)
# starting the train job
huggingface_estimator.fit({'train' : s3_input + "/train.csv",
'val' : s3_input + "/val.csv",
'test' : s3_input + "/test.csv"})检查run_glue.py时,输入参数采用这里
model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]))但是我们可以设置的超参数只会影响training_args。data_args习惯于在此文件中设置max_seq_length 后来。在拥抱面估计量中,除了超级参数之外,我没有看到任何传递其他内容的选项。我可以分叉v4.6.1并手动设置这个值,但这似乎有点过分,是否有一种正确的方法来传递这个值?
发布于 2022-03-18 18:55:03
事实证明,max_seq_length : 512可以直接插入到超视距中。我很可能在收到消息时输入了这个错误,因为这个param没有被使用。
https://stackoverflow.com/questions/71530663
复制相似问题