fix: link to auditing with falco

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind user-interface

/kind content

/kind translation

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area blog

/area documentation

/area videos

What this PR does / why we need it:
Which issue(s) this PR fixes:

Fixes #
Special notes for your reviewer:

[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: j-zimnowoda
To complete the pull request process, please assign rajakavitha1 after the PR has been reviewed.
You can assign the PR to them by writing /assign @rajakavitha1 in a comment when ready.
The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

OWNERS

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.
:memo: Please follow instructions in the contributing guide to update your commits with the DCO
Full details of the Developer Certificate of Origin can be found at developercertificate.org.
The list of commits missing DCO signoff:

14ed16d fix: link to auditing with falco

Instructions for interacting with me using PR comments are available here.  If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Hey @j-zimnowoda
before we can look at your PR, we need all commits to be signed off. Could you fix it, please? :pray:

added signed-off

LGTM label has been added.  Git tree hash: 7b7cbbad306c70bfa47e188d64b1c5e6d0390549

[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: j-zimnowoda, leogr
The full list of commands accepted by this bot can be found here.
The pull request process is described here

Needs approval from an approver in each of these files:

OWNERS [leogr]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment


Not downloading on npm

Hello,
i was trying to download the package with "npm i --save awesome-mask" but the download crash after a few seconds.
May be this is a npm issue ?

Hi @BRKsDeadPool we have tested on five devices this week (using effectively the mask) and we are not having problems with installation.
Can you run npm i --save<EMAIL_ADDRESS>?

Same thing.

I think this is a problem in the npm repository, Can you test in another computer?

Same to me...

@alexsandro-xpt using Windows?

Also, can you see your node and npm version?

Yes, using Windows @iCaio Node Version: v7.5.0, NPM Version: 4.1.2

@alexsandro-xpt I have removed the Vue dependency on 0.3.1, can you try these? On the print, the problem is on installing the dependency of the awesome-mask.

Same thing, not work...

I am sorry @alexsandro-xpt but I need to find a computer with Windows to investigate this problem, this can take some time.

Changed the depedency at 0.3.3 version(only and specific this), please try these one.

Thank you so much @iCaio, package instalation is done with<EMAIL_ADDRESS>

@alexsandro-xpt @BRKsDeadPool Vanilla Masker now supports Windows, you can update the Awesome-Mask to latest version 😄


Support contract-first workflow, using the provided Swagger spec

Our users have noticed a problem in the way their Java services, built from Swagger-codegen stubs as the starting point, provide Swagger-UI documentation at runtime.  We'd like to get some perspective from the community, and see if there are known solutions or relevant discussions we may have missed.
Our solution provides a contract-first workflow for Swagger YAML, with an editing environment, real-time views, mocking, testing, and code gen.
Many of the Swagger-Codegen output templates take advantage of code-first Swagger integrations at runtime. The generated code includes annotations and project configurations (e.g. using swagger-core), so the running service dynamically generates Swagger and provides a Swagger-UI web page.
But we don't think this is an ideal solution, for a couple of reasons:

It entails an unnecessary "round trip" from the Swagger spec to annotated code at design time, and from code back to Swagger at runtime. Information can get lost or mangled in this round trip. Some of our users have had difficulty getting a correct and complete Swagger-UI at runtime.
It invites developers to edit the API descriptions directly in the generated code.  This is expected for a code-first workflow. But with a contract-first workflow, we want all edits to be made in the Swagger source spec, and the code re-generated from this. Ideally, development teams will treat the Swagger spec as part of the source code, and code generation as part of the automated build.

So we don't want dynamic generation of the Swagger spec from code. However, these runtime Swagger integrations also perform some important functions that we don't want to lose:

They provide a web page with Swagger-UI pre-configured.
They serve this web page through a designated URL, usually /docs.
They also expose the dynamically assembled Swagger JSON and/or YAML through another URL.
They dynamically configure the Base URL in the generated Swagger, so it points to the running service instance.  This is important, as it ensures that the "Try it out" sandbox feature works correctly, directing requests to the running instance, without any need for deployment-dependent pre-configuration of the Swagger spec.

Our users want to provide a Swagger-UI (or other documentation format) from their services. But they'd just like to use their original Swagger spec, not have it assembled dynamically at runtime.  It seems reasonable to think that this should be an option, but we don't see a straightforward way to do this with the available components.
In particular:

Swagger-UI doesn't have a constructor param to override the base path for the "try it out" button; it uses the base path specified in the Swagger spec. If we want to dynamically set that to the base URL of the running service, we need to pre-process the Swagger spec before passing it into Swagger-UI.
Swagger-core doesn't seem to have an option to serve the Swagger-UI page using a static, pre-defined Swagger spec. AFAICT, it always assembles the Swagger spec from reflection, and uses this as the input to Swagger-UI.
Swagger-codegen doesn't seem to have any standard configuration options to serve a web page with Swagger-UI based on the original Swagger spec. The implementations are platform-specific, and AFAIK all of the Java stub generators rely on Swagger-core to serve the Swagger-UI page at runtime.

Of course our users can write their own code to serve a web page with Swagger-UI, configured to use their original Swagger spec, pre-processed to have the correct base URL.  It's not terribly challenging, but it's not trivial.  And everything in the Swagger component stack seems to be steering them towards dynamic Swagger.
This seems like a curious oversight.  Swagger has matured from a pure code-first solution to the industry standard OpenAPI description language, with robust support for contract-first workflows.  Are we missing something here?
We're experimenting with this, prototyping some possible solutions.  We may consider releasing an open source component that solves this problem for Java (or JVM) services.  But then we'd want to try to make Swagger-codegen (at least the Java stub generators) aware of this, and able to generate code that uses our component instead of Swagger-core.
I don't know if the maintainers of those generators would want to make a change like this.  I'm sure they'd prefer it if Swagger-core and Swagger-UI had their own, native options to work with a pre-defined Swagger spec, and they could just re-tool their generators to support those options.
Thoughts?

Hi @tedepstein, we have many implementations that do just what you're describing.  For example:

swagger-inflector for Java services.
swagger-node for Node services.
connexion for Python (this is a 3rd party tool).

Have you seen those?  Is that different from what you're looking for?

Hi @fehguy.  If I understand correctly, swagger-inflector, swagger-node and (I assume) connexion dynamically interpret the Swagger spec at runtime to drive method dispatch, etc.  Which is cool.
But not everyone wants to use these, especially in the Java space. We have some users working with Jersey, some with Spring, etc., and they want to continue working with generated, idiomatic code for their framework of choice.
They also want their service to provide Swagger-UI through a /docs URL at runtime, with a "try it out" button that directs to the running API instance, and with other URLs to retrieve the Swagger spec in YAML or JSON form. So far so good, swagger-core accommodates these needs nicely.
But they don't want, or need, their carefully crafted Swagger spec to be "encoded" as annotations in the generated source code, then "decoded" by reflecting over the code and re-constituting he Swagger spec at runtime.  This round trip is causing some issues, and steering developers away from Swagger contract-first, back towards code-first (making direct edits to generated code).
We're trying to start down a path that would require some changes to Swagger-Codegen (which we're happy to make, at least in the Java generator modules), but would also be easiest to do if there were direct support in Swagger-Core, which is why I started the conversation here.

Got it.  So essentially still going down a code generation model, but divorcing the implementation from the specification.  It seems to me like that ends up still being a swagger-codegen project, but that upon generation, the code that creates the routes, etc is not annotated at all, and there is a static route to a copy of the swagger definition.
Unless that's incorrect, I suggest this move to the codegen project, and that there are either new templates or new options for the existing templates to avoid writing the annotations and just expect that the swagger definition (and possibly the ui itself) are just static assets in the webapp.

that ends up still being a swagger-codegen project, but that upon generation, the code that creates the routes, etc is not annotated at all, and there is a static route to a copy of the swagger definition.
...
there are either new templates or new options for the existing templates to avoid writing the annotations and just expect that the swagger definition (and possibly the ui itself) are just static assets in the webapp.

Yes, that's the idea.  Happy to move this to Swagger-Codegen.  I think there are some tweaks to Swagger-UI and Swagger-Core that would make this cleaner, but I can open those as separate, lower-level issues.
My first priority was to make sure there wasn't already a strategy for this, being implemented or discussed somewhere.  It sounds like the answer is no, so I'll take that as a green light to open a broader discussion in Swagger-Codegen.  :-)
@fehguy, thanks for your input.


Update Json.NET #7213 (Lombiq Technologies: ORCH-205)

@sebastienros: @domonkosgabor upgraded this package everywhere to the current latest version and tested multiple different features through the Admin (e.g. Autoroute, Blogs), to validate. Please confirm if you agree!


ranger: add video and pdf preview options

Motivation for this change
An attempt to add video & pdf previews to ranger via the nix derivation out of the box
Things done

[x] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
Built on platform(s)

[x] NixOS
[ ] macOS
[ ] other Linux distributions

[ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
[ ] Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
[x] Tested execution of all binary files (usually in ./result/bin/)
[ ] Determined the impact on package closure size (by running nix path-info -S before and after)
[ ] Ensured that relevant documentation is up to date
[x] Fits CONTRIBUTING.md.

Notify maintainers
cc @

I would love to see it installable out of the box. Have you checked the impact on closure size though ? It might be best to provide a module or a wrapper in charge of generating the scope.sh. Would prevent useless rebuilds/caching.

Makes more sense to go for a module straightaway. Maybe even in home-manager if that's what you use ?

A pure nix way to config ranger would be awesome, but how would a module for it look like?
Something like this?
programs.ranger = {
  enable = true;
  imagePreviewSupport = true;
  pdfPreviewSupport = true;
  videoPreviewSupport = true;
  extraConfig = {
    commands = <...>;
    rc = <...>;
    rifle = <...>;
    scope = <...>;
  };
};

You don't have to cover all the configurations items from the start. Just enable and maybe preview= { image .... video ... pdf }; would be enough for a start. Looking at ranger
s manpage, seems like the configuration could be implemented as a plugin (this way no need to patch the default files).

You don't have to cover all the configurations items from the start. Just enable and maybe preview= { image .... video ... pdf }; would be enough for a start. Looking at ranger
s manpage, seems like the configuration could be implemented as a plugin (this way no need to patch the default files).

I'll take a look at this and other reviews an try to write a wrapper as to improve my nix-fu.

Tbh I'm not sure if that's a good idea: programs.x modules are perfectly fine for system-wide configuration but in this case we only use those options to configure the package itself. In this case it might be even harmful as this makes it hard for non-NixOS users (e.g. folks using Nix on Ubuntu) to actually use those features from ranger.

the changes modify the configuration, we shouldn't have to reinstall the package just to modify the config.
Maybe a wrapper would be better but they are not amazingly user friendly (compared to modules that appear in man configuration.nix for instance).
@mtrsk you can look at neovim for a wrapper example.
@ma27 Regarding your remark, maybe it would be best to prepare a home-manager module then ? @mtrsk  do you use home-manager (https://github.com/rycee/home-manager/) ? I so wish both projects could converge.

@mtrsk you can look at neovim for a wrapper example.

Thanks, I'll take a look at the neovim wrapper (for learning purposes).

the changes modify the configuration, we shouldn't have to reinstall the package just to modify the config.
Maybe a wrapper would be better but they are not amazingly user friendly (compared to modules that appear in man configuration.nix for instance).
@Ma27 Regarding your remark, maybe it would be best to prepare a home-manager module then ? @mtrsk do you use home-manager (https://github.com/rycee/home-manager/) ? I so wish both projects could converge.

It seems it's best to close this PR, as adding more options seems to bring more harm than benefits (once we take into account user friendliness). Making a home-manager module for ranger makes more sense.

You can ping me on irc or at home-manager should you have any question, I would really like such a module ;)

Has any progress of the home-manager configuration been made?

@JohnAZoidberg I've never had the time to tackle this


[macOS] Build fail since d3d10 enabled

Compiling both from the git repo as is, and using Valve Proton, the build fails when trying to change the rpath of d3d10core.dll.
Stripping target 'src/d3d10/d3d10core.dll'
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/meson", line 29, in <module>
    sys.exit(mesonmain.main())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 379, in main
    return run(sys.argv[1:], launcher)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 284, in run
    return minstall.run(remaining_args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/minstall.py", line 466, in run
    installer.do_install(datafilename)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/minstall.py", line 298, in do_install
    self.install_targets(d)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/minstall.py", line 442, in install_targets
    install_name_mappings, verbose=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/scripts/depfixer.py", line 412, in fix_rpath
    fix_darwin(fname, new_rpath, final_path, install_name_mappings)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mesonbuild/scripts/depfixer.py", line 394, in fix_darwin
    stderr=subprocess.DEVNULL)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 328, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['install_name_tool', '/Users/luke/src/Proton/build/dxvk.win32/bin/d3d10core.dll', '-change'<EMAIL_ADDRESS>'/Users/luke/src/Proton/build/dxvk.win32/bin/d3d11.dll']' returned non-zero exit status 1.
FAILED: meson-install
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 /opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.

Trying this manually results in:
error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: input file: /Users/luke/src/dxvk/test/bin/d3d10core.dll is not a Mach-O file

I don't support Mac OS X and I have no way to test this.

There is this if you really want to build it on your machine: https://github.com/cheald/dxvk-docker
Originally from: https://github.com/doitsujin/dxvk/pull/543

@doitsujin It's kind of critical to Valve's Proton if they intend to support macOS at all. I'll continue to see if I can fix it.

If they intend to support Mac OS X, someone will have to get MoltenVK into shape and figure out how to link it to dxvk. Right now it is impossible to even use it.

This looks like a meson bug in its dep fixing for macOS. They run otool -l to extract a list of existing rpaths, and assume that this command will fail on a binary we shouldn't be running install_name_tool against, but this isn't actually the case. otool -l will fail to extract anything but still return an exit code of 0 in this case. llvm-objdump: '/Users/kergoth/Sandbox/Proton/build/dxvk.win32/bin/d3d10core.dll': Object is not a Mach-O file type. is the message shown in this case, it returns 0, and then merrily tries and fails to run install_name_tool against.
meson should likely get a workaround to explicitly handle this case, or better yet, don't run mac fixers in the case where we're building with a mingw compiler as we are here. meson shouldn't try to fix up binaries with host tools when the resulting binaries aren't built for the host. I lack the knowledge of meson to say how it should really be addressed. I just hacked it in my local meson install for now.

@doitsujin I'm still exploring everything that encompasses Proton - you say DXVK is actually linking to Vulkan libs?


[SPARK-50155][3.5] Move scala and java files to their default folders

What changes were proposed in this pull request?
The pr aims to move scala and java files to their default folders (src/main/scala and src/main/java), includes:

ByteArrayUtils.java
from: common/utils/src/main/scala/org/apache/spark/unsafe/array/ByteArrayUtils.java
to: common/utils/src/main/java/org/apache/spark/unsafe/array/ByteArrayUtils.java
CustomDecimal.scala
from: connector/avro/src/main/java/org/apache/spark/sql/avro/CustomDecimal.scala
to: connector/avro/src/main/scala/org/apache/spark/sql/avro/CustomDecimal.scala

PS: The pr is backport branch-3.5, master pr is: https://github.com/apache/spark/pull/48691
Note: In branch-3.5, the OrcCompressionCodec.java file does not exist, so there is no need to move it.
Why are the changes needed?
Move scala and java files to the default folder of the project to avoid misunderstandings for spark developers.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Pass GA.
Was this patch authored or co-authored using generative AI tooling?
No.

cc @dongjoon-hyun @MaxGekk

+1, LGTM. Merging to 3.5.
Thank you, @panbingkun.


Implement RWKV

So this is a pretty immense task and I'd start with #45, but...

RWKV is an RNN with Transformer-level LLM performance, which can also be directly trained like a GPT transformer (parallelizable). And it's 100% attention-free. You only need the hidden state at position t to compute the state at position t+1. You can use the "GPT" mode to quickly compute the hidden state for the "RNN" mode.
So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast training, "infinite" ctx_len, and free sentence embedding (using the final hidden state).

It's entirely open-source, so not legally burdened like LLaMA, and (from what I've seen) is more powerful than BLOOM at the same parameter count.
I asked the RWKV Discord which implementation would be worth looking at, and this is what I was told:

RWKV-LM/RWKV-v4neo/src/model.py is the implementation that's actually used to train the large models, it's cuda only and has tons of features you probably don't need.
rwkv_pip_package only implements inference, but is a good implementation and worth a look, recently got a lot more complex due to supporting more and more strategies and including various optimizations.
ChatRWKV/src/model_run is an older version, but haven't played with it so not sure how good it is. Might be worth a look since it's basically an older version of the one in rwkv_pip_package.
RWKV_in_150_lines.py I still haven't fully checked out, but I know it doesn't support GPT mode, so that may or may not be less useful
Also worth a look is RWKV-v4neo/src/model_run.py, which is a small inference-only impl capable of loading the large RWKV checkpoints
I'm not sure if it has GPT-mode, though

So it sounds like rwkv_pip_package is the way to go as source material:
https://github.com/BlinkDL/ChatRWKV/blob/main/rwkv_pip_package/src/rwkv/model.py
The following articles are very useful for understanding how RWKV works:

https://johanwind.github.io/2023/03/23/rwkv_overview.html
https://johanwind.github.io/2023/03/23/rwkv_details.html

An interesting detail from the latter is the following:

The largest number a 16-bit floating point number (float16) can represent is 65 504, anything above that overflows, which is bad. Most of the code has no problems with this, partially because the Layer Normalizations keep values in a reasonable range. However, the RWKV attention contains exponentially large numbers (exp(bonus + k)). In practice, the RWKV attention is implemented in a way where we factor out an exponential factor from num and den to keep everything within float16 range. See for example the time_mixing function in RWKV in 150 lines.

This may pose issues for the GGML 4-bit quantisation format, which is non-optimal. We would likely want GPTQ quantisation.

RWKV is really interesting, but the Python code is absolutely horrendous. I made an attempt to clean it up a little but the author wasn't interested.
I'd look at this one if you were interested in trying to make the Rust code just a frontend to a Python backend: https://github.com/harrisonvanderbyl/rwkvstic
But I sort of don't know what the benefit would be of doing that for a CLI app, because there's already stuff like Oobabooga's text thingy that handles a lot of different model formats with a front end.
I believe the rwkvstic repo I linked is on a path to get added to the actual Transformers repo as one of the supported models. If you wanted to do a Python frontend to stuff, maybe it would make more sense to look at making the frontend for Transformers rather than RWKV specifically. Then you'll just pretty much get that for free one support is merged.
https://github.com/huggingface/transformers/issues/20737
https://github.com/huggingface/transformers/pull/20809

Nah, we'd want to port the actual inference code to Rust, similarly to what we did to llama-rs. The less Python we have in the codebase, the better 🦀

After a whole lot of struggling because I have essentially no idea of what I'm doing with NN or math stuff: https://github.com/KerfuffleV2/smolrsrwkv
Obviously that's not useful as anything more than an example of the basics, but it does work and generates tokens not all that much slower than the simple Torch version.

Oh wow, nice one! That's an excellent start - do you want to try porting it to ggml-rs? (#81 exposes it as a separate library, so you should be able to use a Git dependency)

(By the way, are you in the Discord? It'd be great to chat synchronously if need be)

Thanks, I didn't really do much more than port the Python example here though: https://johanwind.github.io/2023/03/23/rwkv_details.html

do you want to try porting it to ggml-rs?

I'd have to say probably no. I don't think I'm qualified to write a version that's actually worth using in real software. So if you or anyone else wants to use my code as an example or starting point, you're certainly very welcome.
I may mess around with trying to get it to work on backends other than ndarray but I still don't think it'll be suitable for production. Also, sad to say, I have a very short attention span. Just generally speaking, you're probably better off not depending on me for anything long term.

I don't think I'm qualified to write a version that's actually worth using in real software.

Eh, none of us are really LLM experts - it's more a matter of engineering and refinement. I think you're just as qualified as the rest of us. Happy to help any efforts get across the line.

Also, sad to say, I have a very short attention span. Just generally speaking, you're probably better off not depending on me for anything long term.

Don't worry, I know the feeling very well. No worries at all; a driveby contribution is fine as long as it's maintainable, and from what I've seen of your implementation, you're doing fine in that regard.
I'd encourage you to give it a try, but no pressure at all - even if you don't do it, your port will still be a great resource for those coming after (especially with those sweet static types!)

@philpax

I think you're just as qualified as the rest of us.

I don't know know about that! I also really don't know any math stuff either. So I think I'd probably more focus on trying to make it a good example for understanding how the model works in its basic form rather than something that could be used directly.

I'd encourage you to give it a try, but no pressure at all

I did look, but one thing I noticed is it doesn't seem like GGML supports the operations that are required (or I don't know how to work around/refactor based on it). For example, how to do stuff like subtract tensors from a value, or map something like exponent to the elements? It doesn't seem obvious how to do that with the API it provides.
Could be it provides a higher level way to accomplish the same stuff, but unfortunately I don't have a high level understanding of how it works so that's kind of beyond my ability.
Anyway, maybe if you or someone showed me how to do that, porting it to GGML would be more practical. Here's an example of the kind of thing I mean: https://github.com/KerfuffleV2/smolrsrwkv/blob/c21cb8008b51aa10fb2c0eaa2a81714e8c27f76f/src/model.rs#LL125C70-L125C70 (that's elementwise map).

even if you don't do it, your port will still be a great resource for those coming after (especially with those sweet static types!)

Haha, yeah, I honestly found the Python example very hard to follow since there were no types and it was using weird NumPy shortcuts like sometensors[a > b] = 0 — indexing with a boolean expression, what? Figuring out silly stuff like that actually took as much time as writing the actual logic.
I cleaned up/reorganized the Rust version a bit, so hopefully it's easier to understand now. The state part was particularly bad in the initial version.
Anyway,

I also really don't know any math stuff either.

You know your way around a type system, that's good enough for me :P

I did look, but one thing I noticed is it doesn't seem like GGML supports the operations that are required (or I don't know how to work around/refactor based on it). For example, how to do stuff like subtract tensors from a value, or map something like exponent to the elements? It doesn't seem obvious how to do that with the API it provides.

Oh... yeah. Just had some free time to look at this, and yeah, ggml doesn't support some critical operators (it doesn't seem to support any form of exponentiation...).
For subtracting tensors with a value, you'd use op_sub, potentially with new_f32 (if I'm interpreting what you're asking correctly). That being said, there's definitely non-zero challenges here - I was hoping that it was just a case of operations that we left out of the bindings, but it seems like there's actual holes here.
ggml's API is based around building up a computation graph and then executing all the computation at once, but it means that if you need an operation that it doesn't support you'll need to add it yourself.

weird NumPy shortcuts like sometensors[a > b] = 0 — indexing with a boolean expression, what?

Unfortunately, this is something I recognize from my MATLAB days - it's convenient, but it is absolutely bewildering the first time you see it 😅

I cleaned up/reorganized the Rust version a bit, so hopefully it's easier to understand now. The state part was particularly bad in the initial version.

Yeah, nice, appreciate it! Given that you can't actually implement a ggml version of this, I don't have any immediate suggestions for you, but you can explore the other Rust ML libraries if you're curious.
Still, tremendously cool to have a RWKV implementation in easy-to-understand Rust - you should be proud!

After profiling it, 80-90% or more of the time is just spent doing the matrix multiplication. The rest isn't really significant. How crazy would it be to just use ggml for only that one operation. Even having to copy the data every time it probably still would be worth it.
It may be a lot faster, but that still wouldn't really make that code suitable for general use though since it does everything in f32 and there isn't any easy way around that with the current approach.

I'm not convinced that ggml would be faster for the f32 case; I think most of its benefits come through with quantized values, which would be hard to test with RWKV.

Well, the big deal is currently it only uses a single thread. Supposedly ndarray supports threading but I've failed to get it to actually use more than one.
I also messed around with Rayon just running the 3 and 2 groups of .dot() operations in parallel, but it didn't really make a difference because there's one place it's forced to a single thread and one place where it can only run two in parallel. I only got like a 20-30% speed increase at best, when I have 6 cores and 12 threads available.
So just running those matmul ops in parallel would make a huge, huge difference I think.

Hmm, yeah, makes sense. Do the matmuls happen at the end or do they need to be copied back and forth?

Probably have to be copied back and forth. You can look here: https://github.com/KerfuffleV2/smolrsrwkv/blob/main/src/model.rs

channel_mixing (3) — k and r are independent, but vk depends on k.
time_mixing (3) — All independent.
evaluate_layer (1) — Only happens once per step rather than per layer.

Each group is basically all together, but they need data from other calculations and further calculations depend on those results as well.

Maybe it's possible to construct ggml Tensors directly from the ndarray representation? Not sure, though - the reason ggml can parallelize is because the computational graph lets it spread work across without having to wait for the main thread to dispatch more work. It might be possible to set up contexts/graphs to execute the matmuls, but I'm not sure if the overhead makes it worth it.
Setzer's OK with adding more operations to ggml, so we'd ideally do it all there, but it'll require some work to wire up (cf #45).

Your definition of the model looks really clean! Nice work - it's definitely much easier to understand when it's split up like that. I wonder if we can split up llama.rs code like that - it might be a little difficult because of the aforementioned graph, but I don't see it being too troublesome.

@philpax
I found a another way: https://github.com/KerfuffleV2/smolrsrwkv/blob/ab3df0c706ff786a943a3896d7d96b597b45fc98/src/util.rs#L121
It actually runs at acceptable speed now (relatively speaking), even on the 3B model.
Pretty simple now, but getting here was quite the struggle. ndarray claims to use the matrixmultiply crate which supports threading and even has a feature flag to turn it on, but it does absolutely nothing. That's because ndarray just never will even call matrixmultiply for matrix-vector multiplication.
The big issue now is 32bit models just use an insanely impractical amount of memory. I think I may have taken this as far as it can go because stuff like quantization or using non-float types looks to be a huge undertaking.

Fantastic! Yeah, it doesn't look like ndarray supports f16 or lower types - I'm not sure what the best plan of attack is after that. As far as I can tell, none of the other libraries support <f32 inference.
Once #85 lands, we will have opened ggml to extension by us, so we can investigate implementing the functionality needed to implement RWKV. I don't have any other suggestions until then 😅

Looks like someone's going for it https://github.com/saharNooby/rwkv.cpp

Oh, nice. I look forward to ripping off their ide... I mean collaborating in the spirit of open source.

This is probably poor etiquette but there's no ability to create issues in that repo:
@saharNooby Just in case it's useful, tagging you so you're aware of the efforts/discussion here. Also (in even more poor taste) I'll plug my own little Rust implementation: https://github.com/KerfuffleV2/smolrsrwkv
It's possible a C/C++ programmer could look at that and get something out of it (good chance you already know more than I do though).

Hi all! I've completely missed that Issues were not enabled for my repo, but I've enabled them now, thanks for pointing it out!
Looks like our work is closely related by extending ggml, but diverges at actual implementation of the model -- you do it in Rust, I do it in C++. I'll read the thread and code of both repositories and later write a more proper response.
For the context, here's what I know so far:

ggml is missing element-wise max(x, y), exp(x), which are required for RWKV
it is also missing sigmoid(x), but it has silu(x), so I think I can approximate it with ggml_silu(x) / x
layer_norm(x, w, b) works great as ggml_norm(x) * w + b

My next goal is to implement max and exp. I see that this PR would be a great showcase for me of how to add a new operator to ggml!

@saharNooby

Looks like our work is closely related by extending ggml, but diverges at actual implementation of the model -- you do it in Rust, I do it in C++.

What I linked is a separate project (the only relation here is llama-rs wants to implement RWKV and I've also contributed a little bit of code here). My project just uses a general math library to implement a simple version of RWKV by doing the calculations directly on matrices/vectors.
So basically it's just useful for understanding how RWKV fits together. Just from the other stuff you said just now, it seems like you're already past the point of something like that being helpful.

@KerfuffleV2

What I linked is a separate project

I see. I meant your work here in repo llama-rs :)
Anyway, you may be interested in newly added exp, max, 1_minus_x and sigmoid operators for ggml: commit. For now, only forward pass and FP32. I've also added simple test suite that validates results against PyTorch's results.
With new operators, I managed to get non-NaN logits, yay! Will check their correctness against RWKV reference implementation soon.
Looks like ggml now has all required operators for RWKV, and work of anyone who would like to implement RWKV in llama-rs is unblocked.

Interesting. Is there a reason to implement those elementwise operations all separately instead of adding a generic elementwise map operation?
The matrix multiplications matter so much with this, it's crazy. I'm thinking about just setting up a GGML graph for those operations only. The rest can be done in a naive/simple way and still looks to achieve 95% of the maximum performance.

Is there a reason to implement those elementwise operations all separately instead of adding a generic elementwise map operation?

I guess it was simpler for me to just add new operations, copy-pasting code of existing operations; than to invent a new (for ggml) way of doing things... But I agree that generic map operation would work too, if someone implemented it. Not sure how to do it in C/C++.

I can't really help you with the C++ part. Come over to the Rust side!
In seriousness though, you may well end up doing less work overall if you take that approach because it's just one place to worry about changes. You can just have the operation take a function pointer and then apply that function pointer to the element.
Basically same as you're doing in ggml_compute_forward_exp_f32 except you'd call the user function instead of ggml_vec_element_wise_exp_f32. And you'd want one for applying a binary operation between two tensors like ggml_compute_forward_max_f32 — the idea would be the same though.
inline static void ggml_vec_mapv_f32 (
  const int n, float * y, const float * x,
  float (*fun)(float)) {
    for (int i = 0; i < n; ++i) y[i]  = fun(x[i]);
}

static void ggml_compute_forward_mapv_f32(
        const struct ggml_compute_params * params,
        const struct ggml_tensor * src0,
        struct ggml_tensor * dst) {
    assert(params->ith == 0);
    assert(ggml_are_same_shape(src0, dst));

    if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
        return;
    }

    const int n  = ggml_nrows(src0);
    const int nc = src0->ne[0];

    assert(dst->nb[0]  == sizeof(float));
    assert(src0->nb[0] == sizeof(float));
    fun = GET_FUNCTION_DEFINITION_SOMEHOW();
    for (int i = 0; i < n; i++) {
        ggml_vec_mapv_f32(nc,
                (float *) ((char *) dst->data  + i*( dst->nb[1])),
                (float *) ((char *) src0->data + i*(src0->nb[1])), fun);
    }
}

It looks like storing metadata like a function pointer could be pretty annoying. From looking at other functions, it seems like the approach that was used was to use the opt field and create a 1d tensor with one single value. However, it seems to only support i32 as an integer type. The horrible hacky way to use that for a function point would be to just use two of those 32 bit integers to store the top/bottom half of the function pointer and then reassemble it when you need the function pointer. It's annoying to have to do but shouldn't really make a difference for performance.
Note: Many years ago I was a C programmer but I never got into C++. Consider the above pseudocode.

Might be getting annoying me writing so many comments here, but:
I've been working on my Rust RWKV implementation and got 8bit quantization working. I also managed to split it into a library so it would be pretty easy to interface with: https://github.com/KerfuffleV2/smolrsrwkv/blob/main/smolrwkv-cli/src/main.rs
Interestingly, it seems about as fast as the official Python version when running on CPU, however it's basically still too slow to really be practical. the 3B model runs about as fast as a 13B model on llama-rs or llama.cpp. According to profiling, as expected it's just the matrix multiplication that's taking all the time. It's possible it could reach acceptable levels of performance if it could interface with a higher performance matrix multiplication library.
I don't know if this is something that llama-rs would want to depend on even if performance wasn't a problem. It would require a completely separate non-GGML codepath to use.

@KerfuffleV2 Do I understand quantization algo correctly, that for each matrix row, you determine min and max value, and then represent each element as (uint8) ((e - min) / (max - min))?

@saharNooby
Uhhh... I basically cargo culted it from the official version so I don't know that I can give you a good answer here. See:

https://github.com/BlinkDL/ChatRWKV/blob/0d0abf181356c6f27501274cad18bdf28c83a45b/rwkv_pip_package/src/rwkv/model.py#L237
https://github.com/BlinkDL/ChatRWKV/blob/0d0abf181356c6f27501274cad18bdf28c83a45b/rwkv_pip_package/src/rwkv/model.py#L335

The second one is the CPU-based matrix multiplication function for when 8bit quantization is in effect. So those extra values are required at the point you do the MM.
Also worth pointing out is my implementation is based on the example code here: https://johanwind.github.io/2023/03/23/rwkv_details.html
You probably noticed, but only some of the tensors are (or can be) quantized. The smaller and 1D ones are left as 32bit.
I think there are some differences between that and the official version (although the 8bit quantization stuff still seemed to fit in — with some changes). For one thing, the official version transposes some of the tensors while mine doesn't. It also has an extra state item.

Interesting! Yes, we're open to having our own fork of GGML - we'll just have to manage the patches ourselves.
The primary reason that I think they would shy away from it is because a native implementation would almost always be faster (especially with vectorised operations); that being said, it may be sufficient for operations that aren't on the hot path.
I'm not sure if it'd be better to go with @saharNooby's custom implemented operations or to use your solution (or both). How much of RWKV's unsupported operations are on the hot path?

that being said, it may be sufficient for operations that aren't on the hot path.

Operations on the hot path:

Matrix multiplication.

Options not on the hot path:

Everything else.

Okay, that's a little bit of an exaggeration but seriously, most of the stuff (especially for RWKV as far as I can see) is basically insignificant next to the matrix multiplication.
You're 100% write about the map approach likely not being as performant (although note that the map functions work on rows, not individual items so it could potentially be optimized to use SIMD, etc). I'd say it's mostly something to enable flexibility rather than the end of the optimized solution.
I'd rather be able to do something slightly suboptimally than not at all in most cases.

I'm not sure if it'd be better to go with @saharNooby's custom implemented operations

I'm obviously going to be be biased here, but I really prefer the flexible approach rather than hard-coding and having to maintain operations that may only help one particular model. We'll have to see if there's a big performance difference between the two approaches.
My intuition tells me that it's probably not going to be that significant but we'll have to see.

How much of RWKV's unsupported operations are on the hot path?

I'm not really sure how to answer that. What constitutes "the hot" path when setting up a GGML model?
You can see where they set up the RWKV tensors here: https://github.com/saharNooby/rwkv.cpp/blob/e84c446d9533dabef2d8d60735d5924db63362ff/rwkv.cpp#L315
exp, 1_minus_x, exp, sigmoid, max are ones I know definitely weren't already in GGML. I'm not sure if there are others.

This is still a fairly long way off, but you can get a better idea of what ops are missing here: https://github.com/KerfuffleV2/smolrsrwkv/blob/e58d2e39de1c9627199fc1f89cebd35f3bc41a61/smolrwkv/src/ggml/graph.rs#L11
Setting up the model looks relatively clean using impls on the component parts. The same approach could probably be used for llama based models as well.

Hopefully these posts aren't annoying (let me know if so - maybe this should be in a discussion instead). By the way, this is happening in my separate smolrwkv project but my plan is to use that as a testbed and then try to use that to help with adding support for llama-rs. So that's why it's (hopefully) relevant here.

Finally got the first version of inference with GGML working: https://github.com/KerfuffleV2/smolrsrwkv/commit/995841c57d4a92976af53fe69db934461f06a66a
It is currently only set up to use full 32bit floats.
One interesting thing is relation to llama-rs I noticed is llama-rs builds up the whole graph again for every evaluation step. It looks like llama.cpp does that too but I really don't know why. It doesn't seem necessary.
Also maybe relevant for @saharNooby is it seems like they're copying all the state in and out of the model at every step. As far as I can tell though, that's not actually necessary. You can just do this: https://github.com/KerfuffleV2/smolrsrwkv/blob/995841c57d4a92976af53fe69db934461f06a66a/smolrwkv/src/ggml/graph.rs#L190
Copy the state from the tensor with the new value into the tensor that was set up for state. Then it just naturally loops into itself every evaluation and it's actually not necessary for the rest of the code to look at that at all. The only thing I need to copy out is the probabilities at the end of the computation: https://github.com/KerfuffleV2/smolrsrwkv/blob/995841c57d4a92976af53fe69db934461f06a66a/smolrwkv/src/ggml/context.rs#L79

Next step is to get quantized models working + various cleanups.

Hopefully these posts aren't annoying (let me know if so - maybe this should be in a discussion instead). By the way, this is happening in my separate smolrwkv project but my plan is to use that as a testbed and then try to use that to help with adding support for llama-rs. So that's why it's (hopefully) relevant here.

No worries! These have been very interesting to keep up with, I just haven't had much to add.

Awesome to see the work you've done! Yeah, I think I've heard that traditional backends are on par with GGML for 32-bit. I think it pulls far ahead with quantized values.

Yeah, I think I've heard that traditional backends are on par with GGML for 32-bit. I think it pulls far ahead with quantized values.

You're right about that. I just got quantization working ( https://github.com/KerfuffleV2/smolrsrwkv/commit/4208bc710c02a60ca488e728cb943887a8bae8be ). I got about 1-2 TPS on the 3B model and NDArray 8bit quantization. I can actually load the 7B model with GGML 4bit quantization and it gets 2+ TPS.
Right now there's no ability to save a prequantized file so it's a little slow to load (takes about 90sec for the 7B model), however that's only using one thread for quantization.
   0.055305828s  INFO smolrwkv_cli: Loading model from: /path/to/RWKV-4-Pile-7B-20230109-ctx4096.pth
   0.138817887s  INFO smolrwkv_cli: Backend type: GGML Q4_1
   0.138860247s  INFO load_model: smolrwkv::ggml::loader: Discovering model structure.
   0.186837307s  INFO load_model: smolrwkv::ggml::loader: Precomputing embedding...
   3.673750188s  INFO load_model: smolrwkv::ggml::loader: Loading 32 layer(s):
   3.832211013s  INFO load_model: smolrwkv::ggml::loader: [32/1]: Quantizing att.key.weight([4096, 4096])
   3.911192194s  INFO load_model: smolrwkv::ggml::loader: --> QUANT: len 67108864 -> 12582912 (54525952)

[...]

  97.794115185s  INFO load_model: smolrwkv::ggml::loader: [32/32]: Quantizing ffn.receptance.weight([4096, 4096])
  97.870882902s  INFO load_model: smolrwkv::ggml::loader: --> QUANT: len 67108864 -> 12582912 (54525952)

  97.884595100s  INFO load_model: smolrwkv::ggml::loader: Loading non-layer tensors.
<PHONE_NUMBER>70s  INFO smolrwkv_cli: Loaded: layers=32, embed=4096, vocab=50277

[...]

The research has only been made possible thanks to the preparation and diligence of Liu Yaping, a professor of linguistics and head of the Central Plains Linguistic Research Team. According to Liu, the
<PHONE_NUMBER>91s  INFO smolrwkv_cli: GGML memory used:<PHONE_NUMBER> (6.44981524348259GiB)
 [end of text]

<PHONE_NUMBER>89s  INFO smolrwkv_cli: Completion. Token(s) generated: 101, elapsed time: 44.364179313s, TPS: 2.276620683437021

One weird thing is it actually uses around 17GB RAM even though GGML says it only needed 6.4GB.

Also maybe relevant for @saharNooby is it seems like they're copying all the state in and out

Yeah, agree. I decided to not do anything with it because it does not look like a performance bottleneck.

I can actually load the 7B model with GGML 4bit quantization and it gets 2+ TPS.

Please do quality checks, you may be surprised how badly RWKV may pefrorm with quantization. Here is a rough script for calculating perplexity, may be useful.
If you confirm that RWKV breaks after simple 4-bit quantization implemented in ggml, you may be interested in reading how I tried to solve the issue (TL;DR: added a new quantization format, same disk space as Q4_1, same performance as FP32, which is sad, but works)
I also suggest to compare FP32 with FP16 -- for the same model when using ggml, I have 2x speed on FP16 compared to FP32. Which is not a trivial improvement, considernig that PyTorch can't do FP16 on CPU!

As an aside, are there any GGML format RWKV models floating around? Is there a standard for them?

@philpax I haven't seen any, but saharNooby's project uses the GGMF format with version 100 and includes a converter. So you could make some if you want. I'd probably use a slightly different approach if I implemented it because it's possible to also precompute the embeddings which I don't think that project does.

it's possible to also precompute the embeddings

@KerfuffleV2 You mean merge ln0 into embedding matrix? I've tried it (with PyTorch impl) and did not notice any performance improvement. As you said, 99% is matmul, I guess it is not worth additional complexity from new format and code.

As an aside, are there any GGML format RWKV models floating around? Is there a standard for them?

@philpax No "official" standard, but indeed, I just used llama.cpp's ggmf with version number 100. Here is full format spec in pseudocode:
RWKVModelFile {
  // All ints and floats are in machine byte order.
  // Magic is "ggml" string bytes.
  int32 magic = 0x67676d66;
  int32 version = 100;
  int32 n_vocab;
  int32 n_embed;
  int32 n_layer;
  // 0 if float32, 1 if float16, 2 if Q4_0, 3 if Q4_1, 4 if Q4_1_O.
  int32 data_type;
  // Read until EOF.
  Parameter[] parameters;
}

Parameter {
  int32 dim_count;
  int32 key_length;
  // 0 if float32, 1 if float16, 2 if Q4_0, 3 if Q4_1, 4 if Q4_1_O.
  int32 data_type;
  // Compared to PyTorch's tensor.shape, dimension order is reversed here!
  int32[dim_count] shape;
  // Keys are like "emb.weight", "block.0.ln1.weight".
  uint8[key_length] key_utf8;
  // float32: 4 * element_count bytes.
  // float16: 2 * element_count bytes.
  // Q4_0: element_count / 32 * 20 bytes.
  // Q4_1: element_count / 32 * 24 bytes.
  // Q4_1_O: element_count / 32 * 24 bytes.
  byte[] data;
}

Here is PyTorch -> ggmf converter code (note that doc comment there is a little out of date, I'll update it soon). And looks like someone already uploaded converted RWKV models in this format to HuggingFace...

Interesting - you don't include the vocabulary in there?

@saharNooby

Yeah, agree. I decided to not do anything with it because it does not look like a performance bottleneck.

Fair enough, I doubt it makes a difference from the performance perspective. I wasn't sure if you knew if you didn't have to do that or not. I've been figuring out what I need to do as I go with this stuff. (Also, not unnecessarily copying stuff stuffs nicer to me, but that's just my own aesthetic preference.)

Please do quality checks, you may be surprised how badly RWKV may pefrorm with quantization.

I do plan to do more testing like that. Right now, I've only been trying to get the basic functionality going. I did notice that q4_0 gave terrible results, the model got into a loop repeating the same short phrase over and over almost immediately. With q4_1 the output at least looks pretty reasonable, not noticeably different to me compared to the float32 version.
By the way, I definitely have been looking at your repo and approach to doing stuff. It's been very helpful! I didn't end up actually copying the part where you set up the model but there was plenty of other useful information. Especially the part about the shapes being reversed in GGML, definitely could have wasted a lot of time there.

(TL;DR: added a new quantization format, same disk space as Q4_1, same performance as FP32, which is sad, but works)

That might be a bit too sad for me, I'm really hoping to get something that can run at around the same speed as the equivalent llama model. Right now based on testing the 14B RWKV model vs 13B Vicuna, RWKV is about twice as slow (1.6TPS vs 3.3TPS). That's using q4_1.
I'm curious about how your q4_1_O relates to the ongoing pulls for improving quantization in llama.cpp:

https://github.com/ggerganov/llama.cpp/pull/835
https://github.com/ggerganov/llama.cpp/pull/729
https://github.com/ggerganov/llama.cpp/pull/896

Also, I'd guess the reason why the performance for q4_1_O is low is because there isn't an optimized version like there is for the other formats? Or do you think it's just inherently going to be much slower?

I also suggest to compare FP32 with FP16 -- for the same model

Are you doing anything special to convert from FP32 (or BF16 which is basically the same) into 16 bit? I looked at your code, and it seemed like the answer is no. Did you actually check to make sure all the values in the model could actually be represented as FP16 without actually doing special stuff like quantizing to 16 bit?
(I'm also not sure how that would work with my map ops stuff which currently works with FP32.)

You mean merge ln0 into embedding matrix?

Yeah, it probably doesn't make a performance difference. It also saves a small amount of memory/reduces model file sizes too, since ln0 is never needed again. I'll admit the main reason I did that was just because I like the idea of precomputing anything that can be precomputed.
After thinking about it a bit more, there might be another reason: If you precompute then you can do the calculation at the point the model is still FP32 with higher precision. If you do it later, then you have to perform the calculation on the quantized values/converted values.
I guess those tensors aren't usually quantized to 4 bit but it might make a difference if you're converting to 16 bit.

@philpax

Interesting - you don't include the vocabulary in there?

Not who you asked, but RWKV has its own HuggingFace Tokenizer's style tokenizer definition with the vocab stored outside of the model files. There would be a way to embed it in every copy of the model files, of course, but that would be a bit of a different approach from the status quo.

Why did I only see this now.
My numpy+numba impl: https://github.com/iacore/rwkv-np
My full rust impl with dfdx: https://github.com/iacore/rwkv-rs
My server using custom fork of rwkv.cpp: https://github.com/iacore/rwkv-flask
My web frontend: https://github.com/iacore/rwkv-web
HF Tokenizer (Rust, Python, etc): https://github.com/huggingface/tokenizers
HF Tokenizer ported to WASM: https://github.com/iacore/rwkv-web/tree/main/src/lib/tokenizers
Performance wise, numpy+numba is as fast as ggml. dfdx can only use 4 threads for matmul.. Matmul takes up 80%-90% of the time. Using all the CPU cores is good enough.

@KerfuffleV2 First: I've tried my best to write AVX2 impl of Q4_1_O matmul, but restoration of outlier weights just does not work well with vectorized code. I have some ideas how to optimize if further, but I'm 99% sure that it would not improve it 2x, and we need some real asm/SIMD expert here to optimize it.

You need Zig. Zig has @Vector for cross-arch SIMD.
Any Rust crate that depends on matrixmultiply is not fast enough.

@iacore

You need Zig. Zig has cross-arch SIMD. Optimize cycle count with llvm-mca.

Interesting, thanks! I'm not sure about adding another language into the mix tho. Ideally, I would like to not even need to fork ggml...

q4_2 and q4_3 is coming, see https://github.com/saharNooby/rwkv.cpp/pull/16#issuecomment-1518664786.

Already merged, it's fast and works good with Raven 7B.

Interesting, thanks! I'm not sure about adding another language into the mix tho. Ideally, I would like to not even need to fork ggml...

To me, it's better than writing AVX, NEON and whatever.

I took a stab at this but couldn't get it across the finish line. If anyone would like to pick up where I've left off, please feel free to reuse the code here https://github.com/danforbes/llama-rs/blob/dfo/model/rwkv/crates/models/rwkv/src/lib.rs


RDKit properties are not stored in SmallMoleculeComponent.to_dict

Problem illustrated below. However, there's a more fundamental issue that we were originally using RDKit properties to label the version of gufe that the molecule came from. So if we do include those in to_dict, SmallMoleculeComponent would need a custom gufe-key representation that excludes the gufe version properties from the hash.
My proposed solution would be to:

Include properties in to_dict
Remove the additional properties we add for gufe versioning.

Alternate solutions:

Custom _tokenization method for SmallMoleculeComponent that filters the specific properties we add
Drop the guarantee that we preserve properties attached to an rdkit molecule -- I'm not sure whether these properties would survive a round-trip to another molecular representation anyway (openff, oechem).

MCVE below (note that this has to be done in separate processes for the error to occur because our flyweight will reuse the same object in the same process).
# dump_smc.py
import gufe
from gufe.tokenization import JSON_HANDLER
from rdkit import Chem
import json

mol = Chem.MolFromSmiles("CC")
Chem.AllChem.Compute2DCoords(mol)
mol.SetProp("foo", "bar")
smc = gufe.SmallMoleculeComponent.from_rdkit(mol)

assert smc.to_rdkit().GetProp("foo") == "bar"

dct = smc.to_dict()
with open("dump.json", mode='w') as f:
    f.write(json.dumps(dct, cls=JSON_HANDLER.encoder))

# load_smc.py
import gufe
from gufe.tokenization import JSON_HANDLER
import json

with open("dump.json", mode='r') as f:
    dct = json.load(f)

smc = gufe.SmallMoleculeComponent.from_dict(dct)
assert smc.to_rdkit().GetProp("foo") == "bar"

$ python dump_smc.py
$ python load_smc.py

Traceback (most recent call last):
  File "/Users/dwhs/Dropbox/omsf/tmp-rdkit-prop-issue/load_smc.py", line 9, in <module>
    assert smc.to_rdkit().GetProp("foo") == "bar"
KeyError: 'foo'

Yeah this looks a good idea, obviously we'd have to document which Props we're aware of, in case there's any hiding away that we're accidentally missing.
I think not doing this might be as we were initially considering OpenFF Mol as the internal object, which iirc doesn't preserve these fields.
hmm:
https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/Wrap/Mol.cpp#L50


remove the @Deprecated method from seata about druid

Ⅰ. Issue Description

Ⅱ. Describe what happened
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
Ⅴ. Anything else we need to know?
Ⅵ. Environment:

JDK version :
OS :
Others:

I will optimize this .please assign to me .


MSID: 97958 Version: 1 DOI: 10.1101/2<IP_ADDRESS>8807

MSID: 97958
Version: 1
Preprint DOI: https://doi.org/10.1101/2<IP_ADDRESS>8807
Step 1. Awaiting reviews
Editorial to post reviews via hypothesis
Useful links:

DocMap: https://data-hub-api.elifesciences.org/enhanced-preprints/docmaps/v2/by-publisher/elife/get-by-manuscript-id?manuscript_id=97958
New model tracking: https://docs.google.com/spreadsheets/d/1_fHaoOy7hjyocptKtVJRijeNpUY4hBS7Ck_aVmx6ZJk/
Reviews on sciety: https://sciety.org/articles/activity/10.1101/2<IP_ADDRESS>8807

For trouble shooting (e.g. no Docmaps available):

DocMap issue addressing: https://miro.com/app/board/uXjVNCwK6EI=/
Explore DataHub DocMaps API: https://lookerstudio.google.com/reporting/4c2f0368-babb-4beb-b5b3-497e7e7b0f08/page/ejphD
Unmatched submissions and preprints: https://lookerstudio.google.com/u/0/reporting/9f86204f-3bf7-477c-9b18-5c5ef141bf69/page/p_gxi57ha93c
Unmatched manuscripts spreadsheet: https://docs.google.com/spreadsheets/d/15QcK8w-ssB7109RQEDtFpJPZ0J5HTGxoHa_2TtpMBbg/edit#gid=1336081641

Step 2. Preview reviewed preprint
Production QC content ahead of publication
Instructions:

QC preview: https://prod--epp.elifesciences.org/previews/97958v1
Update ticket with any problems (add blocked label)
When QC OK, add QC OK label to ticket and add publication date and time to https://docs.google.com/spreadsheets/d/1amAlKvdLcaDp5W8Z8g77NmkwbMF5n_u89ArSqPMO8jg
Move card to next column
(At end of the day post link in #enhanced-preprint and ask for PDF to be generated)

Useful links:

Preprint DOI :  https://doi.org/10.1101/2<IP_ADDRESS>8807
Confirm reviews returned by EPP: https://prod--epp.elifesciences.org/api/reviewed-preprints/97958/v1/reviews
To update the MECA path in the docmap: https://docs.google.com/spreadsheets/d/1mctCQuNFBjSn97Lihy7_vBO6z7-N-oqyLv4clyi6zHg

Step 3: Awaiting search reindex
This step adds the reviewed preprint to the homepage: https://elifesciences.org
The search reindex is triggered once an hour. We need the reviewed preprint to be indexed as the search application serves the journal homepage.
Useful links:

Jenkins pipeline to reindex search can be triggered sooner or monitored here: https://alfred.elifesciences.org/job/process/job/process-reindex-reviewed-preprints/

Step 4: Published! PDF requested
Waiting for PDF to be generated
Useful links:

PDF tracking: https://docs.google.com/spreadsheets/d/106_XeDjmuBae7gexOTNzg60lapeqjl2aRn9DzupGyS8/

Step 5: Introduce PDF to data folder and git repo
Upload PDF to relevent folder in git repo https://github.com/elifesciences/enhanced-preprints-data/
Step 6: Done!

[ ] Kettle is on!

Qingliang Zheng wrong email


Make it easier to code gen the flutter <--> embedded golang bridge code

Looks like you and others have the same intent as me :)
What do you think about this idea ??
If the API between the flutter layer and the embedded golang layer was a Protobuf, then we could code gen a ton of the code
For example you need to hand code the dart <--> golang method channels, but this can easily be code generated by sniffing the protobufs later.
The relevant code touch points are here:
Flutter Native bridge:
https://github.com/jerson/flutter-openpgp/blob/master/lib/openpgp.dart#L14
Flutter Web bridge:
https://github.com/jerson/flutter-openpgp/blob/master/lib/web/openpgp_web.dart

I think it's an excellent idea, if you have some ideas on how to implement it it would help me a lot because it would allow me to expose more methods and better performance

Thanks for being receptive to the idea.
SO assuming we make the protobuf the contract, then something like these:
https://github.com/emicklei/proto-contrib
https://github.com/moul/protoc-gen-gotemplate
From there we could gen the dart and goldn code using go templates

There is also FFI instead of protobufs, but i am a little wary of it being still a bit too new myself.
I saw that go-flutter seems to work with FFI: https://github.com/go-flutter-desktop/go-flutter/issues/58#issuecomment-530375169.

SO Let me know what you think of this general approach..

Made some progress...
This helps to give the flutter web and flutter naive the same Isolate abstraction that you have now but in a cleaner way
https://github.com/deakjahn/flutter_isolate_web
It uses this https://pub.dev/packages/isolate_handler, but make its work for web.
It removes alot of the code here:
https://github.com/jerson/flutter-openpgp/blob/master/lib/web/openpgp_web.dart

@joe-getcouragenow im working now implementing with ffi i think is more appropiate but only will work for windows, linux , macos and hover, i really cant undersant how we could use with protobufs, maybe if you have an example flutter <- go will be great

@jerson Thanks for asking... This is complicated stuff for sure..
This is VERY interesting: https://github.com/dart-lang/sdk/issues/42982
It got merged into the Google VM FFI code !!
FFI will also work with android and ios ?
FFI is better and more best practice with Flutter, that method channel.
But it is perfectly possible to use FFI and Protobufs together and this is my main motivation in all this.
Here at the end you can see lots of devs decided to use Protobufs instead of FFI for integrating Dart and Golang together.
https://github.com/go-flutter-desktop/go-flutter/issues/334
Why use Protobuf:
Protobuf makes it easier to manage the Data Type aspects.

So from architecture point of view Protobuf is the Model, and FFI is the Transport. The reason i give the metaphor of FFI being the transport is because they is not Service interface. Its like GRPC without the Service interface and only the Types.
I could not find a perfect example of this but this shows the idea:
https://github.com/mailgun/pebblezgo
In their case zeromq is the Transport.
https://github.com/go-kit/kit
they adhere to strict separation of the Types and the Transport also. as they say in the README "Pluggable serialisation and transport — not just JSON over HTTP"
Because of this sep there are generators like this: https://github.com/sagikazarmark/protoc-gen-kit. And thats why i suggested that with Protobufs you can generate the Dart and Golang code for the stubs that use the Protobufs.

Hope the above makes sense.. Just ask if i did not explain it well enough.
Here is one example of what i mean. But they use Protobufs with MethodChannels, not FFI. Mostly because the code is old and FFI never worked back then.
Its a bit hard to follow because they used a different embed approach on desktop versus mobile.
https://github.com/deromask
Their Proto contract

https://github.com/deromask/dero-gui/tree/master/protos

Flutter calling into GO using Protos

https://github.com/deromask/dero-gui/blob/master/lib/core/services/derocore.dart

Golang mobile core exposed to Flutter
https://github.com/deromask/derosuite/blob/master/cmd/mobile/core.go
Golang Desktop exposed to Flutter
https://github.com/deromask/dero-gui/blob/master/go/plugins/derocore/core.go#L56

@jerson
no comments ? Curious what your thoughts are.

@hi @joe-getcouragenow actually sound like a great solution, i was looking all implementation and now i understand how to use protobuf, im gonna use in that way:
windows, linux,macos, hover: FFI + PROTOBUF
android, ios: gomobile + PROTOBUF
by now looks like ffi dont work well for mobile because i need to get the architecture in dart and i think gomobile is enough for that but in the future when ffi had a better implementation easly could be used to replace gomobile
im gonna base the implementation in derosuite repo he is using :
android, ios: gomobile + PROTOBUF
hover: go + PROTOBUF

Hey @jerson Thanks for the feedback.
I have seen other people not using gomobile to compile for mobiles also. I suspect the golang team is hoping tinygo will take over the role of compiling f
Below is one example. I have seen others out there also, but will take a bit of googling.
Also gio is being maintaining by a former maintainer of the gomobile code at google, and even he does not use it.
I am not suggesting BTW that Flutter is crazy and gophers should drop it and use GIO. I am only highlighting that there are others ways of doing the compilation of golang to mobiles..
I have used GIO on mobiles and it works flawlessly in terms of compilation.
https://gioui.org/

supports Web, desktop and mobile.

Entry Point:
https://git.sr.ht/~eliasnaur/gio/tree/master/cmd/gogio/main.go#L172
Android
https://git.sr.ht/~eliasnaur/gio/tree/master/cmd/gogio/androidbuild.go#L201
IOS
https://git.sr.ht/~eliasnaur/gio/tree/master/cmd/gogio/iosbuild.go#L425

https://rogchap.com/2020/09/14/running-go-code-on-ios-and-android/
on mobile no need for gomobile

Wow nice, probable this is the missing part i was looking for
https://rogchap.com/2020/09/14/running-go-code-on-ios-and-android/
thanks @joe-getcouragenow , these days I have been a bit busy with work but I am taking this up next days

now I'm doing the go part before compilation and it looks like this, I think when it's finished it can be easily integrated with flutter

// proxy
// Call ...
func Call(name string, payload []byte) ([]byte, error) {

	instance := NewInstance()
	var output proto.Message
	switch name {
	case "decrypt":
		output = instance.decrypt(payload)
	case "decrypt_bytes":
		output = instance.decryptBytes(payload)

	}

	return proto.Marshal(output)
}

////////////////////////////////////////

//typedef struct  { void* message; int size; char* error; } BytesReturn;
import "C"

// .... bindings for ffi
func Call(name *C.char,payload unsafe.Pointer, payloadSize C.int) *C.BytesReturn {
	output := (*C.BytesReturn)(C.malloc(C.size_t(C.sizeof_BytesReturn)))
	defer C.free(unsafe.Pointer(name))
	defer C.free(payload)

	result, err := bridge.Call(C.GoString(name),C.GoBytes(payload, payloadSize))
	if err != nil {
		output.error = C.CString(err.Error())
		return output
	}
	output.error = nil
	output.message = C.CBytes(result)
	output.size = C.int(len(result))
	return output
}

Its funny but now looks like libopenpgp_bridge(binding bridge)  is bigger than libgojni(gomobile) but i think probably is something that im missing :D , im gonna continue with this

nvm i was building wrong, now has the same size or a bit less :D

hi @joe-getcouragenow  a couple of minutes ago i released v1.0.0-rc1, this is the first version that uses ffi for most platforms, i think it's a good start for the future to add method in an easy way, thanks for your help, i think i couldn't do this without your help, the next step is to make web async
windows: ffi + protobuf
linux: ffi + protobuf
android: ffi + protobuf
macos: ffi + protobuf
ios: ffi + protobuf
web: wasm + protobuf
hover: go + protobuf
https://pub.dev/packages/openpgp/versions/1.0.0-rc1

Hey @jerson nice stuff !!!!
I will try it out and feedback and also try to help on the code.

@joe-getcouragenow  thank you, im adding github actions to go repo, so now all binaries are generated on each tag, this should help to add features https://github.com/jerson/openpgp-mobile/releases/tag/v0.9.7

ok cool.


Profiler spiltter is not resizable and text doesn't scroll

Azure Data Studio Version: master

Steps to Reproduce:

Open a Profiler window
Click an event with SQL text content

Expected: The text region is resizable and the text content is scrollable if necessary
Actual: Splitter isn't resizable and the text area doesn't scroll (appears to be incorrectly sized with the visible region)

Note In the above screenshot the scrollbar has been dragged below the status bar and isn't visible.  However, the SQL text did not move while dragging scrollbar.  In other cases, the text moved but the last several lines couldn't be brought into focus.  The issue is more impactful when looking at events with larger blocks of SQL as far as I can tell.

@alanrenmsft have you seen this behavior?

@kburtram
I tested using last Friday's build and i don't see such issues. I will test on the latest master now.

for resize, do you see the drag cursor when moving the mouse over the red line you highlighted?
for scrollbar, the scrollbar will show up when the text area got focused. can u give it a try?

@kburtram , just tried on lastest master and it is working as expected, are you on a Mac?

@alanrenmsft I'm on a Windows machine using the latest build from master.  I see a scrollbar, but moving it doesn't actually move the content.  i.e. the text stays at the top and doesn't move when I drag the scrollbar down.  For resize,  I don't see any resize cursor.
@Charles-Gagnon could you please take a look at the scenario in your env to see if you can repro?  If it's just my machine I'm fine to assume it's something with my dev env.

@alanrenmsft another related issue I'm consistently hitting is (1) same repro as above (2) go to details tab and focus on a row (3) down arrow key to get to non-visible rows (4) UI get messed up and document tab bar goes away and large blank area is left in profiler UI.

This appears to be working correctly on current builds/current machine.  I think the issue could be related to the top and bottom pane having large minimum sizes and working on a screen with low resolution.


Pigeon and Profile configuration

Hello,
this is an ongoing effort to add the option to configure the profile from flutter.
Currently I've been able to port roughly 120 of the parameters of DataWedge to be callable from Flutter.
To not get lost in types, I ported the communication to pigeon
My goal is to have at least also the encoder parameters in flutter to choose between different barcodes.
Note: Since this also changes what this library can do I will have to make breaking changes to the API.

I have merged the changes from main that were causing conflicts and have updated the flutter plugins for gradle https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply
I have tried this with a Zebra TC58 and it has been working.
Only known issue is a problem where the creation of a profile fails if its already existing. (Even when passing the CREATE_IF_NOT_EXIST flag).
Hapy to receive feedback on moving this forward.
Not every parameter is implemented yet but I think this is a good start :)

Thank you very much for contributing 🎉
We need more time to fully understand the implication of your changes. Which feature do you still have planned, or what is still missing? Otherwise, looking forward to your future changes!

I currently don't plan to add more features.
The current implementation covers configuring the barcode plugin quite well. Enterprise keyboard and other plugins are not really relevant at the moment to me so I skipped those for now.

Alright, thanks for the update. Please us know when you PR is ready to get tested and reviewed. We can make sure all works on a TC21 as well.
And no worries about missing features, we can add them step by step later on.

You can start testing, I will see if I can resolve the new conflicts in the coming week.
Cheers


One container - two different actions

I have following issue: I need to use exactly one pjax container for two different actions.
To be exact, one of them is used for reloading gridview after form submitted. The second one is required to fill in form with data of model user'd like to edit. Even though in the first case script works correctly, the second one causes filling in right form and also replaces gridview to form.
Any suggestions how to solve this problem?

Sorry, there is not enough information given here for us to be able to provide any advice. It sounds like this might be a problem with usage of this project, and not a bug in our code. If you do think this is a bug, please reopen this and provide more information, such as steps to reproduce. Thank you!


Check failure when running tensorflow.python.ops.gen_ragged_conversion_ops.ragged_tensor_to_variant

Click to expand!
Issue Type
Bug
Have you reproduced the bug with TF nightly?
No
Source
binary
Tensorflow Version
2.11.0
Custom Code
Yes
OS Platform and Distribution
22.04
Mobile device
No response
Python version
3.9
Bazel version
No response
GCC/Compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current Behaviour?
Crash when running .ragged_tensor_to_variant

Standalone code to reproduce the issue
import tensorflow as tf
import os
import numpy as np
from tensorflow.python.ops import gen_ragged_conversion_ops
try:
  arg_0_0_tensor = tf.random.uniform([3], minval=-256, maxval=257, dtype=tf.int64)
  arg_0_0 = tf.identity(arg_0_0_tensor)
  arg_0 = [arg_0_0,]
  arg_1_tensor = tf.random.uniform([], minval=-256, maxval=257, dtype=tf.int32)
  arg_1 = tf.identity(arg_1_tensor)
  arg_2 = True
  arg_3 = None
  out = gen_ragged_conversion_ops.ragged_tensor_to_variant(arg_0,arg_1,arg_2,arg_3,)
except Exception as e:
  print("Error:"+str(e))

import tensorflow as tf
import os
import numpy as np
from tensorflow.python.ops import gen_ragged_conversion_ops

try:
    arg_0_0_tensor = tf.random.uniform([5], minval=-256, maxval=257, dtype=tf.int32)
    arg_0_0 = tf.identity(arg_0_0_tensor)
    arg_0 = [
        arg_0_0,
    ]
    arg_1_tensor = tf.random.uniform([], minval=-256, maxval=257, dtype=tf.int32)
    arg_1 = tf.identity(arg_1_tensor)
    arg_2 = True
    arg_3 = None
    out = gen_ragged_conversion_ops.ragged_tensor_to_variant(
        arg_0,
        arg_1,
        arg_2,
        arg_3,
    )
except Exception as e:
    print("Error:" + str(e))

Relevant log output
2023-01-04 01:34:14.128060: F tensorflow/core/framework/tensor_shape.cc:585] Check failed: d < dims() (0 vs. 0)
Aborted

</details>

tf.ragged_ops are basically designed to be consumed by downstream library users, not end users. Usually, these APIs are less strict in terms of validation etc., which is fine since mainly library writers are supposed to use these symbols. If available, please prefer a high level API for general use case scenarios. Refer this RFC and link for more details. Thank you!

Do you think these APIs are exploitable by external attackers?

TF-2.10 is crashes with check failure with the following test case:
import tensorflow as tf
import os
import numpy as np
from tensorflow.python.ops import gen_ragged_conversion_ops
try:
  arg_0_0_tensor = tf.random.uniform([129], minval=-256, maxval=257, dtype=tf.int64)
  arg_0_0 = tf.identity(arg_0_0_tensor)
  arg_0 = [arg_0_0,]
  arg_1_tensor = tf.random.uniform([], dtype=tf.float32)
  arg_1 = tf.identity(arg_1_tensor)
  arg_2 = True
  arg_3 = None
  out = gen_ragged_conversion_ops.ragged_tensor_to_variant(arg_0,arg_1,arg_2,arg_3,)
except Exception as e:
  print("Error:"+str(e))

The log message:
2023-01-05 17:08:24.472946: F tensorflow/core/framework/tensor_shape.cc:570] Check failed: d < dims() (0 vs. 0)
Aborted

@nimashiri,
Usually we request the community preferring a high level API for general use case scenarios which will be helpful to resoluve the issues.
Refer this RFC and link for more details. Thank you!

Also this one:
import tensorflow as tf
import os
import numpy as np
from tensorflow.python.ops import gen_ragged_conversion_ops
try:
  arg_0_0_tensor = tf.random.uniform([129], minval=-256, maxval=257, dtype=tf.int64)
  arg_0_0 = tf.identity(arg_0_0_tensor)
  arg_0 = [arg_0_0,]
  arg_1_tensor = tf.random.uniform([464], dtype=tf.float32)
  arg_1 = tf.identity(arg_1_tensor)
  arg_2 = True
  arg_3 = None
  out = gen_ragged_conversion_ops.ragged_tensor_to_variant(arg_0,arg_1,arg_2,arg_3,)
except Exception as e:
  print("Error:"+str(e))

@nimashiri,
I tried to execute the code with the alternative appraoch by using minval=256 and maxval=257 and it was executed without any issues. Kindly find the gist of it here. Also the dtype will expect the positive input and throws an error otherwise. Thank you!

@nimashiri, I tried to execute the code with the alternative appraoch by using minval=256 and maxval=257 and it was executed without any issues. Kindly find the gist of it here. Also the dtype will expect the positive input and throws an error otherwise. Thank you!

I am running fuzzer on tensorflow. Those inputs are machine generated.

@dmc1778,
When performing tf.random.uniform the type for the minval  is a Tensor or Python value of type dtype, broadcastable with shape (for integer types, broadcasting is not supported, so it needs to be a scalar). The lower bound on the range of random values to generate (inclusive). Defaults to 0.
As mentioned I was performing the test with minval=256 and maxval=257 and it was executed without any issues. Also the when dtype is -ve it will act as invalid and will expect the positive input & throw an error otherwise. Thank you!

@tilakrayal this is potentially a vulnerability. Don't add the awaiting response tag as that closes the issue before it gets fixed given team does not notice these.
Please test with nightly, not just last release.
@dmc1778 Please stop posting vulenrabilities on GitHub page. It is not the usual procedure for reporting these.

@dmc1778,
I tried to execute the mentioned code on tf-nightly(2.13.0-dev20230228), the crash did not happen when invalid input was provided to ragged_tensor_to_variant. Kindly find the gist of it here and also please find the reference of the ubuntu22.04.

This looks to have been fixed. We can close it.

Closing this as stale. Please reopen if this is still a valid request. Thank you!


I have more than one CC,how can I do?

$mail->add_header("Cc: someone_else@example.com");

The header can generally take a comma-delimited string, ie:
$mail->add_header("Cc: someone<EMAIL_ADDRESS>

thanks  for your help~

When i use it to send email,the subject and receiver show twice,is it your program bug? how can i fix it ..thank you~
i mean that the email i received is like this.
subject:subjectsubject
receiver: test<EMAIL_ADDRESS>but i only write it once in program!

@JinAirsOs I have the same problem,but I do not care,though receiver  show twice,I can recieve the email,  I use it into a reoprt email system,not to users

@guojun1992 After carefully read the code,i have fix it.Things is easy,he make mistakes at $to and $subject.mail function add header $to and $suject and he add that header too.So just comment it in set_default_headers() like this.It will looks good!
private function set_default_headers(){
$this->headers[] = 'MIME-Version: 1.0';
$this->headers[] = "From: {$this->from}";
//$this->headers[] = "To: {$this->to}";
//$this->headers[] = "Subject: {$this->subject}";
$this->headers[] = "Content-type: multipart/mixed; boundary="PHP-mixed-{$this->boundary_hash}"";
}

@JinAirsOs good job

@JinAirsOs Thanks for looking in to this, it's been a long time since I've been able to focus on this library.  Any chance I could get you to submit a pull request with the changes?
Thanks!

I have fix the bug and make some changes to that it more usefull,utf-8
encode looks more good i think ,for coutries that don't use english can use
this tool too!and fix a warning that you use the date() to make
boundary_hash but don't set timezone,so i set it in the construct to fix it
.


feat(api): allow Translators to create their own Components

Allows Translators to bypass the loading and parsing of MessageFormat in favor of providing their own rendered Components. Use cases may include using MiniMessage in i18n files (instead of §) or even raw JSON strings/objects.
Was kinda surprised to see GlobalTranslator worked exclusively with MessageFormat (seems very implementation-specific to how vanilla does it) so I whipped this up… tried to keep the PR simple but I could also see it being desirable to have a dedicated class/interface for a ComponentTranslator. Open to feedback/suggestions/etc 🙂

I feel like there's some overlap between the purpose of #842 and the purpose of this PR. I'm not sure there's much harm in having both, but do any others have thoughts on ways those could/should work together?

oops, just saw this-- I did see that PR but I had only glanced at it. looking at it now, I'm honestly still not quite sure I understand how it's supposed to be used? at least in this context it doesn't seem like there's any way for a plugin to add their own serializer/translator for virtual components which brings us kinda back to square one of why I wrote this PR in the first place 😛 if that were possible then it probably could obsolete this PR, sure. either way i don't immediately see any ways to integrate the two PRs


window spawns bigger than my screen

the game window is bigger than my screen making parts of the level hidden.
Maybe you should reduce the size of rendered chars.

Added an argument to set tile/char size, for example try -s18, see if that helps! thanks!


New-SSHSession only sporadically working on 3.0 alpha

Running the 3.0 alpha on Powershell 7.1.1 on Ubuntu 20.
When using New-SSHSession to connect to Cisco switches, it sometimes work and sometimes doesn't. Connecting to other Linux hosts seem to work better. See output:
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred
New-SSHSession: Session operation has timed out
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred

Server SSH Fingerprint
Do you want to trust the fingerprint 5:21:60:b5:fb:5d:7b:9c:c6:8f:4c:24:36:8e:f:bd
[] Y  [] N  [?] Help (default is "N"): y

SessionId  Host                                                               Connected
---------  ----                                                               ---------
    0      <IP_ADDRESS>                                                            True

PS /home/tbhel> Get-SSHSession | Remove-SSHSession
True
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred

SessionId  Host                                                               Connected
---------  ----                                                               ---------
    0      <IP_ADDRESS>                                                            True

PS /home/tbhel> Get-SSHSession | Remove-SSHSession
True
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred
New-SSHSession: Session operation has timed out

Connecting from a regular SSH client always work. Connecting from Posh-SSH 2.2 on a Windows host also always work.

Connecting to the same Cisco switches from Posh-SSH 2.2 on a Windows host works fine.

Check timeout
Try to compare hostkeys used in new alpha and other variants
You can try to use  host key storage from windows if you convert it from registry to json by Convert-SSHRegistryToJSonKnownHostStore

Any test equipment I could test against? I do not have Cisco kit to test and see what could be happening.
Sent from my iPhone

On Feb 4, 2021, at 6:27 AM, Max Kozlov<EMAIL_ADDRESS>wrote:

Check timeout
Try to compare hostkeys used in new alpha and other variants
You can try to use host key storage from windows if you convert it from registry to json by Convert-SSHRegistryToJSonKnownHostStore
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Aslo can you provide information in terms of version of IOS and type of gear? Including key cipher and algorithm of the host and how ssh is setup in it.
Sent from my iPhone

On Feb 4, 2021, at 6:09 AM, tbhel<EMAIL_ADDRESS>wrote:

Running the 3.0 alpha on Powershell 7.1.1 on Ubuntu 20.
When using New-SSHSession to connect to Cisco switches, it sometimes work and sometimes doesn't. Connecting to other Linux hosts seem to work better. See output:
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred
New-SSHSession: Session operation has timed out
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred
Server SSH Fingerprint
Do you want to trust the fingerprint 5:21:60:b5:fb:5d:7b:9c:c6:8f:4c:24:36:8e:f:bd
[] Y  [] N  [?] Help (default is "N"): y
SessionId  Host                                                               Connected

0      <IP_ADDRESS>                                                            True

PS /home/tbhel> Get-SSHSession | Remove-SSHSession
True
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred
SessionId  Host                                                               Connected

0      <IP_ADDRESS>                                                            True

PS /home/tbhel> Get-SSHSession | Remove-SSHSession
True
PS /home/tbhel> New-SSHSession -ComputerName "<IP_ADDRESS>" -Credential $cred
New-SSHSession: Session operation has timed out
Connecting from a regular SSH client always work.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

@MVKozlov Increasing timeout does not help. When it does work, it connects in <1 second.
Not sure exactly what you mean by compare hostkeys. The fingerprints seem to be correct.
@darkoperator I don't have any test equipment available unfortunately. I have tried to connect to several different switches, including:

Catalyst 2960X-48FPS-L running IOS 15.2(2)E5
Catalyst 4500X-32 running IOS-XE 03.10.00.E

The switches are running ssh version 2 with these algorithms:

Encryption Algorithms:aes128-ctr,aes192-ctr,aes256-ctr
MAC Algorithms:hmac-sha1

At some point Cisco changed something in their implementation of SSH based that this is an issue many report. The weird part is that it is intermittent
Sent from my iPhone

On Feb 4, 2021, at 6:55 AM, tbhel<EMAIL_ADDRESS>wrote:

@MVKozlov Increasing timeout does not help. When it does work, it connects in <1 second.
Not sure exactly what you mean by compare hostkeys. The fingerprints seem to be correct.
@darkoperator I don't have any test equipment available unfortunately. I have tried to connect to several different switches, including:
Catalyst 2960X-48FPS-L running IOS 15.2(2)E5
Catalyst 4500X-32 running IOS-XE 03.10.00.E
The switches are running ssh version 2 with these algorithms:
Encryption Algorithms:aes128-ctr,aes192-ctr,aes256-ctr
MAC Algorithms:hmac-sha1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Any chance you can do a packet capture of a successful vs failed auth?
Sent from my iPhone

On Feb 4, 2021, at 6:59 AM, Carlos Perez<EMAIL_ADDRESS>wrote:
At some point Cisco changed something in their implementation of SSH based that this is an issue many report. The weird part is that it is intermittent
Sent from my iPhone

On Feb 4, 2021, at 6:55 AM, tbhel<EMAIL_ADDRESS>wrote:

@MVKozlov Increasing timeout does not help. When it does work, it connects in <1 second.
Not sure exactly what you mean by compare hostkeys. The fingerprints seem to be correct.
@darkoperator I don't have any test equipment available unfortunately. I have tried to connect to several different switches, including:
Catalyst 2960X-48FPS-L running IOS 15.2(2)E5
Catalyst 4500X-32 running IOS-XE 03.10.00.E
The switches are running ssh version 2 with these algorithms:
Encryption Algorithms:aes128-ctr,aes192-ctr,aes256-ctr
MAC Algorithms:hmac-sha1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Also wonder if debug ip ssh  would show something
Sent from my iPhone

On Feb 4, 2021, at 6:59 AM, Carlos Perez<EMAIL_ADDRESS>wrote:
At some point Cisco changed something in their implementation of SSH based that this is an issue many report. The weird part is that it is intermittent
Sent from my iPhone

On Feb 4, 2021, at 6:55 AM, tbhel<EMAIL_ADDRESS>wrote:

@MVKozlov Increasing timeout does not help. When it does work, it connects in <1 second.
Not sure exactly what you mean by compare hostkeys. The fingerprints seem to be correct.
@darkoperator I don't have any test equipment available unfortunately. I have tried to connect to several different switches, including:
Catalyst 2960X-48FPS-L running IOS 15.2(2)E5
Catalyst 4500X-32 running IOS-XE 03.10.00.E
The switches are running ssh version 2 with these algorithms:
Encryption Algorithms:aes128-ctr,aes192-ctr,aes256-ctr
MAC Algorithms:hmac-sha1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Yeah I saw the other issues with very similar problems. The weird thing is that Posh-SSH 2.2 works completely fine.
I may have to get back to you on a packet capture, but I have the output of debug ip ssh here. Both the working and non-working are from the same switch, just moments between attempts.
Working:
Feb  4 11:06:45.639: SSH1: starting SSH control process
Feb  4 11:06:45.639: SSH1: sent protocol version id SSH-2.0-Cisco-1.25
Feb  4 11:06:45.642: SSH1: protocol version id is - SSH-2.0-Renci.SshNet.SshClient.0.0.1
Feb  4 11:06:45.642: SSH2 1: kexinit sent: encryption algo = aes128-ctr,aes192-ctr,aes256-ctr
Feb  4 11:06:45.642: SSH2 1: kexinit sent: mac algo = hmac-sha1
Feb  4 11:06:45.642: SSH2 1: send:packet of  length 264 (length also includes padlen of 11)
Feb  4 11:06:45.642: SSH2 1: SSH2_MSG_KEXINIT sent
Feb  4 11:06:45.649: SSH2 1: ssh_receive: 536 bytes received
Feb  4 11:06:45.649: SSH2 1: input: total packet length of 1048 bytes
Feb  4 11:06:45.649: SSH2 1: partial packet length(block size)8 bytes,needed 1040 bytes,
               maclen 0
Feb  4 11:06:45.649: SSH2 1: ssh_receive: 512 bytes received
Feb  4 11:06:45.649: SSH2 1: partial packet length(block size)8 bytes,needed 1040 bytes,
               maclen 0
Feb  4 11:06:45.649: SSH2 1: input: padlength 10 bytes
Feb  4 11:06:45.649: SSH2 1: SSH2_MSG_KEXINIT received
Feb  4 11:06:45.649: SSH2 1: kex: client->server enc:aes256-ctr mac:hmac-sha1
Feb  4 11:06:45.649: SSH2 1: kex: server->client enc:aes256-ctr mac:hmac-sha1
Feb  4 11:06:45.649: SSH2 1: Using kex_algo = diffie-hellman-group-exchange-sha1
Feb  4 11:06:45.649: SSH2 1: ssh_receive: 32 bytes received
Feb  4 11:06:45.649: SSH2 1: input: total packet length of 32 bytes
Feb  4 11:06:45.649: SSH2 1: partial packet length(block size)8 bytes,needed 24 bytes,
               maclen 0
Feb  4 11:06:45.649: SSH2 1: input: padlength 14 bytes
Feb  4 11:06:45.649: SSH2 1: SSH2_MSG_KEX_DH_GEX_REQUEST received
Feb  4 11:06:45.649: SSH2 1: Range sent by client is - 1024 < 1024 < 8192
Feb  4 11:06:45.649: SSH2 1:  Modulus size established : 1024 bits
Feb  4 11:06:45.649: SSH2 1: send:packet of  length 152 (length also includes padlen of 8)
Feb  4 11:06:45.688: SSH2 1: expecting SSH2_MSG_KEX_DH_GEX_INIT
Feb  4 11:06:45.702: SSH2 1: ssh_receive: 152 bytes received
Feb  4 11:06:45.702: SSH2 1: input: total packet length of 152 bytes
Feb  4 11:06:45.702: SSH2 1: partial packet length(block size)8 bytes,needed 144 bytes,
               maclen 0
Feb  4 11:06:45.702: SSH2 1: input: padlength 13 bytes
Feb  4 11:06:45.702: SSH2 1: SSH2_MSG_KEXDH_INIT received
Feb  4 11:06:46.058: SSH2 1: signature length 271
Feb  4 11:06:46.058: SSH2 1: send:packet of  length 704 (length also includes padlen of 8)
Feb  4 11:06:46.058: SSH2: kex_derive_keys complete
Feb  4 11:06:46.058: SSH2 1: send:packet of  length 16 (length also includes padlen of 10)
Feb  4 11:06:46.058: SSH2 1: newkeys: mode 1
Feb  4 11:06:46.058: SSH2 1: SSH2_MSG_NEWKEYS sent
Feb  4 11:06:46.058: SSH2 1: waiting for SSH2_MSG_NEWKEYS
Feb  4 11:06:46.079: SSH2 1: ssh_receive: 16 bytes received
Feb  4 11:06:46.079: SSH2 1: input: total packet length of 16 bytes
Feb  4 11:06:46.079: SSH2 1: partial packet length(block size)8 bytes,needed 8 bytes,
               maclen 0
Feb  4 11:06:46.079: SSH2 1: input: padlength 10 bytes
Feb  4 11:06:46.079: SSH2 1: newkeys: mode 0
Feb  4 11:06:46.079: SSH2 1: SSH2_MSG_NEWKEYS received
Feb  4 11:06:46.079: SSH2 1: ssh_receive: 68 bytes received
Feb  4 11:06:46.079: SSH2 1: input: total packet length of 48 bytes
Feb  4 11:06:46.079: SSH2 1: partial packet length(block size)16 bytes,needed 32 bytes,
               maclen 20
Feb  4 11:06:46.079: SSH2 1: MAC compared for #4 :ok
Feb  4 11:06:46.079: SSH2 1: input: padlength 26 bytes
Feb  4 11:06:46.079: SSH2 1: send:packet of  length 32 (length also includes padlen of 10)
Feb  4 11:06:46.079: SSH2 1: computed MAC for sequence no.#4 type 6
Feb  4 11:06:46.083: SSH2 1: ssh_receive: 84 bytes received
Feb  4 11:06:46.083: SSH2 1: input: total packet length of 64 bytes
Feb  4 11:06:46.083: SSH2 1: partial packet length(block size)16 bytes,needed 48 bytes,
               maclen 20
Feb  4 11:06:46.083: SSH2 1: MAC compared for #5 :ok
Feb  4 11:06:46.083: SSH2 1: input: padlength 23 bytes
Feb  4 11:06:46.083: SSH2 1: Using method = none
Feb  4 11:06:46.083: SSH2 1: Authentications that can continue = publickey,keyboard-interactive,password
Feb  4 11:06:46.083: SSH2 1: send:packet of  length 64 (length also includes padlen of 14)
Feb  4 11:06:46.083: SSH2 1: computed MAC for sequence no.#5 type 51
Feb  4 11:06:46.086: SSH2 1: ssh_receive: 100 bytes received
Feb  4 11:06:46.086: SSH2 1: input: total packet length of 80 bytes
Feb  4 11:06:46.086: SSH2 1: partial packet length(block size)16 bytes,needed 64 bytes,
               maclen 20
Feb  4 11:06:46.086: SSH2 1: MAC compared for #6 :ok
Feb  4 11:06:46.086: SSH2 1: input: padlength 19 bytes
Feb  4 11:06:46.086: SSH2 1: Using method = password
Feb  4 11:06:46.093: SSH2 1: send:packet of  length 16 (length also includes padlen of 10)
Feb  4 11:06:46.093: SSH2 1: computed MAC for sequence no.#6 type 52
Feb  4 11:06:46.093: SSH2 1: authentication successful for user

Non-working:
Feb  4 11:09:44.099: SSH1: starting SSH control process
Feb  4 11:09:44.099: SSH1: sent protocol version id SSH-2.0-Cisco-1.25
Feb  4 11:09:54.114: SSH1: protocol version id is - SSH-2.0-Renci.SshNet.SshClient.0.0.1
Feb  4 11:09:54.114: SSH2 1: kexinit sent: encryption algo = aes128-ctr,aes192-ctr,aes256-ctr
Feb  4 11:09:54.114: SSH2 1: kexinit sent: mac algo = hmac-sha1
Feb  4 11:09:54.114: SSH2 1: send:packet of  length 264 (length also includes padlen of 11)
Feb  4 11:09:54.114: SSH2 1: send:packet of  length 72 (length also includes padlen of 7)
Feb  4 11:09:54.215: SSH1: Session disconnected - error 0x00

Managed to grab packet captures. The capture of the working connection obviously continues beyond what is included, but I did not see any point to including it in the dump.
captures.zip

Thanks, will pass this to a ticket to SSH.Net project since it was working before the 2020 update
Sent from my iPhone

On Feb 4, 2021, at 8:13 AM, tbhel<EMAIL_ADDRESS>wrote:

Managed to grab packet captures. The capture of the working connection obviously continues beyond what is included, but I did not see any point to including it in the dump.
captures.zip
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@tbhel, I mean HostkeyName - old  SSH.Net version use rsa by default, new -ssh-ed25519
If you convert old keys fro registry into new json format the 3.0 version will try to use old rsa keys which it already know

Just wanted to let you know that the problem still remains in version 3.0.8 unfortunately.

Ok, I saw the release notes for 3.0.7 regarding https://github.com/sshnet/SSH.NET/pull/972 and got my hopes up. 🙂
Connections to Linux are working perfectly, always has. It's only connections to Cisco switches that are an issue.

Version 3.1.2 includes the latest version of SSH.NET, which should address this.

Can confirm that this is fixed in version 3.1.3, thanks for your great work @darkoperator :)