|
--- |
|
license: apache-2.0 |
|
tags: |
|
- finetuned |
|
pipeline_tag: text-generation |
|
inference: true |
|
widget: |
|
- messages: |
|
- role: user |
|
content: What is your favorite condiment? |
|
extra_gated_description: >- |
|
If you want to learn more about how we process your personal data, please read |
|
our <a href="https://mistral.ai/terms/">Privacy Policy</a>. |
|
--- |
|
|
|
# Model Card for shaheerzk/text-to-rdb-queries |
|
|
|
|
|
## Inference with hugging face `transformers` |
|
|
|
```py |
|
from transformers import AutoModelForCausalLM |
|
|
|
model = AutoModelForCausalLM.from_pretrained("shaheerzk/text-to-rdb-queries") |
|
model.to("cuda") |
|
|
|
generated_ids = model.generate(tokens, max_new_tokens=1000, do_sample=True) |
|
|
|
# decode with mistral tokenizer |
|
result = tokenizer.decode(generated_ids[0].tolist()) |
|
print(result) |
|
``` |
|
|
|
> [!TIP] |
|
> PRs to correct the `transformers` tokenizer so that it gives 1-to-1 the same results as the `mistral_common` reference implementation are very welcome! |
|
|
|
--- |
|
|
|
The shaheerzk/text-to-rdb-queries Large Language Model (LLM) is an instruct fine-tuned version of the Mistral-7B-v0.2. |
|
|
|
|
|
## Instruction format |
|
|
|
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method: |
|
|
|
```python |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
device = "cuda" # the device to load the model onto |
|
|
|
model = AutoModelForCausalLM.from_pretrained("shaheerzk/text-to-rdb-queries") |
|
tokenizer = AutoTokenizer.from_pretrained("shaheerzk/text-to-rdb-queries") |
|
|
|
messages = [ |
|
{"role": "user", "content": ""}, |
|
{"role": "assistant", "content": ""}, |
|
{"role": "user", "content": ""} |
|
] |
|
|
|
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt") |
|
|
|
model_inputs = encodeds.to(device) |
|
model.to(device) |
|
|
|
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True) |
|
decoded = tokenizer.batch_decode(generated_ids) |
|
print(decoded[0]) |
|
``` |
|
|