Accessing components of a step result
- 主要言語
- Python
- スター
- 572
- フォーク
- 55
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Suppose I'm working on a POS tagger. I have two steps, one where I load my dataset and another where I train my model:
```jsonnet
{
data: { ... },
trained_model: {
type: "torch::train",
model: {
...
tag_count: ... // what here?
}
...
}
```
I want to count the number of unique tags that were loaded in the dataset dynamically instead of hardcoding the tag count in the config, and I could do this during the `data` step and include it in the output. However, I don't see how a ref like `{ type: "ref", ref: "data" }` could help, since I really want to access a specific subpart of the `data` step's result, e.g. the attribute `tag_count`.
One workaround is to make a third step between the two, `count_tags`, which takes `data` and produces the `tag_count` as its step result, though this gets awkward when you want to do this for many vocabularies.
Does Tango have any amenities for cases like this? It'd be great if I could write something like `{ type: "ref", ref: "data", attrs: ["tag_count"] }`
コントリビューションガイド
評価
この issue はまだ評価されていません。