模型训练遇到wandb有关报错怎么办???
26%|██▋ | 500/1889 [01:27<03:32, 6.54it/s]wandb: ERROR api_key not configured (no-tty). call wandb.login(key=[your_api_key])
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2023.1\plugins\python\helpers\pydev\pydevconsole.py", line 367, in runcode
loop.run_until_complete(coro)
File "D:\Miniconda3\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "<input>", line 69, in <module>
File "D:\Miniconda3\lib\site-packages\transformers\trainer.py", line 1662, in train
return inner_training_loop(
File "D:\Miniconda3\lib\site-packages\transformers\trainer.py", line 2006, in _inner_training_loop
self._maybe_log_save_evaluate(tr_loss, model, trial, epoch, ignore_keys_for_eval)
File "D:\Miniconda3\lib\site-packages\transformers\trainer.py", line 2273, in _maybe_log_save_evaluate
self.log(logs)
File "D:\Miniconda3\lib\site-packages\transformers\trainer.py", line 2612, in log
self.control = self.callback_handler.on_log(self.args, self.state, self.control, logs)
File "D:\Miniconda3\lib\site-packages\transformers\trainer_callback.py", line 390, in on_log
return self.call_event("on_log", args, state, control, logs=logs)
File "D:\Miniconda3\lib\site-packages\transformers\trainer_callback.py", line 397, in call_event
result = getattr(callback, event)(
File "D:\Miniconda3\lib\site-packages\transformers\integrations.py", line 804, in on_log
self.setup(args, state, model)
File "D:\Miniconda3\lib\site-packages\transformers\integrations.py", line 738, in setup
self._wandb.init(
File "D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_init.py", line 1171, in init
raise e
File "D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_init.py", line 1148, in init
wi.setup(kwargs)
File "D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_init.py", line 289, in setup
wandb_login._login(
File "D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_login.py", line 298, in _login
wlogin.prompt_api_key()
File "D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_login.py", line 228, in prompt_api_key
raise UsageError("api_key not configured (no-tty). call " + directive)
wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])
┌───────────────────── Traceback (most recent call last) ─────────────────────┐
│ C:\Program Files\JetBrains\PyCharm │
│ 2023.1\plugins\python\helpers\pydev\pydevconsole.py:367 in runcode │
│ │
│ 364 │ │ │ │ coro = func() │
│ 365 │ │ │ │ if inspect.iscoroutine(coro): │
│ 366 │ │ │ │ │ loop = asyncio.get_event_loop() │
│ > 367 │ │ │ │ │ loop.run_until_complete(coro) │
│ 368 │ │ │ except SystemExit: │
│ 369 │ │ │ │ raise │
│ 370 │ │ │ except RuntimeError as err: │
│ │
│ D:\Miniconda3\lib\asyncio\base_events.py:616 in run_until_complete │
│ │
│ 613 │ │ if not future.done(): │
│ 614 │ │ │ raise RuntimeError('Event loop stopped before Future com │
│ 615 │ │ │
│ > 616 │ │ return future.result() │
│ 617 │ │
│ 618 │ def stop(self): │
│ 619 │ │ """Stop running the event loop. │
│ in <module>:69 │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\trainer.py:1662 in train │
│ │
│ 1659 │ │ inner_training_loop = find_executable_batch_size( │
│ 1660 │ │ │ self._inner_training_loop, self._train_batch_size, args. │
│ 1661 │ │ ) │
│ > 1662 │ │ return inner_training_loop( │
│ 1663 │ │ │ args=args, │
│ 1664 │ │ │ resume_from_checkpoint=resume_from_checkpoint, │
│ 1665 │ │ │ trial=trial, │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\trainer.py:2006 in │
│ _inner_training_loop │
│ │
│ 2003 │ │ │ │ │ self.state.epoch = epoch + (step + 1 + steps_ski │
│ 2004 │ │ │ │ │ self.control = self.callback_handler.on_step_end │
│ 2005 │ │ │ │ │ │
│ > 2006 │ │ │ │ │ self._maybe_log_save_evaluate(tr_loss, model, tr │
│ 2007 │ │ │ │ else: │
│ 2008 │ │ │ │ │ self.control = self.callback_handler.on_substep_ │
│ 2009 │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\trainer.py:2273 in │
│ _maybe_log_save_evaluate │
│ │
│ 2270 │ │ │ self._globalstep_last_logged = self.state.global_step │
│ 2271 │ │ │ self.store_flos() │
│ 2272 │ │ │ │
│ > 2273 │ │ │ self.log(logs) │
│ 2274 │ │ │
│ 2275 │ │ metrics = None │
│ 2276 │ │ if self.control.should_evaluate: │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\trainer.py:2612 in log │
│ │
│ 2609 │ │ │
│ 2610 │ │ output = {**logs, **{"step": self.state.global_step}} │
│ 2611 │ │ self.state.log_history.append(output) │
│ > 2612 │ │ self.control = self.callback_handler.on_log(self.args, self. │
│ 2613 │ │
│ 2614 │ def _prepare_input(self, data: Union[torch.Tensor, Any]) -> Unio │
│ 2615 │ │ """ │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\trainer_callback.py:390 in │
│ on_log │
│ │
│ 387 │ │
│ 388 │ def on_log(self, args: TrainingArguments, state: TrainerState, co │
│ 389 │ │ control.should_log = False │
│ > 390 │ │ return self.call_event("on_log", args, state, control, logs=l │
│ 391 │ │
│ 392 │ def on_prediction_step(self, args: TrainingArguments, state: Trai │
│ 393 │ │ return self.call_event("on_prediction_step", args, state, con │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\trainer_callback.py:397 in │
│ call_event │
│ │
│ 394 │ │
│ 395 │ def call_event(self, event, args, state, control, **kwargs): │
│ 396 │ │ for callback in self.callbacks: │
│ > 397 │ │ │ result = getattr(callback, event)( │
│ 398 │ │ │ │ args, │
│ 399 │ │ │ │ state, │
│ 400 │ │ │ │ control, │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\integrations.py:804 in on_log │
│ │
│ 801 │ │ if self._wandb is None: │
│ 802 │ │ │ return │
│ 803 │ │ if not self._initialized: │
│ > 804 │ │ │ self.setup(args, state, model) │
│ 805 │ │ if state.is_world_process_zero: │
│ 806 │ │ │ logs = rewrite_logs(logs) │
│ 807 │ │ │ self._wandb.log({**logs, "train/global_step": state.glob │
│ │
│ D:\Miniconda3\lib\site-packages\transformers\integrations.py:738 in setup │
│ │
│ 735 │ │ │ │ │ init_args["name"] = args.run_name │
│ 736 │ │ │ │
│ 737 │ │ │ if self._wandb.run is None: │
│ > 738 │ │ │ │ self._wandb.init( │
│ 739 │ │ │ │ │ project=os.getenv("WANDB_PROJECT", "huggingface" │
│ 740 │ │ │ │ │ **init_args, │
│ 741 │ │ │ │ ) │
│ │
│ D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_init.py:1171 in init │
│ │
│ 1168 │ except Error as e: │
│ 1169 │ │ if logger is not None: │
│ 1170 │ │ │ logger.exception(str(e)) │
│ > 1171 │ │ raise e │
│ 1172 │ except KeyboardInterrupt as e: │
│ 1173 │ │ assert logger │
│ 1174 │ │ logger.warning("interrupted", exc_info=e) │
│ │
│ D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_init.py:1148 in init │
│ │
│ 1145 │ run: Optional[Union[Run, RunDisabled]] = None │
│ 1146 │ try: │
│ 1147 │ │ wi = _WandbInit() │
│ > 1148 │ │ wi.setup(kwargs) │
│ 1149 │ │ assert wi.settings │
│ 1150 │ │ except_exit = wi.settings._except_exit │
│ 1151 │ │ try: │
│ │
│ D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_init.py:289 in setup │
│ │
│ 286 │ │ │ settings.update(init_settings, source=Source.INIT) │
│ 287 │ │ │
│ 288 │ │ if not settings._offline and not settings._noop: │
│ > 289 │ │ │ wandb_login._login( │
│ 290 │ │ │ │ anonymous=kwargs.pop("anonymous", None), │
│ 291 │ │ │ │ force=kwargs.pop("force", None), │
│ 292 │ │ │ │ _disable_warning=True, │
│ │
│ D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_login.py:298 in _login │
│ │
│ 295 │ │ return logged_in │
│ 296 │ │
│ 297 │ if not key: │
│ > 298 │ │ wlogin.prompt_api_key() │
│ 299 │ │
│ 300 │ # make sure login credentials get to the backend │
│ 301 │ wlogin.propogate_login() │
│ │
│ D:\Miniconda3\lib\site-packages\wandb\sdk\wandb_login.py:228 in │
│ prompt_api_key │
│ │
│ 225 │ │ │ │ if self._settings._cli_only_mode │
│ 226 │ │ │ │ else "wandb.login(key=[your_api_key])" │
│ 227 │ │ │ ) │
│ > 228 │ │ │ raise UsageError("api_key not configured (no-tty). call " │
│ 229 │ │ │
│ 230 │ │ self.update_session(key, status=status) │
│ 231 │ │ self._key = key │
└─────────────────────────────────────────────────────────────────────────────┘
UsageError: api_key not configured (no-tty). call
wandb.login(key=[your_api_key])
当然是把它卸载掉了!!!!!!!!!!!!!!