Instructions to use unsqldotai/unSQLv1-7b-sqlite-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsqldotai/unSQLv1-7b-sqlite-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsqldotai/unSQLv1-7b-sqlite-lora")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsqldotai/unSQLv1-7b-sqlite-lora") model = AutoModelForCausalLM.from_pretrained("unsqldotai/unSQLv1-7b-sqlite-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsqldotai/unSQLv1-7b-sqlite-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsqldotai/unSQLv1-7b-sqlite-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsqldotai/unSQLv1-7b-sqlite-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/unsqldotai/unSQLv1-7b-sqlite-lora
- SGLang
How to use unsqldotai/unSQLv1-7b-sqlite-lora 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 "unsqldotai/unSQLv1-7b-sqlite-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsqldotai/unSQLv1-7b-sqlite-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "unsqldotai/unSQLv1-7b-sqlite-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsqldotai/unSQLv1-7b-sqlite-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use unsqldotai/unSQLv1-7b-sqlite-lora with Docker Model Runner:
docker model run hf.co/unsqldotai/unSQLv1-7b-sqlite-lora
Update README.md
Browse files68 unmodified lines697071727374757677787980818283848586878868 unmodified lines## Sagemaker Endpoint I/O Example```js{"inputs": "### Schema and the Natural Language Query:\nCREATE TABLE stadium (\n stadium_id number,\n location text,\n name text,\n capacity number,\n highest number,\n lowest number,\n average number\n)\n\nCREATE TABLE singer (\n singer_id number,\n name text,\n country text,\n song_name text,\n song_release_year text,\n age number,\n is_male others\n)\n\nCREATE TABLE concert (\n concert_id number,\n concert_name text,\n theme text,\n stadium_id text,\n year text\n)\n\nCREATE TABLE singer_in_concert (\n concert_id number,\n singer_id text\n)\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What is the maximum, the average, and the minimum capacity of stadiums ?","parameters": {"maxNewTokens": 512,"topP": 0.9,"temperature": 0.2,"decoderInputDetails": true,"details": true}}``````js{"body": [{68 unmodified lines69707172737475767778798081828384858687888990919293949596979868 unmodified lines## Sagemaker Endpoint I/O Example```pypayload = {"inputs": "### Schema and the Natural Language Query:\nCREATE TABLE stadium (\n stadium_id number,\n location text,\n name text,\n capacity number,\n highest number,\n lowest number,\n average number\n)\n\nCREATE TABLE singer (\n singer_id number,\n name text,\n country text,\n song_name text,\n song_release_year text,\n age number,\n is_male others\n)\n\nCREATE TABLE concert (\n concert_id number,\n concert_name text,\n theme text,\n stadium_id text,\n year text\n)\n\nCREATE TABLE singer_in_concert (\n concert_id number,\n singer_id text\n)\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What is the maximum, the average, and the minimum capacity of stadiums ?","parameters": {"maxNewTokens": 512,"topP": 0.9,"temperature": 0.2}}client = boto3.client('runtime.sagemaker')endpoint_name = 'deployed_model_name'response = client.invoke_endpoint(EndpointName=endpoint_name,ContentType='application/json',Body=json.dumps(payload).encode('utf-8'),)response = response["Body"].read().decode("utf8")response = json.loads(response)print(response[0]['generated_text'])``````json{"body": [{
README.md+16-6