Comments (5)
@dc.dataclass
class InputNode:
name: str
class Inputs:
def __init__(self, fn):
self.params = inspect.signature(fn).parameters
def __getattr__(self, item):
assert item in self.params
return InputNode(item)
class _Predictor:
@property
def inputs(self) -> Inputs:
...
from superduperdb.
What should the signature of .predict
look like?
If we had named inputs, we could create Listener
which "listens" to specific keys.
Idea: X: t.Optional[t.List[t.Any], t.Dict[str, t.Any], t.Any]
.
Variants:
def my_func(x, y, z):
...
model = Model('test', object=my_func)
# both should work
out1 = model.predict(X={'y': 2, 'x': 3, 'z': 'bla'}, one=True)
out2 = model.predict((3, 2, 'bla'), one=True)
assert out1 == out2
Listener
creation could be more precise and similar
# both fine
l = Listener(model=model, key={'y': 'text', 'x': 'image', 'z': 'text2'})
l = Listener(model=model, key=('text', 'image', 'text2'))
# raises `InputException`
l = Listener(model=model, key=('text', 'image'))
What happens to _base
? This can only make sense if a model has one input.
def process_document(r):
... # do anything with all keys
In MongoDB there might be different numbers of keys per document in no particular order.
For SQL only, we might say _base
means that the model gets all columns apart from the id
column.
How about syntactic sugar?
l = Listener(model=model, key='*', select=...)
print(l.key)
# ('txt', 'bla', '...') - gets extracted from select.table_or_collection
from superduperdb.
What about outputs object?
class Outputs:
def __getitem__(self, item: int):
assert isinstance(item, int)
return OutputNode(item)
Then in GraphModel
we can have different variants:
G.add_edge(model.outputs[0], other.inputs.x)
G.add_edge(model.outputs, other.inputs)
G.add_edge(model.outputs, other.inputs.x)
G.add_edge(model.outputs[0], other.inputs)
from superduperdb.
Also we should do some nice pretty-printing of Model
information so that developers "know"
what parameters we have for a model.
from superduperdb.
Subtasks:
- Refactor
._predict
as_predict(self, X, dataset, ...)
- Add input and output nodes to
_Predictor
- Connect input and output nodes with
Listener
andpredict(X, db=db)
from superduperdb.
Related Issues (20)
- For insertions and queries, use a unified interface HOT 5
- Automatically Infer Data Schema for Inserted Data HOT 1
- [SERIALIZE] Update docs with new serialize protocol
- [SERIALIZE] Update and check use-cases with new serialize protocol
- [BUG]: vector() takes 0 positional arguments but 1 was given HOT 2
- [REL-CLT] version issue with ibis-framework
- Auto-create tables and schemas HOT 1
- [BUGS-0.2.0] `peft`, `trl`, `transformers` compatibility
- [BUGS-0.2.0] Connection to Oracle
- [BUGS-0.2.0] Run end-to-end tests on snowflake HOT 1
- [BUGS-0.2.0] Handle conditional test-cases.
- [DistEnv] Distributed Environment
- [DistEnv] Circulate configuration using Ray.
- [SERIALIZE] Remove deadcode from project
- [BUG]: `Document.decode` has unwanted side-effects
- [BUG] Insert queries with artifacts do not work HOT 1
- [BUG]: The predict function of the graph model cannot handle models with default parameter values.
- [BUG] A bug in Document.encode which overrides existing leaves, files and blobs
- Change of Field Name for Storing Model Results in Ibis
- Manage a CONSTANT module to handle all special characters.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superduperdb.