Comments (6)
Thanks. Yes, theta is updated for each task while psi_i only updated for corresponding task. Gradients are not calculated separately as you suspect, once we updated the theta and psi_i, in the inner loop using backward pass, in the outerloop only theta is updated using a weighted average of all task.
from itaml.
Thanks and i get it. And here l have another question. When i make the train and test in Minist, i find something strange about the accuracy after the meta test. The accuracy of the first task reach alomost 100 percent, and the accuracies of the second task , the third task and so on become lower and lower. It make me so confused and i can't find the answer in the code and paper. Can you explain it to me? THANKS
from itaml.
are you referring to this issue?
#10
from itaml.
Thanks. I get it. I have found out the reason of my issue. I wanna transform the method to a new dataset, but the number of pictures belonging to different tasks is unbalanced. Just for this, the accuracies corresponding to different tasks have big gap.
from itaml.
Here, sorry, i have to disturb you again. I have another question.When i read the code as:
main_learner=Learner(model=model,args=args,trainloader=train_loader, testloader=test_loader, use_cuda=use_cuda)
main_learner.learn()
memory = inc_dataset.get_memory(memory, for_memory)
acc_task = main_learner.meta_test(main_learner.best_model, memory, inc_dataset)
Here, i find the function Learner() doesn't use the memory message. And you use memory in meta-test. And when i read the paper, i find that when you train the model, you use both the new task and memory message. Can you explain it to me.
And my first question about the update of the theta and psi. When i read the code, i am also confused. Here i show the code of the outer update.
for i,(p,q) in enumerate(zip(model.parameters(), model_base.parameters())):
alpha = np.exp(-self.args.beta*((1.0*self.args.sess)/self.args.num_task))
ll = torch.stack(reptile_grads[i])
p.data = torch.mean(ll,0)*(alpha) + (1-alpha)* q.data
Here the p refers to the mode's whole parameter which can't match what you say,'in the outerloop only theta is updated using a weighted average of all task'.
from itaml.
No worries,
Learner takes the dataloader as the inputs, which is generated from here.
task_info, train_loader, val_loader, test_loader, for_memory = inc_dataset.new_task(memory)
the train_loader contains data from both new task and memory.
for the next part, the gradients are calculated only for the part of the fully connected layer. so only the classification parameters for the task will be updated.
Line 148 in e56e72b
And, about adding parameters, this was much faster. However, we can use the below part as well.
for i,(p,q) in enumerate(zip(model.parameters(), model_base.parameters())):
alpha = np.exp(-self.args.beta*((1.0*self.args.sess)/self.args.num_task))
ll = torch.stack(reptile_grads[i])
if(p.data.size()[0]==10 and p.data.size()[1]==256):
for ik in sessions:
p.data[2*ik[0]:2*(ik[0]+1),:] = ll[ik[1]][2*ik[0]:2*(ik[0]+1),:]*(alpha) + (1-alpha)* q.data[2*ik[0]:2*(ik[0]+1),:]
else:
p.data = torch.mean(ll,0)*(alpha) + (1-alpha)* q.data
from itaml.
Related Issues (19)
- a few question about the implementation HOT 8
- Nan Loss during training MNIST dataset HOT 2
- Why BCE is used instead of CE with Softmax? HOT 1
- Something strange in the Algorithm 1.. HOT 4
- What is the difference between two output of model? -->outputs2, outputs = model(inputs) HOT 1
- Training script for ImageNet-100 HOT 2
- Running without CUDA HOT 2
- Code for other methods
- Obviously catastrophic forgetting HOT 3
- AttributeError: type object 'args' has no attribute 'overflow' HOT 2
- A question about theta and task-specific phi HOT 1
- something wrong happends in training cifar10 HOT 3
- Where to check task accuracy and class accuracy? HOT 2
- Fair comparison HOT 2
- sys.argv[1] is out of range HOT 2
- train_mnist loss go to nan at Sess 3
- about adding parameters HOT 5
- about adding classes HOT 2
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 itaml.