Instructions to use Majipa/text-to-SQL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Majipa/text-to-SQL with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Majipa/text-to-SQL", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
|
Download README.md from Majipa/text-to-SQL: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/Majipa/text-to-SQL/resolve/main/README.md
- Command line
-
hf download hf://Majipa/text-to-SQL/README.md
-
curl -L -o README.md https://huggingface.co/Majipa/text-to-SQL/resolve/main/README.md
1.52 kB
| base_model: unsloth/phi-3-mini-4k-instruct-bnb-4bit | |
| language: | |
| - en | |
| license: apache-2.0 | |
| tags: | |
| - text-generation-inference | |
| - transformers | |
| - unsloth | |
| - mistral | |
| - trl | |
| # Uploaded model | |
| - **Developed by:** Majipa | |
| - **License:** apache-2.0 | |
| - **Finetuned from model :** unsloth/phi-3-mini-4k-instruct-bnb-4bit | |
| This mistral model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library. | |
| ## Using the model | |
| ```python | |
| from transformers import AutoModelForCausalLM, BitsAndBytesConfig | |
| quantization_config = BitsAndBytesConfig(load_in_4bit=True) | |
| model = AutoModelForCausalLM.from_pretrained("Majipa/text-to-SQL", | |
| device_map="cuda", | |
| torch_dtype="auto", | |
| quantization_config=quantization_config) | |
| from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline | |
| tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct") | |
| messages = [ | |
| {"role": "system", "content": "You are a helpful text-to-SQL assistant."}, | |
| {"role": "user", "content": "question: How many heads of the departments are older than 56 ? context: CREATE TABLE head (age INTEGER)"}, | |
| ] | |
| pipe = pipeline( | |
| "text-generation", | |
| model=model, | |
| tokenizer=tokenizer, | |
| ) | |
| generation_args = { | |
| "max_new_tokens": 500, | |
| "temperature": 0.7, | |
| } | |
| output = pipe(messages, **generation_args) | |
| print(output[0]['generated_text']) | |