Instructions to use BAAI/Emu3-Stage1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BAAI/Emu3-Stage1 with Transformers:
# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("BAAI/Emu3-Stage1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
#2
by wajahatalikhan - opened
README.md
CHANGED
|
@@ -149,14 +149,14 @@ GENERATION_CONFIG = GenerationConfig(
|
|
| 149 |
max_new_tokens=1024,
|
| 150 |
)
|
| 151 |
|
| 152 |
-
|
| 153 |
inputs.input_ids.to("cuda:0"),
|
| 154 |
GENERATION_CONFIG,
|
| 155 |
attention_mask=inputs.attention_mask.to("cuda:0"),
|
| 156 |
)
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
|
| 162 |
```
|
|
|
|
| 149 |
max_new_tokens=1024,
|
| 150 |
)
|
| 151 |
|
| 152 |
+
outputs = model.generate(
|
| 153 |
inputs.input_ids.to("cuda:0"),
|
| 154 |
GENERATION_CONFIG,
|
| 155 |
attention_mask=inputs.attention_mask.to("cuda:0"),
|
| 156 |
)
|
| 157 |
+
outputs = outputs[:, inputs.input_ids.shape[-1]:]
|
| 158 |
+
answers = processor.batch_decode(outputs, skip_special_tokens=True)
|
| 159 |
+
for ans in answers:
|
| 160 |
+
print(ans)
|
| 161 |
|
| 162 |
```
|