Comments (3)
This is expected behavior. Your dataset contains image
as an upvalue, which means you're trying to serialize the full image
package. The image
package contains C-code that cannot be serialized. Hence the error.
Try moving the require 'image'
into the load
closure.
from torchnet.
Ok I can save my dataset in the main thread, then load it in closure and add some transformations.
Thanks :)
from torchnet.
Removing local image
solved the issue. Because image isn't anymore an upvalue.
local tnt = require 'torchnet'
require 'image'
local mode = 'train'
local mnist = require 'mnist'
local dataset = mnist[mode .. 'dataset']()
local listdataset = tnt.ListDataset{
list = torch.range(1, dataset.data:size(1)):long(),
load = function(idx)
return {
input = image.scale(dataset.data[idx],10,10),
target = torch.LongTensor{dataset.label[idx] + 1},
}
end,
}
torch.save('image.scale', image.scale) -- works
torch.save('listdataset.tnt', listdataset) -- works
or
local tnt = require 'torchnet'
local image = require 'image'
local scale = image.scale -- an upvalue -> serialized
-- scale = image.scale -- not an upvalue
local mode = 'train'
local mnist = require 'mnist'
local dataset = mnist[mode .. 'dataset']()
local listdataset = tnt.ListDataset{
list = torch.range(1, dataset.data:size(1)):long(),
load = function(idx)
return {
input = scale(dataset.data[idx],10,10),
target = torch.LongTensor{dataset.label[idx] + 1},
}
end,
}
torch.save('image.scale', image.scale) -- works
torch.save('listdataset.tnt', listdataset) -- works
from torchnet.
Related Issues (20)
- Document uncorrect about "transform.perm"
- for ListDataset, add an onComplete argument HOT 2
- OptimEngine.test not implemented HOT 2
- fatal thread panic on parallelDatasetIterator HOT 1
- Improve ParallelDatasetIterator documentation HOT 13
- How can i use MSE criterion? HOT 5
- IndexedDataset using string as index for large dataset HOT 4
- returning vector in ListDataset problem. HOT 2
- This error is unclear - what is the problem with my code that is causing this? HOT 3
- Segmentation fault (core dumped) HOT 8
- Bug report: not entering into iterator until thorough depth. HOT 2
- ClassErrorMeter throwing size mismatch error HOT 1
- meter.MultilabelConfusionMeter invalid argument error HOT 1
- some bugs of transform.merge() HOT 1
- bug in transform.tablemergekeys() HOT 1
- Unable to install qlua, and therefore: qlua: module 'torchnet' not found HOT 1
- Hi, I doubt that whether I can use torchnet in win10 64x. Could anybody tell me? HOT 2
- "not enough memory" with small dataset when nthread>1 for ParallelDatasetIterator HOT 4
- How to add torchnet to a custom package on kaggle HOT 1
- RecursionError with meter.ConfusionMeter
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 torchnet.