Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Created December 15, 2020 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamletbatista/e0498d79dfef5350cec8171d8e4a1f03 to your computer and use it in GitHub Desktop.
Save hamletbatista/e0498d79dfef5350cec8171d8e4a1f03 to your computer and use it in GitHub Desktop.
input_features:
-
name: Original_Title
type: text
level: word
encoder: t5
reduce_output: null
-
name: Keyword
type: text
level: word
tied_weights: Original_Title
encoder: t5
reduce_output: null
output_features:
-
name: Optimized_Title
type: sequence
level: word
decoder: generator
@marcusbianco
Copy link

Thanks a LOT Hamlet!

@mithila2806
Copy link

Hi

Thank you for the Title automation article on SEJ - https://www.searchenginejournal.com/automated-title-tag-optimization-using-deep-learning/390207/.

I'm very much curious to run this code. Tried many ways but stuck on one step (training the model).

Train Model

I'm getting some errors in Epoch 1. Screenshots attached.

Error - part 1

Error - part 2

Error - part 3

I have also linked the Error log file for more details.
https://gist.github.com/mithila2806/520a5e12963fdba95e2dae6b63ce3912

Any help on how to resolve these errors would be very much appreciated. Merry Christmas and Happy New Year :)

Thanks in advance,
Mithila

@hamletbatista
Copy link
Author

@mithila2806
Copy link

Hi @hamletbatista

Thank you very much for the prompt reply.

I did make changes in the code as per the thread you shared above and included the updated YAML file.

My Collab Notebook (If needed)
https://colab.research.google.com/drive/1aB-ABCXrv5bz85sZKtbLIQXryJQIhNfB?usp=sharing

image

image

Afraid to say I'm still stuck on the same step with below error:

`Epoch 1
Training: 0% 0/6 [00:00<?, ?it/s]Traceback (most recent call last):
File "/usr/local/bin/ludwig", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/ludwig/cli.py", line 146, in main
CLI()
File "/usr/local/lib/python3.6/dist-packages/ludwig/cli.py", line 72, in init
getattr(self, args.command)()
File "/usr/local/lib/python3.6/dist-packages/ludwig/cli.py", line 77, in train
train.cli(sys.argv[2:])
File "/usr/local/lib/python3.6/dist-packages/ludwig/train.py", line 412, in cli
train_cli(**vars(args))
File "/usr/local/lib/python3.6/dist-packages/ludwig/train.py", line 197, in train_cli
debug=debug,
File "/usr/local/lib/python3.6/dist-packages/ludwig/api.py", line 469, in train
save_path=model_dir,
File "/usr/local/lib/python3.6/dist-packages/ludwig/models/trainer.py", line 552, in train
self.regularization_lambda
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 780, in call
result = self._call(*args, **kwds)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 823, in _call
self._initialize(args, kwds, add_initializers_to=initializers)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 697, in _initialize
*args, **kwds))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 2855, in _get_concrete_function_internal_garbage_collected
graph_function, _, _ = self._maybe_define_function(args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 3213, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 3075, in _create_graph_function
capture_by_value=self._capture_by_value),
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py", line 986, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/def_function.py", line 600, in wrapped_fn
return weak_wrapped_fn().wrapped(*args, **kwds)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/function.py", line 3735, in bound_method_wrapper
return wrapped_fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/func_graph.py", line 973, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:

/usr/local/lib/python3.6/dist-packages/ludwig/models/ecd.py:176 train_step  *
    model_outputs = self((inputs, targets), training=True)
/usr/local/lib/python3.6/dist-packages/ludwig/models/ecd.py:101 call  *
    encoder_output = encoder(input_values, training=training,
/usr/local/lib/python3.6/dist-packages/ludwig/features/text_feature.py:242 call  *
    encoder_output = self.encoder_obj(
/usr/local/lib/python3.6/dist-packages/ludwig/encoders/text_encoders.py:640 call  *
    transformer_outputs = self.transformer(
/usr/local/lib/python3.6/dist-packages/transformers/models/t5/modeling_tf_t5.py:1095 call  *
    inputs = input_processing(
/usr/local/lib/python3.6/dist-packages/transformers/modeling_tf_utils.py:349 input_processing  *
    raise ValueError(

ValueError: The following keyword arguments are not supported by this model: ['token_type_ids'].

Training: 0% 0/6 [00:01<?, ?it/s]`

Do you have a copy of the code which I can run myself? If comfortable, could you share a copy of it please?
I'm very new to Python and ML models. So I might be missing the basic details.
Sorry to bother with long message.

Regards,
Mithila

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment