mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-31 17:27:42 +00:00
Implement model (and some factor) coder with evolving (#52)
* store code into FBImplementation * fix path related bugs * fix a bug * fix factor related small bugs * re-submit all model related code * new code to model coder * finish the model evolving code --------- Co-authored-by: xuyang1 <xuyang1@microsoft.com>
This commit is contained in:
@@ -30,7 +30,6 @@ class ModelCodeWriter(TaskGenerator[ModelExperiment]):
|
||||
description=t.description,
|
||||
formulation=t.formulation,
|
||||
variables=t.variables,
|
||||
execute_desc=mti.execute_desc(),
|
||||
)
|
||||
system_prompt = sys_prompt_tpl.render()
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
|
||||
code_implement_sys: -|
|
||||
You are an assistant whose job is to answer user's question."
|
||||
code_implement_user: -|
|
||||
code_implement_sys: |-
|
||||
You are an assistant whose job is to answer user's question.
|
||||
code_implement_user: |-
|
||||
With the following given information, write a python code using pytorch and torch_geometric to implement the model.
|
||||
This model is in the graph learning field, only have one layer.
|
||||
The input will be node_feature [num_nodes, dim_feature] and edge_index [2, num_edges] (It would be the input of the forward model)
|
||||
@@ -13,6 +13,15 @@ code_implement_user: -|
|
||||
3. model formulation:{{formulation}}
|
||||
4. model variables:{{variables}}.
|
||||
You must complete the forward function as far as you can do.
|
||||
\# Execution
|
||||
Your implemented code will be exectued in the follow way
|
||||
{{execute_desc}}
|
||||
Execution Your implemented code will be executed in the follow way:
|
||||
The the implemented code will be placed in a file like [uuid]/model.py
|
||||
We'll import the model in the implementation in file `model.py` after setting the cwd into the directory
|
||||
- from model import model_cls (So you must have a variable named `model_cls` in the file)
|
||||
- So your implemented code could follow the following pattern
|
||||
```Python
|
||||
class XXXLayer(torch.nn.Module):
|
||||
...
|
||||
model_cls = XXXLayer
|
||||
```
|
||||
- initialize the model by initializing it `model_cls(input_dim=INPUT_DIM)`
|
||||
- And then verify the model by comparing the output tensors by feeding specific input tensor.
|
||||
|
||||
Reference in New Issue
Block a user