element 0 of tensors does not have a grad_fn

❓ Questions and Help
What is your question?
Hi,
I got RuntimeError
element 0 of tensors does not have a grad_fn in TEST phase
Code
def test_step(self, batch, batch_nb):
    imgs, labels = batch
    self.last_imgs = imgs

    # get gradients
    self.classifier.eval()
    copied_input = imgs.clone()
    copied_input.requires_grad_(True)
    output = self.classifier(copied_input)
    loss = self.criterion_ce(output, labels)
    gradients = torch.autograd.grad(loss, copied_input)[0]
    self.last_grad = gradients

def criterion_ce(self, y_hat, y):
    return F.cross_entropy(y_hat, y)

What have you tried?
Of course, the above code snippet works well in the training phase.
However, grad_fn of output and loss is None in the test/val phase (In the training phase, there are AddmmBackward and NllLossBackward, respectively).
How can I get the input tensor gradients in the Test/Val phase?
What's your environment?

OS: Linux
conda

you can enable gradients again inside the beginning of the test loop.
def test_step(...):
   self.train()

But generally, test/eval is done without gradients.

@williamFalcon
Thank you for your answer.
I understand what you are saying. But that doesn't solve the problem.
In my research, input gradient is also required in test phase.
Also, as shown below, my model (self) is a GAN generator, not a classifier.
class Generator(nn.Module):
    '''

class Discriminator(nn.Module):
    ''''

class Classifier(nn.Module):
    model = torch.load(checkpoint_dir)

    for params in clf.parameters():
         params.requires_grad = False

    return model

class MyModel(pl.LightningModule):
    self.classfier = '''

'''

def test_step(self, batch, batch_nb):
    imgs, labels = batch
    self.last_imgs = imgs

    # get gradients
    self.classifier.eval()
    copied_input = imgs.clone()
    copied_input.requires_grad_(True)
    output = self.classifier(copied_input)
    loss = self.criterion_ce(output, labels)
    gradients = torch.autograd.grad(loss, copied_input)[0]
    self.last_grad = gradients

def criterion_ce(self, y_hat, y):
    return F.cross_entropy(y_hat, y)

Adding self.train() or self.classifier.train() to the beginning of test_step() like your word does not solve my problem.

@lepoeme20  I just ran into a similar issue, where I require gradients during the test phase, and similar to what you were saying
self.train() or self.classifier.train() did not do anything. I know this is years later, however, what did solve it was to also call torch.set_grad_enabled(True) at the beginning of test_step. I believe under the hood, pytorch lightning calls this context manager and does not allow gradient computations that way, so calling .train() does not change anything, but with torch.set_grad_enabled(True) I get gradients.

@nilsleh This is interesting. I am in a similar boat: I have a task that requires gradients during the test phase. This tip you mention of including torch.set_grad_enabled(True) is really useful and works for the validation step, for me. However, I'm still running into this issue during the LitModel.test_step() step. If you found any other tricks, please drop them here! Nonetheless, appreciate your above comment!

@lepoeme20 @nilsleh @williamFalcon
As an update, this workaround seemed to do the trick (copying a suggestion from @williamFalcon in #770):
def evaluate_retain_grad(self):
    self.trainer.num_sanity_val_steps = -1
    self.trainer.fit(self, self._dataset['train'], self._dataset['test'])

Where evaluate_retain_grad is a method of the wrapper class for the LightningModule and trainer is Trainer() saved as an attribute of this wrapper, as is dataset being a torch.utils.data.dataloader.DataLoader.

I also am in need of gradients at test step for my research!
@williamFalcon Makes sense that it isn't enabled by default but why should it behave different to validation (I imagine something to do with freezing the optimizer param group)? I couldn't find the code in the core loops that causes this behaviour.
To be clear of my issue is during test_step my logits do not require_grad or have grad_fn needed to do a .backward(). I have done torch.set_grad_enabled(True) and for p in self.model.parameters(): p.requires_grad =True; in test_step and a callback before doing a forward pass of the model to rectify with no help (I can provide some example code if helpful but others have done above).
If it's helpful I could open another issue?
@mvinyard Thanks for the work around, I ended up just replacing trainer.test with my own  loop for logging purposes.

This is still not solved, could you please reopen?


Basic native live share support

For #7235

[X] Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
[X] Title summarizes what is changing
[x] Has a news entry file (remember to thank yourself!)
[ ] Appropriate comments and documentation strings in the code
[ ] Has sufficient logging.
[ ] Has telemetry for enhancements.
[ ] Unit tests & system/integration tests are added/updated
[ ] Test plan is updated as appropriate
[ ] package-lock.json has been regenerated by running npm install (if dependencies have changed)
[ ] The wiki is updated with any design decisions/details.

Codecov Report

Merging #7391 into master will decrease coverage by 0.12%.
The diff coverage is 30.76%.

@@            Coverage Diff             @@
##           master    #7391      +/-   ##
==========================================
- Coverage   57.77%   57.65%   -0.13%
==========================================
  Files         493      493
  Lines       21428    21441      +13
  Branches     3488     3490       +2
==========================================
- Hits        12381    12362      -19
- Misses       8260     8288      +28
- Partials      787      791       +4

Impacted Files
Coverage Δ

src/client/telemetry/index.ts
86.13% <ø> (ø)
:arrow_up:

...tascience/jupyter/liveshare/hostJupyterNotebook.ts
10.31% <0%> (-0.17%)
:arrow_down:

...ascience/jupyter/liveshare/guestJupyterNotebook.ts
15.15% <0%> (-0.24%)
:arrow_down:

...datascience/jupyter/liveshare/hostJupyterServer.ts
17.33% <0%> (+1.11%)
:arrow_up:

src/client/datascience/jupyter/jupyterImporter.ts
17.56% <0%> (-1.1%)
:arrow_down:

...atascience/jupyter/liveshare/guestJupyterServer.ts
16% <0%> (-0.33%)
:arrow_down:

.../datascience/interactive-common/interactiveBase.ts
6.32% <0%> (-0.09%)
:arrow_down:

src/client/datascience/constants.ts
99.63% <100%> (-0.37%)
:arrow_down:

...ience/interactive-common/interactiveWindowTypes.ts
100% <100%> (ø)
:arrow_up:

src/client/common/utils/platform.ts
64.7% <0%> (-23.53%)
:arrow_down:

... and 10 more

Continue to review full report at Codecov.

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


chore(main): release 1.1.0

:robot: I have created a release beep boop
1.1.0 (2024-01-08)
Features

add 'excluded_roles' config parameter (#9) (0a5f661)

This PR was generated with Release Please. See documentation.

:robot: Release is at https://github.com/rickstaa/warnings-discord-bot/releases/tag/v1.1.0 :sunflower:


unable to connect to X server: No such file or directory

With the recent chrome OS update, crouton stopped working. This is the error I'm getting when trying to start Elementary:
/usr/bin/startelementary: Starting X server

X.Org X Server 1.15.1
Release Date: 2014-04-13
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.42-75-generic x86_64 Ubuntu
Current Operating System: Linux localhost 3.10.18 #1 SMP Tue May 26 18:03:35 PDT 2015 x86_64
Kernel command line: cros_secure console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=/dev/dm-0 rootwait ro dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=1 dm="1 vroot none ro 1,0 2506752 verity payload=PARTUUID=d29dfd99-1252-5f49-98fa-73224f08a523/PARTNROFF=1 hashtree=PARTUUID=d29dfd99-1252-5f49-98fa-73224f08a523/PARTNROFF=1 hashstart=2506752 alg=sha1 root_hexdigest=e8d5eb56c862e952264ec4717e8398a1d7fa7aa9 salt=6c257451ffdb07295f3b1da1552915a8a174bdda04ee7f1063cb2b62a58da169" noinitrd vt.global_cursor_default=0 kern_guid=d29dfd99-1252-5f49-98fa-73224f08a523 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic
Build Date: 12 February 2015  03:37:52PM
xorg-server 2:1.15.1-0ubuntu2~precise5 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.30.2
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Jun  4 10:35:40 2015
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
setversion 1.4 failed: Permission denied
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension SECURITY
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension XFree86-VidModeExtension
Initializing built-in extension XFree86-DGA
Initializing built-in extension XFree86-DRI
Initializing built-in extension DRI2
Loading extension GLX
(EE)
Fatal server error:
(EE) xf86OpenConsole: Cannot open /dev/tty0 (No such file or directory)
(EE)
(EE)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
/usr/bin/xinit: giving up
/usr/bin/xinit: unable to connect to X server: No such file or directory
/usr/bin/xinit: server error

This is ChromeOS version:
Version 43.0.2357.81 (64-bit)
Platform 6946.55.0 (Official Build) stable-channel swanky
Firmware Google_Swanky.5216.238.5

This is crouton version:
crouton: version 1-20141208100324~master:7b8ffff0
release: precise
architecture: amd64
targets: xfce,keyboard,extension
host: version 6946.55.0 (Official Build) stable-channel swanky

Then I tried to update Crouton with sudo sh ~/Downloads/crouton -u -n precise. It failed while updating..
 They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package hddtemp is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libspeex-dev libspeex-dev:i386 libxfixes-dev libspeexdsp-dev libspeexdsp-dev:i386 libspeex1:i386
  libxi-dev x11proto-fixes-dev x11proto-xext-dev libxext-dev libc6-dev:i386 linux-libc-dev:i386
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  exo-utils gtk2-engines-xfce libburn4 libexo-1-0 libexo-common libexo-helpers libfam0 libgarcon-1-0
  libgarcon-common libhal-storage1 libhal1 libisofs6 libjte1 libthunar-vfs-1-2 libthunar-vfs-1-common
  libthunarx-2-0 libunique-1.0-0 liburi-perl libwnck-common libwnck22 libxfce4ui-1-0 libxfce4util-bin
  libxfce4util-common libxfce4util4 libxfce4util6 libxfcegui4-4 libxfconf-0-2 mousepad orage ristretto
  squeeze tango-icon-theme thunar thunar-archive-plugin thunar-data thunar-media-tags-plugin
  thunar-volman xfburn xfce-keyboard-shortcuts xfce4-appfinder xfce4-artwork xfce4-battery-plugin
  xfce4-clipman xfce4-clipman-plugin xfce4-cpufreq-plugin xfce4-cpugraph-plugin xfce4-datetime-plugin
  xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin xfce4-genmon-plugin xfce4-mailwatch-plugin
  xfce4-mixer xfce4-mount-plugin xfce4-netload-plugin xfce4-notes xfce4-notes-plugin xfce4-notifyd
  xfce4-panel xfce4-places-plugin xfce4-power-manager xfce4-power-manager-data
  xfce4-quicklauncher-plugin xfce4-screenshooter xfce4-sensors-plugin xfce4-session xfce4-settings
  xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal
  xfce4-timer-plugin xfce4-verve-plugin xfce4-volumed xfce4-wavelan-plugin xfce4-weather-plugin
  xfce4-xkb-plugin xfconf xfdesktop4 xfdesktop4-data xfwm4
Suggested packages:
  fam libwww-perl sox shimmer-wallpapers kdelibs-data xfce4-cellmodem-plugin xfce4-linelight-plugin
  xfce4-messenger-plugin xfce4-mpc-plugin xfce4-radio-plugin xfce4-xfapplet-plugin xfswitch-plugin
  xfce4-hdaps thunar-thumbnailers gigolo parole xfmpc xfce4-power-manager-plugins xsensors menu
  xfwm4-themes
The following NEW packages will be installed:
  exo-utils gtk2-engines-xfce libburn4 libexo-1-0 libexo-common libexo-helpers libfam0 libgarcon-1-0
  libgarcon-common libhal-storage1 libhal1 libisofs6 libjte1 libthunar-vfs-1-2 libthunar-vfs-1-common
  libthunarx-2-0 libunique-1.0-0 liburi-perl libwnck-common libwnck22 libxfce4ui-1-0 libxfce4util-bin
  libxfce4util-common libxfce4util4 libxfce4util6 libxfcegui4-4 libxfconf-0-2 mousepad orage ristretto
  shimmer-themes squeeze tango-icon-theme thunar thunar-archive-plugin thunar-data
  thunar-media-tags-plugin thunar-volman xfburn xfce-keyboard-shortcuts xfce4 xfce4-appfinder
  xfce4-artwork xfce4-battery-plugin xfce4-clipman xfce4-clipman-plugin xfce4-cpufreq-plugin
  xfce4-cpugraph-plugin xfce4-datetime-plugin xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin
  xfce4-genmon-plugin xfce4-goodies xfce4-mailwatch-plugin xfce4-mixer xfce4-mount-plugin
  xfce4-netload-plugin xfce4-notes xfce4-notes-plugin xfce4-notifyd xfce4-panel xfce4-places-plugin
  xfce4-power-manager xfce4-power-manager-data xfce4-quicklauncher-plugin xfce4-screenshooter
  xfce4-sensors-plugin xfce4-session xfce4-settings xfce4-smartbookmark-plugin xfce4-systemload-plugin
  xfce4-taskmanager xfce4-terminal xfce4-timer-plugin xfce4-verve-plugin xfce4-volumed
  xfce4-wavelan-plugin xfce4-weather-plugin xfce4-xkb-plugin xfconf xfdesktop4 xfdesktop4-data xfwm4
0 upgraded, 84 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.4 MB of archives.
After this operation, 96.8 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  libxfce4util-common libxfce4util6 xfconf libxfconf-0-2 xfce-keyboard-shortcuts libxfce4ui-1-0
  libexo-common libexo-helpers libexo-1-0 libgarcon-common libgarcon-1-0 thunar-data libthunarx-2-0
  libxfcegui4-4 exo-utils xfce4-panel xfce4-settings xfce4-session gtk2-engines-xfce libxfce4util-bin
  mousepad orage thunar thunar-volman xfburn xfwm4 xfdesktop4-data xfdesktop4 xfce4-appfinder
  xfce4-mixer xfce4 xfce4-battery-plugin xfce4-clipman xfce4-clipman-plugin xfce4-cpufreq-plugin
  xfce4-cpugraph-plugin xfce4-datetime-plugin xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin
  xfce4-genmon-plugin xfce4-mailwatch-plugin xfce4-mount-plugin xfce4-netload-plugin xfce4-notes
  xfce4-notes-plugin xfce4-places-plugin xfce4-quicklauncher-plugin xfce4-sensors-plugin
  xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-timer-plugin xfce4-verve-plugin
  xfce4-wavelan-plugin xfce4-weather-plugin xfce4-xkb-plugin xfce4-notifyd xfce4-screenshooter
  xfce4-taskmanager xfce4-terminal xfce4-power-manager-data xfce4-power-manager
E: There are problems and -y was used without --force-yes
Failed to complete chroot setup.
Unmounting /mnt/stateful_partition/crouton/chroots/precise...

Now trying to start Elementary OS succeeds but the mouse pointer or keyboard is not working. So cannot do anything, (including returning to ChromeOS). Is a fresh install my only option? Can I recover anything from a backed up tarball of old crouton installation?

Just to let you know, I have deleted the crouton installer, re-downloaded it before doing the update above.

Looks like this is related to #1696

Getting the same error as in the OP, with Ubuntu. I just restarted my chromebook to update it and I have this now.
Full log can be found here: http://pastebin.com/MfSAuKhC

Update Crouton: sudo sh ~/Downloads/crouton -u -n chrootname
-Jason
On Sun, Jun 7, 2015 at 8:54 AM, coyotte508<EMAIL_ADDRESS>wrote:

Getting the same error as in the OP, with Ubuntu. I just restarted my
chromebook to update it and I have this now.
Full log can be found here: http://pastebin.com/MfSAuKhC
—
Reply to this email directly or view it on GitHub
https://github.com/dnschneid/crouton/issues/1825#issuecomment-109749088.

@xeoron I have already done that. Read the comments above.


undefined method `split' for nil:NilClass

When upgrading from 0.51.0 to 0.52.0 and performing a git push a ruby error is raised.
❯ git push
Running pre-push hooks
Run RSpec test suite..........................................[RSpec] FAILED
Hook raised unexpected error
undefined method `split' for nil:NilClass
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_context/pre_push.rb:21:in `remote_ref_deletion?'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook/pre_push/base.rb:15:in `run?'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:195:in `should_skip?'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:159:in `run_hook'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:97:in `block in consume'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:94:in `loop'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:94:in `consume'
Check for security vulnerabilities.........................[Brakeman] FAILED
Hook raised unexpected error
undefined method `split' for nil:NilClass
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_context/pre_push.rb:21:in `remote_ref_deletion?'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook/pre_push/base.rb:15:in `run?'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:195:in `should_skip?'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:159:in `run_hook'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:97:in `block in consume'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:94:in `loop'
/Users/andreas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/overcommit-0.52.0/lib/overcommit/hook_runner.rb:94:in `consume'

✗ One or more pre-push hooks failed

Here's my overcommit.yml:
PreCommit:
  RuboCop:
    enabled: true
    on_warn: fail
  EsLint:
    enabled: true
    on_warn: fail
    required_executable: 'npm'
    command: ['npm', 'run', 'lint']
  BundleAudit:
    enabled: true
    flags: ['--update']
  BundleOutdated:
    enabled: true

PrePush:
  RSpec:
    enabled: true
    on_warn: fail
  Brakeman:
    enabled: true
    on_warn: fail

CommitMsg:
  RussianNovel:
    enabled: true
  CapitalizedSubject:
    enabled: false

Thanks for the report! Released 0.52.1 to fix.


enableCompression does not exist

It used to, but it doesn't anymore. It's in the docs.

Same problem here. Where is the property? There's no enableCompression in WebSocket nor WSCompression.

The docs should probably be better worded, but the example should how do accomplish compression support: https://github.com/daltoniam/Starscream#compression-extensions
just add:
let compression = WSCompression()
let socket = WebSocket(request: request, compressionHandler: compression) // add the compress object when creating a new Websocket

This was changed in 4.0.0 as it allows for custom compression implementations. I'll update the docs to make this clearer.


Refactor DoorKey

Refactor DoorKey keeping the same environment logic.
Address #48 and #62

Codecov Report

Merging #71 (c1d4d7e) into master (2523782) will increase coverage by 0.67%.
The diff coverage is 93.87%.

@@            Coverage Diff             @@
##           master      #71      +/-   ##
==========================================
+ Coverage   70.44%   71.11%   +0.67%
==========================================
  Files          14       14
  Lines         477      502      +25
==========================================
+ Hits          336      357      +21
- Misses        141      145       +4

Impacted Files
Coverage Δ

src/objects.jl
21.87% <0.00%> (-0.71%)
:arrow_down:

src/envs/doorkey.jl
96.66% <97.87%> (-3.34%)
:arrow_down:

src/GridWorlds.jl
100.00% <0.00%> (ø)

Continue to review full report at Codecov.

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


To add working steps in Area of circle inscribed in a Isosceles Trapezoid

Is your feature request related to a problem? Please describe.
To add working steps in Area of circle inscribed in a Isosceles Trapezoid

Hi, I want to work on this issue I will start working on it as soon as I get assigned!! I am a part of GSSoC'21.
Kindly assign this issue to me!
Discord Username : Abhijeet Sinha(P)
Discord Tag: #4018


Bidirectional analysis: only one link found instead of three

In this paper: http://dgarijo.com/papers/widoco-iswc2017.pdf
the associated repo has three links back to the paper:

On the readme
On the citation.cff
Through a Zenodo link
However, the final JSON returned is:

[
    {
        "title": "WIDOCO: a wizard for documenting ontologies",
        "implementation_urls": [
            {
                "identifier": "https://github.com/dgarijo/Widoco",
                "type": "git",
                "paper_frequency": 1,
                "extraction_methods": [
                    {
                        "type": "regex"
                    },
                    {
                        "type": "bidir",
                        "location": "FILE_CFF",
                        "location_type": "DOI",
                        "source": "SOMEF"
                    },
                    {
                        "type": "unidir",
                        "location": "PDFs/widoco-iswc2017.pdf",
                        "location_type": "PAPER",
                        "source_paragraph": "WIDOCO is available in GitHub,12 where users can download it, open issues or ask for help."
                    }
                ]
            }
        ],
        "doi": "10.1007/978-3-319-68204-4_9",
        "arxiv": null,
        "abstract": "Omitted for simplicity",
        "file_name": "widoco-iswc2017.pdf",
        "file_path": "PDFs/widoco-iswc2017.pdf"
    }
]

Only one method is detected, which previously worked fine.

I have checked the JSON. Now the Zenodo link is not found.
And it seems like citation.cff is being checked for bidirectionality both for title and doi, which is correct, but if both are found I just need to see one in the output


Show our project organization and our processes

a graphic would help

I went with a screenshot of our GitHub projects as a support.


config-const.js content is emptied

After starting gulp watch 2 times in terminal, the config-const.js file is emptied therefore the build fails. This sometimes happens also when using livereload.
related to #363
(I'm also a member of the HMTL5 team @mwaylabs)

This issue also describes the same bug: https://github.com/mwaylabs/generator-m-ionic/issues/227

Workaround:
We usually just use git and simply checkout the file.
git checkout app/main/constants/config-const.js
You can also generate a new file with the sub-generator:
yo m-ionic:constant config --template=config

@lordgreg. I just cannot reproduce this. I tried running gulp watch with gulp karma, gulp protractor and gulp build at the same time and the config was just not emptied. I even tried to run ALL 4 commands at once, still no empty config-const :(


Amy code splitting

Description

Changed Python dependency from 3 to 3.7 (since all of us are on 3.7 now)
Split code via route
Added analyze script to package.json (added a new package too)
Changed imports of @material-ui icons
Changed url path for pdf to allow for use in development and production
Removed print statements from pdf creation
Increased limit on cost from 999.99 to 1,000,000,000
Added note indicating limit under cost field
Added validation to form to enforce limit
Changed zipCode and billingAddress fields from string to boolean in Checkout to remove console errors
Added InputLabelProps to deadline as label text was over the top of the mm/dd/yyyy
Removed Black and Flake8 from devDependency section of Pipfile

Fixes Issue #76
Type of change
Please delete options that are not relevant.

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

How Has This Been Tested?
Tested locally
Checklist:

[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] My code has been reviewed by at least one peer
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[x] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes

Note: Will require a yarn install as I added a package to the front-end dependency list.


Add Versions method

this is helpful when you're working with versioned Buckets in amazon s3

This can be re-opened if there is work to get it updated.


chore: Handle exceptions in bot runner

Adds much-needed try/catch statements in the txs bot runner, improve logging in the bot itself, and add a configurable timeout for awaiting txs to be mined. It also defaults the log level to verbose in the tf template.
Fixes #7658

Benchmark results
Metrics with a significant change:

avm_simulation_time_ms (Token:transfer_public): 46.7 (-33%)
protocol_circuit_proving_time_in_ms (base-parity): 1,499 (-36%)

Detailed results
All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call  to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.
This benchmark source data is available in JSON format on S3 here.
Proof generation
Each column represents the number of threads used in proof generation.

Metric
1 threads
4 threads
16 threads
32 threads
64 threads

proof_construction_time_sha256_ms
5,701 (-1%)
1,534 (-1%)
705
742 (-4%)
764 (-1%)

proof_construction_time_sha256_30_ms
11,686 (-1%)
3,141 (-1%)
1,404 (-1%)
1,445 (-1%)
1,471

proof_construction_time_sha256_100_ms
43,676 (-1%)
12,443 (+1%)
5,668 (-1%)
5,587
5,495 (-1%)

proof_construction_time_poseidon_hash_ms
78.0 (-1%)
34.0
35.0 (+3%)
59.0 (+2%)
89.0 (+2%)

proof_construction_time_poseidon_hash_30_ms
1,513 (-1%)
415 (-1%)
199
227 (+2%)
268 (+1%)

proof_construction_time_poseidon_hash_100_ms
5,584 (-1%)
1,512 (-1%)
675
736 (-1%)
753

L2 block published to L1
Each column represents the number of txs on an L2 block published to L1.

Metric
4 txs
8 txs
16 txs

l1_rollup_calldata_size_in_bytes
708
708
708

l1_rollup_calldata_gas
6,576
6,588
6,576

l1_rollup_execution_gas
584,256
584,419
584,558

l2_block_processing_time_in_ms
773 (+2%)
1,455
2,800 (+4%)

l2_block_building_time_in_ms
10,861
21,436
41,938 (-1%)

l2_block_rollup_simulation_time_in_ms
10,861
21,436
41,938 (-1%)

l2_block_public_tx_process_time_in_ms
9,097
19,425
39,871

L2 chain processing
Each column represents the number of blocks on the L2 chain where each block has 8 txs.

Metric
3 blocks
5 blocks

node_history_sync_time_in_ms
7,270
10,199

node_database_size_in_bytes
12,746,832
16,838,736

pxe_database_size_in_bytes
16,254
26,813

Circuits stats
Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Function
time_ms
bytecode_size_in_bytes

GasToken:_increase_public_balance
98.9 (-4%)
13,790

GasToken:set_portal
15.5 (-9%)
3,339

Token:constructor
128 (-4%)
23,692

FPC:constructor
92.3 (-2%)
13,592

GasToken:mint_public
82.3 (-1%)
10,158

Token:mint_public
64.3 (+6%)
19,034

Token:assert_minter_and_mint
61.9 (-3%)
12,925

AuthRegistry:set_authorized
44.8 (-18%)
7,812

FPC:prepare_fee
256 (-14%)
11,068

Token:transfer_public
:warning: 46.7 (-33%)
44,012

FPC:pay_refund
83.4 (+14%)
15,961

Benchmarking:increment_balance
1,078
11,281

Token:_increase_public_balance
15.2
15,006

FPC:pay_refund_with_shielded_rebate
134 (-1%)
17,056

Public DB Access
Time to access various public DBs.

Function
time_ms

get-nullifier-index
0.159

Tree insertion stats
The duration to insert a fixed batch of leaves into each tree type.

Metric
1 leaves
16 leaves
64 leaves
128 leaves
256 leaves
512 leaves
1024 leaves

batch_insert_into_append_only_tree_16_depth_ms
10.6 (+1%)
16.8
N/A
N/A
N/A
N/A
N/A

batch_insert_into_append_only_tree_16_depth_hash_count
16.8
31.7
N/A
N/A
N/A
N/A
N/A

batch_insert_into_append_only_tree_16_depth_hash_ms
0.611 (+1%)
0.515
N/A
N/A
N/A
N/A
N/A

batch_insert_into_append_only_tree_32_depth_ms
N/A
N/A
48.2 (-1%)
76.4 (-1%)
131 (-1%)
249 (-1%)
501 (+7%)

batch_insert_into_append_only_tree_32_depth_hash_count
N/A
N/A
95.9
159
287
543
1,055

batch_insert_into_append_only_tree_32_depth_hash_ms
N/A
N/A
0.492
0.470 (-1%)
0.450
0.451 (-1%)
0.465 (+6%)

batch_insert_into_indexed_tree_20_depth_ms
N/A
N/A
59.4 (-1%)
112
182
359
732 (+5%)

batch_insert_into_indexed_tree_20_depth_hash_count
N/A
N/A
109
207
355
691
1,363

batch_insert_into_indexed_tree_20_depth_hash_ms
N/A
N/A
0.501 (-1%)
0.505
0.483
0.486
0.496 (+4%)

batch_insert_into_indexed_tree_40_depth_ms
N/A
N/A
73.5
N/A
N/A
N/A
N/A

batch_insert_into_indexed_tree_40_depth_hash_count
N/A
N/A
133
N/A
N/A
N/A
N/A

batch_insert_into_indexed_tree_40_depth_hash_ms
N/A
N/A
0.523
N/A
N/A
N/A
N/A

Miscellaneous
Transaction sizes based on how many contract classes are registered in the tx.

Metric
0 registered classes
1 registered classes

tx_size_in_bytes
72,017
666,910

Transaction size based on fee payment method
| Metric |  |
| - |  |


Fetch old predictors with old analysis

Typically, when one fetches the predictors for a set of runs, the default is to get the latest version of the predictors.
However, if you clone an analysis, or edit an old analysis (that was never compiled), you could be using old predictor ids.
However, a fresh fetch of predictors would give conflicting info on which predictors are selected.
One solution is to always update predictors when cloning (although this might still be a problem for editing old analyses).
Another option is to give an override analysis id to the /predictors route that would override any similary named predictors, with the version used by that analysis.  So that if there are old predictors associated, it gives those rather than the latest ones

I was thinking about this some more, and an alternative approach that' might be more robust and flexible is to add an API route that returns different versions for a given predictor. On the client side, for predictors that have multiple versions, we could display a "versions" button that pops up a modal dialog of available versions when clicked--and then the user can choose which one. It would always default to the latest, so that most of the time nobody would bother changing the version. But the option would be there if the user wanted it. And for cloned/edited analyses, we could still make the default the one that was previously run.

Yeah, that would work. I mean that's already available because you can query /api/predictors and request all, rather than only the latest. Then it would be up to the front end to appropriately display that information (and you can infer order by id... not sure if I give timestamps). I would mainly worry that it may be a very large response if we update often (which maybe we wont), and potentially confusing to users unless its a bit of a hidden option (since 99% of people won't want to do this).


Spinner: Update UI + Add isLoading to Button (V2)

Spinner: Update UI + Add isLoading to Button (V2)

This update greatly improves the Spinner component. For starters, the CSS is now rendered with css.js rather than .scss. We ran into multiple integration issues from the previous .scss style method. Secondly, the animations look a lot better (IMO). It mimics the loading spinner you'd see from modern UI like Google and friends. Previously, it was just spinning an SVG.
Button: Adding Loading

The Button (v2) component has been enhanced to have built-in support for isLoading. If that prop is defined, it will automatically render a Spinner and disable the Button.
Button Deploy Preview
https://deploy-preview-579--hsds-react.netlify.com/?selectedKind=Button%2FV2&selectedStory=Default&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybooks%2Fstorybook-addon-knobs
cc'ing @digitaldesigner for design approval for this one. I opted to overlay the spinner on top of the text (and make the text a little muted) during the isLoading state. The reason for this is to ensure the Button's width doesn't grow/shrink when transition to/from loading. GIF above shows what it looks like across multiple Button kinds (primary, secondary, etc...)
... and, for funzies...

A special request from @TerrenceLJones with a special spinButtonOnLoading prop. Obviously... don't use this in production 😉
Resolves: https://github.com/helpscout/hsds-react/issues/548

Button Deploy Preview:
https://deploy-preview-579--hsds-react.netlify.com/?selectedKind=Button%2FV2&selectedStory=Default&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybooks%2Fstorybook-addon-knobs

Pull Request Test Coverage Report for Build 1991

28 of 28 (100.0%)  changed or added relevant lines in 4 files are covered.
No unchanged relevant lines lost coverage.
Overall coverage remained the same at 100.0%

Totals

Change from base Build 1988:
0.0%

Covered Lines:
7609

Relevant Lines:
7609

💛  - Coveralls

@digitaldesigner + @tinkertrain Thank you so much ! 🙏
Updated:


Adopt the CLI UI kit in the shopify theme list command

WHY are these changes introduced?
Fixes:

https://github.com/Shopify/internal-cli-foundations/issues/498

WHAT is this pull request doing?

Displays a table with all themes, following the CLI UI Kit convention
Calls Admin API’s /themes endpoint with query parameter fields, to only retrieve fields id, name, role, for both theme open and theme list command
Introduces --role parameter for theme list command, to filter for themes with the specific role

How to test your changes?

Run pnpm run shopify theme list in dark mode

Verify that text is white/grey on dark background

Run pnpm run shopify theme list in bright mode

Verify that text is black/grey on bright background

Run pnpm run shopify theme list --role=live and verify that only live themes are displayed

Measuring impact
How do we know this change was effective? Please choose one:

[ ] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
[x] Existing analytics will cater for this addition
[ ] PR includes analytics changes to measure impact

Checklist

[x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
[x] I've considered possible documentation changes
[x] I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

Note: I forgot to implement code for the requirement "Introduce the filter by name, role, and id" (see issue).
Therefore, PR is still work in progress 😊


fix(roomdescription): add max height and scrolling to room description

fix #1556

I don't like 2 things about these

You are adding a CSS file, this does not follow the convention we have
You are using a static max-height

I don't like 2 things about this PR

You are adding a CSS file, this does not follow the convention we have
You are using a static max-height

Fair points, figured there would be some pushback on this, what is the convention for CSS? Are there any examples of commits I can look at?
Would % max-height be better?

I don't like 2 things about this PR

You are adding a CSS file, this does not follow the convention we have
You are using a static max-height

Fair points, figured there would be some pushback on this, what is the convention for CSS? Are there any examples of commits I can look at?
Would % max-height be better?

Updated PR to use tailwind classes instead of adding new CSS file.
Also now using rem instead of static px value for max-height.

Alright, can you please show that it's working? (screenshot)


API docs

Looking for contributors to help build documentation

Hey @pranshugupta54 ! I'd love to contribute to the docs. Are you referring to this API Docs? Or is there a specific area you need help with?

Hey @remigathoni, thank you for showing interest. We are not maintaining that site, can plan to make a fresh new doc using some method for open source contribution, so anyone can help fix things.
Join us on Discord for any help.

Alright, thank you!
On Wed, Nov 22, 2023 at 11:00 PM Pranshu Gupta @.***>
wrote:

Hey @remigathoni https://github.com/remigathoni, thank you for showing
interest. We are not maintaining that site, can plan to make a fresh new
doc using some method for open source contribution, so anyone can help fix
things.
Join us on Discord https://digitomize.com/discord for any help.
—
Reply to this email directly, view it on GitHub
https://github.com/digitomize/digitomize/issues/272#issuecomment-1823433690,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AMMBYTSD3CPAHLHAPQFWEQ3YFZKV5AVCNFSM6AAAAAA7UHMJKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTGQZTGNRZGA
.
You are receiving this because you were mentioned.Message ID:
@.***>

@remigathoni, we'll be working on https://github.com/digitomize/api-docs, hosted at https://doc.digitomize.com

Got you, I'll get started on it. I think first I can create a docs contribution guide on how to set everything up as I do so myself. Also just to confirm, we're documenting the backend endpoints, right?

What exactly do you mean by contribution guide? bcuz we already have README for the repo, also separate for frontend and backend. We're building docs for backend endpoints yes

Yes, I saw those and went through them! They were very helpful.
I was thinking of putting together a guide for contributors to the docs
specifically, like how to set up GitBook and preview the api docs locally
before pushing changes etc. It could be handy for tech writers who want to
jump in. What do you think?
On Fri, Nov 24, 2023 at 2:25 PM Pranshu Gupta @.***>
wrote:

What exactly do you mean by contribution guide? bcuz we already have
README for the repo, also separate for frontend and backend. We're building
docs for backend endpoints yes
—
Reply to this email directly, view it on GitHub
https://github.com/digitomize/digitomize/issues/272#issuecomment-1825533185,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AMMBYTRGLRBKBQHWYXH5D6TYGB7ZBAVCNFSM6AAAAAA7UHMJKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVGUZTGMJYGU
.
You are receiving this because you were mentioned.Message ID:
@.***>

That's a good idea, but at first we should build a basic API doc atleast

Got you!
On Sat, Nov 25, 2023 at 12:58 AM Pranshu Gupta @.***>
wrote:

That's a good idea, but at first we should build a basic API doc atleast
—
Reply to this email directly, view it on GitHub
https://github.com/digitomize/digitomize/issues/272#issuecomment-1826105828,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AMMBYTSEPBNA4H4IMI2LC5TYGEKA5AVCNFSM6AAAAAA7UHMJKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWGEYDKOBSHA
.
You are receiving this because you were mentioned.Message ID:
@.***>


checklist for v0.3

dryRun false by default
drop zone flag
txt registry by default
remove noop registry?
rename record owner id
switch incluster logic (default incluster, auto detect)
empty string for domain by default
simpler flags for source (multiple --source is odd)

@ideahitme @hjacobs please add points for final v0.3 release whatever comes to your mind

more logging

https://github.com/kubernetes-incubator/external-dns/pull/124 addresses most of the things

@linki I think we can remove noop registry in the next release and in the current one just remove the confusing logging part. And I think we can live with --source ingress --source service part

I agree

@linki @ideahitme great, let's merge https://github.com/zalando-incubator/kubernetes-on-aws/pull/395, test it "briefly" in dev/alpha channels and release 0.3 next week?

OK, let's merge #184, release 0.3.0 (git tag, CI trigger) and close this issue + milestone :tada:

0.3.0 released


Yarn upgraded version throws error when compiling

I had the yarn version 1.2.1 but when I upgraded it to the latest version It was unable to compile the assets due to an error with the node-sass. What I ended up doing was to delete the current yarn.lock file and run yarn and yarn run dev again. Everything is working fine now. How should we proceed to with the yarn.lock file now?

I don't see a problem on latest yarn.

When I execute the yarn command I get this error:

I'm not sure if it is an error only in my machine or if it is in general.

I just did that and pushed. Thanks for the heads up :)


[mbedTLS] Enable TLS 1.3 support

Move library initialization to module registration functions.
Only set library debug threshold when verbose output is enabled.
TLSv1.3 functions seems to be a bit more verbose then expected, and generate a lot of noise. Yet, some level of debugging without recompiling the engine would be nice. We should discuss this upstream.
Draft status:

~Depends on #96385~

Fixes #92101
Test:
# main.gd
extends Node

var http : HTTPRequest

func _ready() -> void:
	http = HTTPRequest.new()
	add_child(http)
	http.request_completed.connect(_completed)
	if http.request("https://tls13.akamai.io/") != OK:
		_exit()

func _completed(result: int, code: int, headers: PackedStringArray, body: PackedByteArray):
	if code != 200:
		print("Request failed, result: %d, code: %d" % [result, code])
		_exit()
		return
	var str_body := body.get_string_from_utf8()
	var tls13 := "Your client negotiated TLS 1.3" in str_body
	var tls12 := "Your client negotiated TLS 1.2" in str_body
	if tls13:
		print("TLS 1.3 supported :)")
	elif tls12:
		print("TLS 1.3 **NOT** supported :(")
		print("TLS 1.2 supported :)")
	else:
		print("Can't determine TLS version... Check yourself: %s" % str_body)
	_exit()

func _exit():
	get_tree().quit.call_deferred()

Note for package maintainers: When using builtin_mbedtls=no TLS 1.3 support will depend on the system library version and configuration.

The cicd check is failing on The command line is too long..

The cicd check is failing on The command line is too long..

Yes, seems like a build system issue on Windows + MSVC (not MinGW apparently).
I don't know how to fix that and I currently can't easily test MSVC builds, so help is welcome.

The cicd check is failing on The command line is too long..

Yes, seems like a build system issue on Windows + MSVC (not MinGW apparently).
I don't know how to fix that and I currently can't easily test MSVC builds, so help is welcome.

CC @bruvzg @Repiteo

I don't know how to fix that and I currently can't easily test MSVC builds, so help is welcome.

Probably in the same way as ar - https://github.com/godotengine/godot/pull/96407, MSVC lib do support running with response file - https://learn.microsoft.com/en-us/cpp/build/reference/running-lib?view=msvc-170#lib-command-files

Probably in the same way as ar - #96407, MSVC lib do support running with response file

I remember trying it but it didn't work. I added https://github.com/godotengine/godot/pull/96394/commits/3c66820cf375b45b3dd14aa6ade1575b188e385f and indeed it's still failing (doesn't seem to use the tempfile).
Am I doing something wrong?

Am I doing something wrong?

It's actually already is using TEMPFILE by default, the issue is env["MAXLINELENGTH"] = 8192 line in our config (added in #87154), removing it fixes the build.

For the reference, max length seems to be 8191 - https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation#more-information, but it's not working either. 8000 seems to working, so not sure what's the real limit is. Scons default is 2048.

Opened #97458 with the windows fix.

OMG you are hero!
I'm testing this change right now and it's already looks promising.
As it's just a commit I needed to compile Godot from scratch, so not sure if everything will work 100% but I hope all good.

I tested it in my project. My application was finally loading data for a period but then started failing.
Sadly, I can't 100% confirm why it worked.
After it started failing I checked Wireshark and it's showing TLS 1.2 again. Not sure if it used 1.3 during successes.
No amount of reboots and code changes make it 1.3.

Thanks!

Testing again (Kubuntu btw).
It's showing the correct TLS 1.3, though I still have problems with loading data.
After first packet it stops refreshing

I tested the issue deeper with Wireshark. I need to figure out if this problem with my code or the Godot's code.
I removed everything from my code and just receiving packets without any computation.
After a short working period it shows errors of ZeroWindow and sometimes others. It means that the client (Godot app) can't receive data fast enough. The Browser and Postman still loading the same data perfectly fine.
I think it has something to do with the buffers or maybe something else.

@DjSapsan please open a dedicated issue with a minimal reproduction project. It's not really possible to understand what's going on otherwise.

@DjSapsan please open a dedicated issue with a minimal reproduction project. It's not really possible to understand what's going on otherwise.

https://github.com/godotengine/godot/issues/97899


Missing Error Check in function SSL_CTX_new()

Function SSL_CTX_new() returns NULL if the creation of a new SSL_CTX object failed. However , the return value of function SSL_CTX_new() is not checked. See the following code:
line : 1166
https://github.com/apache/trafficserver/blob/5ee6a5f554880b02535e6ee84268df922e87274d/tools/http_load/http_load.c#L1166-L1177
==============================================================================
We find the return value of this call been checked in openssl project with the version of openssl 1.1.2.
Such as in openssl/apps folder
line : 178
Ref : https://github.com/openssl/openssl/blob/0db957dbbcf6a432086ab913378c23636d8c374c/apps/ciphers.c#L178-L180
line 178:    ctx = SSL_CTX_new(meth);
line 179:    if (ctx == NULL)
line 180:        goto err;

Chi Li, Zuxing Gu, Jiecheng Wu

@lc3412 Did you want to make a PR for the change?

Hi, I want to work on this issue. Can you help me to get started?

@shinrich is going to put up a PR for this


Add simple binary encoding (SBE) support

Simple Binary Encoding is a serialization format used in financial trading. For an overview see this post that compares cap'n'proto, flatbuffers, and sbe. In a nutshell it is a non-random-access, zero copy, serialization format.

I am closing this because I do not plan to dedicate Serde developer time to implementing this. I would love if anybody steps up to implement SBE support for Serde in a separate crate.


FastAPI new release 0.89.1 fixes Pydantic Response types

Installing with strawberry-graphql[fastapi]==0.152.0 will grab fastapi==0.89.0
Following the tutorial with:
import strawberry

from fastapi import FastAPI, Depends, Request, WebSocket, BackgroundTasks
from strawberry.types import Info
from strawberry.fastapi import BaseContext, GraphQLRouter

class CustomContext(BaseContext):
    def __init__(self, greeting: str, name: str):
        self.greeting = greeting
        self.name = name

def custom_context_dependency() -> CustomContext:
    return CustomContext(greeting="you rock!", name="John")

async def get_context(
    custom_context=Depends(custom_context_dependency),
):
    return custom_context

@strawberry.type
class Query:
    @strawberry.field
    def example(self, info: Info) -> str:
        return f"Hello {info.context.name}, {info.context.greeting}"

schema = strawberry.Schema(Query)

graphql_app = GraphQLRouter(
  schema,
  context_getter=get_context,
)

app = FastAPI()
app.include_router(graphql_app, prefix="/graphql")

Will give the exception:
Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 404, in main
    run(
  File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run
    server.run()
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 67, in serve
    config.load()
  File "/usr/local/lib/python3.10/site-packages/uvicorn/config.py", line 477, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/site-packages/ele/stream/app.py", line 36, in <module>
    graphql_app = GraphQLRouter(
  File "/usr/local/lib/python3.10/site-packages/strawberry/fastapi/router.py", line 159, in __init__
    async def handle_http_get(
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 633, in decorator
    self.add_api_route(
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 572, in add_api_route
    route = route_class(
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 400, in __init__
    self.response_field = create_response_field(
  File "/usr/local/lib/python3.10/site-packages/fastapi/utils.py", line 90, in create_response_field
    raise fastapi.exceptions.FastAPIError(
fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'starlette.responses.Response'> is a valid pydantic field type

fastapi 0.89.0 has this issue raised here: https://github.com/tiangolo/fastapi/issues/5861
fastapi 0.89.1 has just been released, bumping the poetry lock file will probably be a good idea :)
Installing fastapi==0.89.1 specially instead of strawberry-graphql[fastapi] fixes the issue.

@m3talstorm I don't think the lock file would change much :D We have a PR for it though, I'll merge it soon!
I've just tried the command and installed the latest version of FastAPI:
/private/tmp/lol .virtualenv ❯ pip install "strawberry-graphql[fastapi]==0.152.0"
Collecting strawberry-graphql[fastapi]==0.152.0
  Downloading strawberry_graphql-0.152.0-py3-none-any.whl (213 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 213.6/213.6 kB 8.1 MB/s eta 0:00:00
Collecting fastapi>=0.65.2
  Downloading fastapi-0.89.1-py3-none-any.whl (55 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.8/55.8 kB 6.5 MB/s eta 0:00:00
Collecting graphql-core<3.3.0,>=3.2.0

I'll close the issue when I merge the other PR though :)

I've merged the PR for updating the lock file 😊


ALVR randomly stopped working.

Had ALVR for over a year, no issues at all. A few days ago, upon booting up the program and clicking the start server button, Steam launches and is unable to find headset.
Version is 2.3.1 both on PC and the Oculus GO. Didn't change anything at all when it comes to settings. reinstalled both ALVR and Steam VR. Please Halp!

Do you see "Server is alive" on ALVR launcher after launch steamvr?
Did you check firewall settings?

No. I have tried everything in the other issues. It used to work fine, until one day with no changes at all, it stopped. Steam shows headset not detected. I tried resetting. I tried reinstalling. I cannot get to server is live.

If it gives you any clues, skyboxvr seems to work no problem

Can you provide following information?

Screenshot of SteamVR
Result of "List drivers" button on About tab.
Debug log file C:\Program Files\ALVR\logs\driver.log. -> How to enable debug log
log of SteamVR. C:\Program Files (x86)\Steam\logs\vrserver.txt

you wont believe this, but as soon as i checked the debug log to enable, it started working. Would you still like me to provide the info?

Same thing happened to me. Worked perfectly but now all of a sudden it stopped working?? It happened to me a day ago, I just turned off WiFi on my Quest and turned it on again and started working? It seem's like it just works when it wants to.


Superuser not allowed to update and delete iRODS data requests created by others

Not sure if this is a bug or just an oversight in the original spec, but obviously this is incorrect. Superuser should mean superuser.

Fixed.


Unable to parse QR address from monerujo android wallet

the payment_id may not be empty. it's either there or it's not. when it's there it needs to be set to something valid. tx_amount also is affected.
problem occurs when a monerujo wallet user attempts to send funds to cakewallet user
example:
monero:4AdkPJoxn7JCvAby9szgnt93MSEwdnxdhaASxbTBm6x5dCwmsDep2UYN4FhStDn5i11nsJbpU7oj59ahg8gXb1Mg3viqCuk?tx_payment_id=&tx_amount=
referenced issue:
https://github.com/m2049r/xmrwallet/issues/473

This is fixed in the new version.


Unable to login once refresh token expires

It seems as though once the refresh token has expired or is no longer valid, it is not possible to login without clearing the site's cookies.
Otherwise, the error page is displayed

Uhm I cannot reproduce this. I just tried to log in both on the demo cluster and locally - both with sessions that are surely expired now - and in both cases, I got redirected to the login page.

Maybe this only happens locally? Maybe it's not worth much effort if that is the case. I'm also using Firefox, which may be related. I'll try with another browser today.

Closing because this was related to the Keycloak integration which was removed in an earlier version.


Wrong September + October days before 1996 on Intl.DateTimeFormat

Can you take a look at this issue about Intl.DateTimeFormat in firefox and chrome?
https://github.com/motss/app-datepicker/issues/87
I've made a simple test using javascript console in firefox and chrome with the same result:
new window.Intl.DateTimeFormat('es-ES', { day: 'numeric' }).format(new Date(1995,8,24));
"24"
new window.Intl.DateTimeFormat('es-ES', { day: 'numeric' }).format(new Date(1995,8,25));
"24" wrong, must be "25"
new window.Intl.DateTimeFormat('es-ES', { day: 'numeric' }).format(new Date(1995,8,26));
"25" wrong, must be "26"
new window.Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(new Date(1995,8,24));
"24"
new window.Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(new Date(1995,8,25));
"24" wrong, must be "25"
new window.Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(new Date(1995,8,26));
**"25"**wrong, must be "26"
new window.Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(new Date(1996,8,26));
"26"
new window.Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(new Date(1996,8,25));
"25"
new window.Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(new Date(1996,8,24));
"24"

new Date(1995,8,25) will be set to midnight, so even any timezone data difference between Date and DateTimeFormat can result in the day displaying differently. You could probably work around the issue by using noon instead of midnight: new Date(1995,8,25,12), so that the time zones would have to be off by 12 hours to display the wrong date.
Since these are the underlying browser apis, you should file bugs in their respective bug trackers.


Problem at _tsize

Hi. I am integrating the exllama2 into lollms as a binding (nice job by the way). And I get this little problem:
def _tsize(st, key):
tslice = st.get_slice(key)
shape = tslice.get_shape()
numel = 1
for x in shape: numel *= x
dtype = tslice.get_dtype()
if dtype == "I32": return numel * 4
elif dtype == "I16": return numel * 2
elif dtype == "F16": return numel * 2
elif dtype == "BF16": return numel * 2
elif dtype == "F32": return numel * 4
else: raise ValueError(f"Unexpected datatype {dtype}: {key}")

tslice doesn't have a method called get_dtype!
So I just changed it to force F16 in my fork (as most AIs I use have F16) can you tell me what am I doing wrong?
Is it my safetensors version?

I think so, yes. get_dtype was added in version 0.3.2.

Thanks alot. That was the mistake. i was using my old environment and forget to update.
Your binding is really cool. it is fast. I get around 25 t/s with a 13B model on my RTX3060Ti.
Now it is sitting gracefully on lollms zoo:

Thanks for the good job.

I just wonder if I am making something wrong here. The models seem to have more halucination on exllama2 than on hugging face.
Here is my binding code. you can look at the build_model and generate methods:
######
# Project       : lollms
# File          : binding.py
# Author        : ParisNeo with the help from bartowski
# Supported by Nomic-AI
# license       : Apache 2.0
# Description   :
# This is an interface class for lollms bindings.
# Big thank you to turboderp and oobabooga for their
# paving the way with their work
######
from pathlib import Path
from typing import Callable
from lollms.config import BaseConfig, TypedConfig, ConfigTemplate, InstallOption
from lollms.paths import LollmsPaths
from lollms.binding import LLMBinding, LOLLMSConfig
from lollms.helpers import ASCIIColors
from lollms.types import MSG_TYPE
from lollms.helpers import trace_exception
from lollms.utilities import AdvancedGarbageCollector
import subprocess
import yaml
import re
import urllib
import shutil
import sys
import os

sys.path.append(os.getcwd())
pth = Path(__file__).parent/"exllamav2"
sys.path.append(str(pth))

__author__ = "parisneo"
__github__ = "https://github.com/ParisNeo/lollms_bindings_zoo"
__copyright__ = "Copyright 2023, "
__license__ = "Apache 2.0"

binding_name = "EXLLAMA2"
binding_folder_name = "exllama2"
import os
import subprocess
import torch
class EXLLAMA2(LLMBinding):

    def __init__(self,
                config: LOLLMSConfig,
                lollms_paths: LollmsPaths = None,
                installation_option:InstallOption=InstallOption.INSTALL_IF_NECESSARY
                ) -> None:
        """Builds an Exllama binding

        Args:
            config (LOLLMSConfig): The configuration file
        """
        self.model          = None
        self.tokenizer      = None
        self.cache          = None
        self.generator      = None

        if lollms_paths is None:
            lollms_paths = LollmsPaths()

        # Initialization code goes here
        binding_config_template = ConfigTemplate([

            {"name": "gpu_split", "type": "list", "value": [24],
                "help": "A list depicting how many layers to offload to each GPU. If you have just one, the list should contain one value"},
            {"name": "ctx_size", "type": "int", "value": 2048, "min": 512,
                "help": "The current context size (it depends on the model you are using). Make sure the context size if correct or you may encounter bad outputs. Reduce to save memory. Can also be increased, ideally while also using compress_pos_emn and a compatible model/LoRA"},
            {"name": "max_input_len", "type": "int", "value": 2048, "min": 512,
                "help": "Maximum length of input IDs in a single forward pass. Sequences longer than this will be processed in multiple steps"},
            {"name": "max_attention_size", "type": "int", "value": 2048**2, "min": 512,
                "help": "Increase to compress positional embeddings applied to sequence"},
            {"name": "compress_pos_emb", "type": "float", "value": 1, "min": 1, "max": 8,
                "help": "Positional embeddings compression value, set it to your ctx_size divided by 2048 when over 2048. Only set this or alpha. Increase to compress positional embeddings applied to sequence"},
            {"name": "alpha", "type": "int", "value": 1, "min": 1, "max": 32,
                "help": "Alpha value for context size extension. Only use this or compress_pos_emb. Alpha value for NTK RoPE scaling. Similar to compress_pos_emb, higher values increaste ctx but add Perplexity."},
        ])
        binding_config_vals = BaseConfig.from_template(binding_config_template)

        binding_config = TypedConfig(
            binding_config_template,
            binding_config_vals
        )
        super().__init__(
                            Path(__file__).parent,
                            lollms_paths,
                            config,
                            binding_config,
                            installation_option,
                            supported_file_extensions=['.safetensors','.pth','.bin']
                        )

        self.config.ctx_size = self.binding_config.config.ctx_size
        self.callback = None
        self.n_generated = 0
        self.n_prompt = 0

        self.skip_prompt = True
        self.decode_kwargs = {}

        # variables used in the streaming process
        self.token_cache = []
        self.print_len = 0
        self.next_tokens_are_prompt = True

    def build_model(self):

        try:
            from torch import version as torch_version
            from exllamav2 import (
                ExLlamaV2,
                ExLlamaV2Config,
                ExLlamaV2Cache,
                ExLlamaV2Tokenizer,
            )

            from exllamav2.generator import (
                ExLlamaV2StreamingGenerator,
                ExLlamaV2Sampler
            )

        except Exception as ex:
            trace_exception(ex)
            ASCIIColors.warning("Couldn't import dependencies")
            return

        if self.config.model_name is None:
            ASCIIColors.error('No model selected!!')
            return

        if self.config.model_name:

            path = self.config.model_name
            model_path = self.get_model_path()

            if not model_path:
                self.model = None
                return None

            models_dir = self.lollms_paths.personal_models_path / "exllama2"
            models_dir.mkdir(parents=True, exist_ok=True)

            # model_path = models_dir/ path

            model_name = str(model_path).replace("\\","/")

            for ext in ['.safetensors', '.pt', '.bin']:
                found = list(model_path.glob(f"*{ext}"))
                if len(found) > 0:
                    if len(found) > 1:
                        print(
                            f'More than one {ext} model has been found. The last one will be selected. It could be wrong.')

                    model_path = found[-1]
                    break

            config = ExLlamaV2Config()
            config.model_dir = str(model_name)
            config.prepare()
            config.max_seq_len = self.binding_config.config.ctx_size  # Reduce to save memory. Can also be increased, ideally while also using compress_pos_emn and a compatible model/LoRA
            config.max_input_len = self.binding_config.config.max_input_len  # Maximum length of input IDs in a single forward pass. Sequences longer than this will be processed in multiple steps
            config.max_attention_size = self.binding_config.config.max_attention_size  # Sequences will be processed in chunks to keep the size of the attention weights matrix <= this
            config.compress_pos_emb = self.binding_config.config.compress_pos_emb  # Increase to compress positional embeddings applied to sequence
            config.alpha_value = self.binding_config.config.alpha # Alpha value for NTK RoPE scaling. Similar to compress_pos_emb, higher values increaste ctx but add Perplexity.
            config.gpu_peer_fix = False # Apparently Torch can have problems transferring tensors directly one GPU to another sometimes. Enable this to expliticly move tensors via system RAM instead, where needed

            if torch_version.hip:
                config.rmsnorm_no_half2 = True
                config.rope_no_half2 = True
                config.matmul_no_half2 = True
                config.silu_no_half2 = True

            self.clear_cuda()
            ASCIIColors.red ("----------- LOLLMS EXLLAMA2 Model Information -----------------")
            ASCIIColors.magenta(f"Model name:{self.config.model_name}")
            self.print_class_attributes(config)
            ASCIIColors.red ("--------------------------------------------------------------")

            self.model = ExLlamaV2(config)
            print("Loading model: " + str(model_name))
            self.model.load(self.binding_config.gpu_split) # [16, 24]
            self.tokenizer = ExLlamaV2Tokenizer(config)
            self.cache = ExLlamaV2Cache(self.model)
            self.generator = ExLlamaV2StreamingGenerator(self.model, self.cache, self.tokenizer)
            self.settings = ExLlamaV2Sampler.Settings()

            return self

    def __del__(self):
        del self.generator
        del self.cache
        del self.tokenizer
        del self.model
        try:
            torch.cuda.empty_cache()
        except Exception as ex:
            ASCIIColors.error("Couldn't clear cuda memory")

    def install(self):
        # free up memory
        ASCIIColors.success("freeing memory")
        AdvancedGarbageCollector.safeHardCollectMultiple(['model','tokenizer','cache','generator'],self)
        AdvancedGarbageCollector.safeHardCollectMultiple(['ExLlamaGenerator','ExLlama','ExLlamaCache','ExLlamaConfig','ExLlamaTokenizer','torch_version'])
        AdvancedGarbageCollector.collect()
        self.clear_cuda()
        ASCIIColors.success("freed memory")

        super().install()
        print("This is the first time you are using this binding.")
                # Step 1 : install pytorch with cuda
        ASCIIColors.info("Checking pytorch")

        if self.config.enable_gpu:
            try:
                import torch
                from torch import version as torch_version
                try:
                    torch.cuda.empty_cache()
                except Exception as ex:
                    ASCIIColors.error("Couldn't clear cuda memory")
            except:
                pass
            try:
                if torch.cuda.is_available():
                    ASCIIColors.success("CUDA is supported.")
                else:
                    ASCIIColors.warning("CUDA is not supported. Trying to reinstall PyTorch with CUDA support.")
                    self.reinstall_pytorch_with_cuda()
            except Exception as ex:
                ASCIIColors.info("Pytorch not installed")
                self.reinstall_pytorch_with_cuda()

            requirements_file = self.binding_dir / "requirements.txt"
            subprocess.run(["pip", "install", "--upgrade", "--no-cache-dir", "-r", str(requirements_file)])

            # Repository URL
            repo_url = "https://github.com/ParisNeo/exllamav2.git"

            # Get the path of the current script file
            script_path = Path(__file__).resolve()

            # Get the parent directory of the script file
            parent_dir = script_path.parent

            # Define the subfolder name
            subfolder_name = "exllamav2"

            # Create the full path to the subfolder
            subfolder_path = parent_dir / subfolder_name

            # Check if the subfolder exists and remove it if it does
            if subfolder_path.exists():
                ASCIIColors.yellow("---------- Pulling exllama ---------")
                subprocess.run(["git", "pull"], cwd = str(subfolder_path), check=True)
                ASCIIColors.yellow("------------------------------------")

            else:
                # Clone the repository to the subfolder
                subprocess.run(["git", "clone", repo_url, str(subfolder_path)])
            # Make models dir
            models_dir = self.lollms_paths.personal_models_path / "exllama2"
            models_dir.mkdir(parents=True, exist_ok=True)

            # Install custom version of transformers
            subprocess.run(["pip", "install", "--upgrade", "transformers"])
            subprocess.run(["pip", "install", "--upgrade", "accelerate"])
            subprocess.run(["pip", "install", "--upgrade", "peft"])

            #
            ASCIIColors.success("Installed successfully")
            try:
                import torch
                from torch import version as torch_version
            except:
                pass
        else:
            ASCIIColors.error("Exllama is only installable on GPU. Please activate GPU support before proceeding")

    def uninstall(self):
        super().install()
        print("Uninstalling binding.")
        subprocess.run(["pip", "uninstall", "--yes", "llama-cpp-python"])
        ASCIIColors.success("Installed successfully")

    def tokenize(self, prompt:str):
        """
        Tokenizes the given prompt using the model's tokenizer.

        Args:
            prompt (str): The input prompt to be tokenized.

        Returns:
            list: A list of tokens representing the tokenized prompt.
        """
        t = self.tokenizer.encode(prompt)
        return t[0].tolist()

    def detokenize(self, tokens_list:list):
        """
        Detokenizes the given list of tokens using the model's tokenizer.

        Args:
            tokens_list (list): A list of tokens to be detokenized.

        Returns:
            str: The detokenized text as a string.
        """
        t = torch.IntTensor([tokens_list])
        return  self.tokenizer.decode(t)[0]

    def generate(self,
                 prompt:str,
                 n_predict: int = 128,
                 callback: Callable[[str], None] = bool,
                 verbose: bool = False,
                 **gpt_params ):
        """Generates text out of a prompt

        Args:
            prompt (str): The prompt to use for generation
            n_predict (int, optional): Number of tokens to prodict. Defaults to 128.
            callback (Callable[[str], None], optional): A callback function that is called everytime a new text element is generated. Defaults to None.
            verbose (bool, optional): If true, the code will spit many informations about the generation process. Defaults to False.
        """
        self.callback = callback
        default_params = {
            'temperature': 0.7,
            'top_k': 50,
            'top_p': 0.96,
            'repeat_penalty': 1.3,
            "seed":-1,
            "n_threads":8,
            "typical_p":0.0
        }
        self.output = ""
        self.settings.temperature = default_params['temperature']
        self.settings.top_k = default_params['top_k']
        self.settings.top_p = default_params['top_p']
        self.settings.token_repetition_penalty = default_params['repeat_penalty']
        self.settings.disallow_tokens(self.tokenizer, [self.tokenizer.eos_token_id])
        try:
            input_ids = self.tokenizer.encode(prompt)
            prompt_tokens = input_ids.shape[-1]
            self.generator.warmup()

            self.generator.set_stop_conditions([])
            self.generator.begin_stream(input_ids, self.settings)
            for i in range(n_predict):
                chunk, eos, _ = self.generator.stream()
                self.output += chunk
                if  self.callback:
                    if not self.callback(chunk, MSG_TYPE.MSG_TYPE_CHUNK):
                        break

                if eos: break
        except Exception as ex:
            ASCIIColors.error(ex)
            trace_exception(ex)
            if callback:
                callback(str(ex),MSG_TYPE.MSG_TYPE_EXCEPTION)
        return self.output

    @staticmethod
    def get_filenames(repo):
        import requests
        from bs4 import BeautifulSoup

        dont_download = [".gitattributes"]

        main_url = '/'.join(repo.split("/")[:-3])+"/tree/main" #f"https://huggingface.co/{}/tree/main"
        response = requests.get(main_url)
        html_content = response.text
        soup = BeautifulSoup(html_content, 'html.parser')

        file_names = []

        for a_tag in soup.find_all('a', {'class': 'group'}):
            span_tag = a_tag.find('span', {'class': 'truncate'})
            if span_tag:
                file_name = span_tag.text
                if file_name not in dont_download:
                    file_names.append(file_name)

        print(f"Repo: {repo}")
        print("Found files:")
        for file in file_names:
            print(" ", file)
        return file_names

    @staticmethod
    def download_model(repo, base_folder, callback=None):
        """
        Downloads a folder from a Hugging Face repository URL, reports the download progress using a callback function,
        and displays a progress bar.

        Args:
            repo (str): The name of the Hugging Face repository.
            base_folder (str): The base folder where the repository should be saved.
            installation_path (str): The path where the folder should be saved.
            callback (function, optional): A callback function to be called during the download
                with the progress percentage as an argument. Defaults to None.
        """

        import wget
        import os
        from tqdm import tqdm

        file_names = EXLLAMA2.get_filenames(repo)

        dest_dir = Path(base_folder)
        dest_dir.mkdir(parents=True, exist_ok=True)
        os.chdir(dest_dir)

        loading = ["none"]
        previous = [0]
        pbar = tqdm(total=100, desc="Processing", unit="step")
        def chunk_callback(current, total, width=80):
            # This function is called for each received chunk
            # Perform actions or computations on the received chunk
            # chunk: The chunk of data received
            # chunk_size: The size of each chunk in bytes
            # total_size: The total size of the file being downloaded

            # Example: Print the current progress
            downloaded = current
            progress = (current  / total) * 100
            pbar.update(current-previous[0])  # Update the tqdm progress bar
            previous[0] = current
            if callback and ".safetensors" in loading[0]:
                try:
                    callback(downloaded, total)
                except:
                    callback(0, downloaded, total)

        def download_file(get_file):
            src = "/".join(repo.split("/")[:-3])
            filename = f"{src}/resolve/main/{get_file}"
            print(f"\nDownloading {filename}")
            loading[0]=filename
            wget.download(filename, out=str(dest_dir), bar=chunk_callback)

        # with concurrent.futures.ThreadPoolExecutor() as executor:
        #     executor.map(download_file, file_names)
        for file_name in file_names:
            download_file(file_name)

        print("Done")

    def get_file_size(self, url):
        file_names = EXLLAMA2.get_filenames(url)
        for file_name in file_names:
            if file_name.endswith(".safetensors"):
                src = "/".join(url.split("/")[:-3])
                filename = f"{src}/resolve/main/{file_name}"
                response = urllib.request.urlopen(filename)

                # Extract the Content-Length header value
                file_size = response.headers.get('Content-Length')

                # Convert the file size to integer
                if file_size:
                    file_size = int(file_size)

                return file_size
        return<PHONE_NUMBER>

    def list_models(self, config:dict):
        """Lists the models for this binding
        """
        models_dir:Path = self.lollms_paths.personal_models_path/config["binding_name"]  # replace with the actual path to the models folder
        return [f.name for f in models_dir.iterdir() if f.is_dir() and not f.stem.startswith(".") or f.suffix==".reference"]

    @staticmethod
    def get_available_models():
        # Create the file path relative to the child class's directory
        binding_path = Path(__file__).parent
        file_path = binding_path/"models.yaml"

        with open(file_path, 'r') as file:
            yaml_data = yaml.safe_load(file)

        return yaml_data

Hi there,
I have a little problem bugging me though.
It seems that the exllama2 binding yields more hallucination than the hugging face one.
I think I'm doing something wrong in the configuration.
The code is not complex, you just need to look at build_model and generate methods.
The code can be found here:
https://github.com/ParisNeo/lollms_bindings_zoo/blob/main/exllama2/init.py
If you have an idea why I have those halucinations I apreciate your help. In fact, the answer starts ok but it talks alot then goes beyond the answer.
Thanks in advance.

Here is an exmaple:

Is it possibly this line:
        self.settings.disallow_tokens(self.tokenizer, [self.tokenizer.eos_token_id])```

I include it in some of the examples mostly to make sure the model actually delivers the requested number of tokens. For a number of models like Mistral-instruct, you'll definitely want to not include that in regular use.

I'm not sure what the stop condition is supposed to be in that example, or how you're prompting the model. If it's just the base model, and you're expecting it to output "\nParisNeo:", it does look like a weird sort of failure that it would proceed to end quotes instead. Maybe it's trying to emit an EOS token there? Idk.

But in any case the generator requires some sort of stop condition or it will just keep talking forever. Instruct/chat models usually adhere to their prompt format, while base models have to be guided into a of pattern that you can then trigger off of. For that, the streaming generator will return the EOS signal when it encounters any of the conditions set by `set_stop_conditions()`. You just pass it a list of tokens and/or strings to trigger off of.

Hi and thanks for that. I actually force it through the prompt to have a format like this:
!@>instruction: blabla
!@>user_name: prompt
!@>personality: and here i expect the output.
The models be it a base or fine tuned, play along and after answering the question, they either do an EOS, or they continue like this:
!@>user_name: blabla
The callback function has a detection system for the !@> text which if detected, returns false triggering the end of the generation:
                if  self.callback:
                    if not self.callback(chunk, MSG_TYPE.MSG_TYPE_CHUNK):
                        break

                if eos: break

There are a couple of changes in the config compared to V1. compress_pos_emb -> scale_pos_emb and alpha_value -> scale_alpha_value, and the gpu_peer_fix is redundant now. It also doesn't have the no_half2 options. The default sampler settings have changed a bit as well, specifically the repetition penalty range which is 256 by default in V1 and unlimited by default in V2. That would gently discourage the generator from sampling "!@>" since it appears earlier in the context.
You could try token healing (set token_healing = True when calling begin_stream, which  sometimes helps the model stay on track. Also be mindful of little details like whether you're prepending <s> in one case and not the other. You could also try other models, if nothing else then just to see if you get the same behavior.
Beyond that, I can't see anything obviously wrong, I'm afraid. Some notes would be to avoid self.generator.warmup() since all it does is make sure CUDA is fully initialized so you accurately time the first inference. And maybe don't disallow the EOS token but set it as a stop condition instead, just in case the model is actually trying to emit that token and its second-best option isn't very good.

Many thanks for taking time to do this and sorry for the late answer.  I was cleaning my notifications and saw this.
The updates you suggested are very helpful.
It looks like it is working fine now with 20 t/s on my 3060Ti Modest GPU.
Thanks for this beautiful work.
I'm setting it as my favorite gpu binding:

Some users reported problems with a DLL after they install the binding and they can't use it.
Have you had this error reported before?
I have no clue to what is causing this on some PCs and not on others for windows users.


hocr2pdf.py dropping one character (or last character from) words?

Hi, when I try running hocr2pdf.py on the files I've attached, it mostly works but single character "ocr_words" seem to get lost. Also, sometimes the last character in multi-character words?
Oh wait, this is weird.. when opening them in acrobat reader (on osx) the words are (all but two) there, but when opening them in chrome's PDF viewer, a lot (all?) of the single-character ones are missing! Like, you can't even CTRL-F to find them in the doc in chrome, but (mostly) can in adobe!
I've attached the original jp.jpg, the jp.hocr file, a non-searchable pdf of the jpg (just created by running 'convert jp.jpg jp.pdf') and the result of hocr2pdf.py as jp_ocr.pdf.
Strangely the 発展 characters don't seem to make it to the pdf, even when viewing in adobe (everything else does in adobe).
This is some weird, weird stuff...
jp_ocr.pdf
jp.pdf

jp.hocr.txt
Help?

I'm not sure if that hocr file uploaded correctly.. just in case, here it is again?
jp.hocr.txt

Sorry, I don't think I'll be able to help on this.  It seems related to the
particular PDF viewer and the Tesseract OCR engine for your language.  I
have not seen this on english documents.
On Tue, May 17, 2016 at 8:20 PM, zhoujianfu<EMAIL_ADDRESS>wrote:

Hi, when I try running hocr2pdf.py on the files I've attached, it mostly
works but single character "ocr_words" seem to get lost. Also, sometimes
the last character in multi-character words?
Oh wait, this is weird.. when opening them in acrobat reader (on osx) the
words are (all but two) there, but when opening them in chrome's PDF
viewer, a lot (all?) of the single-character ones are missing! Like, you
can't even CTRL-F to find them in the doc in chrome, but (mostly) can in
adobe!
I've attached the original jp.jpg, the jp.hocr file, a non-searchable pdf
of the jpg (just created by running 'convert jp.jpg jp.pdf') and the result
of hocr2pdf.py as jp_ocr.pdf.
Strangely the 発展 characters don't seem to make it to the pdf, even when
viewing in adobe (everything else does in adobe).
This is some weird, weird stuff...
jp_ocr.pdf https://github.com/virantha/pypdfocr/files/269412/jp_ocr.pdf
jp.pdf https://github.com/virantha/pypdfocr/files/269413/jp.pdf
[image: jp]
https://cloud.githubusercontent.com/assets/940578/15343662/8c0e0608-1c53-11e6-8de1-f491717a7940.jpg
jp.hocr.txt
https://github.com/virantha/pypdfocr/files/269414/jp.hocr.txt
Help?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/virantha/pypdfocr/issues/46