HHousen/ParaSCI
Viewer • Updated • 350k • 200 • 2
How to use ptkag1712/gpt2-based-on-paraSCI_dataset with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ptkag1712/gpt2-based-on-paraSCI_dataset") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("ptkag1712/gpt2-based-on-paraSCI_dataset", dtype="auto")How to use ptkag1712/gpt2-based-on-paraSCI_dataset with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ptkag1712/gpt2-based-on-paraSCI_dataset"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ptkag1712/gpt2-based-on-paraSCI_dataset",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ptkag1712/gpt2-based-on-paraSCI_dataset
How to use ptkag1712/gpt2-based-on-paraSCI_dataset with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ptkag1712/gpt2-based-on-paraSCI_dataset" \
--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": "ptkag1712/gpt2-based-on-paraSCI_dataset",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "ptkag1712/gpt2-based-on-paraSCI_dataset" \
--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": "ptkag1712/gpt2-based-on-paraSCI_dataset",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ptkag1712/gpt2-based-on-paraSCI_dataset with Docker Model Runner:
docker model run hf.co/ptkag1712/gpt2-based-on-paraSCI_dataset
gpt2-parasciparaphrase
This model is a fine-tuned version of GPT-2 on the ParaSCI dataset for paraphrase generation. It takes a sentence as input and generates a paraphrased version of that sentence.
gpt2)fp16 mixed precisionsentence1 → sentence2)paraphrase this sentence: {sentence1}\n{sentence2}pad_token = eos_tokenwandb)from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("your-username/gpt2-parasciparaphrase")
tokenizer = AutoTokenizer.from_pretrained("your-username/gpt2-parasciparaphrase")
input_text = "paraphrase this sentence: AI models can help in automating tasks.\n"
input_ids = tokenizer.encode(input_text, return_tensors="pt")
output = model.generate(input_ids, max_new_tokens=50, do_sample=True, top_k=50, top_p=0.95)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Base model
openai-community/gpt2