@huggingface/tasks 0.13.1-test β 0.13.1-test2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/src/dataset-libraries.ts +89 -0
- package/src/default-widget-inputs.ts +718 -0
- package/src/gguf.ts +40 -0
- package/src/hardware.ts +482 -0
- package/src/index.ts +59 -0
- package/src/library-to-tasks.ts +76 -0
- package/src/local-apps.ts +412 -0
- package/src/model-data.ts +149 -0
- package/src/model-libraries-downloads.ts +18 -0
- package/src/model-libraries-snippets.ts +1128 -0
- package/src/model-libraries.ts +820 -0
- package/src/pipelines.ts +698 -0
- package/src/snippets/common.ts +39 -0
- package/src/snippets/curl.spec.ts +94 -0
- package/src/snippets/curl.ts +120 -0
- package/src/snippets/index.ts +7 -0
- package/src/snippets/inputs.ts +167 -0
- package/src/snippets/js.spec.ts +148 -0
- package/src/snippets/js.ts +305 -0
- package/src/snippets/python.spec.ts +144 -0
- package/src/snippets/python.ts +321 -0
- package/src/snippets/types.ts +16 -0
- package/src/tasks/audio-classification/about.md +86 -0
- package/src/tasks/audio-classification/data.ts +81 -0
- package/src/tasks/audio-classification/inference.ts +52 -0
- package/src/tasks/audio-classification/spec/input.json +35 -0
- package/src/tasks/audio-classification/spec/output.json +11 -0
- package/src/tasks/audio-to-audio/about.md +56 -0
- package/src/tasks/audio-to-audio/data.ts +70 -0
- package/src/tasks/automatic-speech-recognition/about.md +90 -0
- package/src/tasks/automatic-speech-recognition/data.ts +82 -0
- package/src/tasks/automatic-speech-recognition/inference.ts +160 -0
- package/src/tasks/automatic-speech-recognition/spec/input.json +35 -0
- package/src/tasks/automatic-speech-recognition/spec/output.json +38 -0
- package/src/tasks/chat-completion/inference.ts +322 -0
- package/src/tasks/chat-completion/spec/input.json +350 -0
- package/src/tasks/chat-completion/spec/output.json +206 -0
- package/src/tasks/chat-completion/spec/stream_output.json +213 -0
- package/src/tasks/common-definitions.json +100 -0
- package/src/tasks/depth-estimation/about.md +45 -0
- package/src/tasks/depth-estimation/data.ts +70 -0
- package/src/tasks/depth-estimation/inference.ts +35 -0
- package/src/tasks/depth-estimation/spec/input.json +25 -0
- package/src/tasks/depth-estimation/spec/output.json +16 -0
- package/src/tasks/document-question-answering/about.md +53 -0
- package/src/tasks/document-question-answering/data.ts +85 -0
- package/src/tasks/document-question-answering/inference.ts +110 -0
- package/src/tasks/document-question-answering/spec/input.json +85 -0
- package/src/tasks/document-question-answering/spec/output.json +36 -0
- package/src/tasks/feature-extraction/about.md +72 -0
- package/src/tasks/feature-extraction/data.ts +57 -0
- package/src/tasks/feature-extraction/inference.ts +40 -0
- package/src/tasks/feature-extraction/spec/input.json +47 -0
- package/src/tasks/feature-extraction/spec/output.json +15 -0
- package/src/tasks/fill-mask/about.md +51 -0
- package/src/tasks/fill-mask/data.ts +79 -0
- package/src/tasks/fill-mask/inference.ts +62 -0
- package/src/tasks/fill-mask/spec/input.json +38 -0
- package/src/tasks/fill-mask/spec/output.json +29 -0
- package/src/tasks/image-classification/about.md +50 -0
- package/src/tasks/image-classification/data.ts +88 -0
- package/src/tasks/image-classification/inference.ts +52 -0
- package/src/tasks/image-classification/spec/input.json +35 -0
- package/src/tasks/image-classification/spec/output.json +11 -0
- package/src/tasks/image-feature-extraction/about.md +23 -0
- package/src/tasks/image-feature-extraction/data.ts +59 -0
- package/src/tasks/image-segmentation/about.md +63 -0
- package/src/tasks/image-segmentation/data.ts +99 -0
- package/src/tasks/image-segmentation/inference.ts +69 -0
- package/src/tasks/image-segmentation/spec/input.json +45 -0
- package/src/tasks/image-segmentation/spec/output.json +26 -0
- package/src/tasks/image-text-to-text/about.md +76 -0
- package/src/tasks/image-text-to-text/data.ts +102 -0
- package/src/tasks/image-to-3d/about.md +62 -0
- package/src/tasks/image-to-3d/data.ts +75 -0
- package/src/tasks/image-to-image/about.md +129 -0
- package/src/tasks/image-to-image/data.ts +101 -0
- package/src/tasks/image-to-image/inference.ts +68 -0
- package/src/tasks/image-to-image/spec/input.json +55 -0
- package/src/tasks/image-to-image/spec/output.json +12 -0
- package/src/tasks/image-to-text/about.md +61 -0
- package/src/tasks/image-to-text/data.ts +82 -0
- package/src/tasks/image-to-text/inference.ts +143 -0
- package/src/tasks/image-to-text/spec/input.json +34 -0
- package/src/tasks/image-to-text/spec/output.json +14 -0
- package/src/tasks/index.ts +312 -0
- package/src/tasks/keypoint-detection/about.md +57 -0
- package/src/tasks/keypoint-detection/data.ts +50 -0
- package/src/tasks/mask-generation/about.md +65 -0
- package/src/tasks/mask-generation/data.ts +55 -0
- package/src/tasks/object-detection/about.md +37 -0
- package/src/tasks/object-detection/data.ts +86 -0
- package/src/tasks/object-detection/inference.ts +75 -0
- package/src/tasks/object-detection/spec/input.json +31 -0
- package/src/tasks/object-detection/spec/output.json +50 -0
- package/src/tasks/placeholder/about.md +15 -0
- package/src/tasks/placeholder/data.ts +21 -0
- package/src/tasks/placeholder/spec/input.json +35 -0
- package/src/tasks/placeholder/spec/output.json +17 -0
- package/src/tasks/question-answering/about.md +56 -0
- package/src/tasks/question-answering/data.ts +75 -0
- package/src/tasks/question-answering/inference.ts +99 -0
- package/src/tasks/question-answering/spec/input.json +67 -0
- package/src/tasks/question-answering/spec/output.json +29 -0
- package/src/tasks/reinforcement-learning/about.md +167 -0
- package/src/tasks/reinforcement-learning/data.ts +75 -0
- package/src/tasks/sentence-similarity/about.md +97 -0
- package/src/tasks/sentence-similarity/data.ts +101 -0
- package/src/tasks/sentence-similarity/inference.ts +32 -0
- package/src/tasks/sentence-similarity/spec/input.json +40 -0
- package/src/tasks/sentence-similarity/spec/output.json +12 -0
- package/src/tasks/summarization/about.md +58 -0
- package/src/tasks/summarization/data.ts +76 -0
- package/src/tasks/summarization/inference.ts +57 -0
- package/src/tasks/summarization/spec/input.json +42 -0
- package/src/tasks/summarization/spec/output.json +14 -0
- package/src/tasks/table-question-answering/about.md +43 -0
- package/src/tasks/table-question-answering/data.ts +59 -0
- package/src/tasks/table-question-answering/inference.ts +61 -0
- package/src/tasks/table-question-answering/spec/input.json +44 -0
- package/src/tasks/table-question-answering/spec/output.json +40 -0
- package/src/tasks/tabular-classification/about.md +65 -0
- package/src/tasks/tabular-classification/data.ts +68 -0
- package/src/tasks/tabular-regression/about.md +87 -0
- package/src/tasks/tabular-regression/data.ts +57 -0
- package/src/tasks/text-classification/about.md +173 -0
- package/src/tasks/text-classification/data.ts +103 -0
- package/src/tasks/text-classification/inference.ts +51 -0
- package/src/tasks/text-classification/spec/input.json +35 -0
- package/src/tasks/text-classification/spec/output.json +11 -0
- package/src/tasks/text-generation/about.md +154 -0
- package/src/tasks/text-generation/data.ts +114 -0
- package/src/tasks/text-generation/inference.ts +200 -0
- package/src/tasks/text-generation/spec/input.json +219 -0
- package/src/tasks/text-generation/spec/output.json +179 -0
- package/src/tasks/text-generation/spec/stream_output.json +103 -0
- package/src/tasks/text-to-3d/about.md +62 -0
- package/src/tasks/text-to-3d/data.ts +56 -0
- package/src/tasks/text-to-audio/inference.ts +143 -0
- package/src/tasks/text-to-audio/spec/input.json +31 -0
- package/src/tasks/text-to-audio/spec/output.json +17 -0
- package/src/tasks/text-to-image/about.md +96 -0
- package/src/tasks/text-to-image/data.ts +100 -0
- package/src/tasks/text-to-image/inference.ts +75 -0
- package/src/tasks/text-to-image/spec/input.json +63 -0
- package/src/tasks/text-to-image/spec/output.json +13 -0
- package/src/tasks/text-to-speech/about.md +63 -0
- package/src/tasks/text-to-speech/data.ts +79 -0
- package/src/tasks/text-to-speech/inference.ts +145 -0
- package/src/tasks/text-to-speech/spec/input.json +31 -0
- package/src/tasks/text-to-speech/spec/output.json +7 -0
- package/src/tasks/text-to-video/about.md +41 -0
- package/src/tasks/text-to-video/data.ts +102 -0
- package/src/tasks/text2text-generation/inference.ts +55 -0
- package/src/tasks/text2text-generation/spec/input.json +55 -0
- package/src/tasks/text2text-generation/spec/output.json +14 -0
- package/src/tasks/token-classification/about.md +76 -0
- package/src/tasks/token-classification/data.ts +92 -0
- package/src/tasks/token-classification/inference.ts +85 -0
- package/src/tasks/token-classification/spec/input.json +65 -0
- package/src/tasks/token-classification/spec/output.json +37 -0
- package/src/tasks/translation/about.md +65 -0
- package/src/tasks/translation/data.ts +70 -0
- package/src/tasks/translation/inference.ts +67 -0
- package/src/tasks/translation/spec/input.json +50 -0
- package/src/tasks/translation/spec/output.json +14 -0
- package/src/tasks/unconditional-image-generation/about.md +50 -0
- package/src/tasks/unconditional-image-generation/data.ts +72 -0
- package/src/tasks/video-classification/about.md +37 -0
- package/src/tasks/video-classification/data.ts +84 -0
- package/src/tasks/video-classification/inference.ts +59 -0
- package/src/tasks/video-classification/spec/input.json +42 -0
- package/src/tasks/video-classification/spec/output.json +10 -0
- package/src/tasks/video-text-to-text/about.md +98 -0
- package/src/tasks/video-text-to-text/data.ts +66 -0
- package/src/tasks/visual-question-answering/about.md +48 -0
- package/src/tasks/visual-question-answering/data.ts +97 -0
- package/src/tasks/visual-question-answering/inference.ts +62 -0
- package/src/tasks/visual-question-answering/spec/input.json +41 -0
- package/src/tasks/visual-question-answering/spec/output.json +21 -0
- package/src/tasks/zero-shot-classification/about.md +40 -0
- package/src/tasks/zero-shot-classification/data.ts +70 -0
- package/src/tasks/zero-shot-classification/inference.ts +67 -0
- package/src/tasks/zero-shot-classification/spec/input.json +50 -0
- package/src/tasks/zero-shot-classification/spec/output.json +11 -0
- package/src/tasks/zero-shot-image-classification/about.md +75 -0
- package/src/tasks/zero-shot-image-classification/data.ts +84 -0
- package/src/tasks/zero-shot-image-classification/inference.ts +61 -0
- package/src/tasks/zero-shot-image-classification/spec/input.json +45 -0
- package/src/tasks/zero-shot-image-classification/spec/output.json +10 -0
- package/src/tasks/zero-shot-object-detection/about.md +45 -0
- package/src/tasks/zero-shot-object-detection/data.ts +67 -0
- package/src/tasks/zero-shot-object-detection/inference.ts +66 -0
- package/src/tasks/zero-shot-object-detection/spec/input.json +40 -0
- package/src/tasks/zero-shot-object-detection/spec/output.json +47 -0
- package/src/tokenizer-data.ts +32 -0
- package/src/widget-example.ts +125 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
## Use Cases
|
|
2
|
+
|
|
3
|
+
### Gaming
|
|
4
|
+
|
|
5
|
+
Reinforcement learning is known for its application to video games. Since the games provide a safe environment for the agent to be trained in the sense that it is perfectly defined and controllable, this makes them perfect candidates for experimentation and will help a lot to learn about the capabilities and limitations of various RL algorithms.
|
|
6
|
+
|
|
7
|
+
There are many videos on the Internet where a game-playing reinforcement learning agent starts with a terrible gaming strategy due to random initialization of its settings, but over iterations, the agent gets better and better with each episode of the training. This [paper](https://arxiv.org/abs/1912.10944) mainly investigates the performance of RL in popular games such as Minecraft or Dota2. The agent's performance can exceed a human player's, although there are still some challenges mainly related to efficiency in constructing the gaming policy of the reinforcement learning agent.
|
|
8
|
+
|
|
9
|
+
### Trading and Finance
|
|
10
|
+
|
|
11
|
+
Reinforcement learning is the science to train computers to make decisions and thus has a novel use in trading and finance. All time-series models are helpful in predicting prices, volume and future sales of a product or a stock. Reinforcement based automated agents can decide to sell, buy or hold a stock. It shifts the impact of AI in this field to real time decision making rather than just prediction of prices. The glossary given below will clear some parameters to as to how we can train a model to take these decisions.
|
|
12
|
+
|
|
13
|
+
## Task Variants
|
|
14
|
+
|
|
15
|
+
### Model Based RL
|
|
16
|
+
|
|
17
|
+
In model based reinforcement learning techniques intend to create a model of the environment, learn the state transition probabilities and the reward function, to find the optimal action. Some typical examples for model based reinforcement learning algorithms are dynamic programming, value iteration and policy iteration.
|
|
18
|
+
|
|
19
|
+
### Model Free RL
|
|
20
|
+
|
|
21
|
+
In model free reinforcement learning, agent decides on optimal actions based on its experience in the environment and the reward it collects from it. This is one of the most commonly used algorithms beneficial in complex environments, where modeling of state transition probabilities and reward functions are difficult. Some of the examples of model free reinforcement learning are SARSA, Q-Learning, actor-critic and proximal policy optimization (PPO) algorithms.
|
|
22
|
+
|
|
23
|
+
## Glossary
|
|
24
|
+
|
|
25
|
+
<!--  TODO: Uncomment image for visual understanding if it fits within the page-->
|
|
26
|
+
|
|
27
|
+
**Agent:** The learner and the decision maker.
|
|
28
|
+
|
|
29
|
+
**Environment:** The part of the world the agent interacts, comprising everything outside the agent.
|
|
30
|
+
|
|
31
|
+
Observations and states are the information our agent gets from the environment. In the case of a video game, it can be a frame (a screenshot). In the case of the trading agent, it can be the value of a certain stock.
|
|
32
|
+
|
|
33
|
+
**State:** Complete description of the state of the environment with no hidden information.
|
|
34
|
+
|
|
35
|
+
**Observation:** Partial description of the state, in a partially observed environment.
|
|
36
|
+
|
|
37
|
+
**Action:** The decision taken by the agent.
|
|
38
|
+
|
|
39
|
+
**Reward:** The numerical feedback signal that the agent receives from the environment based on the chosen action.
|
|
40
|
+
|
|
41
|
+
**Return:** Cumulative Reward. In the simplest case, the return is the sum of the rewards.
|
|
42
|
+
|
|
43
|
+
**Episode:** For some applications there is a natural notion of final time step. In this case, there is a starting point and an ending point (a terminal state). This creates an episode: a list of States, Actions, Rewards, and new States. For instance, think about Chess: an episode begins at the initial board position and ends when the game is over.
|
|
44
|
+
|
|
45
|
+
**Policy:** The Policy is the brain of the Agent, itβs the function that tells what action to take given the state. So it defines the agentβs behavior at a given time. Reinforcement learning methods specify how the agentβs policy is changed as a result of its experience.
|
|
46
|
+
|
|
47
|
+
##Β Inference
|
|
48
|
+
|
|
49
|
+
Inference in reinforcement learning differs from other modalities, in which there's a model and test data. In reinforcement learning, once you have trained an agent in an environment, you try to run the trained agent for additional steps to get the average reward.
|
|
50
|
+
|
|
51
|
+
A typical training cycle consists of gathering experience from the environment, training the agent, and running the agent on a test environment to obtain average reward. Below there's a snippet on how you can interact with the environment using the `gymnasium` library, train an agent using `stable-baselines3`, evalute the agent on test environment and infer actions from the trained agent.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
# Here we are running 20 episodes of CartPole-v1 environment, taking random actions
|
|
55
|
+
import gymnasium as gym
|
|
56
|
+
|
|
57
|
+
env = gym.make("CartPole-v1")
|
|
58
|
+
observation, info = env.reset()
|
|
59
|
+
|
|
60
|
+
for _ in range(20):
|
|
61
|
+
action = env.action_space.sample() # samples random action from action sample space
|
|
62
|
+
|
|
63
|
+
# the agent takes the action
|
|
64
|
+
observation, reward, terminated, truncated, info = env.step(action)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# if the agent reaches terminal state, we reset the environment
|
|
68
|
+
if terminated or truncated:
|
|
69
|
+
|
|
70
|
+
print("Environment is reset")
|
|
71
|
+
observation = env.reset()
|
|
72
|
+
|
|
73
|
+
env.close()
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Below snippet shows how to train a PPO model on LunarLander-v2 environment using `stable-baselines3` library and saving the model
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from stable_baselines3 import PPO
|
|
80
|
+
|
|
81
|
+
# initialize the environment
|
|
82
|
+
|
|
83
|
+
env = gym.make("LunarLander-v2")
|
|
84
|
+
|
|
85
|
+
# initialize the model
|
|
86
|
+
|
|
87
|
+
model = PPO(policy = "MlpPolicy",
|
|
88
|
+
env = env,
|
|
89
|
+
n_steps = 1024,
|
|
90
|
+
batch_size = 64,
|
|
91
|
+
n_epochs = 4,
|
|
92
|
+
verbose = 1)
|
|
93
|
+
|
|
94
|
+
# train the model for 1000 time steps
|
|
95
|
+
model.learn(total_timesteps = 1000)
|
|
96
|
+
|
|
97
|
+
# Saving the model in desired directory
|
|
98
|
+
model_name = "PPO-LunarLander-v2"
|
|
99
|
+
model.save(model_name)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Below code shows how to evaluate an agent trained using `stable-baselines3`
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
# Loading a saved model and evaluating the model for 10 episodes
|
|
106
|
+
from stable_baselines3.common.evaluation import evaluate_policy
|
|
107
|
+
from stable_baselines3 import PPO
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
env = gym.make("LunarLander-v2")
|
|
111
|
+
# Loading the saved model
|
|
112
|
+
model = PPO.load("PPO-LunarLander-v2",env=env)
|
|
113
|
+
|
|
114
|
+
# Initializating the evaluation environment
|
|
115
|
+
eval_env = gym.make("LunarLander-v2")
|
|
116
|
+
|
|
117
|
+
# Running the trained agent on eval_env for 10 time steps and getting the mean reward
|
|
118
|
+
mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes = 10,
|
|
119
|
+
deterministic=True)
|
|
120
|
+
|
|
121
|
+
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Below code snippet shows how to infer actions from an agent trained using `stable-baselines3`
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from stable_baselines3.common.evaluation import evaluate_policy
|
|
128
|
+
from stable_baselines3 import PPO
|
|
129
|
+
|
|
130
|
+
# Loading the saved model
|
|
131
|
+
model = PPO.load("PPO-LunarLander-v2",env=env)
|
|
132
|
+
|
|
133
|
+
# Getting the environment from the trained agent
|
|
134
|
+
env = model.get_env()
|
|
135
|
+
|
|
136
|
+
obs = env.reset()
|
|
137
|
+
for i in range(1000):
|
|
138
|
+
# getting action predictions from the trained agent
|
|
139
|
+
action, _states = model.predict(obs, deterministic=True)
|
|
140
|
+
|
|
141
|
+
# taking the predicted action in the environment to observe next state and rewards
|
|
142
|
+
obs, rewards, dones, info = env.step(action)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
For more information, you can check out the documentations of the respective libraries.
|
|
146
|
+
|
|
147
|
+
[Gymnasium Documentation](https://gymnasium.farama.org/)
|
|
148
|
+
[Stable Baselines Documentation](https://stable-baselines3.readthedocs.io/en/master/)
|
|
149
|
+
|
|
150
|
+
##Β Useful Resources
|
|
151
|
+
|
|
152
|
+
Would you like to learn more about the topic? Awesome! Here you can find some curated resources that you may find helpful!
|
|
153
|
+
|
|
154
|
+
- [HuggingFace Deep Reinforcement Learning Class](https://github.com/huggingface/deep-rl-class)
|
|
155
|
+
- [Introduction to Deep Reinforcement Learning](https://huggingface.co/blog/deep-rl-intro)
|
|
156
|
+
- [Stable Baselines Integration with HuggingFace](https://huggingface.co/blog/sb3)
|
|
157
|
+
- Learn how reinforcement learning is used in conversational agents in this blog: [Illustrating Reinforcement Learning from Human Feedback (RLHF)](https://huggingface.co/blog/rlhf)
|
|
158
|
+
- [Reinforcement Learning from Human Feedback From Zero to ChatGPT](https://www.youtube.com/watch?v=EAd4oQtEJOM)
|
|
159
|
+
- [Guide on Multi-Agent Competition Systems](https://huggingface.co/blog/aivsai)
|
|
160
|
+
|
|
161
|
+
### Notebooks
|
|
162
|
+
|
|
163
|
+
- [Train a Deep Reinforcement Learning lander agent to land correctly on the Moon π using Stable-Baselines3](https://github.com/huggingface/deep-rl-class/blob/main/notebooks/unit1/unit1.ipynb)
|
|
164
|
+
- [Introduction to Unity MLAgents](https://github.com/huggingface/deep-rl-class/blob/main/notebooks/unit5/unit5.ipynb)
|
|
165
|
+
- [Training Decision Transformers with π€ transformers](https://github.com/huggingface/blog/blob/main/notebooks/101_train-decision-transformers.ipynb)
|
|
166
|
+
|
|
167
|
+
This page was made possible thanks to the efforts of [Ram Ananth](https://huggingface.co/RamAnanth1), [Emilio Lehoucq](https://huggingface.co/emiliol), [Sagar Mathpal](https://huggingface.co/sagarmathpal) and [Osman Alenbey](https://huggingface.co/osman93).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { TaskDataCustom } from "../index.js";
|
|
2
|
+
|
|
3
|
+
const taskData: TaskDataCustom = {
|
|
4
|
+
datasets: [
|
|
5
|
+
{
|
|
6
|
+
description: "A curation of widely used datasets for Data Driven Deep Reinforcement Learning (D4RL)",
|
|
7
|
+
id: "edbeeching/decision_transformer_gym_replay",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
demo: {
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
label: "State",
|
|
14
|
+
content: "Red traffic light, pedestrians are about to pass.",
|
|
15
|
+
type: "text",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
outputs: [
|
|
19
|
+
{
|
|
20
|
+
label: "Action",
|
|
21
|
+
content: "Stop the car.",
|
|
22
|
+
type: "text",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "Next State",
|
|
26
|
+
content: "Yellow light, pedestrians have crossed.",
|
|
27
|
+
type: "text",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
metrics: [
|
|
32
|
+
{
|
|
33
|
+
description:
|
|
34
|
+
"Accumulated reward across all time steps discounted by a factor that ranges between 0 and 1 and determines how much the agent optimizes for future relative to immediate rewards. Measures how good is the policy ultimately found by a given algorithm considering uncertainty over the future.",
|
|
35
|
+
id: "Discounted Total Reward",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
description:
|
|
39
|
+
"Average return obtained after running the policy for a certain number of evaluation episodes. As opposed to total reward, mean reward considers how much reward a given algorithm receives while learning.",
|
|
40
|
+
id: "Mean Reward",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
description:
|
|
44
|
+
"Measures how good a given algorithm is after a predefined time. Some algorithms may be guaranteed to converge to optimal behavior across many time steps. However, an agent that reaches an acceptable level of optimality after a given time horizon may be preferable to one that ultimately reaches optimality but takes a long time.",
|
|
45
|
+
id: "Level of Performance After Some Time",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
models: [
|
|
49
|
+
{
|
|
50
|
+
description: "A Reinforcement Learning model trained on expert data from the Gym Hopper environment",
|
|
51
|
+
|
|
52
|
+
id: "edbeeching/decision-transformer-gym-hopper-expert",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
description: "A PPO agent playing seals/CartPole-v0 using the stable-baselines3 library and the RL Zoo.",
|
|
56
|
+
id: "HumanCompatibleAI/ppo-seals-CartPole-v0",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
spaces: [
|
|
60
|
+
{
|
|
61
|
+
description: "An application for a cute puppy agent learning to catch a stick.",
|
|
62
|
+
id: "ThomasSimonini/Huggy",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
description: "An application to play Snowball Fight with a reinforcement learning agent.",
|
|
66
|
+
id: "ThomasSimonini/SnowballFight",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
summary:
|
|
70
|
+
"Reinforcement learning is the computational approach of learning from action by interacting with an environment through trial and error and receiving rewards (negative or positive) as feedback",
|
|
71
|
+
widgetModels: [],
|
|
72
|
+
youtubeId: "q0BiUn5LiBc",
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default taskData;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
## Use Cases π
|
|
2
|
+
|
|
3
|
+
### Information Retrieval
|
|
4
|
+
|
|
5
|
+
You can extract information from documents using Sentence Similarity models. The first step is to rank documents using Passage Ranking models. You can then get to the top ranked document and search it with Sentence Similarity models by selecting the sentence that has the most similarity to the input query.
|
|
6
|
+
|
|
7
|
+
## The Sentence Transformers library
|
|
8
|
+
|
|
9
|
+
The [Sentence Transformers](https://www.sbert.net/) library is very powerful for calculating embeddings of sentences, paragraphs, and entire documents. An embedding is just a vector representation of a text and is useful for finding how similar two texts are.
|
|
10
|
+
|
|
11
|
+
You can find and use [hundreds of Sentence Transformers](https://huggingface.co/models?library=sentence-transformers&sort=downloads) models from the Hub by directly using the library, playing with the widgets in the browser or using Inference Endpoints.
|
|
12
|
+
|
|
13
|
+
## Task Variants
|
|
14
|
+
|
|
15
|
+
### Passage Ranking
|
|
16
|
+
|
|
17
|
+
Passage Ranking is the task of ranking documents based on their relevance to a given query. The task is evaluated on Mean Reciprocal Rank. These models take one query and multiple documents and return ranked documents according to the relevancy to the query. π
|
|
18
|
+
|
|
19
|
+
You can infer with Passage Ranking models using [Inference Endpoints](https://huggingface.co/inference-endpoints). The Passage Ranking model inputs are a query for which we look for relevancy in the documents and the documents we want to search. The model will return scores according to the relevancy of these documents for the query.
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import json
|
|
23
|
+
import requests
|
|
24
|
+
|
|
25
|
+
API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/msmarco-distilbert-base-tas-b"
|
|
26
|
+
headers = {"Authorization": f"Bearer {api_token}"}
|
|
27
|
+
|
|
28
|
+
def query(payload):
|
|
29
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
30
|
+
return response.json()
|
|
31
|
+
|
|
32
|
+
data = query(
|
|
33
|
+
{
|
|
34
|
+
"inputs": {
|
|
35
|
+
"source_sentence": "That is a happy person",
|
|
36
|
+
"sentences": [
|
|
37
|
+
"That is a happy dog",
|
|
38
|
+
"That is a very happy person",
|
|
39
|
+
"Today is a sunny day"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
## [0.853, 0.981, 0.655]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Semantic Textual Similarity
|
|
47
|
+
|
|
48
|
+
Semantic Textual Similarity is the task of evaluating how similar two texts are in terms of meaning. These models take a source sentence and a list of sentences in which we will look for similarities and will return a list of similarity scores. The benchmark dataset is the [Semantic Textual Similarity Benchmark](http://ixa2.si.ehu.eus/stswiki/index.php/STSbenchmark). The task is evaluated on Pearsonβs Rank Correlation.
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import json
|
|
52
|
+
import requests
|
|
53
|
+
|
|
54
|
+
API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2"
|
|
55
|
+
headers = {"Authorization": f"Bearer {api_token}"}
|
|
56
|
+
|
|
57
|
+
def query(payload):
|
|
58
|
+
response = requests.post(API_URL, headers=headers, json=payload)
|
|
59
|
+
return response.json()
|
|
60
|
+
|
|
61
|
+
data = query(
|
|
62
|
+
{
|
|
63
|
+
"inputs": {
|
|
64
|
+
"source_sentence": "I'm very happy",
|
|
65
|
+
"sentences":["I'm filled with happiness", "I'm happy"]
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
## [0.605, 0.894]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
You can also infer with the models in the Hub using Sentence Transformer models.
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
pip install -U sentence-transformers
|
|
76
|
+
|
|
77
|
+
from sentence_transformers import SentenceTransformer, util
|
|
78
|
+
sentences = ["I'm happy", "I'm full of happiness"]
|
|
79
|
+
|
|
80
|
+
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
|
81
|
+
|
|
82
|
+
#Compute embedding for both lists
|
|
83
|
+
embedding_1= model.encode(sentences[0], convert_to_tensor=True)
|
|
84
|
+
embedding_2 = model.encode(sentences[1], convert_to_tensor=True)
|
|
85
|
+
|
|
86
|
+
util.pytorch_cos_sim(embedding_1, embedding_2)
|
|
87
|
+
## tensor([[0.6003]])
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Useful Resources
|
|
91
|
+
|
|
92
|
+
Would you like to learn more about Sentence Transformers and Sentence Similarity? Awesome! Here you can find some curated resources that you may find helpful!
|
|
93
|
+
|
|
94
|
+
- [Sentence Transformers Documentation](https://www.sbert.net/)
|
|
95
|
+
- [Sentence Transformers in the Hub](https://huggingface.co/blog/sentence-transformers-in-the-hub)
|
|
96
|
+
- [Building a Playlist Generator with Sentence Transformers](https://huggingface.co/blog/playlist-generator)
|
|
97
|
+
- [Getting Started With Embeddings](https://huggingface.co/blog/getting-started-with-embeddings)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { TaskDataCustom } from "../index.js";
|
|
2
|
+
|
|
3
|
+
const taskData: TaskDataCustom = {
|
|
4
|
+
datasets: [
|
|
5
|
+
{
|
|
6
|
+
description: "Bing queries with relevant passages from various web sources.",
|
|
7
|
+
id: "ms_marco",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
demo: {
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
label: "Source sentence",
|
|
14
|
+
content: "Machine learning is so easy.",
|
|
15
|
+
type: "text",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "Sentences to compare to",
|
|
19
|
+
content: "Deep learning is so straightforward.",
|
|
20
|
+
type: "text",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "",
|
|
24
|
+
content: "This is so difficult, like rocket science.",
|
|
25
|
+
type: "text",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "",
|
|
29
|
+
content: "I can't believe how much I struggled with this.",
|
|
30
|
+
type: "text",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
outputs: [
|
|
34
|
+
{
|
|
35
|
+
type: "chart",
|
|
36
|
+
data: [
|
|
37
|
+
{
|
|
38
|
+
label: "Deep learning is so straightforward.",
|
|
39
|
+
score: 0.623,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "This is so difficult, like rocket science.",
|
|
43
|
+
score: 0.413,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: "I can't believe how much I struggled with this.",
|
|
47
|
+
score: 0.256,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
metrics: [
|
|
54
|
+
{
|
|
55
|
+
description:
|
|
56
|
+
"Reciprocal Rank is a measure used to rank the relevancy of documents given a set of documents. Reciprocal Rank is the reciprocal of the rank of the document retrieved, meaning, if the rank is 3, the Reciprocal Rank is 0.33. If the rank is 1, the Reciprocal Rank is 1",
|
|
57
|
+
id: "Mean Reciprocal Rank",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
description:
|
|
61
|
+
"The similarity of the embeddings is evaluated mainly on cosine similarity. It is calculated as the cosine of the angle between two vectors. It is particularly useful when your texts are not the same length",
|
|
62
|
+
id: "Cosine Similarity",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
models: [
|
|
66
|
+
{
|
|
67
|
+
description:
|
|
68
|
+
"This model works well for sentences and paragraphs and can be used for clustering/grouping and semantic searches.",
|
|
69
|
+
id: "sentence-transformers/all-mpnet-base-v2",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
description: "A multilingual robust sentence similarity model..",
|
|
73
|
+
id: "BAAI/bge-m3",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
spaces: [
|
|
77
|
+
{
|
|
78
|
+
description: "An application that leverages sentence similarity to answer questions from YouTube videos.",
|
|
79
|
+
id: "Gradio-Blocks/Ask_Questions_To_YouTube_Videos",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
description:
|
|
83
|
+
"An application that retrieves relevant PubMed abstracts for a given online article which can be used as further references.",
|
|
84
|
+
id: "Gradio-Blocks/pubmed-abstract-retriever",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
description: "An application that leverages sentence similarity to summarize text.",
|
|
88
|
+
id: "nickmuchi/article-text-summarizer",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
description: "A guide that explains how Sentence Transformers can be used for semantic search.",
|
|
92
|
+
id: "sentence-transformers/Sentence_Transformers_for_semantic_search",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
summary:
|
|
96
|
+
"Sentence Similarity is the task of determining how similar two texts are. Sentence similarity models convert input texts into vectors (embeddings) that capture semantic information and calculate how close (similar) they are between them. This task is particularly useful for information retrieval and clustering/grouping.",
|
|
97
|
+
widgetModels: ["BAAI/bge-small-en-v1.5"],
|
|
98
|
+
youtubeId: "VCZq5AkbNEU",
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default taskData;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type SentenceSimilarityOutput = number[];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Inputs for Sentence similarity inference
|
|
11
|
+
*/
|
|
12
|
+
export interface SentenceSimilarityInput {
|
|
13
|
+
inputs: SentenceSimilarityInputData;
|
|
14
|
+
/**
|
|
15
|
+
* Additional inference parameters
|
|
16
|
+
*/
|
|
17
|
+
parameters?: { [key: string]: unknown };
|
|
18
|
+
[property: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface SentenceSimilarityInputData {
|
|
22
|
+
/**
|
|
23
|
+
* A list of strings which will be compared against the source_sentence.
|
|
24
|
+
*/
|
|
25
|
+
sentences: string[];
|
|
26
|
+
/**
|
|
27
|
+
* The string that you wish to compare the other strings with. This can be a phrase,
|
|
28
|
+
* sentence, or longer passage, depending on the model being used.
|
|
29
|
+
*/
|
|
30
|
+
sourceSentence: string;
|
|
31
|
+
[property: string]: unknown;
|
|
32
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/inference/schemas/sentence-similarity/input.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"description": "Inputs for Sentence similarity inference",
|
|
5
|
+
"title": "SentenceSimilarityInput",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"inputs": {
|
|
9
|
+
"title": "SentenceSimilarityInputData",
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"sourceSentence": {
|
|
13
|
+
"description": "The string that you wish to compare the other strings with. This can be a phrase, sentence, or longer passage, depending on the model being used.",
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"sentences": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"description": "A list of strings which will be compared against the source_sentence.",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["sourceSentence", "sentences"]
|
|
25
|
+
},
|
|
26
|
+
"parameters": {
|
|
27
|
+
"description": "Additional inference parameters",
|
|
28
|
+
"$ref": "#/$defs/SentenceSimilarityParameters"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"SentenceSimilarityParameters": {
|
|
33
|
+
"title": "SentenceSimilarityParameters",
|
|
34
|
+
"description": "Additional inference parameters for Sentence Similarity",
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": ["inputs"]
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/inference/schemas/sentence-similarity/output.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"title": "SentenceSimilarityOutput",
|
|
5
|
+
"description": "Outputs of inference for the Sentence Similarity task",
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"description": "The associated similarity score for each of the given sentences",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"title": "SentenceSimilarityScore"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Use Cases
|
|
2
|
+
|
|
3
|
+
### Research Paper Summarization π§
|
|
4
|
+
|
|
5
|
+
Research papers can be summarized to allow researchers to spend less time selecting which articles to read. There are several approaches you can take for a task like this:
|
|
6
|
+
|
|
7
|
+
1. Use an existing extractive summarization model on the Hub to do inference.
|
|
8
|
+
2. Pick an existing language model trained for academic papers. This model can then be trained in a process called fine-tuning so it can solve the summarization task.
|
|
9
|
+
3. Use a sequence-to-sequence model like [T5](https://huggingface.co/docs/transformers/model_doc/t5) for abstractive text summarization.
|
|
10
|
+
|
|
11
|
+
## Inference
|
|
12
|
+
|
|
13
|
+
You can use the π€ Transformers library `summarization` pipeline to infer with existing Summarization models. If no model name is provided the pipeline will be initialized with [sshleifer/distilbart-cnn-12-6](https://huggingface.co/sshleifer/distilbart-cnn-12-6).
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from transformers import pipeline
|
|
17
|
+
|
|
18
|
+
classifier = pipeline("summarization")
|
|
19
|
+
classifier("Paris is the capital and most populous city of France, with an estimated population of 2,175,601 residents as of 2018, in an area of more than 105 square kilometres (41 square miles). The City of Paris is the centre and seat of government of the region and province of Γle-de-France, or Paris Region, which has an estimated population of 12,174,880, or about 18 percent of the population of France as of 2017.")
|
|
20
|
+
## [{ "summary_text": " Paris is the capital and most populous city of France..." }]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You can use [huggingface.js](https://github.com/huggingface/huggingface.js) to infer summarization models on Hugging Face Hub.
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import { HfInference } from "@huggingface/inference";
|
|
27
|
+
|
|
28
|
+
const inference = new HfInference(HF_TOKEN);
|
|
29
|
+
const inputs =
|
|
30
|
+
"Paris is the capital and most populous city of France, with an estimated population of 2,175,601 residents as of 2018, in an area of more than 105 square kilometres (41 square miles). The City of Paris is the centre and seat of government of the region and province of Γle-de-France, or Paris Region, which has an estimated population of 12,174,880, or about 18 percent of the population of France as of 2017.";
|
|
31
|
+
|
|
32
|
+
await inference.summarization({
|
|
33
|
+
model: "sshleifer/distilbart-cnn-12-6",
|
|
34
|
+
inputs,
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Useful Resources
|
|
39
|
+
|
|
40
|
+
Would you like to learn more about the topic? Awesome! Here you can find some curated resources that you may find helpful!
|
|
41
|
+
|
|
42
|
+
- [Course Chapter on Summarization](https://huggingface.co/course/chapter7/5?fw=pt)
|
|
43
|
+
- [Distributed Training: Train BART/T5 for Summarization using π€ Transformers and Amazon SageMaker](https://huggingface.co/blog/sagemaker-distributed-training-seq2seq)
|
|
44
|
+
|
|
45
|
+
### Notebooks
|
|
46
|
+
|
|
47
|
+
- [PyTorch](https://github.com/huggingface/notebooks/blob/master/examples/summarization.ipynb)
|
|
48
|
+
- [TensorFlow](https://github.com/huggingface/notebooks/blob/master/examples/summarization-tf.ipynb)
|
|
49
|
+
|
|
50
|
+
### Scripts for training
|
|
51
|
+
|
|
52
|
+
- [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization)
|
|
53
|
+
- [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization)
|
|
54
|
+
- [Flax](https://github.com/huggingface/transformers/tree/main/examples/flax/summarization)
|
|
55
|
+
|
|
56
|
+
### Documentation
|
|
57
|
+
|
|
58
|
+
- [Summarization task guide](https://huggingface.co/docs/transformers/tasks/summarization)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { TaskDataCustom } from "../index.js";
|
|
2
|
+
|
|
3
|
+
const taskData: TaskDataCustom = {
|
|
4
|
+
canonicalId: "text2text-generation",
|
|
5
|
+
datasets: [
|
|
6
|
+
{
|
|
7
|
+
description:
|
|
8
|
+
"News articles in five different languages along with their summaries. Widely used for benchmarking multilingual summarization models.",
|
|
9
|
+
id: "mlsum",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
description: "English conversations and their summaries. Useful for benchmarking conversational agents.",
|
|
13
|
+
id: "samsum",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
demo: {
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
label: "Input",
|
|
20
|
+
content:
|
|
21
|
+
"The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. It was the first structure to reach a height of 300 metres. Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.",
|
|
22
|
+
type: "text",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
outputs: [
|
|
26
|
+
{
|
|
27
|
+
label: "Output",
|
|
28
|
+
content:
|
|
29
|
+
"The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building. It was the first structure to reach a height of 300 metres.",
|
|
30
|
+
type: "text",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
metrics: [
|
|
35
|
+
{
|
|
36
|
+
description:
|
|
37
|
+
"The generated sequence is compared against its summary, and the overlap of tokens are counted. ROUGE-N refers to overlap of N subsequent tokens, ROUGE-1 refers to overlap of single tokens and ROUGE-2 is the overlap of two subsequent tokens.",
|
|
38
|
+
id: "rouge",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
models: [
|
|
42
|
+
{
|
|
43
|
+
description:
|
|
44
|
+
"A strong summarization model trained on English news articles. Excels at generating factual summaries.",
|
|
45
|
+
id: "facebook/bart-large-cnn",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
description: "A summarization model trained on medical articles.",
|
|
49
|
+
id: "Falconsai/medical_summarization",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
spaces: [
|
|
53
|
+
{
|
|
54
|
+
description: "An application that can summarize long paragraphs.",
|
|
55
|
+
id: "pszemraj/summarize-long-text",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: "A much needed summarization application for terms and conditions.",
|
|
59
|
+
id: "ml6team/distilbart-tos-summarizer-tosdr",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
description: "An application that summarizes long documents.",
|
|
63
|
+
id: "pszemraj/document-summarization",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
description: "An application that can detect errors in abstractive summarization.",
|
|
67
|
+
id: "ml6team/post-processing-summarization",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
summary:
|
|
71
|
+
"Summarization is the task of producing a shorter version of a document while preserving its important information. Some models can extract text from the original input, while other models can generate entirely new text.",
|
|
72
|
+
widgetModels: ["facebook/bart-large-cnn"],
|
|
73
|
+
youtubeId: "yHnr5Dk2zCI",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default taskData;
|