AI4Bharat / IndicXlit

Transliteration models for 21 Indic languages
https://ai4bharat.iitm.ac.in/transliteration
MIT License
76 stars 21 forks source link

unable to run the code #32

Closed shabbirddev closed 7 months ago

shabbirddev commented 7 months ago

Please guide me how to solve this errors Code:

from ai4bharat.transliteration import XlitEngine

e = XlitEngine(lang2use="ur",beam_width=10,rescore=True,src_script_type="indic")
out = e.translit_sentence("رسالت پر")
print(out)

Errors:


Initializing Multilingual model for transliteration
Traceback (most recent call last):
  File "c:\Personal_Data\Code_Projects\Python\trans\main.py", line 3, in <module>
    e = XlitEngine(lang2use="ur",beam_width=10,rescore=True,src_script_type="indic")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\ai4bharat\transliteration\xlit_src.py", line 12, in XlitEngine
    return XlitEngineTransformer_Indic2En(beam_width=beam_width, rescore=rescore)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\ai4bharat\transliteration\transformer\indic2en.py", line 60, in __init__
    super().__init__(models_path, beam_width=beam_width, rescore=rescore)
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\ai4bharat\transliteration\transformer\base_engine.py", line 45, in __init__
    from .custom_interactive import Transliterator
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\ai4bharat\transliteration\transformer\custom_interactive.py", line 23, in <module>
    from fairseq import checkpoint_utils, distributed_utils, options, tasks, utils
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\fairseq\__init__.py", line 20, in <module>
    from fairseq.distributed import utils as distributed_utils
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\fairseq\distributed\__init__.py", line 7, in <module>
    from .fully_sharded_data_parallel import (
  File "C:\Personal_Data\Code_Projects\Python\trans\Lib\site-packages\fairseq\distributed\fully_sharded_data_parallel.py", line 10, in <module>
     ^^^^^^^^^
  File "C:\Users\shabb\AppData\Local\Programs\Python\Python312\Lib\dataclasses.py", line 1266, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "C:\Users\shabb\AppData\Local\Programs\Python\Python312\Lib\dataclasses.py", line 1256, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shabb\AppData\Local\Programs\Python\Python312\Lib\dataclasses.py", line 994, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\shabb\AppData\Local\Programs\Python\Python312\Lib\dataclasses.py", line 852, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'fairseq.dataclass.configs.CommonConfig'> for field common is not allowed: use default_factory
GokulNC commented 7 months ago

Please check: https://github.com/AI4Bharat/IndicXlit/issues/24#issuecomment-1647383983