Skip to content

Conversation

@yumiian
Copy link

@yumiian yumiian commented Jun 8, 2025

Tested on Python version 3.12.11.

Apparently this issue occur when running on newer Python version >= 3.12.x

This issue has been discussed on #192. This PR further fixes the issue when running this code:

import malaya
malaya.translation.huggingface()

The error output:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[3], line 1
----> 1 malaya.translation.huggingface()

File d:\Anaconda\envs\nlp\Lib\site-packages\malaya\translation.py:286, in huggingface(model, force_check, **kwargs)
    266 def huggingface(
    267     model: str = 'mesolitica/translation-t5-small-standard-bahasa-cased',
    268     force_check: bool = True,
    269     **kwargs,
    270 ):
    271     """
    272     Load HuggingFace model to translate.
    273 
   (...)    284     result: malaya.torch_model.huggingface.Translation
    285     """
--> 286     return load(
    287         model=model,
    288         class_model=Translation,
    289         available_huggingface=available_huggingface,
    290         force_check=force_check,
    291         path=__name__,
    292         **kwargs,
    293     )

File d:\Anaconda\envs\nlp\Lib\site-packages\malaya\supervised\huggingface.py:22, in load(model, class_model, available_huggingface, force_check, path, **kwargs)
     17 if model not in available_huggingface and force_check:
     18     raise ValueError(
     19         f'model not supported, please check supported models from `{path}.available_huggingface`.'
     20     )
---> 22 args = inspect.getargspec(class_model)
     23 # args = inspect.signature(class_model).parameters
     24 for k, v in additional_parameters.items():

AttributeError: module 'inspect' has no attribute 'getargspec'

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

Successfully merging this pull request may close these issues.

1 participant