Instructions to use maxmarcon/gpt2-medium-sarcasm-defuser with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use maxmarcon/gpt2-medium-sarcasm-defuser with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="maxmarcon/gpt2-medium-sarcasm-defuser")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("maxmarcon/gpt2-medium-sarcasm-defuser") model = AutoModelForCausalLM.from_pretrained("maxmarcon/gpt2-medium-sarcasm-defuser", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use maxmarcon/gpt2-medium-sarcasm-defuser with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "maxmarcon/gpt2-medium-sarcasm-defuser" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "maxmarcon/gpt2-medium-sarcasm-defuser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/maxmarcon/gpt2-medium-sarcasm-defuser
- SGLang
How to use maxmarcon/gpt2-medium-sarcasm-defuser 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 "maxmarcon/gpt2-medium-sarcasm-defuser" \ --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": "maxmarcon/gpt2-medium-sarcasm-defuser", "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 "maxmarcon/gpt2-medium-sarcasm-defuser" \ --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": "maxmarcon/gpt2-medium-sarcasm-defuser", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use maxmarcon/gpt2-medium-sarcasm-defuser with Docker Model Runner:
docker model run hf.co/maxmarcon/gpt2-medium-sarcasm-defuser
Update README.md
Browse files
README.md
CHANGED
|
@@ -1527,197 +1527,40 @@ model-index:
|
|
| 1527 |
name: kaggle
|
| 1528 |
---
|
| 1529 |
|
| 1530 |
-
#
|
| 1531 |
|
| 1532 |
-
|
| 1533 |
|
| 1534 |
|
|
|
|
| 1535 |
|
| 1536 |
-
|
|
|
|
|
|
|
|
|
|
| 1537 |
|
| 1538 |
-
|
| 1539 |
|
| 1540 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 1541 |
|
| 1542 |
-
|
| 1543 |
|
| 1544 |
-
|
| 1545 |
-
|
| 1546 |
-
|
| 1547 |
-
- **Model type:** [More Information Needed]
|
| 1548 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 1549 |
-
- **License:** [More Information Needed]
|
| 1550 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 1551 |
|
| 1552 |
-
|
|
|
|
| 1553 |
|
| 1554 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1555 |
|
| 1556 |
-
|
| 1557 |
-
|
| 1558 |
-
- **Demo [optional]:** [More Information Needed]
|
| 1559 |
|
| 1560 |
-
## Uses
|
| 1561 |
|
| 1562 |
-
|
| 1563 |
|
| 1564 |
-
|
| 1565 |
-
|
| 1566 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 1567 |
-
|
| 1568 |
-
[More Information Needed]
|
| 1569 |
-
|
| 1570 |
-
### Downstream Use [optional]
|
| 1571 |
-
|
| 1572 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 1573 |
-
|
| 1574 |
-
[More Information Needed]
|
| 1575 |
-
|
| 1576 |
-
### Out-of-Scope Use
|
| 1577 |
-
|
| 1578 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 1579 |
-
|
| 1580 |
-
[More Information Needed]
|
| 1581 |
-
|
| 1582 |
-
## Bias, Risks, and Limitations
|
| 1583 |
-
|
| 1584 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 1585 |
-
|
| 1586 |
-
[More Information Needed]
|
| 1587 |
-
|
| 1588 |
-
### Recommendations
|
| 1589 |
-
|
| 1590 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 1591 |
-
|
| 1592 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 1593 |
-
|
| 1594 |
-
## How to Get Started with the Model
|
| 1595 |
-
|
| 1596 |
-
Use the code below to get started with the model.
|
| 1597 |
-
|
| 1598 |
-
[More Information Needed]
|
| 1599 |
-
|
| 1600 |
-
## Training Details
|
| 1601 |
-
|
| 1602 |
-
### Training Data
|
| 1603 |
-
|
| 1604 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 1605 |
-
|
| 1606 |
-
[More Information Needed]
|
| 1607 |
-
|
| 1608 |
-
### Training Procedure
|
| 1609 |
-
|
| 1610 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 1611 |
-
|
| 1612 |
-
#### Preprocessing [optional]
|
| 1613 |
-
|
| 1614 |
-
[More Information Needed]
|
| 1615 |
-
|
| 1616 |
-
|
| 1617 |
-
#### Training Hyperparameters
|
| 1618 |
-
|
| 1619 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 1620 |
-
|
| 1621 |
-
#### Speeds, Sizes, Times [optional]
|
| 1622 |
-
|
| 1623 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 1624 |
-
|
| 1625 |
-
[More Information Needed]
|
| 1626 |
-
|
| 1627 |
-
## Evaluation
|
| 1628 |
-
|
| 1629 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 1630 |
-
|
| 1631 |
-
### Testing Data, Factors & Metrics
|
| 1632 |
-
|
| 1633 |
-
#### Testing Data
|
| 1634 |
-
|
| 1635 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 1636 |
-
|
| 1637 |
-
[More Information Needed]
|
| 1638 |
-
|
| 1639 |
-
#### Factors
|
| 1640 |
-
|
| 1641 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 1642 |
-
|
| 1643 |
-
[More Information Needed]
|
| 1644 |
-
|
| 1645 |
-
#### Metrics
|
| 1646 |
-
|
| 1647 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 1648 |
-
|
| 1649 |
-
[More Information Needed]
|
| 1650 |
-
|
| 1651 |
-
### Results
|
| 1652 |
-
|
| 1653 |
-
[More Information Needed]
|
| 1654 |
-
|
| 1655 |
-
#### Summary
|
| 1656 |
-
|
| 1657 |
-
|
| 1658 |
-
|
| 1659 |
-
## Model Examination [optional]
|
| 1660 |
-
|
| 1661 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 1662 |
-
|
| 1663 |
-
[More Information Needed]
|
| 1664 |
-
|
| 1665 |
-
## Environmental Impact
|
| 1666 |
-
|
| 1667 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 1668 |
-
|
| 1669 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 1670 |
-
|
| 1671 |
-
- **Hardware Type:** [More Information Needed]
|
| 1672 |
-
- **Hours used:** [More Information Needed]
|
| 1673 |
-
- **Cloud Provider:** [More Information Needed]
|
| 1674 |
-
- **Compute Region:** [More Information Needed]
|
| 1675 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 1676 |
-
|
| 1677 |
-
## Technical Specifications [optional]
|
| 1678 |
-
|
| 1679 |
-
### Model Architecture and Objective
|
| 1680 |
-
|
| 1681 |
-
[More Information Needed]
|
| 1682 |
-
|
| 1683 |
-
### Compute Infrastructure
|
| 1684 |
-
|
| 1685 |
-
[More Information Needed]
|
| 1686 |
-
|
| 1687 |
-
#### Hardware
|
| 1688 |
-
|
| 1689 |
-
[More Information Needed]
|
| 1690 |
-
|
| 1691 |
-
#### Software
|
| 1692 |
-
|
| 1693 |
-
[More Information Needed]
|
| 1694 |
-
|
| 1695 |
-
## Citation [optional]
|
| 1696 |
-
|
| 1697 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 1698 |
-
|
| 1699 |
-
**BibTeX:**
|
| 1700 |
-
|
| 1701 |
-
[More Information Needed]
|
| 1702 |
-
|
| 1703 |
-
**APA:**
|
| 1704 |
-
|
| 1705 |
-
[More Information Needed]
|
| 1706 |
-
|
| 1707 |
-
## Glossary [optional]
|
| 1708 |
-
|
| 1709 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 1710 |
-
|
| 1711 |
-
[More Information Needed]
|
| 1712 |
-
|
| 1713 |
-
## More Information [optional]
|
| 1714 |
-
|
| 1715 |
-
[More Information Needed]
|
| 1716 |
-
|
| 1717 |
-
## Model Card Authors [optional]
|
| 1718 |
-
|
| 1719 |
-
[More Information Needed]
|
| 1720 |
-
|
| 1721 |
-
## Model Card Contact
|
| 1722 |
-
|
| 1723 |
-
[More Information Needed]
|
|
|
|
| 1527 |
name: kaggle
|
| 1528 |
---
|
| 1529 |
|
| 1530 |
+
# GP2 Sarcasm Defuser
|
| 1531 |
|
| 1532 |
+
## Description
|
| 1533 |
|
| 1534 |
|
| 1535 |
+
GPT-2 model (medium 0.4B parameters) fine-tuned to defues sarcasm. Example:
|
| 1536 |
|
| 1537 |
+
```
|
| 1538 |
+
Prompt: So glad investment bankers and hedge funds make so much on the low wages these guys get.<|BOS|>
|
| 1539 |
+
Generated after prompt: It's concerning that investment bankers and hedge funds are making so much on the low wages these workers receive.
|
| 1540 |
+
```
|
| 1541 |
|
| 1542 |
+
(The model use the special `<|BOS|>` token as a marker for where the generated, defuse comment should start).
|
| 1543 |
|
|
|
|
| 1544 |
|
| 1545 |
+
## Training and Evaluation
|
| 1546 |
|
| 1547 |
+
The model has been trained on ~4500 sarcastic comments from the [Sarcasm on Reddit](https://www.kaggle.com/datasets/danofer/sarcasm/data) Kaggle dataset. The dataset includes
|
| 1548 |
+
a selection of comments from Reddit that were marked as sarcastic by the author of the comment.
|
| 1549 |
+
Another ~500 comments have been used to test the trained model's performance.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1550 |
|
| 1551 |
+
In order to teach the model what a defused, not sarcastic comment looks like, we used a more powerful LLM to generate defused comments for the Kaggle dataset.
|
| 1552 |
+
We used the [gemma-3-12b-it](https://ai.google.dev/gemma/docs/core) model with 12B parameters and we queried via the Google API with the following prompt for each comment:
|
| 1553 |
|
| 1554 |
+
```
|
| 1555 |
+
given this sarcastic comment: <SARCASTIC_COMMENT>,
|
| 1556 |
+
which is a response to this other comment: <CONTEXT>,
|
| 1557 |
+
remove all the sarcasm from it while keeping the original meaning. Don't output anything else, and don't try to describe the comment in the third person",
|
| 1558 |
+
```
|
| 1559 |
|
| 1560 |
+
where `<SARCASTIC_COMMENT>` is the sarcastic comment from the Kaggle dataset and `<CONTEXT>` is the comment that preceded the sarcstic comment (this comment was also
|
| 1561 |
+
available as part of the Kaggle dataset). This gives the LLM additional information on how to "translate" the sarcastic comment into a "normal" one.
|
|
|
|
| 1562 |
|
|
|
|
| 1563 |
|
| 1564 |
+
## How to use
|
| 1565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