Add a custom hook to fetch the connections field of the policy object

Details

Add a custom hook to fetch the connections field of the policy object.
Fixed Issues

$ https://github.com/Expensify/App/issues/41277
PROPOSAL: N/A
Tests

Can be tested on a PR that uses this change.
Offline tests

N/A
QA Steps

NO QA
PR Author Checklist

[x] I linked the correct issue in the ### Fixed Issues section above
[x] I wrote clear testing steps that cover the changes made in this PR

[x] I added steps for local testing in the Tests section
[x] I added steps for the expected offline behavior in the Offline steps section
[x] I added steps for Staging and/or Production testing in the QA steps section
[x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
[x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
[x] I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).

[x] I included screenshots or videos for tests on all platforms
[x] I ran the tests on all platforms & verified they passed on:

[x] Android: Native
[x] Android: mWeb Chrome
[x] iOS: Native
[x] iOS: mWeb Safari
[x] MacOS: Chrome / Safari
[x] MacOS: Desktop

[x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
[x] I followed proper code patterns (see Reviewing the code)

[x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
[x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
[x] I verified that comments were added to code that is not self explanatory
[x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
[x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method

[x] If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:

[x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
[x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
[x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
[x] I verified the JSDocs style guidelines (in STYLE.md) were followed

[x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
[x] I followed the guidelines as stated in the Review Guidelines
[x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
[x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
[x] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
[x] I verified that if a function's arguments changed that all usages have also been updated correctly
[x] If any new file was added I verified that:

[x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory

[x] If a new CSS style is added I verified that:

[x] A similar style doesn't already exist
[x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))

[x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
[x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
[x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
[x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
[x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:

[x] I verified that all the inputs inside a form are aligned with each other.
[x] I added Design label and/or tagged @Expensify/design so the design team can review the changes.

[x] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
[x] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

Android: mWeb Chrome

iOS: Native

iOS: mWeb Safari

MacOS: Chrome / Safari

MacOS: Desktop

is my review required? i think not. code LGTM

While I do prefer hooks over the HOC we have, I have to ask why are we needing this hook if we have the HOC? :P

@aldo-expensify
We need the connections data on Categories and Tags pages, too. However, if we use the existing HOC withPolicyConnections, we will block these pages from being displayed when the device is offline, breaking the existing offline pattern.
What we want to do on these pages is that we fetch the connections data while not blocking these screens while the connections data is being fetched or while the device is offline.
So, we need a custom hook without the blocking rendering logic of the HOC.

:hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

🚀 Deployed to staging by https://github.com/aldo-expensify in version: 1.4.69-0 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅

@aldo-expensify
We need the connections data on Categories and Tags pages, too. However, if we use the existing HOC withPolicyConnections, we will block these pages from being displayed when the device is offline, breaking the existing offline pattern.

@hayata-suenaga
Thinking again about this, we already call a command when we open the "Category" pages: OpenPolicyCategoriesPage. Using this hook will make us do two requests when you open the Category page, so it goes against 1:1:1. Why didn't we add the connections to OpenPolicyCategoriesPage's response?

🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.69-2 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅

Thinking again about this, we already call a command when we open the "Category" pages: OpenPolicyCategoriesPage. Using this hook will make us do two requests when you open the Category page, so it goes against 1:1:1. Why didn't we add the connections to OpenPolicyCategoriesPage's response?

But we already have this kind of pattern, don't we? On some pages, we try to get several Onyx keys, and in my understanding, if the Onyx value doesn't exist, the front end tries to fetch missing data?

@aldo-expensify, so upon examining the Auth code, we're already returning the connections field of policy as it uses Policy::getAsOnyxUpdate that returns the whole policy object.
I double-confirmed that by looking at the payload of OpenPolicyCategoriesPage Web-E command. So we actually didn't need to fetch the connections data separately at all 😅.

I'll remove the hook from the categories page. Also, as other workspace pages probably use the same method on the Auth side, there is really no need for the custom hook usePolicyConnections. I'll delete that from the App code.

I'll remove the hook from the categories page. Also, as other workspace pages probably use the same method on the Auth side, there is really no need for the custom hook usePolicyConnections. I'll delete that from the App code.

Sounds good, thanks for investigating!


Local penalization

Issue #, if available: #48
Description of changes: Added the following components:

Local penalization acquisition function
Local penalization candidate point calculator
Example loop using local penalization
Acquisition function that takes log of a different acquisition function as the local acquisition works by summing logs of acquisitions rather than multiplying acquisitions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Codecov Report

Merging #56 into develop will increase coverage by 0.1%.
The diff coverage is 81.81%.

@@            Coverage Diff             @@
##           develop      #56     +/-   ##
==========================================
+ Coverage     81.2%   81.31%   +0.1%
==========================================
  Files           62       66      +4
  Lines         1532     1664    +132
  Branches       154      160      +6
==========================================
+ Hits          1244     1353    +109
- Misses         253      274     +21
- Partials        35       37      +2

Impacted Files
Coverage Δ

.../examples/local_penalization_batch_optimization.py
0% <0%> (ø)

...an_optimization/acquisitions/local_penalization.py
92.59% <92.59%> (ø)

...esian_optimization/acquisitions/log_acquisition.py
93.75% <93.75%> (ø)

...sian_optimization/local_penalization_calculator.py
95.55% <95.55%> (ø)

emukit/core/acquisition.py
91.8% <0%> (+1.63%)
:arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a43c47...03c954f. Read the comment docs.

Broken due to merging #45


Revert TTT for HC Maximizer

Since Maximizer (or something it calls) doesn't properly parse the formula in modifiers.txt and detects the Time-Twitching Toolbelt as a Free Pull, it causes unexpected aborts in HC runs.
Revert modifiers.txt until it's fixed.

You need to also add back the code that was removed from Modifiers, or this won't be seen as a free pull ever (not that the TTT has been around lately)

Doesn't the quest manager resolve this?  Looking at this, I'm not sure why we need anything else.
The same code that sets the timeTowerAvailable sets the free pull setting.  I'm thinking all the code that got yanked out was unnecessary.
Of course, I can't really test this live.
public static void handleTimeTower(final boolean available) {
   if (Preferences.getBoolean("timeTowerAvailable") == available) {
     return;
   }

   Preferences.setBoolean("timeTowerAvailable", available);

   // time-twitching toolbelt is a free pull if the time tower is
   // available. Place it in correct storage list.

   Modifiers.getModifiers("Item", "time-twitching toolbelt");
   AdventureResult toolbelt = ItemPool.get(ItemPool.TIME_TWITCHING_TOOLBELT, 1);
   List<AdventureResult> source = available ? KoLConstants.storage : KoLConstants.freepulls;
   List<AdventureResult> dest = available ? KoLConstants.freepulls : KoLConstants.storage;
   int index = source.indexOf(toolbelt);
   if (index > -1) {
     AdventureResult item = source.get(index);
     source.remove(item);
     dest.add(item);
   }

   ConcoctionDatabase.setRefreshNeeded(false);
 }

There's also StorageRequest.isFreePull. I don't know which the maximizer uses: can you confirm that calling isFreePull on the belt returns true if handleTimeTower(true) is called?

Sounds like an opportunity for me to make a test case. :)


Clean document/data in default mutators.

Makes submission of dates possible, as the clean function converts types!
I am not entirely sure if this is the right place to put it, but hey, it works and I didn't want to chain it in more centrally, as checking is not always desired.
(Maye we should make checking optional?)

Oh so you mean if you submit a date string for a Date field for example? I suspect in that case the GraphQL layer would still throw an error though…
Generally I'm a bit hesitant to add any "magic" cleaning step that might modify documents into something the user doesn't necessarily expect so I'm not 100% sure about that to be honest. What if we just let user add it in a callback instead? Maybe make it easier by passing the schema as a callback option?

Graphql doesn't complain. I did open this PR because I need it for submitting dates with autoform and i didn't want to write a helper for every date field.

Good idea with that callback. The schema already is part of the context if I am not mistaken.

Actually it wasn't, but I just added it.

Is this still relevant?

No, I think we can close it.


Can I use it for production?

Can I use it for production?

@0x457 Sure, IUP is developed and used for many years, and there are still many very complex UI apps that use IUP and are maintained. You just need to follow the documentation, but that is the same for every UI toolkit. The new release is expected to happen soon, with some bug fixes. Go bindings however do not include support for any additional controls, just core.
I wish development is faster though, i.e. I would like to see legacy systray in Linux be replaced with a modern one, table/list view is also on TODO list, etc. but I cannot help with that. Perhaps moving out to GitHub would be beneficial for the IUP project, I didn't see a discussion about that, maybe they have some reasons, or they just don't have the time.


Example of DCGAN

Hi, I would like to contribute a DCGAN example to dlib.
I have implemented a version of Pytorch DCGAN for C++.
However, I would need some guidance with some things I don't know how to do. I am wondering on how I should proceed. Should I attach my current code here (around 150 lines), or make a pull request, even if the code is not able to learn anything? Maybe @edubois can help out, since he stated that he managed to make it work on https://github.com/davisking/dlib/issues/1261
Thanks for your hard work on dlib.

I'm still working on this... I'm going to write about the network architecture

loss_binary_log
discriminator
generator
input

Here's what they look like:
// the MNIST input image size
constexpr size_t input_size = 28;
// some helper definitions for the noise generation
constexpr size_t noise_size = 100;
using noise_t = std::array<matrix<double, 1, 1>, noise_size>;
// convolution and transposed convolution with custom padding
template<long num_filters, long kernel_size, int stride, int padding, typename SUBNET>
using conp = add_layer<con_<num_filters, kernel_size, kernel_size, stride, stride, padding, padding>, SUBNET>;
template<long num_filters, long kernel_size, int stride, int padding, typename SUBNET>
using contp = add_layer<cont_<num_filters, kernel_size, kernel_size, stride, stride, padding, padding>, SUBNET>;
// the generator
template<typename SUBNET>
using generator_type =
    htan<contp<1, 4, 2, 1,
    relu<bn_con<contp<64, 4, 2, 1,
    relu<bn_con<contp<128, 3, 2, 1,
    relu<bn_con<contp<256, 4, 1, 0,
    SUBNET>>>>>>>>>>>;
// the discriminator
template<typename SUBNET>
using discriminator_type =
    loss_binary_log<
    affine<conp<1, 3, 1, 0,
    prelu<bn_con<conp<256, 4, 2, 1,
    prelu<bn_con<conp<128, 4, 2, 1,
    prelu<conp<64, 4, 2, 1,
    SUBNET>>>>>>>>>>>;
// and the whole network
using net_type =
    discriminator_type<
    // tag5 gets the mask from tag1, multiplies it by the noise and adds it to the image
    tag5<add_prev2<mult_prev4<extract<input_size * input_size * 2, 1, input_size, input_size, skip1<
    // tag4 generates an image from the noise
    tag4<generator_type<
    // tag3 gets the noise from tag1
    tag3<extract<input_size * input_size, 100, 1, 1, skip1<
    // tag2 gets the image from tag1
    tag2<extract<0, 1, input_size, input_size,
    // tag1 contains the image, the noise and a mask
    tag1<input<std::array<matrix<float>, 3>>>
    >>>>>>>>>>>>>;

I know the architecture looks a bit weird, but the main idea is that the input has 3 channels:

a real image
random noise
a mask (zeros or ones)

Then, when I train with real images or random noise I set the mask to ignore the input I don't care about.
The main problem I face is when I want to back propagate the error with real images, where the discriminator is not involved, I don't know how to stop the back propagation in tag5. Maybe using visit_layers_until_tag, but I haven't managed to make it work.
By the way, the network trains a pretty good discriminator, which after a few iterations has a loss of around 10e-9, but the generator sucks...
Any help or guidance is appreciated, but I will continue digging :)

You might be better off with two separate net objects and to alternate
between training them.

Thanks for the suggestion, that was my first approach, but I couldn't make it work.
I'll give it another try :)

Hi @arrufat, have you please finally published a GAN network using DLIB on your GitHub home page? Btw, thank you for the definition of the Resxxx networks you give, it is very useful and I am currently computing some models that could be useful to the community (e.g. gender and age). I will submit them to @davisking if the results obtained are interesting, in order to enhance the current framework.

@Cydral, yes, that's the whole point of this, I want to make a working DCGAN example and share it with everyone, but first, and most importantly, I need to get it working, which doesn't seem trivial. As soon as I got something, I'll update this issue.
Also, thanks for your kind works on my ResNet implementations. I want to simplify the code a little bit, mostly by defining the models as templates that depend only on bn_con or affine so that I don't have to duplicate models for training and inference. Here's what I have in mind, but still thinking about it:
namespace resnet50
{
    // resnet backbone definition goes here
    template<template<typename> class BN>
    using model = loss_multiclass_log<fc<1000, backbone<BN, input_rgb_image>>>

    using train = model<bn_con>
    using infer = model<affine>
}

Then you could use it in your own code like:
resnet50::train net;

or
resnet50::infer net;

Hi @arrufat, it does indeed sound good and it may actually avoid overwriting a model with the  part as it has happened to me in the past! For the models I would like to propose, I work more on layer reduction, the idea being to have so-called minimalist but nevertheless effective models. I already did lots of tests using Resnet-18 and I think I will also try a Resnet-12 type, also by minimizing the size of the input image as much as possible.
For the DCGAN, I considered what you reported and found the approach interesting but reinjecting the loss value into the network seems difficult in this manner.
On my side, I'm trying to see if the loss function (e.g. loss_multiclass_log_per_pixel) could not be modified to include a network (discriminator) on the one hand and if the output value of this network could simply not be returned by the loss function for the weight adjustment, on the other hand.
According to the Dlib implementation, because the loss function has both the current/target image and the input image, training the discriminator at this level should be possible, allowing to maintain the current loss back-propagation mechanism. Does that seem appropriate?

That seems an odd choice, but maybe not weirder that my joint network architecture, let's see how it turns out.

I saw Davis' comment and it is certain that building two separate networks and alternating learning and inference (for the discriminator) by forwarding the output value to the generator is certainly easier. I'm still looking for a way to do that by reusing Dlib's existing primitives but it's not so easy for me. At least, we have a U-Net model that can probably be reused for the generator (https://github.com/davisking/dlib/blob/master/examples/dnn_semantic_segmentation_ex.h)...

Here's my work in process for the DCGAN implementation with two separate networks, but it doesn't work (yet).
It's what I tried first, before merging them both. https://gist.github.com/arrufat/062b8847b7f87465efd96d627dadf1ad

Thanks for sharing, my mate! I leave a comment attached to this code.

Hi @arrufat , I updated the code here: https://gist.github.com/Cydral/92be4e848551429ec1a6919d6d813c08.
I used another approach for the formalization of the G and D networks but at the end, it's very close to your own code. This seems to work overall... except for the back propagation of the loss tensor values. Maybe could @davisking really advise us on that?
By the way, it would only work for a single plane for the moment; I had initially made a version to infer a RGB image but I have a problem to get a 3D matrix formalizing a reconstructed image from the generator outputs. Maybe it is necessary to extract each scalar values of k and rebuild a RGB image from these different planes (I haven't tried yet)?

If you are trying to backprop from one network into another you want to get
the gradients via get_final_data_gradient(), not get_gradient_input(),
since you want the gradients with respect to the inputs to the network,
which is not what get_gradient_input() is giving you.
get_gradient_input() is the input to the backprop procedure for a
network.  It's not an output of the network.
On Thu, Jul 25, 2019 at 4:10 AM Cydral<EMAIL_ADDRESS>wrote:

Hi @arrufat https://github.com/arrufat , I updated the code here:
https://gist.github.com/Cydral/92be4e848551429ec1a6919d6d813c08.
I used another approach for the formalization of the G and D networks but
at the end, it's very close to your own code. This seems to work overall...
except for the back propagation of the loss tensor values. Maybe could
@davisking https://github.com/davisking really advise us on that?
By the way, it would only work for a single plane for the moment; I had
initially made a version to infer a RGB image but I have a problem to get a
3D matrix formalizing a reconstructed image from the generator outputs.
Maybe it is necessary to extract each scalar values of k and rebuild a RGB
image from these different planes (I haven't tried yet)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/davisking/dlib/issues/1776?email_source=notifications&email_token=ABPYFR23EJ3P6ND4RDMR4ZTQBFNWJA5CNFSM4HOKEY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2YWVNQ#issuecomment-514943670,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPYFR7EGAFA7ALMYKOBPT3QBFNWJANCNFSM4HOKEY5A
.

Thank you for your advice. We will continue our work on this basis.

Sorry to bother, but I've been reading the documentation and trying several things, and when I try to backprop from one net into the other:
dis_trainer.train_one_step(mini_batch_fake_samples, mini_batch_fake_labels);
resizable_tensor loss_fake = discriminator.subnet().get_final_data_gradient();
generator.subnet().back_propagate_error(loss_fake);

I get this:
Error detected at line 662.
Error detected in file _deps/dlib-src/dlib/cuda/cudnn_dlibapi.cpp.
Error detected in function void dlib::cuda::batch_normalize_conv_gradient(double, const dlib::tensor&, const dlib::tensor&, const dlib::tensor&, const dlib::tensor&, const dlib::tensor&, dlib::tensor&, dlib::tensor&, dlib::tensor&).

Failing expression was src.k() == (long)means.size().

I know it's my fault and I am using the API incorrectly, but I can't figure out how to do it properly...

After reading the documentation more thoroughly, I think I've found a way to properly backpropagate the loss from one network to the other.
// get the loss after inputting images from the generator using noise samples
const resizable_tensor& out_fake = discriminator.subnet().subnet().get_final_data_gradient();
// convert the input noises into a tensor by using the generator input layer (13, in my case)
resizable_tensor noises_tensor;
layer<13>(generator).to_tensor(noises.begin(), noises.end(), noises_tensor);
// make a forward call
generator(noises)
generator.subnet().subnet().back_propagate_error(noises_tensor, out_fake);

All this works until the network is serialized:
Error detected at line 1522.
Error detected in file _deps/dlib-src/dlib/cuda/cudnn_dlibapi.cpp.
Error detected in function void dlib::cuda::tanh_gradient(dlib::tensor&, const dlib::tensor&, const dlib::tensor&).

Failing expression was have_same_dimensions(dest,gradient_input) == true && have_same_dimensions(dest,grad) == true.

However, I don't know if there might be a more straightforward way to backpropagate the loss from one network to the other.
Suggestions are welcome :)

back_propagate_error() requires that have_same_dimensions(gradient_input, get_output())==true.  Are you sure that out_fake has the same dimensions as generator.subnet().subnet().get_output()?

Thanks for the reply.
I've just verified and they have the same size:
const resizable_tensor& out_fake = discriminator.subnet().subnet().get_final_data_gradient();
std::cout << "out_fake: " <<
              out_fake.num_samples () << "x" <<
              out_fake.k() << "x" <<
              out_fake.nr() << "x" <<
              out_fake.nc() << std::endl;

const resizable_tensor& out_gen = generator.subnet().subnet().get_output();
std::cout << "gen_fake: " <<
              out_gen.num_samples () << "x" <<
              out_gen.k() << "x" <<
              out_gen.nr() << "x" <<
              out_gen.nc() << std::endl;

the output is:
out_fake: 8x1x28x28
gen_fake: 8x1x28x28

I will update the code on my github fork later.

Thanks for the reply.
I've just verified and they have the same size:
const resizable_tensor& out_fake = discriminator.subnet().subnet().get_final_data_gradient();
std::cout << "out_fake: " <<
              out_fake.num_samples() << "x" <<
              out_fake.k() << "x" <<
              out_fake.nr() << "x" <<
              out_fake.nc() << std::endl;

const resizable_tensor& out_gen = generator.subnet().subnet().get_output();
std::cout << "gen_fake:  " <<
              out_gen.num_samples() << "x" <<
              out_gen.k() << "x" <<
              out_gen.nr() << "x" <<
              out_gen.nc() << std::endl;

the output is:
out_fake: 8x1x28x28
out_gen:  8x1x28x28

I will update the code to my github fork soon.

You can find a compilable example here.

You can find a compilable example here.

Thanks for sharing the code – I too am very excited about this new development!
Looks to me like synchronizing the network being trained to disk may empty out_fake = discriminator.subnet().subnet().get_final_data_gradient().
With this small sanity check, was at least able to train much longer: https://github.com/reunanen/dlib/commit/ac6d8e7fad329d5a75c8619b710aa1832b870d92

I guess this line is emptying also the gradient: https://github.com/arrufat/dlib/blob/592361ed818d04fd1f52522757e593a6bb10b550/dlib/dnn/trainer.h#L1009-L1010

So, I've realized that I might have been back-propagating the error without updating the network parameters.
I've updated the code to perform these actions:
// convert the noises array to a tensor
resizable_tensor noises_tensor;
generator.to_tensor(noises.begin(), noises.end(), noises_tensor);
// forward it to the network
generator.subnet().forward(noises_tensor);
// back-propagate the error with the loss from the discriminator
generator.subnet().subnet().back_propagate_error(noises_tensor, out_fake);
// update the network parameters using the the discriminator network solvers
auto solvers = gen_trainer.get_solvers();
generator.subnet().subnet().update_parameters(make_sstack<adam>(solvers), gen_trainer.get_learning_rate());

It's not working yet, but I'm not 100% I'm doing it right.
Anyway I feel we're getting closer :)

Oh yeah, that part is important :)

With the latest commit I've managed to speed up the training and generate images like this one:

But I'm running out of ideas on how to make it work well... right now I can't see what I'm doing wrong :P

With the latest update, I've managed to speed up the training and generate images like this one:

But I'm running out of ideas on how to make it work well... right now I can't see what I'm doing wrong...

Unluckily I haven't been able to make this work... I've read the docs several times and I can't see what I am doing wrong.
If somebody has some spare time to look at the code, I would really appreciate it :)

It's very possible it's not a software issue.  Take it from someone who has
attempted to reproduce many many papers, it's often hard and often things
don't work the way paper authors suggest.  There are often important tricks
they leave out that are needed to make things work right, or the method is
very narrow and only works on the data they used, rather than on more
general stuff, despite implicit suggestions to the contrary in the paper.
You should start out by trying to exactly reproduce some published setup,
so same data and settings and everything, if you can.
On Sun, Nov 10, 2019 at 3:43 AM Adrià Arrufat<EMAIL_ADDRESS>wrote:

Unluckily I haven't been able to make this work... I've read the docs
several times and I can't see what I am doing wrong.
If somebody has some spare time to look at the code, I would really
appreciate it :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/davisking/dlib/issues/1776?email_source=notifications&email_token=ABPYFR7GMJMSHAQ42GKA2NLQS7CTXA5CNFSM4HOKEY5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUYKOA#issuecomment-552174904,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABPYFR23LVDWFSNU5FVPPCTQS7CTXANCNFSM4HOKEY5A
.

Thank you for your suggestion.
I have also some experience implementing papers and many times there are some tricks that the authors missed (on purpose?), so making it work is not usually straightforward.
For this reason I wanted to implement the DCGAN code from the PyTorch CPP examples.
I am using same the same dataset, optimizer, parameters and batch size.
I will debug the PyTorch example more thoroughly to make sure I didn't miss any detail.
However, I would say that I'm not sure I am updating the network appropriately. I did it the way I understood from the documentation and how it's used in dlib itself, but I've never seen it being used to update a network with gradients coming from another one.
I will let you know if I make some progress, so that other people that want to create a GAN using dlib don't have to struggle too much :)

First of all, thank you for your contribution.
there were some fixes.
add leakyRelu,
Added BinaryCrossEntorpyLoss function,
modified  DCGan Training Sequence.
And if you look at the pytorch c ++ code, you will finally learn the final gradient of the generator in the discriminator.
Rather than learning the final gradient for the Discriminator's training, it's important to learn the gradient for the Test_loss.
this code is
dis_trainer.test_one_step(mini_batch_fake_samples, mini_batch_fake_labels);
resizable_tensor noises_tensor;
layer<13>(generator).to_tensor(noises.begin(), noises.end(), noises_tensor);
generator(noises);
const resizable_tensor& out_fake = discriminator.subnet().subnet().get_final_data_gradient();

above this is very important.
I'll clean up the source now and put it on my repositorie.
Thank you for your contribution.
Let's continue to develop Dlib together.
this is result of mnist dcgan.

I just updated the dcgan example code in my repository
Please contact me if you there is a problem!
https://github.com/intellizd/dlib-dcgan_example
thanks

Awesome.  Super cool to see this working :)

Agreed, thank you so much for looking into this @intellizd
Will you submit a PR? I think you should :)

I usually use the dlib platform frequently.
This time I'm glad to contribute because of the dcgan issue.
This time it's a mnist dcgan sample, but I'd like to try various new things through dlib.
I want to be a contributor to various features of dlib.
First
I want to develop mnist GAN to cifar GAN.
Davis, I would appreciate it if you consider me a contributor.

@intellizd that would be awesome :)
You should make the mnist DCGAN thing into a little example so other people can learn from it.  That would be super cool and educational for many users.

@davisking ,Thank you for the compliment.
I learned a lot from this DC-GAN issue.
thank you to @arrufat for making this issue.
I recommend that DLIB draw up a development road-map like any other Deep Learning Frameworks.
Why don't we develop that roadmap together with contributors who are willing to participate?

We can make a bunch of issues that are "help wanted".  There are already a few.  I generally encourage others to work on whatever interests them.  But some obvious things to do are to add new layer types like dilated convolution.  There are a few things like that that have been added to cuDNN but not yet made part of dlib's layer catalogue.  Burning down that list is a good place to start.

@davisking  thanks for your comment about dlib's direction.
I'll follow your direction.

I just updated the dcgan example code in my repository
Please contact me if you there is a problem!
example code is
https://github.com/intellizd/dlib-dcgan_example/blob/master/examples/dnn_dcgan_train_ex.cpp
dcgan-dlib whole source is
https://github.com/intellizd/dlib-dcgan_example
thanks

Are you sure of the part of code:
resizable_tensor noises_tensor;
layer<13>(generator).to_tensor(noises.begin(), noises.end(), noises_tensor);
generator(noises);
const resizable_tensor& out_fake = discriminator.subnet().subnet().get_final_data_gradient();
... because networks are different:
out_fake: 128x1x96x96
noises_tensor:  128x100x1x1
In such a situation, an assert is normally raised:
Failing expression was have_same_dimensions(dest,gradient_input) == true && have_same_dimensions(dest,grad) == true

@Cydral That's right.
Perhaps the generator and discriminator layers should be paired and matched.
such like generator's htan <-> discrimminator's conp
Have you changed  layer structure?
If you changed it, show me the structure.

@intellizd, not really. I used the definition to align my own code with fixes you reported previous as below;
using generator_type = loss_binary_log<fc_no_bias<1, 	htan<contp<1, 4, 2, 1, 	relu<bn_con<contp<64, 4, 2, 1, 	relu<bn_con<contp<128, 3, 2, 1, 	relu<bn_con<contp<256, 4, 1, 0, 	input<noise_t> 	>>>>>>>>>>>>>;
using discriminator_type = loss_binary_log<fc_no_bias<1, 	conp<1, 3, 1, 0, 	relu<bn_con<conp<256, 4, 2, 1, 	relu<bn_con<conp<128, 4, 2, 1, 	relu<conp<64, 4, 2, 1, 	input<matrix<gray_pixel>> 	>>>>>>>>>>>;
I only set the image size to 96pix.
In a previous comment, you reported:
dis_trainer.test_one_step(mini_batch_fake_samples, mini_batch_fake_labels); resizable_tensor noises_tensor; layer<13>(generator).to_tensor(noises.begin(), noises.end(), noises_tensor); generator(noises); const resizable_tensor& out_fake = discriminator.subnet().subnet().get_final_data_gradient();
According to the network definition, layer<13> means the entry level in your own code. Thus my remark because the entry level definition of the generator doesn't match the out_fake structure. Thus my question. Could you please check the code you posted to confirm that the right version used to generate images as results of the of the mnist dcgan run? Thanks in advance.

The corresponding layer is the architecture for the minist data.
Only size for images of 28*28 pixels.
You can change the image size and try again

Sorry, I didn't get the point. Why will this work with a 28x28pix image because, except if I'm mistaken, we will try to use the final data gradient of a num_samplesx100x1x1 (z latent layer) network to backpropagate it inside a num_samplesx1ximage_sizeximage_size? BTW, I tested also directly with your own code and I have an interruption during the second loop, coming from the discriminator training... I'm trying to figure out why

Sorry, you can forget my question. This is clear but I had not realized that the latent vector finally gave input_size=1. The output size is therefore independent of the size of the input vector in this case.

@intellizd are you planning on submitting a PR with an example on how to train these kind of networks? If not and if you don't mind, I might give it a go :)

@arrufat  mnist and cifar10 dcgan were completed with CUDA version.
I'm the first PR at DLIB. BINARY_CROSS_ENTROPY was added to the CUDA version at Dlib's Loss Fusion.
I'll try as soon as possible if I can get PR. I was busy these days so I didn't get busy these days.
Thanks for your advice.

@arrufat
Dlib-DCGAN Repository:
https://github.com/intellizd/dlib-dcgan_example
just now updated dcgan examples (MNIST, CIFAR 64x64)
CUDA version binary cross entropy and 64*64 size image DC-GANs sample was added.
Because I'm a novice at PR.
I hope you will be the leader and this PR(DCGAN-examples)
Optimize and PR please.

@intellizd Oh great, thanks for contributing to this! I will definitely have a look :)
However, it seems that instead of forking dlib's repository, you copied the dlib tree into a new repository.
I'll try to fix that :)

@arrufat To do PR Maybe I should do FORKED.
I didn't know this. Thank you for letting me know. I'll try.

@intellizd any updates on this? I you want I can try to make a PR or break the contribution into several ones, since you added leaky_relu, an other stuff to make it work. I was wondering if we actually need leaky_relu or we can just set the right slope and the learning_rate_multiplier for the prelu activation to 0.

@arrufat LeakyRelu is explained in original paper DCGAN so I implemented it.
Current version dlib provides prelu, but it doesn't look much different from LeakyRelu. Just the Slope and the initial value?
However, it would be nice to have several activation functions in the DLIB.
Verification has been made and there seems to be no problem.
CUDA would also be implemented.
I want you to work together and PR together.

@intellizd, my fork is here: https://github.com/arrufat/dlib
I will create a leaky_relu branch and start working on that PR first, since it will be easier to review.

@arrufat I was created a binary_cross_entropy_loss function branch and I will try to PR this.

@intellizd, I was wondering if that is necessary, I think that loss_multiclass_log is the binary cross entropy loss function when you set the number of classes to 2.

Yes, the log losses are cross entropy losses.  The more canonical name for these things is log or logistic loss.  The deep learning community had a bunch of weird non-textbook names for things.  Sadly they have now become common which makes things confusing for outsiders.
So to be clear, multinomial logistic regression is the same thing as the cross entropy method.

Thank you for your good advice.
You are right. I know it's the same function. However, it will also be necessary to enhance convenience by making functions more recognizable to other users.
When I implemented the DCGANs example as a dlib, I analyzed the core part of the pytorch C++.
Pytorch used binary_cross_entropy, output range is 0 to 1 and suitable for use with the sigmoid activation function.
First I tryed to implemented Dlib binary log loss, I used the DCGANs example during the process, but it has a branching between 1 and -1, so I wrote the binary cross entropy that output is 0 to 1.
These problems need to be integrated and thought possible by someone with a high level of insight.

@intellizd Oh, I think I got your point, loss_multiclass_log with 2 classes has 2 outputs, but for this case we need one output only that varies between 0 and 1, but the loss_binary_log varies between -1 and 1 by default.
Maybe we can try:

replacing the sig with htan in the discriminator, so that the output range is between -1 and 1.
try to make it work with loss_multiclass_log.

I have one suggestion for @davisking: Instead of adding a new loss layer, would you accept a PR that:

allows modifying the output values (negative_label and postive_label) of the loss_binary_log, defaulting to -1.f and 1.f, but we could set them just like we can set the threshold for loss_metric
when deserializing a previous version loss_binary_log, initializes negative_label and positive_label  to -1.f and 1., respectively, to keep backwards compatibility

So, one should be able to write:
using net_type = loss_binary_log<...>;
net_type net(loss_binary_log_(0.f, 1.f);

And then, here, instead of checking the ground truth is not 0, we check that is not the midpoint between positive_label and negative_label?

I would not accept such a PR, as it's not right.  The output of loss_binary_log is not between -1 and 1, it's between -infinity and infinity, because it is a log odds ratio.  That is, it is log(probability_true_class/probability_false_class).  If you want to get the probability_true_class probability out of it just convert to that.  You do this by applying 1/(1 + exp(-logodds)), which with some algebra you can see yields probability_true_class.  I.e. you apply a sigmoid.

Oh, I completely missed the point, sorry about that 😅.

No worries :)

@intellizd, I've been trying to play with your code and there's one thing I don't quite understand:
Here you train the discriminator with fake images and fake labels, then you switch the labels from 0 to , but keep the same images and test instead of train, then it's that gradient what you transfer to the generator. Is that right?

I have managed to make it work, you can try the working version here.
I will add more comments and make it look more like an example and submit a PR. Thank you all for your help.
This is what snapshots every 5000 training iterations look like:

@arrufat Congratulations. This issue you created a year ago is coming to an end. As soon we can see the dcgan examples in the dlib. I got your back.

Let me explain what I was missing:

changed prelu to leaky_relu
change sig to htan since loss_binary_log chooses between positive and negative numbers
get the gradient from the discriminator with fake images but true labels: this tells the generator how it should update itself.

With regards to the last point, I missed it because in the PyTorch example, they do this:
// Train discriminator with fake images.
torch::Tensor fake_labels = torch::zeros(batch.data.size(0), device);
torch::Tensor d_loss_fake =
          torch::binary_cross_entropy(fake_output, fake_labels);

// Train generator.
fake_labels.fill_(1);
torch::Tensor g_loss =
          torch::binary_cross_entropy(fake_output, fake_labels);

But I missed the fact that they change the value of fake_labels, instead of using real_labels.
It sounds stupid, but I skipped that fake_labels.fill_(1); statement, so I was training with fake_labels in the dlib code instead of real_labels, which wasn't giving any constructive feedback to the generator...
Also, @intellizd, I tried using test_one_step, like you do, but it didn't work for me, since that call does not populate the get_final_data_gradient().
I needed to call back_propagate_error and then it worked. So I don't understand how you made it work in your code. Or maybe I am missing something else?


Generator seed

Checks to be done before submitting your PR

[ x] python3 -m pytest tests/ runs successfully.
[ x] black . runs successfully.
[ x] make html runs successfully (in the docs/ directory).
[ x] Updated docstrings related to the changes (as applicable).
[ x] Added an entry to the CHANGELOG.rst.

Hi deepinv team. I add a new feature to PhysicsGenerator class. Each class will have now a rng attribute for random number generator for reproducibility, as suggested in #243 . Moreover, we can also specify the seed in each generation step. I also fixed the ProductConvolutionBlurGenerator for generating a batch of eigen-PSF, which is not supported previously, and enhance the SVD quality.
An another small feature is that I created an equivalent of numpy.random.choice in torch, which allows PhysicsGenerator from inpainting and mri to take torch.Generator instead of numpy.Generator, make it more uniform and avoid some overhead of switching between torch and numpy, mayby @Andrewwango  can take a look?
Don't hesitate to make any comments!

Hi @minh-hai-nguyen-712, thank you for the PR! I will review it when I return from annual leave w/c Mon 26th.

@matthieutrs  please can you review the product blur convolution bits in this? I don't know anything about that!

Thanks a lot for this amazing PR!

Thank you very much for your detailed review!

Thanks for your work @mh-nguyen712 ! I have just added another issue #297  to also set rngs in physics which have randomness - if you are interested in combining with this PR!

Thanks for your work @mh-nguyen712 ! I have just added another issue #297 to also set rngs in physics which have randomness - if you are interested in combining with this PR!

Thanks for your work @mh-nguyen712 ! I have just added another issue #297 to also set rngs in physics which have randomness - if you are interested in combining with this PR!

Of course! I can combine it to this PR!

Thanks for your work @mh-nguyen712 ! I have just added another issue #297 to also set rngs in physics which have randomness - if you are interested in combining with this PR!

I have added rng to all noise model, except for GammaNoise, which depends on torch.distributions and dont have support of torch.Generator. All tests passed. I also added some small code improvement (e.g., use new random_choice function). Could you review them?

I'm happy to approve - @matthieutrs ?

Sorry about that. I just resolved the open comments!


Fonts are falling back

Importing fonts as so:
@font-face {
  font-family: 'Lato';
  src: asset-url('Lato-Regular.eot');
  src: asset-url('Lato-Regular.eot?#iefix') format('embedded-opentype'),
        asset-url('Lato-Regular.woff') format('woff'),
        asset-url('Lato-Regular.ttf') format('truetype');
}

html, body {
  font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
}

The font shows up before the email is sent, when looking at the HTML file, however, when viewing the email in a client the font falls back to Arial. I have tried both Apple Mail and Gmail. The font shows up in Apple mail if premailer is skipped.

You might want to ask over at premailer (this is just the Rails integration).
Make sure that premailer is configured not to remove the original CSS. Then I think it should work.

@ghost any  news ? I'm having the same problem.


[CELEBORN-1327][FOLLOWUP] Simplify DirectByteBuffer constructor lookup logic

What changes were proposed in this pull request?
Simplify DirectByteBuffer constructor lookup logic in Platform. Meanwhile, bump commons-lang3 version from 3.12.0 to 3.13.0.
Why are the changes needed?
try-catch statement is not needed because we know version number already.
Backport:

https://github.com/apache/spark/pull/41780
https://github.com/apache/spark/pull/42269
https://github.com/apache/spark/pull/44444

Does this PR introduce any user-facing change?
No.
How was this patch tested?
GA.

Ping @pan3793.

There are compilation errors.

@FMX, the compilation errors are caused by bumping the version of commons-langs to 3.14.0. I have only upgraded to 3.13.0 for JavaVersion.JAVA_21.

what's issue in commons-lang3 3.14.0

@pan3793, the spark profile compilation has error as follows:
  last tree to typer: Ident(_root_)
       tree position: line 24 of /Users/nicholas/Github/celeborn/worker/src/main/java/org/apache/celeborn/service/deploy/worker/congestcontrol/TimeSlidingHub.java
            tree tpe: <root>
              symbol: final package _root_
   symbol definition: final package _root_ (a RootPackage)
      symbol package: <none>
       symbol owners: package _root_
           call site: package congestcontrol in package worker in package worker

== Source file context for tree position ==

    21 import java.util.concurrent.LinkedBlockingDeque;
    22
    23 import com.google.common.annotations.VisibleForTesting;
    24 import org.apache.commons.lang3.tuple.Pair;
    25
    26 /**
    27  * A time sliding list that group different {@link TimeSlidingNode} with corresponding timestamp by
[ERROR] : Error while emitting Controller.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/Controller;
[ERROR] : Error while emitting Controller.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/Controller;
[ERROR] : Error while emitting Controller.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/Controller;
[ERROR] : Error while emitting Controller.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/Controller;
[ERROR] : Error while emitting Controller.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/Controller;
[ERROR] : Error while emitting FetchHandler.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting PushDataHandler.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting PushDataHandler.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/congestcontrol/CongestionController;
[ERROR] : Error while emitting PushDataHandler.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/congestcontrol/CongestionController;
[ERROR] : Error while emitting Worker.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting Worker.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting WorkerStatusManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting DeviceMonitor.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/DeviceMonitor;
[ERROR] : Error while emitting DeviceMonitor.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/DeviceMonitor;
[ERROR] : Error while emitting DeviceMonitor.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/PartitionDataWriter;
[ERROR] : Error while emitting DeviceMonitor.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/DeviceMonitor;
[ERROR] : Error while emitting Flusher.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/Flusher;
[ERROR] : Error while emitting Flusher.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/LocalFlusher;
[ERROR] : Error while emitting Flusher.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/Flusher;
[ERROR] : Error while emitting Flusher.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/Flusher;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/PartitionDataWriter;
[ERROR] : Error while emitting StorageManager.scala
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager$$anon$11;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/PushDataHandler$$anon$1
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/PartitionDataWriter;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/PushDataHandler$$anon$3
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/PartitionDataWriter;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor$DiskUsageInfo
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/DeviceMonitor;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor$DiskUsageInfo$
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/DeviceMonitor;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/storage/StorageManager$$anon$3
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/storage/StorageManager$$anon$4
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/storage/StorageManager$$anon$5
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] : Error while emitting org/apache/celeborn/service/deploy/worker/storage/StorageManager$$anon$6
assertion failed: ClassBType.info not yet assigned: Lorg/apache/celeborn/service/deploy/worker/storage/StorageManager;
[ERROR] 37 errors found

No suspicious items in 3.14.0 changelogs https://commons.apache.org/proper/commons-lang/changes-report.html#a3.14.0. Weird, anyway, this PR is good to go.

cc @FMX.

spark profile compilation has error

commons-lang3 3.13.0 is compiled using JDK8, 3.14.0-3.16.0 is compiled using JDK21, 3.17.0 is compiled using JDK17
Because JDK21 is used for compilation, there will be more MethodParameters in the class file, which triggers a bug in the lower version of scala.
https://github.com/scala/bug/issues/12783
javap -v Pair

scala 2.12.18 Fix
mvn package -am -pl worker  -DskipTests -Pspark-3.4 -Dcommons-lang3.version=3.14.0  -Dscala.version=2.12.18

https://lists.apache.org/thread/5ysptqcqxzp4l500qlxmhp92t3d5881k
https://lists.apache.org/thread/jw6fbm1mc67jn94zhd8g8f9hdws8l5j0
https://lists.apache.org/thread/odv5w41h06t0gdcl7spq087hl441df3c

@cxzl25 will the bug be triggered on just compile time? or include the runtime?

will the bug only be triggered on compile time? or include the runtime?

I did a simple test, it was only triggered during the compile phase, and no error was reported when the runtime was replaced with 3.14.0.
object TestLang3 {
  def main(args: Array[String]): Unit = {
    println(org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast(org.apache.commons.lang3.JavaVersion.JAVA_21))
  }
}

java -cp scala-library-2.12.15.jar:commons-lang3-3.13.0.jar:. TestLang3
false

java -cp scala-library-2.12.15.jar:commons-lang3-3.14.0.jar:. TestLang3
false

given there will be cases in celeborn ships higher version relocated commons-lang3 classes and Spark runtime uses a lower version of scala library, we must ensure the runtime compatibility.
if the issue only happens in the compile phase, it's good then.


ENH: Add get_output function to old keithly SMUs

Coverage remained the same at 32.447% when pulling c7a165daccfb3155b0566dd72a274ce65673db18 on add_keithley_function into 183a36faa3ca202d216efc1ce0192a8e5603e27a on development.


Deleted some unused variables

$data and $error was unused, also addHeaders was edited.

they are used just not in the method directly, for instance the $data is used inside the views the view::render method includes, without $data the controller cannot pass any information to the view.

Oh i see my bad i must be on drugs right now lol i forgot those variables.

haha no worries :)

please close this


Brew tap issue

Hi,
Homebrew has started giving me the following error at every update since a few days ago.
Did anything change?
fatal: couldn't find remote ref refs/heads/master
Error: Fetching /usr/local/Homebrew/Library/Taps/cleishm/homebrew-neo4j failed!

Thanks,
Greg

Ah! Thanks for the heads up on this.
The branch names have changed, which was causing this issue. I've updated the homebrew formula, so it should be ok now.


Error starting bot

Please tick all applicable boxes.

[x] I am using Python 3.5.3 or higher (run python --version on the command line)
[x] I have followed the official guides to install the bot for my system
[x] I have updated my dependencies to the latest version using the appropriate update script

Which version are you using?

[x] The latest master version (release-260419)
[ ] The latest review version

What type of issue are you creating?

[x] Bug
[ ] Feature request
[ ] Question

Description of issue

Error starting bot

[INFO] launcher: Starting sanity checks
[INFO] launcher: Checking for Python 3.8+
[INFO] launcher: Checking console encoding
[INFO] launcher: Setting console encoding to UTF-8
[INFO] launcher: Ensuring we're in the right environment
[INFO] launcher: Adding local bins/ folder to path
[INFO] launcher: Required checks passed.
[INFO] launcher: Optional checks passed.
[INFO] launcher: Moving old musicbot log
Starting MusicBot release-260819-94-g59bbe52
Loaded autoplaylist with 2531 entries
Authenticated with Spotify successfully using client ID and secret.
[ERROR:bot] Error in cleanup
Traceback (most recent call last):
File "C:\Users\nawaz\Documents\music-bot1\MusicBot\musicbot\bot.py", line 944, in run
self.loop.run_until_complete(self.start(*self.config.auth))
File "C:\Users\nawaz\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\nawaz\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 661, in start
await self.connect(reconnect=reconnect)
File "C:\Users\nawaz\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 596, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\nawaz\Documents\music-bot1\MusicBot\musicbot\bot.py", line 955, in run
self._cleanup()
File "C:\Users\nawaz\Documents\music-bot1\MusicBot\musicbot\bot.py", line 931, in _cleanup
pending = asyncio.Task.all_tasks()
AttributeError: type object '_asyncio.Task' has no attribute 'all_tasks'
[ERROR] launcher: Error starting bot
Traceback (most recent call last):
File "C:\Users\nawaz\Documents\music-bot1\MusicBot\run.py", line 385, in main
m.run()
File "C:\Users\nawaz\Documents\music-bot1\MusicBot\musicbot\bot.py", line 944, in run
self.loop.run_until_complete(self.start(*self.config.auth))
File "C:\Users\nawaz\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Users\nawaz\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 661, in start
await self.connect(reconnect=reconnect)
File "C:\Users\nawaz\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 596, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
[INFO] launcher: All done.

Steps to reproduce

Log file
musicbot.log
Please attach your MusicBot log file (located at logs/musicbot.log) to this issue. You can do so by dragging and dropping the file here. If you do not include your log file, you WILL be asked to provide one.

As shown in the above image Please enable intents also strongly recommend using review for now


[Release/v1.6] Update OSM to v1.2.1

What this PR does / why we need it:
Updating OSM to v1.2.1 to include this fix.
Which issue(s) this PR fixes:

Fixes #
What type of PR is this?

/kind bug
Special notes for your reviewer:
Does this PR introduce a user-facing change? Then add your Release Note here:

* Update Operating System Manager to v1.2.1
* Fix an issue where cloud-init scripts re-ran on machine reboot

Documentation:

NONE

/approve
/lgtm


Another tests added

Most of tests are working now (several TODOs are left).
API has slightly changed:

instantiation is not possible without validation
imports validation is a part of validation process
=> when you add 'native' functions to env module, you should pass this env module to add_module function.

great!


[Label] Attached label groups

While individual labels can be attached to content segments, groups of labels can not.  It seems like this would be a reasonable extension and make things more consistent.
An example use case: a set tags as labels attached to the content they tag.

I've removed this as an addition, this is just too complex to implement in a standard way.


refactor: add support for converting ethers wallet and ethers signer to SmartAccountOwner

PR-Codex overview
Focus of the PR:
This PR focuses on adding a new function convertEthersSignerToAccountSigner in the utils.ts file.
Detailed summary:

Added an import for Signer from @ethersproject/abstract-signer.
Added a new function convertEthersSignerToAccountSigner that converts an ethers signer to a SmartAccountSigner.
The convertEthersSignerToAccountSigner function returns an object with methods getAddress, signMessage, and signTypedData.
The signTypedData method throws an error as it is not supported for ethers signers.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Current dependencies on/for this PR:

main

PR #77   👈

This comment was auto-generated by Graphite.


Middle click open note/folder in new tab

Hello - in the Spaces/file explorer pane, would it be possible to add the ability to open a note (or folder) in a new tab using middle click?  This functionality exists in the default file explorer and is very convenient, but seems to be missing in Spaces (nothing happens with middle click).  Thanks!

Hello. Is there an option to implement this functionality?

I didn't know this until I looked at the code, but FYI you can also open files in a new tab from the spaces file tree view by left-clicking while holding down Ctrl or ⌘.


feat #48: SPA migrations

Title of the Pull Request

[x] Have you renamed the PR Title in a meaningful way?

Related Issue

Closes: #48
Description

This PR improves website and makes it significantly faster.
Introduced First SPA without raw python and javascript only
How Has This Been Tested? ⚙

Use Website as usual you will see difference and can test.
Screenshots 📷

https://github.com/user-attachments/assets/e21b1af6-9fcf-4e41-802a-80e6126c4cc8
Type of change
What sort of changes have you made:

[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[x] Code style update (formatting, local variables)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[x] This change requires a documentation update

Checklist

[x] My code follows the code style of this project.
[x] I have followed the contribution guidelines
[x] I have performed a self-review of my own code.
[x] I have ensured my changes don't generate any new warnings or errors.
[ ] I have updated the documentation (if necessary).
[x] I have resolved all merge conflicts.

@kom-senapati Let me know your words on this?? PA

Good work


revert storage medium of partition should not inherit from…

… table (#41192)
pick: https://github.com/apache/doris/pull/41192

run p0


Istio Support

Hi there, I'm wondering if anyone has gotten a clickhouse installation from the clickhouse-operator working with Istio?
Currently I'm having trouble with the readiness/liveness probe upon startup, likely due to how the ports get bound to <IP_ADDRESS> instead of <IP_ADDRESS>

Same, I've got the next cluster configuration after adding istio:
┌─cluster────────┬─shard_num─┬─replica_num─┬─host_name────────┬─host_address──────────────┬─port─┐
│ all-clusters   │         1 │           1 │ chi-test-0-0 │ ipv6:addr:was:here:19bc::d │ 9000 │
│ all-clusters   │         1 │           2 │ chi-test-0-1 │ ipv6:addr:was:here:19bc::7 │ 9000 │
│ all-clusters   │         1 │           3 │ chi-test-0-2 │ <IP_ADDRESS>                 │ 9000 │
...

It seems to me that cluster instances self-discovery doesn't go well within ipv6-only aws eks cluster running under istio.

And restarting operator pod helped somewhy - it couldn't resolve replicas services into a proper addresses, but after restart it has gone.


feat: benchmarking for capymoa and river, with necessary edits in evaluation.py

Benchmarking experimenter that can be rerun at any time for reproducibility.

Could we move the benchmark logic out of "/src/capymoa" perhaps into "/benchmark". This way the benchmark won't be packaged. This will likely also fix the import issue since pytest won't go looking for tests. The advantages of this are:

We can have different dependencies for benchmarks.
We can make changes to benchmarks without influencing the capymoa package in anyway.

You can add benchmark dependencies including capymoa to a "/benchmark/requirements.txt" and an explanation of how to use the benchmark in "/benchmark/README.md". Sort of treating it as a separate project.
If there is a good reason for packaging the benchmark we have some other options, like moving the import into the function where river is used.

Could we move the benchmark logic out of "/src/capymoa" perhaps into "/benchmark". This way the benchmark won't be packaged. This will likely also fix the import issue since pytest won't go looking for tests. The advantages of this are:

We can have different dependencies for benchmarks.
We can make changes to benchmarks without influencing the capymoa package in anyway.

You can add benchmark dependencies including capymoa to a "/benchmark/requirements.txt" and an explanation of how to use the benchmark in "/benchmark/README.md". Sort of treating it as a separate project.
If there is a good reason for packaging the benchmark we have some other options, like moving the import into the function where river is used.

No problem, I will try to move it a bit later.


ErrorStateMatcher with formly

We want to see the validations only when the form is submitted, and not when an input is just touched, for required fields.
export class MyErrorStateMatcher implements ErrorStateMatcher {
  isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
    const isSubmitted = form && form.submitted;
    return !!(control && control.invalid && (isSubmitted));
  }
}

we use this in the formly field
      key: 'Input',
      type: 'input',

      props: {
        label: 'Input',
        placeholder: 'Placeholder',
        description: 'Description',
        required: true,
        errorStateMatcher: new MyErrorStateMatcher(),
      },
    }

and in app.module
providers: [
    { provide: ErrorStateMatcher, useClass: MyErrorStateMatcher },
  ]

Still, when the onBlur is fired, even when the form is not submitted, the validation message appears.
What are we missing here?
<form [formGroup]="form">
  <formly-form [model]="model" [fields]="fields" [options]="options" [form]="form"></formly-form>
  <button>Submit</button>
</form>

see https://github.com/ngx-formly/ngx-formly/issues/3041#issuecomment-978048375


Add snapshot export step to benchmarking

Issue summary

It'd be helpful to add a snapshot export to the benchmark. Currently, we mostly measure entries' write speed. The main difference between paritydb and rocksdb performance is walking the entries' performance which is missed by the benchmarks. This would allow us to take a more informed decision when considering switches between database backends and allocators. We are interested in total export time, peak memory and average memory.
:warning: it may be that the mainnet export won't work for some configurations. This should be included in the report.
Other information and links

This is now part of forest-tool benchmark export.


[Forge 1.19.2] Lookup arguments broken

Testing this mod for my network on 1.20.1 and 1.19.2 and noticed that the 1.19.2 lookup args aren't working as intended. I am using pretty much a clean forge 1.19.2 server
Info:
architectury-6.5.90-forge.jar
grieflogger-1.1.4-forge.jar
supermartijn642configlib-1.1.8-forge-mc1.19.jar
1.19.2-43.3.7 (Server Forge version)
The autofill:

No matter what input I put in for the filter, it return invalid
I don't think I am doing anything wrong. 1.20.1 Forge version works as intended.

Did you turn off server side mode in the config?

I have the same problem in the same version of Minecraft/modloader

same I also have this problem

Same issue here, all the lookup commands are invalid and filters are unusable.
serverside is on "true"
forge 43.4.0
grieflogger 1.1.4
architectury 6.6.92
supermartijn642configlib 1.1.8

Same shit, AWFUL to use and it just doesn't even work

Been month and still isn't fixed ? Bruh, alr its over for 1.19.2 ig

Feel free to create a PR

Feel free to create a PR

You took a look at it and you can't figure it out or didn't, because if you did then from an non dev pov idk what I could do more if it's an forge 1.19.2 failure.


Default constructor for extension types

Hi!
I was very happy to see dataclasses and typed namedtuples in recent Python versions. I think they allow very convenient and Pythonic way to structure data. In particular, I like that I don't have to implement constructors. However, if we want better performance and use Cython, we have no choice than to use extension types (cdef classes) and implement constructors full of self.varname = varname.
Could Cython implement default constructors/init methods for extension types, that would take all class attributes as parameters (in the definition order) and perform the assignment?

Is there an advantage of doing this over implementing @dataclass for cdef classes? Or are there use cases where @dataclass is not the right thing?

I don't think so, ability to compile dataclasses would be great, but I suppose it would be much more complicated. If this is planned, are there some open issues I could watch?

Superseded by #2903.


Is it possible to change the schema programmatically and call it immediately?

I have a situation that requires changing the schema of the query / mutation based on user input. Is it possible to change the schema after its been set and call it immediately?
Thanks for the great library!!!

Hiya 👋
I’m not quite sure what you mean by changing the schema since that’s not an option? Do you mean the GraphQL API url?
You can either programmatically set it in your state and recreate the client when it changes, and pass it to the Providern
Or you can pass in context.url in the hooks to change this once off: https://github.com/FormidableLabs/urql/blob/fb070cba2170c89f39baac757a694da92447ddce/src/hooks/useQuery.ts#L24

Once I examined the code, I noticed it couldn't be changed. So I created a custom query.
const CustomQueryAsync = (value) => {
  console.log({ value });
  return pipe(
    fromValue(value),
    debounce(() => 5000),
    mergeMap((name) => client.executeQuery(createRequest(GetIndustries, name ? { input: { name } } : undefined))),
    map(({ data: { GetIndustries } }) => GetIndustries),
    take(1),
    toPromise,
  );
};

Except for the debounce, everything else is working great.

The only thing I see your custom query do is alter the variables object which should be possible by doing this:
const result = useQuery({ query, variables: name ? { input: { name} } : undefined }) or am I misunderstanding this?

In my use case, I would run a function that would choose the appropriate query based on certain conditions. I could have either made multiple useQueries or setup a useEffect to run whenever the useQuery's execute function changes but it seemed very inefficient.

Oh so you still want both results to be available?
You can maybe still use useQuery. We have a pause: true | false option so you can conditionally only let one of them run at a time maybe?

Yes what @kitten sais is a good way I t hink
Let me introduce a small example:
const MyApp = () => {
  const [type, setType] = useState('dogs');
  const [dogsRes] = useQuery({ query: dogsQuery, pause: type === 'dogs' });
  const [catsRes] = useQuery({ query: catsQuery, pause: type === 'cats' });

  ...jsx stuff
}

I did consider that but I had 5 queries and initialization of all 5 every time seemed inefficient when only 1 of the queries was required depending on some parameters. Either way, I got everything working. Really like urql.


Error when creating preview

Describe the bug
I am trying to use a react component as a live preview with gatsby and the netlify-cms npm package. I think I have set it all up correctly, but in the preview window, it doesn't display the template and it says:
Sorry!
There's been an error - please report it!
TypeError: Cannot read property 'get' of undefined

To Reproduce

Make a new gatsby project with my files and try to edit a 'page' collection in the netlify cms admin panel.
Expected behavior
It would put the values into the react component and display it in the live preview.
Screenshots

Applicable Versions:

Netlify CMS version: 2.3.3
Git provider: Gitlab
OS: Arch Linux
Browser version Chromium 72
Node.JS version: 6.7.0

CMS configuration

backend:
  name: git-gateway

media_folder: "static/images/uploads"
public_folder: "/images/uploads"

collections:
  - label: "Pages"
    name: "pages"
    files:
      - label: "Index"
        name: "index"
        file: "src/pages/index/index.md"
        fields:
          - { label: "Path", name: "path", widget: "hidden" }
          - { label: "Main", name: "main", widget: "object", fields: [
              { label: "Heading", name: "heading", widget: "string" },
              { label: "Description", name: "description", widget: "markdown" }
            ]}

Additional context

src/cms/cms.js
import CMS from "netlify-cms"
import IndexPreview from "./preview-templates/index"

CMS.registerPreviewTemplate('index', IndexPreview)

src/cms/preview-templates/index.js
import React from "react"
import { IndexPageTemplate } from "../../templates/index.js"

const IndexPreview = ({ entry, widgetFor }) => {
  return (
    <IndexPageTemplate
      heading={entry.getIn(['data', 'heading'])}
      description={widgetFor('description')}
    />
  )
}

export default IndexPreview

src/templates/index.js
import React from "react"
import { graphql } from "gatsby"
import Markdown from "react-markdown"
import Layout from "../components/layout"

export const IndexPageTemplate = ({
  heading,
  description
}) => (
  <>
    <h1>{ heading }</h1>
    <Markdown source={ description } />
  </>
)

const IndexPage = ({ data }) => {
  const fm = data.markdownRemark.frontmatter

  return (
    <Layout>
      <IndexPageTemplate
        heading={fm.main.heading}
        description={fm.main.description}
      />
    </Layout>
  )
}

export default IndexPage

export const mainQuery = graphql`
  query MainQuery($path: String!) {
    markdownRemark(frontmatter: { path: { eq: $path } }) {
      frontmatter {
        main {
          heading
          description
        }
      }
    }
  }
`

Nevermind, I'm pretty new to Netlify CMS and I make a silly mistake. In src/cms/preview-templates/index.js, I was using the widgetFor parameter wrongly. I referred to the docs and now I understand :)

Also entry.getIn(['data', 'heading']) ==> entry.getIn(['data', 'main', 'heading']) , right ?

@jakegore Hi I'm facing the same issue. Also, I have been unsuccessfully trying to create the preview component. I have styled the website but can't get the same styling for preview pane in NetlifyCMS.
Can you please refer me to the docs as well. Thanks

https://www.netlifycms.org/docs/customization/


refactor: fetch contract interface outside state mgmt

Try out this version of the Hiro Wallet - download extension builds.

Draft PR that removes data fetching from async atoms, to hooks.
Adds package limiter. Really simple library that does exactly what we want. Current settings can be adjusted, but here we limit there to being 1 contract interface every 2 seconds.
https://user-images.githubusercontent.com/1618764/130594556-2b237dcc-9a31-4052-a7d8-46749bcbda23.mp4

PR is outdated and can be closed wo merge


win-7 & win8 are dead.

Type of Request
bug
Infrastructure Environment
LUCI, Github, Cocoon scheduler, Autosubmit, etc...
What is happening?
win-7 & win8 are dead.

Steps to reproduce
Step 1:
Step 2:
..
Step n:
Expected results
I expect to see X when Y is finished.

Network adapter was disabled on both machines, rebooting machine to restart network service.