Skip to content

Commit

Permalink
More Emu2 experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnurro committed May 2, 2024
1 parent 7507a5a commit 4122d37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backends/huggingface_multimodal_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def load_model(model_spec: backends.ModelSpec):
if hasattr(model_spec, 'trust_remote_code'):
if model_spec['trust_remote_code']:
if model_spec['model_type'] == "Emu2":
# based on Emu2 example code,
with init_empty_weights():
model = AutoModelForCausalLM.from_pretrained(
"BAAI/Emu2-Chat",
Expand Down Expand Up @@ -252,6 +253,9 @@ def generate_emu2_output(model: AutoModelForCausalLM, tokenizer: AutoTokenizer,
param tokenizer: Emu2 tokenizer
param device: Processing device - cuda/CPU
"""

print(prompt)

# process prompt and images into model input:
inputs = model.build_input_ids(
text=[prompt],
Expand Down

0 comments on commit 4122d37

Please sign in to comment.