ersilia-os / eos6oli

Aqueous solubility prediction
GNU General Public License v3.0
1 stars 4 forks source link

Clean Up & Dockerization eos6oli #4

Closed GemmaTuron closed 1 year ago

GemmaTuron commented 1 year ago

Hi @HellenNamulinda

Please update this model to its latest version, including workflows and structure of the template!

HellenNamulinda commented 1 year ago

Hello @GemmaTuron, I cloned the repo and I'm working on it.

HellenNamulinda commented 1 year ago

@GemmaTuron I noticed the main LICENSE file of the repository is Apache-2.0, which is for the model developers. I have updated it to the GPLv3(the main license file in the template).

GemmaTuron commented 1 year ago

Hi @HellenNamulinda !

The License file on the main repo should indeed be GPL v3 The model is quite particular because it is simply running a python package named "Soltrannet" If you see the service file, it creates a run file inside the predict function. I suggest we remove that from there and add a run.sh file under the framework directory

I am referring to this piece inside predict function:

        with open(run_file, "w") as f:
            lines = [
                "soltrannet {0} {1}".format(
                    data_file,
                    pred_file
                )
            ]
            f.write(os.linesep.join(lines))

so our run.sh should have simply the command soltrannet $1 $2 And modify the functions on the service file to run instead of predict Hope this helps!

HellenNamulinda commented 1 year ago

@GemmaTuron Thank you so much. Let me modify and do the final testing before pushing.

HellenNamulinda commented 1 year ago

Hello @GemmaTuron, I refactored the model api (predict to run) And also added the run.sh file soltrannet $1 $2. I tested the model by executing the run.sh script and works except for warnings of ;

/home/hellenah/anaconda3/envs/eos6oli/lib/python3.7/site-packages/soltrannet/data_utils.py:207: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at ../torch/csrc/utils/tensor_new.cpp:230.)
return [torch.FloatTensor(adjacency_list), torch.FloatTensor(features_list), smiles_list, index_list]

I'm still getting errors while testing the model using ersila(after activing ersilia env). When I fetch the model i.e ersilia -v fetch eos6oli --repo_path ~/Outreachy/eos6oli, I get EmptyOutputError.

Ersilia exception class:
EmptyOutputError
Detailed error:
Model API eos6oli:run did not produce an output/home/hellenah/eos/repository/eos6oli/20230602102801_0BABD6/eos6oli/artifacts/framework/run.sh: line 1: soltrannet: command not found
GemmaTuron commented 1 year ago

Hi @HellenNamulinda

To be able to provide help I need to see the whole log of the error. You have instructions on how to collect this here. Once you have the whole error log, please revise it line by line and try to identify what is crashing. It is probably a version error of pytorch or another package

HellenNamulinda commented 1 year ago

Hello @GemmaTuron, After doing more research and understanding the structure of most of the models in erisilia hub, I was able to solve all the issues. For the warning(it is not an error) when running run.sh, I realized it arises from the original code of the model. The code needed some optimization to make it faster. But we can't change it now. This is beacuse the original model code was provided as a python package which is installed using pip install soltrannet==1.0.0

Also, for the EmptyOutputError, I realized the mistake I had made. After adding the run.sh file, I had changed the code

"soltrannet {0} {1}".format(
                    data_file,
                    pred_file
                )

to

  "bash {0}/run.sh {0} {1} {2}".format(
      self.framework_dir,
      data_file,
      pred_file
     ) 

And yet the model is a package, not code. I now know better the structure of most of the models and updating the next ones is going to be faster.

I successfully tested the updated model locally, and I have created a pull request here

GemmaTuron commented 1 year ago

The model is clearly working, the model test on push still fails though, we will revisit that with @miquelduranfrigola

GemmaTuron commented 1 year ago

The latest change to get the model from the repo path instead of dockerhub (see this) works, the model testing has been passed successfully. I'll close this issue as completed, thanks @HellenNamulinda !