Fix init to accept kwargs
This commit is contained in:
8
hello.py
8
hello.py
@@ -9,20 +9,18 @@ class EchoConfig(PrecompiledConfig):
|
|||||||
class EchoAgent(PrecompiledAgent):
|
class EchoAgent(PrecompiledAgent):
|
||||||
config: EchoConfig
|
config: EchoConfig
|
||||||
|
|
||||||
def __init__(self, config: EchoConfig):
|
def __init__(self, config: EchoConfig, **kwargs): # <-- Add **kwargs
|
||||||
super().__init__(config)
|
super().__init__(config, **kwargs) # <-- Pass them through
|
||||||
|
|
||||||
def forward(self, text: str) -> str:
|
def forward(self, text: str) -> str:
|
||||||
return f"Echo: {text}"
|
return f"Echo: {text}"
|
||||||
|
|
||||||
|
|
||||||
# This block only runs when you execute the script directly,
|
|
||||||
# NOT when modaic imports the module
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
agent = EchoAgent(EchoConfig())
|
agent = EchoAgent(EchoConfig())
|
||||||
print(agent(text="hello"))
|
print(agent(text="hello"))
|
||||||
agent.push_to_hub(
|
agent.push_to_hub(
|
||||||
"connor/CrossEncoderRanker",
|
"connor/CrossEncoderRanker",
|
||||||
with_code=True,
|
with_code=True,
|
||||||
commit_message="My first commit"
|
commit_message="Fix init to accept kwargs"
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user