Skip to content

Instantly share code, notes, and snippets.

"""2023-10-25_FY-34010_add-source-to-class-resource
/home/paulh/apps/finetune/service-fym/submodules/ft-core/migrations/versions/2023_10_25_fy_34010_add_source_to_class__2be8a742c105.py
Revision ID: 2be8a742c105
Revises: 6088d1b424e3
Create Date: 2023-10-25 15:10:40.516490
"""
from alembic import op
import sqlalchemy as sa
--Abstract
Despite strong performance on a variety of tasks, neural sequence models trained with maximum likelihood have been shown to exhibit issues such as length bias and degenerate repetition. We study the related issue of receiving infinite-length sequences from a recurrent language model when using common decoding algorithms. To analyze this issue, we first define inconsistency of a decoding algorithm, meaning that the algorithm can yield an infinite-length sequence that has zero probability under the model. We prove that commonly used incomplete decoding algorithms - greedy search, beam search, top-k sampling, and nucleus sampling - are inconsistent, despite the fact that recurrent language models are trained to produce sequences of finite length. Based on these insights, we propose two remedies which address inconsistency: consistent variants of top-k and nucleus sampling, and a self-terminating recurrent language model. Empirical results show that inconsistency occurs in practice, and that the propos
@hpaul
hpaul / prob.py
Last active January 10, 2020 14:10
import itertools
A = 10
L = [1, 4, 5, 6, 1, 1, 2, 3]
rezultat = []
# `range` creaza o lista incepand de la primul argument pana la al doilea argument dar excluzandu-l [a, b)
# range(1, 2) returneaza `[1]`
# range(1, 3) returneaza `[1, 2]`
@hpaul
hpaul / mostcited.sql
Created May 22, 2019 14:49
Extract most cited authors
SELECT
author.id,
coauthors.co_list,
json_extract(author.affiliation_current, '$.affiliation-country') AS country_origin,
author.cited_by_count
FROM
author
INNER JOIN coauthors ON author.id = coauthors.id
WHERE
author.cat LIKE '%BIOC%'
# config/intializers/page_request_info.rb
module ActionController
class PageRequestInfo
# http://guides.rubyonrails.org/active_support_instrumentation.html
# http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
# call() is called as an ActiveSupport::Notifications subscriber callback - see the very bottom of this file for the subscriber registration
# We manipulate the Notification event payload so that lograge can log out extra information easily.
def call(name, started, finished, unique_id, payload)
request_info = Thread.current[:page_request_info] || {}
log_info = {}
# config/intializers/page_request_info.rb
module ActionController
class PageRequestInfo
# http://guides.rubyonrails.org/active_support_instrumentation.html
# http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
# call() is called as an ActiveSupport::Notifications subscriber callback - see the very bottom of this file for the subscriber registration
# We manipulate the Notification event payload so that lograge can log out extra information easily.
def call(name, started, finished, unique_id, payload)
request_info = Thread.current[:page_request_info] || {}
log_info = {}
# config/intializers/page_request_info.rb
module ActionController
class PageRequestInfo
# http://guides.rubyonrails.org/active_support_instrumentation.html
# http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
# call() is called as an ActiveSupport::Notifications subscriber callback - see the very bottom of this file for the subscriber registration
# We manipulate the Notification event payload so that lograge can log out extra information easily.
def call(name, started, finished, unique_id, payload)
request_info = Thread.current[:page_request_info] || {}
log_info = {}
# config/intializers/page_request_info.rb
module ActionController
class PageRequestInfo
# http://guides.rubyonrails.org/active_support_instrumentation.html
# http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
# call() is called as an ActiveSupport::Notifications subscriber callback - see the very bottom of this file for the subscriber registration
# We manipulate the Notification event payload so that lograge can log out extra information easily.
def call(name, started, finished, unique_id, payload)
request_info = Thread.current[:page_request_info] || {}
log_info = {}
@withAuthorization
class Users extends Endpoint {
static url = '/users';
static create(data, success, error) {
return this.post(data).then(
success, error
@hpaul
hpaul / widget.php
Created July 10, 2012 20:37
Widget class
<?php
/**
* Widget class library
*
* @author Paul Hrimiuc <[email protected]>
*/
class Widget {
/**