huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
132.83k stars 26.49k forks source link

dev-ai #27365

Open devgupta6 opened 10 months ago

devgupta6 commented 10 months ago

Model description

It a generative artifical intelligence model. I have the architecture ready but I am facing the problem to interagte it with transformer architure. It would be great if you provide me assistance with this.

Open source status

Provide useful links for the implementation

No response

amyeroberts commented 10 months ago

Hi @devgupta6, thanks for opening an issue!

The easiest and recommended way to make a model available in transformers is to add the modeling code directly on the hub: https://huggingface.co/docs/transformers/custom_models. Here is a more general guide on adding models: https://huggingface.co/docs/transformers/add_new_model

devgupta6 commented 10 months ago

Hi @amyeroberts I had registered my LLM model using automodel like this - AutoModelForCausalLM.register(CustomAIConfig, CustomAI) but it is showing the error - --------------------------------------------------------------------------- ImportError Traceback (most recent call last)

in () 1 # Load model directly ----> 2 from transformers import CustomAI 3 model = CustomAI.from_pretrained("RANITBAG/gan") ImportError: cannot import name 'CustomAI' from 'transformers' (/usr/local/lib/python3.10/dist-packages/transformers/__init__.py) --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below. --------------------------------------------------------------------------- . I have tried all sorts of things but it would be of great help if you could assist me with this.
amyeroberts commented 10 months ago

Could you link to your model on the hub? Without seeing the code I'm not able to see what the issue might be.

devgupta6 commented 10 months ago

Yes, sure. https://github.com/devgupta6/dev-ai this is the model link

amyeroberts commented 10 months ago

@devgupta6 Please read the documentation pages I sent over as these contain all the information you should need. The model at the moment is just a torch implementation and doesn't have any of the necessary adaptations for the transformers library. For example, your model needs to inherit from PretrainedModel. We can help with bugs and issues but we can't write your code for you.