fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

'TranslationTask' object has no attribute 'args'

Open whiteSteelRain opened this issue 1 year ago • 0 comments

Stuck an afternoon almost....

i was using lightseq to accerlate fairseq.it support fairseq0.10.2,and i want to keep my fairseq0.12.2.

so when running lightseq's criterion's init,error bumped:'TranslationTask' object has no attribute 'args'

after seeing the error,i found where it took place:

    config = LSCrossEntropyLayer.get_config(
        max_batch_tokens=task.args.max_tokens,
        padding_idx=self.padding_idx,
        epsilon=label_smoothing,
        fp16=task.args.fp16,
        local_rank=task.args.device_id,
    )
    self.ls_cross_entropy = LSCrossEntropyLayer(config)

so i thought it must because version,the 0.12.2 remove task.args.

so i went to fairseq_criterion.py,find that current version use cfg instead of args and i also see an legacy fairseq class warning that dont use args use cfg instead(sth like that)

so the dumbest idea and also direct est idea,print it dir out and i didnt find the cfg have "max_tokens,","device_id","fp16"....

so i am really seeking help that if anyone know in fairseq0.12.2,where is the'args'?any similar that contains those args above?

i'll be really appreciated.

  • fairseq Version 0.12.2

  • PyTorch Version 2.0.0

  • fairseq (source):

  • Python version:3.9

  • CUDA/cuDNN version: 11.7

whiteSteelRain avatar Apr 21 '24 16:04 whiteSteelRain