Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Add EncoderBlock #698

Closed
marcromeyn opened this issue Aug 30, 2022 · 0 comments · Fixed by #705
Closed

[TASK] Add EncoderBlock #698

marcromeyn opened this issue Aug 30, 2022 · 0 comments · Fixed by #705
Assignees
Milestone

Comments

@marcromeyn
Copy link
Contributor

marcromeyn commented Aug 30, 2022

There’s a need to introduce a new concept: Encoder which is a block that encodes features into some representation. This class can be used for prediction but can’t be trained/evaluated in isolation, only as part of a Model.

class Encoder(tf.keras.Model):
	# Block that can be used for prediction but not for train/test

	def __init__(
		self, 
		inputs: Union[Schema, Block],
		*blocks: Block,
		pre: Optional[tf.keras.layers.Layer] = None,
		post: Optional[tf.keras.layers.Layer] = None,
		**kwargs,
	):
		...

	@classmethod
	def for_tag(
		cls,
		schema,
		tag,
		*block,
	):
		...

	def encode(
		self, 
		dataset: merlin.io.Dataset,
		id_col=None,
		**kwargs
	) -> merlin.io.Dataset:
		...

	def batch_predict(
		self, 
		dataset: merlin.io.Dataset,
		output_schema: Optional[Schema] = None
		**kwargs
	) -> merlin.io.Dataset:
		...
	
	def predict(
		self,
		x,
		batch_size=None,
		verbose='auto',
		steps=None,
		callbacks=None,
		max_queue_size=10,
		workers=1,
		use_multiprocessing=False
	):
		...

	def save(...):
		# Save with input- & output-schema

	@property
	def schema(self) -> Schema:
		...
	
	@property
	def output_schema(self) -> Schema:
		...

	@property
	def inputs(self) -> Block:
		...
@marcromeyn marcromeyn changed the title Add EncoderBlock & BiEncoderBlock [TASK] Add EncoderBlock & BiEncoderBlock Aug 30, 2022
@marcromeyn marcromeyn transferred this issue from NVIDIA-Merlin/Merlin Aug 30, 2022
@marcromeyn marcromeyn self-assigned this Aug 30, 2022
@marcromeyn marcromeyn added this to the Merlin 22.09 milestone Aug 30, 2022
@marcromeyn marcromeyn changed the title [TASK] Add EncoderBlock & BiEncoderBlock [TASK] Add EncoderBlock Aug 30, 2022
@marcromeyn marcromeyn linked a pull request Sep 7, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant