一昨昨日の記事の続きだが、Swallowを使って系列ラベリングをおこなうべく、LlamaForTokenClassificationを書いてみた。 from typing import List, Optional, Tuple, Union import torch from torch import nn from transformers.modeling_outputs import TokenClassifierOutput from transformers.file_utils import add_start_docstrings_to_model_forward from transformers.models.llama.modeling_llama import LlamaModel, LlamaPreTrainedModel, LLAMA_INPUTS_DOCSTR
![transformers向け系列ラベリングクラスLlamaForTokenClassificationを書いてみた - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/1e9d5acf16770ae9bf9611f7b361c516fcea3534/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Fadvent-calendar-ogp-background-f625e957b80c4bd8dd47b724be996090.jpg%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9dHJhbnNmb3JtZXJzJUU1JTkwJTkxJUUzJTgxJTkxJUU3JUIzJUJCJUU1JTg4JTk3JUUzJTgzJUE5JUUzJTgzJTk5JUUzJTgzJUFBJUUzJTgzJUIzJUUzJTgyJUIwJUUzJTgyJUFGJUUzJTgzJUE5JUUzJTgyJUI5TGxhbWFGb3JUb2tlbkNsYXNzaWZpY2F0aW9uJUUzJTgyJTkyJUU2JTlCJUI4JUUzJTgxJTg0JUUzJTgxJUE2JUUzJTgxJUJGJUUzJTgxJTlGJnR4dC1jb2xvcj0lMjMzQTNDM0MmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9NTYmdHh0LWNsaXA9ZWxsaXBzaXMmdHh0LWFsaWduPWxlZnQlMkNtaWRkbGUmcz05NDdiNjhhNTk2MjE5ZTY0MmU4NjljYzhkYzU5YTQyYg%26mark-x%3D142%26mark-y%3D151%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTcxNiZ0eHQ9JTQwS29pY2hpWWFzdW9rYSZ0eHQtY29sb3I9JTIzM0EzQzNDJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTMyJnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnM9YzY3MzQ3MmIxZGZhMjFjMzNmZDViNDA4ODAyOWFmNmQ%26blend-x%3D142%26blend-y%3D491%26blend-mode%3Dnormal%26s%3D4a257ac8ec4895827a11861a1876fc3f)