Instructions to use p208p2002/gpt2-large-babi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use p208p2002/gpt2-large-babi with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="p208p2002/gpt2-large-babi")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("p208p2002/gpt2-large-babi") model = AutoModelForCausalLM.from_pretrained("p208p2002/gpt2-large-babi", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use p208p2002/gpt2-large-babi with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "p208p2002/gpt2-large-babi" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "p208p2002/gpt2-large-babi", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/p208p2002/gpt2-large-babi
- SGLang
How to use p208p2002/gpt2-large-babi 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 "p208p2002/gpt2-large-babi" \ --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": "p208p2002/gpt2-large-babi", "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 "p208p2002/gpt2-large-babi" \ --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": "p208p2002/gpt2-large-babi", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use p208p2002/gpt2-large-babi with Docker Model Runner:
docker model run hf.co/p208p2002/gpt2-large-babi
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- facebook/babi_qa
|
| 4 |
+
---
|
| 5 |
+
Fine tune and evaluate transformer model on facebook's bAbi tasks.
|
| 6 |
+
> [Towards AI-Complete Question Answering: A Set of Prerequisite Toy Tasks](https://arxiv.org/abs/1502.05698)
|
| 7 |
+
|
| 8 |
+
Training Code: [p208p2002/bAbi-tasks-with-transformer-model](https://github.com/p208p2002/bAbi-tasks-with-transformer-model)
|
| 9 |
+
|
| 10 |
+
|task_no|task_name |score|
|
| 11 |
+
|-------|----------------------|-----|
|
| 12 |
+
|qa1 |single-supporting-fact|100 |
|
| 13 |
+
|qa2 |two-supporting-facts |99.4 |
|
| 14 |
+
|qa3 |three-supporting-facts|62.0 |
|
| 15 |
+
|qa4 |two-arg-relations |100 |
|
| 16 |
+
|qa5 |three-arg-relations |96.5 |
|
| 17 |
+
|qa6 |yes-no-questions |100 |
|
| 18 |
+
|qa7 |counting |100 |
|
| 19 |
+
|qa8 |lists-sets |99.8 |
|
| 20 |
+
|qa9 |simple-negation |100 |
|
| 21 |
+
|qa10 | indefinite-knowledge |100 |
|
| 22 |
+
|qa11 | basic-coreference |100 |
|
| 23 |
+
|qa12 | conjunction |100 |
|
| 24 |
+
|qa13 | compound-coreference |100 |
|
| 25 |
+
|qa14 | time-reasoning |100 |
|
| 26 |
+
|qa15 | basic-deduction |100 |
|
| 27 |
+
|qa16 | basic-induction |100 |
|
| 28 |
+
|qa17 | positional-reasoning |100 |
|
| 29 |
+
|qa18 | size-reasoning |100 |
|
| 30 |
+
|qa19 | path-finding |100 |
|
| 31 |
+
|qa20 | agents-motivations |100 |
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
# Please use with the follow template
|
| 35 |
+
|
| 36 |
+
INPUT_TEMPLATE = """
|
| 37 |
+
Context:
|
| 38 |
+
{context}
|
| 39 |
+
|
| 40 |
+
Question:
|
| 41 |
+
{question}
|
| 42 |
+
|
| 43 |
+
Answer:
|
| 44 |
+
{answer}
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
input_text = INPUT_TEMPLATE.format_map({
|
| 48 |
+
"context":context,
|
| 49 |
+
"question":question,
|
| 50 |
+
"answer":answer
|
| 51 |
+
}).strip()
|
| 52 |
+
```
|