Build a transformer model in tensorflow

Job ID: 33964002

Budget: $30 – $250 USD

I need a transformer model as a python class made with tensorflow which is capable of:
- imbalanced data learnig
- few-shot learning

The model goals are to guess correctly the environment's next state and reward value when the agent is doing some action. The agent should not learn how to play, but instead learn how the state of environment changes and what is the reward value according to agent's action.

Environments are available on: https://www.gymlibrary.ml/

The python class should support any environment, and build properly the model using the environment passed as a parameter. It is important to not overfit or underfit the model, and build the model with optimal number of trainable parameters, because a optimal means as few parameters as possible to build a small model that is capable to generalise very well the behaviour of environment vs agent.

For example:

import gym
env = gym.make("Taxi-v3")
observation, info = env.reset(seed=42, return_info=True)
for _ in range(1500):
env.render()
action = random_action()
observation, reward, done, info = env.step(action)

if done:
observation, info = env.reset(return_info=True)
env.close()

In the above code we collect 1500 samples, which is the half of all samples supported by this discrete environment. Having only few samples, the model should find the patterns that describes the behaviour. Agent is learning to emulate the environment and agent behaviour. The model gets as input current state and action, and outputs next sate and reward.

Note that some states, rewards are rare, and the agent should be able to learn from that. Some environments are simple toy text. other are classic controls and Atari environments, so the class should build a correct model.