From 9c3c89bfd34f3bd937fd684e8f72a568b808bd7e Mon Sep 17 00:00:00 2001 From: Martin Molinero Date: Mon, 27 Nov 2023 15:42:11 -0300 Subject: [PATCH 1/2] Minor foundation update --- DockerfileLeanFoundation | 12 ++++++------ DockerfileLeanFoundationARM | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DockerfileLeanFoundation b/DockerfileLeanFoundation index 52ee997ad8e8..244ccbee0c5a 100644 --- a/DockerfileLeanFoundation +++ b/DockerfileLeanFoundation @@ -200,9 +200,7 @@ RUN pip install --no-cache-dir \ jupyter-bokeh==3.0.7 \ imbalanced-learn==0.11.0 \ scikeras==0.12.0 \ - openai==0.28.1 \ - openai[embeddings]==0.28.1 \ - openai[wandb]==0.28.1 \ + openai==1.3.5 \ lazypredict==0.2.12 \ fracdiff==0.9.0 \ darts==0.24.0 \ @@ -224,14 +222,16 @@ RUN pip install --no-cache-dir \ tick==0.7.0.1 \ transformers==4.34.0 \ Rbeast==0.1.16 \ - langchain==0.0.316 \ + langchain==0.0.341 \ tensorflow-ranking==0.5.3 \ pomegranate==1.0.3 \ tigramite==5.2.3.1 \ MAPIE==0.7.0 \ mlforecast==0.9.3 \ functime==0.8.4 \ - tensorrt==8.6.1.post1 + tensorrt==8.6.1.post1 \ + x-transformers==1.26.0 \ + Werkzeug==2.3.8 RUN conda install -c conda-forge -y cudatoolkit=11.8.0 && conda install -c nvidia -y cuda-compiler=12.2.2 && conda clean -y --all ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/opt/miniconda3/ @@ -242,7 +242,7 @@ ENV CUDA_MODULE_LOADING=LAZY RUN dwave install --all -y # Install 'ipopt' solver for 'Pyomo' -RUN conda install -c conda-forge ipopt==3.14.12 \ +RUN conda install -c conda-forge ipopt==3.14.13 \ && conda clean -y --all # We install need to install separately else fails to find numpy diff --git a/DockerfileLeanFoundationARM b/DockerfileLeanFoundationARM index 24d32debef0f..ebb437f73eef 100644 --- a/DockerfileLeanFoundationARM +++ b/DockerfileLeanFoundationARM @@ -183,9 +183,7 @@ RUN pip install --no-cache-dir \ jupyter-bokeh==3.0.7 \ imbalanced-learn==0.11.0 \ scikeras==0.12.0 \ - openai==0.28.1 \ - openai[embeddings]==0.28.1 \ - openai[wandb]==0.28.1 \ + openai==1.3.5 \ lazypredict==0.2.12 \ fracdiff==0.9.0 \ darts==0.24.0 \ @@ -204,18 +202,20 @@ RUN pip install --no-cache-dir \ Shimmy==1.3.0 \ FixedEffectModel==0.0.5 \ transformers==4.34.0 \ - langchain==0.0.316 \ + langchain==0.0.341 \ tensorflow-ranking==0.5.3 \ pomegranate==1.0.3 \ tigramite==5.2.3.1 \ MAPIE==0.7.0 \ - mlforecast==0.9.3 + mlforecast==0.9.3 \ + x-transformers==1.26.0 \ + Werkzeug==2.3.8 # Install dwave tool RUN dwave install --all -y # Install 'ipopt' solver for 'Pyomo' -RUN conda install -c conda-forge ipopt==3.14.12 \ +RUN conda install -c conda-forge ipopt==3.14.13 \ && conda clean -y --all # We install need to install separately else fails to find numpy From 6172d75f2bfab4a3bef21ec73c1c5892bd15432d Mon Sep 17 00:00:00 2001 From: Martin Molinero Date: Tue, 28 Nov 2023 12:40:50 -0300 Subject: [PATCH 2/2] Add Xtransformers test --- .github/workflows/virtual-environments.yml | 2 +- Tests/Python/PythonPackagesTests.cs | 31 +++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/virtual-environments.yml b/.github/workflows/virtual-environments.yml index 0f45a0211696..356736eb7caf 100644 --- a/.github/workflows/virtual-environments.yml +++ b/.github/workflows/virtual-environments.yml @@ -55,4 +55,4 @@ jobs: # Run Scikeras Python Package Test dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.ScikerasTest" --blame-hang-timeout 120seconds --blame-crash # Run Transformers - dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.Transformers" --blame-hang-timeout 120seconds --blame-crash \ No newline at end of file + dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.Transformers|XTransformers" --blame-hang-timeout 120seconds --blame-crash \ No newline at end of file diff --git a/Tests/Python/PythonPackagesTests.cs b/Tests/Python/PythonPackagesTests.cs index 01c7bb2cfb25..c035228f54b2 100644 --- a/Tests/Python/PythonPackagesTests.cs +++ b/Tests/Python/PythonPackagesTests.cs @@ -17,13 +17,42 @@ using System; using Python.Runtime; using NUnit.Framework; -using QuantConnect.Python; namespace QuantConnect.Tests.Python { [TestFixture, Category("TravisExclude")] public class PythonPackagesTests { + [Test, Explicit("Needs to be run by itself to avoid hanging")] + public void XTransformers() + { + AssertCode( + @" +import torch +from x_transformers import XTransformer + +def RunTest(): + model = XTransformer( + dim = 512, + enc_num_tokens = 256, + enc_depth = 6, + enc_heads = 8, + enc_max_seq_len = 1024, + dec_num_tokens = 256, + dec_depth = 6, + dec_heads = 8, + dec_max_seq_len = 1024, + tie_token_emb = True # tie embeddings of encoder and decoder + ) + + src = torch.randint(0, 256, (1, 1024)) + src_mask = torch.ones_like(src).bool() + tgt = torch.randint(0, 256, (1, 1024)) + + loss = model(src, tgt, mask = src_mask) # (1, 1024, 512) + loss.backward()"); + } + [Test] public void Functime() {