(language_model_path, output_path)
| 232 | |
| 233 | |
| 234 | def create_value_model(language_model_path, output_path): |
| 235 | config = AutoConfig.from_pretrained(language_model_path) |
| 236 | config.num_labels = 1 |
| 237 | config.classifier_dropout = 0 |
| 238 | config.tie_word_embeddings = False |
| 239 | model = AutoModelForTokenClassification.from_config(config) |
| 240 | tokenizer = AutoTokenizer.from_pretrained(os.path.expanduser(language_model_path)) |
| 241 | assert model.config.num_labels == 1 |
| 242 | path = os.path.expanduser(output_path) |
| 243 | model.save_pretrained(path) |
| 244 | tokenizer.save_pretrained(path) |
| 245 | config.save_pretrained(path) |
| 246 | return path |
| 247 | |
| 248 | |
| 249 | @pytest.mark.parametrize("strategy", ["fsdp", "fsdp2"]) |
no test coverage detected