Upload ai21labs_AI21-Jamba2-3B_1.txt with huggingface_hub
Browse files
ai21labs_AI21-Jamba2-3B_1.txt
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```CODE:
|
| 2 |
+
# Load model directly
|
| 3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 4 |
+
|
| 5 |
+
tokenizer = AutoTokenizer.from_pretrained("ai21labs/AI21-Jamba2-3B")
|
| 6 |
+
model = AutoModelForCausalLM.from_pretrained("ai21labs/AI21-Jamba2-3B")
|
| 7 |
+
messages = [
|
| 8 |
+
{"role": "user", "content": "Who are you?"},
|
| 9 |
+
]
|
| 10 |
+
inputs = tokenizer.apply_chat_template(
|
| 11 |
+
messages,
|
| 12 |
+
add_generation_prompt=True,
|
| 13 |
+
tokenize=True,
|
| 14 |
+
return_dict=True,
|
| 15 |
+
return_tensors="pt",
|
| 16 |
+
).to(model.device)
|
| 17 |
+
|
| 18 |
+
outputs = model.generate(**inputs, max_new_tokens=40)
|
| 19 |
+
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
ERROR:
|
| 23 |
+
Traceback (most recent call last):
|
| 24 |
+
File "/tmp/ai21labs_AI21-Jamba2-3B_1x3WqpZ.py", line 39, in <module>
|
| 25 |
+
outputs = model.generate(**inputs, max_new_tokens=40)
|
| 26 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
|
| 27 |
+
return func(*args, **kwargs)
|
| 28 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/generation/utils.py", line 2564, in generate
|
| 29 |
+
result = decoding_method(
|
| 30 |
+
self,
|
| 31 |
+
...<5 lines>...
|
| 32 |
+
**model_kwargs,
|
| 33 |
+
)
|
| 34 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/generation/utils.py", line 2784, in _sample
|
| 35 |
+
outputs = self(**model_inputs, return_dict=True)
|
| 36 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
|
| 37 |
+
return self._call_impl(*args, **kwargs)
|
| 38 |
+
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
|
| 39 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
|
| 40 |
+
return forward_call(*args, **kwargs)
|
| 41 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/utils/generic.py", line 918, in wrapper
|
| 42 |
+
output = func(self, *args, **kwargs)
|
| 43 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/models/jamba/modeling_jamba.py", line 1350, in forward
|
| 44 |
+
outputs: MoeModelOutputWithPast = self.model(
|
| 45 |
+
~~~~~~~~~~^
|
| 46 |
+
input_ids=input_ids,
|
| 47 |
+
^^^^^^^^^^^^^^^^^^^^
|
| 48 |
+
...<8 lines>...
|
| 49 |
+
cache_position=cache_position,
|
| 50 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 51 |
+
)
|
| 52 |
+
^
|
| 53 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
|
| 54 |
+
return self._call_impl(*args, **kwargs)
|
| 55 |
+
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
|
| 56 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
|
| 57 |
+
return forward_call(*args, **kwargs)
|
| 58 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/utils/generic.py", line 918, in wrapper
|
| 59 |
+
output = func(self, *args, **kwargs)
|
| 60 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/models/jamba/modeling_jamba.py", line 1195, in forward
|
| 61 |
+
layer_outputs = decoder_layer(
|
| 62 |
+
hidden_states,
|
| 63 |
+
...<6 lines>...
|
| 64 |
+
cache_position=cache_position,
|
| 65 |
+
)
|
| 66 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/modeling_layers.py", line 94, in __call__
|
| 67 |
+
return super().__call__(*args, **kwargs)
|
| 68 |
+
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
|
| 69 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
|
| 70 |
+
return self._call_impl(*args, **kwargs)
|
| 71 |
+
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
|
| 72 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
|
| 73 |
+
return forward_call(*args, **kwargs)
|
| 74 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/utils/deprecation.py", line 172, in wrapped_func
|
| 75 |
+
return func(*args, **kwargs)
|
| 76 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/models/jamba/modeling_jamba.py", line 1035, in forward
|
| 77 |
+
hidden_states = self.mamba(
|
| 78 |
+
hidden_states=hidden_states,
|
| 79 |
+
cache_params=past_key_values,
|
| 80 |
+
attention_mask=attention_mask,
|
| 81 |
+
)
|
| 82 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1775, in _wrapped_call_impl
|
| 83 |
+
return self._call_impl(*args, **kwargs)
|
| 84 |
+
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
|
| 85 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1786, in _call_impl
|
| 86 |
+
return forward_call(*args, **kwargs)
|
| 87 |
+
File "/tmp/.cache/uv/environments-v2/8057a645a8e26186/lib/python3.13/site-packages/transformers/models/jamba/modeling_jamba.py", line 818, in forward
|
| 88 |
+
raise ValueError(
|
| 89 |
+
"Fast Mamba kernels are not available. Make sure to they are installed and that the mamba module is on a CUDA device"
|
| 90 |
+
)
|
| 91 |
+
ValueError: Fast Mamba kernels are not available. Make sure to they are installed and that the mamba module is on a CUDA device
|