Initial work on documentation generation tool as rewrite step

This PR beings work on a new documentation generation tool that directly outputs DocFX-Flavored Markdown (DFM) from the Q# compilation process, instead of the YAML → template process currently used. This enables:

Direct usage by third-party libraries (i.e..: no additional template needed).
Resolving long-standing documentation limitations (e.g.: https://github.com/microsoft/qsharp-compiler/issues/113), and fixing bugs in templates (https://github.com/MicrosoftDocs/quantum-docs-pr/issues/991).
Adapting output generation for new language features.

The compilation rewrite step in this PR also embeds documentation metadata into new attributes (PR on qsharp-runtime forthcoming), so that downstream tools such as IQ# can consume documentation without re-parsing documentation comments.
By way of implementation, this PR uses the existing documentation output tool as a parser to power the new compilation step.
NB: This PR replaces and supercedes https://github.com/microsoft/qsharp-runtime/pull/253.
Breaking changes:

UIDs generated for Q# are no longer lower-cased, following standards for UIDs in other languages and frameworks. This will require fixing existing @"" and xref: links to use fully-qualified names as UIDs instead of transforming to lowercase.

TODO:

[ ] Open corresponding PRs on qsharp-runtime, iqsharp, and QuantumKatas with changes needed to support this PR.
[x] Finish extension method for converting type signatures to Markdown links (operations and tuples are currently TODO).
[ ] Adapt QuantumLibraries documentation for UDTs to include new /// # Named Items documentation section.
[ ] Adapt QuantumLibraries projects to provide package name.
[ ] Adapt symbol encoder in IQ# to utilize new information.
[x] Package new step as nuget package.
[ ] Adapt Microsoft.Quantum.Sdk to automatically import new package when outputting documentation.
[x] Generate/update TOC and namespace pages
[ ] Add new MSBuild properties to documentation.

Currently in draft for early feedback, targeting new feature branch.

Is it possible to merge in updates from master into the feature branch in a separate PR to make the diff here cleaner? It's quite large and looks like it contains unrelated changes from new commits on master.

Is it possible to merge in updates from master into the feature branch in a separate PR to make the diff here cleaner? It's quite large and looks like it contains unrelated changes from new commits on master.

Sounds good, let me go on and do that, then.

@samarsha: Please see https://github.com/microsoft/qsharp-compiler/pull/611. Thanks!

This is looking pretty great! I know the qRAM team could really make use of this (https://github.com/qsharp-community/qram/issues/27) so that we could take the API docs that we have now and easily convert them to a static site for our users 💖 Let me know if there is anything I can do to help move this along!

/AzurePipelines run

@bettinaheim: Thanks again for the review! I've addressed most of your feedback, save for your comments about the QSharpDocsPackageId MSBuild property. If it's alright, I'd like to leave that for two reasons:

When publishing API documentation for a group of packages at once, it may not be clear what package users should depend on to get access to a given function, operation, or UDT. By keeping the package name as metadata, the documentation generation tool can provide this information to users when it is appropriate to do so.
Some packages may be available under a different package ID than they are built with (e.g.: when metapackages are used to simplify package deployment), such that individual packages should be able to override the property to specify the name of their corresponding metapackage instead.

 Would you be willing to take another look? Thanks!

/azp run


Convert Age to Days

Before jumping into Pr first comment for assign.All Problem from Edabit. Link is mandatory to add
**Problem statement:**Create a function that takes the age and return the age in days.Use 365 days as the length of a year for this challenge.
Ignore leap years and days between last birthday and now.
Expect only positive integer inputs.
**Problem Link:**https://edabit.com/challenge/xbZR26rHMNo32yz35

Before submitting a PR please Check some details.Check Edabit for problem task

[ ] fileName formet should be in camelcase
example- returnTheNextNumber.py
[ ]  Add label for Problem
[ ]  In file there should be problem statement and link to probelm
example -

'''
    Probem Task : Convert Age to Days
    Problem Link :https://edabit.com/challenge/xbZR26rHMNo32yz35
*/
def main():
    return a + b
'''

This repository is vaild for HacktoberFest2020

Read before making PR - [How to contribute on Github](https://www.dataschool.io/how-to-contribute-on-github/)
Good Luck,
****

please assign this to me

@aayushi-droid please assign this to me

I would like to work on this.
Thank you!

@aayushi-droid Please assign this issue to me

duplicate of #255


Update docs badge to use master instead of 0.1.0

We should track the latest release, not master.

Should be v0.3.0 and depends on #79

@meew0 73 commits to master since the last release is it not time?

I'll update the docs badge manually when the next release causes a doc update, see #139


Refactor code

The  Github diff look weird.
What I do ?

Use URL. documentsDirectory ,  the code become more concise. Reference [https://sarunw.com/posts/url-type-properties/](Better way to get paths to system directories in iOS 16)
We don't need Task inside async function.  I change the code structure (this make diff hard to understand)

    func similarPhoto(with photoAsset: PhotoAsset) async {
           ...
         Task {
             do_some_thing()
         }
          ...
    }

to
  func similarPhoto(with photoAsset: PhotoAsset) async {
         ...
        do_some_thing()
        ...
 }

Thanks for your work and explanation!


Add Socks Proxy support

At the moment Apify has a cool option - 'proxy'. But unfortunately it does not support a socks type proxy. I think iIt would be awesome and very useful

This is an open issue on the proxy-chain package that we use. https://github.com/apifytech/proxy-chain/issues/29
Until it lands there, we have to live without sock5 support, sadly.

Socks proxies without authentication are now supported.

@mnmkng is username+password supported in the latest version?

@osullivanalan No, sorry, proxy-chain still does not support that.
@jancurn how complex would it be to add the feature?

If there is some good SOCKS5 library, it might be not too difficult. Don't know more

Same here, i am looking for to use with puppeter.
:D


Adding files for homewrok 3

Adding files for Homework 3.

Metric
Value

alert_status
:white_check_mark: OK

bugs
0

code_smells
25

reliability_rating
A (0 Bugs)Note: A being best, E being worst

security_rating
A (0 Vulnerabilities)Note: A being best, E being worst

vulnerabilities
0


Template card size not right yet

What
I thought I fixed it in https://github.com/openfoodfacts/smooth-app/pull/3093 but it seems to still not looks quite right.

can i work on this issue?

Sure @prathamsoni11

i have fixed the issue and also done some changes in UI. Select any one to commit in UI.


Use MicroCom.Runtime from nuget

You can test this PR using the following package version. 11.0.999-cibuild0025031-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]


BUG: Use of floor division instead of regular division.

The compose filter expects all inputs to have the same pixel
type. This was not the case when using regular division. Changed it to
floor division.
Change-Id: I9e7dacd9d04f5d4d680c97fa3fcdc14aabfc2da8

This usage occurs in a number of files:
$ git grep -l sitk.Compose
DemonsRegistration1/DemonsRegistration1.py
DemonsRegistration2/DemonsRegistration2.py
ImageRegistrationMethod1/ImageRegistrationMethod1.py
ImageRegistrationMethod2/ImageRegistrationMethod2.py
ImageRegistrationMethod3/ImageRegistrationMethod3.py
ImageRegistrationMethod4/ImageRegistrationMethod4.py
ImageRegistrationMethodBSpline1/ImageRegistrationMethodBSpline1.py
ImageRegistrationMethodBSpline2/ImageRegistrationMethodBSpline2.py
ImageRegistrationMethodDisplacement1/ImageRegistrationMethodDisplacement1.py
ImageRegistrationMethodExhaustive/ImageRegistrationMethodExhaustive.py

Do you think these others are effected but this Python 3 compatibility too?

Good catch. Fixed this in all the files.

Thanks for the additional changes! 👍


Full usage demo

Hi!
Thank you for the great job!
1.Can you provide a bag file for full usage?
2.if I want to use single robot for big map, how can I follow the full usage steps?
3.if I want to use another loop closure method instead of the disco, how can I modify the code?
Thank you again!!!

Hi @MaverickPeter,
Bravo for the great work! I have similar questions with the questions No.1 and No.3 raised by @guo253.
Can you provide a bag file for full usage demo?
And do you have any idea for implementing other loop closing modules apart from the DiSCO and RING?
Thanks.
Best Regards,
William


Remove db-scoped fullCommit variable

Codecov Report

Merging #73 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
- Coverage   96.92%   96.91%   -0.01%
==========================================
  Files          20       20
  Lines        1235     1231       -4
==========================================
- Hits         1197     1193       -4
  Misses         27       27
  Partials       11       11

Impacted Files
Coverage Δ

attachments.go
100% <100%> (ø)
:arrow_up:

replication.go
95.42% <100%> (ø)
:arrow_up:

bulk.go
100% <100%> (ø)
:arrow_up:

couchdb.go
100% <100%> (ø)
:arrow_up:

db.go
100% <100%> (ø)
: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 8e8ae6c...6f4069b. Read the comment docs.


Extend basePath

The basePath is a part of the URL. It sits between the server target host URL and the operation path. An improvement we can do, in regards to creating better names from paths (see #179), is to determine the lowest common denominator basePath for all operation paths. That way, we can build names from only the unique components of the path and not mistakenly add redundant metadata.
For example, a common trope is to add the API version number to the path.
exampleAPI.com/apis/v1/...

We can filter out the basePath apis/v1/ and strictly focus on the semantically important parts of the path.

The basePath seems to be an element in Swagger but not so in OAS 3.x.x. Regardless, we can still use the same strategy.


Add default providing persistence key

Adds a special DefaultProvidingKey which acts as a decorator around another persistence key and holds on to a default value.
This allows you to define the default value for a particular key alongside the key definition and not need to declare a default value everywhere you use @Shared or @SharedReader with that key.
For example:
extension User {
  static let placeholder = User(id: UUID(0), name: "")
}

extension PersistenceKey where Self == DefaultValueProviding<InMemoryKey<User>> {
    static var user: Self {
        inMemory("user", defaultValue: .placeholder)
    }
}

@Reducer
struct LoggedIn {
  struct State: Equatable {
    @SharedReader(.user) var user
  }
}

This PR provides overloads for creating inMemory and fileStorage keys with a default value. I have not provided any overloads for appStorage keys as there are quite a lot of them already, but they could also be added if desired.
One caveat to this implementation is that because keys are required to be hashable, the default value must also be a hashable type.
Previous discussion:
https://github.com/pointfreeco/swift-composable-architecture/discussions/2956

WHOA that's cool! Hope it gets Stephen and Brandon's blessing 🙂

I would love to have this capability. I see the value in modeling the API after what SwiftUI does, but this seems like a reasonable alternative for those who want to keep it DRY.

Hey @lukeredpath, just wanted to let you know we haven't forgotten about this. We've made a few small changes and hope to merge it tomorrow, but we may make a few more tweaks before then too.

Congrats @lukeredpath !


sharing pages between books

make possible to the user share a page between different books, it will help because books are used to organize topics and some pages may be useful in more the one book and copping is a problem becase if someone change in one book the other will continue the way it was

You can get the page ID by highlighting text in a page and it will pop-up with the shortcut link. That link will have the page ID in it.  Then in the page you want to include that page put:
{{@###}} where ### is the page ID.
Caveat: If permissions don't match for user viewing it, content won't display.

It can be a problem because if someone wants to edit the page, he or she will need to find the original source of it. What I was thinking was a way to have a kind of link, so if I open the same page in different books it would be the same for reading or editing

It can be a problem because if someone wants to edit the page, he or she will need to find the original source of it. What I was thinking was a way to have a kind of link, so if I open the same page in different books it would be the same for reading or editing

Hi @cainotis ,
Thanks for opening this issue.
This has already been requested in #182 therefore I'm going to close this to reduce duplicates. If you add a :+1: reaction to the original post on #182 it will help show support for that request.


Adjust swap action to match swap_delay and fix skill hold cancels

Check for skill hold on cancel delays
Fix swap event not getting delayed by swap_delay
Fix xiangling C1 check

closing in favor of #490


Missing information about defaults

Although you specify something about what happens with the project argument is missing, some of the defaults are not obvious. It appears that the default output directory is TestResults or is that just added onto whatever the output directory is set to?
Standard format for any parameter descriptions should include what you already have and also what the default values are. Thx.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 61ca4064-7481-a263-60fc-c70127f2ad16
Version Independent ID: 2878af44-8208-7bd8-46d4-3acda3e82ce0
Content: dotnet test command - .NET Core CLI
Content Source: docs/core/tools/dotnet-test.md
Product: dotnet-core
Technology: dotnet-cli
GitHub Login: @mairaw
Microsoft Alias: mairaw

Thank you for filing this issue, we'll add it to the backlog.

this consideration has been raised in https://github.com/dotnet/sdk/issues/10706 ... also, please ensure that this effort to document the defaults is included in "dotnet test -h".

@brcaswell That issue seems to be about something else, to enable Console.WriteLine to appear in console output without specifying the -v parameter.

@Thraka that issue workitem raised a few points, one being in regards to this issue where "the docs, mentioning only v2.1 and dotnet test -h say nothing about the default value for verbosity"

@tdykstra You were just in the test command docs. It seems the default values are missing. But I don't think they are even listed in the output of the command itself. Do you have a product group contact that can fill in the info?


Incorrect Authorize Uri

https://login.microsoftonline.net/common should be https://login.microsoftonline.com/common I believe.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 5a1179b0-7f3d-77de-239b-a33c9d30ff61
Version Independent ID: ab708f2a-3cb5-fcf3-9733-a2bc26b09e60
Content: Authenticate users and get an Azure AD access token for your application - Power BI
Content Source: powerbi-docs/developer/get-azuread-access-token.md
Service: powerbi
Sub-service: powerbi-developer
GitHub Login: @rkarlin
Microsoft Alias: rkarlin

Hi, @johnnycardy -- thanks for pointing that out. I've assigned this to the author.

@johnnycardy,
Thanks for the feedback, I updated the authority URI in the code block to show ".com" instead of ".net."
I also updated article - https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-get-token- with this info as well.
Changes should show live by the end of the week.
Thank you.

We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion, and we will reopen the issue.


[Feature] ID support For Spawned Object alerts

Describe the solution you'd like
For spawned object alerts, I'd like to be able to input object IDs for the trigger. Currently, it is limited to just the display name value.

I would like to do some analysis on this (and will welcome anyone else's own analysis) to discover any potential ToS issues that could arise enabling this. With the advent of region blocking, I think we are given a little more breathing room with the features we can implement since they "don't matter" as much (apparently). On initial thought, being able to detect something based on ID "feels" bad and against the spirit. You're not normally able to see objects ID's, unlike their names, so it feels a little cheaty. And this game is so complex that it's hard to know everything that this would allow.
So ya, I or hopefully someone more knowledgeable can put some thought into this and decide if it's a good idea.


MPC Layout for 2 party semi honest setting

Hi,
Thanks for the framework!
I want to run a 2pc semi2k and cheetah experiments so I should use this config? Additionally does SPU running on two devices along with P1 and P2 means it is a 3 party model? I am running experiments where there are only Alice and Bob involved in the transaction and no additional party.

Hi @dhyani15
Yes, that is the right config file.
P1 & P2 here are data providers, they can be on the same device as SPU (colocated mode) or on a different devices (our-sourcing mode), see doc here.
For your case, Alice and Bob they are both data providers and MPC computation parties (colocated mode). So P1 and SPU1 should be on one machine, P2 and SPU2 should be on another machine.
Best
~Yancheng

Thanks for the quick reply, please correct if I understood this correctly, the data provider "P1" only provides cipher text data, and the actual secure function evaluation happens in the SPU device?  So in colocated mode, we have data providers and secure function evaluation on the same node?
Also going through the llama7b example here I am trying to replicate a similar behaviour, alice provide ciphertext data, and bob provides ciphertext model weights and then the inference would take place on the SPU device? In the example they use a 3pc mode but can i use a 2pc mode? Which would be correct to simulate a 2 party semi honest setting?
Best,
Naren

Thanks for the quick reply, @anakinxc please correct me if I am wrong, the data provider "P1" only provides cipher text data, and the actual secure function evaluation happens in the SPU device? So in colocated mode, we have data providers and secure function evaluation on the same node?

Yes, that is correct.

Also going through the llama7b example, I am trying to replicate a similar behaviour, alice provide ciphertext data, and bob provides ciphertext model weights and then the inference would take place on the SPU device? In the example they use a 3pc mode but can i use a 2pc mode? Which would be correct to simulate a 2 party semi honest setting?

Use this config as a reference. All you need to do is remove one SPU node and change protocol to cheetah.

Thanks @anakinxc, a little unrelated but I am running this experiment on pytorch and following the code in torch_experiment, but I am getting some issues when converting to stablehlo.
code snippet:
def compile_torch_to_mhlo(model,data):
    print('Compile torch program to mhlo test\n------\n')

    import torch_mlir

    module = torch_mlir.compile(
        model,
        data,
        output_type=torch_mlir.OutputType.STABLEHLO,
        use_tracing = False
    )
    print(f"StableHLO={module}\n------\n")

if __name__ == '__main__':
...
data = torch.ones(args.batch,3,224,224)
config = AutoConfig.from_pretrained(args.model_type,num_labels=num_classes)
model = CustomViTForImageClassification(config)
model.load_state_dict(checkpoint['state_dict'], strict = False)
compile_torch_to_mhlo(model, data)

error trace:
/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/annotations.py:386: UserWarning: TorchScript will treat type annotations of Tensor dtype-specific subtypes as if they are normal Tensors. dtype constraints are not enforced in compilation either.
  warnings.warn(
Traceback (most recent call last):
  File "/home/nhd7682/SNL_VIT/mpc_inference.py", line 164, in <module>
    compile_torch_to_mhlo(model, data)
  File "/home/nhd7682/SNL_VIT/mpc_inference.py", line 132, in compile_torch_to_mhlo
    module = torch_mlir.compile(
             ^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch_mlir/__init__.py", line 419, in compile
    scripted = torch.jit.script(model)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_script.py", line 1324, in script
    return torch.jit._recursive.create_script_module(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 559, in create_script_module
    return create_script_module_impl(nn_module, concrete_type, stubs_fn)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 632, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_script.py", line 639, in _construct
    init_fn(script_module)
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 608, in init_fn
    scripted = create_script_module_impl(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 632, in create_script_module_impl
    script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_script.py", line 639, in _construct
    init_fn(script_module)
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 608, in init_fn
    scripted = create_script_module_impl(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 636, in create_script_module_impl
    create_methods_and_properties_from_stubs(
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/torch/jit/_recursive.py", line 469, in create_methods_and_properties_from_stubs
    concrete_type._create_methods_and_properties(
RuntimeError:
'NoneType' object has no attribute or method 'expand'.:
  File "/scratch/nhd7682/envs_dirs/spu/lib/python3.11/site-packages/transformers/models/vit/modeling_vit.py", line 126
        if bool_masked_pos is not None:
            seq_length = embeddings.shape[1]
            mask_tokens = self.mask_token.expand(batch_size, seq_length, -1)
                          ~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            # replace the masked visual tokens by mask_tokens
            mask = bool_masked_pos.unsqueeze(-1).type_as(mask_tokens)

Hi @anakinxc, following the recommendations I shifted to flax. But I am facing some errors initializing the nodes.
I ran this line of code
with open(args.config, 'r') as file:
    conf = json.load(file)

ppd.init(conf["nodes"], conf["devices"])

stack trace
Traceback (most recent call last):
  File "/home/nhd7682/SNL_VIT/flax_mpc_inference.py", line 40, in <module>
    ppd.init(conf["nodes"], conf["devices"])
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 1108, in init
    _CONTEXT = HostContext(nodes_def, devices_def)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 1035, in __init__
    self.devices[name] = SPU(
                         ^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 950, in __init__
    results = [future.result() for future in futures]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 950, in <listcomp>
    results = [future.result() for future in futures]
               ^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 249, in run
    return self._call(self._stub.Run, fn, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 238, in _call
    rsp_data = rebuild_messages(rsp_itr.data for rsp_itr in rsp_gen)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 218, in rebuild_messages
    return b''.join([msg for msg in msgs])
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 218, in <listcomp>
    return b''.join([msg for msg in msgs])
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 238, in <genexpr>
    rsp_data = rebuild_messages(rsp_itr.data for rsp_itr in rsp_gen)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/grpc/_channel.py", line 541, in __next__
    return self._next()
           ^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/grpc/_channel.py", line 950, in _next
    raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:<IP_ADDRESS>:9320: Failed to connect to remote host: Connection refused"
        debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:<IP_ADDRESS>:9320: Failed to connect to remote host: Connection refused {grpc_status:14, created_time:"2023-08-24T00:40:47.789226161-04:00"}"
>

server stack trace
python nodectl.py --config 2pc.json up
[2023-08-24 00:22:26,689] [Process-1] Starting grpc server at <IP_ADDRESS>:9320
[2023-08-24 00:22:26,691] [Process-2] Starting grpc server at <IP_ADDRESS>:9321
[2023-08-24 00:39:57,319] [Process-1] Run : builtin_spu_init at node:0
I0824 00:39:58.634897 220717 external/com_github_brpc_brpc/src/brpc/server.cpp:1113] Server[yacl::link::internal::ReceiverServiceImpl] is serving on port=9330.
I0824 00:39:58.636501 220717 external/com_github_brpc_brpc/src/brpc/server.cpp:1116] Check out http://cl003.hpc.nyu.edu:9330 in web browser.

2pc.json
{
    "id": "colocated.2pc",
    "nodes": {
        "node:0": "<IP_ADDRESS>:9320",
        "node:1": "<IP_ADDRESS>:9321"
    },
    "devices": {
        "SPU": {
            "kind": "SPU",
            "config": {
                "node_ids": [
                    "node:0"
                ],
                "experimental_data_folder": [
                    "/tmp/spu_data_0/"
                ],
                "spu_internal_addrs": [
                    "<IP_ADDRESS>:9330"
                ],
                "runtime_config": {
                    "protocol": "CHEETAH",
                    "field": "FM64",
                    "enable_pphlo_profile": true,
                    "enable_hal_profile": true,
                    "enable_pphlo_trace": false,
                    "enable_action_trace": false
                }
            }
        },
        "P1": {
            "kind": "PYU",
            "config": {
                "node_id": "node:0"
            }
        },
        "P2": {
            "kind": "PYU",
            "config": {
                "node_id": "node:1"
            }
        }
    }
}

Hi @dhyani15
You need to put two addresses in spu_internal_addrs

Thanks @anakinxc, I am able to run the code now.
Although I need some design advice. My threat model is Alice who provides ciphertext data and Bob who provides ciphertext model. I want to run end to end inference of one input image from Alice on cipher model provided by Bob.
This is my current spu code that tries to implement it, which doesn't work
def run_on_spu(inputs, targets):
    inputs = ppd.device("P1")(lambda x: x)(inputs)
    model = ppd.device("P2")(lambda x: x)(model)
    outputs = ppd.device("SPU")(model, copts=copts)(inputs)
    outputs = ppd.get(outputs)
    outputs = outputs['logits']
    acc = accuracy(jnp.argmax(outputs,axis=1),targets.numpy())
    return acc

error:
File "/home/nhd7682/SNL_VIT/flax_mpc_inference.py", line 89, in run_on_spu
    model = ppd.device("P2")(lambda x: x)(model)
                                          ^^^^^
UnboundLocalError: cannot access local variable 'model' where it is not associated with a value

I tried doing this earlier according to the llama7b example.
def infer_cipher(inputs, params):
    config = AutoConfig.from_pretrained('google/vit-base-patch16-224-in21k', num_labels=100)
    model_cipher = CustomFlaxViTForImageClassification(config=config)
    model_cipher.params = params
    outputs = model_cipher(inputs)['logits']
    return outputs

def run_on_spu(inputs, targets):
    inputs = ppd.device("P1")(lambda x: x)(inputs)
    params = ppd.device("P2")(lambda x: x)(model.params)
    outputs = ppd.device("SPU")(infer_cipher, copts=copts)(inputs, params)
    outputs = ppd.get(outputs)
    outputs = outputs['logits']
    acc = accuracy(jnp.argmax(outputs,axis=1),targets.numpy())
    return acc

In this case i get some other errors.
Can you please comment how would be a good way to achieve what I want?

UnboundLocalError

Could you please provide more details for us to reproduce your problem? I could not find where is your model defined.

I am using a customized Flax ViT from huggingface.
Here is the high level definition of the model.
class CustomFlaxViTForImageClassificationModule(FlaxViTForImageClassificationModule):
    config: ViTConfig
    dtype: jnp.dtype = jnp.float32

    def setup(self):
        self.vit = CustomFlaxViTModule(config=self.config, dtype=self.dtype, add_pooling_layer=False)
        self.classifier = nn.Dense(
            self.config.num_labels,
            dtype=self.dtype,
            kernel_init=jax.nn.initializers.variance_scaling(
                self.config.initializer_range**2, "fan_in", "truncated_normal"
            ),
        )

    def __call__(
        self,
        pixel_values=None,
        deterministic: bool = True,
        output_attentions=None,
        output_hidden_states=None,
        return_dict=None,
        params = None
    ):

        return super().__call__(pixel_values=pixel_values, deterministic=deterministic, output_attentions=output_attentions, output_hidden_states=output_hidden_states, return_dict=return_dict, params=params)

class CustomFlaxViTForImageClassification(FlaxViTPreTrainedModel):
    module_class = CustomFlaxViTForImageClassificationModule

All the methods are inherited from huggingface implementation.

All the methods are inherited from huggingface implementation.

Hi, I implemented an SPU version of the Huggingface Flax ViT official demo for your reference.
import argparse
import json

import jax.numpy as jnp

import spu.utils.distributed as ppd

parser = argparse.ArgumentParser(description='distributed driver.')
parser.add_argument("-c", "--config", default="examples/python/ml/flax_gpt2/3pc.json")
args = parser.parse_args()

with open(args.config, 'r') as file:
    conf = json.load(file)

ppd.init(conf["nodes"], conf["devices"])

from transformers import AutoImageProcessor, FlaxViTForImageClassification, AutoConfig
from PIL import Image
import jax
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
model = FlaxViTForImageClassification.from_pretrained("google/vit-base-patch16-224")

inputs = image_processor(images=image, return_tensors="jax")["pixel_values"]

def infer_cipher(inputs, params):
    config = AutoConfig.from_pretrained('google/vit-base-patch16-224')
    model_cipher = FlaxViTForImageClassification(config=config)
    outputs = model_cipher(pixel_values=inputs, params=params)
    return outputs

def run_on_spu(inputs, model):
    inputs = ppd.device("P1")(lambda x: x)(inputs)
    params = ppd.device("P2")(lambda x: x)(model.params)
    outputs = ppd.device("SPU")(infer_cipher)(inputs, params)
    outputs = ppd.get(outputs)
    outputs = outputs['logits']
    predicted_class_idx = jax.numpy.argmax(outputs, axis=-1)
    print("Predicted class:", model.config.id2label[predicted_class_idx.item()])

run_on_spu(inputs, model)

Hi @tpppppub,
Thank you very much for sharing your design, using the design you shared I am able to run_on_cpu() but when i run_on_spu() I get the following errors:
Run on SPU
Traceback (most recent call last):
  File "/home/nhd7682/SNL_VIT/flax_mpc_inference.py", line 99, in <module>
    acc_spu = run_on_spu(inputs.numpy(),targets)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nhd7682/SNL_VIT/flax_mpc_inference.py", line 83, in run_on_spu
    outputs = ppd.device("SPU")(infer_cipher)(inputs, params)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 677, in __call__
    results = [future.result() for future in futures]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 677, in <listcomp>
    results = [future.result() for future in futures]
               ^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 249, in run
    return self._call(self._stub.Run, fn, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 242, in _call
    raise Exception("remote exception", result)
Exception: ('remote exception', Exception('Traceback (most recent call last):\n  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 324, in Run\n    ret_objs = fn(self, *args, **kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 579, in builtin_spu_run\n    rt.run(spu_exec)\n  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/api.py", line 45, in run\n    return self._vm.Run(executable.SerializeToString())\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nRuntimeError: what: \n\t[Enforce fail at ./libspu/mpc/cheetah/arith/common.h:33] (b > 0). \nStacktrace:\n#0 spu::mpc::cheetah::Conv2DProtocol::GetInputSize()+0x7f06cc7053c8\n#1 spu::mpc::cheetah::CheetahDot::Impl::Conv2dOLE()+0x7f06cc7038f7\n#2 spu::mpc::cheetah::CheetahDot::Conv2dOLE()+0x7f06cc703e73\n#3 spu::mpc::cheetah::Conv2DAA::proc()+0x7f06cc6eedab\n#4 spu::mpc::Conv2DKernel::evaluate()+0x7f06ccdfa3e5\n#5 spu::dynDispatch<>()+0x7f06cce3633b\n#6 spu::kernel::hal::_conv2d_ss()+0x7f06cce374dd\n#7 spu::kernel::hal::_conv2d()+0x7f06cce28c19\n#8 spu::kernel::hal::f_conv2d()+0x7f06ccdd853e\n#9 spu::kernel::hal::conv2d()+0x7f06ccdc5150\n#10 spu::kernel::hlo::Convolution2D()+0x7f06ccd74811\n#11 spu::device::pphlo::dispatchOp<>()+0x7f06cc7f9a30\n#12 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fa1fa\n#13 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fbc40\n#14 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fd943\n#15 spu::device::runBlock()+0x7f06cc919ea5\n\nstacktrace: \n#0 spu::mpc::cheetah::Conv2DProtocol::GetInputSize()+0x7f06cc7053c8\n#1 spu::mpc::cheetah::CheetahDot::Impl::Conv2dOLE()+0x7f06cc7038f7\n#2 spu::mpc::cheetah::CheetahDot::Conv2dOLE()+0x7f06cc703e73\n#3 spu::mpc::cheetah::Conv2DAA::proc()+0x7f06cc6eedab\n#4 spu::mpc::Conv2DKernel::evaluate()+0x7f06ccdfa3e5\n#5 spu::dynDispatch<>()+0x7f06cce3633b\n#6 spu::kernel::hal::_conv2d_ss()+0x7f06cce374dd\n#7 spu::kernel::hal::_conv2d()+0x7f06cce28c19\n#8 spu::kernel::hal::f_conv2d()+0x7f06ccdd853e\n#9 spu::kernel::hal::conv2d()+0x7f06ccdc5150\n#10 spu::kernel::hlo::Convolution2D()+0x7f06ccd74811\n#11 spu::device::pphlo::dispatchOp<>()+0x7f06cc7f9a30\n#12 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fa1fa\n#13 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fbc40\n#14 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fd943\n#15 spu::device::runBlock()+0x7f06cc919ea5\n\n\n'))

server stack trace
Traceback (most recent call last):
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 324, in Run
    ret_objs = fn(self, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 579, in builtin_spu_run
    rt.run(spu_exec)
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/api.py", line 45, in run
    return self._vm.Run(executable.SerializeToString())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: what:
        [Enforce fail at ./libspu/mpc/cheetah/arith/common.h:33] (b > 0).
Stacktrace:
#0 spu::mpc::cheetah::Conv2DProtocol::GetInputSize()+0x7f06cc7053c8
#1 spu::mpc::cheetah::CheetahDot::Impl::Conv2dOLE()+0x7f06cc7038f7
#2 spu::mpc::cheetah::CheetahDot::Conv2dOLE()+0x7f06cc703e73
#3 spu::mpc::cheetah::Conv2DAA::proc()+0x7f06cc6eedab
#4 spu::mpc::Conv2DKernel::evaluate()+0x7f06ccdfa3e5
#5 spu::dynDispatch<>()+0x7f06cce3633b
#6 spu::kernel::hal::_conv2d_ss()+0x7f06cce374dd
#7 spu::kernel::hal::_conv2d()+0x7f06cce28c19
#8 spu::kernel::hal::f_conv2d()+0x7f06ccdd853e
#9 spu::kernel::hal::conv2d()+0x7f06ccdc5150
#10 spu::kernel::hlo::Convolution2D()+0x7f06ccd74811
#11 spu::device::pphlo::dispatchOp<>()+0x7f06cc7f9a30
#12 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fa1fa
#13 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fbc40
#14 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fd943
#15 spu::device::runBlock()+0x7f06cc919ea5

stacktrace:
#0 spu::mpc::cheetah::Conv2DProtocol::GetInputSize()+0x7f06cc7053c8
#1 spu::mpc::cheetah::CheetahDot::Impl::Conv2dOLE()+0x7f06cc7038f7
#2 spu::mpc::cheetah::CheetahDot::Conv2dOLE()+0x7f06cc703e73
#3 spu::mpc::cheetah::Conv2DAA::proc()+0x7f06cc6eedab
#4 spu::mpc::Conv2DKernel::evaluate()+0x7f06ccdfa3e5
#5 spu::dynDispatch<>()+0x7f06cce3633b
#6 spu::kernel::hal::_conv2d_ss()+0x7f06cce374dd
#7 spu::kernel::hal::_conv2d()+0x7f06cce28c19
#8 spu::kernel::hal::f_conv2d()+0x7f06ccdd853e
#9 spu::kernel::hal::conv2d()+0x7f06ccdc5150
#10 spu::kernel::hlo::Convolution2D()+0x7f06ccd74811
#11 spu::device::pphlo::dispatchOp<>()+0x7f06cc7f9a30
#12 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fa1fa
#13 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fbc40
#14 spu::device::pphlo::dispatchOp<>()+0x7f06cc7fd943
#15 spu::device::runBlock()+0x7f06cc919ea5

Hi @dhyani15
This looks like a bug in our code. I'll check if it's still in the latest version.

Thanks @anakinxc very grateful for your support. Yes I ran exactly the same file that was shared by @tpppppub and it gave a similar error. I thought I should mention I installed spu using pip install . Do you think installing from source would resolve this?

Additionally I ran the same experiment under SEMI2K protocol and got the following profiling results, I think this means it runs on SEMI2K and the issue seems to be Cheetah Specific?
 Also HLO profiling is the time taken by the HLO primitives and similarly the MPC profiling is for MPC primitives? What does total send bytes<PHONE_NUMBER>4 mean? The data shared back and forth between bob and alice to produce one inference result? If so how I might go about breaking down layerwise communication cost?

@dhyani15 You got me. There is a bug in cheetah's conv2d kernel. Please pull out the latest version.
In more details, we have temporally remove the conv2d kernel in cheetah, and we just use the img2col to convert the
computation of conv2d as a matmul operation.
For the layer-wsie performance breakdown, unfortunately, we do not have an easy way to do that.

Thanks @anakinxc very grateful for your support. Yes I ran exactly the same file that was shared by @tpppppub and it gave a similar error. I thought I should mention I installed spu using pip install . Do you think installing from source would resolve this?

we should provide a new weekly dev build late today.

Thanks for the update, I came across this when going through the documentation here.

A semi-honest NPC-protocol similar to SPDZ but requires a trusted third party to generate offline randoms. By default this protocol now uses trusted first party. Hence, it should be used for debugging purposes only.

Does this mean I cannot run 2 party ml inference like I have done in this example on SEMI2k?

As the documentation described, the trusted-first-party mode is not suitable for production use.

Hi @dhyani15
Can you update to this version?

If I did pip install spu==0.5.0.dev20230825 then it gave me an error that
ERROR: Could not find a version that satisfies the requirement spu==0.5.0.dev20230825 (from versions: 0.3.3b0, 0.3.3b2, 0.4.0b1, 0.4.1b0, 0.4.1b1)
ERROR: No matching distribution found for spu==0.5.0.dev20230825

So I downloaded the whl file and uploaded to my linux machine and tried pip install filename.whl
I got the following error
ERROR: spu-0.5.0.dev20230825-cp38-cp38-manylinux2014_x86_64.whl is not a supported wheel on this platform.
Can you please tell me if there is any other way to get the packages?

for dev, we only build wheel for python 3.8

Thanks, I have a compiler related question.
I am trying to run secure inference on spu, in a two party computation setting.
My question is that I have a code snippet in flax where I doing variable*(softmax(x)) where variable is set to 0 when I load the mode weights. Will the jax compiler optimize this part of code or will there be a softmax(X) calculation performed? Will your spu compiler compile this away?
Best,
Naren

Thanks, I have a compiler related question.
I am trying to run secure inference on spu, in a two party computation setting.
My question is that I have a code snippet in flax where I doing variable*(softmax(x)) where variable is learnable parameter that is set to 0 when I load the pretrained model weights. Will the jax compiler optimize this part of code or will there be a softmax(X) calculation performed? Will your spu compiler compile this away?
Best, Naren

Hi Naren,
This really depends on how JAX compiles this part. If JAX treats variable as a constant, this multiplication can be folded away, otherwise no pass will be able to do this.

Thanks for the update, i am trying to replicate the figure 7 results of this paper on tiny imagenet https://arxiv.org/pdf/2211.13955.pdf which runs secure inference on secretflow using Semi2k. Right now I am getting same latency for 4 different models which the authors claim to range from 200s to 600s. Would you have any comments on what might be the disconnect. Am I using your framework incorrectly?
Previously I thought compiler is not constant folding the non-linear operations, but I am using checkpoints provided by the authors themselves so I think compiler might not be the issue. Is there a specific way i would need to load the model?

Please find my complete script where I load their pytorch checkpoint, convert it into flax and run inference as per the demo script provided by you. Please let me know if this helps you understand why latency not changing?
import argparse
import json
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from transformer_mpc_vit import CustomFlaxViTForImageClassification
from transformers.models.vit.configuration_vit import ViTConfig
from dataloader_tinyimagenet import TinyImageNet
import flax
from flax import traverse_util
import jax.numpy as jnp
import numpy as np
import spu.utils.distributed as ppd
import spu.spu_pb2 as spu_pb2
parser = argparse.ArgumentParser(description='distributed driver.')

parser.add_argument(
    "-c", "--config", default="2pc.json"
)
args = parser.parse_args()
with open(args.config, 'r') as file:
    conf = json.load(file)

ppd.init(conf["nodes"], conf["devices"])

def pytorch_to_flax(pytorch_model_state_dict, flax_model):
    ....

config = ViTConfig(
    image_size=64,  # The size of input images
    patch_size=4,  # Size of patches to be extracted from the images
    num_channels=3,  # Number of channels of the input images
    num_labels=200,  # Number of labels for classification task
    hidden_size=192,  # Dimensionality of the encoder layers and the pooler layer
    num_hidden_layers=9,  # Number of hidden layers in the Transformer encoder
    num_attention_heads=12,  # Number of attention heads for each attention layer in the Transformer encoder
    intermediate_size=384,  # Dimensionality of the "intermediate" layer in the Transformer encoder
    hidden_act="gelu",  # The non-linear activation function in the encoder and pooler
    hidden_dropout_prob=0.,  # The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler
    attention_probs_dropout_prob=0.1,  # The dropout ratio for the attention probabilities
    qkv_bias=False,
    layer_norm_eps = 1e-05
)

checkpoint = torch.load("...", map_location=torch.device('cpu'))
model = CustomFlaxViTForImageClassification(config)
model = pytorch_to_flax(checkpoint['state_dict'], model)

def accuracy(predictions, labels):
    if predictions.shape != labels.shape:
        raise ValueError("Predictions and labels must have the same shape")

    correct_predictions = jnp.sum(predictions == labels)
    total_predictions = predictions.size

    return correct_predictions / total_predictions

model_test = CustomFlaxViTForImageClassification(config)
model_cipher = CustomFlaxViTForImageClassification(config=config)

def infer_cipher(inputs, params):
    outputs = model_cipher(pixel_values=inputs, params=params)
    return outputs

def run_on_spu(inputs, targets):
    inputs = ppd.device("P1")(lambda x: x)(inputs)
    params = ppd.device("P2")(lambda x: x)(model.params)
    outputs = ppd.device("SPU")(infer_cipher)(inputs, params)
    outputs = ppd.get(outputs)
    outputs = outputs['logits']
    acc = accuracy(jnp.argmax(outputs,axis=1),targets.numpy())
    print(acc)
    return acc

def run_on_cpu(inputs, targets):
    # encode context the generation is conditioned on
    # For reproducibility

    outputs = model_test(pixel_values=inputs, params= model.params)["logits"]
    # loss = criterion(outputs, targets)

    acc = accuracy(jnp.argmax(outputs,axis=1),targets.numpy())
    print(acc)
    return acc

if __name__ == '__main__':
    print('\n------\nRun on CPU')
    torch.manual_seed(0)
    data_transforms = {
    'train': transforms.Compose([
        transforms.RandomHorizontalFlip(),
        transforms.AutoAugment(),
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.480,0.448,0.397], std=[0.272,0.265,0.274]),
        transforms.RandomErasing(p=0.25),
    ]),
    'eval': transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.480,0.448,0.397], std=[0.272,0.265,0.274])
    ]),
    'test': transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.480,0.448,0.397], std=[0.272,0.265,0.274])
    ])
    }
    dataset_eval = TinyImageNet(root='/scratch/nhd7682/data/tiny-imagenet-200/', train=False, transform=data_transforms['eval'])
    loader_eval = DataLoader(dataset=dataset_eval, batch_size=1, num_workers=1, shuffle=False)
    inputs, targets = next(iter(loader_eval))
    acc_cpu = run_on_cpu(inputs.numpy(), targets)
    print('\n------\nRun on SPU')
    acc_spu = run_on_spu(inputs.numpy(),targets)

Hi @dhyani15
Something to check:

Network setting?
Runtime config?
SPU version?

Also are you using a prebuild SPU binary or build by yourself?
@fionser @rivertalk anything you guys aware of?
~Anakin

hi @dhyani15
If my understanding is correct, you are reproducing the latency experiment for MPCViT with varying u (that controls the ratio of RSAttention).
If so, could you check the model architecture defined in CustomFlaxViTForImageClassification? If the model architecture is different, the inference latency actually should be different.

Thanks for the prompt response. @llCurious you are right, I am trying to reproduce the paper, the model performs as expected in plaintext i.e. the accuracy correspond to the ones reported in figure 7. This made me think that there might be something wrong with my spu implementation. I know the exact latency numbers won't match but I am not seeing the trend in figure 7, their numbers vary from 200s to 600s between various checkpoints, I am getting a same latency for all checkpoints as if the 'u' is not playing any effect.
This is what the authors mentions:

We follow Cheetah [22] and use the WAN mode
for communication. Specifically, the communication bandwidth between the cloud instances is set to 44 MBps and the
round-trip time is set to 40ms. Our experiments are evaluated on an Intel Xeon<EMAIL_ADDRESS>GHz with 62 GB RAM.

This is the config file i am using. My experiments are on one single cpu instance on hpc system. Is there something I doing wrong here?
{
    "id": "colocated.2pc",
    "nodes": {
        "node:0": "<IP_ADDRESS>:9320",
        "node:1": "<IP_ADDRESS>:9321"
    },
    "devices": {
        "SPU": {
            "kind": "SPU",
            "config": {
                "node_ids": [
                    "node:0",
                    "node:1"
                ],
                "experimental_data_folder": [
                    "/tmp/spu_data_0/",
                    "/tmp/spu_data_1/"
                ],
                "spu_internal_addrs": [
                    "<IP_ADDRESS>:9330",
                    "<IP_ADDRESS>:9331"
                ],
                "runtime_config": {
                    "protocol": "SEMI2K",
                    "field": "FM64",
                    "enable_pphlo_profile": true,
                    "enable_hal_profile": true,
                    "enable_pphlo_trace": false,
                    "enable_action_trace": false
                }
            }
        },
        "P1": {
            "kind": "PYU",
            "config": {
                "node_id": "node:0"
            }
        },
        "P2": {
            "kind": "PYU",
            "config": {
                "node_id": "node:1"
            }
        }
    }
}

This is the config file i am using. My experiments are on one single cpu instance on hpc system.

The configuration should be correct. I notice that your experiments are also performed on one machine. If you want to simulate the same WAN setting (like MPCViT), have you tried tc tool to manually add limitation on the bandwidth and latency?

That's a great suggestion, I will try that. Nonetheless if I were to do this over cloud instances, how would I go about changing my current script to make it run on two cloud node?

You could refer to this document for launching an SPU cluster on multiple cloud instances

Thanks, I ran 2pc.json that I shared above, in server 0 I ran nodeid node 0 and server 1 ran nodeid node 1. Ran the inference script in server 0. Before running the script, checked both server status and had the following node 0 and 1 outputs:
[2023-09-08 02:38:55,610] [MainProcess] Starting grpc server at <IP_ADDRESS>:9320
[2023-09-08 02:38:10,517] [MainProcess] Starting grpc server at <IP_ADDRESS>:9321

After running the main script in node 0, got
Run : builtin_spu_init at node:0
I0908 02:40:46.228287 1089493 external/com_github_brpc_brpc/src/brpc/server.cpp:1127] Server[yacl::link::transport::internal::ReceiverServiceImpl] is serving on port=9330.
I0908 02:40:46.230445 1089493 external/com_github_brpc_brpc/src/brpc/server.cpp:1130] Check out http://cl002.hpc.nyu.edu:9330 in web browser.
[2023-09-08 02:40:46.232] [info] [default_brpc_retry_policy.cc:52] socket error, sleep=1000000us and retry
[2023-09-08 02:40:47.232] [info] [default_brpc_retry_policy.cc:29] cntl ErrorCode '112', http status code '200', response header '', error msg '[E111]Fail to connect Socket{id=0 addr=<IP_ADDRESS>:9331} (0x0x7fa710061580): Connection refused [R1][E112]Not connected to <IP_ADDRESS>:9331 yet, server_id=0'
[2023-09-08 02:40:47.232] [info] [default_brpc_retry_policy.cc:75] aggressive retry, sleep=1000000us and retry
[2023-09-08 02:40:48.233] [info] [default_brpc_retry_policy.cc:29] cntl ErrorCode '112', http status code '200', response header '', error msg '[E111]Fail to connect Socket{id=0 addr=<IP_ADDRESS>:9331} (0x0x7fa710061580): Connection refused [R1][E112]Not connected to <IP_ADDRESS>:9331 yet, server_id=0 [R2][E112]Not connected to <IP_ADDRESS>:9331 yet, server_id=0'
[2023-09-08 02:40:48.233] [info] [default_brpc_retry_policy.cc:75] aggressive retry, sleep=1000000us and retry

How can i run colocated mode in two cluster nodes?

You should replace nodes' IPs with your servers' IPs in each server's configuration. Both nodes and spu_internal_addrs fields should be modified.

Thanks, that worked but now a new error popped up.
Node 0 logs
File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 323, in Run
    args, kwargs = tree_map(lambda obj: self._get_object(obj), (args, kwargs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/jax/_src/tree_util.py", line 252, in tree_map
    return treedef.unflatten(f(*xs) for xs in zip(*all_leaves))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/jax/_src/tree_util.py", line 252, in <genexpr>
    return treedef.unflatten(f(*xs) for xs in zip(*all_leaves))
                             ^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 323, in <lambda>
    args, kwargs = tree_map(lambda obj: self._get_object(obj), (args, kwargs))
                                        ^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 343, in _get_object
    obj = self._node_clients[ref.origin_nodeid].get(ref)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 261, in get
    return self._call(self._stub.RunReturn, builtin_fetch_object, ref.uuid)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 242, in _call
    raise Exception("remote exception", result)
Exception: ('remote exception', Exception('Traceback (most recent call last):\n  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 308, in RunReturn\n    result = fn(self, *args, **kwargs)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/scratch/nhd7682/envs_dirs/spu-jax/lib/python3.11/site-packages/spu/utils/distributed.py", line 258, in builtin_fetch_object\n    return server._globals[ObjectRef(refid, server.node_id)]\n           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nKeyError: ObjRef(f9100788-ea12-4db5-96cb-711560661d62 at node:1)\n'))

Thanks, it is running on the two nodes of hpc, i.e. two different machines. So this replicates the LAN setting, but all it did was reduce the time from ~250s to ~175s. All four checkpoints still exhibit the same inference latency time. So I don't think the network setting is the issue here.

We recommend you contact MPCViT's authors directly as most SecretFlow members have no knowledge about the details of this paper.


Proposal: present a link to the application dashboard while user waits for Download.

It may be nice to present a link in the quickStart CLI which points to the dashboard of the application they are working on, so they can see that the device is in the "connecting.." state on the dashboard. This will allow them to explore the dashboard while they wait for OS download. However, this needs to be thought about in the context of the full user flow and make sure it makes sense.

Closing as unnecessary for now.


Error while compiling for windows universal: 'OSWinrt': cannot instantiate abstract class

I am running Windows 8.1 64-bit with 32-bit Python 2.7.11 and 32-bit pywin32 build 220 and scons 2.5.0 with Godot source cloned from the branch 'master'.
When running (using a Visual Studio 2015 x64 Vative Tools Command Prompt):
scons platform=winrt
from the source directory it will run for a few seconds then give this error:
platform\winrt\app.cpp(71): error C2259: 'OSWinrt': cannot instantiate abstract class
platform\winrt\app.cpp(71): note: due to following members:
platform\winrt\app.cpp(71): note: 'Size2 OS::get_window_size(void) const': is abstract
C:\godot\core\os/os.h(167): note: see declaration of 'OS::get_window_size'
platform\winrt\app.cpp(114): warning C4291: 'void *operator new(size_t,const char *)': no matching operator delete found; memory will not be freed if initialization throws an exception
c:\godot\core\os/memory.h(207): note: see declaration of 'operator new'
scons: *** [platform\winrt\app.winrt.tools.x64.obj] Error 2
scons: building terminated because of errors.

IIRC WinRT port is not complete and considered not supported yet,
so you will have to investigate the problem and provide fix.
@reduz correct me if I'm wrong.

It's indeed a work-in-progress and hasn't received much attention lately, so I'm not surprised it doesn't build. That doesn't mean that the OP should find a fix by themselves, any interested contributor can investigate and try to find a fix. It's likely easy to reproduce the bug.

@punto- probably knows better about this.

The same thing happens with Visual Studio 2013 on Windows 8.1 and with Visual Studio 2013 and Visual Studio 2015 on Windows 10.

I was trying to build version 1.0 (from git branch) and am now getting an error linking 'libEGL.lib'. Does anyone know why that is or how to fix it?

WinRT is totally broken, even if you manage to build it won't work (even in 1.0 I'd guess, though I haven't tested). libEGL.lib, libGLESv2.lib and libANGLE.lib are all from the ANGLE project. You can build it from the MS repo (which have solutions ready) or from the upstream from Google (which needs the depot_tools).
I'm currently working on this platform to make it work fully and already made quite a progress, but there are still stuff missing. Hopefully it'll be on master soon and ready for 2.2.

Likely fixed by #6363.


go.mod k8s.io updates and buildah fix

Closes: #1780

@eero-t are you fine with the suggested buildah fix?
@hj-johannes-lee PTAL and merge if ok

@eero-t are you fine with the suggested buildah fix?

Yes.   It would still be nice to know what's the root cause, but in the meanwhile it's acceptable workaround.
(Cannot say anything about the other changes though, so approval needs to come from somebody else.)

Yes. It would still be nice to know what's the root cause, but in the meanwhile it's acceptable workaround.

:+1 FWIW, my host dmesg shows something that looks related: [55853.131352] audit: type=1326 audit(1721716790.685:552): auid=1001 uid=1001 gid=1002 ses=20 subj=unconfined pid=317640 comm="tar" exe="/usr/bin/tar" sig=0 arch=c000003e syscall=452 compat=0 ip=0x78a577c8fe8e code=0x50000

unfortunately not enough authority to merge it.


360 degree fishbowl

Hi, I'm having trouble starting VR. 95% of the time I get either 1) 360 degree fishbowl; 2) left eye right eye, but they're the wrong way around.
I have found that if I alt-enter around 20 times, The game will finally initialise in VR properly (and it looks fantastic!) but it sometimes reverts to fishbowl or wrong-eye when I go into the menu.
I am running Vive Pro 2; rtx 3090; 10900k.

Known issue, duplicate issue.


Phoenix CSV BulkloadTool fails with "Global tag is not allowed" error on transactional table

This changes removes the shading of org.apache.omid and hence trusted lists defines in OMID goes through successfully and don't error out.

Please move this ticket to the PHOENIX project, and rename patch description in the PR, @nikita15p .

Sure @stoty


Fix package name.

Sorry, the namespace thing didn't really work. It worked for BuckleScript, but Webpack could not find the package with the name from bsconfig.json (re-logger). The name in bsconfig.json needs to match the name in package.json (@cca-io/re-logger).
But then we would end up with the namespace CcaIoReLogger. So I removed the namespace setting again and just renamed Logger.re(i) => ReLogger.re(i).

As 1.0.0 is broken anyway, this may as well be 1.0.1.


Receiving deprecation warning when using registerAs param

just formalizing an issue brought forward by @abercrave (PR #21)

this warning is caused by these lines
problem is resolved by: PR #23

@Suven have you had a chance to look at this?

@Suven: the PR from @abercrave should solve this issue

Fixed by merging #21
I'll release a new tag after I ditched into some more PR's. Sorry for the delay


perf: don't keep all fuzz case traces

Motivation
Closes #2796

Solution
only keep 1 set of traces per fuzz test, which gets rid of fuzz_cases - 1 (redundant) traces (255 by default).
this greatly reduces memory consumption in verbose mode -vvv
previously running forge test --no-match-contract 'Element|AceOfZk|StabilityPoolBridge' --no-match-test 'testRedistribution' -vvv on https://github.com/AztecProtocol/aztec-connect-bridges peaked at ~12GB (due to large number of fuzz cases in combination with heavy test functions)
with this fix it's down to ~220MB peak

lgtm, but i'm still unsure why we need 'good' traces for normal fuzzing, since I don't think we show them at all?

yeh, I think it's to satisfy the TestResult{traces} field, which makes sense that you at least have 1 set of traces per test.
now mem consumption for fuzz traces are the same as for regular test cases, so this seems appropriate to have.


[not for merge] Masking rules backport to 19.11

Build & CI run.
Masking rules backport to 19.11 - #5710 + Alexey commits + #6810

Ok.


use json inspect

Pull Request Test Coverage Report for Build 3377
Details

0 of 0   changed or added relevant lines in 0 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage increased (+0.5%) to 83.327%

Totals

Change from base Build 3376:
0.5%

Covered Lines:
4113

Relevant Lines:
4936

💛  - Coveralls


Error with React 18 in development mode

Expected behavior
Daily works in development mode: The DailyProvider manages creating and destroying the callObject correctly.
Describe the bug (unexpected behavior)
With react 18 running in development mode, it throws the error Duplicate DailyIframe instances are not allowed, essentially breaking the app in dev mode.
This is due to react 18 rendering the app twice in development mode.
Maybe the call object is not cleaned up correctly on unmount?
Steps to reproduce

Create a react app npx create-react-app my-app
Replace App.js with the following:import { DailyProvider } from '@daily-co/daily-react';
import './App.css';

function App() {
	return <DailyProvider>Hello World</DailyProvider>;
}

export default App;

Run the development server npm start
It now throws the error Duplicate DailyIframe instances are not allowed

System information

Device:
OS, version:
Browser, version:

Additional context
Daily versions:
		"@daily-co/daily-js": "0.45.0",
		"@daily-co/daily-react": "^0.8.0",

@TimoBechtel This issue should be fixed in Daily React 0.9.0.
Let me know in case you're running into any issues after updating.


Add support for attr_accessible

This is often used to specify the publicly available fields in an Active Record.

Will do, good idea.


Issue setting values from / to JSON Objects?

Hello, it seems that this implementation of JsonPath works pretty well when setting the first level of keys of an object (from existing to new instance).. eg
if we set values this way (with the specific options set in "jsonConfig" below):
where data is defined as a Map<String,Object> "json object"
Configuration jsonConfig = Configuration.builder()
           .options(DEFAULT_PATH_LEAF_TO_NULL, SUPPRESS_EXCEPTIONS)
           .build();
Map<String, Object> newObject = new LinkedHashMap<>();
DocumentContext reader = JsonPath.parse(data, jsonConfig);
DocumentContext writer = JsonPath.parse(newObject, jsonConfig);

JsonPath fromPath = ..
JsonPath toPath = ..
value = reader.read(fromPath);
writer.set(toPath, value);

then this works for all first level keys.. eg
$.key1 => $.key
$.car => $.plane
$.house => $.boat
.. and so on

The above, causes newObject to be filled in with the desired new keys on the right using the data that had been previously set from the source "data" set.
But if I'm trying to convert to nested paths such as these, it does not work and the newObject map above is not filled in:
$.key1 => $.nested.key
$.car => $.nested.plane
$.house => $.nested.boat
.. and so on

Is there a better way of doing that that I am overlooking?  Or can this be a bug?

If we trying to add something to empty json ("{}") by Json Path like "$.nonexistent.node" we can see an exception
com.jayway.jsonpath.PathNotFoundException: Missing property in path $['nonexistent']
It was cool, if we have some option to create an absent part of json path if it is expected


Development branch doesn't render

I downloaded and installed the Master branch on my web server and it worked fine. Made no adjustments just did a simple FTP to my server. The example DOCS worked fine.
I had an issue with the Master Branch, that I did not file a report about, where an index.md at a folder level was not rendering.
I looked through the issues and they seemed to indicate I should install the development branch.
So, I download the dev branch and installed it complete as a test.
Nothing renders for me on a clean install. Total blank screen.
My server is a Mac running Apache 2.2.29 and php 5.4.34

Hi,
sorry for the long answer time, your version of php and apache should work with the development branch, can you enable logging or check in the apache error logs to see if there are more informations ?
as I can't reproduce your error on my machine I won't be able to help you out without an error message.

Hi, I made some fixes on the development branch for php 5.4, reopen the issue if you still get the problem


Typo

Hey @voku
just a typo in the examples...
Cheers!

This change is

Thanks for the fix! :+1:

No worries, happy to help out!


Rewrite OSOReaderToMaster::hint

Zap is seeing sporadic (but frustraingly impossible to reproduce) crash
reports from inside this function, specifically in the part that parses
%argrw hints.
There was a longstanding comment:   // FIXME -- use string_view ops here
So, sure, rewrite the whole thing using string_view and Strutil::parse
functions, and remove the assertions, and put extra guards to make sure
we aren't acessing a symbol or op (via blah.back()) if there aren't any
in the vector yet, and pretty much just let it ignore or be robust to any
malformed hints.
I've never seen a repro case, so I don't know that this will fix it, but
it's programmed a lot more defensively now, so hopefully there will be
no further crashes (after I backport this to whatever version Zap is
using).  I even put in an error message for a certain way to malform
%argrw, in the hopes that it might give us a clue, but even that is just
a guess.

LGTM!


[TS Migration] Migrate CheckboxWithLabel.js component to TypeScript

Details

Fixed Issues

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

Log into the app
Navigate to the Settings page
Navigate to the Wallet page
Click the 'Add bank account button'
Select 'Debit card'
You should see the CheckboxWithLabel component on the bottom (I accept the Expensify Terms of Service)
Make sure it looks and works properly

[x] Verify that no errors appear in the JS console

Offline tests

N/A
QA Steps

Same as Tests section above

[x] Verify that no errors appear in the JS console

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 approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
[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 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-compressed.webm

Android: mWeb Chrome
chrome-compressed.webm

iOS: Native
https://github.com/Expensify/App/assets/44364829/dd50a5e1-94d1-4ba6-833e-420c6ae11d00

iOS: mWeb Safari
https://github.com/Expensify/App/assets/44364829/99be233d-22be-42d3-b74b-3ca3bb36fec5

MacOS: Chrome / Safari
https://github.com/Expensify/App/assets/44364829/35f40eed-e575-4b2c-a338-3527a89cd35c

MacOS: Desktop
https://github.com/Expensify/App/assets/44364829/c2484842-cb6c-43e1-89df-9b8edf4ae7da

@pac-guerreiro feel free to take another look 😄

@JKobrynski LGTM 👍

@mountiny no engineer here either, can you help? 😄

: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/arosiclair in version: 1.4.14-0 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
failure ❌

🕸 web 🕸
success ✅

🚀 Deployed to staging by https://github.com/arosiclair in version: 1.4.14-0 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅

🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.4.14-6 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
failure ❌

🕸 web 🕸
success ✅


[Addition]: PantherX cluster (10 HS)

Hotspot b58 Addresses
112XX4Zxfz4zqKAn16yxwEe7xaGaRjRPEkvJTQqxXD6NSz7vQuas
116oLrPk1ww9V1DgbmtCe9End9ytDmmpS433GmMUxkbg7oREiia
117WF3RNuoEP2XYzCxGY1Yg4Vhv2s68sTAfBGzvNHfVQwGVWxDr
11CRsfxhoufMKNyapk3jLJ7bk2Cp8WFY9CiyAACgMfjQffDmc57
11EgDJ7jfJnFjzFtoHVf6k6Ca6RMc7Kz7hEXUkJzcRSaG8kw9eK
11J9eJkQiJdP981TYh4Q2UFnbgyppFtAFkH3PXKbDMUfbHQDrWU
11muWXtBS9DpiVgJXRceJK7GZ8X7G3YrGxbHY3N5szr3vMfgsJy
11nYwHCULdXqJS8sXvjL7NrSgjEZx3MCVrVgUQZD1gq2o5SNye9
11U8b7pmR4JGdW7vrYTmBbBvhufKpX63T4715LsnhSA5qnzHPqT
11zJVcFNcYeu97UtSkHxnfEZLkmBskgkQYUU2HAC41wy54dZ7Gt
Discord Handle
No response
Reason(s)
These Hotspots are only witnessing their own brand, have very often a unlikely (perfect) placement, same assertion date-range(s) and usually there are enough real hotspots arround but these do not get witnessed at all.
High Clustering Coefficient and/or Clique size above the thresholds which are considered normal on the network.
Below some proof of the cluster(s):

https://explorer.helium.com/accounts/143EUPXwoHz7zwfj8hDgTpKr8qbzQ1QqFrjpk24CNdF2QE82NFo
https://explorer.helium.com/hotspots/112ACDJSDoqVUkDzhkrutc7oRhDUF5NoCoZ8K39Zyok8LHMYdDaD
These are more fake, don't you say


Process results now also creates github issues for flaky tests.

Also fixes the rebuild logic allowing the test results to be reprocessed/re-reported/re-pushed to github issues.

Tested here:  https://github.com/diem/diem/runs/2955458669?check_suite_focus=true
Generated issues like: https://github.com/diem/diem/issues/8671


Android Support

Hi team,
First of all kudos for the amazing work you've done on Passwordless.dev! I'm planning on integrating passkeys in an Android project and since I wanted to keep the backend as simple as possible I found this a great opportunity to make use of Passwordless.dev. That being said, do you plan on making a client SDK for Android as well?
Best regards :)

Hi @mrmitew, we currently have an Android SDK in development. Take a look here.


Set tail of element to None if tail was added as text

Changes:

I set the tail of an element to None if its tail was added as text in the process_node function

In the process_node function, the tail of an element is added as text if the element doesn't contain any text but the tails stays the same, so the tail content is duplicated.
https://github.com/adbar/trafilatura/blob/e81cffe11cb8de03cb177fd2cd3055c7d1824834/trafilatura/htmlprocessing.py#L346-L347
I think the tail should then be set to  None (resp. empty string), as in
https://github.com/adbar/trafilatura/blob/e81cffe11cb8de03cb177fd2cd3055c7d1824834/trafilatura/htmlprocessing.py#L314-L318

Indeed, good catch!


Call signature returning a wide union type not seen as compatible with implementation

Bug Report
🔎 Search Terms
overload "not compatible" 2394 union return type
🕗 Version & Regression Information

This is the behavior in every version I tried, and I reviewed the FAQ for entries about overloads and unions

⏯ Playground Link
Playground link with relevant code
💻 Code
function foo(x: true): 0 | 1; // error!
// ----> ~~~
// This overload signature is not compatible with its implementation signature.(2394)
function foo(x: false): 2;
function foo(x: boolean) {
  return x ? 0 : 2;
}

🙁 Actual behavior
The compiler complains that the first call signature which returns 0 | 1 is not compatible with the implementation signature which returns 0 | 2.
🙂 Expected behavior
The compiler "should" allow the 0 | 1 call signature return type because of the significant overlap with 0 | 2.

So, this is probably not actually a bug, but I'm having a hard time locating any canonical documentation or issues that mention this particular behavior.   It makes sense for the compiler to warn that a call signature is claiming to return something the implementation can never return, but in this particular instance (adapted from this SO question) it seems unfortunate/misplaced: while the implementation cannot return a value of type 1, it can return a value of type 0 | 1.  Obviously there are workarounds, the easiest of which would be an explicit implementation return type annotation of the full union 0 | 1 | 2:
function foo(x: true): 0 | 1;  // no error now
function foo(x: false): 2;
function foo(x: boolean): 0 | 1 | 2 {
  return x ? 0 : 2;
}

So... is this working as intended?  If so, could someone explain the intent?  Thanks!

The rules are a mess of backcompat that no one wanted to write down.
Basically the idea is to detect totally wrong situations and not too much else extra, keeping in mind the limitation that we're analyzing the function body opaquely. I believe for the return type we use "assignable to or from", which is where this is getting tripped up because 0 | 2 (the inferred type) is neither a subset nor superset of 0 | 1.
We might want to update this to just "comparable" which would allow it due to nonempty overlap


Replace custom Resource with Spring Resource

What needs to be done
Replace all usages of org.springframework.sbm.project.parser.Resource with org.springframework.core.io.Resource.
Remove mapping and declaration of org.springframework.sbm.project.parser.Resource
Why it needs to be done
The MavenProjectParser uses a custom Resource implementation.
In ProjectContextInitializer the custom Resource gets mapped to a Spring Resource.
This is a relict and can be removed so only Spring Resource is used.

done


[Feature]: Associate a label to a Select

Describe the feature
We should be able to focus a SelectTrigger by clicking on an associated label. Like in this example here. But currently you would have to use asChild and render a button with an id to get this functionality.
<label for="fruit">Friut</label>
<SelectRoot>
  <SelectTrigger id="fruit">
    <SelectValue placeholder="Please select a fruit" />
  </SelectTrigger>
</SelectRoot>

Additional information

[X] I intend to submit a PR for this feature.
[ ] I have already implemented and/or tested this feature.

Sorry @jeppe-smith  I dun quite understand. https://stackblitz.com/edit/vkhvi8?file=src%2FApp.vue shows SelectTrigger already receiving id as inherited attribute.

Closed as not applicable.The SelectTrigger already receiving the id attribute via attribute fallback. Example provided in the link above


Multiple cookie headers not serialized correctly on HTTP/2

Describe the bug
It looks like cookies are not correctly serialized when the browser sends multiple cookie headers over HTTP/2.
Over HTTP/2 multiple cookies shows up comma separated (e.g. first=1,second=2) in req.headers.cookie in server-side code. This means cookie libraries such as cookie are unable to parse them correctly.
The behaviour seems to have changed recently. Our site worked fine a few days ago. Although we can't pinpoint it exactly. We reproduced this with older versions as well (netlify v6.1.6, netlify-cli v3.4.7, next-on-netlify v2.8.7). Could something have changed in Netlify recently?
To Reproduce
We made a minimal example project: https://github.com/frigus02/test-netlify-plugin-nextjs-cookies
Steps to reproduce are in the readme. It shows different behaviour when run locally and deployed on Netlify.
It's currently deployed under: https://test-netlify-plugin-nextjs-cookies.netlify.app
Expected behavior
req.headers.cookie should be first=1; second=2 even when the browser sends multiple cookie headers with HTTP/2.
Investigation
We investigated further and saw in Wireshark, that browsers send multiple cookie headers when using HTTP/2:
cookie: first=1
cookie: second=2

but only 1 header with using HTTP/1.1:
cookie: first=1; second=2

This distinction is not visible in browser devtools, sadly. But it seems to be according to the spec.
We think the code that serializes with a comma instead of semicolon is this line:
https://github.com/netlify/netlify-plugin-nextjs/blob/46526f955240dfcd1f65c4ecfa0c563ce2b1362d/src/lib/templates/createRequestObject.js#L64
Versions

Next.js: 10.2.0
plugin: 3.2.0

If you're using the CLI to build

OS: macOS
netlify/cli version: 3.24.3

If you're using file-based installation

netlify.toml: https://github.com/frigus02/test-netlify-plugin-nextjs-cookies/blob/91b3311848ae46b4933eef603fa33d6aaca6c81d/netlify.toml

@frigus02 hey! https://answers.netlify.com/t/bug-netlify-functions-event-headers-cookie-sometimes-suddenly-used-comma-instead-of-semicolon/36793/12 does this look like your same issue? are you still seeing it or has it resolved for you as well?

Hi @lindsaylevine. This does sound exactly like the issue we were seeing, yes. Thanks for the quick response.
The test site under https://test-netlify-plugin-nextjs-cookies.netlify.app/ doesn't have the issue anymore. I will test our real site tomorrow and report back. But I assume it's fixed and we can close this issue.

@frigus02 of course! shoutout to @mraerino who did the navigating of this issue. i'll close for now but if for some reason your real site doesn't work we can always reopen!


Initial listings fix

@iainnash submitting a pull request for another minor update. more comprehensive questions + commments found in this pull request (with a few diff commits) I submitted earlier
change:

added the ability to pass in an initial array of Listing structs upon contract initialization (so would be something you pass in to the factory deploy call). that way someone could deploy a new curation contract already preloaded with their curatorial choices (ex: think mixtapes) in one transaction for ultimate smoothness. what do you think? is the commit I referenced in question #1 in this pull request

cc @salieflewis for visibility since this will impact the curation factory flow

lgtm some nits where
if (Z != 0) may want to use if (Z > 0) instead for gasss and cleanliness.


ARTEMIS-1799 - Add a NotificationActiveMQServerPlugin

Adds a new plugin that will support sending new types of notifications
for broker events which will allow enhanced broker monitoring

I don't understand the confusion.  That call just calls off to any registered plugins if they exist.   But it only fires off that notification if the flag in the plugin is set to true.

@cshannon I see. .thanks for the clarification. merging it.

@clebertsuconic - thanks for merging


v0.0.6

Codecov Report
Base: 88.97% // Head: 75.97% // Decreases project coverage by -13.00% :warning:

Coverage data is based on head (a43cc6e) compared to base (5f2654a).
Patch coverage: 69.44% of modified lines in pull request are covered.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
Additional details and impacted files
@@             Coverage Diff             @@
##             main       #1       +/-   ##
===========================================
- Coverage   88.97%   75.97%   -13.00%
===========================================
  Files           5       17       +12
  Lines         136      383      +247
  Branches       14       53       +39
===========================================
+ Hits          121      291      +170
- Misses         11       82       +71
- Partials        4       10        +6

Impacted Files
Coverage Δ

easyflake/grpc/server/exec.py
40.62% <40.62%> (ø)

easyflake/grpc/protobuf/sequence_pb2.py
52.94% <52.94%> (ø)

easyflake/grpc/protobuf/sequence_pb2_grpc.py
57.89% <57.89%> (ø)

easyflake/node/rpc/client.py
58.22% <58.22%> (ø)

easyflake/node/base.py
80.00% <80.00%> (ø)

easyflake/node/rpc/factory.py
85.00% <85.00%> (ø)

easyflake/grpc/server/servicers.py
91.66% <91.66%> (ø)

easyflake/__main__.py
92.00% <92.00%> (ø)

easyflake/__init__.py
100.00% <100.00%> (ø)

easyflake/easyflake.py
90.69% <100.00%> (+0.22%)
:arrow_up:

... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.


Added NVRVirtualHand and NVRVirtualInputDevice to use with NPC and remote users

Attach NVRVirtualHand to the hands of NPCs and remote users to replay remote interactions over multiplayer. You can control the hand by calling one of three new methods on NVRVirtualHand:

Hold() begins holding the closest interactable
Release() releases the current interactable
Use() triggers UseButtonDown() on the current interactable

I added two new events to NVRHand, OnBeginUseInteraction and OnEndUseInteraction, which can be used to capture the trigger down/up and broadcast them. Using these, we now have NewtonVR working over multiplayer, with grab and release and the trigger working, which is very exciting!

I haven't inspected your code yet, but judging by the description I'm worried about design for lag.  Shouldn't 'Hold' take the interactable to be acted upon as an argument?   If it just grabs the closest thing, and lag or physics makes positioning slightly different on the clients, then they could be out of sync and each client shows the player grabbing a different object.

@SmartCarrion in short, you're right. The Hold() method mainly just wraps PickupClosest() which is what gets called when you try to grab something locally already, so it's basically the same on both sides in that sense. But the On*Interaction events on NVRHand do provide an NVRInteractable so you can send the object that was grabbed and do correction based on that.
Lag is definitely a design challenge in multiplayer VR, but getting NewtonVR to where a virtual hand can grab and use objects is step 1. From here, additional logic will be needed to do prediction and synchronization. It may work to build that into NewtonVR as a next step, but it may be something that ends up needing fine tuning on a case-by-case basis, depending on the type of interaction and gameplay.

We added a few new improvements which help improve replay accuracy a little bit, namely a Hold(withObjectID) method to ensure the virtual hand picks up the correct object and not just the closest. This doesn't replace the need for client-side prediction, but those can be built on top of this as next steps.

I should add that setting an interaction point on the objects makes a big difference to how well this feels :)

Any news on when this might get incorporated, or on changes needed to do so?
We're planning additional multiplayer-related work on our end, so it would be great to get the basics in sync with the main NewtonVR project before getting too far along in our forked repo.

Hi, i just downloaded the last version from the Asset Store. Wehre can i find the   scripts for use it in a Mutliplayer?

@Proktologe to start implementing multiplayer, you'll need to incorporate the modifications from this pull request into your project, and then you can attach virtual hands (the NVRVirtualHand component) to the objects that represent your remote players' hands in the scene.
From there, you would send the transform data of each user's hands and use it to update the position of each virtual hand, as well as capturing the various OnBeginUseInteraction events on the regular NVRHand components to know when to call Hold(), Release() and Use() on the virtual hands.
This of course won't recreate the interactions perfectly, due to network latency, but there are techniques for keeping things in sync. Here's a great resource on those techniques:
http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/

Added one more method, EndUse(), to virtualize releasing the use trigger.
@zite, any ETA on looking into merging this?

I had to merge two other PR's into my fork's master branch for manageability, so they're included in this one now too (an intermittent crash in builds that doesn't happen in editor, and separate interaction points for right- and left-handed use).
Any update on looking at these PR's, @zite? It's getting harder to maintain compatibility over several months with no word, and I'd like to keep contributing since we're actively using NewtonVR with multiplayer over here :)

Sorry, been pretty busy. I'll try and take a look at this on the weekend. Thanks for the pull request

So you're using this for networking? Are you using a plugin or something custom? I was thinking just making a kind of dummy item would work better than trying to stub out a whole nvrplayer replacement.
At a minimum I'll need to be able to test this to make sure it works before accepting a push. But just to let you know I may end up going a different route. Can you provide any other code to help me test? If not that's cool, I can try and put something together myself. Multiplayer was on the roadmap anyway.

I'm using this for two things:

Networked users
Replay of recorded user actions

In both cases, I don't use NVRPlayer for them at all (only for the local player), I just attach the NVRVirtualHand to the hand objects that represent remotes and replays and on receiving incoming packets I do one of two things:

For positional data, I apply it to the hand's transform with a bit of lerping (I'm only sending positional data at 30 fps), which doesn't touch NVRVirtualHand at all
For actions like hold, release, etc. I just call the appropriate public method on NVRVirtualHand

A quick test would be:

Create a simple mirrored "player" in the scene (you could call it Dummy and put a Head, LeftHand and RightHand under it with spheres on them)
Add an NVRVirtualHand to each of the dummy's hands
Mirror the NVRPlayer's positional data from the head and hands onto the dummy object on update
Connect the events on each NVRHand to the mirrored NVRVirtualHand's Hold(), Release(), Use() and EndUse() methods

Outside of that, any networking logic stays outside of NewtonVR which could use Unity's networking, Photon, Steamworks, or anything else without requiring any changes to NewtonVR itself.
I can see about setting up an example scene like I described for you too if that would be helpful :)

Ah gotcha! I was just planning on adding a separate scene to newton that showed an example of networking the example scene eventually, so figured I'd start here. Most of that wouldn't be built into "main" newton, just an extra example. Probably going to start with photon first unless you have another preference.

I've been working on our photon implementation and I'm not seeing a direct use for this. It seems like you should be tracking the location of the items separately anyway, otherwise they don't move when you release them. I'm not rendering remote hands yet, so maybe my opinion will change when I get there. But it seems like having this done locally you're going to get some weird situations.
For replaying user action that seems like it could make sense, but with rigidbodies you're going to get into similar weird situations since things aren't deterministic / lag / other object interaction on the rigidbodies. Might as well just track the objects in the recording too.
I appreciate you contributing, and this has pushed me to implement a multiplayer example, but right now it's not looking like I'm going to merge this into main, probably best left in your fork. However, I am adding some hooks and events in that wouldn't have been there without this request, so thanks for that.

Either way it works out, I'm glad even if some of it ends up being useful :)
I'm curious how you see the remote players' actions playing out to each other. When we went to implement hands on our remote avatars, we needed a way of programmatically taking an incoming packet that said "user x grabbed object y" and applying that to the hand/interactable on the receiving end. That's where those extra methods on NVRVirtualHand came in for us, since remote users wouldn't have the NVRPlayer or NVRHand that the local player does.
We've also implemented a couple different methods for replaying object movement, depending on the type of object. Some we don't care if they replay exactly and we just apply the velocity, etc. on release. Others we track more precisely.
Anyway, looking forward to seeing your multiplayer example too. Cheers!

Wellll, I'm kind of doing a 180 here. Initially I had object tracking without modifying any of the player bits. But now that I'm trying to render the players too I realize I probably should just do a full nvrplayer inheritance down to hand. That way each client can just check .IsAttached on objects, get the hand from the player, things like that. I'm skipping over nvrinputdevice right now because it seems kind of redundant, but we'll see how things go as I progress. Just thought I'd give you an update to let you know I'm still working on it.

Since our fork has evolved a bit beyond this PR (adding separate left and right hand interaction points), but is being actively maintained for our project, I've added a wiki page here that describes what we've added. Hope that helps in case these changes are useful for others.