Instructions to use simmonsc/qwen-lm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use simmonsc/qwen-lm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="simmonsc/qwen-lm")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("simmonsc/qwen-lm", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use simmonsc/qwen-lm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "simmonsc/qwen-lm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "simmonsc/qwen-lm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/simmonsc/qwen-lm
- SGLang
How to use simmonsc/qwen-lm 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 "simmonsc/qwen-lm" \ --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": "simmonsc/qwen-lm", "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 "simmonsc/qwen-lm" \ --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": "simmonsc/qwen-lm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use simmonsc/qwen-lm with Docker Model Runner:
docker model run hf.co/simmonsc/qwen-lm
๐งฎ Qwen Math Assistant
A powerful AI-powered mathematical problem solver built with Qwen language model and deployed on Hugging Face Spaces.
๐ Features
- Step-by-step Solutions: Get detailed explanations for mathematical problems
- Wide Range of Topics: Algebra, calculus, geometry, trigonometry, and more
- Interactive Interface: Clean and intuitive Gradio-powered chat interface
- Real-time Processing: Fast response times with optimized model loading
- Example Problems: Quick-start with pre-loaded example questions
๐ฏ Supported Math Topics
- โ Algebra: Linear equations, quadratic equations, polynomial operations
- โ Calculus: Derivatives, integrals, limits
- โ Geometry: Area, volume, perimeter calculations
- โ Trigonometry: Sin, cos, tan functions and identities
- โ Statistics: Basic statistical calculations
- โ Number Theory: Prime numbers, factorization
๐ ๏ธ How to Use
- Load the Model: Click the "๐ Load Model" button to initialize the AI assistant
- Ask Questions: Type your math problem in the text box
- Get Solutions: Receive step-by-step explanations and answers
- Try Examples: Click on example problems to get started quickly
Example Queries:
- "Solve: 2x + 5 = 15"
- "What is the derivative of xยฒ + 3x - 2?"
- "Factor: xยฒ - 9"
- "Calculate the area of a circle with radius 5"
๐๏ธ Technical Details
Model Architecture
- Base Model: Qwen2.5-0.5B (optimized for Hugging Face Spaces)
- Framework: Transformers, PyTorch
- Interface: Gradio
- Deployment: Hugging Face Spaces
Performance Optimizations
- Efficient memory usage with
low_cpu_mem_usage=True - Dynamic device mapping for GPU/CPU compatibility
- Optimized tokenization with proper padding handling
- Response caching for better performance
๐ Requirements
- Python 3.8+
- PyTorch 2.0+
- Transformers 4.35+
- Gradio 4.0+
- PEFT 0.6+
๐ Deployment
Local Setup
git clone <your-repo>
cd qwen-math-assistant
pip install -r requirements.txt
python app.py
Hugging Face Spaces
- Create a new Space on Hugging Face
- Upload
app.pyandrequirements.txt - Set the SDK to "gradio"
- The Space will automatically build and deploy
๐ง Configuration
The application includes several configurable parameters:
- Max Response Length: Adjustable slider (50-500 tokens)
- Temperature: Set to 0.7 for balanced creativity/accuracy
- Top-p Sampling: 0.9 for diverse but relevant responses
๐ License
This project is open source and available under the MIT License.
๐ค Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
๐ Support
For questions or support, please open an issue in the repository or contact the maintainers.
Note: This application uses the Qwen language model. Please ensure you comply with the model's usage terms and conditions.
- Downloads last month
- -
Dataset used to train simmonsc/qwen-lm
Benchmark โข Updated โข 17.6k โข 931k โข 1.37k