allenai / allenai/tango

Accessing components of a step result

オープン
#485 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。