internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: conan-io/conan-center-index

Issue:
Bump opentdf-client's zlib requirement to [>=1.2.11 <2] range



Discussion:

Resolving patch:
diff --git a/recipes/opentdf-client/all/conanfile.py b/recipes/opentdf-client/all/conanfile.py
--- a/recipes/opentdf-client/all/conanfile.py
+++ b/recipes/opentdf-client/all/conanfile.py
@@ -43,9 +43,9 @@ def _minimum_compilers_version(self):
         return {
             "Visual Studio": "17" if Version(self.version) < "1.1.5" else "15",
             "msvc": "193" if Version(self.version) < "1.1.5" else "191",
-            "gcc": "7.5.0",
+            "gcc": "7.5",
             "clang": "12",
-            "apple-clang": "12.0.0",
+            "apple-clang": "12",
         }
 
     def config_options(self):
@@ -64,21 +64,16 @@ def requirements(self):
         if Version(self.version) >= "1.5.0":
             self.requires("openssl/[>=3.1 <4]")
         else:
-            self.requires("openssl/1.1.1u")
+            self.requires("openssl/1.1.1w")
         # Uses magic_enum for 1.4.0 and newer
         if Version(self.version) >= "1.4.0":
             self.requires("magic_enum/0.8.2")
         self.requires("ms-gsl/2.1.0")
-        self.requires("nlohmann_json/3.11.1")
+        self.requires("nlohmann_json/3.11.2")
         self.requires("jwt-cpp/0.4.0")
-        self.requires("zlib/1.2.13")
-        # Use newer boost+libxml2 after 1.3.6
-        if Version(self.version) <= "1.3.6":
-            self.requires("boost/1.79.0")
-            self.requires("libxml2/2.9.14")
-        else:
-            self.requires("boost/1.82.0")
-            self.requires("libxml2/2.11.4")
+        self.requires("zlib/[>=1.2.11 <2]")
+        self.requires("boost/1.83.0")
+        self.requires("libxml2/2.11.4")
 
     def validate(self):
         if self.settings.compiler.get_safe("cppstd"):
@@ -98,7 +93,7 @@ def validate(self):
         # Disallow MT and MTd
         if is_msvc_static_runtime(self):
             raise ConanInvalidConfiguration(f"{self.name} can not be built with MT or MTd at this time")
-        
+
         if self.options.shared and self.settings.os == "Windows":
             raise ConanInvalidConfiguration(f"{self.name} does not currently support shared library on Windows")
 
@@ -164,3 +159,6 @@ def package_info(self):
             self.cpp_info.components["libopentdf"].requires.append("libarchive::libarchive")
         if Version(self.version) >= "1.4.0":
             self.cpp_info.components["libopentdf"].requires.append("magic_enum::magic_enum")
+
+        if self.settings.os in ["Linux", "FreeBSD"]:
+            self.cpp_info.system_libs.append("m")


Test patch:
Repository: conan-io/conan-center-index

Issue:
[package] opencolorio >= 2.2.0: wrong logic of minizp-ng options checks on macOS?
### Description

opencolorio recipe raises indirectly on macOS due to a check of minizip-ng with_zlib option which can't be satisfied on macOS by default (with_zlib option is removed on macOS when with_libcomp is enabled, which is the default value of minizip-ng recipe). See https://github.com/conan-io/conan-center-index/pull/15669#discussion_r1287511835

/cc @toge

### Package and Environment Details

N/A

### Conan profile

N/A

### Steps to reproduce

N/A

### Logs

N/A


Discussion:

Resolving patch:
diff --git a/recipes/opencolorio/all/conanfile.py b/recipes/opencolorio/all/conanfile.py
--- a/recipes/opencolorio/all/conanfile.py
+++ b/recipes/opencolorio/all/conanfile.py
@@ -90,7 +90,7 @@ def validate(self):
         # opencolorio>=2.2.0 requires minizip-ng with with_zlib
         if Version(self.version) >= "2.2.0" and \
             not self.dependencies["minizip-ng"].options.get_safe("with_zlib", False):
-            raise ConanInvalidConfiguration(f"{self.ref} requires minizip-ng with with_zlib = True.")
+            raise ConanInvalidConfiguration(f"{self.ref} requires minizip-ng with with_zlib = True. On Apple platforms with_libcomp = False is also needed to enable the with_zlib option.")
 
         if Version(self.version) == "1.1.1" and self.options.shared and self.dependencies["yaml-cpp"].options.shared:
             raise ConanInvalidConfiguration(f"{self.ref} requires static build yaml-cpp")


Test patch:
Repository: conan-io/conan-center-index

Issue:
[package] 7zip/22.01: Fails to build with C++17
### Description

I added 7zip/22.01 as a build_requires for one of my recipes. My profile uses C++17. The build fails.

I think options are:

1. Patch to build with C++17
2. Validate the std is c++14 or lower (or whatever the actual min requirement is)...hopefully reporting how to fix (override std of package in profile)

### Package and Environment Details

* Package Name/Version: 7zip/22.01
* Operating System+version: Windows
* Compiler+version: Visual Studio 2022
* Conan version: conan 2.0.13
* Python version: Python 3.11.5


### Conan profile

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

### Steps to reproduce

conanfile.txt
```
[requires]
7zip/22.01
```

`conan install . -pr:b my_profile -pr:h my_profile --build=*`

### Logs

[build.txt](https://github.com/conan-io/conan-center-index/files/12917419/build.txt)



Discussion:

Resolving patch:
diff --git a/recipes/7zip/19.00/conanfile.py b/recipes/7zip/19.00/conanfile.py
--- a/recipes/7zip/19.00/conanfile.py
+++ b/recipes/7zip/19.00/conanfile.py
@@ -90,6 +90,12 @@ def _patch_sources(self):
             os.chmod(fn, 0o644)
             replace_in_file(self, fn, "-MT", f"-{self.settings.compiler.runtime}")
             replace_in_file(self, fn, "-MD", f"-{self.settings.compiler.runtime}")
+            if self.version < Version("23.01"):
+                replace_in_file(self, fn, "-WX", "")
+
+                pfc = os.path.join(self.source_folder, "CPP", "7zip", "UI", "FileManager", "PanelFolderChange.cpp")
+                os.chmod(pfc, 0o644)
+                replace_in_file(self, pfc, r'L"\\"', r'static_cast<UString>(L"\\")')
 
     def build(self):
         self._patch_sources()


Test patch:
Repository: conan-io/conan-center-index

Issue:
[package] qt/5.15.11: missing plugin
### Description

QSvgPlugin and QSvgIconPlugin are not exposed.

### Package and Environment Details

* Package Name/Version: **qt/5.15.11**
* Operating System+version: **Windows 10**
* Compiler+version: **MSVC 193**
* Conan version: **conan 2.0.13**
* Python version: **Python 3.11.4**


### Conan profile

Host profile:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

Build profile:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows

### Steps to reproduce

Add this to CMakeLists.txt, configure will fail
```
target_link_libraries(${PROJECT_NAME} Qt5::QSvgIconPlugin Qt5::QSvgPlugin)
```

Add this to code, build will fail (given that above line is not in CMakeLists.txt)
```
Q_IMPORT_PLUGIN (QSvgPlugin);
Q_IMPORT_PLUGIN (QSvgIconPlugin);
```

### Logs

If import plugin is used
```
[build] main.obj : error LNK2019: symbole externe non résolu "struct QStaticPlugin const __cdecl qt_static_plugin_QSvgPlugin(void)" (?qt_static_plugin_QSvgPlugin@@YA?BUQStaticPlugin@@XZ) référencé dans la fonction "void __cdecl `dynamic initializer for 'staticQSvgPluginInstance''(void)" (??__EstaticQSvgPluginInstance@@YAXXZ) [C:\Users\fnadeau\git-github\qt-demo\build\main.vcxproj]
[build] main.obj : error LNK2019: symbole externe non résolu "struct QStaticPlugin const __cdecl qt_static_plugin_QSvgIconPlugin(void)" (?qt_static_plugin_QSvgIconPlugin@@YA?BUQStaticPlugin@@XZ) référencé dans la fonction "void __cdecl `dynamic initializer for 'staticQSvgIconPluginInstance''(void)" (??__EstaticQSvgIconPluginInstance@@YAXXZ) [C:\Users\fnadeau\git-github\qt-demo\build\main.vcxproj]
[build] C:\Users\fnadeau\git-github\qt-demo\build\Release\main.exe : fatal error LNK1120: 2 externes non résolus [C:\Users\fnadeau\git-github\qt-demo\build\main.vcxproj]
```

if target link is used

```
[cmake] CMake Error at CMakeLists.txt:24 (target_link_libraries):
[cmake]   Target "main" links to:
[cmake] 
[cmake]     Qt5::QSvgIconPlugin
[cmake] 
[cmake]   but the target was not found.  Possible reasons include:
[cmake] 
[cmake]     * There is a typo in the target name.
[cmake]     * A find_package call is missing for an IMPORTED target.
[cmake]     * An ALIAS target is missing.
```


Discussion:

Resolving patch:
diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py
--- a/recipes/qt/5.x.x/conanfile.py
+++ b/recipes/qt/5.x.x/conanfile.py
@@ -1253,6 +1253,8 @@ def _create_plugin(pluginname, libname, plugintype, requires):
 
         if self.options.qtsvg and self.options.gui:
             _create_module("Svg", ["Gui"])
+            _create_plugin("QSvgIconPlugin", "qsvgicon", "iconengines", [])
+            _create_plugin("QSvgPlugin", "qsvg", "imageformats", [])
 
         if self.options.qtwayland and self.options.gui:
             _create_module("WaylandClient", ["Gui", "wayland::wayland-client"])


Test patch:
Repository: conan-io/conan-center-index

Issue:
pcl:with_qhull=True does not set HAVE_QHULL
### What is your question?

Hi,

I've build pcl/1.13.1 with apple-clang 15.0 and pcl:with_qhull=True because I need pcl::ConcaveHull in my application. 
The absence of setting HAVE_QHULL prevents the include or linking with concave_hull.

My conanfile:
```
[requires]
    pcl/1.13.1

[generators]
    CMakeDeps
    CMakeToolchain
```
pcl:with_qhull is default True and it doesn't change if I add this to the options or not. 

In pcl_config.h.in:
`#cmakedefine HAVE_QHULL 1`

This should result in setting HAVE_QHULL in pcl_config.h, but:
`/* #undef HAVE_QHULL */`

Is there an option to set HAVE_QHULL?






Discussion:
@DevlBert Thank for reporting the case, I'll take a look. 

Resolving patch:
diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py
--- a/recipes/pcl/all/conanfile.py
+++ b/recipes/pcl/all/conanfile.py
@@ -574,6 +574,13 @@ def package_info(self):
         if self.settings.os == "Windows":
             common.system_libs.append("ws2_32")
 
+        if self.options.with_qhull:
+            self.cpp_info.defines.append('HAVE_QHULL=1')
+        if self.options.with_png:
+            self.cpp_info.defines.append('HAVE_PNG=1')
+        if self.options.with_cuda:
+            self.cpp_info.defines.append('HAVE_CUDA=1')
+
         # TODO: Legacy, to be removed on Conan 2.0
         self.cpp_info.names["cmake_find_package"] = "PCL"
         self.cpp_info.names["cmake_find_package_multi"] = "PCL"


Test patch:
Repository: conan-io/conan-center-index

Issue:
[question] Inconsistent usage of versions
### What is your question?

Hi,

I noticed that dependencies of recipes are updated in isolation without doing this consistently across conan-center-index.
This leads to version conflicts if I want to fork this repo and build the projects I need.

Example: 
libarchive uses version 5.4.4 of xz_utils
https://github.com/conan-io/conan-center-index/blob/262eec05f634fe235d75f9b22d434bbe3869a13b/recipes/libarchive/all/conanfile.py#L106

elfutils uses version 5.4.5 of xz_utils
https://github.com/conan-io/conan-center-index/blob/262eec05f634fe235d75f9b22d434bbe3869a13b/recipes/elfutils/all/conanfile.py#L76

The moment I use both in the same dependency tree, I have to adjust versions myself.
This creates a lot of effort to consume recipes, as this is just an example.

Can the versions be updated consistently across conan-center-index?


Discussion:

Resolving patch:
diff --git a/recipes/libarchive/all/conanfile.py b/recipes/libarchive/all/conanfile.py
--- a/recipes/libarchive/all/conanfile.py
+++ b/recipes/libarchive/all/conanfile.py
@@ -85,7 +85,7 @@ def requirements(self):
         if self.options.with_bzip2:
             self.requires("bzip2/1.0.8")
         if self.options.with_libxml2:
-            self.requires("libxml2/2.11.4")
+            self.requires("libxml2/2.12.2")
         if self.options.with_expat:
             self.requires("expat/2.5.0")
         if self.options.with_iconv:
@@ -103,11 +103,11 @@ def requirements(self):
         if self.options.with_lzo:
             self.requires("lzo/2.10")
         if self.options.with_lzma:
-            self.requires("xz_utils/5.4.4")
+            self.requires("xz_utils/5.4.5")
         if self.options.with_zstd:
             self.requires("zstd/1.5.5")
         if self.options.get_safe("with_mbedtls"):
-            self.requires("mbedtls/3.2.1")
+            self.requires("mbedtls/3.5.0")
 
     def validate(self):
         if self.settings.os != "Windows" and self.options.with_cng:


Test patch:
Repository: conan-io/conan-center-index

Issue:
[package] openssl/3.x.x: add enable_trace option
Please add `enable_trace` option into openssl recipe: https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-trace

By default, OpenSSL is built without tracing, see: https://www.openssl.org/docs/manmaster/man3/OSSL_trace_set_channel.html#Configure-Tracing which makes impossible to use some of the functions (which were added in OpenSSL 3.0)


Discussion:

Resolving patch:
diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py
--- a/recipes/openssl/3.x.x/conanfile.py
+++ b/recipes/openssl/3.x.x/conanfile.py
@@ -31,6 +31,7 @@ class OpenSSLConan(ConanFile):
         "386": [True, False],
         "capieng_dialog": [True, False],
         "enable_capieng": [True, False],
+        "enable_trace": [True, False],
         "no_aria": [True, False],
         "no_autoload_config": [True, False],
         "no_asm": [True, False],
@@ -386,6 +387,9 @@ def _configure_args(self):
         args.append("no-md2" if self.options.get_safe("no_md2", True) else "enable-md2")
         args.append("-DOPENSSL_TLS_SECURITY_LEVEL=%s" % str(self.options.tls_security_level))
 
+        if self.options.get_safe("enable_trace"):
+            args.append("enable-trace")
+
         if self.settings.os == "Neutrino":
             args.append("no-asm -lsocket -latomic")
 


Test patch:
Repository: conan-io/conan-center-index

Issue:
[package] poco/all: zlib missing transitive_headers option
### Description

When trying to use either [DeflatingStream.h](https://github.com/pocoproject/poco/blob/a92ab6d41dae6504b535cddaf671dcd18db85893/Foundation/include/Poco/DeflatingStream.h#L26) or [InflatingStream.h](https://github.com/pocoproject/poco/blob/a92ab6d41dae6504b535cddaf671dcd18db85893/Foundation/include/Poco/InflatingStream.h#L26) from Poco::Foundation there will be a compilation error about zlib.h not being found.

Specifically, this error only occurs on systems where zlib headers haven't been installed as system headers. It gets masked if zlib.h can be found in the system headers search path. I specifically noticed this issue when cross-compiling an application to windows

This can be fixed by adding `transitive_headers=True` to the `self.requires("zlib/[>=1.2.11 <2]")` line

### Package and Environment Details

* Package Name/Version: **poco/all**
* Operating System+version: **Windows**
* Compiler+version: **MSVC**
* Conan version: **conan 2.0.16**
* Python version: **Python 3.10.12**


### Conan profile

[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.runtime=dynamic
compiler.version=193
build_type=Release


### Steps to reproduce

Create a sample project which uses poco.

[requires]
poco/1.12.4

Include <Poco/DeflatingStream.h> or <Poco/InflatingStream.h>
Try to compile

### Logs

Missing logs, will edit issue with log output once I am back on my dev machine

<details><summary>Click to expand log</summary>

```
Put your log output here
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/poco/all/conanfile.py b/recipes/poco/all/conanfile.py
--- a/recipes/poco/all/conanfile.py
+++ b/recipes/poco/all/conanfile.py
@@ -149,7 +149,7 @@ def requirements(self):
             self.requires("pcre/8.45")
         else:
             self.requires("pcre2/10.42")
-        self.requires("zlib/[>=1.2.11 <2]")
+        self.requires("zlib/[>=1.2.11 <2]", transitive_headers=True)
         if self.options.enable_xml:
             self.requires("expat/2.5.0", transitive_headers=True)
         if self.options.enable_data_sqlite:


Test patch:
Repository: conan-io/conan-center-index

Issue:
[request] libtorrent/2.0.10
### Package Name/Version

libtorrent/2.0.10

### Changelog

https://github.com/arvidn/libtorrent/releases/tag/v2.0.10

### Context about the new update

The above-mentioned version is newly released by the upstream project and not yet available as a recipe.
Please add this version.



Discussion:

Resolving patch:
diff --git a/recipes/libtorrent/all/conanfile.py b/recipes/libtorrent/all/conanfile.py
--- a/recipes/libtorrent/all/conanfile.py
+++ b/recipes/libtorrent/all/conanfile.py
@@ -187,9 +187,9 @@ def package_info(self):
             self.cpp_info.components["libtorrent-rasterbar"].requires.append("libiconv::libiconv")
 
         if self.settings.os in ["Linux", "FreeBSD"]:
-            self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["dl", "pthread"]
+            self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["dl", "pthread", "m"]
         elif self.settings.os == "Windows":
-            self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["wsock32", "ws2_32", "iphlpapi", "dbghelp"]
+            self.cpp_info.components["libtorrent-rasterbar"].system_libs = ["wsock32", "ws2_32", "iphlpapi", "dbghelp", "mswsock"]
         elif self.settings.os == "Macos":
             self.cpp_info.components["libtorrent-rasterbar"].frameworks = ["CoreFoundation", "SystemConfiguration"]
 


Test patch:
Repository: conan-io/conan-center-index

Issue:
[package] zstd/1.5.6: unknown warning option
### Description

zstd recipe injects compile option that isn't supported by compiler.

### Package and Environment Details

* Package Name/Version: **zstd/1.5.6**
* Operating System+version: **Linux Debian Bullseye 11.9**
* Compiler+version: **clang 11**
* Docker image: **-**
* Conan version: **conan 2.3.0**
* Python version: **Python 3.9.2**


### Conan profile

[settings]
arch=x86_64
os=Linux
compiler=clang
compiler.version=11
compiler.cppstd=17
compiler.libcxx=libstdc++11
build_type=Release
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.build:compiler_executables={"c":"/usr/local/bin/cc","cpp":"/usr/local/bin/c++"}

### Steps to reproduce

conan install -pr:b default -pr:h default --build=missing conanfile.py

### Logs

There is the same warning for each *.c
<details><summary>Click to expand log</summary>

```
[1/64] Building C object lib/CMakeFiles/libzstd_static.dir/mnt/ccache/.conan2/p/b/zstd963d8984462ca/b/src/lib/common/debug.c.o
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.
```

</details>



Discussion:
@Nekto89 Hello! Conan avoids touching the compiler configuration provided by upstream. The error you see is related to the upstream project, not the package. I would suggest ask the the upstream about that warning.

Doing a quick search, I found is a "bug" in LLVM: https://bugs.llvm.org/show_bug.cgi?id=24979
> @Nekto89 Hello! Conan avoids touching the compiler configuration provided by upstream. The error you see is related to the upstream project, not the package. I would suggest ask the the upstream about that warning.
> 
> Doing a quick search, I found is a "bug" in LLVM: https://bugs.llvm.org/show_bug.cgi?id=24979

https://github.com/conan-io/conan-center-index/blob/e6836d3f7920e92efdcc6d3db46c35fdedc4916a/recipes/zstd/all/conanfile.py#L59C13-L59C71

> [`e6836d3`/recipes/zstd/all/conanfile.py#L59C13-L59C71](https://github.com/conan-io/conan-center-index/blob/e6836d3f7920e92efdcc6d3db46c35fdedc4916a/recipes/zstd/all/conanfile.py#L59C13-L59C71)

Ops! I'll take a look for a hotfix.

Resolving patch:
diff --git a/recipes/zstd/all/conanfile.py b/recipes/zstd/all/conanfile.py
--- a/recipes/zstd/all/conanfile.py
+++ b/recipes/zstd/all/conanfile.py
@@ -1,7 +1,6 @@
 from conan import ConanFile
 from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
 from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir, rm
-from conan.tools.microsoft import is_msvc
 import glob
 import os
 
@@ -55,8 +54,6 @@ def generate(self):
         tc.variables["ZSTD_BUILD_STATIC"] = not self.options.shared or self.options.build_programs
         tc.variables["ZSTD_BUILD_SHARED"] = self.options.shared
         tc.variables["ZSTD_MULTITHREAD_SUPPORT"] = self.options.threading
-        if not is_msvc(self):
-            tc.variables["CMAKE_C_FLAGS"] = "-Wno-maybe-uninitialized"
         tc.generate()
 
     def _patch_sources(self):


Test patch:
Repository: OpenNMT/OpenNMT-py

Issue:
About MultiGPU Usage
When i use Opennmt-py with MultiGPU, it will report the follow error:

> Traceback (most recent call last):
  File "train.py", line 356, in <module>
    main()
  File "train.py", line 352, in main
    trainModel(model, trainData, validData, dataset, optim)
  File "train.py", line 234, in trainModel
    train_loss, train_acc = trainEpoch(epoch)
  File "train.py", line 198, in trainEpoch
    outputs = model(batch)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 206, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/data_parallel.py", line 61, in forward
    outputs = self.parallel_apply(replicas, inputs, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/data_parallel.py", line 71, in parallel_apply
    return parallel_apply(replicas, inputs, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/parallel/parallel_apply.py", line 45, in parallel_apply
    raise output
ValueError: lengths array has incorrect size

But in Single GPU, it has no problem, is it a bug or other problem?


Discussion:

Resolving patch:
diff --git a/onmt/Dataset.py b/onmt/Dataset.py
--- a/onmt/Dataset.py
+++ b/onmt/Dataset.py
@@ -68,6 +68,10 @@ def wrap(b):
             b = Variable(b, volatile=self.volatile)
             return b
 
+        # wrap lengths in a Variable to properly split it in DataParallel
+        lengths = torch.LongTensor(lengths).view(1, -1)
+        lengths = Variable(lengths, volatile=self.volatile)
+
         return (wrap(srcBatch), lengths), wrap(tgtBatch), indices
 
     def __len__(self):
diff --git a/onmt/Models.py b/onmt/Models.py
--- a/onmt/Models.py
+++ b/onmt/Models.py
@@ -30,7 +30,8 @@ def load_pretrained_vectors(self, opt):
 
     def forward(self, input, hidden=None):
         if isinstance(input, tuple):
-            emb = pack(self.word_lut(input[0]), input[1])
+            lengths = input[1].data.view(-1).tolist() # lengths data is wrapped inside a Variable
+            emb = pack(self.word_lut(input[0]), lengths)
         else:
             emb = self.word_lut(input)
         outputs, hidden_t = self.rnn(emb, hidden)
diff --git a/train.py b/train.py
--- a/train.py
+++ b/train.py
@@ -209,7 +209,7 @@ def trainEpoch(epoch):
             report_loss += loss
             report_num_correct += num_correct
             report_tgt_words += num_words
-            report_src_words += sum(batch[0][1])
+            report_src_words += batch[0][1].data.sum()
             total_loss += loss
             total_num_correct += num_correct
             total_words += num_words


Test patch: