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

Missing Transformers initializer for Falcon models #1988

Open
martin-gorner opened this issue Nov 19, 2024 · 1 comment
Open

Missing Transformers initializer for Falcon models #1988

martin-gorner opened this issue Nov 19, 2024 · 1 comment

Comments

@martin-gorner
Copy link
Contributor

martin-gorner commented Nov 19, 2024

Repro code:
model5 = keras_hub.models.CausalLM.from_preset("hf://tiiuae/falcon-7b-instruct", dtype="bfloat16")
Result:
ValueError: KerasHub has no converter for huggingface/transformers models with model type 'falcon'

Now that the Falcon model family exists in Keras-hub, this should work.

@mehtamansi29 mehtamansi29 self-assigned this Dec 4, 2024
@mehtamansi29
Copy link
Collaborator

Hi @martin-gorner -

Thanks for reporting the issue. You can intialize falcon-7b-instruct model using transformers AutoTokenizer, AutoModelForCausalLM class.

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_name = "tiiuae/falcon-7b-instruct"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto") 

And for loading falcon model family(falcon_refinedweb_1b_en) in keras-hub, you can use like this.
model5 = keras_hub.models.CausalLM.from_preset("hf://keras/falcon_refinedweb_1b_en", dtype="bfloat16")

Attached gist here for the reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants