Run this model with HF Jobs

Run google/gemma-3n-E4B-it on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/google/gemma-3n-E4B-it. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/google/gemma-3n-E4B-it on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/google/gemma-3n-E4B-it. Ask me which benchmark to run, then save the scores and the per-example results to a new private dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/google/gemma-3n-E4B-it. Push it to a new private model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Cannot copy out of meta tensor; no data!

#14
by Amit5674 - opened

First in order to avoid unknown mobilenetv5_300m_enc errors:
!pip uninstall -y timm
!pip install timm --upgrade

Then run the inference example of the model card and got: NotImplementedError: Cannot copy out of meta tensor; no data!
Full log:
The following generation flags are not valid and may be ignored: ['top_p', 'top_k']. Set TRANSFORMERS_VERBOSITY=info for more details.

NotImplementedError Traceback (most recent call last)
/tmp/ipython-input-1-875231982.py in <cell line: 0>()
35
36 with torch.inference_mode():
---> 37 generation = model.generate(**inputs, max_new_tokens=100, do_sample=False)
38 generation = generation[0][input_len:]
39

21 frames
/usr/local/lib/python3.11/dist-packages/transformers/models/gemma3n/modeling_gemma3n.py in scale_corrected_output(self, corrected)
1138 def scale_corrected_output(self, corrected: torch.Tensor) -> torch.Tensor:
1139 """Scales the provided 3D tensor of shape [batch_size, num_tokens, hidden_size]."""
-> 1140 return (corrected.type_as(self.correct_output_scale) * self.correct_output_scale).type_as(corrected)
1141
1142

NotImplementedError: Cannot copy out of meta tensor; no data!

Hi @Amit5674 ,

RuntimeError: Unknown model (mobilenetv5_300m_enc) is an error from timm it means they are not up to date. Gemma 3n requires at least timm v1.0.16. Please upgrade avoid the above issue, and also please upgrade the transformer to the latest the timm to latest version or at least to v1.0.16 to version to work with Gemma 3n models. I have successfully able to load the model after upgrading the timm to v1.0.16.

Please find the following gist file where I have successfully able to get the output from the model.

Thanks.

Sign up or log in to comment