CShorten/ML-ArXiv-Papers
Viewer • Updated • 118k • 3.11k • 64
How to use suarkadipa/GPT-2-finetuned-papers with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="suarkadipa/GPT-2-finetuned-papers") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("suarkadipa/GPT-2-finetuned-papers")
model = AutoModelForCausalLM.from_pretrained("suarkadipa/GPT-2-finetuned-papers")How to use suarkadipa/GPT-2-finetuned-papers with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "suarkadipa/GPT-2-finetuned-papers"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "suarkadipa/GPT-2-finetuned-papers",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/suarkadipa/GPT-2-finetuned-papers
How to use suarkadipa/GPT-2-finetuned-papers with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "suarkadipa/GPT-2-finetuned-papers" \
--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": "suarkadipa/GPT-2-finetuned-papers",
"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 "suarkadipa/GPT-2-finetuned-papers" \
--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": "suarkadipa/GPT-2-finetuned-papers",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use suarkadipa/GPT-2-finetuned-papers with Docker Model Runner:
docker model run hf.co/suarkadipa/GPT-2-finetuned-papers
This model is a fine-tuned version of distilgpt2 on an CShorten/ML-ArXiv-Papers dataset. Based on https://python.plainenglish.io/i-fine-tuned-gpt-2-on-100k-scientific-papers-heres-the-result-903f0784fe65 It achieves the following results on the evaluation set:
More information needed
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer_fromhub = AutoTokenizer.from_pretrained("suarkadipa/GPT-2-finetuned-papers")
model_fromhub = AutoModelForCausalLM.from_pretrained("suarkadipa/GPT-2-finetuned-papers", from_tf=True)
text_generator = pipeline(
"text-generation",
model=model_fromhub,
tokenizer=tokenizer_fromhub,
framework="tf",
max_new_tokens=3000
)
// change with your text
test_sentence = "the role of recommender systems"
res=text_generator(test_sentence)[0]["generated_text"].replace("\n", " ")
res
More information needed
The following hyperparameters were used during training:
| Train Loss | Validation Loss | Epoch |
|---|---|---|
| 2.4225 | 2.2164 | 0 |
Base model
distilbert/distilgpt2