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

self hosted models to translate from Indic to English translation fails with no output #54

Open
usaraj opened this issue Mar 7, 2023 · 2 comments

Comments

@usaraj
Copy link

usaraj commented Mar 7, 2023

Error:

get error: "AttributeError: 'dict' object has no attribute '_get_node_flag'" when translating sentences from Indic to English.

Environment details

Installation was successfully done following as per this: https://colab.research.google.com/github/AI4Bharat/indicTrans/blob/main/indicTrans_python_interface.ipynb#scrollTo=E_4JxNdRlPQB

Server: Ubuntu
GPU: Cuda 11.x
Python 3.8

Terminal Output from python run

(langtrans) sysops@das:~/a1bharat/indicTrans$ python app.py
शिर्डी - श्री साईबाबा संस्‍थानचे जानेवारी २०२३ चे उत्‍कृष्‍ट विभाग प्रमुख व उत्‍कृष्‍ट कर्मचारी म्‍हणुन मुख्‍यलेखाधिकारी तथा प्र.प्रशासकीय अधिकारी कैलास खराडे व प्र.लेखाधिकारी साहेबराव लंके यांचा संस्‍थानचे प्र.मुख्‍य कार्यकारी अधिकारी राहुल...
Tue Mar 7 14:58:26 CST 2023
Applying normalization and script conversion
100%|█████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 25.62it/s]
Number of sentences in input: 1
Applying BPE
Decoding
Extracting translations, script conversion and detokenization
Translation completed

Logs from: en_outputs.txt.log:

2023-03-07 14:58:32 | INFO | fairseq_cli.interactive | {'_name': None, 'common': {'_name': None, 'no_progress_bar': False, 'log_interval': 100, 'log_format': None, 'tensorboard_logdir': None, 'wandb_project': None, 'azureml_logging': False, 'seed': 1, 'cpu': False, 'tpu': False, 'bf16': False, 'memory_efficient_bf16': False, 'fp16': False, 'memory_efficient_fp16': False, 'fp16_no_flatten_grads': False, 'fp16_init_scale': 128, 'fp16_scale_window': None, 'fp16_scale_tolerance': 0.0, 'min_loss_scale': 0.0001, 'threshold_loss_scale': None, 'user_dir': 'model_configs', 'empty_cache_freq': 0, 'all_gather_list_size': 16384, 'model_parallel_size': 1, 'quantization_config_path': None, 'profile': False, 'reset_logging': False, 'suppress_crashes': False}, 'common_eval': {'_name': None, 'path': '../indic-en/model/checkpoint_best.pt', 'post_process': 'subword_nmt', 'quiet': False, 'model_overrides': '{}', 'results_path': None}, 'distributed_training': {'_name': None, 'distributed_world_size': 1, 'distributed_rank': 0, 'distributed_backend': 'nccl', 'distributed_init_method': None, 'distributed_port': -1, 'device_id': 0, 'distributed_no_spawn': False, 'ddp_backend': 'pytorch_ddp', 'bucket_cap_mb': 25, 'fix_batches_to_gpus': False, 'find_unused_parameters': False, 'fast_stat_sync': False, 'heartbeat_timeout': -1, 'broadcast_buffers': False, 'slowmo_momentum': None, 'slowmo_algorithm': 'LocalSGD', 'localsgd_frequency': 3, 'nprocs_per_node': 1, 'pipeline_model_parallel': False, 'pipeline_balance': None, 'pipeline_devices': None, 'pipeline_chunks': 0, 'pipeline_encoder_balance': None, 'pipeline_encoder_devices': None, 'pipeline_decoder_balance': None, 'pipeline_decoder_devices': None, 'pipeline_checkpoint': 'never', 'zero_sharding': 'none', 'tpu': False, 'distributed_num_procs': 1}, 'dataset': {'_name': None, 'num_workers': 1, 'skip_invalid_size_inputs_valid_test': True, 'max_tokens': None, 'batch_size': 64, 'required_batch_size_multiple': 8, 'required_seq_len_multiple': 1, 'dataset_impl': None, 'data_buffer_size': 10, 'train_subset': 'train', 'valid_subset': 'valid', 'validate_interval': 1, 'validate_interval_updates': 0, 'validate_after_updates': 0, 'fixed_validation_seed': None, 'disable_validation': False, 'max_tokens_valid': None, 'batch_size_valid': 64, 'curriculum': 0, 'gen_subset': 'test', 'num_shards': 1, 'shard_id': 0}, 'optimization': {'_name': None, 'max_epoch': 0, 'max_update': 0, 'stop_time_hours': 0.0, 'clip_norm': 0.0, 'sentence_avg': False, 'update_freq': [1], 'lr': [0.25], 'stop_min_lr': -1.0, 'use_bmuf': False}, 'checkpoint': {'_name': None, 'save_dir': 'checkpoints', 'restore_file': 'checkpoint_last.pt', 'finetune_from_model': None, 'reset_dataloader': False, 'reset_lr_scheduler': False, 'reset_meters': False, 'reset_optimizer': False, 'optimizer_overrides': '{}', 'save_interval': 1, 'save_interval_updates': 0, 'keep_interval_updates': -1, 'keep_last_epochs': -1, 'keep_best_checkpoints': -1, 'no_save': False, 'no_epoch_checkpoints': False, 'no_last_checkpoints': False, 'no_save_optimizer_state': False, 'best_checkpoint_metric': 'loss', 'maximize_best_checkpoint_metric': False, 'patience': -1, 'checkpoint_suffix': '', 'checkpoint_shard_count': 1, 'load_checkpoint_on_all_dp_ranks': False, 'model_parallel_size': 1, 'distributed_rank': 0}, 'bmuf': {'_name': None, 'block_lr': 1.0, 'block_momentum': 0.875, 'global_sync_iter': 50, 'warmup_iterations': 500, 'use_nbm': False, 'average_sync': False, 'distributed_world_size': 1}, 'generation': {'_name': None, 'beam': 5, 'nbest': 1, 'max_len_a': 0.0, 'max_len_b': 200, 'min_len': 1, 'match_source_len': False, 'unnormalized': False, 'no_early_stop': False, 'no_beamable_mm': False, 'lenpen': 1.0, 'unkpen': 0.0, 'replace_unk': None, 'sacrebleu': False, 'score_reference': False, 'prefix_size': 0, 'no_repeat_ngram_size': 0, 'sampling': False, 'sampling_topk': -1, 'sampling_topp': -1.0, 'constraints': None, 'temperature': 1.0, 'diverse_beam_groups': -1, 'diverse_beam_strength': 0.5, 'diversity_rate': -1.0, 'print_alignment': None, 'print_step': False, 'lm_path': None, 'lm_weight': 0.0, 'iter_decode_eos_penalty': 0.0, 'iter_decode_max_iter': 10, 'iter_decode_force_max_iter': False, 'iter_decode_with_beam': 1, 'iter_decode_with_external_reranker': False, 'retain_iter_history': False, 'retain_dropout': False, 'retain_dropout_modules': None, 'decoding_format': None, 'no_seed_provided': False}, 'eval_lm': {'_name': None, 'output_word_probs': False, 'output_word_stats': False, 'context_window': 0, 'softmax_batch': 9223372036854775807}, 'interactive': {'_name': None, 'buffer_size': 2500, 'input': 'en_outputs.txt.bpe'}, 'model': None, 'task': {'_name': 'translation', 'data': '../indic-en/final_bin', 'source_lang': 'SRC', 'target_lang': 'TGT', 'load_alignments': False, 'left_pad_source': True, 'left_pad_target': False, 'max_source_positions': 1024, 'max_target_positions': 1024, 'upsample_primary': -1, 'truncate_source': False, 'num_batch_buckets': 0, 'train_subset': 'train', 'dataset_impl': None, 'required_seq_len_multiple': 1, 'eval_bleu': False, 'eval_bleu_args': '{}', 'eval_bleu_detok': 'space', 'eval_bleu_detok_args': '{}', 'eval_tokenized_bleu': False, 'eval_bleu_remove_bpe': None, 'eval_bleu_print_samples': False}, 'criterion': {'_name': 'cross_entropy', 'sentence_avg': True}, 'optimizer': None, 'lr_scheduler': {'_name': 'fixed', 'force_anneal': None, 'lr_shrink': 0.1, 'warmup_updates': 0, 'lr': [0.25]}, 'scoring': {'_name': 'bleu', 'pad': 1, 'eos': 2, 'unk': 3}, 'bpe': None, 'tokenizer': None}
2023-03-07 14:58:32 | INFO | fairseq.tasks.translation | [SRC] dictionary: 35904 types
2023-03-07 14:58:32 | INFO | fairseq.tasks.translation | [TGT] dictionary: 32088 types
2023-03-07 14:58:32 | INFO | fairseq_cli.interactive | loading model(s) from ../indic-en/model/checkpoint_best.pt
Traceback (most recent call last):
File "/home/sysops/langtrans/bin/fairseq-interactive", line 8, in
sys.exit(cli_main())
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq_cli/interactive.py", line 312, in cli_main
distributed_utils.call_main(convert_namespace_to_omegaconf(args), main)
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq/distributed/utils.py", line 364, in call_main
main(cfg, **kwargs)
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq_cli/interactive.py", line 145, in main
models, _model_args = checkpoint_utils.load_model_ensemble(
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq/checkpoint_utils.py", line 297, in load_model_ensemble
ensemble, args, _task = load_model_ensemble_and_task(
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq/checkpoint_utils.py", line 339, in load_model_ensemble_and_task
state = load_checkpoint_to_cpu(filename, arg_overrides)
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq/checkpoint_utils.py", line 271, in load_checkpoint_to_cpu
overwrite_args_by_name(state["cfg"], arg_overrides)
File "/home/sysops/langtrans/lib/python3.8/site-packages/fairseq/dataclass/utils.py", line 427, in overwrite_args_by_name
with open_dict(cfg):
File "/usr/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/home/sysops/langtrans/lib/python3.8/site-packages/omegaconf/omegaconf.py", line 669, in open_dict
prev_state = config._get_node_flag("struct")
AttributeError: 'dict' object has no attribute '_get_node_flag'

@sumanthd17
Copy link
Member

Can you also share the version of fairseq. It is likely that there's a mismatch in fairseq

@usaraj
Copy link
Author

usaraj commented Mar 14, 2023

@sumanthd17 - Thanks for your reply.

The fairseq version installed from git repo is: 1.0.0a0+da9eaba.

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