Text Generation
Transformers
Safetensors
Arabic
qwen2
fill-mask
Text-To-SQL
Arabic
Spider
SQL
text2text-generation
conversational
text-generation-inference
Instructions to use OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B") model = AutoModelWithLMHead.from_pretrained("OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B
- SGLang
How to use OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B with Docker Model Runner:
docker model run hf.co/OsamaMo/Arabic_Text-To-SQL_using_Qwen2.5-1.5B
| # Default use the NVIDIA official image with PyTorch 2.3.0 | |
| # https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/index.html | |
| ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:24.02-py3 | |
| FROM ${BASE_IMAGE} | |
| # Define environments | |
| ENV MAX_JOBS=4 | |
| ENV FLASH_ATTENTION_FORCE_BUILD=TRUE | |
| ENV VLLM_WORKER_MULTIPROC_METHOD=spawn | |
| # Define installation arguments | |
| ARG INSTALL_BNB=false | |
| ARG INSTALL_VLLM=false | |
| ARG INSTALL_DEEPSPEED=false | |
| ARG INSTALL_FLASHATTN=false | |
| ARG INSTALL_LIGER_KERNEL=false | |
| ARG INSTALL_HQQ=false | |
| ARG INSTALL_EETQ=false | |
| ARG PIP_INDEX=https://pypi.org/simple | |
| ARG HTTP_PROXY= | |
| # Set the working directory | |
| WORKDIR /app | |
| # Set http proxy | |
| RUN if [ -n "$HTTP_PROXY" ]; then \ | |
| echo "Configuring proxy..."; \ | |
| export http_proxy=$HTTP_PROXY; \ | |
| export https_proxy=$HTTP_PROXY; \ | |
| fi | |
| # Install the requirements | |
| COPY requirements.txt /app | |
| RUN pip config set global.index-url "$PIP_INDEX" && \ | |
| pip config set global.extra-index-url "$PIP_INDEX" && \ | |
| python -m pip install --upgrade pip && \ | |
| if [ -n "$HTTP_PROXY" ]; then \ | |
| python -m pip install --proxy=$HTTP_PROXY -r requirements.txt; \ | |
| else \ | |
| python -m pip install -r requirements.txt; \ | |
| fi | |
| # Copy the rest of the application into the image | |
| COPY . /app | |
| # Install the LLaMA Factory | |
| RUN EXTRA_PACKAGES="metrics"; \ | |
| if [ "$INSTALL_BNB" == "true" ]; then \ | |
| EXTRA_PACKAGES="${EXTRA_PACKAGES},bitsandbytes"; \ | |
| fi; \ | |
| if [ "$INSTALL_VLLM" == "true" ]; then \ | |
| EXTRA_PACKAGES="${EXTRA_PACKAGES},vllm"; \ | |
| fi; \ | |
| if [ "$INSTALL_DEEPSPEED" == "true" ]; then \ | |
| EXTRA_PACKAGES="${EXTRA_PACKAGES},deepspeed"; \ | |
| fi; \ | |
| if [ "$INSTALL_LIGER_KERNEL" == "true" ]; then \ | |
| EXTRA_PACKAGES="${EXTRA_PACKAGES},liger-kernel"; \ | |
| fi; \ | |
| if [ "$INSTALL_HQQ" == "true" ]; then \ | |
| EXTRA_PACKAGES="${EXTRA_PACKAGES},hqq"; \ | |
| fi; \ | |
| if [ "$INSTALL_EETQ" == "true" ]; then \ | |
| EXTRA_PACKAGES="${EXTRA_PACKAGES},eetq"; \ | |
| fi; \ | |
| if [ -n "$HTTP_PROXY" ]; then \ | |
| pip install --proxy=$HTTP_PROXY -e ".[$EXTRA_PACKAGES]"; \ | |
| else \ | |
| pip install -e ".[$EXTRA_PACKAGES]"; \ | |
| fi | |
| # Rebuild flash attention | |
| RUN pip uninstall -y transformer-engine flash-attn && \ | |
| if [ "$INSTALL_FLASHATTN" == "true" ]; then \ | |
| pip uninstall -y ninja && \ | |
| if [ -n "$HTTP_PROXY" ]; then \ | |
| pip install --proxy=$HTTP_PROXY ninja && \ | |
| pip install --proxy=$HTTP_PROXY --no-cache-dir flash-attn --no-build-isolation; \ | |
| else \ | |
| pip install ninja && \ | |
| pip install --no-cache-dir flash-attn --no-build-isolation; \ | |
| fi; \ | |
| fi | |
| # Unset http proxy | |
| RUN if [ -n "$HTTP_PROXY" ]; then \ | |
| unset http_proxy; \ | |
| unset https_proxy; \ | |
| fi | |
| # Set up volumes | |
| VOLUME [ "/root/.cache/huggingface", "/root/.cache/modelscope", "/app/data", "/app/output" ] | |
| # Expose port 7860 for the LLaMA Board | |
| ENV GRADIO_SERVER_PORT 7860 | |
| EXPOSE 7860 | |
| # Expose port 8000 for the API service | |
| ENV API_PORT 8000 | |
| EXPOSE 8000 | |