The inference engine for the Taco LLMingway project. This is a FastAPI-based server that loads a custom GPT model trained on Taco Hemingway's lyrics and serves predictions via standard JSON or high-performance streaming.
- Real-time Streaming: Implements
StreamingResponseto deliver lyrics token-by-token. - Dual Endpoints: Supports both standard POST requests and streaming for interactive UIs.
- PyTorch Integration: Optimized for CPU inference using pre-trained weights.
- CORS Enabled: Configured for seamless communication with the Next.js frontend.
The model weights used in this project were trained on a custom dataset of Taco Hemingway's lyrics. You can find the pre-trained weights and tokenizer on Kaggle:
- Framework: FastAPI
- Inference: PyTorch
- Server: Uvicorn (Dev) / Gunicorn (Prod)
- Data Validation: Pydantic
├── main.py # Application entry point & routes
├── requirements.txt # Python dependencies
└── model/ # Download weights from Kaggle here
├── tokenizer.json
├── config.json
└── taco-llmingway.pth-
Clone the repositories: Ensure both the backend and the core library are in the same parent directory:
git clone https://github.com/your-username/taco-llmingway-backend.git git clone https://github.com/your-username/taco-llmingway.git
-
Install the core library:
pip install ../taco-llmingway cd taco-llmingway-backend -
Install remaining dependencies: For CPU-only VPS:
pip install torch --index-url https://download.pytorch.org/whl/cpu pip install -r requirements.txt
Use this for local testing and development with hot-reload:
uvicorn main:app --reload --port 8000Use Gunicorn with the Uvicorn worker class for better stability and performance:
gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind 0.0.0.0:8000POST /stream
{
"starting_text": "Wracam ekspresem do Warszawy...",
"n_iters": 256,
"temperature": 0.8
}POST /generate
{
"starting_text": "Wracam ekspresem do Warszawy...",
"n_iters": 256,
"temperature": 0.8
}*Note: The /stream endpoint will return a streaming response, while /generate will return the raw tokens.
- Taco-LLMingway-frontend - The Next.js web interface.
- Taco-LLMingway - Training scripts and data processing.
This project is licensed under the MIT License.