Instructions to use pszemraj/flan-t5-xl-grammar-synthesis with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pszemraj/flan-t5-xl-grammar-synthesis with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("pszemraj/flan-t5-xl-grammar-synthesis") model = AutoModelForSeq2SeqLM.from_pretrained("pszemraj/flan-t5-xl-grammar-synthesis") - llama-cpp-python
How to use pszemraj/flan-t5-xl-grammar-synthesis with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="pszemraj/flan-t5-xl-grammar-synthesis", filename="flan-t5-xl-grammar-synthesis-q6_k.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use pszemraj/flan-t5-xl-grammar-synthesis with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K # Run inference directly in the terminal: llama-cli -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K # Run inference directly in the terminal: llama-cli -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K # Run inference directly in the terminal: ./llama-cli -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K # Run inference directly in the terminal: ./build/bin/llama-cli -hf pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
Use Docker
docker model run hf.co/pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
- LM Studio
- Jan
- Ollama
How to use pszemraj/flan-t5-xl-grammar-synthesis with Ollama:
ollama run hf.co/pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
- Unsloth Studio
How to use pszemraj/flan-t5-xl-grammar-synthesis with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pszemraj/flan-t5-xl-grammar-synthesis to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pszemraj/flan-t5-xl-grammar-synthesis to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for pszemraj/flan-t5-xl-grammar-synthesis to start chatting
- Docker Model Runner
How to use pszemraj/flan-t5-xl-grammar-synthesis with Docker Model Runner:
docker model run hf.co/pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
- Lemonade
How to use pszemraj/flan-t5-xl-grammar-synthesis with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull pszemraj/flan-t5-xl-grammar-synthesis:Q6_K
Run and chat with the model
lemonade run user.flan-t5-xl-grammar-synthesis-Q6_K
List all available models
lemonade list
grammar-synthesis: flan-t5-xl
This model is a fine-tuned version of google/flan-t5-xl on an extended version of the JFLEG dataset.
- here is a custom class wrapper that makes using this with
bitsandbyteseasier - the API can be slow due to model size, try the notebook!
Model description
The intent is to create a text2text language model that successfully performs "single-shot grammar correction" on a potentially grammatically incorrect text that could have many errors with the important qualifier that it does not semantically change text/information that IS grammatically correct..
Compare some of the more severe error examples on other grammar correction models to see the difference :)
Limitations
- Data set:
cc-by-nc-sa-4.0 - Model:
apache-2.0 - currently a work in progress! While probably useful for "single-shot grammar correction" in many cases, check the output for correctness, ok?.
Training procedure
Training hyperparameters
Session One
- TODO: add this. It was a single epoch at higher LR
Session Two
The following hyperparameters were used during training:
- learning_rate: 4e-05
- train_batch_size: 4
- eval_batch_size: 1
- seed: 42
- distributed_type: multi-GPU
- gradient_accumulation_steps: 16
- total_train_batch_size: 64
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.02
- num_epochs: 2.0
- Downloads last month
- 90
Model tree for pszemraj/flan-t5-xl-grammar-synthesis
Base model
google/flan-t5-xl