diff --git a/.gitattributes b/.gitattributes index 3bd76951d32fff6eeed948cd0a1f0c88e431f55f..3e90aae5d4a3b7bee6eba7e978b991dfd12c98da 100644 --- a/.gitattributes +++ b/.gitattributes @@ -271,3 +271,22 @@ shared/package-files/30/30e2c5853b7762551f32be245e79fd9d06e52a7cfdfd9c31bfece834 shared/package-files/31/3196378de7c8f842481203abc471a1e1b5f231b4c1da26fd6812cc90df38e012/blob filter=lfs diff=lfs merge=lfs -text shared/package-files/31/31977145330b3a430a9088dcab494e4598947e5084b79e19958f694840c249e6/blob filter=lfs diff=lfs merge=lfs -text shared/package-files/31/31b8c3d177e2f59d9cff0198d08c057aafd81f9098b9ad34eae9d7a4a7b10120/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/3211959beba2d9a5e95409567047d8ff854d4f9e77d8e623d030a34943ac516e/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/321f0293b95d07de6fd2df7c9da5fee13bd9bbb8ae47241731c526ba427c1e2f/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/324cceb2911a13bad228b62b2793776ce4300df1ec710cd805611eceaf81ba62/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/3269b056aff788416a4cddb0c57e2d6a2a34b8df4616a35447eab204eb9c9bc3/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/326f7950937ae1bdd50169bf8a604bde6c2e1a758b32d015a4dc5996eac1e9e2/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/3270fc5dca024bd4ca78976d961dff9407e839dcbb5ba317488005aa1a93b536/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/328316a05d5defc85baed3f1d18a527c088052a6c6f362585079d151f9f3f0bf/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/329f191d3dd5e6ed6bc66411d23bd13f8e2f2d5bc9d98a7f5aa77aaf74249ab0/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/32/32e7cfd5f4833a6be03bad36850b5796ec579fc31fe7ecd1aa8eb14f54115923/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/33/330bff9279f9946aa1f8182ee01c15e4c597b1df891a3b275190476e62de1951/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/33/332a9f4d6e7755c6d1ccec4271e9030f60ac334ae014fddfb6a7c54c3d46373d/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/33/335d55a6d02ea00f200aaa54dad20546a1b88c5d8b2f599a2b0a5ffd7e920314/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/33/336152fee45ad772ba030b300474de581db48777c2c0857c72ce230c5a91a45b/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/33/33ba4d691a4e44278747073f1eb3e3540c6a24bf31c857ba1ecec3092987f1ef/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/33/33d569c599044397f4ee75e13b3c373cb452fb876e8f7e8bf8ec4485d537bf47/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/34/34048a84478aee7a9955cbe83bfff8581662b1119da716f1a3c9ddfca78eba6f/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/34/342b2c16a3e7682eb34e6655dec0bc6b086c3d4c9b6b21f52ccf3a91ad82f734/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/34/3434fdb0ee99663ee112a8bfd7f9378eb1c3d36e6f75519e4378b446e77d38c9/blob filter=lfs diff=lfs merge=lfs -text +shared/package-files/34/347c4ca3bb09091c12653f0d4a4796363333def1ffb7650a503222ffb4f7c522/blob filter=lfs diff=lfs merge=lfs -text diff --git a/shared/package-files/31/31c4764f0f8f37496ced933d462379f544a8c499c3d8822c7c6642cb3c33ac22/blob b/shared/package-files/31/31c4764f0f8f37496ced933d462379f544a8c499c3d8822c7c6642cb3c33ac22/blob new file mode 100644 index 0000000000000000000000000000000000000000..40d87258cf80a580f380f5c04f14772da66b1934 --- /dev/null +++ b/shared/package-files/31/31c4764f0f8f37496ced933d462379f544a8c499c3d8822c7c6642cb3c33ac22/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor special_entr(const at::Tensor & self); +TORCH_API at::Tensor & special_entr_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & special_entr_outf(const at::Tensor & self, at::Tensor & out); + +} // namespace cpu +} // namespace at diff --git a/shared/package-files/31/31c4850d453892009abd4d6edfebaa04697351988b1b1339a8f7c11603d3a9d1/blob b/shared/package-files/31/31c4850d453892009abd4d6edfebaa04697351988b1b1339a8f7c11603d3a9d1/blob new file mode 100644 index 0000000000000000000000000000000000000000..2a4e7b34b62042efdb0ce0f8ee61ce0189320995 --- /dev/null +++ b/shared/package-files/31/31c4850d453892009abd4d6edfebaa04697351988b1b1339a8f7c11603d3a9d1/blob @@ -0,0 +1,22 @@ +from numpy.testing import assert_allclose +from scipy.linalg import cython_lapack as cython_lapack +from scipy.linalg import lapack + + +class TestLamch: + + def test_slamch(self): + for c in [b'e', b's', b'b', b'p', b'n', b'r', b'm', b'u', b'l', b'o']: + assert_allclose(cython_lapack._test_slamch(c), + lapack.slamch(c)) + + def test_dlamch(self): + for c in [b'e', b's', b'b', b'p', b'n', b'r', b'm', b'u', b'l', b'o']: + assert_allclose(cython_lapack._test_dlamch(c), + lapack.dlamch(c)) + + def test_complex_ladiv(self): + cx = .5 + 1.j + cy = .875 + 2.j + assert_allclose(cython_lapack._test_zladiv(cy, cx), 1.95+0.1j) + assert_allclose(cython_lapack._test_cladiv(cy, cx), 1.95+0.1j) diff --git a/shared/package-files/31/31d1e0b9b3bb131716829f12f823fd07851f27f6912e02dab74cb3d295d011d8/blob b/shared/package-files/31/31d1e0b9b3bb131716829f12f823fd07851f27f6912e02dab74cb3d295d011d8/blob new file mode 100644 index 0000000000000000000000000000000000000000..3ad9f26275b0bb407e88e7dad6970db201a05579 --- /dev/null +++ b/shared/package-files/31/31d1e0b9b3bb131716829f12f823fd07851f27f6912e02dab74cb3d295d011d8/blob @@ -0,0 +1,434 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +/// \brief Implementation of Flight RPC client. + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "arrow/ipc/options.h" +#include "arrow/ipc/reader.h" +#include "arrow/ipc/writer.h" +#include "arrow/result.h" +#include "arrow/status.h" +#include "arrow/util/cancel.h" + +#include "arrow/flight/type_fwd.h" +#include "arrow/flight/types.h" // IWYU pragma: keep +#include "arrow/flight/visibility.h" + +namespace arrow { + +class RecordBatch; +class Schema; + +namespace flight { + +/// \brief A duration type for Flight call timeouts. +typedef std::chrono::duration TimeoutDuration; + +/// \brief Hints to the underlying RPC layer for Arrow Flight calls. +class ARROW_FLIGHT_EXPORT FlightCallOptions { + public: + /// Create a default set of call options. + FlightCallOptions(); + + /// \brief An optional timeout for this call. Negative durations + /// mean an implementation-defined default behavior will be used + /// instead. This is the default value. + TimeoutDuration timeout; + + /// \brief IPC reader options, if applicable for the call. + ipc::IpcReadOptions read_options; + + /// \brief IPC writer options, if applicable for the call. + ipc::IpcWriteOptions write_options; + + /// \brief Headers for client to add to context. + std::vector> headers; + + /// \brief A token to enable interactive user cancellation of long-running requests. + StopToken stop_token; + + /// \brief An optional memory manager to control where to allocate incoming data. + std::shared_ptr memory_manager; +}; + +/// \brief Indicate that the client attempted to write a message +/// larger than the soft limit set via write_size_limit_bytes. +class ARROW_FLIGHT_EXPORT FlightWriteSizeStatusDetail : public arrow::StatusDetail { + public: + explicit FlightWriteSizeStatusDetail(int64_t limit, int64_t actual) + : limit_(limit), actual_(actual) {} + const char* type_id() const override; + std::string ToString() const override; + int64_t limit() const { return limit_; } + int64_t actual() const { return actual_; } + + /// \brief Extract this status detail from a status, or return + /// nullptr if the status doesn't contain this status detail. + static std::shared_ptr UnwrapStatus( + const arrow::Status& status); + + private: + int64_t limit_; + int64_t actual_; +}; + +struct ARROW_FLIGHT_EXPORT FlightClientOptions { + /// \brief Root certificates to use for validating server + /// certificates. + std::string tls_root_certs; + /// \brief Override the hostname checked by TLS. Use with caution. + std::string override_hostname; + /// \brief The client certificate to use if using Mutual TLS + std::string cert_chain; + /// \brief The private key associated with the client certificate for Mutual TLS + std::string private_key; + /// \brief A list of client middleware to apply. + std::vector> middleware; + /// \brief A soft limit on the number of bytes to write in a single + /// batch when sending Arrow data to a server. + /// + /// Used to help limit server memory consumption. Only enabled if + /// positive. When enabled, FlightStreamWriter.Write* may yield a + /// IOError with error detail FlightWriteSizeStatusDetail. + int64_t write_size_limit_bytes = 0; + + /// \brief Generic connection options, passed to the underlying + /// transport; interpretation is implementation-dependent. + std::vector>> generic_options; + + /// \brief Use TLS without validating the server certificate. Use with caution. + bool disable_server_verification = false; + + /// \brief Get default options. + static FlightClientOptions Defaults(); +}; + +/// \brief A RecordBatchReader exposing Flight metadata and cancel +/// operations. +class ARROW_FLIGHT_EXPORT FlightStreamReader : public MetadataRecordBatchReader { + public: + /// \brief Try to cancel the call. + virtual void Cancel() = 0; + + using MetadataRecordBatchReader::ToRecordBatches; + /// \brief Consume entire stream as a vector of record batches + virtual arrow::Result>> ToRecordBatches( + const StopToken& stop_token) = 0; + + using MetadataRecordBatchReader::ToTable; + /// \brief Consume entire stream as a Table + arrow::Result> ToTable(const StopToken& stop_token); + + using MetadataRecordBatchReader::stats; + /// \brief Return current read statistics + virtual arrow::ipc::ReadStats stats() const = 0; +}; + +// Silence warning +// "non dll-interface class RecordBatchReader used as base for dll-interface class" +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable : 4275) +#endif + +/// \brief A RecordBatchWriter that also allows sending +/// application-defined metadata via the Flight protocol. +class ARROW_FLIGHT_EXPORT FlightStreamWriter : public MetadataRecordBatchWriter { + public: + /// \brief Indicate that the application is done writing to this stream. + /// + /// The application may not write to this stream after calling + /// this. This differs from closing the stream because this writer + /// may represent only one half of a readable and writable stream. + virtual Status DoneWriting() = 0; +}; + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +/// \brief A reader for application-specific metadata sent back to the +/// client during an upload. +class ARROW_FLIGHT_EXPORT FlightMetadataReader { + public: + virtual ~FlightMetadataReader(); + /// \brief Read a message from the server. + virtual Status ReadMetadata(std::shared_ptr* out) = 0; +}; + +/// \brief Client class for Arrow Flight RPC services. +class ARROW_FLIGHT_EXPORT FlightClient { + public: + ~FlightClient(); + + /// \brief Connect to an unauthenticated flight service + /// \param[in] location the URI + /// \return Arrow result with the created FlightClient, OK status may not indicate that + /// the connection was successful + static arrow::Result> Connect(const Location& location); + + /// \brief Connect to an unauthenticated flight service + /// \param[in] location the URI + /// \param[in] options Other options for setting up the client + /// \return Arrow result with the created FlightClient, OK status may not indicate that + /// the connection was successful + static arrow::Result> Connect( + const Location& location, const FlightClientOptions& options); + + /// \brief Authenticate to the server using the given handler. + /// \param[in] options Per-RPC options + /// \param[in] auth_handler The authentication mechanism to use + /// \return Status OK if the client authenticated successfully + Status Authenticate(const FlightCallOptions& options, + std::unique_ptr auth_handler); + + /// \brief Authenticate to the server using basic HTTP style authentication. + /// \param[in] options Per-RPC options + /// \param[in] username Username to use + /// \param[in] password Password to use + /// \return Arrow result with bearer token and status OK if client authenticated + /// successfully + arrow::Result> AuthenticateBasicToken( + const FlightCallOptions& options, const std::string& username, + const std::string& password); + + /// \brief Perform the indicated action, returning an iterator to the stream + /// of results, if any + /// \param[in] options Per-RPC options + /// \param[in] action the action to be performed + /// \return Arrow result with an iterator object for reading the returned results + arrow::Result> DoAction(const FlightCallOptions& options, + const Action& action); + arrow::Result> DoAction(const Action& action) { + return DoAction({}, action); + } + + /// \brief Perform the CancelFlightInfo action, returning a + /// CancelFlightInfoResult + /// + /// \param[in] options Per-RPC options + /// \param[in] request The CancelFlightInfoRequest + /// \return Arrow result with a CancelFlightInfoResult + arrow::Result CancelFlightInfo( + const FlightCallOptions& options, const CancelFlightInfoRequest& request); + arrow::Result CancelFlightInfo( + const CancelFlightInfoRequest& request) { + return CancelFlightInfo({}, request); + } + + /// \brief Perform the RenewFlightEndpoint action, returning a renewed + /// FlightEndpoint + /// + /// \param[in] options Per-RPC options + /// \param[in] request The RenewFlightEndpointRequest + /// \return Arrow result with a renewed FlightEndpoint + arrow::Result RenewFlightEndpoint( + const FlightCallOptions& options, const RenewFlightEndpointRequest& request); + arrow::Result RenewFlightEndpoint( + const RenewFlightEndpointRequest& request) { + return RenewFlightEndpoint({}, request); + } + + /// \brief Retrieve a list of available Action types + /// \param[in] options Per-RPC options + /// \return Arrow result with the available actions + arrow::Result> ListActions(const FlightCallOptions& options); + arrow::Result> ListActions() { + return ListActions(FlightCallOptions()); + } + + /// \brief Request access plan for a single flight, which may be an existing + /// dataset or a command to be executed + /// \param[in] options Per-RPC options + /// \param[in] descriptor the dataset request, whether a named dataset or + /// command + /// \return Arrow result with the FlightInfo describing where to access the dataset + arrow::Result> GetFlightInfo( + const FlightCallOptions& options, const FlightDescriptor& descriptor); + arrow::Result> GetFlightInfo( + const FlightDescriptor& descriptor) { + return GetFlightInfo({}, descriptor); + } + + /// \brief Asynchronous GetFlightInfo. + /// \param[in] options Per-RPC options + /// \param[in] descriptor the dataset request + /// \param[in] listener Callbacks for response and RPC completion + void GetFlightInfoAsync(const FlightCallOptions& options, + const FlightDescriptor& descriptor, + std::shared_ptr> listener); + void GetFlightInfoAsync(const FlightDescriptor& descriptor, + std::shared_ptr> listener) { + return GetFlightInfoAsync({}, descriptor, std::move(listener)); + } + + /// \brief Asynchronous GetFlightInfo returning a Future. + /// \param[in] options Per-RPC options + /// \param[in] descriptor the dataset request + arrow::Future GetFlightInfoAsync(const FlightCallOptions& options, + const FlightDescriptor& descriptor); + arrow::Future GetFlightInfoAsync(const FlightDescriptor& descriptor) { + return GetFlightInfoAsync({}, descriptor); + } + + /// \brief Request and poll a long running query + /// \param[in] options Per-RPC options + /// \param[in] descriptor the dataset request or a descriptor returned by a + /// prior PollFlightInfo call + /// \return Arrow result with the PollInfo describing the status of + /// the requested query + arrow::Result> PollFlightInfo( + const FlightCallOptions& options, const FlightDescriptor& descriptor); + arrow::Result> PollFlightInfo( + const FlightDescriptor& descriptor) { + return PollFlightInfo({}, descriptor); + } + + /// \brief Request schema for a single flight, which may be an existing + /// dataset or a command to be executed + /// \param[in] options Per-RPC options + /// \param[in] descriptor the dataset request, whether a named dataset or + /// command + /// \return Arrow result with the SchemaResult describing the dataset schema + arrow::Result> GetSchema( + const FlightCallOptions& options, const FlightDescriptor& descriptor); + + arrow::Result> GetSchema( + const FlightDescriptor& descriptor) { + return GetSchema({}, descriptor); + } + + /// \brief List all available flights known to the server + /// \return Arrow result with an iterator that returns a FlightInfo for each flight + arrow::Result> ListFlights(); + + /// \brief List available flights given indicated filter criteria + /// \param[in] options Per-RPC options + /// \param[in] criteria the filter criteria (opaque) + /// \return Arrow result with an iterator that returns a FlightInfo for each flight + arrow::Result> ListFlights( + const FlightCallOptions& options, const Criteria& criteria); + + /// \brief Given a flight ticket and schema, request to be sent the + /// stream. Returns record batch stream reader + /// \param[in] options Per-RPC options + /// \param[in] ticket The flight ticket to use + /// \return Arrow result with the returned RecordBatchReader + arrow::Result> DoGet( + const FlightCallOptions& options, const Ticket& ticket); + arrow::Result> DoGet(const Ticket& ticket) { + return DoGet({}, ticket); + } + + /// \brief DoPut return value + struct DoPutResult { + /// \brief a writer to write record batches to + std::unique_ptr writer; + /// \brief a reader for application metadata from the server + std::unique_ptr reader; + }; + /// \brief Upload data to a Flight described by the given + /// descriptor. The caller must call Close() on the returned stream + /// once they are done writing. + /// + /// The reader and writer are linked; closing the writer will also + /// close the reader. Use \a DoneWriting to only close the write + /// side of the channel. + /// + /// \param[in] options Per-RPC options + /// \param[in] descriptor the descriptor of the stream + /// \param[in] schema the schema for the data to upload + /// \return Arrow result with a DoPutResult struct holding a reader and a writer + arrow::Result DoPut(const FlightCallOptions& options, + const FlightDescriptor& descriptor, + const std::shared_ptr& schema); + + arrow::Result DoPut(const FlightDescriptor& descriptor, + const std::shared_ptr& schema) { + return DoPut({}, descriptor, schema); + } + + struct DoExchangeResult { + std::unique_ptr writer; + std::unique_ptr reader; + }; + arrow::Result DoExchange(const FlightCallOptions& options, + const FlightDescriptor& descriptor); + arrow::Result DoExchange(const FlightDescriptor& descriptor) { + return DoExchange({}, descriptor); + } + + /// \brief Set server session option(s) by name/value. Sessions are generally + /// persisted via HTTP cookies. + /// \param[in] options Per-RPC options + /// \param[in] request The server session options to set + ::arrow::Result SetSessionOptions( + const FlightCallOptions& options, const SetSessionOptionsRequest& request); + + /// \brief Get the current server session options. The session is generally + /// accessed via an HTTP cookie. + /// \param[in] options Per-RPC options + /// \param[in] request The (empty) GetSessionOptions request object. + ::arrow::Result GetSessionOptions( + const FlightCallOptions& options, const GetSessionOptionsRequest& request); + + /// \brief Close/invalidate the current server session. The session is generally + /// accessed via an HTTP cookie. + /// \param[in] options Per-RPC options + /// \param[in] request The (empty) CloseSession request object. + ::arrow::Result CloseSession(const FlightCallOptions& options, + const CloseSessionRequest& request); + + /// \brief Explicitly shut down and clean up the client. + /// + /// For backwards compatibility, this will be implicitly called by + /// the destructor if not already called, but this gives the + /// application no chance to handle errors, so it is recommended to + /// explicitly close the client. + /// + /// \since 8.0.0 + Status Close(); + + /// \brief Whether this client supports asynchronous methods. + bool supports_async() const; + + /// \brief Check whether this client supports asynchronous methods. + /// + /// This is like supports_async(), except that a detailed error message + /// is returned if async support is not available. If async support is + /// available, this function returns successfully. + Status CheckAsyncSupport() const; + + private: + FlightClient(); + Status CheckOpen() const; + std::unique_ptr transport_; + bool closed_; + int64_t write_size_limit_bytes_; +}; + +} // namespace flight +} // namespace arrow diff --git a/shared/package-files/31/31d3fcccd95241e794ee9b0e5f0194750d7ef172b360297998a30872930288df/blob b/shared/package-files/31/31d3fcccd95241e794ee9b0e5f0194750d7ef172b360297998a30872930288df/blob new file mode 100644 index 0000000000000000000000000000000000000000..7e3ba4089ff60e9ab226f7536c6be1843be8ea59 --- /dev/null +++ b/shared/package-files/31/31d3fcccd95241e794ee9b0e5f0194750d7ef172b360297998a30872930288df/blob @@ -0,0 +1,643 @@ +""" +datetimelike delegation +""" +from __future__ import annotations + +from typing import ( + TYPE_CHECKING, + cast, +) +import warnings + +import numpy as np + +from pandas._libs import lib +from pandas.util._exceptions import find_stack_level + +from pandas.core.dtypes.common import ( + is_integer_dtype, + is_list_like, +) +from pandas.core.dtypes.dtypes import ( + ArrowDtype, + CategoricalDtype, + DatetimeTZDtype, + PeriodDtype, +) +from pandas.core.dtypes.generic import ABCSeries + +from pandas.core.accessor import ( + PandasDelegate, + delegate_names, +) +from pandas.core.arrays import ( + DatetimeArray, + PeriodArray, + TimedeltaArray, +) +from pandas.core.arrays.arrow.array import ArrowExtensionArray +from pandas.core.base import ( + NoNewAttributesMixin, + PandasObject, +) +from pandas.core.indexes.datetimes import DatetimeIndex +from pandas.core.indexes.timedeltas import TimedeltaIndex + +if TYPE_CHECKING: + from pandas import ( + DataFrame, + Series, + ) + + +class Properties(PandasDelegate, PandasObject, NoNewAttributesMixin): + _hidden_attrs = PandasObject._hidden_attrs | { + "orig", + "name", + } + + def __init__(self, data: Series, orig) -> None: + if not isinstance(data, ABCSeries): + raise TypeError( + f"cannot convert an object of type {type(data)} to a datetimelike index" + ) + + self._parent = data + self.orig = orig + self.name = getattr(data, "name", None) + self._freeze() + + def _get_values(self): + data = self._parent + if lib.is_np_dtype(data.dtype, "M"): + return DatetimeIndex(data, copy=False, name=self.name) + + elif isinstance(data.dtype, DatetimeTZDtype): + return DatetimeIndex(data, copy=False, name=self.name) + + elif lib.is_np_dtype(data.dtype, "m"): + return TimedeltaIndex(data, copy=False, name=self.name) + + elif isinstance(data.dtype, PeriodDtype): + return PeriodArray(data, copy=False) + + raise TypeError( + f"cannot convert an object of type {type(data)} to a datetimelike index" + ) + + def _delegate_property_get(self, name: str): + from pandas import Series + + values = self._get_values() + + result = getattr(values, name) + + # maybe need to upcast (ints) + if isinstance(result, np.ndarray): + if is_integer_dtype(result): + result = result.astype("int64") + elif not is_list_like(result): + return result + + result = np.asarray(result) + + if self.orig is not None: + index = self.orig.index + else: + index = self._parent.index + # return the result as a Series + result = Series(result, index=index, name=self.name).__finalize__(self._parent) + + # setting this object will show a SettingWithCopyWarning/Error + result._is_copy = ( + "modifications to a property of a datetimelike " + "object are not supported and are discarded. " + "Change values on the original." + ) + + return result + + def _delegate_property_set(self, name: str, value, *args, **kwargs): + raise ValueError( + "modifications to a property of a datetimelike object are not supported. " + "Change values on the original." + ) + + def _delegate_method(self, name: str, *args, **kwargs): + from pandas import Series + + values = self._get_values() + + method = getattr(values, name) + result = method(*args, **kwargs) + + if not is_list_like(result): + return result + + result = Series(result, index=self._parent.index, name=self.name).__finalize__( + self._parent + ) + + # setting this object will show a SettingWithCopyWarning/Error + result._is_copy = ( + "modifications to a method of a datetimelike " + "object are not supported and are discarded. " + "Change values on the original." + ) + + return result + + +@delegate_names( + delegate=ArrowExtensionArray, + accessors=TimedeltaArray._datetimelike_ops, + typ="property", + accessor_mapping=lambda x: f"_dt_{x}", + raise_on_missing=False, +) +@delegate_names( + delegate=ArrowExtensionArray, + accessors=TimedeltaArray._datetimelike_methods, + typ="method", + accessor_mapping=lambda x: f"_dt_{x}", + raise_on_missing=False, +) +@delegate_names( + delegate=ArrowExtensionArray, + accessors=DatetimeArray._datetimelike_ops, + typ="property", + accessor_mapping=lambda x: f"_dt_{x}", + raise_on_missing=False, +) +@delegate_names( + delegate=ArrowExtensionArray, + accessors=DatetimeArray._datetimelike_methods, + typ="method", + accessor_mapping=lambda x: f"_dt_{x}", + raise_on_missing=False, +) +class ArrowTemporalProperties(PandasDelegate, PandasObject, NoNewAttributesMixin): + def __init__(self, data: Series, orig) -> None: + if not isinstance(data, ABCSeries): + raise TypeError( + f"cannot convert an object of type {type(data)} to a datetimelike index" + ) + + self._parent = data + self._orig = orig + self._freeze() + + def _delegate_property_get(self, name: str): + if not hasattr(self._parent.array, f"_dt_{name}"): + raise NotImplementedError( + f"dt.{name} is not supported for {self._parent.dtype}" + ) + result = getattr(self._parent.array, f"_dt_{name}") + + if not is_list_like(result): + return result + + if self._orig is not None: + index = self._orig.index + else: + index = self._parent.index + # return the result as a Series, which is by definition a copy + result = type(self._parent)( + result, index=index, name=self._parent.name + ).__finalize__(self._parent) + + return result + + def _delegate_method(self, name: str, *args, **kwargs): + if not hasattr(self._parent.array, f"_dt_{name}"): + raise NotImplementedError( + f"dt.{name} is not supported for {self._parent.dtype}" + ) + + result = getattr(self._parent.array, f"_dt_{name}")(*args, **kwargs) + + if self._orig is not None: + index = self._orig.index + else: + index = self._parent.index + # return the result as a Series, which is by definition a copy + result = type(self._parent)( + result, index=index, name=self._parent.name + ).__finalize__(self._parent) + + return result + + def to_pytimedelta(self): + return cast(ArrowExtensionArray, self._parent.array)._dt_to_pytimedelta() + + def to_pydatetime(self): + # GH#20306 + warnings.warn( + f"The behavior of {type(self).__name__}.to_pydatetime is deprecated, " + "in a future version this will return a Series containing python " + "datetime objects instead of an ndarray. To retain the old behavior, " + "call `np.array` on the result", + FutureWarning, + stacklevel=find_stack_level(), + ) + return cast(ArrowExtensionArray, self._parent.array)._dt_to_pydatetime() + + def isocalendar(self) -> DataFrame: + from pandas import DataFrame + + result = ( + cast(ArrowExtensionArray, self._parent.array) + ._dt_isocalendar() + ._pa_array.combine_chunks() + ) + iso_calendar_df = DataFrame( + { + col: type(self._parent.array)(result.field(i)) # type: ignore[call-arg] + for i, col in enumerate(["year", "week", "day"]) + } + ) + return iso_calendar_df + + @property + def components(self) -> DataFrame: + from pandas import DataFrame + + components_df = DataFrame( + { + col: getattr(self._parent.array, f"_dt_{col}") + for col in [ + "days", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + ] + } + ) + return components_df + + +@delegate_names( + delegate=DatetimeArray, + accessors=DatetimeArray._datetimelike_ops + ["unit"], + typ="property", +) +@delegate_names( + delegate=DatetimeArray, + accessors=DatetimeArray._datetimelike_methods + ["as_unit"], + typ="method", +) +class DatetimeProperties(Properties): + """ + Accessor object for datetimelike properties of the Series values. + + Examples + -------- + >>> seconds_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="s")) + >>> seconds_series + 0 2000-01-01 00:00:00 + 1 2000-01-01 00:00:01 + 2 2000-01-01 00:00:02 + dtype: datetime64[ns] + >>> seconds_series.dt.second + 0 0 + 1 1 + 2 2 + dtype: int32 + + >>> hours_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="h")) + >>> hours_series + 0 2000-01-01 00:00:00 + 1 2000-01-01 01:00:00 + 2 2000-01-01 02:00:00 + dtype: datetime64[ns] + >>> hours_series.dt.hour + 0 0 + 1 1 + 2 2 + dtype: int32 + + >>> quarters_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="QE")) + >>> quarters_series + 0 2000-03-31 + 1 2000-06-30 + 2 2000-09-30 + dtype: datetime64[ns] + >>> quarters_series.dt.quarter + 0 1 + 1 2 + 2 3 + dtype: int32 + + Returns a Series indexed like the original Series. + Raises TypeError if the Series does not contain datetimelike values. + """ + + def to_pydatetime(self) -> np.ndarray: + """ + Return the data as an array of :class:`datetime.datetime` objects. + + .. deprecated:: 2.1.0 + + The current behavior of dt.to_pydatetime is deprecated. + In a future version this will return a Series containing python + datetime objects instead of a ndarray. + + Timezone information is retained if present. + + .. warning:: + + Python's datetime uses microsecond resolution, which is lower than + pandas (nanosecond). The values are truncated. + + Returns + ------- + numpy.ndarray + Object dtype array containing native Python datetime objects. + + See Also + -------- + datetime.datetime : Standard library value for a datetime. + + Examples + -------- + >>> s = pd.Series(pd.date_range('20180310', periods=2)) + >>> s + 0 2018-03-10 + 1 2018-03-11 + dtype: datetime64[ns] + + >>> s.dt.to_pydatetime() + array([datetime.datetime(2018, 3, 10, 0, 0), + datetime.datetime(2018, 3, 11, 0, 0)], dtype=object) + + pandas' nanosecond precision is truncated to microseconds. + + >>> s = pd.Series(pd.date_range('20180310', periods=2, freq='ns')) + >>> s + 0 2018-03-10 00:00:00.000000000 + 1 2018-03-10 00:00:00.000000001 + dtype: datetime64[ns] + + >>> s.dt.to_pydatetime() + array([datetime.datetime(2018, 3, 10, 0, 0), + datetime.datetime(2018, 3, 10, 0, 0)], dtype=object) + """ + # GH#20306 + warnings.warn( + f"The behavior of {type(self).__name__}.to_pydatetime is deprecated, " + "in a future version this will return a Series containing python " + "datetime objects instead of an ndarray. To retain the old behavior, " + "call `np.array` on the result", + FutureWarning, + stacklevel=find_stack_level(), + ) + return self._get_values().to_pydatetime() + + @property + def freq(self): + return self._get_values().inferred_freq + + def isocalendar(self) -> DataFrame: + """ + Calculate year, week, and day according to the ISO 8601 standard. + + Returns + ------- + DataFrame + With columns year, week and day. + + See Also + -------- + Timestamp.isocalendar : Function return a 3-tuple containing ISO year, + week number, and weekday for the given Timestamp object. + datetime.date.isocalendar : Return a named tuple object with + three components: year, week and weekday. + + Examples + -------- + >>> ser = pd.to_datetime(pd.Series(["2010-01-01", pd.NaT])) + >>> ser.dt.isocalendar() + year week day + 0 2009 53 5 + 1 + >>> ser.dt.isocalendar().week + 0 53 + 1 + Name: week, dtype: UInt32 + """ + return self._get_values().isocalendar().set_index(self._parent.index) + + +@delegate_names( + delegate=TimedeltaArray, accessors=TimedeltaArray._datetimelike_ops, typ="property" +) +@delegate_names( + delegate=TimedeltaArray, + accessors=TimedeltaArray._datetimelike_methods, + typ="method", +) +class TimedeltaProperties(Properties): + """ + Accessor object for datetimelike properties of the Series values. + + Returns a Series indexed like the original Series. + Raises TypeError if the Series does not contain datetimelike values. + + Examples + -------- + >>> seconds_series = pd.Series( + ... pd.timedelta_range(start="1 second", periods=3, freq="s") + ... ) + >>> seconds_series + 0 0 days 00:00:01 + 1 0 days 00:00:02 + 2 0 days 00:00:03 + dtype: timedelta64[ns] + >>> seconds_series.dt.seconds + 0 1 + 1 2 + 2 3 + dtype: int32 + """ + + def to_pytimedelta(self) -> np.ndarray: + """ + Return an array of native :class:`datetime.timedelta` objects. + + Python's standard `datetime` library uses a different representation + timedelta's. This method converts a Series of pandas Timedeltas + to `datetime.timedelta` format with the same length as the original + Series. + + Returns + ------- + numpy.ndarray + Array of 1D containing data with `datetime.timedelta` type. + + See Also + -------- + datetime.timedelta : A duration expressing the difference + between two date, time, or datetime. + + Examples + -------- + >>> s = pd.Series(pd.to_timedelta(np.arange(5), unit="d")) + >>> s + 0 0 days + 1 1 days + 2 2 days + 3 3 days + 4 4 days + dtype: timedelta64[ns] + + >>> s.dt.to_pytimedelta() + array([datetime.timedelta(0), datetime.timedelta(days=1), + datetime.timedelta(days=2), datetime.timedelta(days=3), + datetime.timedelta(days=4)], dtype=object) + """ + return self._get_values().to_pytimedelta() + + @property + def components(self): + """ + Return a Dataframe of the components of the Timedeltas. + + Returns + ------- + DataFrame + + Examples + -------- + >>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='s')) + >>> s + 0 0 days 00:00:00 + 1 0 days 00:00:01 + 2 0 days 00:00:02 + 3 0 days 00:00:03 + 4 0 days 00:00:04 + dtype: timedelta64[ns] + >>> s.dt.components + days hours minutes seconds milliseconds microseconds nanoseconds + 0 0 0 0 0 0 0 0 + 1 0 0 0 1 0 0 0 + 2 0 0 0 2 0 0 0 + 3 0 0 0 3 0 0 0 + 4 0 0 0 4 0 0 0 + """ + return ( + self._get_values() + .components.set_index(self._parent.index) + .__finalize__(self._parent) + ) + + @property + def freq(self): + return self._get_values().inferred_freq + + +@delegate_names( + delegate=PeriodArray, accessors=PeriodArray._datetimelike_ops, typ="property" +) +@delegate_names( + delegate=PeriodArray, accessors=PeriodArray._datetimelike_methods, typ="method" +) +class PeriodProperties(Properties): + """ + Accessor object for datetimelike properties of the Series values. + + Returns a Series indexed like the original Series. + Raises TypeError if the Series does not contain datetimelike values. + + Examples + -------- + >>> seconds_series = pd.Series( + ... pd.period_range( + ... start="2000-01-01 00:00:00", end="2000-01-01 00:00:03", freq="s" + ... ) + ... ) + >>> seconds_series + 0 2000-01-01 00:00:00 + 1 2000-01-01 00:00:01 + 2 2000-01-01 00:00:02 + 3 2000-01-01 00:00:03 + dtype: period[s] + >>> seconds_series.dt.second + 0 0 + 1 1 + 2 2 + 3 3 + dtype: int64 + + >>> hours_series = pd.Series( + ... pd.period_range(start="2000-01-01 00:00", end="2000-01-01 03:00", freq="h") + ... ) + >>> hours_series + 0 2000-01-01 00:00 + 1 2000-01-01 01:00 + 2 2000-01-01 02:00 + 3 2000-01-01 03:00 + dtype: period[h] + >>> hours_series.dt.hour + 0 0 + 1 1 + 2 2 + 3 3 + dtype: int64 + + >>> quarters_series = pd.Series( + ... pd.period_range(start="2000-01-01", end="2000-12-31", freq="Q-DEC") + ... ) + >>> quarters_series + 0 2000Q1 + 1 2000Q2 + 2 2000Q3 + 3 2000Q4 + dtype: period[Q-DEC] + >>> quarters_series.dt.quarter + 0 1 + 1 2 + 2 3 + 3 4 + dtype: int64 + """ + + +class CombinedDatetimelikeProperties( + DatetimeProperties, TimedeltaProperties, PeriodProperties +): + def __new__(cls, data: Series): # pyright: ignore[reportInconsistentConstructor] + # CombinedDatetimelikeProperties isn't really instantiated. Instead + # we need to choose which parent (datetime or timedelta) is + # appropriate. Since we're checking the dtypes anyway, we'll just + # do all the validation here. + + if not isinstance(data, ABCSeries): + raise TypeError( + f"cannot convert an object of type {type(data)} to a datetimelike index" + ) + + orig = data if isinstance(data.dtype, CategoricalDtype) else None + if orig is not None: + data = data._constructor( + orig.array, + name=orig.name, + copy=False, + dtype=orig._values.categories.dtype, + index=orig.index, + ) + + if isinstance(data.dtype, ArrowDtype) and data.dtype.kind in "Mm": + return ArrowTemporalProperties(data, orig) + if lib.is_np_dtype(data.dtype, "M"): + return DatetimeProperties(data, orig) + elif isinstance(data.dtype, DatetimeTZDtype): + return DatetimeProperties(data, orig) + elif lib.is_np_dtype(data.dtype, "m"): + return TimedeltaProperties(data, orig) + elif isinstance(data.dtype, PeriodDtype): + return PeriodProperties(data, orig) + + raise AttributeError("Can only use .dt accessor with datetimelike values") diff --git a/shared/package-files/31/31d72adad79910126b22a5579ec9e179eee86674ecebe3fcff6f76916193af0e/blob b/shared/package-files/31/31d72adad79910126b22a5579ec9e179eee86674ecebe3fcff6f76916193af0e/blob new file mode 100644 index 0000000000000000000000000000000000000000..2f7be81d583f0f95cda1c73f5604d0ee5425019c --- /dev/null +++ b/shared/package-files/31/31d72adad79910126b22a5579ec9e179eee86674ecebe3fcff6f76916193af0e/blob @@ -0,0 +1,342 @@ +StartFontMetrics 4.1 +Comment Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved. +Comment Creation Date: Thu May 1 17:27:09 1997 +Comment UniqueID 43050 +Comment VMusage 39754 50779 +FontName Courier +FullName Courier +FamilyName Courier +Weight Medium +ItalicAngle 0 +IsFixedPitch true +CharacterSet ExtendedRoman +FontBBox -23 -250 715 805 +UnderlinePosition -100 +UnderlineThickness 50 +Version 003.000 +Notice Copyright (c) 1989, 1990, 1991, 1992, 1993, 1997 Adobe Systems Incorporated. All Rights Reserved. +EncodingScheme AdobeStandardEncoding +CapHeight 562 +XHeight 426 +Ascender 629 +Descender -157 +StdHW 51 +StdVW 51 +StartCharMetrics 315 +C 32 ; WX 600 ; N space ; B 0 0 0 0 ; +C 33 ; WX 600 ; N exclam ; B 236 -15 364 572 ; +C 34 ; WX 600 ; N quotedbl ; B 187 328 413 562 ; +C 35 ; WX 600 ; N numbersign ; B 93 -32 507 639 ; +C 36 ; WX 600 ; N dollar ; B 105 -126 496 662 ; +C 37 ; WX 600 ; N percent ; B 81 -15 518 622 ; +C 38 ; WX 600 ; N ampersand ; B 63 -15 538 543 ; +C 39 ; WX 600 ; N quoteright ; B 213 328 376 562 ; +C 40 ; WX 600 ; N parenleft ; B 269 -108 440 622 ; +C 41 ; WX 600 ; N parenright ; B 160 -108 331 622 ; +C 42 ; WX 600 ; N asterisk ; B 116 257 484 607 ; +C 43 ; WX 600 ; N plus ; B 80 44 520 470 ; +C 44 ; WX 600 ; N comma ; B 181 -112 344 122 ; +C 45 ; WX 600 ; N hyphen ; B 103 231 497 285 ; +C 46 ; WX 600 ; N period ; B 229 -15 371 109 ; +C 47 ; WX 600 ; N slash ; B 125 -80 475 629 ; +C 48 ; WX 600 ; N zero ; B 106 -15 494 622 ; +C 49 ; WX 600 ; N one ; B 96 0 505 622 ; +C 50 ; WX 600 ; N two ; B 70 0 471 622 ; +C 51 ; WX 600 ; N three ; B 75 -15 466 622 ; +C 52 ; WX 600 ; N four ; B 78 0 500 622 ; +C 53 ; WX 600 ; N five ; B 92 -15 497 607 ; +C 54 ; WX 600 ; N six ; B 111 -15 497 622 ; +C 55 ; WX 600 ; N seven ; B 82 0 483 607 ; +C 56 ; WX 600 ; N eight ; B 102 -15 498 622 ; +C 57 ; WX 600 ; N nine ; B 96 -15 489 622 ; +C 58 ; WX 600 ; N colon ; B 229 -15 371 385 ; +C 59 ; WX 600 ; N semicolon ; B 181 -112 371 385 ; +C 60 ; WX 600 ; N less ; B 41 42 519 472 ; +C 61 ; WX 600 ; N equal ; B 80 138 520 376 ; +C 62 ; WX 600 ; N greater ; B 66 42 544 472 ; +C 63 ; WX 600 ; N question ; B 129 -15 492 572 ; +C 64 ; WX 600 ; N at ; B 77 -15 533 622 ; +C 65 ; WX 600 ; N A ; B 3 0 597 562 ; +C 66 ; WX 600 ; N B ; B 43 0 559 562 ; +C 67 ; WX 600 ; N C ; B 41 -18 540 580 ; +C 68 ; WX 600 ; N D ; B 43 0 574 562 ; +C 69 ; WX 600 ; N E ; B 53 0 550 562 ; +C 70 ; WX 600 ; N F ; B 53 0 545 562 ; +C 71 ; WX 600 ; N G ; B 31 -18 575 580 ; +C 72 ; WX 600 ; N H ; B 32 0 568 562 ; +C 73 ; WX 600 ; N I ; B 96 0 504 562 ; +C 74 ; WX 600 ; N J ; B 34 -18 566 562 ; +C 75 ; WX 600 ; N K ; B 38 0 582 562 ; +C 76 ; WX 600 ; N L ; B 47 0 554 562 ; +C 77 ; WX 600 ; N M ; B 4 0 596 562 ; +C 78 ; WX 600 ; N N ; B 7 -13 593 562 ; +C 79 ; WX 600 ; N O ; B 43 -18 557 580 ; +C 80 ; WX 600 ; N P ; B 79 0 558 562 ; +C 81 ; WX 600 ; N Q ; B 43 -138 557 580 ; +C 82 ; WX 600 ; N R ; B 38 0 588 562 ; +C 83 ; WX 600 ; N S ; B 72 -20 529 580 ; +C 84 ; WX 600 ; N T ; B 38 0 563 562 ; +C 85 ; WX 600 ; N U ; B 17 -18 583 562 ; +C 86 ; WX 600 ; N V ; B -4 -13 604 562 ; +C 87 ; WX 600 ; N W ; B -3 -13 603 562 ; +C 88 ; WX 600 ; N X ; B 23 0 577 562 ; +C 89 ; WX 600 ; N Y ; B 24 0 576 562 ; +C 90 ; WX 600 ; N Z ; B 86 0 514 562 ; +C 91 ; WX 600 ; N bracketleft ; B 269 -108 442 622 ; +C 92 ; WX 600 ; N backslash ; B 118 -80 482 629 ; +C 93 ; WX 600 ; N bracketright ; B 158 -108 331 622 ; +C 94 ; WX 600 ; N asciicircum ; B 94 354 506 622 ; +C 95 ; WX 600 ; N underscore ; B 0 -125 600 -75 ; +C 96 ; WX 600 ; N quoteleft ; B 224 328 387 562 ; +C 97 ; WX 600 ; N a ; B 53 -15 559 441 ; +C 98 ; WX 600 ; N b ; B 14 -15 575 629 ; +C 99 ; WX 600 ; N c ; B 66 -15 529 441 ; +C 100 ; WX 600 ; N d ; B 45 -15 591 629 ; +C 101 ; WX 600 ; N e ; B 66 -15 548 441 ; +C 102 ; WX 600 ; N f ; B 114 0 531 629 ; L i fi ; L l fl ; +C 103 ; WX 600 ; N g ; B 45 -157 566 441 ; +C 104 ; WX 600 ; N h ; B 18 0 582 629 ; +C 105 ; WX 600 ; N i ; B 95 0 505 657 ; +C 106 ; WX 600 ; N j ; B 82 -157 410 657 ; +C 107 ; WX 600 ; N k ; B 43 0 580 629 ; +C 108 ; WX 600 ; N l ; B 95 0 505 629 ; +C 109 ; WX 600 ; N m ; B -5 0 605 441 ; +C 110 ; WX 600 ; N n ; B 26 0 575 441 ; +C 111 ; WX 600 ; N o ; B 62 -15 538 441 ; +C 112 ; WX 600 ; N p ; B 9 -157 555 441 ; +C 113 ; WX 600 ; N q ; B 45 -157 591 441 ; +C 114 ; WX 600 ; N r ; B 60 0 559 441 ; +C 115 ; WX 600 ; N s ; B 80 -15 513 441 ; +C 116 ; WX 600 ; N t ; B 87 -15 530 561 ; +C 117 ; WX 600 ; N u ; B 21 -15 562 426 ; +C 118 ; WX 600 ; N v ; B 10 -10 590 426 ; +C 119 ; WX 600 ; N w ; B -4 -10 604 426 ; +C 120 ; WX 600 ; N x ; B 20 0 580 426 ; +C 121 ; WX 600 ; N y ; B 7 -157 592 426 ; +C 122 ; WX 600 ; N z ; B 99 0 502 426 ; +C 123 ; WX 600 ; N braceleft ; B 182 -108 437 622 ; +C 124 ; WX 600 ; N bar ; B 275 -250 326 750 ; +C 125 ; WX 600 ; N braceright ; B 163 -108 418 622 ; +C 126 ; WX 600 ; N asciitilde ; B 63 197 540 320 ; +C 161 ; WX 600 ; N exclamdown ; B 236 -157 364 430 ; +C 162 ; WX 600 ; N cent ; B 96 -49 500 614 ; +C 163 ; WX 600 ; N sterling ; B 84 -21 521 611 ; +C 164 ; WX 600 ; N fraction ; B 92 -57 509 665 ; +C 165 ; WX 600 ; N yen ; B 26 0 574 562 ; +C 166 ; WX 600 ; N florin ; B 4 -143 539 622 ; +C 167 ; WX 600 ; N section ; B 113 -78 488 580 ; +C 168 ; WX 600 ; N currency ; B 73 58 527 506 ; +C 169 ; WX 600 ; N quotesingle ; B 259 328 341 562 ; +C 170 ; WX 600 ; N quotedblleft ; B 143 328 471 562 ; +C 171 ; WX 600 ; N guillemotleft ; B 37 70 563 446 ; +C 172 ; WX 600 ; N guilsinglleft ; B 149 70 451 446 ; +C 173 ; WX 600 ; N guilsinglright ; B 149 70 451 446 ; +C 174 ; WX 600 ; N fi ; B 3 0 597 629 ; +C 175 ; WX 600 ; N fl ; B 3 0 597 629 ; +C 177 ; WX 600 ; N endash ; B 75 231 525 285 ; +C 178 ; WX 600 ; N dagger ; B 141 -78 459 580 ; +C 179 ; WX 600 ; N daggerdbl ; B 141 -78 459 580 ; +C 180 ; WX 600 ; N periodcentered ; B 222 189 378 327 ; +C 182 ; WX 600 ; N paragraph ; B 50 -78 511 562 ; +C 183 ; WX 600 ; N bullet ; B 172 130 428 383 ; +C 184 ; WX 600 ; N quotesinglbase ; B 213 -134 376 100 ; +C 185 ; WX 600 ; N quotedblbase ; B 143 -134 457 100 ; +C 186 ; WX 600 ; N quotedblright ; B 143 328 457 562 ; +C 187 ; WX 600 ; N guillemotright ; B 37 70 563 446 ; +C 188 ; WX 600 ; N ellipsis ; B 37 -15 563 111 ; +C 189 ; WX 600 ; N perthousand ; B 3 -15 600 622 ; +C 191 ; WX 600 ; N questiondown ; B 108 -157 471 430 ; +C 193 ; WX 600 ; N grave ; B 151 497 378 672 ; +C 194 ; WX 600 ; N acute ; B 242 497 469 672 ; +C 195 ; WX 600 ; N circumflex ; B 124 477 476 654 ; +C 196 ; WX 600 ; N tilde ; B 105 489 503 606 ; +C 197 ; WX 600 ; N macron ; B 120 525 480 565 ; +C 198 ; WX 600 ; N breve ; B 153 501 447 609 ; +C 199 ; WX 600 ; N dotaccent ; B 249 537 352 640 ; +C 200 ; WX 600 ; N dieresis ; B 148 537 453 640 ; +C 202 ; WX 600 ; N ring ; B 218 463 382 627 ; +C 203 ; WX 600 ; N cedilla ; B 224 -151 362 10 ; +C 205 ; WX 600 ; N hungarumlaut ; B 133 497 540 672 ; +C 206 ; WX 600 ; N ogonek ; B 211 -172 407 4 ; +C 207 ; WX 600 ; N caron ; B 124 492 476 669 ; +C 208 ; WX 600 ; N emdash ; B 0 231 600 285 ; +C 225 ; WX 600 ; N AE ; B 3 0 550 562 ; +C 227 ; WX 600 ; N ordfeminine ; B 156 249 442 580 ; +C 232 ; WX 600 ; N Lslash ; B 47 0 554 562 ; +C 233 ; WX 600 ; N Oslash ; B 43 -80 557 629 ; +C 234 ; WX 600 ; N OE ; B 7 0 567 562 ; +C 235 ; WX 600 ; N ordmasculine ; B 157 249 443 580 ; +C 241 ; WX 600 ; N ae ; B 19 -15 570 441 ; +C 245 ; WX 600 ; N dotlessi ; B 95 0 505 426 ; +C 248 ; WX 600 ; N lslash ; B 95 0 505 629 ; +C 249 ; WX 600 ; N oslash ; B 62 -80 538 506 ; +C 250 ; WX 600 ; N oe ; B 19 -15 559 441 ; +C 251 ; WX 600 ; N germandbls ; B 48 -15 588 629 ; +C -1 ; WX 600 ; N Idieresis ; B 96 0 504 753 ; +C -1 ; WX 600 ; N eacute ; B 66 -15 548 672 ; +C -1 ; WX 600 ; N abreve ; B 53 -15 559 609 ; +C -1 ; WX 600 ; N uhungarumlaut ; B 21 -15 580 672 ; +C -1 ; WX 600 ; N ecaron ; B 66 -15 548 669 ; +C -1 ; WX 600 ; N Ydieresis ; B 24 0 576 753 ; +C -1 ; WX 600 ; N divide ; B 87 48 513 467 ; +C -1 ; WX 600 ; N Yacute ; B 24 0 576 805 ; +C -1 ; WX 600 ; N Acircumflex ; B 3 0 597 787 ; +C -1 ; WX 600 ; N aacute ; B 53 -15 559 672 ; +C -1 ; WX 600 ; N Ucircumflex ; B 17 -18 583 787 ; +C -1 ; WX 600 ; N yacute ; B 7 -157 592 672 ; +C -1 ; WX 600 ; N scommaaccent ; B 80 -250 513 441 ; +C -1 ; WX 600 ; N ecircumflex ; B 66 -15 548 654 ; +C -1 ; WX 600 ; N Uring ; B 17 -18 583 760 ; +C -1 ; WX 600 ; N Udieresis ; B 17 -18 583 753 ; +C -1 ; WX 600 ; N aogonek ; B 53 -172 587 441 ; +C -1 ; WX 600 ; N Uacute ; B 17 -18 583 805 ; +C -1 ; WX 600 ; N uogonek ; B 21 -172 590 426 ; +C -1 ; WX 600 ; N Edieresis ; B 53 0 550 753 ; +C -1 ; WX 600 ; N Dcroat ; B 30 0 574 562 ; +C -1 ; WX 600 ; N commaaccent ; B 198 -250 335 -58 ; +C -1 ; WX 600 ; N copyright ; B 0 -18 600 580 ; +C -1 ; WX 600 ; N Emacron ; B 53 0 550 698 ; +C -1 ; WX 600 ; N ccaron ; B 66 -15 529 669 ; +C -1 ; WX 600 ; N aring ; B 53 -15 559 627 ; +C -1 ; WX 600 ; N Ncommaaccent ; B 7 -250 593 562 ; +C -1 ; WX 600 ; N lacute ; B 95 0 505 805 ; +C -1 ; WX 600 ; N agrave ; B 53 -15 559 672 ; +C -1 ; WX 600 ; N Tcommaaccent ; B 38 -250 563 562 ; +C -1 ; WX 600 ; N Cacute ; B 41 -18 540 805 ; +C -1 ; WX 600 ; N atilde ; B 53 -15 559 606 ; +C -1 ; WX 600 ; N Edotaccent ; B 53 0 550 753 ; +C -1 ; WX 600 ; N scaron ; B 80 -15 513 669 ; +C -1 ; WX 600 ; N scedilla ; B 80 -151 513 441 ; +C -1 ; WX 600 ; N iacute ; B 95 0 505 672 ; +C -1 ; WX 600 ; N lozenge ; B 18 0 443 706 ; +C -1 ; WX 600 ; N Rcaron ; B 38 0 588 802 ; +C -1 ; WX 600 ; N Gcommaaccent ; B 31 -250 575 580 ; +C -1 ; WX 600 ; N ucircumflex ; B 21 -15 562 654 ; +C -1 ; WX 600 ; N acircumflex ; B 53 -15 559 654 ; +C -1 ; WX 600 ; N Amacron ; B 3 0 597 698 ; +C -1 ; WX 600 ; N rcaron ; B 60 0 559 669 ; +C -1 ; WX 600 ; N ccedilla ; B 66 -151 529 441 ; +C -1 ; WX 600 ; N Zdotaccent ; B 86 0 514 753 ; +C -1 ; WX 600 ; N Thorn ; B 79 0 538 562 ; +C -1 ; WX 600 ; N Omacron ; B 43 -18 557 698 ; +C -1 ; WX 600 ; N Racute ; B 38 0 588 805 ; +C -1 ; WX 600 ; N Sacute ; B 72 -20 529 805 ; +C -1 ; WX 600 ; N dcaron ; B 45 -15 715 629 ; +C -1 ; WX 600 ; N Umacron ; B 17 -18 583 698 ; +C -1 ; WX 600 ; N uring ; B 21 -15 562 627 ; +C -1 ; WX 600 ; N threesuperior ; B 155 240 406 622 ; +C -1 ; WX 600 ; N Ograve ; B 43 -18 557 805 ; +C -1 ; WX 600 ; N Agrave ; B 3 0 597 805 ; +C -1 ; WX 600 ; N Abreve ; B 3 0 597 732 ; +C -1 ; WX 600 ; N multiply ; B 87 43 515 470 ; +C -1 ; WX 600 ; N uacute ; B 21 -15 562 672 ; +C -1 ; WX 600 ; N Tcaron ; B 38 0 563 802 ; +C -1 ; WX 600 ; N partialdiff ; B 17 -38 459 710 ; +C -1 ; WX 600 ; N ydieresis ; B 7 -157 592 620 ; +C -1 ; WX 600 ; N Nacute ; B 7 -13 593 805 ; +C -1 ; WX 600 ; N icircumflex ; B 94 0 505 654 ; +C -1 ; WX 600 ; N Ecircumflex ; B 53 0 550 787 ; +C -1 ; WX 600 ; N adieresis ; B 53 -15 559 620 ; +C -1 ; WX 600 ; N edieresis ; B 66 -15 548 620 ; +C -1 ; WX 600 ; N cacute ; B 66 -15 529 672 ; +C -1 ; WX 600 ; N nacute ; B 26 0 575 672 ; +C -1 ; WX 600 ; N umacron ; B 21 -15 562 565 ; +C -1 ; WX 600 ; N Ncaron ; B 7 -13 593 802 ; +C -1 ; WX 600 ; N Iacute ; B 96 0 504 805 ; +C -1 ; WX 600 ; N plusminus ; B 87 44 513 558 ; +C -1 ; WX 600 ; N brokenbar ; B 275 -175 326 675 ; +C -1 ; WX 600 ; N registered ; B 0 -18 600 580 ; +C -1 ; WX 600 ; N Gbreve ; B 31 -18 575 732 ; +C -1 ; WX 600 ; N Idotaccent ; B 96 0 504 753 ; +C -1 ; WX 600 ; N summation ; B 15 -10 585 706 ; +C -1 ; WX 600 ; N Egrave ; B 53 0 550 805 ; +C -1 ; WX 600 ; N racute ; B 60 0 559 672 ; +C -1 ; WX 600 ; N omacron ; B 62 -15 538 565 ; +C -1 ; WX 600 ; N Zacute ; B 86 0 514 805 ; +C -1 ; WX 600 ; N Zcaron ; B 86 0 514 802 ; +C -1 ; WX 600 ; N greaterequal ; B 98 0 502 710 ; +C -1 ; WX 600 ; N Eth ; B 30 0 574 562 ; +C -1 ; WX 600 ; N Ccedilla ; B 41 -151 540 580 ; +C -1 ; WX 600 ; N lcommaaccent ; B 95 -250 505 629 ; +C -1 ; WX 600 ; N tcaron ; B 87 -15 530 717 ; +C -1 ; WX 600 ; N eogonek ; B 66 -172 548 441 ; +C -1 ; WX 600 ; N Uogonek ; B 17 -172 583 562 ; +C -1 ; WX 600 ; N Aacute ; B 3 0 597 805 ; +C -1 ; WX 600 ; N Adieresis ; B 3 0 597 753 ; +C -1 ; WX 600 ; N egrave ; B 66 -15 548 672 ; +C -1 ; WX 600 ; N zacute ; B 99 0 502 672 ; +C -1 ; WX 600 ; N iogonek ; B 95 -172 505 657 ; +C -1 ; WX 600 ; N Oacute ; B 43 -18 557 805 ; +C -1 ; WX 600 ; N oacute ; B 62 -15 538 672 ; +C -1 ; WX 600 ; N amacron ; B 53 -15 559 565 ; +C -1 ; WX 600 ; N sacute ; B 80 -15 513 672 ; +C -1 ; WX 600 ; N idieresis ; B 95 0 505 620 ; +C -1 ; WX 600 ; N Ocircumflex ; B 43 -18 557 787 ; +C -1 ; WX 600 ; N Ugrave ; B 17 -18 583 805 ; +C -1 ; WX 600 ; N Delta ; B 6 0 598 688 ; +C -1 ; WX 600 ; N thorn ; B -6 -157 555 629 ; +C -1 ; WX 600 ; N twosuperior ; B 177 249 424 622 ; +C -1 ; WX 600 ; N Odieresis ; B 43 -18 557 753 ; +C -1 ; WX 600 ; N mu ; B 21 -157 562 426 ; +C -1 ; WX 600 ; N igrave ; B 95 0 505 672 ; +C -1 ; WX 600 ; N ohungarumlaut ; B 62 -15 580 672 ; +C -1 ; WX 600 ; N Eogonek ; B 53 -172 561 562 ; +C -1 ; WX 600 ; N dcroat ; B 45 -15 591 629 ; +C -1 ; WX 600 ; N threequarters ; B 8 -56 593 666 ; +C -1 ; WX 600 ; N Scedilla ; B 72 -151 529 580 ; +C -1 ; WX 600 ; N lcaron ; B 95 0 533 629 ; +C -1 ; WX 600 ; N Kcommaaccent ; B 38 -250 582 562 ; +C -1 ; WX 600 ; N Lacute ; B 47 0 554 805 ; +C -1 ; WX 600 ; N trademark ; B -23 263 623 562 ; +C -1 ; WX 600 ; N edotaccent ; B 66 -15 548 620 ; +C -1 ; WX 600 ; N Igrave ; B 96 0 504 805 ; +C -1 ; WX 600 ; N Imacron ; B 96 0 504 698 ; +C -1 ; WX 600 ; N Lcaron ; B 47 0 554 562 ; +C -1 ; WX 600 ; N onehalf ; B 0 -57 611 665 ; +C -1 ; WX 600 ; N lessequal ; B 98 0 502 710 ; +C -1 ; WX 600 ; N ocircumflex ; B 62 -15 538 654 ; +C -1 ; WX 600 ; N ntilde ; B 26 0 575 606 ; +C -1 ; WX 600 ; N Uhungarumlaut ; B 17 -18 590 805 ; +C -1 ; WX 600 ; N Eacute ; B 53 0 550 805 ; +C -1 ; WX 600 ; N emacron ; B 66 -15 548 565 ; +C -1 ; WX 600 ; N gbreve ; B 45 -157 566 609 ; +C -1 ; WX 600 ; N onequarter ; B 0 -57 600 665 ; +C -1 ; WX 600 ; N Scaron ; B 72 -20 529 802 ; +C -1 ; WX 600 ; N Scommaaccent ; B 72 -250 529 580 ; +C -1 ; WX 600 ; N Ohungarumlaut ; B 43 -18 580 805 ; +C -1 ; WX 600 ; N degree ; B 123 269 477 622 ; +C -1 ; WX 600 ; N ograve ; B 62 -15 538 672 ; +C -1 ; WX 600 ; N Ccaron ; B 41 -18 540 802 ; +C -1 ; WX 600 ; N ugrave ; B 21 -15 562 672 ; +C -1 ; WX 600 ; N radical ; B 3 -15 597 792 ; +C -1 ; WX 600 ; N Dcaron ; B 43 0 574 802 ; +C -1 ; WX 600 ; N rcommaaccent ; B 60 -250 559 441 ; +C -1 ; WX 600 ; N Ntilde ; B 7 -13 593 729 ; +C -1 ; WX 600 ; N otilde ; B 62 -15 538 606 ; +C -1 ; WX 600 ; N Rcommaaccent ; B 38 -250 588 562 ; +C -1 ; WX 600 ; N Lcommaaccent ; B 47 -250 554 562 ; +C -1 ; WX 600 ; N Atilde ; B 3 0 597 729 ; +C -1 ; WX 600 ; N Aogonek ; B 3 -172 608 562 ; +C -1 ; WX 600 ; N Aring ; B 3 0 597 750 ; +C -1 ; WX 600 ; N Otilde ; B 43 -18 557 729 ; +C -1 ; WX 600 ; N zdotaccent ; B 99 0 502 620 ; +C -1 ; WX 600 ; N Ecaron ; B 53 0 550 802 ; +C -1 ; WX 600 ; N Iogonek ; B 96 -172 504 562 ; +C -1 ; WX 600 ; N kcommaaccent ; B 43 -250 580 629 ; +C -1 ; WX 600 ; N minus ; B 80 232 520 283 ; +C -1 ; WX 600 ; N Icircumflex ; B 96 0 504 787 ; +C -1 ; WX 600 ; N ncaron ; B 26 0 575 669 ; +C -1 ; WX 600 ; N tcommaaccent ; B 87 -250 530 561 ; +C -1 ; WX 600 ; N logicalnot ; B 87 108 513 369 ; +C -1 ; WX 600 ; N odieresis ; B 62 -15 538 620 ; +C -1 ; WX 600 ; N udieresis ; B 21 -15 562 620 ; +C -1 ; WX 600 ; N notequal ; B 15 -16 540 529 ; +C -1 ; WX 600 ; N gcommaaccent ; B 45 -157 566 708 ; +C -1 ; WX 600 ; N eth ; B 62 -15 538 629 ; +C -1 ; WX 600 ; N zcaron ; B 99 0 502 669 ; +C -1 ; WX 600 ; N ncommaaccent ; B 26 -250 575 441 ; +C -1 ; WX 600 ; N onesuperior ; B 172 249 428 622 ; +C -1 ; WX 600 ; N imacron ; B 95 0 505 565 ; +C -1 ; WX 600 ; N Euro ; B 0 0 0 0 ; +EndCharMetrics +EndFontMetrics diff --git a/shared/package-files/31/31d7376ec16989846d88c976c3e615f3b4e26178b65f009901ac786a713bc170/blob b/shared/package-files/31/31d7376ec16989846d88c976c3e615f3b4e26178b65f009901ac786a713bc170/blob new file mode 100644 index 0000000000000000000000000000000000000000..14afde2e8fdcb192473ce80824c56584a21d876b Binary files /dev/null and b/shared/package-files/31/31d7376ec16989846d88c976c3e615f3b4e26178b65f009901ac786a713bc170/blob differ diff --git a/shared/package-files/31/31d8f1a50dbaf2ecc9ed9c7566ba0552d454c2ab09e85ff263701857d157c352/blob b/shared/package-files/31/31d8f1a50dbaf2ecc9ed9c7566ba0552d454c2ab09e85ff263701857d157c352/blob new file mode 100644 index 0000000000000000000000000000000000000000..59f3759c409a1fb50e632ef5ef613d3fee7af7ef Binary files /dev/null and b/shared/package-files/31/31d8f1a50dbaf2ecc9ed9c7566ba0552d454c2ab09e85ff263701857d157c352/blob differ diff --git a/shared/package-files/31/31dda61e64849ebf334f5965cf81ea18bf3e7ac057f316cf84a3a50022d503d2/blob b/shared/package-files/31/31dda61e64849ebf334f5965cf81ea18bf3e7ac057f316cf84a3a50022d503d2/blob new file mode 100644 index 0000000000000000000000000000000000000000..42ef9be1b129b718ec6a85320ef77c387a700710 --- /dev/null +++ b/shared/package-files/31/31dda61e64849ebf334f5965cf81ea18bf3e7ac057f316cf84a3a50022d503d2/blob @@ -0,0 +1,1575 @@ +import abc +import cmath +import collections.abc +import contextlib +import warnings +from typing import ( + Any, + Callable, + Collection, + Dict, + List, + NoReturn, + Optional, + Sequence, + Tuple, + Type, + Union, +) + +import torch + +try: + import numpy as np + + NUMPY_AVAILABLE = True +except ModuleNotFoundError: + NUMPY_AVAILABLE = False + + +class ErrorMeta(Exception): + """Internal testing exception that makes that carries error metadata.""" + + def __init__( + self, type: Type[Exception], msg: str, *, id: Tuple[Any, ...] = () + ) -> None: + super().__init__( + "If you are a user and see this message during normal operation " + "please file an issue at https://github.com/pytorch/pytorch/issues. " + "If you are a developer and working on the comparison functions, please `raise ErrorMeta().to_error()` " + "for user facing errors." + ) + self.type = type + self.msg = msg + self.id = id + + def to_error( + self, msg: Optional[Union[str, Callable[[str], str]]] = None + ) -> Exception: + if not isinstance(msg, str): + generated_msg = self.msg + if self.id: + generated_msg += f"\n\nThe failure occurred for item {''.join(str([item]) for item in self.id)}" + + msg = msg(generated_msg) if callable(msg) else generated_msg + + return self.type(msg) + + +# Some analysis of tolerance by logging tests from test_torch.py can be found in +# https://github.com/pytorch/pytorch/pull/32538. +# {dtype: (rtol, atol)} +_DTYPE_PRECISIONS = { + torch.float16: (0.001, 1e-5), + torch.bfloat16: (0.016, 1e-5), + torch.float32: (1.3e-6, 1e-5), + torch.float64: (1e-7, 1e-7), + torch.complex32: (0.001, 1e-5), + torch.complex64: (1.3e-6, 1e-5), + torch.complex128: (1e-7, 1e-7), +} +# The default tolerances of torch.float32 are used for quantized dtypes, because quantized tensors are compared in +# their dequantized and floating point representation. For more details see `TensorLikePair._compare_quantized_values` +_DTYPE_PRECISIONS.update( + dict.fromkeys( + (torch.quint8, torch.quint2x4, torch.quint4x2, torch.qint8, torch.qint32), + _DTYPE_PRECISIONS[torch.float32], + ) +) + + +def default_tolerances( + *inputs: Union[torch.Tensor, torch.dtype], + dtype_precisions: Optional[Dict[torch.dtype, Tuple[float, float]]] = None, +) -> Tuple[float, float]: + """Returns the default absolute and relative testing tolerances for a set of inputs based on the dtype. + + See :func:`assert_close` for a table of the default tolerance for each dtype. + + Returns: + (Tuple[float, float]): Loosest tolerances of all input dtypes. + """ + dtypes = [] + for input in inputs: + if isinstance(input, torch.Tensor): + dtypes.append(input.dtype) + elif isinstance(input, torch.dtype): + dtypes.append(input) + else: + raise TypeError( + f"Expected a torch.Tensor or a torch.dtype, but got {type(input)} instead." + ) + dtype_precisions = dtype_precisions or _DTYPE_PRECISIONS + rtols, atols = zip(*[dtype_precisions.get(dtype, (0.0, 0.0)) for dtype in dtypes]) + return max(rtols), max(atols) + + +def get_tolerances( + *inputs: Union[torch.Tensor, torch.dtype], + rtol: Optional[float], + atol: Optional[float], + id: Tuple[Any, ...] = (), +) -> Tuple[float, float]: + """Gets absolute and relative to be used for numeric comparisons. + + If both ``rtol`` and ``atol`` are specified, this is a no-op. If both are not specified, the return value of + :func:`default_tolerances` is used. + + Raises: + ErrorMeta: With :class:`ValueError`, if only ``rtol`` or ``atol`` is specified. + + Returns: + (Tuple[float, float]): Valid absolute and relative tolerances. + """ + if (rtol is None) ^ (atol is None): + # We require both tolerance to be omitted or specified, because specifying only one might lead to surprising + # results. Imagine setting atol=0.0 and the tensors still match because rtol>0.0. + raise ErrorMeta( + ValueError, + f"Both 'rtol' and 'atol' must be either specified or omitted, " + f"but got no {'rtol' if rtol is None else 'atol'}.", + id=id, + ) + elif rtol is not None and atol is not None: + return rtol, atol + else: + return default_tolerances(*inputs) + + +def _make_mismatch_msg( + *, + default_identifier: str, + identifier: Optional[Union[str, Callable[[str], str]]] = None, + extra: Optional[str] = None, + abs_diff: float, + abs_diff_idx: Optional[Union[int, Tuple[int, ...]]] = None, + atol: float, + rel_diff: float, + rel_diff_idx: Optional[Union[int, Tuple[int, ...]]] = None, + rtol: float, +) -> str: + """Makes a mismatch error message for numeric values. + + Args: + default_identifier (str): Default description of the compared values, e.g. "Tensor-likes". + identifier (Optional[Union[str, Callable[[str], str]]]): Optional identifier that overrides + ``default_identifier``. Can be passed as callable in which case it will be called with + ``default_identifier`` to create the description at runtime. + extra (Optional[str]): Extra information to be placed after the message header and the mismatch statistics. + abs_diff (float): Absolute difference. + abs_diff_idx (Optional[Union[int, Tuple[int, ...]]]): Optional index of the absolute difference. + atol (float): Allowed absolute tolerance. Will only be added to mismatch statistics if it or ``rtol`` are + ``> 0``. + rel_diff (float): Relative difference. + rel_diff_idx (Optional[Union[int, Tuple[int, ...]]]): Optional index of the relative difference. + rtol (float): Allowed relative tolerance. Will only be added to mismatch statistics if it or ``atol`` are + ``> 0``. + """ + equality = rtol == 0 and atol == 0 + + def make_diff_msg( + *, + type: str, + diff: float, + idx: Optional[Union[int, Tuple[int, ...]]], + tol: float, + ) -> str: + if idx is None: + msg = f"{type.title()} difference: {diff}" + else: + msg = f"Greatest {type} difference: {diff} at index {idx}" + if not equality: + msg += f" (up to {tol} allowed)" + return msg + "\n" + + if identifier is None: + identifier = default_identifier + elif callable(identifier): + identifier = identifier(default_identifier) + + msg = f"{identifier} are not {'equal' if equality else 'close'}!\n\n" + + if extra: + msg += f"{extra.strip()}\n" + + msg += make_diff_msg(type="absolute", diff=abs_diff, idx=abs_diff_idx, tol=atol) + msg += make_diff_msg(type="relative", diff=rel_diff, idx=rel_diff_idx, tol=rtol) + + return msg.strip() + + +def make_scalar_mismatch_msg( + actual: Union[bool, int, float, complex], + expected: Union[bool, int, float, complex], + *, + rtol: float, + atol: float, + identifier: Optional[Union[str, Callable[[str], str]]] = None, +) -> str: + """Makes a mismatch error message for scalars. + + Args: + actual (Union[bool, int, float, complex]): Actual scalar. + expected (Union[bool, int, float, complex]): Expected scalar. + rtol (float): Relative tolerance. + atol (float): Absolute tolerance. + identifier (Optional[Union[str, Callable[[str], str]]]): Optional description for the scalars. Can be passed + as callable in which case it will be called by the default value to create the description at runtime. + Defaults to "Scalars". + """ + abs_diff = abs(actual - expected) + rel_diff = float("inf") if expected == 0 else abs_diff / abs(expected) + return _make_mismatch_msg( + default_identifier="Scalars", + identifier=identifier, + extra=f"Expected {expected} but got {actual}.", + abs_diff=abs_diff, + atol=atol, + rel_diff=rel_diff, + rtol=rtol, + ) + + +def make_tensor_mismatch_msg( + actual: torch.Tensor, + expected: torch.Tensor, + matches: torch.Tensor, + *, + rtol: float, + atol: float, + identifier: Optional[Union[str, Callable[[str], str]]] = None, +): + """Makes a mismatch error message for tensors. + + Args: + actual (torch.Tensor): Actual tensor. + expected (torch.Tensor): Expected tensor. + matches (torch.Tensor): Boolean mask of the same shape as ``actual`` and ``expected`` that indicates the + location of matches. + rtol (float): Relative tolerance. + atol (float): Absolute tolerance. + identifier (Optional[Union[str, Callable[[str], str]]]): Optional description for the tensors. Can be passed + as callable in which case it will be called by the default value to create the description at runtime. + Defaults to "Tensor-likes". + """ + + def unravel_flat_index(flat_index: int) -> Tuple[int, ...]: + if not matches.shape: + return () + + inverse_index = [] + for size in matches.shape[::-1]: + div, mod = divmod(flat_index, size) + flat_index = div + inverse_index.append(mod) + + return tuple(inverse_index[::-1]) + + number_of_elements = matches.numel() + total_mismatches = number_of_elements - int(torch.sum(matches)) + extra = ( + f"Mismatched elements: {total_mismatches} / {number_of_elements} " + f"({total_mismatches / number_of_elements:.1%})" + ) + + actual_flat = actual.flatten() + expected_flat = expected.flatten() + matches_flat = matches.flatten() + + if not actual.dtype.is_floating_point and not actual.dtype.is_complex: + # TODO: Instead of always upcasting to int64, it would be sufficient to cast to the next higher dtype to avoid + # overflow + actual_flat = actual_flat.to(torch.int64) + expected_flat = expected_flat.to(torch.int64) + + abs_diff = torch.abs(actual_flat - expected_flat) + # Ensure that only mismatches are used for the max_abs_diff computation + abs_diff[matches_flat] = 0 + max_abs_diff, max_abs_diff_flat_idx = torch.max(abs_diff, 0) + + rel_diff = abs_diff / torch.abs(expected_flat) + # Ensure that only mismatches are used for the max_rel_diff computation + rel_diff[matches_flat] = 0 + max_rel_diff, max_rel_diff_flat_idx = torch.max(rel_diff, 0) + return _make_mismatch_msg( + default_identifier="Tensor-likes", + identifier=identifier, + extra=extra, + abs_diff=max_abs_diff.item(), + abs_diff_idx=unravel_flat_index(int(max_abs_diff_flat_idx)), + atol=atol, + rel_diff=max_rel_diff.item(), + rel_diff_idx=unravel_flat_index(int(max_rel_diff_flat_idx)), + rtol=rtol, + ) + + +class UnsupportedInputs(Exception): # noqa: B903 + """Exception to be raised during the construction of a :class:`Pair` in case it doesn't support the inputs.""" + + +class Pair(abc.ABC): + """ABC for all comparison pairs to be used in conjunction with :func:`assert_equal`. + + Each subclass needs to overwrite :meth:`Pair.compare` that performs the actual comparison. + + Each pair receives **all** options, so select the ones applicable for the subclass and forward the rest to the + super class. Raising an :class:`UnsupportedInputs` during constructions indicates that the pair is not able to + handle the inputs and the next pair type will be tried. + + All other errors should be raised as :class:`ErrorMeta`. After the instantiation, :meth:`Pair._make_error_meta` can + be used to automatically handle overwriting the message with a user supplied one and id handling. + """ + + def __init__( + self, + actual: Any, + expected: Any, + *, + id: Tuple[Any, ...] = (), + **unknown_parameters: Any, + ) -> None: + self.actual = actual + self.expected = expected + self.id = id + self._unknown_parameters = unknown_parameters + + @staticmethod + def _inputs_not_supported() -> NoReturn: + raise UnsupportedInputs() + + @staticmethod + def _check_inputs_isinstance(*inputs: Any, cls: Union[Type, Tuple[Type, ...]]): + """Checks if all inputs are instances of a given class and raise :class:`UnsupportedInputs` otherwise.""" + if not all(isinstance(input, cls) for input in inputs): + Pair._inputs_not_supported() + + def _fail( + self, type: Type[Exception], msg: str, *, id: Tuple[Any, ...] = () + ) -> NoReturn: + """Raises an :class:`ErrorMeta` from a given exception type and message and the stored id. + + .. warning:: + + If you use this before the ``super().__init__(...)`` call in the constructor, you have to pass the ``id`` + explicitly. + """ + raise ErrorMeta(type, msg, id=self.id if not id and hasattr(self, "id") else id) + + @abc.abstractmethod + def compare(self) -> None: + """Compares the inputs and raises an :class`ErrorMeta` in case they mismatch.""" + + def extra_repr(self) -> Sequence[Union[str, Tuple[str, Any]]]: + """Returns extra information that will be included in the representation. + + Should be overwritten by all subclasses that use additional options. The representation of the object will only + be surfaced in case we encounter an unexpected error and thus should help debug the issue. Can be a sequence of + key-value-pairs or attribute names. + """ + return [] + + def __repr__(self) -> str: + head = f"{type(self).__name__}(" + tail = ")" + body = [ + f" {name}={value!s}," + for name, value in [ + ("id", self.id), + ("actual", self.actual), + ("expected", self.expected), + *[ + (extra, getattr(self, extra)) if isinstance(extra, str) else extra + for extra in self.extra_repr() + ], + ] + ] + return "\n".join((head, *body, *tail)) + + +class ObjectPair(Pair): + """Pair for any type of inputs that will be compared with the `==` operator. + + .. note:: + + Since this will instantiate for any kind of inputs, it should only be used as fallback after all other pairs + couldn't handle the inputs. + + """ + + def compare(self) -> None: + try: + equal = self.actual == self.expected + except Exception as error: + # We are not using `self._raise_error_meta` here since we need the exception chaining + raise ErrorMeta( + ValueError, + f"{self.actual} == {self.expected} failed with:\n{error}.", + id=self.id, + ) from error + + if not equal: + self._fail(AssertionError, f"{self.actual} != {self.expected}") + + +class NonePair(Pair): + """Pair for ``None`` inputs.""" + + def __init__(self, actual: Any, expected: Any, **other_parameters: Any) -> None: + if not (actual is None or expected is None): + self._inputs_not_supported() + + super().__init__(actual, expected, **other_parameters) + + def compare(self) -> None: + if not (self.actual is None and self.expected is None): + self._fail( + AssertionError, f"None mismatch: {self.actual} is not {self.expected}" + ) + + +class BooleanPair(Pair): + """Pair for :class:`bool` inputs. + + .. note:: + + If ``numpy`` is available, also handles :class:`numpy.bool_` inputs. + + """ + + def __init__( + self, + actual: Any, + expected: Any, + *, + id: Tuple[Any, ...], + **other_parameters: Any, + ) -> None: + actual, expected = self._process_inputs(actual, expected, id=id) + super().__init__(actual, expected, **other_parameters) + + @property + def _supported_types(self) -> Tuple[Type, ...]: + cls: List[Type] = [bool] + if NUMPY_AVAILABLE: + cls.append(np.bool_) + return tuple(cls) + + def _process_inputs( + self, actual: Any, expected: Any, *, id: Tuple[Any, ...] + ) -> Tuple[bool, bool]: + self._check_inputs_isinstance(actual, expected, cls=self._supported_types) + actual, expected = ( + self._to_bool(bool_like, id=id) for bool_like in (actual, expected) + ) + return actual, expected + + def _to_bool(self, bool_like: Any, *, id: Tuple[Any, ...]) -> bool: + if isinstance(bool_like, bool): + return bool_like + elif isinstance(bool_like, np.bool_): + return bool_like.item() + else: + raise ErrorMeta( + TypeError, f"Unknown boolean type {type(bool_like)}.", id=id + ) + + def compare(self) -> None: + if self.actual is not self.expected: + self._fail( + AssertionError, + f"Booleans mismatch: {self.actual} is not {self.expected}", + ) + + +class NumberPair(Pair): + """Pair for Python number (:class:`int`, :class:`float`, and :class:`complex`) inputs. + + .. note:: + + If ``numpy`` is available, also handles :class:`numpy.number` inputs. + + Kwargs: + rtol (Optional[float]): Relative tolerance. If specified ``atol`` must also be specified. If omitted, default + values based on the type are selected with the below table. + atol (Optional[float]): Absolute tolerance. If specified ``rtol`` must also be specified. If omitted, default + values based on the type are selected with the below table. + equal_nan (bool): If ``True``, two ``NaN`` values are considered equal. Defaults to ``False``. + check_dtype (bool): If ``True``, the type of the inputs will be checked for equality. Defaults to ``False``. + + The following table displays correspondence between Python number type and the ``torch.dtype``'s. See + :func:`assert_close` for the corresponding tolerances. + + +------------------+-------------------------------+ + | ``type`` | corresponding ``torch.dtype`` | + +==================+===============================+ + | :class:`int` | :attr:`~torch.int64` | + +------------------+-------------------------------+ + | :class:`float` | :attr:`~torch.float64` | + +------------------+-------------------------------+ + | :class:`complex` | :attr:`~torch.complex64` | + +------------------+-------------------------------+ + """ + + _TYPE_TO_DTYPE = { + int: torch.int64, + float: torch.float64, + complex: torch.complex128, + } + _NUMBER_TYPES = tuple(_TYPE_TO_DTYPE.keys()) + + def __init__( + self, + actual: Any, + expected: Any, + *, + id: Tuple[Any, ...] = (), + rtol: Optional[float] = None, + atol: Optional[float] = None, + equal_nan: bool = False, + check_dtype: bool = False, + **other_parameters: Any, + ) -> None: + actual, expected = self._process_inputs(actual, expected, id=id) + super().__init__(actual, expected, id=id, **other_parameters) + + self.rtol, self.atol = get_tolerances( + *[self._TYPE_TO_DTYPE[type(input)] for input in (actual, expected)], + rtol=rtol, + atol=atol, + id=id, + ) + self.equal_nan = equal_nan + self.check_dtype = check_dtype + + @property + def _supported_types(self) -> Tuple[Type, ...]: + cls = list(self._NUMBER_TYPES) + if NUMPY_AVAILABLE: + cls.append(np.number) + return tuple(cls) + + def _process_inputs( + self, actual: Any, expected: Any, *, id: Tuple[Any, ...] + ) -> Tuple[Union[int, float, complex], Union[int, float, complex]]: + self._check_inputs_isinstance(actual, expected, cls=self._supported_types) + actual, expected = ( + self._to_number(number_like, id=id) for number_like in (actual, expected) + ) + return actual, expected + + def _to_number( + self, number_like: Any, *, id: Tuple[Any, ...] + ) -> Union[int, float, complex]: + if NUMPY_AVAILABLE and isinstance(number_like, np.number): + return number_like.item() + elif isinstance(number_like, self._NUMBER_TYPES): + return number_like # type: ignore[return-value] + else: + raise ErrorMeta( + TypeError, f"Unknown number type {type(number_like)}.", id=id + ) + + def compare(self) -> None: + if self.check_dtype and type(self.actual) is not type(self.expected): + self._fail( + AssertionError, + f"The (d)types do not match: {type(self.actual)} != {type(self.expected)}.", + ) + + if self.actual == self.expected: + return + + if self.equal_nan and cmath.isnan(self.actual) and cmath.isnan(self.expected): + return + + abs_diff = abs(self.actual - self.expected) + tolerance = self.atol + self.rtol * abs(self.expected) + + if cmath.isfinite(abs_diff) and abs_diff <= tolerance: + return + + self._fail( + AssertionError, + make_scalar_mismatch_msg( + self.actual, self.expected, rtol=self.rtol, atol=self.atol + ), + ) + + def extra_repr(self) -> Sequence[str]: + return ( + "rtol", + "atol", + "equal_nan", + "check_dtype", + ) + + +class TensorLikePair(Pair): + """Pair for :class:`torch.Tensor`-like inputs. + + Kwargs: + allow_subclasses (bool): + rtol (Optional[float]): Relative tolerance. If specified ``atol`` must also be specified. If omitted, default + values based on the type are selected. See :func:assert_close: for details. + atol (Optional[float]): Absolute tolerance. If specified ``rtol`` must also be specified. If omitted, default + values based on the type are selected. See :func:assert_close: for details. + equal_nan (bool): If ``True``, two ``NaN`` values are considered equal. Defaults to ``False``. + check_device (bool): If ``True`` (default), asserts that corresponding tensors are on the same + :attr:`~torch.Tensor.device`. If this check is disabled, tensors on different + :attr:`~torch.Tensor.device`'s are moved to the CPU before being compared. + check_dtype (bool): If ``True`` (default), asserts that corresponding tensors have the same ``dtype``. If this + check is disabled, tensors with different ``dtype``'s are promoted to a common ``dtype`` (according to + :func:`torch.promote_types`) before being compared. + check_layout (bool): If ``True`` (default), asserts that corresponding tensors have the same ``layout``. If this + check is disabled, tensors with different ``layout``'s are converted to strided tensors before being + compared. + check_stride (bool): If ``True`` and corresponding tensors are strided, asserts that they have the same stride. + """ + + def __init__( + self, + actual: Any, + expected: Any, + *, + id: Tuple[Any, ...] = (), + allow_subclasses: bool = True, + rtol: Optional[float] = None, + atol: Optional[float] = None, + equal_nan: bool = False, + check_device: bool = True, + check_dtype: bool = True, + check_layout: bool = True, + check_stride: bool = False, + **other_parameters: Any, + ): + actual, expected = self._process_inputs( + actual, expected, id=id, allow_subclasses=allow_subclasses + ) + super().__init__(actual, expected, id=id, **other_parameters) + + self.rtol, self.atol = get_tolerances( + actual, expected, rtol=rtol, atol=atol, id=self.id + ) + self.equal_nan = equal_nan + self.check_device = check_device + self.check_dtype = check_dtype + self.check_layout = check_layout + self.check_stride = check_stride + + def _process_inputs( + self, actual: Any, expected: Any, *, id: Tuple[Any, ...], allow_subclasses: bool + ) -> Tuple[torch.Tensor, torch.Tensor]: + directly_related = isinstance(actual, type(expected)) or isinstance( + expected, type(actual) + ) + if not directly_related: + self._inputs_not_supported() + + if not allow_subclasses and type(actual) is not type(expected): + self._inputs_not_supported() + + actual, expected = (self._to_tensor(input) for input in (actual, expected)) + for tensor in (actual, expected): + self._check_supported(tensor, id=id) + return actual, expected + + def _to_tensor(self, tensor_like: Any) -> torch.Tensor: + if isinstance(tensor_like, torch.Tensor): + return tensor_like + + try: + return torch.as_tensor(tensor_like) + except Exception: + self._inputs_not_supported() + + def _check_supported(self, tensor: torch.Tensor, *, id: Tuple[Any, ...]) -> None: + if tensor.layout not in { + torch.strided, + torch.sparse_coo, + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }: + raise ErrorMeta( + ValueError, f"Unsupported tensor layout {tensor.layout}", id=id + ) + + def compare(self) -> None: + actual, expected = self.actual, self.expected + + self._compare_attributes(actual, expected) + if any(input.device.type == "meta" for input in (actual, expected)): + return + + actual, expected = self._equalize_attributes(actual, expected) + self._compare_values(actual, expected) + + def _compare_attributes( + self, + actual: torch.Tensor, + expected: torch.Tensor, + ) -> None: + """Checks if the attributes of two tensors match. + + Always checks + + - the :attr:`~torch.Tensor.shape`, + - whether both inputs are quantized or not, + - and if they use the same quantization scheme. + + Checks for + + - :attr:`~torch.Tensor.layout`, + - :meth:`~torch.Tensor.stride`, + - :attr:`~torch.Tensor.device`, and + - :attr:`~torch.Tensor.dtype` + + are optional and can be disabled through the corresponding ``check_*`` flag during construction of the pair. + """ + + def raise_mismatch_error( + attribute_name: str, actual_value: Any, expected_value: Any + ) -> NoReturn: + self._fail( + AssertionError, + f"The values for attribute '{attribute_name}' do not match: {actual_value} != {expected_value}.", + ) + + if actual.shape != expected.shape: + raise_mismatch_error("shape", actual.shape, expected.shape) + + if actual.is_quantized != expected.is_quantized: + raise_mismatch_error( + "is_quantized", actual.is_quantized, expected.is_quantized + ) + elif actual.is_quantized and actual.qscheme() != expected.qscheme(): + raise_mismatch_error("qscheme()", actual.qscheme(), expected.qscheme()) + + if actual.layout != expected.layout: + if self.check_layout: + raise_mismatch_error("layout", actual.layout, expected.layout) + elif ( + actual.layout == torch.strided + and self.check_stride + and actual.stride() != expected.stride() + ): + raise_mismatch_error("stride()", actual.stride(), expected.stride()) + + if self.check_device and actual.device != expected.device: + raise_mismatch_error("device", actual.device, expected.device) + + if self.check_dtype and actual.dtype != expected.dtype: + raise_mismatch_error("dtype", actual.dtype, expected.dtype) + + def _equalize_attributes( + self, actual: torch.Tensor, expected: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Equalizes some attributes of two tensors for value comparison. + + If ``actual`` and ``expected`` are ... + + - ... not on the same :attr:`~torch.Tensor.device`, they are moved CPU memory. + - ... not of the same ``dtype``, they are promoted to a common ``dtype`` (according to + :func:`torch.promote_types`). + - ... not of the same ``layout``, they are converted to strided tensors. + + Args: + actual (Tensor): Actual tensor. + expected (Tensor): Expected tensor. + + Returns: + (Tuple[Tensor, Tensor]): Equalized tensors. + """ + # The comparison logic uses operators currently not supported by the MPS backends. + # See https://github.com/pytorch/pytorch/issues/77144 for details. + # TODO: Remove this conversion as soon as all operations are supported natively by the MPS backend + if actual.is_mps or expected.is_mps: # type: ignore[attr-defined] + actual = actual.cpu() + expected = expected.cpu() + + if actual.device != expected.device: + actual = actual.cpu() + expected = expected.cpu() + + if actual.dtype != expected.dtype: + actual_dtype = actual.dtype + expected_dtype = expected.dtype + # For uint64, this is not sound in general, which is why promote_types doesn't + # allow it, but for easy testing, we're unlikely to get confused + # by large uint64 overflowing into negative int64 + if actual_dtype in [torch.uint64, torch.uint32, torch.uint16]: + actual_dtype = torch.int64 + if expected_dtype in [torch.uint64, torch.uint32, torch.uint16]: + expected_dtype = torch.int64 + dtype = torch.promote_types(actual_dtype, expected_dtype) + actual = actual.to(dtype) + expected = expected.to(dtype) + + if actual.layout != expected.layout: + # These checks are needed, since Tensor.to_dense() fails on tensors that are already strided + actual = actual.to_dense() if actual.layout != torch.strided else actual + expected = ( + expected.to_dense() if expected.layout != torch.strided else expected + ) + + return actual, expected + + def _compare_values(self, actual: torch.Tensor, expected: torch.Tensor) -> None: + if actual.is_quantized: + compare_fn = self._compare_quantized_values + elif actual.is_sparse: + compare_fn = self._compare_sparse_coo_values + elif actual.layout in { + torch.sparse_csr, + torch.sparse_csc, + torch.sparse_bsr, + torch.sparse_bsc, + }: + compare_fn = self._compare_sparse_compressed_values + else: + compare_fn = self._compare_regular_values_close + + compare_fn( + actual, expected, rtol=self.rtol, atol=self.atol, equal_nan=self.equal_nan + ) + + def _compare_quantized_values( + self, + actual: torch.Tensor, + expected: torch.Tensor, + *, + rtol: float, + atol: float, + equal_nan: bool, + ) -> None: + """Compares quantized tensors by comparing the :meth:`~torch.Tensor.dequantize`'d variants for closeness. + + .. note:: + + A detailed discussion about why only the dequantized variant is checked for closeness rather than checking + the individual quantization parameters for closeness and the integer representation for equality can be + found in https://github.com/pytorch/pytorch/issues/68548. + """ + return self._compare_regular_values_close( + actual.dequantize(), + expected.dequantize(), + rtol=rtol, + atol=atol, + equal_nan=equal_nan, + identifier=lambda default_identifier: f"Quantized {default_identifier.lower()}", + ) + + def _compare_sparse_coo_values( + self, + actual: torch.Tensor, + expected: torch.Tensor, + *, + rtol: float, + atol: float, + equal_nan: bool, + ) -> None: + """Compares sparse COO tensors by comparing + + - the number of sparse dimensions, + - the number of non-zero elements (nnz) for equality, + - the indices for equality, and + - the values for closeness. + """ + if actual.sparse_dim() != expected.sparse_dim(): + self._fail( + AssertionError, + ( + f"The number of sparse dimensions in sparse COO tensors does not match: " + f"{actual.sparse_dim()} != {expected.sparse_dim()}" + ), + ) + + if actual._nnz() != expected._nnz(): + self._fail( + AssertionError, + ( + f"The number of specified values in sparse COO tensors does not match: " + f"{actual._nnz()} != {expected._nnz()}" + ), + ) + + self._compare_regular_values_equal( + actual._indices(), + expected._indices(), + identifier="Sparse COO indices", + ) + self._compare_regular_values_close( + actual._values(), + expected._values(), + rtol=rtol, + atol=atol, + equal_nan=equal_nan, + identifier="Sparse COO values", + ) + + def _compare_sparse_compressed_values( + self, + actual: torch.Tensor, + expected: torch.Tensor, + *, + rtol: float, + atol: float, + equal_nan: bool, + ) -> None: + """Compares sparse compressed tensors by comparing + + - the number of non-zero elements (nnz) for equality, + - the plain indices for equality, + - the compressed indices for equality, and + - the values for closeness. + """ + format_name, compressed_indices_method, plain_indices_method = { + torch.sparse_csr: ( + "CSR", + torch.Tensor.crow_indices, + torch.Tensor.col_indices, + ), + torch.sparse_csc: ( + "CSC", + torch.Tensor.ccol_indices, + torch.Tensor.row_indices, + ), + torch.sparse_bsr: ( + "BSR", + torch.Tensor.crow_indices, + torch.Tensor.col_indices, + ), + torch.sparse_bsc: ( + "BSC", + torch.Tensor.ccol_indices, + torch.Tensor.row_indices, + ), + }[actual.layout] + + if actual._nnz() != expected._nnz(): + self._fail( + AssertionError, + ( + f"The number of specified values in sparse {format_name} tensors does not match: " + f"{actual._nnz()} != {expected._nnz()}" + ), + ) + + # Compressed and plain indices in the CSR / CSC / BSR / BSC sparse formates can be `torch.int32` _or_ + # `torch.int64`. While the same dtype is enforced for the compressed and plain indices of a single tensor, it + # can be different between two tensors. Thus, we need to convert them to the same dtype, or the comparison will + # fail. + actual_compressed_indices = compressed_indices_method(actual) + expected_compressed_indices = compressed_indices_method(expected) + indices_dtype = torch.promote_types( + actual_compressed_indices.dtype, expected_compressed_indices.dtype + ) + + self._compare_regular_values_equal( + actual_compressed_indices.to(indices_dtype), + expected_compressed_indices.to(indices_dtype), + identifier=f"Sparse {format_name} {compressed_indices_method.__name__}", + ) + self._compare_regular_values_equal( + plain_indices_method(actual).to(indices_dtype), + plain_indices_method(expected).to(indices_dtype), + identifier=f"Sparse {format_name} {plain_indices_method.__name__}", + ) + self._compare_regular_values_close( + actual.values(), + expected.values(), + rtol=rtol, + atol=atol, + equal_nan=equal_nan, + identifier=f"Sparse {format_name} values", + ) + + def _compare_regular_values_equal( + self, + actual: torch.Tensor, + expected: torch.Tensor, + *, + equal_nan: bool = False, + identifier: Optional[Union[str, Callable[[str], str]]] = None, + ) -> None: + """Checks if the values of two tensors are equal.""" + self._compare_regular_values_close( + actual, expected, rtol=0, atol=0, equal_nan=equal_nan, identifier=identifier + ) + + def _compare_regular_values_close( + self, + actual: torch.Tensor, + expected: torch.Tensor, + *, + rtol: float, + atol: float, + equal_nan: bool, + identifier: Optional[Union[str, Callable[[str], str]]] = None, + ) -> None: + """Checks if the values of two tensors are close up to a desired tolerance.""" + matches = torch.isclose( + actual, expected, rtol=rtol, atol=atol, equal_nan=equal_nan + ) + if torch.all(matches): + return + + if actual.shape == torch.Size([]): + msg = make_scalar_mismatch_msg( + actual.item(), + expected.item(), + rtol=rtol, + atol=atol, + identifier=identifier, + ) + else: + msg = make_tensor_mismatch_msg( + actual, expected, matches, rtol=rtol, atol=atol, identifier=identifier + ) + self._fail(AssertionError, msg) + + def extra_repr(self) -> Sequence[str]: + return ( + "rtol", + "atol", + "equal_nan", + "check_device", + "check_dtype", + "check_layout", + "check_stride", + ) + + +def originate_pairs( + actual: Any, + expected: Any, + *, + pair_types: Sequence[Type[Pair]], + sequence_types: Tuple[Type, ...] = (collections.abc.Sequence,), + mapping_types: Tuple[Type, ...] = (collections.abc.Mapping,), + id: Tuple[Any, ...] = (), + **options: Any, +) -> List[Pair]: + """Originates pairs from the individual inputs. + + ``actual`` and ``expected`` can be possibly nested :class:`~collections.abc.Sequence`'s or + :class:`~collections.abc.Mapping`'s. In this case the pairs are originated by recursing through them. + + Args: + actual (Any): Actual input. + expected (Any): Expected input. + pair_types (Sequence[Type[Pair]]): Sequence of pair types that will be tried to construct with the inputs. + First successful pair will be used. + sequence_types (Tuple[Type, ...]): Optional types treated as sequences that will be checked elementwise. + mapping_types (Tuple[Type, ...]): Optional types treated as mappings that will be checked elementwise. + id (Tuple[Any, ...]): Optional id of a pair that will be included in an error message. + **options (Any): Options passed to each pair during construction. + + Raises: + ErrorMeta: With :class`AssertionError`, if the inputs are :class:`~collections.abc.Sequence`'s, but their + length does not match. + ErrorMeta: With :class`AssertionError`, if the inputs are :class:`~collections.abc.Mapping`'s, but their set of + keys do not match. + ErrorMeta: With :class`TypeError`, if no pair is able to handle the inputs. + ErrorMeta: With any expected exception that happens during the construction of a pair. + + Returns: + (List[Pair]): Originated pairs. + """ + # We explicitly exclude str's here since they are self-referential and would cause an infinite recursion loop: + # "a" == "a"[0][0]... + if ( + isinstance(actual, sequence_types) + and not isinstance(actual, str) + and isinstance(expected, sequence_types) + and not isinstance(expected, str) + ): + actual_len = len(actual) + expected_len = len(expected) + if actual_len != expected_len: + raise ErrorMeta( + AssertionError, + f"The length of the sequences mismatch: {actual_len} != {expected_len}", + id=id, + ) + + pairs = [] + for idx in range(actual_len): + pairs.extend( + originate_pairs( + actual[idx], + expected[idx], + pair_types=pair_types, + sequence_types=sequence_types, + mapping_types=mapping_types, + id=(*id, idx), + **options, + ) + ) + return pairs + + elif isinstance(actual, mapping_types) and isinstance(expected, mapping_types): + actual_keys = set(actual.keys()) + expected_keys = set(expected.keys()) + if actual_keys != expected_keys: + missing_keys = expected_keys - actual_keys + additional_keys = actual_keys - expected_keys + raise ErrorMeta( + AssertionError, + ( + f"The keys of the mappings do not match:\n" + f"Missing keys in the actual mapping: {sorted(missing_keys)}\n" + f"Additional keys in the actual mapping: {sorted(additional_keys)}" + ), + id=id, + ) + + keys: Collection = actual_keys + # Since the origination aborts after the first failure, we try to be deterministic + with contextlib.suppress(Exception): + keys = sorted(keys) + + pairs = [] + for key in keys: + pairs.extend( + originate_pairs( + actual[key], + expected[key], + pair_types=pair_types, + sequence_types=sequence_types, + mapping_types=mapping_types, + id=(*id, key), + **options, + ) + ) + return pairs + + else: + for pair_type in pair_types: + try: + return [pair_type(actual, expected, id=id, **options)] + # Raising an `UnsupportedInputs` during origination indicates that the pair type is not able to handle the + # inputs. Thus, we try the next pair type. + except UnsupportedInputs: + continue + # Raising an `ErrorMeta` during origination is the orderly way to abort and so we simply re-raise it. This + # is only in a separate branch, because the one below would also except it. + except ErrorMeta: + raise + # Raising any other exception during origination is unexpected and will give some extra information about + # what happened. If applicable, the exception should be expected in the future. + except Exception as error: + raise RuntimeError( + f"Originating a {pair_type.__name__}() at item {''.join(str([item]) for item in id)} with\n\n" + f"{type(actual).__name__}(): {actual}\n\n" + f"and\n\n" + f"{type(expected).__name__}(): {expected}\n\n" + f"resulted in the unexpected exception above. " + f"If you are a user and see this message during normal operation " + "please file an issue at https://github.com/pytorch/pytorch/issues. " + "If you are a developer and working on the comparison functions, " + "please except the previous error and raise an expressive `ErrorMeta` instead." + ) from error + else: + raise ErrorMeta( + TypeError, + f"No comparison pair was able to handle inputs of type {type(actual)} and {type(expected)}.", + id=id, + ) + + +def not_close_error_metas( + actual: Any, + expected: Any, + *, + pair_types: Sequence[Type[Pair]] = (ObjectPair,), + sequence_types: Tuple[Type, ...] = (collections.abc.Sequence,), + mapping_types: Tuple[Type, ...] = (collections.abc.Mapping,), + **options: Any, +) -> List[ErrorMeta]: + """Asserts that inputs are equal. + + ``actual`` and ``expected`` can be possibly nested :class:`~collections.abc.Sequence`'s or + :class:`~collections.abc.Mapping`'s. In this case the comparison happens elementwise by recursing through them. + + Args: + actual (Any): Actual input. + expected (Any): Expected input. + pair_types (Sequence[Type[Pair]]): Sequence of :class:`Pair` types that will be tried to construct with the + inputs. First successful pair will be used. Defaults to only using :class:`ObjectPair`. + sequence_types (Tuple[Type, ...]): Optional types treated as sequences that will be checked elementwise. + mapping_types (Tuple[Type, ...]): Optional types treated as mappings that will be checked elementwise. + **options (Any): Options passed to each pair during construction. + """ + # Hide this function from `pytest`'s traceback + __tracebackhide__ = True + + try: + pairs = originate_pairs( + actual, + expected, + pair_types=pair_types, + sequence_types=sequence_types, + mapping_types=mapping_types, + **options, + ) + except ErrorMeta as error_meta: + # Explicitly raising from None to hide the internal traceback + raise error_meta.to_error() from None + + error_metas: List[ErrorMeta] = [] + for pair in pairs: + try: + pair.compare() + except ErrorMeta as error_meta: + error_metas.append(error_meta) + # Raising any exception besides `ErrorMeta` while comparing is unexpected and will give some extra information + # about what happened. If applicable, the exception should be expected in the future. + except Exception as error: + raise RuntimeError( + f"Comparing\n\n" + f"{pair}\n\n" + f"resulted in the unexpected exception above. " + f"If you are a user and see this message during normal operation " + "please file an issue at https://github.com/pytorch/pytorch/issues. " + "If you are a developer and working on the comparison functions, " + "please except the previous error and raise an expressive `ErrorMeta` instead." + ) from error + + # [ErrorMeta Cycles] + # ErrorMeta objects in this list capture + # tracebacks that refer to the frame of this function. + # The local variable `error_metas` refers to the error meta + # objects, creating a reference cycle. Frames in the traceback + # would not get freed until cycle collection, leaking cuda memory in tests. + # We break the cycle by removing the reference to the error_meta objects + # from this frame as it returns. + error_metas = [error_metas] + return error_metas.pop() + + +def assert_close( + actual: Any, + expected: Any, + *, + allow_subclasses: bool = True, + rtol: Optional[float] = None, + atol: Optional[float] = None, + equal_nan: bool = False, + check_device: bool = True, + check_dtype: bool = True, + check_layout: bool = True, + check_stride: bool = False, + msg: Optional[Union[str, Callable[[str], str]]] = None, +): + r"""Asserts that ``actual`` and ``expected`` are close. + + If ``actual`` and ``expected`` are strided, non-quantized, real-valued, and finite, they are considered close if + + .. math:: + + \lvert \text{actual} - \text{expected} \rvert \le \texttt{atol} + \texttt{rtol} \cdot \lvert \text{expected} \rvert + + Non-finite values (``-inf`` and ``inf``) are only considered close if and only if they are equal. ``NaN``'s are + only considered equal to each other if ``equal_nan`` is ``True``. + + In addition, they are only considered close if they have the same + + - :attr:`~torch.Tensor.device` (if ``check_device`` is ``True``), + - ``dtype`` (if ``check_dtype`` is ``True``), + - ``layout`` (if ``check_layout`` is ``True``), and + - stride (if ``check_stride`` is ``True``). + + If either ``actual`` or ``expected`` is a meta tensor, only the attribute checks will be performed. + + If ``actual`` and ``expected`` are sparse (either having COO, CSR, CSC, BSR, or BSC layout), their strided members are + checked individually. Indices, namely ``indices`` for COO, ``crow_indices`` and ``col_indices`` for CSR and BSR, + or ``ccol_indices`` and ``row_indices`` for CSC and BSC layouts, respectively, + are always checked for equality whereas the values are checked for closeness according to the definition above. + + If ``actual`` and ``expected`` are quantized, they are considered close if they have the same + :meth:`~torch.Tensor.qscheme` and the result of :meth:`~torch.Tensor.dequantize` is close according to the + definition above. + + ``actual`` and ``expected`` can be :class:`~torch.Tensor`'s or any tensor-or-scalar-likes from which + :class:`torch.Tensor`'s can be constructed with :func:`torch.as_tensor`. Except for Python scalars the input types + have to be directly related. In addition, ``actual`` and ``expected`` can be :class:`~collections.abc.Sequence`'s + or :class:`~collections.abc.Mapping`'s in which case they are considered close if their structure matches and all + their elements are considered close according to the above definition. + + .. note:: + + Python scalars are an exception to the type relation requirement, because their :func:`type`, i.e. + :class:`int`, :class:`float`, and :class:`complex`, is equivalent to the ``dtype`` of a tensor-like. Thus, + Python scalars of different types can be checked, but require ``check_dtype=False``. + + Args: + actual (Any): Actual input. + expected (Any): Expected input. + allow_subclasses (bool): If ``True`` (default) and except for Python scalars, inputs of directly related types + are allowed. Otherwise type equality is required. + rtol (Optional[float]): Relative tolerance. If specified ``atol`` must also be specified. If omitted, default + values based on the :attr:`~torch.Tensor.dtype` are selected with the below table. + atol (Optional[float]): Absolute tolerance. If specified ``rtol`` must also be specified. If omitted, default + values based on the :attr:`~torch.Tensor.dtype` are selected with the below table. + equal_nan (Union[bool, str]): If ``True``, two ``NaN`` values will be considered equal. + check_device (bool): If ``True`` (default), asserts that corresponding tensors are on the same + :attr:`~torch.Tensor.device`. If this check is disabled, tensors on different + :attr:`~torch.Tensor.device`'s are moved to the CPU before being compared. + check_dtype (bool): If ``True`` (default), asserts that corresponding tensors have the same ``dtype``. If this + check is disabled, tensors with different ``dtype``'s are promoted to a common ``dtype`` (according to + :func:`torch.promote_types`) before being compared. + check_layout (bool): If ``True`` (default), asserts that corresponding tensors have the same ``layout``. If this + check is disabled, tensors with different ``layout``'s are converted to strided tensors before being + compared. + check_stride (bool): If ``True`` and corresponding tensors are strided, asserts that they have the same stride. + msg (Optional[Union[str, Callable[[str], str]]]): Optional error message to use in case a failure occurs during + the comparison. Can also passed as callable in which case it will be called with the generated message and + should return the new message. + + Raises: + ValueError: If no :class:`torch.Tensor` can be constructed from an input. + ValueError: If only ``rtol`` or ``atol`` is specified. + AssertionError: If corresponding inputs are not Python scalars and are not directly related. + AssertionError: If ``allow_subclasses`` is ``False``, but corresponding inputs are not Python scalars and have + different types. + AssertionError: If the inputs are :class:`~collections.abc.Sequence`'s, but their length does not match. + AssertionError: If the inputs are :class:`~collections.abc.Mapping`'s, but their set of keys do not match. + AssertionError: If corresponding tensors do not have the same :attr:`~torch.Tensor.shape`. + AssertionError: If ``check_layout`` is ``True``, but corresponding tensors do not have the same + :attr:`~torch.Tensor.layout`. + AssertionError: If only one of corresponding tensors is quantized. + AssertionError: If corresponding tensors are quantized, but have different :meth:`~torch.Tensor.qscheme`'s. + AssertionError: If ``check_device`` is ``True``, but corresponding tensors are not on the same + :attr:`~torch.Tensor.device`. + AssertionError: If ``check_dtype`` is ``True``, but corresponding tensors do not have the same ``dtype``. + AssertionError: If ``check_stride`` is ``True``, but corresponding strided tensors do not have the same stride. + AssertionError: If the values of corresponding tensors are not close according to the definition above. + + The following table displays the default ``rtol`` and ``atol`` for different ``dtype``'s. In case of mismatching + ``dtype``'s, the maximum of both tolerances is used. + + +---------------------------+------------+----------+ + | ``dtype`` | ``rtol`` | ``atol`` | + +===========================+============+==========+ + | :attr:`~torch.float16` | ``1e-3`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.bfloat16` | ``1.6e-2`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.float32` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.float64` | ``1e-7`` | ``1e-7`` | + +---------------------------+------------+----------+ + | :attr:`~torch.complex32` | ``1e-3`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.complex64` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.complex128` | ``1e-7`` | ``1e-7`` | + +---------------------------+------------+----------+ + | :attr:`~torch.quint8` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.quint2x4` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.quint4x2` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.qint8` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | :attr:`~torch.qint32` | ``1.3e-6`` | ``1e-5`` | + +---------------------------+------------+----------+ + | other | ``0.0`` | ``0.0`` | + +---------------------------+------------+----------+ + + .. note:: + + :func:`~torch.testing.assert_close` is highly configurable with strict default settings. Users are encouraged + to :func:`~functools.partial` it to fit their use case. For example, if an equality check is needed, one might + define an ``assert_equal`` that uses zero tolerances for every ``dtype`` by default: + + >>> import functools + >>> assert_equal = functools.partial(torch.testing.assert_close, rtol=0, atol=0) + >>> assert_equal(1e-9, 1e-10) + Traceback (most recent call last): + ... + AssertionError: Scalars are not equal! + + Expected 1e-10 but got 1e-09. + Absolute difference: 9.000000000000001e-10 + Relative difference: 9.0 + + Examples: + >>> # tensor to tensor comparison + >>> expected = torch.tensor([1e0, 1e-1, 1e-2]) + >>> actual = torch.acos(torch.cos(expected)) + >>> torch.testing.assert_close(actual, expected) + + >>> # scalar to scalar comparison + >>> import math + >>> expected = math.sqrt(2.0) + >>> actual = 2.0 / math.sqrt(2.0) + >>> torch.testing.assert_close(actual, expected) + + >>> # numpy array to numpy array comparison + >>> import numpy as np + >>> expected = np.array([1e0, 1e-1, 1e-2]) + >>> actual = np.arccos(np.cos(expected)) + >>> torch.testing.assert_close(actual, expected) + + >>> # sequence to sequence comparison + >>> import numpy as np + >>> # The types of the sequences do not have to match. They only have to have the same + >>> # length and their elements have to match. + >>> expected = [torch.tensor([1.0]), 2.0, np.array(3.0)] + >>> actual = tuple(expected) + >>> torch.testing.assert_close(actual, expected) + + >>> # mapping to mapping comparison + >>> from collections import OrderedDict + >>> import numpy as np + >>> foo = torch.tensor(1.0) + >>> bar = 2.0 + >>> baz = np.array(3.0) + >>> # The types and a possible ordering of mappings do not have to match. They only + >>> # have to have the same set of keys and their elements have to match. + >>> expected = OrderedDict([("foo", foo), ("bar", bar), ("baz", baz)]) + >>> actual = {"baz": baz, "bar": bar, "foo": foo} + >>> torch.testing.assert_close(actual, expected) + + >>> expected = torch.tensor([1.0, 2.0, 3.0]) + >>> actual = expected.clone() + >>> # By default, directly related instances can be compared + >>> torch.testing.assert_close(torch.nn.Parameter(actual), expected) + >>> # This check can be made more strict with allow_subclasses=False + >>> torch.testing.assert_close( + ... torch.nn.Parameter(actual), expected, allow_subclasses=False + ... ) + Traceback (most recent call last): + ... + TypeError: No comparison pair was able to handle inputs of type + and . + >>> # If the inputs are not directly related, they are never considered close + >>> torch.testing.assert_close(actual.numpy(), expected) + Traceback (most recent call last): + ... + TypeError: No comparison pair was able to handle inputs of type + and . + >>> # Exceptions to these rules are Python scalars. They can be checked regardless of + >>> # their type if check_dtype=False. + >>> torch.testing.assert_close(1.0, 1, check_dtype=False) + + >>> # NaN != NaN by default. + >>> expected = torch.tensor(float("Nan")) + >>> actual = expected.clone() + >>> torch.testing.assert_close(actual, expected) + Traceback (most recent call last): + ... + AssertionError: Scalars are not close! + + Expected nan but got nan. + Absolute difference: nan (up to 1e-05 allowed) + Relative difference: nan (up to 1.3e-06 allowed) + >>> torch.testing.assert_close(actual, expected, equal_nan=True) + + >>> expected = torch.tensor([1.0, 2.0, 3.0]) + >>> actual = torch.tensor([1.0, 4.0, 5.0]) + >>> # The default error message can be overwritten. + >>> torch.testing.assert_close(actual, expected, msg="Argh, the tensors are not close!") + Traceback (most recent call last): + ... + AssertionError: Argh, the tensors are not close! + >>> # If msg is a callable, it can be used to augment the generated message with + >>> # extra information + >>> torch.testing.assert_close( + ... actual, expected, msg=lambda msg: f"Header\n\n{msg}\n\nFooter" + ... ) + Traceback (most recent call last): + ... + AssertionError: Header + + Tensor-likes are not close! + + Mismatched elements: 2 / 3 (66.7%) + Greatest absolute difference: 2.0 at index (1,) (up to 1e-05 allowed) + Greatest relative difference: 1.0 at index (1,) (up to 1.3e-06 allowed) + + Footer + """ + # Hide this function from `pytest`'s traceback + __tracebackhide__ = True + + error_metas = not_close_error_metas( + actual, + expected, + pair_types=( + NonePair, + BooleanPair, + NumberPair, + TensorLikePair, + ), + allow_subclasses=allow_subclasses, + rtol=rtol, + atol=atol, + equal_nan=equal_nan, + check_device=check_device, + check_dtype=check_dtype, + check_layout=check_layout, + check_stride=check_stride, + msg=msg, + ) + + if error_metas: + # TODO: compose all metas into one AssertionError + raise error_metas[0].to_error(msg) + + +def assert_allclose( + actual: Any, + expected: Any, + rtol: Optional[float] = None, + atol: Optional[float] = None, + equal_nan: bool = True, + msg: str = "", +) -> None: + """ + .. warning:: + + :func:`torch.testing.assert_allclose` is deprecated since ``1.12`` and will be removed in a future release. + Please use :func:`torch.testing.assert_close` instead. You can find detailed upgrade instructions + `here `_. + """ + warnings.warn( + "`torch.testing.assert_allclose()` is deprecated since 1.12 and will be removed in a future release. " + "Please use `torch.testing.assert_close()` instead. " + "You can find detailed upgrade instructions in https://github.com/pytorch/pytorch/issues/61844.", + FutureWarning, + stacklevel=2, + ) + + if not isinstance(actual, torch.Tensor): + actual = torch.tensor(actual) + if not isinstance(expected, torch.Tensor): + expected = torch.tensor(expected, dtype=actual.dtype) + + if rtol is None and atol is None: + rtol, atol = default_tolerances( + actual, + expected, + dtype_precisions={ + torch.float16: (1e-3, 1e-3), + torch.float32: (1e-4, 1e-5), + torch.float64: (1e-5, 1e-8), + }, + ) + + torch.testing.assert_close( + actual, + expected, + rtol=rtol, + atol=atol, + equal_nan=equal_nan, + check_device=True, + check_dtype=False, + check_stride=False, + msg=msg or None, + ) diff --git a/shared/package-files/31/31ddedd22e89ab666068c076cb95a18d5c62e82350fc7173a0d4e87c01ebb1cc/blob b/shared/package-files/31/31ddedd22e89ab666068c076cb95a18d5c62e82350fc7173a0d4e87c01ebb1cc/blob new file mode 100644 index 0000000000000000000000000000000000000000..fc82d90c4c8a0344e9e027f683fee4c9e6195b44 --- /dev/null +++ b/shared/package-files/31/31ddedd22e89ab666068c076cb95a18d5c62e82350fc7173a0d4e87c01ebb1cc/blob @@ -0,0 +1,47 @@ +# mypy: ignore-errors + +""" +Python polyfills for common builtins. +""" +import math + +import torch + + +def all(iterator): + for elem in iterator: + if not elem: + return False + return True + + +def any(iterator): + for elem in iterator: + if elem: + return True + return False + + +def index(iterator, item, start=0, end=None): + for i, elem in enumerate(list(iterator))[start:end]: + if item == elem: + return i + # This will not run in dynamo + raise ValueError(f"{item} is not in {type(iterator)}") + + +def repeat(item, count): + for i in range(count): + yield item + + +def radians(x): + return math.pi / 180.0 * x + + +def accumulate_grad(x, new_grad): + new_grad = torch.clone(new_grad) + if x.grad is None: + x.grad = new_grad + else: + x.grad.add_(new_grad) diff --git a/shared/package-files/31/31e1e3cf08b04fc4f64182d1123bd4a38ad46e9b757f1f4bd40ed7bc8adcbea1/blob b/shared/package-files/31/31e1e3cf08b04fc4f64182d1123bd4a38ad46e9b757f1f4bd40ed7bc8adcbea1/blob new file mode 100644 index 0000000000000000000000000000000000000000..71d7b436ea5329f656b4e15ad9845e8991d7e08f Binary files /dev/null and b/shared/package-files/31/31e1e3cf08b04fc4f64182d1123bd4a38ad46e9b757f1f4bd40ed7bc8adcbea1/blob differ diff --git a/shared/package-files/31/31e3a1164bfdd402e278a26d187aa487180eeca241cf9de607cb51718097df19/blob b/shared/package-files/31/31e3a1164bfdd402e278a26d187aa487180eeca241cf9de607cb51718097df19/blob new file mode 100644 index 0000000000000000000000000000000000000000..f9e1bfee69d785a7ecaa4800a75616cbd8ac399b --- /dev/null +++ b/shared/package-files/31/31e3a1164bfdd402e278a26d187aa487180eeca241cf9de607cb51718097df19/blob @@ -0,0 +1,158 @@ +""" +Cuthill-McKee ordering of graph nodes to produce sparse matrices +""" +from collections import deque +from operator import itemgetter + +import networkx as nx + +from ..utils import arbitrary_element + +__all__ = ["cuthill_mckee_ordering", "reverse_cuthill_mckee_ordering"] + + +def cuthill_mckee_ordering(G, heuristic=None): + """Generate an ordering (permutation) of the graph nodes to make + a sparse matrix. + + Uses the Cuthill-McKee heuristic (based on breadth-first search) [1]_. + + Parameters + ---------- + G : graph + A NetworkX graph + + heuristic : function, optional + Function to choose starting node for RCM algorithm. If None + a node from a pseudo-peripheral pair is used. A user-defined function + can be supplied that takes a graph object and returns a single node. + + Returns + ------- + nodes : generator + Generator of nodes in Cuthill-McKee ordering. + + Examples + -------- + >>> from networkx.utils import cuthill_mckee_ordering + >>> G = nx.path_graph(4) + >>> rcm = list(cuthill_mckee_ordering(G)) + >>> A = nx.adjacency_matrix(G, nodelist=rcm) + + Smallest degree node as heuristic function: + + >>> def smallest_degree(G): + ... return min(G, key=G.degree) + >>> rcm = list(cuthill_mckee_ordering(G, heuristic=smallest_degree)) + + + See Also + -------- + reverse_cuthill_mckee_ordering + + Notes + ----- + The optimal solution the bandwidth reduction is NP-complete [2]_. + + + References + ---------- + .. [1] E. Cuthill and J. McKee. + Reducing the bandwidth of sparse symmetric matrices, + In Proc. 24th Nat. Conf. ACM, pages 157-172, 1969. + http://doi.acm.org/10.1145/800195.805928 + .. [2] Steven S. Skiena. 1997. The Algorithm Design Manual. + Springer-Verlag New York, Inc., New York, NY, USA. + """ + for c in nx.connected_components(G): + yield from connected_cuthill_mckee_ordering(G.subgraph(c), heuristic) + + +def reverse_cuthill_mckee_ordering(G, heuristic=None): + """Generate an ordering (permutation) of the graph nodes to make + a sparse matrix. + + Uses the reverse Cuthill-McKee heuristic (based on breadth-first search) + [1]_. + + Parameters + ---------- + G : graph + A NetworkX graph + + heuristic : function, optional + Function to choose starting node for RCM algorithm. If None + a node from a pseudo-peripheral pair is used. A user-defined function + can be supplied that takes a graph object and returns a single node. + + Returns + ------- + nodes : generator + Generator of nodes in reverse Cuthill-McKee ordering. + + Examples + -------- + >>> from networkx.utils import reverse_cuthill_mckee_ordering + >>> G = nx.path_graph(4) + >>> rcm = list(reverse_cuthill_mckee_ordering(G)) + >>> A = nx.adjacency_matrix(G, nodelist=rcm) + + Smallest degree node as heuristic function: + + >>> def smallest_degree(G): + ... return min(G, key=G.degree) + >>> rcm = list(reverse_cuthill_mckee_ordering(G, heuristic=smallest_degree)) + + + See Also + -------- + cuthill_mckee_ordering + + Notes + ----- + The optimal solution the bandwidth reduction is NP-complete [2]_. + + References + ---------- + .. [1] E. Cuthill and J. McKee. + Reducing the bandwidth of sparse symmetric matrices, + In Proc. 24th Nat. Conf. ACM, pages 157-72, 1969. + http://doi.acm.org/10.1145/800195.805928 + .. [2] Steven S. Skiena. 1997. The Algorithm Design Manual. + Springer-Verlag New York, Inc., New York, NY, USA. + """ + return reversed(list(cuthill_mckee_ordering(G, heuristic=heuristic))) + + +def connected_cuthill_mckee_ordering(G, heuristic=None): + # the cuthill mckee algorithm for connected graphs + if heuristic is None: + start = pseudo_peripheral_node(G) + else: + start = heuristic(G) + visited = {start} + queue = deque([start]) + while queue: + parent = queue.popleft() + yield parent + nd = sorted(G.degree(set(G[parent]) - visited), key=itemgetter(1)) + children = [n for n, d in nd] + visited.update(children) + queue.extend(children) + + +def pseudo_peripheral_node(G): + # helper for cuthill-mckee to find a node in a "pseudo peripheral pair" + # to use as good starting node + u = arbitrary_element(G) + lp = 0 + v = u + while True: + spl = dict(nx.shortest_path_length(G, v)) + l = max(spl.values()) + if l <= lp: + break + lp = l + farthest = (n for n, dist in spl.items() if dist == l) + v, deg = min(G.degree(farthest), key=itemgetter(1)) + return v diff --git a/shared/package-files/31/31e6182e61583cd1b8d31359b26ecead2dba2ae003a7714c16afc1795bdbeceb/blob b/shared/package-files/31/31e6182e61583cd1b8d31359b26ecead2dba2ae003a7714c16afc1795bdbeceb/blob new file mode 100644 index 0000000000000000000000000000000000000000..456869aef3b2ed692e653021c7c3a0422769ce84 --- /dev/null +++ b/shared/package-files/31/31e6182e61583cd1b8d31359b26ecead2dba2ae003a7714c16afc1795bdbeceb/blob @@ -0,0 +1,1400 @@ +# FontDame-to-FontTools for OpenType Layout tables +# +# Source language spec is available at: +# http://monotype.github.io/OpenType_Table_Source/otl_source.html +# https://github.com/Monotype/OpenType_Table_Source/ + +from fontTools import ttLib +from fontTools.ttLib.tables._c_m_a_p import cmap_classes +from fontTools.ttLib.tables import otTables as ot +from fontTools.ttLib.tables.otBase import ValueRecord, valueRecordFormatDict +from fontTools.otlLib import builder as otl +from contextlib import contextmanager +from fontTools.ttLib import newTable +from fontTools.feaLib.lookupDebugInfo import LOOKUP_DEBUG_ENV_VAR, LOOKUP_DEBUG_INFO_KEY +from operator import setitem +import os +import logging + + +class MtiLibError(Exception): + pass + + +class ReferenceNotFoundError(MtiLibError): + pass + + +class FeatureNotFoundError(ReferenceNotFoundError): + pass + + +class LookupNotFoundError(ReferenceNotFoundError): + pass + + +log = logging.getLogger("fontTools.mtiLib") + + +def makeGlyph(s): + if s[:2] in ["U ", "u "]: + return ttLib.TTFont._makeGlyphName(int(s[2:], 16)) + elif s[:2] == "# ": + return "glyph%.5d" % int(s[2:]) + assert s.find(" ") < 0, "Space found in glyph name: %s" % s + assert s, "Glyph name is empty" + return s + + +def makeGlyphs(l): + return [makeGlyph(g) for g in l] + + +def mapLookup(sym, mapping): + # Lookups are addressed by name. So resolved them using a map if available. + # Fallback to parsing as lookup index if a map isn't provided. + if mapping is not None: + try: + idx = mapping[sym] + except KeyError: + raise LookupNotFoundError(sym) + else: + idx = int(sym) + return idx + + +def mapFeature(sym, mapping): + # Features are referenced by index according the spec. So, if symbol is an + # integer, use it directly. Otherwise look up in the map if provided. + try: + idx = int(sym) + except ValueError: + try: + idx = mapping[sym] + except KeyError: + raise FeatureNotFoundError(sym) + return idx + + +def setReference(mapper, mapping, sym, setter, collection, key): + try: + mapped = mapper(sym, mapping) + except ReferenceNotFoundError as e: + try: + if mapping is not None: + mapping.addDeferredMapping( + lambda ref: setter(collection, key, ref), sym, e + ) + return + except AttributeError: + pass + raise + setter(collection, key, mapped) + + +class DeferredMapping(dict): + def __init__(self): + self._deferredMappings = [] + + def addDeferredMapping(self, setter, sym, e): + log.debug("Adding deferred mapping for symbol '%s' %s", sym, type(e).__name__) + self._deferredMappings.append((setter, sym, e)) + + def applyDeferredMappings(self): + for setter, sym, e in self._deferredMappings: + log.debug( + "Applying deferred mapping for symbol '%s' %s", sym, type(e).__name__ + ) + try: + mapped = self[sym] + except KeyError: + raise e + setter(mapped) + log.debug("Set to %s", mapped) + self._deferredMappings = [] + + +def parseScriptList(lines, featureMap=None): + self = ot.ScriptList() + records = [] + with lines.between("script table"): + for line in lines: + while len(line) < 4: + line.append("") + scriptTag, langSysTag, defaultFeature, features = line + log.debug("Adding script %s language-system %s", scriptTag, langSysTag) + + langSys = ot.LangSys() + langSys.LookupOrder = None + if defaultFeature: + setReference( + mapFeature, + featureMap, + defaultFeature, + setattr, + langSys, + "ReqFeatureIndex", + ) + else: + langSys.ReqFeatureIndex = 0xFFFF + syms = stripSplitComma(features) + langSys.FeatureIndex = theList = [3] * len(syms) + for i, sym in enumerate(syms): + setReference(mapFeature, featureMap, sym, setitem, theList, i) + langSys.FeatureCount = len(langSys.FeatureIndex) + + script = [s for s in records if s.ScriptTag == scriptTag] + if script: + script = script[0].Script + else: + scriptRec = ot.ScriptRecord() + scriptRec.ScriptTag = scriptTag + " " * (4 - len(scriptTag)) + scriptRec.Script = ot.Script() + records.append(scriptRec) + script = scriptRec.Script + script.DefaultLangSys = None + script.LangSysRecord = [] + script.LangSysCount = 0 + + if langSysTag == "default": + script.DefaultLangSys = langSys + else: + langSysRec = ot.LangSysRecord() + langSysRec.LangSysTag = langSysTag + " " * (4 - len(langSysTag)) + langSysRec.LangSys = langSys + script.LangSysRecord.append(langSysRec) + script.LangSysCount = len(script.LangSysRecord) + + for script in records: + script.Script.LangSysRecord = sorted( + script.Script.LangSysRecord, key=lambda rec: rec.LangSysTag + ) + self.ScriptRecord = sorted(records, key=lambda rec: rec.ScriptTag) + self.ScriptCount = len(self.ScriptRecord) + return self + + +def parseFeatureList(lines, lookupMap=None, featureMap=None): + self = ot.FeatureList() + self.FeatureRecord = [] + with lines.between("feature table"): + for line in lines: + name, featureTag, lookups = line + if featureMap is not None: + assert name not in featureMap, "Duplicate feature name: %s" % name + featureMap[name] = len(self.FeatureRecord) + # If feature name is integer, make sure it matches its index. + try: + assert int(name) == len(self.FeatureRecord), "%d %d" % ( + name, + len(self.FeatureRecord), + ) + except ValueError: + pass + featureRec = ot.FeatureRecord() + featureRec.FeatureTag = featureTag + featureRec.Feature = ot.Feature() + self.FeatureRecord.append(featureRec) + feature = featureRec.Feature + feature.FeatureParams = None + syms = stripSplitComma(lookups) + feature.LookupListIndex = theList = [None] * len(syms) + for i, sym in enumerate(syms): + setReference(mapLookup, lookupMap, sym, setitem, theList, i) + feature.LookupCount = len(feature.LookupListIndex) + + self.FeatureCount = len(self.FeatureRecord) + return self + + +def parseLookupFlags(lines): + flags = 0 + filterset = None + allFlags = [ + "righttoleft", + "ignorebaseglyphs", + "ignoreligatures", + "ignoremarks", + "markattachmenttype", + "markfiltertype", + ] + while lines.peeks()[0].lower() in allFlags: + line = next(lines) + flag = { + "righttoleft": 0x0001, + "ignorebaseglyphs": 0x0002, + "ignoreligatures": 0x0004, + "ignoremarks": 0x0008, + }.get(line[0].lower()) + if flag: + assert line[1].lower() in ["yes", "no"], line[1] + if line[1].lower() == "yes": + flags |= flag + continue + if line[0].lower() == "markattachmenttype": + flags |= int(line[1]) << 8 + continue + if line[0].lower() == "markfiltertype": + flags |= 0x10 + filterset = int(line[1]) + return flags, filterset + + +def parseSingleSubst(lines, font, _lookupMap=None): + mapping = {} + for line in lines: + assert len(line) == 2, line + line = makeGlyphs(line) + mapping[line[0]] = line[1] + return otl.buildSingleSubstSubtable(mapping) + + +def parseMultiple(lines, font, _lookupMap=None): + mapping = {} + for line in lines: + line = makeGlyphs(line) + mapping[line[0]] = line[1:] + return otl.buildMultipleSubstSubtable(mapping) + + +def parseAlternate(lines, font, _lookupMap=None): + mapping = {} + for line in lines: + line = makeGlyphs(line) + mapping[line[0]] = line[1:] + return otl.buildAlternateSubstSubtable(mapping) + + +def parseLigature(lines, font, _lookupMap=None): + mapping = {} + for line in lines: + assert len(line) >= 2, line + line = makeGlyphs(line) + mapping[tuple(line[1:])] = line[0] + return otl.buildLigatureSubstSubtable(mapping) + + +def parseSinglePos(lines, font, _lookupMap=None): + values = {} + for line in lines: + assert len(line) == 3, line + w = line[0].title().replace(" ", "") + assert w in valueRecordFormatDict + g = makeGlyph(line[1]) + v = int(line[2]) + if g not in values: + values[g] = ValueRecord() + assert not hasattr(values[g], w), (g, w) + setattr(values[g], w, v) + return otl.buildSinglePosSubtable(values, font.getReverseGlyphMap()) + + +def parsePair(lines, font, _lookupMap=None): + self = ot.PairPos() + self.ValueFormat1 = self.ValueFormat2 = 0 + typ = lines.peeks()[0].split()[0].lower() + if typ in ("left", "right"): + self.Format = 1 + values = {} + for line in lines: + assert len(line) == 4, line + side = line[0].split()[0].lower() + assert side in ("left", "right"), side + what = line[0][len(side) :].title().replace(" ", "") + mask = valueRecordFormatDict[what][0] + glyph1, glyph2 = makeGlyphs(line[1:3]) + value = int(line[3]) + if not glyph1 in values: + values[glyph1] = {} + if not glyph2 in values[glyph1]: + values[glyph1][glyph2] = (ValueRecord(), ValueRecord()) + rec2 = values[glyph1][glyph2] + if side == "left": + self.ValueFormat1 |= mask + vr = rec2[0] + else: + self.ValueFormat2 |= mask + vr = rec2[1] + assert not hasattr(vr, what), (vr, what) + setattr(vr, what, value) + self.Coverage = makeCoverage(set(values.keys()), font) + self.PairSet = [] + for glyph1 in self.Coverage.glyphs: + values1 = values[glyph1] + pairset = ot.PairSet() + records = pairset.PairValueRecord = [] + for glyph2 in sorted(values1.keys(), key=font.getGlyphID): + values2 = values1[glyph2] + pair = ot.PairValueRecord() + pair.SecondGlyph = glyph2 + pair.Value1 = values2[0] + pair.Value2 = values2[1] if self.ValueFormat2 else None + records.append(pair) + pairset.PairValueCount = len(pairset.PairValueRecord) + self.PairSet.append(pairset) + self.PairSetCount = len(self.PairSet) + elif typ.endswith("class"): + self.Format = 2 + classDefs = [None, None] + while lines.peeks()[0].endswith("class definition begin"): + typ = lines.peek()[0][: -len("class definition begin")].lower() + idx, klass = { + "first": (0, ot.ClassDef1), + "second": (1, ot.ClassDef2), + }[typ] + assert classDefs[idx] is None + classDefs[idx] = parseClassDef(lines, font, klass=klass) + self.ClassDef1, self.ClassDef2 = classDefs + self.Class1Count, self.Class2Count = ( + 1 + max(c.classDefs.values()) for c in classDefs + ) + self.Class1Record = [ot.Class1Record() for i in range(self.Class1Count)] + for rec1 in self.Class1Record: + rec1.Class2Record = [ot.Class2Record() for j in range(self.Class2Count)] + for rec2 in rec1.Class2Record: + rec2.Value1 = ValueRecord() + rec2.Value2 = ValueRecord() + for line in lines: + assert len(line) == 4, line + side = line[0].split()[0].lower() + assert side in ("left", "right"), side + what = line[0][len(side) :].title().replace(" ", "") + mask = valueRecordFormatDict[what][0] + class1, class2, value = (int(x) for x in line[1:4]) + rec2 = self.Class1Record[class1].Class2Record[class2] + if side == "left": + self.ValueFormat1 |= mask + vr = rec2.Value1 + else: + self.ValueFormat2 |= mask + vr = rec2.Value2 + assert not hasattr(vr, what), (vr, what) + setattr(vr, what, value) + for rec1 in self.Class1Record: + for rec2 in rec1.Class2Record: + rec2.Value1 = ValueRecord(self.ValueFormat1, rec2.Value1) + rec2.Value2 = ( + ValueRecord(self.ValueFormat2, rec2.Value2) + if self.ValueFormat2 + else None + ) + + self.Coverage = makeCoverage(set(self.ClassDef1.classDefs.keys()), font) + else: + assert 0, typ + return self + + +def parseKernset(lines, font, _lookupMap=None): + typ = lines.peeks()[0].split()[0].lower() + if typ in ("left", "right"): + with lines.until( + ("firstclass definition begin", "secondclass definition begin") + ): + return parsePair(lines, font) + return parsePair(lines, font) + + +def makeAnchor(data, klass=ot.Anchor): + assert len(data) <= 2 + anchor = klass() + anchor.Format = 1 + anchor.XCoordinate, anchor.YCoordinate = intSplitComma(data[0]) + if len(data) > 1 and data[1] != "": + anchor.Format = 2 + anchor.AnchorPoint = int(data[1]) + return anchor + + +def parseCursive(lines, font, _lookupMap=None): + records = {} + for line in lines: + assert len(line) in [3, 4], line + idx, klass = { + "entry": (0, ot.EntryAnchor), + "exit": (1, ot.ExitAnchor), + }[line[0]] + glyph = makeGlyph(line[1]) + if glyph not in records: + records[glyph] = [None, None] + assert records[glyph][idx] is None, (glyph, idx) + records[glyph][idx] = makeAnchor(line[2:], klass) + return otl.buildCursivePosSubtable(records, font.getReverseGlyphMap()) + + +def makeMarkRecords(data, coverage, c): + records = [] + for glyph in coverage.glyphs: + klass, anchor = data[glyph] + record = c.MarkRecordClass() + record.Class = klass + setattr(record, c.MarkAnchor, anchor) + records.append(record) + return records + + +def makeBaseRecords(data, coverage, c, classCount): + records = [] + idx = {} + for glyph in coverage.glyphs: + idx[glyph] = len(records) + record = c.BaseRecordClass() + anchors = [None] * classCount + setattr(record, c.BaseAnchor, anchors) + records.append(record) + for (glyph, klass), anchor in data.items(): + record = records[idx[glyph]] + anchors = getattr(record, c.BaseAnchor) + assert anchors[klass] is None, (glyph, klass) + anchors[klass] = anchor + return records + + +def makeLigatureRecords(data, coverage, c, classCount): + records = [None] * len(coverage.glyphs) + idx = {g: i for i, g in enumerate(coverage.glyphs)} + + for (glyph, klass, compIdx, compCount), anchor in data.items(): + record = records[idx[glyph]] + if record is None: + record = records[idx[glyph]] = ot.LigatureAttach() + record.ComponentCount = compCount + record.ComponentRecord = [ot.ComponentRecord() for i in range(compCount)] + for compRec in record.ComponentRecord: + compRec.LigatureAnchor = [None] * classCount + assert record.ComponentCount == compCount, ( + glyph, + record.ComponentCount, + compCount, + ) + + anchors = record.ComponentRecord[compIdx - 1].LigatureAnchor + assert anchors[klass] is None, (glyph, compIdx, klass) + anchors[klass] = anchor + return records + + +def parseMarkToSomething(lines, font, c): + self = c.Type() + self.Format = 1 + markData = {} + baseData = {} + Data = { + "mark": (markData, c.MarkAnchorClass), + "base": (baseData, c.BaseAnchorClass), + "ligature": (baseData, c.BaseAnchorClass), + } + maxKlass = 0 + for line in lines: + typ = line[0] + assert typ in ("mark", "base", "ligature") + glyph = makeGlyph(line[1]) + data, anchorClass = Data[typ] + extraItems = 2 if typ == "ligature" else 0 + extras = tuple(int(i) for i in line[2 : 2 + extraItems]) + klass = int(line[2 + extraItems]) + anchor = makeAnchor(line[3 + extraItems :], anchorClass) + if typ == "mark": + key, value = glyph, (klass, anchor) + else: + key, value = ((glyph, klass) + extras), anchor + assert key not in data, key + data[key] = value + maxKlass = max(maxKlass, klass) + + # Mark + markCoverage = makeCoverage(set(markData.keys()), font, c.MarkCoverageClass) + markArray = c.MarkArrayClass() + markRecords = makeMarkRecords(markData, markCoverage, c) + setattr(markArray, c.MarkRecord, markRecords) + setattr(markArray, c.MarkCount, len(markRecords)) + setattr(self, c.MarkCoverage, markCoverage) + setattr(self, c.MarkArray, markArray) + self.ClassCount = maxKlass + 1 + + # Base + self.classCount = 0 if not baseData else 1 + max(k[1] for k, v in baseData.items()) + baseCoverage = makeCoverage( + set([k[0] for k in baseData.keys()]), font, c.BaseCoverageClass + ) + baseArray = c.BaseArrayClass() + if c.Base == "Ligature": + baseRecords = makeLigatureRecords(baseData, baseCoverage, c, self.classCount) + else: + baseRecords = makeBaseRecords(baseData, baseCoverage, c, self.classCount) + setattr(baseArray, c.BaseRecord, baseRecords) + setattr(baseArray, c.BaseCount, len(baseRecords)) + setattr(self, c.BaseCoverage, baseCoverage) + setattr(self, c.BaseArray, baseArray) + + return self + + +class MarkHelper(object): + def __init__(self): + for Which in ("Mark", "Base"): + for What in ("Coverage", "Array", "Count", "Record", "Anchor"): + key = Which + What + if Which == "Mark" and What in ("Count", "Record", "Anchor"): + value = key + else: + value = getattr(self, Which) + What + if value == "LigatureRecord": + value = "LigatureAttach" + setattr(self, key, value) + if What != "Count": + klass = getattr(ot, value) + setattr(self, key + "Class", klass) + + +class MarkToBaseHelper(MarkHelper): + Mark = "Mark" + Base = "Base" + Type = ot.MarkBasePos + + +class MarkToMarkHelper(MarkHelper): + Mark = "Mark1" + Base = "Mark2" + Type = ot.MarkMarkPos + + +class MarkToLigatureHelper(MarkHelper): + Mark = "Mark" + Base = "Ligature" + Type = ot.MarkLigPos + + +def parseMarkToBase(lines, font, _lookupMap=None): + return parseMarkToSomething(lines, font, MarkToBaseHelper()) + + +def parseMarkToMark(lines, font, _lookupMap=None): + return parseMarkToSomething(lines, font, MarkToMarkHelper()) + + +def parseMarkToLigature(lines, font, _lookupMap=None): + return parseMarkToSomething(lines, font, MarkToLigatureHelper()) + + +def stripSplitComma(line): + return [s.strip() for s in line.split(",")] if line else [] + + +def intSplitComma(line): + return [int(i) for i in line.split(",")] if line else [] + + +# Copied from fontTools.subset +class ContextHelper(object): + def __init__(self, klassName, Format): + if klassName.endswith("Subst"): + Typ = "Sub" + Type = "Subst" + else: + Typ = "Pos" + Type = "Pos" + if klassName.startswith("Chain"): + Chain = "Chain" + InputIdx = 1 + DataLen = 3 + else: + Chain = "" + InputIdx = 0 + DataLen = 1 + ChainTyp = Chain + Typ + + self.Typ = Typ + self.Type = Type + self.Chain = Chain + self.ChainTyp = ChainTyp + self.InputIdx = InputIdx + self.DataLen = DataLen + + self.LookupRecord = Type + "LookupRecord" + + if Format == 1: + Coverage = lambda r: r.Coverage + ChainCoverage = lambda r: r.Coverage + ContextData = lambda r: (None,) + ChainContextData = lambda r: (None, None, None) + SetContextData = None + SetChainContextData = None + RuleData = lambda r: (r.Input,) + ChainRuleData = lambda r: (r.Backtrack, r.Input, r.LookAhead) + + def SetRuleData(r, d): + (r.Input,) = d + (r.GlyphCount,) = (len(x) + 1 for x in d) + + def ChainSetRuleData(r, d): + r.Backtrack, r.Input, r.LookAhead = d + ( + r.BacktrackGlyphCount, + r.InputGlyphCount, + r.LookAheadGlyphCount, + ) = (len(d[0]), len(d[1]) + 1, len(d[2])) + + elif Format == 2: + Coverage = lambda r: r.Coverage + ChainCoverage = lambda r: r.Coverage + ContextData = lambda r: (r.ClassDef,) + ChainContextData = lambda r: ( + r.BacktrackClassDef, + r.InputClassDef, + r.LookAheadClassDef, + ) + + def SetContextData(r, d): + (r.ClassDef,) = d + + def SetChainContextData(r, d): + r.BacktrackClassDef, r.InputClassDef, r.LookAheadClassDef = d + + RuleData = lambda r: (r.Class,) + ChainRuleData = lambda r: (r.Backtrack, r.Input, r.LookAhead) + + def SetRuleData(r, d): + (r.Class,) = d + (r.GlyphCount,) = (len(x) + 1 for x in d) + + def ChainSetRuleData(r, d): + r.Backtrack, r.Input, r.LookAhead = d + ( + r.BacktrackGlyphCount, + r.InputGlyphCount, + r.LookAheadGlyphCount, + ) = (len(d[0]), len(d[1]) + 1, len(d[2])) + + elif Format == 3: + Coverage = lambda r: r.Coverage[0] + ChainCoverage = lambda r: r.InputCoverage[0] + ContextData = None + ChainContextData = None + SetContextData = None + SetChainContextData = None + RuleData = lambda r: r.Coverage + ChainRuleData = lambda r: ( + r.BacktrackCoverage + r.InputCoverage + r.LookAheadCoverage + ) + + def SetRuleData(r, d): + (r.Coverage,) = d + (r.GlyphCount,) = (len(x) for x in d) + + def ChainSetRuleData(r, d): + r.BacktrackCoverage, r.InputCoverage, r.LookAheadCoverage = d + ( + r.BacktrackGlyphCount, + r.InputGlyphCount, + r.LookAheadGlyphCount, + ) = (len(x) for x in d) + + else: + assert 0, "unknown format: %s" % Format + + if Chain: + self.Coverage = ChainCoverage + self.ContextData = ChainContextData + self.SetContextData = SetChainContextData + self.RuleData = ChainRuleData + self.SetRuleData = ChainSetRuleData + else: + self.Coverage = Coverage + self.ContextData = ContextData + self.SetContextData = SetContextData + self.RuleData = RuleData + self.SetRuleData = SetRuleData + + if Format == 1: + self.Rule = ChainTyp + "Rule" + self.RuleCount = ChainTyp + "RuleCount" + self.RuleSet = ChainTyp + "RuleSet" + self.RuleSetCount = ChainTyp + "RuleSetCount" + self.Intersect = lambda glyphs, c, r: [r] if r in glyphs else [] + elif Format == 2: + self.Rule = ChainTyp + "ClassRule" + self.RuleCount = ChainTyp + "ClassRuleCount" + self.RuleSet = ChainTyp + "ClassSet" + self.RuleSetCount = ChainTyp + "ClassSetCount" + self.Intersect = lambda glyphs, c, r: ( + c.intersect_class(glyphs, r) + if c + else (set(glyphs) if r == 0 else set()) + ) + + self.ClassDef = "InputClassDef" if Chain else "ClassDef" + self.ClassDefIndex = 1 if Chain else 0 + self.Input = "Input" if Chain else "Class" + + +def parseLookupRecords(items, klassName, lookupMap=None): + klass = getattr(ot, klassName) + lst = [] + for item in items: + rec = klass() + item = stripSplitComma(item) + assert len(item) == 2, item + idx = int(item[0]) + assert idx > 0, idx + rec.SequenceIndex = idx - 1 + setReference(mapLookup, lookupMap, item[1], setattr, rec, "LookupListIndex") + lst.append(rec) + return lst + + +def makeClassDef(classDefs, font, klass=ot.Coverage): + if not classDefs: + return None + self = klass() + self.classDefs = dict(classDefs) + return self + + +def parseClassDef(lines, font, klass=ot.ClassDef): + classDefs = {} + with lines.between("class definition"): + for line in lines: + glyph = makeGlyph(line[0]) + assert glyph not in classDefs, glyph + classDefs[glyph] = int(line[1]) + return makeClassDef(classDefs, font, klass) + + +def makeCoverage(glyphs, font, klass=ot.Coverage): + if not glyphs: + return None + if isinstance(glyphs, set): + glyphs = sorted(glyphs) + coverage = klass() + coverage.glyphs = sorted(set(glyphs), key=font.getGlyphID) + return coverage + + +def parseCoverage(lines, font, klass=ot.Coverage): + glyphs = [] + with lines.between("coverage definition"): + for line in lines: + glyphs.append(makeGlyph(line[0])) + return makeCoverage(glyphs, font, klass) + + +def bucketizeRules(self, c, rules, bucketKeys): + buckets = {} + for seq, recs in rules: + buckets.setdefault(seq[c.InputIdx][0], []).append( + (tuple(s[1 if i == c.InputIdx else 0 :] for i, s in enumerate(seq)), recs) + ) + + rulesets = [] + for firstGlyph in bucketKeys: + if firstGlyph not in buckets: + rulesets.append(None) + continue + thisRules = [] + for seq, recs in buckets[firstGlyph]: + rule = getattr(ot, c.Rule)() + c.SetRuleData(rule, seq) + setattr(rule, c.Type + "Count", len(recs)) + setattr(rule, c.LookupRecord, recs) + thisRules.append(rule) + + ruleset = getattr(ot, c.RuleSet)() + setattr(ruleset, c.Rule, thisRules) + setattr(ruleset, c.RuleCount, len(thisRules)) + rulesets.append(ruleset) + + setattr(self, c.RuleSet, rulesets) + setattr(self, c.RuleSetCount, len(rulesets)) + + +def parseContext(lines, font, Type, lookupMap=None): + self = getattr(ot, Type)() + typ = lines.peeks()[0].split()[0].lower() + if typ == "glyph": + self.Format = 1 + log.debug("Parsing %s format %s", Type, self.Format) + c = ContextHelper(Type, self.Format) + rules = [] + for line in lines: + assert line[0].lower() == "glyph", line[0] + while len(line) < 1 + c.DataLen: + line.append("") + seq = tuple(makeGlyphs(stripSplitComma(i)) for i in line[1 : 1 + c.DataLen]) + recs = parseLookupRecords(line[1 + c.DataLen :], c.LookupRecord, lookupMap) + rules.append((seq, recs)) + + firstGlyphs = set(seq[c.InputIdx][0] for seq, recs in rules) + self.Coverage = makeCoverage(firstGlyphs, font) + bucketizeRules(self, c, rules, self.Coverage.glyphs) + elif typ.endswith("class"): + self.Format = 2 + log.debug("Parsing %s format %s", Type, self.Format) + c = ContextHelper(Type, self.Format) + classDefs = [None] * c.DataLen + while lines.peeks()[0].endswith("class definition begin"): + typ = lines.peek()[0][: -len("class definition begin")].lower() + idx, klass = { + 1: { + "": (0, ot.ClassDef), + }, + 3: { + "backtrack": (0, ot.BacktrackClassDef), + "": (1, ot.InputClassDef), + "lookahead": (2, ot.LookAheadClassDef), + }, + }[c.DataLen][typ] + assert classDefs[idx] is None, idx + classDefs[idx] = parseClassDef(lines, font, klass=klass) + c.SetContextData(self, classDefs) + rules = [] + for line in lines: + assert line[0].lower().startswith("class"), line[0] + while len(line) < 1 + c.DataLen: + line.append("") + seq = tuple(intSplitComma(i) for i in line[1 : 1 + c.DataLen]) + recs = parseLookupRecords(line[1 + c.DataLen :], c.LookupRecord, lookupMap) + rules.append((seq, recs)) + firstClasses = set(seq[c.InputIdx][0] for seq, recs in rules) + firstGlyphs = set( + g for g, c in classDefs[c.InputIdx].classDefs.items() if c in firstClasses + ) + self.Coverage = makeCoverage(firstGlyphs, font) + bucketizeRules(self, c, rules, range(max(firstClasses) + 1)) + elif typ.endswith("coverage"): + self.Format = 3 + log.debug("Parsing %s format %s", Type, self.Format) + c = ContextHelper(Type, self.Format) + coverages = tuple([] for i in range(c.DataLen)) + while lines.peeks()[0].endswith("coverage definition begin"): + typ = lines.peek()[0][: -len("coverage definition begin")].lower() + idx, klass = { + 1: { + "": (0, ot.Coverage), + }, + 3: { + "backtrack": (0, ot.BacktrackCoverage), + "input": (1, ot.InputCoverage), + "lookahead": (2, ot.LookAheadCoverage), + }, + }[c.DataLen][typ] + coverages[idx].append(parseCoverage(lines, font, klass=klass)) + c.SetRuleData(self, coverages) + lines = list(lines) + assert len(lines) == 1 + line = lines[0] + assert line[0].lower() == "coverage", line[0] + recs = parseLookupRecords(line[1:], c.LookupRecord, lookupMap) + setattr(self, c.Type + "Count", len(recs)) + setattr(self, c.LookupRecord, recs) + else: + assert 0, typ + return self + + +def parseContextSubst(lines, font, lookupMap=None): + return parseContext(lines, font, "ContextSubst", lookupMap=lookupMap) + + +def parseContextPos(lines, font, lookupMap=None): + return parseContext(lines, font, "ContextPos", lookupMap=lookupMap) + + +def parseChainedSubst(lines, font, lookupMap=None): + return parseContext(lines, font, "ChainContextSubst", lookupMap=lookupMap) + + +def parseChainedPos(lines, font, lookupMap=None): + return parseContext(lines, font, "ChainContextPos", lookupMap=lookupMap) + + +def parseReverseChainedSubst(lines, font, _lookupMap=None): + self = ot.ReverseChainSingleSubst() + self.Format = 1 + coverages = ([], []) + while lines.peeks()[0].endswith("coverage definition begin"): + typ = lines.peek()[0][: -len("coverage definition begin")].lower() + idx, klass = { + "backtrack": (0, ot.BacktrackCoverage), + "lookahead": (1, ot.LookAheadCoverage), + }[typ] + coverages[idx].append(parseCoverage(lines, font, klass=klass)) + self.BacktrackCoverage = coverages[0] + self.BacktrackGlyphCount = len(self.BacktrackCoverage) + self.LookAheadCoverage = coverages[1] + self.LookAheadGlyphCount = len(self.LookAheadCoverage) + mapping = {} + for line in lines: + assert len(line) == 2, line + line = makeGlyphs(line) + mapping[line[0]] = line[1] + self.Coverage = makeCoverage(set(mapping.keys()), font) + self.Substitute = [mapping[k] for k in self.Coverage.glyphs] + self.GlyphCount = len(self.Substitute) + return self + + +def parseLookup(lines, tableTag, font, lookupMap=None): + line = lines.expect("lookup") + _, name, typ = line + log.debug("Parsing lookup type %s %s", typ, name) + lookup = ot.Lookup() + lookup.LookupFlag, filterset = parseLookupFlags(lines) + if filterset is not None: + lookup.MarkFilteringSet = filterset + lookup.LookupType, parseLookupSubTable = { + "GSUB": { + "single": (1, parseSingleSubst), + "multiple": (2, parseMultiple), + "alternate": (3, parseAlternate), + "ligature": (4, parseLigature), + "context": (5, parseContextSubst), + "chained": (6, parseChainedSubst), + "reversechained": (8, parseReverseChainedSubst), + }, + "GPOS": { + "single": (1, parseSinglePos), + "pair": (2, parsePair), + "kernset": (2, parseKernset), + "cursive": (3, parseCursive), + "mark to base": (4, parseMarkToBase), + "mark to ligature": (5, parseMarkToLigature), + "mark to mark": (6, parseMarkToMark), + "context": (7, parseContextPos), + "chained": (8, parseChainedPos), + }, + }[tableTag][typ] + + with lines.until("lookup end"): + subtables = [] + + while lines.peek(): + with lines.until(("% subtable", "subtable end")): + while lines.peek(): + subtable = parseLookupSubTable(lines, font, lookupMap) + assert lookup.LookupType == subtable.LookupType + subtables.append(subtable) + if lines.peeks()[0] in ("% subtable", "subtable end"): + next(lines) + lines.expect("lookup end") + + lookup.SubTable = subtables + lookup.SubTableCount = len(lookup.SubTable) + if lookup.SubTableCount == 0: + # Remove this return when following is fixed: + # https://github.com/fonttools/fonttools/issues/789 + return None + return lookup + + +def parseGSUBGPOS(lines, font, tableTag): + container = ttLib.getTableClass(tableTag)() + lookupMap = DeferredMapping() + featureMap = DeferredMapping() + assert tableTag in ("GSUB", "GPOS") + log.debug("Parsing %s", tableTag) + self = getattr(ot, tableTag)() + self.Version = 0x00010000 + fields = { + "script table begin": ( + "ScriptList", + lambda lines: parseScriptList(lines, featureMap), + ), + "feature table begin": ( + "FeatureList", + lambda lines: parseFeatureList(lines, lookupMap, featureMap), + ), + "lookup": ("LookupList", None), + } + for attr, parser in fields.values(): + setattr(self, attr, None) + while lines.peek() is not None: + typ = lines.peek()[0].lower() + if typ not in fields: + log.debug("Skipping %s", lines.peek()) + next(lines) + continue + attr, parser = fields[typ] + if typ == "lookup": + if self.LookupList is None: + self.LookupList = ot.LookupList() + self.LookupList.Lookup = [] + _, name, _ = lines.peek() + lookup = parseLookup(lines, tableTag, font, lookupMap) + if lookupMap is not None: + assert name not in lookupMap, "Duplicate lookup name: %s" % name + lookupMap[name] = len(self.LookupList.Lookup) + else: + assert int(name) == len(self.LookupList.Lookup), "%d %d" % ( + name, + len(self.Lookup), + ) + self.LookupList.Lookup.append(lookup) + else: + assert getattr(self, attr) is None, attr + setattr(self, attr, parser(lines)) + if self.LookupList: + self.LookupList.LookupCount = len(self.LookupList.Lookup) + if lookupMap is not None: + lookupMap.applyDeferredMappings() + if os.environ.get(LOOKUP_DEBUG_ENV_VAR): + if "Debg" not in font: + font["Debg"] = newTable("Debg") + font["Debg"].data = {} + debug = ( + font["Debg"] + .data.setdefault(LOOKUP_DEBUG_INFO_KEY, {}) + .setdefault(tableTag, {}) + ) + for name, lookup in lookupMap.items(): + debug[str(lookup)] = ["", name, ""] + + featureMap.applyDeferredMappings() + container.table = self + return container + + +def parseGSUB(lines, font): + return parseGSUBGPOS(lines, font, "GSUB") + + +def parseGPOS(lines, font): + return parseGSUBGPOS(lines, font, "GPOS") + + +def parseAttachList(lines, font): + points = {} + with lines.between("attachment list"): + for line in lines: + glyph = makeGlyph(line[0]) + assert glyph not in points, glyph + points[glyph] = [int(i) for i in line[1:]] + return otl.buildAttachList(points, font.getReverseGlyphMap()) + + +def parseCaretList(lines, font): + carets = {} + with lines.between("carets"): + for line in lines: + glyph = makeGlyph(line[0]) + assert glyph not in carets, glyph + num = int(line[1]) + thisCarets = [int(i) for i in line[2:]] + assert num == len(thisCarets), line + carets[glyph] = thisCarets + return otl.buildLigCaretList(carets, {}, font.getReverseGlyphMap()) + + +def makeMarkFilteringSets(sets, font): + self = ot.MarkGlyphSetsDef() + self.MarkSetTableFormat = 1 + self.MarkSetCount = 1 + max(sets.keys()) + self.Coverage = [None] * self.MarkSetCount + for k, v in sorted(sets.items()): + self.Coverage[k] = makeCoverage(set(v), font) + return self + + +def parseMarkFilteringSets(lines, font): + sets = {} + with lines.between("set definition"): + for line in lines: + assert len(line) == 2, line + glyph = makeGlyph(line[0]) + # TODO accept set names + st = int(line[1]) + if st not in sets: + sets[st] = [] + sets[st].append(glyph) + return makeMarkFilteringSets(sets, font) + + +def parseGDEF(lines, font): + container = ttLib.getTableClass("GDEF")() + log.debug("Parsing GDEF") + self = ot.GDEF() + fields = { + "class definition begin": ( + "GlyphClassDef", + lambda lines, font: parseClassDef(lines, font, klass=ot.GlyphClassDef), + ), + "attachment list begin": ("AttachList", parseAttachList), + "carets begin": ("LigCaretList", parseCaretList), + "mark attachment class definition begin": ( + "MarkAttachClassDef", + lambda lines, font: parseClassDef(lines, font, klass=ot.MarkAttachClassDef), + ), + "markfilter set definition begin": ("MarkGlyphSetsDef", parseMarkFilteringSets), + } + for attr, parser in fields.values(): + setattr(self, attr, None) + while lines.peek() is not None: + typ = lines.peek()[0].lower() + if typ not in fields: + log.debug("Skipping %s", typ) + next(lines) + continue + attr, parser = fields[typ] + assert getattr(self, attr) is None, attr + setattr(self, attr, parser(lines, font)) + self.Version = 0x00010000 if self.MarkGlyphSetsDef is None else 0x00010002 + container.table = self + return container + + +def parseCmap(lines, font): + container = ttLib.getTableClass("cmap")() + log.debug("Parsing cmap") + tables = [] + while lines.peek() is not None: + lines.expect("cmap subtable %d" % len(tables)) + platId, encId, fmt, lang = [ + parseCmapId(lines, field) + for field in ("platformID", "encodingID", "format", "language") + ] + table = cmap_classes[fmt](fmt) + table.platformID = platId + table.platEncID = encId + table.language = lang + table.cmap = {} + line = next(lines) + while line[0] != "end subtable": + table.cmap[int(line[0], 16)] = line[1] + line = next(lines) + tables.append(table) + container.tableVersion = 0 + container.tables = tables + return container + + +def parseCmapId(lines, field): + line = next(lines) + assert field == line[0] + return int(line[1]) + + +def parseTable(lines, font, tableTag=None): + log.debug("Parsing table") + line = lines.peeks() + tag = None + if line[0].split()[0] == "FontDame": + tag = line[0].split()[1] + elif " ".join(line[0].split()[:3]) == "Font Chef Table": + tag = line[0].split()[3] + if tag is not None: + next(lines) + tag = tag.ljust(4) + if tableTag is None: + tableTag = tag + else: + assert tableTag == tag, (tableTag, tag) + + assert ( + tableTag is not None + ), "Don't know what table to parse and data doesn't specify" + + return { + "GSUB": parseGSUB, + "GPOS": parseGPOS, + "GDEF": parseGDEF, + "cmap": parseCmap, + }[tableTag](lines, font) + + +class Tokenizer(object): + def __init__(self, f): + # TODO BytesIO / StringIO as needed? also, figure out whether we work on bytes or unicode + lines = iter(f) + try: + self.filename = f.name + except: + self.filename = None + self.lines = iter(lines) + self.line = "" + self.lineno = 0 + self.stoppers = [] + self.buffer = None + + def __iter__(self): + return self + + def _next_line(self): + self.lineno += 1 + line = self.line = next(self.lines) + line = [s.strip() for s in line.split("\t")] + if len(line) == 1 and not line[0]: + del line[0] + if line and not line[-1]: + log.warning("trailing tab found on line %d: %s" % (self.lineno, self.line)) + while line and not line[-1]: + del line[-1] + return line + + def _next_nonempty(self): + while True: + line = self._next_line() + # Skip comments and empty lines + if line and line[0] and (line[0][0] != "%" or line[0] == "% subtable"): + return line + + def _next_buffered(self): + if self.buffer: + ret = self.buffer + self.buffer = None + return ret + else: + return self._next_nonempty() + + def __next__(self): + line = self._next_buffered() + if line[0].lower() in self.stoppers: + self.buffer = line + raise StopIteration + return line + + def next(self): + return self.__next__() + + def peek(self): + if not self.buffer: + try: + self.buffer = self._next_nonempty() + except StopIteration: + return None + if self.buffer[0].lower() in self.stoppers: + return None + return self.buffer + + def peeks(self): + ret = self.peek() + return ret if ret is not None else ("",) + + @contextmanager + def between(self, tag): + start = tag + " begin" + end = tag + " end" + self.expectendswith(start) + self.stoppers.append(end) + yield + del self.stoppers[-1] + self.expect(tag + " end") + + @contextmanager + def until(self, tags): + if type(tags) is not tuple: + tags = (tags,) + self.stoppers.extend(tags) + yield + del self.stoppers[-len(tags) :] + + def expect(self, s): + line = next(self) + tag = line[0].lower() + assert tag == s, "Expected '%s', got '%s'" % (s, tag) + return line + + def expectendswith(self, s): + line = next(self) + tag = line[0].lower() + assert tag.endswith(s), "Expected '*%s', got '%s'" % (s, tag) + return line + + +def build(f, font, tableTag=None): + """Convert a Monotype font layout file to an OpenType layout object + + A font object must be passed, but this may be a "dummy" font; it is only + used for sorting glyph sets when making coverage tables and to hold the + OpenType layout table while it is being built. + + Args: + f: A file object. + font (TTFont): A font object. + tableTag (string): If provided, asserts that the file contains data for the + given OpenType table. + + Returns: + An object representing the table. (e.g. ``table_G_S_U_B_``) + """ + lines = Tokenizer(f) + return parseTable(lines, font, tableTag=tableTag) + + +def main(args=None, font=None): + """Convert a FontDame OTL file to TTX XML + + Writes XML output to stdout. + + Args: + args: Command line arguments (``--font``, ``--table``, input files). + """ + import sys + from fontTools import configLogger + from fontTools.misc.testTools import MockFont + + if args is None: + args = sys.argv[1:] + + # configure the library logger (for >= WARNING) + configLogger() + # comment this out to enable debug messages from mtiLib's logger + # log.setLevel(logging.DEBUG) + + import argparse + + parser = argparse.ArgumentParser( + "fonttools mtiLib", + description=main.__doc__, + ) + + parser.add_argument( + "--font", + "-f", + metavar="FILE", + dest="font", + help="Input TTF files (used for glyph classes and sorting coverage tables)", + ) + parser.add_argument( + "--table", + "-t", + metavar="TABLE", + dest="tableTag", + help="Table to fill (sniffed from input file if not provided)", + ) + parser.add_argument( + "inputs", metavar="FILE", type=str, nargs="+", help="Input FontDame .txt files" + ) + + args = parser.parse_args(args) + + if font is None: + if args.font: + font = ttLib.TTFont(args.font) + else: + font = MockFont() + + for f in args.inputs: + log.debug("Processing %s", f) + with open(f, "rt", encoding="utf-8-sig") as f: + table = build(f, font, tableTag=args.tableTag) + blob = table.compile(font) # Make sure it compiles + decompiled = table.__class__() + decompiled.decompile(blob, font) # Make sure it decompiles! + + # continue + from fontTools.misc import xmlWriter + + tag = table.tableTag + writer = xmlWriter.XMLWriter(sys.stdout) + writer.begintag(tag) + writer.newline() + # table.toXML(writer, font) + decompiled.toXML(writer, font) + writer.endtag(tag) + writer.newline() + + +if __name__ == "__main__": + import sys + + sys.exit(main()) diff --git a/shared/package-files/31/31e7e018f6c9649bce8616fcd3284843c23c853b4b56c4b152cf561c29c5fd1b/blob b/shared/package-files/31/31e7e018f6c9649bce8616fcd3284843c23c853b4b56c4b152cf561c29c5fd1b/blob new file mode 100644 index 0000000000000000000000000000000000000000..7bc88ec3c5fe8ab23b1606ff502ecc36fa9d76b6 Binary files /dev/null and b/shared/package-files/31/31e7e018f6c9649bce8616fcd3284843c23c853b4b56c4b152cf561c29c5fd1b/blob differ diff --git a/shared/package-files/31/31e99ec2d7580af332a37c64d2d373457f17f593627bf7c41368a96afde2e74f/blob b/shared/package-files/31/31e99ec2d7580af332a37c64d2d373457f17f593627bf7c41368a96afde2e74f/blob new file mode 100644 index 0000000000000000000000000000000000000000..b06737aec8491c7d6bf620bb25bb0a0e2309481b Binary files /dev/null and b/shared/package-files/31/31e99ec2d7580af332a37c64d2d373457f17f593627bf7c41368a96afde2e74f/blob differ diff --git a/shared/package-files/31/31ea913829659f4a9cf5bcbe83458d7c0c765a518c6d9b6808e5a2b10da79019/blob b/shared/package-files/31/31ea913829659f4a9cf5bcbe83458d7c0c765a518c6d9b6808e5a2b10da79019/blob new file mode 100644 index 0000000000000000000000000000000000000000..b9b49bac33eb99dcbdb0d97cd7426df1e96c6ad2 --- /dev/null +++ b/shared/package-files/31/31ea913829659f4a9cf5bcbe83458d7c0c765a518c6d9b6808e5a2b10da79019/blob @@ -0,0 +1,335 @@ +""" +Implements Lilliefors corrected Kolmogorov-Smirnov tests for normal and +exponential distributions. + +`kstest_fit` is provided as a top-level function to access both tests. +`kstest_normal` and `kstest_exponential` are provided as convenience functions +with the appropriate test as the default. +`lilliefors` is provided as an alias for `kstest_fit`. + +Created on Sat Oct 01 13:16:49 2011 + +Author: Josef Perktold +License: BSD-3 + +pvalues for Lilliefors test are based on formula and table in + +An Analytic Approximation to the Distribution of Lilliefors's Test Statistic +for Normality +Author(s): Gerard E. Dallal and Leland Wilkinson +Source: The American Statistician, Vol. 40, No. 4 (Nov., 1986), pp. 294-296 +Published by: American Statistical Association +Stable URL: http://www.jstor.org/stable/2684607. + +On the Kolmogorov-Smirnov Test for Normality with Mean and Variance Unknown +Hubert W. Lilliefors +Journal of the American Statistical Association, Vol. 62, No. 318. +(Jun., 1967), pp. 399-402. + +--- + +Updated 2017-07-23 +Jacob C. Kimmel + +Ref: +Lilliefors, H.W. +On the Kolmogorov-Smirnov test for the exponential distribution with mean +unknown. Journal of the American Statistical Association, Vol 64, No. 325. +(1969), pp. 387-389. +""" + +from functools import cache, partial + +import numpy as np +from scipy import stats + +from statsmodels.tools.validation import string_like + +from .tabledist import TableDist + + +def _make_asymptotic_function(params): + """ + Generate an asymptotic distribution callable from a param matrix + + Polynomial is a[0] * x**(-1/2) + a[1] * x**(-1) + a[2] * x**(-3/2) + + Parameters + ---------- + params : ndarray + Array with shape (nalpha, 3) where nalpha is the number of + significance levels. + + Returns + ------- + callable + Function of the sample size that evaluates the asymptotic + critical value approximation. + """ + + def f(n): + poly = np.array([1, np.log(n), np.log(n) ** 2]) + return np.exp(poly.dot(params.T)) + + return f + + +def ksstat(x, cdf, alternative="two-sided", args=()): + """ + Calculate statistic for the Kolmogorov-Smirnov test for goodness of fit + + This calculates the test statistic for a test of the distribution G(x) of + an observed variable against a given distribution F(x). Under the null + hypothesis the two distributions are identical, G(x)=F(x). The + alternative hypothesis can be either 'two-sided' (default), 'lower' + or 'upper'. The KS test is only valid for continuous distributions. + + Parameters + ---------- + x : array_like, 1d + Array of observations. + cdf : str or callable + String: name of a distribution in scipy.stats. + Callable: function to evaluate cdf. + alternative : {'two-sided', 'lower', 'upper'}, optional + Defines the alternative hypothesis (see explanation). Default is + 'two-sided'. + args : tuple, optional + Distribution parameters for call to cdf. + + Returns + ------- + D : float + KS test statistic, either D, D+ or D-. + + See Also + -------- + scipy.stats.kstest + + Notes + ----- + In the one-sided test, the alternative is that the empirical + cumulative distribution function of the random variable is "lower" + or "upper" than the cumulative distribution function F(x) of the + hypothesis, G(x)<=F(x), resp. G(x)>=F(x). + + In contrast to scipy.stats.kstest, this function only calculates the + statistic which can be used either as distance measure or to implement + case specific p-values. + """ + alternative = string_like( + alternative, + "alternative", + options=("two-sided", "lower", "upper"), + deprecated={"two_sided": "two-sided", "less": "lower", "greater": "upper"}, + removed_after="0.16", + ) + nobs = float(len(x)) + + if isinstance(cdf, str): + cdf = getattr(stats.distributions, cdf).cdf + elif hasattr(cdf, "cdf"): + cdf = cdf.cdf + + x = np.sort(x) + cdfvals = cdf(x, *args) + + d_plus = (np.arange(1.0, nobs + 1) / nobs - cdfvals).max() + d_min = (cdfvals - np.arange(0.0, nobs) / nobs).max() + if alternative == "upper": + return d_plus + elif alternative == "lower": + return d_min + + return np.max([d_plus, d_min]) + + +@cache +def get_lilliefors_table(dist="norm"): + """ + Generates tables for significance levels of Lilliefors test statistics + + Tables for available normal and exponential distribution testing, + as specified in Lilliefors references above + + Parameters + ---------- + dist : str, optional + Distribution being tested, one of {'norm', 'exp'}. + + Returns + ------- + lf : TableDist + Table of critical values. + """ + # function just to keep things together + # for this test alpha is sf probability, i.e., right tail probability + + # deferred import: this table is a large, generated module (~380 lines + # of literal arrays) that is only needed when a Lilliefors test is + # actually run, so import it lazily and cache the resulting TableDist + # (via lru_cache on this function) rather than paying the parsing cost + # at package import time. + from ._lilliefors_critical_values import ( + PERCENTILES, + asymp_critical_values, + critical_values, + ) + + alpha = 1 - np.array(PERCENTILES) / 100.0 + alpha = alpha[::-1] + dist = "normal" if dist == "norm" else dist + if dist not in critical_values: + raise ValueError("Invalid dist parameter. Must be 'norm' or 'exp'") + cv_data = critical_values[dist] + acv_data = asymp_critical_values[dist] + + size = np.array(sorted(cv_data), dtype=float) + crit_lf = np.array([cv_data[key] for key in sorted(cv_data)]) + crit_lf = crit_lf[:, ::-1] + + asym_params = np.array([acv_data[key] for key in sorted(acv_data)]) + asymp_fn = _make_asymptotic_function(asym_params[::-1]) + + lf = TableDist(alpha, size, crit_lf, asymptotic=asymp_fn) + return lf + + +def pval_lf(d_max, n): + """ + Approximate pvalues for Lilliefors test + + This is only valid for pvalues smaller than 0.1 which is not checked in + this function. + + Parameters + ---------- + d_max : array_like + two-sided Kolmogorov-Smirnov test statistic + n : int or float + sample size + + Returns + ------- + p-value : float or ndarray + pvalue according to approximation formula of Dallal and Wilkinson. + + Notes + ----- + This is mainly a helper function where the calling code should dispatch + on bound violations. Therefore it does not check whether the pvalue is in + the valid range. + + Precision for the pvalues is around 2 to 3 decimals. This approximation is + also used by other statistical packages (e.g., R:fBasics) but might not be + the most precise available. + + References + ---------- + DallalWilkinson1986 + """ + # todo: check boundaries, valid range for n and Dmax + if n > 100: + d_max *= (n / 100.0) ** 0.49 + n = 100 + pval = np.exp( + -7.01256 * d_max**2 * (n + 2.78019) + + 2.99587 * d_max * np.sqrt(n + 2.78019) + - 0.122119 + + 0.974598 / np.sqrt(n) + + 1.67997 / n + ) + return pval + + +def kstest_fit(x, dist="norm", pvalmethod="table"): + """ + Test assumed normal or exponential distribution using Lilliefors' test + + Lilliefors' test is a Kolmogorov-Smirnov test with estimated parameters. + + Parameters + ---------- + x : array_like, 1d + Data to test. + dist : {'norm', 'exp'}, optional + The assumed distribution. + pvalmethod : {'approx', 'table'}, optional + The method used to compute the p-value of the test statistic. In + general, 'table' is preferred and makes use of a very large simulation. + 'approx' is only valid for normality. If `dist = 'exp'`, `table` is + always used. 'approx' uses the approximation formula of Dalal and + Wilkinson, valid for pvalues < 0.1. If the pvalue is larger than 0.1, + then the result of `table` is returned. + + Returns + ------- + ksstat : float + Kolmogorov-Smirnov test statistic with estimated mean and variance. + pvalue : float + If the pvalue is lower than some threshold, e.g., 0.05, then we can + reject the Null hypothesis that the sample comes from a normal + distribution. + + Notes + ----- + 'table' uses an improved table based on 10,000,000 simulations. The + critical values are approximated using + log(cv_alpha) = b_alpha + c[0] log(n) + c[1] log(n)**2 + where cv_alpha is the critical value for a test with size alpha, + b_alpha is an alpha-specific intercept term and c[1] and c[2] are + coefficients that are shared across all alphas. + Values in the table are linearly interpolated. Values outside the + range are returned as bounds, 0.990 for large and 0.001 for small + pvalues. + + For implementation details, see lilliefors_critical_value_simulation.py in + the test directory. + """ + dist = string_like(dist, "dist", options=("norm", "exp")) + pvalmethod = string_like(pvalmethod, "pvalmethod", options=("approx", "table")) + x = np.asarray(x) + if x.ndim == 2 and x.shape[1] == 1: + x = x[:, 0] + elif x.ndim != 1: + raise ValueError( + "Invalid parameter `x`: must be a one-dimensional" + " array-like or a single-column DataFrame" + ) + + nobs = len(x) + + dist = string_like(dist, "dist", options=("norm", "exp"), lower=False) + if dist == "norm": + z = (x - x.mean()) / x.std(ddof=1) + test_d = stats.norm.cdf + else: # dist == "exp" + z = x / x.mean() + test_d = stats.expon.cdf + pvalmethod = "table" + # deferred/cached: only builds (and imports) the critical-value table + # for the distribution actually requested + lilliefors_table = get_lilliefors_table(dist=dist) + + min_nobs = 4 if dist == "norm" else 3 + if nobs < min_nobs: + raise ValueError( + f"Test for distribution {dist} requires at least {min_nobs} observations" + ) + + d_ks = ksstat(z, test_d, alternative="two-sided") + + if pvalmethod == "approx": + pval = pval_lf(d_ks, nobs) + # check pval is in desired range + if pval > 0.1: + pval = lilliefors_table.prob(d_ks, nobs) + else: # pvalmethod == 'table' + pval = lilliefors_table.prob(d_ks, nobs) + + return d_ks, pval + + +lilliefors = kstest_fit +kstest_normal = kstest_fit +kstest_exponential = partial(kstest_fit, dist="exp") diff --git a/shared/package-files/31/31eb31c6083704bc6178b671f9d49fdf46fa80aa4e81d557c3a5befae1d2b334/blob b/shared/package-files/31/31eb31c6083704bc6178b671f9d49fdf46fa80aa4e81d557c3a5befae1d2b334/blob new file mode 100644 index 0000000000000000000000000000000000000000..81342afa447746dbb8f060da2d454c0175f12e30 --- /dev/null +++ b/shared/package-files/31/31eb31c6083704bc6178b671f9d49fdf46fa80aa4e81d557c3a5befae1d2b334/blob @@ -0,0 +1,88 @@ +import os +import sys +from typing import Optional, Tuple + + +def glibc_version_string() -> Optional[str]: + "Returns glibc version string, or None if not using glibc." + return glibc_version_string_confstr() or glibc_version_string_ctypes() + + +def glibc_version_string_confstr() -> Optional[str]: + "Primary implementation of glibc_version_string using os.confstr." + # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely + # to be broken or missing. This strategy is used in the standard library + # platform module: + # https://github.com/python/cpython/blob/fcf1d003bf4f0100c9d0921ff3d70e1127ca1b71/Lib/platform.py#L175-L183 + if sys.platform == "win32": + return None + try: + gnu_libc_version = os.confstr("CS_GNU_LIBC_VERSION") + if gnu_libc_version is None: + return None + # os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17": + _, version = gnu_libc_version.split() + except (AttributeError, OSError, ValueError): + # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... + return None + return version + + +def glibc_version_string_ctypes() -> Optional[str]: + "Fallback implementation of glibc_version_string using ctypes." + + try: + import ctypes + except ImportError: + return None + + # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen + # manpage says, "If filename is NULL, then the returned handle is for the + # main program". This way we can let the linker do the work to figure out + # which libc our process is actually using. + process_namespace = ctypes.CDLL(None) + try: + gnu_get_libc_version = process_namespace.gnu_get_libc_version + except AttributeError: + # Symbol doesn't exist -> therefore, we are not linked to + # glibc. + return None + + # Call gnu_get_libc_version, which returns a string like "2.5" + gnu_get_libc_version.restype = ctypes.c_char_p + version_str = gnu_get_libc_version() + # py2 / py3 compatibility: + if not isinstance(version_str, str): + version_str = version_str.decode("ascii") + + return version_str + + +# platform.libc_ver regularly returns completely nonsensical glibc +# versions. E.g. on my computer, platform says: +# +# ~$ python2.7 -c 'import platform; print(platform.libc_ver())' +# ('glibc', '2.7') +# ~$ python3.5 -c 'import platform; print(platform.libc_ver())' +# ('glibc', '2.9') +# +# But the truth is: +# +# ~$ ldd --version +# ldd (Debian GLIBC 2.22-11) 2.22 +# +# This is unfortunate, because it means that the linehaul data on libc +# versions that was generated by pip 8.1.2 and earlier is useless and +# misleading. Solution: instead of using platform, use our code that actually +# works. +def libc_ver() -> Tuple[str, str]: + """Try to determine the glibc version + + Returns a tuple of strings (lib, version) which default to empty strings + in case the lookup fails. + """ + glibc_version = glibc_version_string() + if glibc_version is None: + return ("", "") + else: + return ("glibc", glibc_version) diff --git a/shared/package-files/31/31f0728acd86ea4539fb2e058e18514d00f90d068fe4e385adcf9c882f4988a1/blob b/shared/package-files/31/31f0728acd86ea4539fb2e058e18514d00f90d068fe4e385adcf9c882f4988a1/blob new file mode 100644 index 0000000000000000000000000000000000000000..40855b4b7d9377f210d4efd89b9097486cdea463 --- /dev/null +++ b/shared/package-files/31/31f0728acd86ea4539fb2e058e18514d00f90d068fe4e385adcf9c882f4988a1/blob @@ -0,0 +1,139 @@ +import sys +from typing import Any, Dict, Protocol, Text, Union + +MSG_DISCONNECT: int +MSG_IGNORE: int +MSG_UNIMPLEMENTED: int +MSG_DEBUG: int +MSG_SERVICE_REQUEST: int +MSG_SERVICE_ACCEPT: int +MSG_KEXINIT: int +MSG_NEWKEYS: int +MSG_USERAUTH_REQUEST: int +MSG_USERAUTH_FAILURE: int +MSG_USERAUTH_SUCCESS: int +MSG_USERAUTH_BANNER: int +MSG_USERAUTH_PK_OK: int +MSG_USERAUTH_INFO_REQUEST: int +MSG_USERAUTH_INFO_RESPONSE: int +MSG_USERAUTH_GSSAPI_RESPONSE: int +MSG_USERAUTH_GSSAPI_TOKEN: int +MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE: int +MSG_USERAUTH_GSSAPI_ERROR: int +MSG_USERAUTH_GSSAPI_ERRTOK: int +MSG_USERAUTH_GSSAPI_MIC: int +HIGHEST_USERAUTH_MESSAGE_ID: int +MSG_GLOBAL_REQUEST: int +MSG_REQUEST_SUCCESS: int +MSG_REQUEST_FAILURE: int +MSG_CHANNEL_OPEN: int +MSG_CHANNEL_OPEN_SUCCESS: int +MSG_CHANNEL_OPEN_FAILURE: int +MSG_CHANNEL_WINDOW_ADJUST: int +MSG_CHANNEL_DATA: int +MSG_CHANNEL_EXTENDED_DATA: int +MSG_CHANNEL_EOF: int +MSG_CHANNEL_CLOSE: int +MSG_CHANNEL_REQUEST: int +MSG_CHANNEL_SUCCESS: int +MSG_CHANNEL_FAILURE: int + +cMSG_DISCONNECT: bytes +cMSG_IGNORE: bytes +cMSG_UNIMPLEMENTED: bytes +cMSG_DEBUG: bytes +cMSG_SERVICE_REQUEST: bytes +cMSG_SERVICE_ACCEPT: bytes +cMSG_KEXINIT: bytes +cMSG_NEWKEYS: bytes +cMSG_USERAUTH_REQUEST: bytes +cMSG_USERAUTH_FAILURE: bytes +cMSG_USERAUTH_SUCCESS: bytes +cMSG_USERAUTH_BANNER: bytes +cMSG_USERAUTH_PK_OK: bytes +cMSG_USERAUTH_INFO_REQUEST: bytes +cMSG_USERAUTH_INFO_RESPONSE: bytes +cMSG_USERAUTH_GSSAPI_RESPONSE: bytes +cMSG_USERAUTH_GSSAPI_TOKEN: bytes +cMSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE: bytes +cMSG_USERAUTH_GSSAPI_ERROR: bytes +cMSG_USERAUTH_GSSAPI_ERRTOK: bytes +cMSG_USERAUTH_GSSAPI_MIC: bytes +cMSG_GLOBAL_REQUEST: bytes +cMSG_REQUEST_SUCCESS: bytes +cMSG_REQUEST_FAILURE: bytes +cMSG_CHANNEL_OPEN: bytes +cMSG_CHANNEL_OPEN_SUCCESS: bytes +cMSG_CHANNEL_OPEN_FAILURE: bytes +cMSG_CHANNEL_WINDOW_ADJUST: bytes +cMSG_CHANNEL_DATA: bytes +cMSG_CHANNEL_EXTENDED_DATA: bytes +cMSG_CHANNEL_EOF: bytes +cMSG_CHANNEL_CLOSE: bytes +cMSG_CHANNEL_REQUEST: bytes +cMSG_CHANNEL_SUCCESS: bytes +cMSG_CHANNEL_FAILURE: bytes + +MSG_NAMES: Dict[int, str] + +AUTH_SUCCESSFUL: int +AUTH_PARTIALLY_SUCCESSFUL: int +AUTH_FAILED: int + +OPEN_SUCCEEDED: int +OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED: int +OPEN_FAILED_CONNECT_FAILED: int +OPEN_FAILED_UNKNOWN_CHANNEL_TYPE: int +OPEN_FAILED_RESOURCE_SHORTAGE: int + +CONNECTION_FAILED_CODE: Dict[int, str] + +DISCONNECT_SERVICE_NOT_AVAILABLE: int +DISCONNECT_AUTH_CANCELLED_BY_USER: int +DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE: int + +zero_byte: bytes +one_byte: bytes +four_byte: bytes +max_byte: bytes +cr_byte: bytes +linefeed_byte: bytes +crlf: bytes +if sys.version_info < (3, 0): + cr_byte_value: bytes + linefeed_byte_value: bytes +else: + cr_byte_value: int + linefeed_byte_value: int + +class _SupportsAsBytes(Protocol): + def asbytes(self) -> bytes: ... + +_LikeBytes = Union[bytes, Text, _SupportsAsBytes] + +def asbytes(s: _LikeBytes) -> bytes: ... + +xffffffff: int +x80000000: int +o666: int +o660: int +o644: int +o600: int +o777: int +o700: int +o70: int + +DEBUG: int +INFO: int +WARNING: int +ERROR: int +CRITICAL: int + +io_sleep: float + +DEFAULT_WINDOW_SIZE: int +DEFAULT_MAX_PACKET_SIZE: int + +MIN_WINDOW_SIZE: int +MIN_PACKET_SIZE: int +MAX_WINDOW_SIZE: int diff --git a/shared/package-files/31/31f09bc8966ed57b0224e092c3abef86ce1e88fe0b64f705f9ef61b8f996fb2b/blob b/shared/package-files/31/31f09bc8966ed57b0224e092c3abef86ce1e88fe0b64f705f9ef61b8f996fb2b/blob new file mode 100644 index 0000000000000000000000000000000000000000..30afd3eb0cb4d68d82078200a5612feffcf65b0f --- /dev/null +++ b/shared/package-files/31/31f09bc8966ed57b0224e092c3abef86ce1e88fe0b64f705f9ef61b8f996fb2b/blob @@ -0,0 +1,101 @@ +import traceback +import threading +import multiprocessing +import numpy as np +from numba import cuda +from numba.cuda.testing import (skip_on_cudasim, skip_under_cuda_memcheck, + CUDATestCase) +import unittest + +try: + from concurrent.futures import ThreadPoolExecutor +except ImportError: + has_concurrent_futures = False +else: + has_concurrent_futures = True + + +has_mp_get_context = hasattr(multiprocessing, 'get_context') + + +def check_concurrent_compiling(): + @cuda.jit + def foo(x): + x[0] += 1 + + def use_foo(x): + foo[1, 1](x) + return x + + arrays = [cuda.to_device(np.arange(10)) for i in range(10)] + expected = np.arange(10) + expected[0] += 1 + with ThreadPoolExecutor(max_workers=4) as e: + for ary in e.map(use_foo, arrays): + np.testing.assert_equal(ary, expected) + + +def spawn_process_entry(q): + try: + check_concurrent_compiling() + # Catch anything that goes wrong in the threads + except: # noqa: E722 + msg = traceback.format_exc() + q.put('\n'.join(['', '=' * 80, msg])) + else: + q.put(None) + + +@skip_under_cuda_memcheck('Hangs cuda-memcheck') +@skip_on_cudasim('disabled for cudasim') +class TestMultiThreadCompiling(CUDATestCase): + + @unittest.skipIf(not has_concurrent_futures, "no concurrent.futures") + def test_concurrent_compiling(self): + check_concurrent_compiling() + + @unittest.skipIf(not has_mp_get_context, "no multiprocessing.get_context") + def test_spawn_concurrent_compilation(self): + # force CUDA context init + cuda.get_current_device() + # use "spawn" to avoid inheriting the CUDA context + ctx = multiprocessing.get_context('spawn') + + q = ctx.Queue() + p = ctx.Process(target=spawn_process_entry, args=(q,)) + p.start() + try: + err = q.get() + finally: + p.join() + if err is not None: + raise AssertionError(err) + self.assertEqual(p.exitcode, 0, 'test failed in child process') + + def test_invalid_context_error_with_d2h(self): + def d2h(arr, out): + out[:] = arr.copy_to_host() + + arr = np.arange(1, 4) + out = np.zeros_like(arr) + darr = cuda.to_device(arr) + th = threading.Thread(target=d2h, args=[darr, out]) + th.start() + th.join() + np.testing.assert_equal(arr, out) + + def test_invalid_context_error_with_d2d(self): + def d2d(dst, src): + dst.copy_to_device(src) + + arr = np.arange(100) + common = cuda.to_device(arr) + darr = cuda.to_device(np.zeros(common.shape, dtype=common.dtype)) + th = threading.Thread(target=d2d, args=[darr, common]) + th.start() + th.join() + np.testing.assert_equal(darr.copy_to_host(), arr) + + +if __name__ == '__main__': + unittest.main() diff --git a/shared/package-files/31/31f16bfef90158d13d4fc249e83459165a1edab89273841343d613b0571729c2/blob b/shared/package-files/31/31f16bfef90158d13d4fc249e83459165a1edab89273841343d613b0571729c2/blob new file mode 100644 index 0000000000000000000000000000000000000000..745b6c7d99d63d1f4502cf8399ab4166c6af1917 --- /dev/null +++ b/shared/package-files/31/31f16bfef90158d13d4fc249e83459165a1edab89273841343d613b0571729c2/blob @@ -0,0 +1,21 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API bool is_inference(const at::Tensor & self); +} // namespace native +} // namespace at diff --git a/shared/package-files/31/31f6496511a73ae245863ac284927466508fa6c2b64a9aab69f57b5649c0afc0/blob b/shared/package-files/31/31f6496511a73ae245863ac284927466508fa6c2b64a9aab69f57b5649c0afc0/blob new file mode 100644 index 0000000000000000000000000000000000000000..9057e727d45d646b43d4f20d3ba4fa3858a6c107 --- /dev/null +++ b/shared/package-files/31/31f6496511a73ae245863ac284927466508fa6c2b64a9aab69f57b5649c0afc0/blob @@ -0,0 +1,164 @@ +from __future__ import annotations + +from ..._explanation import Explanation +from .._explainer import Explainer + + +class DeepExplainer(Explainer): + """Meant to approximate SHAP values for deep learning models. + + This is an enhanced version of the DeepLIFT algorithm (Deep SHAP) where, similar to Kernel SHAP, we + approximate the conditional expectations of SHAP values using a selection of background samples. + Lundberg and Lee, NIPS 2017 showed that the per node attribution rules in DeepLIFT (Shrikumar, + Greenside, and Kundaje, arXiv 2017) can be chosen to approximate Shapley values. By integrating + over many background samples, Deep estimates approximate SHAP values such that they sum + up to the difference between the expected model output on the passed background samples and the + current model output (f(x) - E[f(x)]). + + Examples + -------- + See :ref:`Deep Explainer Examples ` + + """ + + def __init__(self, model, data, session=None, learning_phase_flags=None): + """An explainer object for a differentiable model using a given background dataset. + + Note that the complexity of the method scales linearly with the number of background data + samples. Passing the entire training dataset as `data` will give very accurate expected + values, but will be unreasonably expensive. The variance of the expectation estimates scales by + roughly 1/sqrt(N) for N background data samples. So 100 samples will give a good estimate, + and 1000 samples a very good estimate of the expected values. + + Parameters + ---------- + model : + if framework == 'tensorflow', (input : [tf.Tensor], output : tf.Tensor) + A pair of TensorFlow tensors (or a list and a tensor) that specifies the input and + output of the model to be explained. Note that SHAP values are specific to a single + output value, so the output tf.Tensor should be a single dimensional output (,1). + + if framework == 'pytorch', an nn.Module object (model), or a tuple (model, layer), + where both are nn.Module objects. + The model is an nn.Module object which takes as input a tensor (or list of tensors) of + shape data, and returns a single dimensional output. + If the input is a tuple, the returned shap values will be for the input of the + layer argument. layer must be a layer in the model, i.e. model.conv2 + + data : + if framework == 'tensorflow': [np.array] or [pandas.DataFrame] + if framework == 'pytorch': [torch.tensor] + + The background dataset to use for integrating out features. Deep integrates + over these samples. The data passed here must match the input tensors given in the + first argument. Note that, since these samples are integrated over for each sample, you + should only use something like 100 or 1000 random background samples, not the whole + training dataset. + + session : None or tensorflow.Session + The TensorFlow session that has the model we are explaining. If None is passed then + we do our best to find the right session, first looking for a keras session, then + falling back to the default TensorFlow session. + + learning_phase_flags : None or list of tensors + If you have your own custom learning phase flags, pass them here. When explaining a prediction + we need to ensure we are not in training mode, since this changes the behavior of ops like + batch norm or dropout. If None is passed then we look for tensors in the graph that look like + learning phase flags (this works for Keras models). Note that we assume all the flags should + have a value of False during predictions (and hence explanations). + + """ + # first, we need to find the framework + if type(model) is tuple: + a, b = model + try: + a.named_parameters() + framework = "pytorch" + except Exception: + framework = "tensorflow" + else: + try: + model.named_parameters() + framework = "pytorch" + except Exception: + framework = "tensorflow" + + masker = data + super().__init__(model, masker) + + self.explainer: TFDeep | PyTorchDeep + if framework == "tensorflow": + from .deep_tf import TFDeep + + self.explainer = TFDeep(model, data, session, learning_phase_flags) + elif framework == "pytorch": + from .deep_pytorch import PyTorchDeep + + self.explainer = PyTorchDeep(model, data) + + self.expected_value = self.explainer.expected_value + self.explainer.framework = framework # type: ignore + + def __call__(self, X: list | np.ndarray | pd.DataFrame | torch.tensor) -> Explanation: # type: ignore # noqa: F821 + """Return an explanation object for the model applied to X. + + Parameters + ---------- + X : list, + if framework == 'tensorflow': numpy.array, or pandas.DataFrame + if framework == 'pytorch': torch.tensor + A tensor (or list of tensors) of samples (where X.shape[0] == # samples) on which to + explain the model's output. + + Returns + ------- + shap.Explanation: + """ + shap_values = self.shap_values(X) + return Explanation(values=shap_values, data=X) + + def shap_values(self, X, ranked_outputs=None, output_rank_order="max", check_additivity=True): + """Return approximate SHAP values for the model applied to the data given by X. + + Parameters + ---------- + X : list, + if framework == 'tensorflow': np.array, or pandas.DataFrame + if framework == 'pytorch': torch.tensor + A tensor (or list of tensors) of samples (where X.shape[0] == # samples) on which to + explain the model's output. + + ranked_outputs : None or int + If ranked_outputs is None then we explain all the outputs in a multi-output model. If + ranked_outputs is a positive integer then we only explain that many of the top model + outputs (where "top" is determined by output_rank_order). Note that this causes a pair + of values to be returned (shap_values, indexes), where shap_values is a list of numpy + arrays for each of the output ranks, and indexes is a matrix that indicates for each sample + which output indexes were choses as "top". + + output_rank_order : "max", "min", or "max_abs" + How to order the model outputs when using ranked_outputs, either by maximum, minimum, or + maximum absolute value. + + Returns + ------- + np.array or list + Estimated SHAP values, usually of shape ``(# samples x # features)``. + + The shape of the returned array depends on the number of model outputs: + + * one input, one output: matrix of shape ``(#num_samples, *X.shape[1:])``. + * one input, multiple outputs: matrix of shape ``(#num_samples, *X.shape[1:], #num_outputs)`` + * multiple inputs, one or more outputs: list of matrices, with shapes of one of the above. + + If ranked_outputs is ``None`` then this list of tensors matches + the number of model outputs. If ranked_outputs is a positive integer a pair is returned + (shap_values, indexes), where shap_values is a list of tensors with a length of + ranked_outputs, and indexes is a matrix that indicates for each sample which output indexes + were chosen as "top". + + .. versionchanged:: 0.45.0 + Return type for models with multiple outputs and one input changed from list to np.ndarray. + + """ + return self.explainer.shap_values(X, ranked_outputs, output_rank_order, check_additivity=check_additivity) diff --git a/shared/package-files/31/31f721de5fe36cae5740d7da2e15e9e8e72fa391d42a118db10cc771f2cf1b0d/blob b/shared/package-files/31/31f721de5fe36cae5740d7da2e15e9e8e72fa391d42a118db10cc771f2cf1b0d/blob new file mode 100644 index 0000000000000000000000000000000000000000..7771865c5432478b47eb635c97ea39778ab4a6d9 --- /dev/null +++ b/shared/package-files/31/31f721de5fe36cae5740d7da2e15e9e8e72fa391d42a118db10cc771f2cf1b0d/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor __lshift__(const at::Tensor & self, const at::Scalar & other); +TORCH_API at::Tensor & __ilshift__(at::Tensor & self, const at::Scalar & other); +TORCH_API at::Tensor __lshift__(const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & __ilshift__(at::Tensor & self, const at::Tensor & other); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/31/31f7e08f7c79b45c2c2968a1c3691b8529a1bc634481073fa498ba0b79844317/blob b/shared/package-files/31/31f7e08f7c79b45c2c2968a1c3691b8529a1bc634481073fa498ba0b79844317/blob new file mode 100644 index 0000000000000000000000000000000000000000..f23342155224f2c022280a6384192e63e7852e31 --- /dev/null +++ b/shared/package-files/31/31f7e08f7c79b45c2c2968a1c3691b8529a1bc634481073fa498ba0b79844317/blob @@ -0,0 +1,407 @@ +""" + pygments.lexers.wgsl + ~~~~~~~~~~~~~~~~~~~~ + + Lexer for the WebGPU Shading Language. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, bygroups, words, default +from pygments.token import Comment, Operator, Keyword, Name, \ + Number, Punctuation, Whitespace +from pygments import unistring as uni + +__all__ = ['WgslLexer'] + +LF = '\\u000a' +VT = '\\u000b' +FF = '\\u000c' +CR = '\\u000d' +NextLine = '\\u0085' +LineSep = '\\u2028' +ParaSep = '\\u2029' +LineEndCodePoints = [LF,VT,FF,CR,NextLine,LineSep,ParaSep] +NotLineEndRE = '[^' + "".join(LineEndCodePoints) + ']' +LineEndRE = '[' + "".join(LineEndCodePoints) + ']' + +# https://www.w3.org/TR/WGSL/#syntax-ident_pattern_token +ident_pattern_token = '([{}][{}]+)|[{}]'.format(uni.xid_start,uni.xid_continue,uni.xid_start) + + +class WgslLexer(RegexLexer): + """ + Lexer for the WebGPU Shading Language. + + .. versionadded:: 2.15 + """ + name = 'WebGPU Shading Language' + url = 'https://www.w3.org/TR/WGSL/' + aliases = ['wgsl'] + filenames = ['*.wgsl'] + mimetypes = ['text/wgsl'] + + # https://www.w3.org/TR/WGSL/#var-and-value + keyword_decl = (words('var let const override'.split(),suffix=r'\b'), Keyword.Declaration) + # https://www.w3.org/TR/WGSL/#keyword-summary + keywords = (words(""" + alias + break + case + const_assert + continue + continuing + default + diagnostic + discard + else + enable + false + fn + for + if + loop + requires + return + struct + switch + true + while + """.split(), suffix=r'\b'), Keyword) + + # https://www.w3.org/TR/WGSL/#reserved-words + keyword_reserved = (words(""" + NULL + Self + abstract + active + alignas + alignof + as + asm + asm_fragment + async + attribute + auto + await + become + binding_array + cast + catch + class + co_await + co_return + co_yield + coherent + column_major + common + compile + compile_fragment + concept + const_cast + consteval + constexpr + constinit + crate + debugger + decltype + delete + demote + demote_to_helper + do + dynamic_cast + enum + explicit + export + extends + extern + external + fallthrough + filter + final + finally + friend + from + fxgroup + get + goto + groupshared + highp + impl + implements + import + inline + instanceof + interface + layout + lowp + macro + macro_rules + match + mediump + meta + mod + module + move + mut + mutable + namespace + new + nil + noexcept + noinline + nointerpolation + noperspective + null + nullptr + of + operator + package + packoffset + partition + pass + patch + pixelfragment + precise + precision + premerge + priv + protected + pub + public + readonly + ref + regardless + register + reinterpret_cast + require + resource + restrict + self + set + shared + sizeof + smooth + snorm + static + static_assert + static_cast + std + subroutine + super + target + template + this + thread_local + throw + trait + try + type + typedef + typeid + typename + typeof + union + unless + unorm + unsafe + unsized + use + using + varying + virtual + volatile + wgsl + where + with + writeonly + yield + """.split(), suffix=r'\b'), Keyword.Reserved) + + # https://www.w3.org/TR/WGSL/#predeclared-enumerants + predeclared_enums = (words(""" + read write read_write + function private workgroup uniform storage + perspective linear flat + center centroid sample + vertex_index instance_index position front_facing frag_depth + local_invocation_id local_invocation_index + global_invocation_id workgroup_id num_workgroups + sample_index sample_mask + rgba8unorm + rgba8snorm + rgba8uint + rgba8sint + rgba16uint + rgba16sint + rgba16float + r32uint + r32sint + r32float + rg32uint + rg32sint + rg32float + rgba32uint + rgba32sint + rgba32float + bgra8unorm + """.split(), suffix=r'\b'), Name.Builtin) + + # https://www.w3.org/TR/WGSL/#predeclared-types + predeclared_types = (words(""" + bool + f16 + f32 + i32 + sampler sampler_comparison + texture_depth_2d + texture_depth_2d_array + texture_depth_cube + texture_depth_cube_array + texture_depth_multisampled_2d + texture_external + texture_external + u32 + """.split(), suffix=r'\b'), Name.Builtin) + + # https://www.w3.org/TR/WGSL/#predeclared-types + predeclared_type_generators = (words(""" + array + atomic + mat2x2 + mat2x3 + mat2x4 + mat3x2 + mat3x3 + mat3x4 + mat4x2 + mat4x3 + mat4x4 + ptr + texture_1d + texture_2d + texture_2d_array + texture_3d + texture_cube + texture_cube_array + texture_multisampled_2d + texture_storage_1d + texture_storage_2d + texture_storage_2d_array + texture_storage_3d + vec2 + vec3 + vec4 + """.split(), suffix=r'\b'), Name.Builtin) + + # Predeclared type aliases for vectors + # https://www.w3.org/TR/WGSL/#vector-types + predeclared_type_alias_vectors = (words(""" + vec2i vec3i vec4i + vec2u vec3u vec4u + vec2f vec3f vec4f + vec2h vec3h vec4h + """.split(), suffix=r'\b'), Name.Builtin) + + # Predeclared type aliases for matrices + # https://www.w3.org/TR/WGSL/#matrix-types + predeclared_type_alias_matrices = (words(""" + mat2x2f mat2x3f mat2x4f + mat3x2f mat3x3f mat3x4f + mat4x2f mat4x3f mat4x4f + mat2x2h mat2x3h mat2x4h + mat3x2h mat3x3h mat3x4h + mat4x2h mat4x3h mat4x4h + """.split(), suffix=r'\b'), Name.Builtin) + + tokens = { + 'blankspace': [ + # https://www.w3.org/TR/WGSL/#blankspace + (r'[\u0020\u0009\u000a\u000b\u000c\u000d\u0085\u200e\u200f\u2028\u2029]+', Whitespace), + ], + 'comments': [ + # Line ending comments + # Match up CR/LF pair first. + (r'//{}*{}{}'.format(NotLineEndRE,CR,LF), Comment.Single), + (r'//{}*{}'.format(NotLineEndRE,LineEndRE), Comment.Single), + (r'/\*', Comment.Multiline, 'block_comment'), + ], + 'attribute': [ + include('blankspace'), + include('comments'), + (ident_pattern_token, Name.Decorator,'#pop'), + default('#pop'), + ], + 'root': [ + include('blankspace'), + include('comments'), + + # Attributes. + # https://www.w3.org/TR/WGSL/#attributes + # Mark the '@' and the attribute name as a decorator. + (r'@', Name.Decorator, 'attribute'), + + # Keywords + (r'(true|false)\b', Keyword.Constant), + keyword_decl, + keywords, + keyword_reserved, + + # Predeclared + predeclared_enums, + predeclared_types, + predeclared_type_generators, + predeclared_type_alias_vectors, + predeclared_type_alias_matrices, + + # Decimal float literals + # https://www.w3.org/TR/WGSL/#syntax-decimal_float_literal + # 0, with type-specifying suffix. + (r'0[fh]', Number.Float), + # Other decimal integer, with type-specifying suffix. + (r'[1-9][0-9]*[fh]', Number.Float), + # Has decimal point, at least one digit after decimal. + (r'[0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[fh]?', Number.Float), + # Has decimal point, at least one digit before decimal. + (r'[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?[fh]?', Number.Float), + # Has at least one digit, and has an exponent. + (r'[0-9]+[eE][+-]?[0-9]+[fh]?', Number.Float), + + # Hex float literals + # https://www.w3.org/TR/WGSL/#syntax-hex_float_literal + (r'0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+([pP][+-]?[0-9]+[fh]?)?', Number.Float), + (r'0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*([pP][+-]?[0-9]+[fh]?)?', Number.Float), + (r'0[xX][0-9a-fA-F]+[pP][+-]?[0-9]+[fh]?', Number.Float), + + # Hexadecimal integer literals + # https://www.w3.org/TR/WGSL/#syntax-hex_int_literal + (r'0[xX][0-9a-fA-F]+[iu]?', Number.Hex), + # Decimal integer literals + # https://www.w3.org/TR/WGSL/#syntax-decimal_int_literal + # We need two rules here because 01 is not valid. + (r'[1-9][0-9]*[iu]?', Number.Integer), + (r'0[iu]?', Number.Integer), # Must match last. + + # Operators and Punctuation + (r'[{}()\[\],\.;:]', Punctuation), + (r'->', Punctuation), # Return-type arrow + (r'[+\-*/%&|<>^!~=]', Operator), + + # TODO: Treat context-depedendent names specially + # https://www.w3.org/TR/WGSL/#context-dependent-name + + # Identifiers + (ident_pattern_token, Name), + + # TODO: templates start and end tokens. + # https://www.w3.org/TR/WGSL/#template-lists-sec + ], + 'block_comment': [ + # https://www.w3.org/TR/WGSL/#block-comment + (r'[^*/]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + } diff --git a/shared/package-files/31/31fe7b070a21467f727ba8b126a8cd1272b480aaa754f13d1b2f2f2beebfcf1a/blob b/shared/package-files/31/31fe7b070a21467f727ba8b126a8cd1272b480aaa754f13d1b2f2f2beebfcf1a/blob new file mode 100644 index 0000000000000000000000000000000000000000..ee818e90575b62622e5802c3f2dc56b875cec38b --- /dev/null +++ b/shared/package-files/31/31fe7b070a21467f727ba8b126a8cd1272b480aaa754f13d1b2f2f2beebfcf1a/blob @@ -0,0 +1,338 @@ +""" +A module with various ``typing.Protocol`` subclasses that implement +the ``__call__`` magic method. + +See the `Mypy documentation`_ on protocols for more details. + +.. _`Mypy documentation`: https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols + +""" + +from __future__ import annotations + +from typing import ( + TypeVar, + overload, + Any, + NoReturn, + Protocol, +) + +from numpy import ( + ndarray, + dtype, + generic, + bool_, + timedelta64, + number, + integer, + unsignedinteger, + signedinteger, + int8, + int_, + floating, + float64, + complexfloating, + complex128, +) +from ._nbit import _NBitInt, _NBitDouble +from ._scalars import ( + _BoolLike_co, + _IntLike_co, + _FloatLike_co, + _NumberLike_co, +) +from . import NBitBase +from ._array_like import NDArray +from ._nested_sequence import _NestedSequence + +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T1_contra = TypeVar("_T1_contra", contravariant=True) +_T2_contra = TypeVar("_T2_contra", contravariant=True) +_2Tuple = tuple[_T1, _T1] + +_NBit1 = TypeVar("_NBit1", bound=NBitBase) +_NBit2 = TypeVar("_NBit2", bound=NBitBase) + +_IntType = TypeVar("_IntType", bound=integer) +_FloatType = TypeVar("_FloatType", bound=floating) +_NumberType = TypeVar("_NumberType", bound=number) +_NumberType_co = TypeVar("_NumberType_co", covariant=True, bound=number) +_GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic) + +class _BoolOp(Protocol[_GenericType_co]): + @overload + def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ... + @overload # platform dependent + def __call__(self, other: int, /) -> int_: ... + @overload + def __call__(self, other: float, /) -> float64: ... + @overload + def __call__(self, other: complex, /) -> complex128: ... + @overload + def __call__(self, other: _NumberType, /) -> _NumberType: ... + +class _BoolBitOp(Protocol[_GenericType_co]): + @overload + def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ... + @overload # platform dependent + def __call__(self, other: int, /) -> int_: ... + @overload + def __call__(self, other: _IntType, /) -> _IntType: ... + +class _BoolSub(Protocol): + # Note that `other: bool_` is absent here + @overload + def __call__(self, other: bool, /) -> NoReturn: ... + @overload # platform dependent + def __call__(self, other: int, /) -> int_: ... + @overload + def __call__(self, other: float, /) -> float64: ... + @overload + def __call__(self, other: complex, /) -> complex128: ... + @overload + def __call__(self, other: _NumberType, /) -> _NumberType: ... + +class _BoolTrueDiv(Protocol): + @overload + def __call__(self, other: float | _IntLike_co, /) -> float64: ... + @overload + def __call__(self, other: complex, /) -> complex128: ... + @overload + def __call__(self, other: _NumberType, /) -> _NumberType: ... + +class _BoolMod(Protocol): + @overload + def __call__(self, other: _BoolLike_co, /) -> int8: ... + @overload # platform dependent + def __call__(self, other: int, /) -> int_: ... + @overload + def __call__(self, other: float, /) -> float64: ... + @overload + def __call__(self, other: _IntType, /) -> _IntType: ... + @overload + def __call__(self, other: _FloatType, /) -> _FloatType: ... + +class _BoolDivMod(Protocol): + @overload + def __call__(self, other: _BoolLike_co, /) -> _2Tuple[int8]: ... + @overload # platform dependent + def __call__(self, other: int, /) -> _2Tuple[int_]: ... + @overload + def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... + @overload + def __call__(self, other: _IntType, /) -> _2Tuple[_IntType]: ... + @overload + def __call__(self, other: _FloatType, /) -> _2Tuple[_FloatType]: ... + +class _TD64Div(Protocol[_NumberType_co]): + @overload + def __call__(self, other: timedelta64, /) -> _NumberType_co: ... + @overload + def __call__(self, other: _BoolLike_co, /) -> NoReturn: ... + @overload + def __call__(self, other: _FloatLike_co, /) -> timedelta64: ... + +class _IntTrueDiv(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> floating[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: complex, /, + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... + @overload + def __call__(self, other: integer[_NBit2], /) -> floating[_NBit1 | _NBit2]: ... + +class _UnsignedIntOp(Protocol[_NBit1]): + # NOTE: `uint64 + signedinteger -> float64` + @overload + def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ... + @overload + def __call__( + self, other: int | signedinteger[Any], / + ) -> Any: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: complex, /, + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: unsignedinteger[_NBit2], / + ) -> unsignedinteger[_NBit1 | _NBit2]: ... + +class _UnsignedIntBitOp(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> signedinteger[Any]: ... + @overload + def __call__(self, other: signedinteger[Any], /) -> signedinteger[Any]: ... + @overload + def __call__( + self, other: unsignedinteger[_NBit2], / + ) -> unsignedinteger[_NBit1 | _NBit2]: ... + +class _UnsignedIntMod(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ... + @overload + def __call__( + self, other: int | signedinteger[Any], / + ) -> Any: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: unsignedinteger[_NBit2], / + ) -> unsignedinteger[_NBit1 | _NBit2]: ... + +class _UnsignedIntDivMod(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ... + @overload + def __call__( + self, other: int | signedinteger[Any], / + ) -> _2Tuple[Any]: ... + @overload + def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... + @overload + def __call__( + self, other: unsignedinteger[_NBit2], / + ) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ... + +class _SignedIntOp(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: complex, /, + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: signedinteger[_NBit2], /, + ) -> signedinteger[_NBit1 | _NBit2]: ... + +class _SignedIntBitOp(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ... + @overload + def __call__( + self, other: signedinteger[_NBit2], /, + ) -> signedinteger[_NBit1 | _NBit2]: ... + +class _SignedIntMod(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: signedinteger[_NBit2], /, + ) -> signedinteger[_NBit1 | _NBit2]: ... + +class _SignedIntDivMod(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ... + @overload + def __call__(self, other: int, /) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ... + @overload + def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... + @overload + def __call__( + self, other: signedinteger[_NBit2], /, + ) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ... + +class _FloatOp(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> floating[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: complex, /, + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: integer[_NBit2] | floating[_NBit2], / + ) -> floating[_NBit1 | _NBit2]: ... + +class _FloatMod(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> floating[_NBit1]: ... + @overload + def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ... + @overload + def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, other: integer[_NBit2] | floating[_NBit2], / + ) -> floating[_NBit1 | _NBit2]: ... + +class _FloatDivMod(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> _2Tuple[floating[_NBit1]]: ... + @overload + def __call__(self, other: int, /) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ... + @overload + def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... + @overload + def __call__( + self, other: integer[_NBit2] | floating[_NBit2], / + ) -> _2Tuple[floating[_NBit1 | _NBit2]]: ... + +class _ComplexOp(Protocol[_NBit1]): + @overload + def __call__(self, other: bool, /) -> complexfloating[_NBit1, _NBit1]: ... + @overload + def __call__(self, other: int, /) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ... + @overload + def __call__( + self, other: complex, /, + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... + @overload + def __call__( + self, + other: ( + integer[_NBit2] + | floating[_NBit2] + | complexfloating[_NBit2, _NBit2] + ), /, + ) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ... + +class _NumberOp(Protocol): + def __call__(self, other: _NumberLike_co, /) -> Any: ... + +class _SupportsLT(Protocol): + def __lt__(self, other: Any, /) -> object: ... + +class _SupportsGT(Protocol): + def __gt__(self, other: Any, /) -> object: ... + +class _ComparisonOp(Protocol[_T1_contra, _T2_contra]): + @overload + def __call__(self, other: _T1_contra, /) -> bool_: ... + @overload + def __call__(self, other: _T2_contra, /) -> NDArray[bool_]: ... + @overload + def __call__( + self, + other: _SupportsLT | _SupportsGT | _NestedSequence[_SupportsLT | _SupportsGT], + /, + ) -> Any: ... diff --git a/shared/package-files/32/32027eb7f7fb836922cdcad667f12b725c791e049ac7d269bda12429a39e9d48/blob b/shared/package-files/32/32027eb7f7fb836922cdcad667f12b725c791e049ac7d269bda12429a39e9d48/blob new file mode 100644 index 0000000000000000000000000000000000000000..246426e721db61fadab78a669f3e6dc18d78f04d --- /dev/null +++ b/shared/package-files/32/32027eb7f7fb836922cdcad667f12b725c791e049ac7d269bda12429a39e9d48/blob @@ -0,0 +1,13 @@ +# See: man pkg-config +prefix=/opt/conda +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Python +Description: Embed Python into an application +Requires: +Version: 3.10 +Libs.private: -lcrypt -lpthread -ldl -lutil -lm +Libs: -L${libdir} -lpython3.10 +Cflags: -I${includedir}/python3.10 diff --git a/shared/package-files/32/3204305af3d1b1a4fa532c1b68e8ec5d331c02add9f6d6a1772f39ff0ee47c16/blob b/shared/package-files/32/3204305af3d1b1a4fa532c1b68e8ec5d331c02add9f6d6a1772f39ff0ee47c16/blob new file mode 100644 index 0000000000000000000000000000000000000000..a38471842782b526e38c8f7602c40ec38e9416a6 --- /dev/null +++ b/shared/package-files/32/3204305af3d1b1a4fa532c1b68e8ec5d331c02add9f6d6a1772f39ff0ee47c16/blob @@ -0,0 +1,4 @@ +class ExperimentalWarning(Warning): + """Used to manage warning messages for any experimental integrations.""" + + pass diff --git a/shared/package-files/32/3208279bebd7d83b14c1360f25f93cd40048e904280d52b3b8549b05f0e3ae71/blob b/shared/package-files/32/3208279bebd7d83b14c1360f25f93cd40048e904280d52b3b8549b05f0e3ae71/blob new file mode 100644 index 0000000000000000000000000000000000000000..9f16f621b345113a4e265abcd5de19e8095bc5e8 --- /dev/null +++ b/shared/package-files/32/3208279bebd7d83b14c1360f25f93cd40048e904280d52b3b8549b05f0e3ae71/blob @@ -0,0 +1,63 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_fused_sgd_(Tensor(a!)[] self, Tensor(b!)[] grads, Tensor(c!)[] momentum_buffer_list, *, float weight_decay, float momentum, float lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None) -> () +inline void _fused_sgd_(at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, double lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale={}, const c10::optional & found_inf={}) { + return at::_ops::_fused_sgd_::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf); +} + +// aten::_fused_sgd_.tensor_lr(Tensor(a!)[] self, Tensor(b!)[] grads, Tensor(c!)[] momentum_buffer_list, *, float weight_decay, float momentum, Tensor lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None) -> () +inline void _fused_sgd_(at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, const at::Tensor & lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale={}, const c10::optional & found_inf={}) { + return at::_ops::_fused_sgd__tensor_lr::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf); +} + +// aten::_fused_sgd.out(Tensor[] self, Tensor(b!)[] grads, Tensor(c!)[] momentum_buffer_list, *, float weight_decay, float momentum, float lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None, Tensor(a!)[] out) -> () +inline void _fused_sgd_out(at::TensorList out, at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, double lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale={}, const c10::optional & found_inf={}) { + return at::_ops::_fused_sgd_out::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf, out); +} +// aten::_fused_sgd.out(Tensor[] self, Tensor(b!)[] grads, Tensor(c!)[] momentum_buffer_list, *, float weight_decay, float momentum, float lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None, Tensor(a!)[] out) -> () +inline void _fused_sgd_outf(at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, double lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale, const c10::optional & found_inf, at::TensorList out) { + return at::_ops::_fused_sgd_out::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf, out); +} + +// aten::_fused_sgd(Tensor[] self, Tensor[] grads, Tensor[] momentum_buffer_list, *, float weight_decay, float momentum, float lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None) -> (Tensor[] self_out, Tensor[] grads_out, Tensor[] momentum_buffer_list_out) +inline ::std::tuple<::std::vector,::std::vector,::std::vector> _fused_sgd(at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, double lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale={}, const c10::optional & found_inf={}) { + return at::_ops::_fused_sgd::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf); +} + +// aten::_fused_sgd.tensor_lr_out(Tensor[] self, Tensor(b!)[] grads, Tensor(c!)[] momentum_buffer_list, *, float weight_decay, float momentum, Tensor lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None, Tensor(a!)[] out) -> () +inline void _fused_sgd_out(at::TensorList out, at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, const at::Tensor & lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale={}, const c10::optional & found_inf={}) { + return at::_ops::_fused_sgd_tensor_lr_out::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf, out); +} +// aten::_fused_sgd.tensor_lr_out(Tensor[] self, Tensor(b!)[] grads, Tensor(c!)[] momentum_buffer_list, *, float weight_decay, float momentum, Tensor lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None, Tensor(a!)[] out) -> () +inline void _fused_sgd_outf(at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, const at::Tensor & lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale, const c10::optional & found_inf, at::TensorList out) { + return at::_ops::_fused_sgd_tensor_lr_out::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf, out); +} + +// aten::_fused_sgd.tensor_lr(Tensor[] self, Tensor[] grads, Tensor[] momentum_buffer_list, *, float weight_decay, float momentum, Tensor lr, float dampening, bool nesterov, bool maximize, bool is_first_step, Tensor? grad_scale=None, Tensor? found_inf=None) -> (Tensor[] self_out, Tensor[] grads_out, Tensor[] momentum_buffer_list_out) +inline ::std::tuple<::std::vector,::std::vector,::std::vector> _fused_sgd(at::TensorList self, at::TensorList grads, at::TensorList momentum_buffer_list, double weight_decay, double momentum, const at::Tensor & lr, double dampening, bool nesterov, bool maximize, bool is_first_step, const c10::optional & grad_scale={}, const c10::optional & found_inf={}) { + return at::_ops::_fused_sgd_tensor_lr::call(self, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf); +} + +} diff --git a/shared/package-files/32/3209ff37311d53ba8ccea59c7e6c7fe0579a3eb10c185ff6b115b15e859aa149/blob b/shared/package-files/32/3209ff37311d53ba8ccea59c7e6c7fe0579a3eb10c185ff6b115b15e859aa149/blob new file mode 100644 index 0000000000000000000000000000000000000000..de470fcda18ed47417ff84b88c6b48bc888cec8f --- /dev/null +++ b/shared/package-files/32/3209ff37311d53ba8ccea59c7e6c7fe0579a3eb10c185ff6b115b15e859aa149/blob @@ -0,0 +1,2684 @@ +from datetime import datetime +import itertools +import re + +import numpy as np +import pytest + +from pandas._libs import lib +from pandas.errors import PerformanceWarning + +import pandas as pd +from pandas import ( + DataFrame, + Index, + MultiIndex, + Period, + Series, + Timedelta, + date_range, +) +import pandas._testing as tm +from pandas.core.reshape import reshape as reshape_lib + + +@pytest.fixture(params=[True, False]) +def future_stack(request): + return request.param + + +class TestDataFrameReshape: + def test_stack_unstack(self, float_frame, future_stack): + df = float_frame.copy() + df[:] = np.arange(np.prod(df.shape)).reshape(df.shape) + + stacked = df.stack(future_stack=future_stack) + stacked_df = DataFrame({"foo": stacked, "bar": stacked}) + + unstacked = stacked.unstack() + unstacked_df = stacked_df.unstack() + + tm.assert_frame_equal(unstacked, df) + tm.assert_frame_equal(unstacked_df["bar"], df) + + unstacked_cols = stacked.unstack(0) + unstacked_cols_df = stacked_df.unstack(0) + tm.assert_frame_equal(unstacked_cols.T, df) + tm.assert_frame_equal(unstacked_cols_df["bar"].T, df) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_mixed_level(self, future_stack): + # GH 18310 + levels = [range(3), [3, "a", "b"], [1, 2]] + + # flat columns: + df = DataFrame(1, index=levels[0], columns=levels[1]) + result = df.stack(future_stack=future_stack) + expected = Series(1, index=MultiIndex.from_product(levels[:2])) + tm.assert_series_equal(result, expected) + + # MultiIndex columns: + df = DataFrame(1, index=levels[0], columns=MultiIndex.from_product(levels[1:])) + result = df.stack(1, future_stack=future_stack) + expected = DataFrame( + 1, index=MultiIndex.from_product([levels[0], levels[2]]), columns=levels[1] + ) + tm.assert_frame_equal(result, expected) + + # as above, but used labels in level are actually of homogeneous type + result = df[["a", "b"]].stack(1, future_stack=future_stack) + expected = expected[["a", "b"]] + tm.assert_frame_equal(result, expected) + + def test_unstack_not_consolidated(self, using_array_manager): + # Gh#34708 + df = DataFrame({"x": [1, 2, np.nan], "y": [3.0, 4, np.nan]}) + df2 = df[["x"]] + df2["y"] = df["y"] + if not using_array_manager: + assert len(df2._mgr.blocks) == 2 + + res = df2.unstack() + expected = df.unstack() + tm.assert_series_equal(res, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_unstack_fill(self, future_stack): + # GH #9746: fill_value keyword argument for Series + # and DataFrame unstack + + # From a series + data = Series([1, 2, 4, 5], dtype=np.int16) + data.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + result = data.unstack(fill_value=-1) + expected = DataFrame( + {"a": [1, -1, 5], "b": [2, 4, -1]}, index=["x", "y", "z"], dtype=np.int16 + ) + tm.assert_frame_equal(result, expected) + + # From a series with incorrect data type for fill_value + result = data.unstack(fill_value=0.5) + expected = DataFrame( + {"a": [1, 0.5, 5], "b": [2, 4, 0.5]}, index=["x", "y", "z"], dtype=float + ) + tm.assert_frame_equal(result, expected) + + # GH #13971: fill_value when unstacking multiple levels: + df = DataFrame( + {"x": ["a", "a", "b"], "y": ["j", "k", "j"], "z": [0, 1, 2], "w": [0, 1, 2]} + ).set_index(["x", "y", "z"]) + unstacked = df.unstack(["x", "y"], fill_value=0) + key = ("w", "b", "j") + expected = unstacked[key] + result = Series([0, 0, 2], index=unstacked.index, name=key) + tm.assert_series_equal(result, expected) + + stacked = unstacked.stack(["x", "y"], future_stack=future_stack) + stacked.index = stacked.index.reorder_levels(df.index.names) + # Workaround for GH #17886 (unnecessarily casts to float): + stacked = stacked.astype(np.int64) + result = stacked.loc[df.index] + tm.assert_frame_equal(result, df) + + # From a series + s = df["w"] + result = s.unstack(["x", "y"], fill_value=0) + expected = unstacked["w"] + tm.assert_frame_equal(result, expected) + + def test_unstack_fill_frame(self): + # From a dataframe + rows = [[1, 2], [3, 4], [5, 6], [7, 8]] + df = DataFrame(rows, columns=list("AB"), dtype=np.int32) + df.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + result = df.unstack(fill_value=-1) + + rows = [[1, 3, 2, 4], [-1, 5, -1, 6], [7, -1, 8, -1]] + expected = DataFrame(rows, index=list("xyz"), dtype=np.int32) + expected.columns = MultiIndex.from_tuples( + [("A", "a"), ("A", "b"), ("B", "a"), ("B", "b")] + ) + tm.assert_frame_equal(result, expected) + + # From a mixed type dataframe + df["A"] = df["A"].astype(np.int16) + df["B"] = df["B"].astype(np.float64) + + result = df.unstack(fill_value=-1) + expected["A"] = expected["A"].astype(np.int16) + expected["B"] = expected["B"].astype(np.float64) + tm.assert_frame_equal(result, expected) + + # From a dataframe with incorrect data type for fill_value + result = df.unstack(fill_value=0.5) + + rows = [[1, 3, 2, 4], [0.5, 5, 0.5, 6], [7, 0.5, 8, 0.5]] + expected = DataFrame(rows, index=list("xyz"), dtype=float) + expected.columns = MultiIndex.from_tuples( + [("A", "a"), ("A", "b"), ("B", "a"), ("B", "b")] + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_fill_frame_datetime(self): + # Test unstacking with date times + dv = date_range("2012-01-01", periods=4).values + data = Series(dv) + data.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + result = data.unstack() + expected = DataFrame( + {"a": [dv[0], pd.NaT, dv[3]], "b": [dv[1], dv[2], pd.NaT]}, + index=["x", "y", "z"], + ) + tm.assert_frame_equal(result, expected) + + result = data.unstack(fill_value=dv[0]) + expected = DataFrame( + {"a": [dv[0], dv[0], dv[3]], "b": [dv[1], dv[2], dv[0]]}, + index=["x", "y", "z"], + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_fill_frame_timedelta(self): + # Test unstacking with time deltas + td = [Timedelta(days=i) for i in range(4)] + data = Series(td) + data.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + result = data.unstack() + expected = DataFrame( + {"a": [td[0], pd.NaT, td[3]], "b": [td[1], td[2], pd.NaT]}, + index=["x", "y", "z"], + ) + tm.assert_frame_equal(result, expected) + + result = data.unstack(fill_value=td[1]) + expected = DataFrame( + {"a": [td[0], td[1], td[3]], "b": [td[1], td[2], td[1]]}, + index=["x", "y", "z"], + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_fill_frame_period(self): + # Test unstacking with period + periods = [ + Period("2012-01"), + Period("2012-02"), + Period("2012-03"), + Period("2012-04"), + ] + data = Series(periods) + data.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + result = data.unstack() + expected = DataFrame( + {"a": [periods[0], None, periods[3]], "b": [periods[1], periods[2], None]}, + index=["x", "y", "z"], + ) + tm.assert_frame_equal(result, expected) + + result = data.unstack(fill_value=periods[1]) + expected = DataFrame( + { + "a": [periods[0], periods[1], periods[3]], + "b": [periods[1], periods[2], periods[1]], + }, + index=["x", "y", "z"], + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_fill_frame_categorical(self): + # Test unstacking with categorical + data = Series(["a", "b", "c", "a"], dtype="category") + data.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + # By default missing values will be NaN + result = data.unstack() + expected = DataFrame( + { + "a": pd.Categorical(list("axa"), categories=list("abc")), + "b": pd.Categorical(list("bcx"), categories=list("abc")), + }, + index=list("xyz"), + ) + tm.assert_frame_equal(result, expected) + + # Fill with non-category results in a ValueError + msg = r"Cannot setitem on a Categorical with a new category \(d\)" + with pytest.raises(TypeError, match=msg): + data.unstack(fill_value="d") + + # Fill with category value replaces missing values as expected + result = data.unstack(fill_value="c") + expected = DataFrame( + { + "a": pd.Categorical(list("aca"), categories=list("abc")), + "b": pd.Categorical(list("bcc"), categories=list("abc")), + }, + index=list("xyz"), + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_tuplename_in_multiindex(self): + # GH 19966 + idx = MultiIndex.from_product( + [["a", "b", "c"], [1, 2, 3]], names=[("A", "a"), ("B", "b")] + ) + df = DataFrame({"d": [1] * 9, "e": [2] * 9}, index=idx) + result = df.unstack(("A", "a")) + + expected = DataFrame( + [[1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2]], + columns=MultiIndex.from_tuples( + [ + ("d", "a"), + ("d", "b"), + ("d", "c"), + ("e", "a"), + ("e", "b"), + ("e", "c"), + ], + names=[None, ("A", "a")], + ), + index=Index([1, 2, 3], name=("B", "b")), + ) + tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize( + "unstack_idx, expected_values, expected_index, expected_columns", + [ + ( + ("A", "a"), + [[1, 1, 2, 2], [1, 1, 2, 2], [1, 1, 2, 2], [1, 1, 2, 2]], + MultiIndex.from_tuples( + [(1, 3), (1, 4), (2, 3), (2, 4)], names=["B", "C"] + ), + MultiIndex.from_tuples( + [("d", "a"), ("d", "b"), ("e", "a"), ("e", "b")], + names=[None, ("A", "a")], + ), + ), + ( + (("A", "a"), "B"), + [[1, 1, 1, 1, 2, 2, 2, 2], [1, 1, 1, 1, 2, 2, 2, 2]], + Index([3, 4], name="C"), + MultiIndex.from_tuples( + [ + ("d", "a", 1), + ("d", "a", 2), + ("d", "b", 1), + ("d", "b", 2), + ("e", "a", 1), + ("e", "a", 2), + ("e", "b", 1), + ("e", "b", 2), + ], + names=[None, ("A", "a"), "B"], + ), + ), + ], + ) + def test_unstack_mixed_type_name_in_multiindex( + self, unstack_idx, expected_values, expected_index, expected_columns + ): + # GH 19966 + idx = MultiIndex.from_product( + [["a", "b"], [1, 2], [3, 4]], names=[("A", "a"), "B", "C"] + ) + df = DataFrame({"d": [1] * 8, "e": [2] * 8}, index=idx) + result = df.unstack(unstack_idx) + + expected = DataFrame( + expected_values, columns=expected_columns, index=expected_index + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_preserve_dtypes(self): + # Checks fix for #11847 + df = DataFrame( + { + "state": ["IL", "MI", "NC"], + "index": ["a", "b", "c"], + "some_categories": Series(["a", "b", "c"]).astype("category"), + "A": np.random.default_rng(2).random(3), + "B": 1, + "C": "foo", + "D": pd.Timestamp("20010102"), + "E": Series([1.0, 50.0, 100.0]).astype("float32"), + "F": Series([3.0, 4.0, 5.0]).astype("float64"), + "G": False, + "H": Series([1, 200, 923442]).astype("int8"), + } + ) + + def unstack_and_compare(df, column_name): + unstacked1 = df.unstack([column_name]) + unstacked2 = df.unstack(column_name) + tm.assert_frame_equal(unstacked1, unstacked2) + + df1 = df.set_index(["state", "index"]) + unstack_and_compare(df1, "index") + + df1 = df.set_index(["state", "some_categories"]) + unstack_and_compare(df1, "some_categories") + + df1 = df.set_index(["F", "C"]) + unstack_and_compare(df1, "F") + + df1 = df.set_index(["G", "B", "state"]) + unstack_and_compare(df1, "B") + + df1 = df.set_index(["E", "A"]) + unstack_and_compare(df1, "E") + + df1 = df.set_index(["state", "index"]) + s = df1["A"] + unstack_and_compare(s, "index") + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_ints(self, future_stack): + columns = MultiIndex.from_tuples(list(itertools.product(range(3), repeat=3))) + df = DataFrame( + np.random.default_rng(2).standard_normal((30, 27)), columns=columns + ) + + tm.assert_frame_equal( + df.stack(level=[1, 2], future_stack=future_stack), + df.stack(level=1, future_stack=future_stack).stack( + level=1, future_stack=future_stack + ), + ) + tm.assert_frame_equal( + df.stack(level=[-2, -1], future_stack=future_stack), + df.stack(level=1, future_stack=future_stack).stack( + level=1, future_stack=future_stack + ), + ) + + df_named = df.copy() + return_value = df_named.columns.set_names(range(3), inplace=True) + assert return_value is None + + tm.assert_frame_equal( + df_named.stack(level=[1, 2], future_stack=future_stack), + df_named.stack(level=1, future_stack=future_stack).stack( + level=1, future_stack=future_stack + ), + ) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_mixed_levels(self, future_stack): + columns = MultiIndex.from_tuples( + [ + ("A", "cat", "long"), + ("B", "cat", "long"), + ("A", "dog", "short"), + ("B", "dog", "short"), + ], + names=["exp", "animal", "hair_length"], + ) + df = DataFrame( + np.random.default_rng(2).standard_normal((4, 4)), columns=columns + ) + + animal_hair_stacked = df.stack( + level=["animal", "hair_length"], future_stack=future_stack + ) + exp_hair_stacked = df.stack( + level=["exp", "hair_length"], future_stack=future_stack + ) + + # GH #8584: Need to check that stacking works when a number + # is passed that is both a level name and in the range of + # the level numbers + df2 = df.copy() + df2.columns.names = ["exp", "animal", 1] + tm.assert_frame_equal( + df2.stack(level=["animal", 1], future_stack=future_stack), + animal_hair_stacked, + check_names=False, + ) + tm.assert_frame_equal( + df2.stack(level=["exp", 1], future_stack=future_stack), + exp_hair_stacked, + check_names=False, + ) + + # When mixed types are passed and the ints are not level + # names, raise + msg = ( + "level should contain all level names or all level numbers, not " + "a mixture of the two" + ) + with pytest.raises(ValueError, match=msg): + df2.stack(level=["animal", 0], future_stack=future_stack) + + # GH #8584: Having 0 in the level names could raise a + # strange error about lexsort depth + df3 = df.copy() + df3.columns.names = ["exp", "animal", 0] + tm.assert_frame_equal( + df3.stack(level=["animal", 0], future_stack=future_stack), + animal_hair_stacked, + check_names=False, + ) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_int_level_names(self, future_stack): + columns = MultiIndex.from_tuples( + [ + ("A", "cat", "long"), + ("B", "cat", "long"), + ("A", "dog", "short"), + ("B", "dog", "short"), + ], + names=["exp", "animal", "hair_length"], + ) + df = DataFrame( + np.random.default_rng(2).standard_normal((4, 4)), columns=columns + ) + + exp_animal_stacked = df.stack( + level=["exp", "animal"], future_stack=future_stack + ) + animal_hair_stacked = df.stack( + level=["animal", "hair_length"], future_stack=future_stack + ) + exp_hair_stacked = df.stack( + level=["exp", "hair_length"], future_stack=future_stack + ) + + df2 = df.copy() + df2.columns.names = [0, 1, 2] + tm.assert_frame_equal( + df2.stack(level=[1, 2], future_stack=future_stack), + animal_hair_stacked, + check_names=False, + ) + tm.assert_frame_equal( + df2.stack(level=[0, 1], future_stack=future_stack), + exp_animal_stacked, + check_names=False, + ) + tm.assert_frame_equal( + df2.stack(level=[0, 2], future_stack=future_stack), + exp_hair_stacked, + check_names=False, + ) + + # Out-of-order int column names + df3 = df.copy() + df3.columns.names = [2, 0, 1] + tm.assert_frame_equal( + df3.stack(level=[0, 1], future_stack=future_stack), + animal_hair_stacked, + check_names=False, + ) + tm.assert_frame_equal( + df3.stack(level=[2, 0], future_stack=future_stack), + exp_animal_stacked, + check_names=False, + ) + tm.assert_frame_equal( + df3.stack(level=[2, 1], future_stack=future_stack), + exp_hair_stacked, + check_names=False, + ) + + def test_unstack_bool(self): + df = DataFrame( + [False, False], + index=MultiIndex.from_arrays([["a", "b"], ["c", "l"]]), + columns=["col"], + ) + rs = df.unstack() + xp = DataFrame( + np.array([[False, np.nan], [np.nan, False]], dtype=object), + index=["a", "b"], + columns=MultiIndex.from_arrays([["col", "col"], ["c", "l"]]), + ) + tm.assert_frame_equal(rs, xp) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_unstack_level_binding(self, future_stack): + # GH9856 + mi = MultiIndex( + levels=[["foo", "bar"], ["one", "two"], ["a", "b"]], + codes=[[0, 0, 1, 1], [0, 1, 0, 1], [1, 0, 1, 0]], + names=["first", "second", "third"], + ) + s = Series(0, index=mi) + result = s.unstack([1, 2]).stack(0, future_stack=future_stack) + + expected_mi = MultiIndex( + levels=[["foo", "bar"], ["one", "two"]], + codes=[[0, 0, 1, 1], [0, 1, 0, 1]], + names=["first", "second"], + ) + + expected = DataFrame( + np.array( + [[0, np.nan], [np.nan, 0], [0, np.nan], [np.nan, 0]], dtype=np.float64 + ), + index=expected_mi, + columns=Index(["b", "a"], name="third"), + ) + + tm.assert_frame_equal(result, expected) + + def test_unstack_to_series(self, float_frame): + # check reversibility + data = float_frame.unstack() + + assert isinstance(data, Series) + undo = data.unstack().T + tm.assert_frame_equal(undo, float_frame) + + # check NA handling + data = DataFrame({"x": [1, 2, np.nan], "y": [3.0, 4, np.nan]}) + data.index = Index(["a", "b", "c"]) + result = data.unstack() + + midx = MultiIndex( + levels=[["x", "y"], ["a", "b", "c"]], + codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]], + ) + expected = Series([1, 2, np.nan, 3, 4, np.nan], index=midx) + + tm.assert_series_equal(result, expected) + + # check composability of unstack + old_data = data.copy() + for _ in range(4): + data = data.unstack() + tm.assert_frame_equal(old_data, data) + + def test_unstack_dtypes(self, using_infer_string): + # GH 2929 + rows = [[1, 1, 3, 4], [1, 2, 3, 4], [2, 1, 3, 4], [2, 2, 3, 4]] + + df = DataFrame(rows, columns=list("ABCD")) + result = df.dtypes + expected = Series([np.dtype("int64")] * 4, index=list("ABCD")) + tm.assert_series_equal(result, expected) + + # single dtype + df2 = df.set_index(["A", "B"]) + df3 = df2.unstack("B") + result = df3.dtypes + expected = Series( + [np.dtype("int64")] * 4, + index=MultiIndex.from_arrays( + [["C", "C", "D", "D"], [1, 2, 1, 2]], names=(None, "B") + ), + ) + tm.assert_series_equal(result, expected) + + # mixed + df2 = df.set_index(["A", "B"]) + df2["C"] = 3.0 + df3 = df2.unstack("B") + result = df3.dtypes + expected = Series( + [np.dtype("float64")] * 2 + [np.dtype("int64")] * 2, + index=MultiIndex.from_arrays( + [["C", "C", "D", "D"], [1, 2, 1, 2]], names=(None, "B") + ), + ) + tm.assert_series_equal(result, expected) + df2["D"] = "foo" + df3 = df2.unstack("B") + result = df3.dtypes + dtype = ( + pd.StringDtype(na_value=np.nan) + if using_infer_string + else np.dtype("object") + ) + expected = Series( + [np.dtype("float64")] * 2 + [dtype] * 2, + index=MultiIndex.from_arrays( + [["C", "C", "D", "D"], [1, 2, 1, 2]], names=(None, "B") + ), + ) + tm.assert_series_equal(result, expected) + + @pytest.mark.parametrize( + "c, d", + ( + (np.zeros(5), np.zeros(5)), + (np.arange(5, dtype="f8"), np.arange(5, 10, dtype="f8")), + ), + ) + def test_unstack_dtypes_mixed_date(self, c, d): + # GH7405 + df = DataFrame( + { + "A": ["a"] * 5, + "C": c, + "D": d, + "B": date_range("2012-01-01", periods=5), + } + ) + + right = df.iloc[:3].copy(deep=True) + + df = df.set_index(["A", "B"]) + df["D"] = df["D"].astype("int64") + + left = df.iloc[:3].unstack(0) + right = right.set_index(["A", "B"]).unstack(0) + right[("D", "a")] = right[("D", "a")].astype("int64") + + assert left.shape == (3, 2) + tm.assert_frame_equal(left, right) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_unstack_non_unique_index_names(self, future_stack): + idx = MultiIndex.from_tuples([("a", "b"), ("c", "d")], names=["c1", "c1"]) + df = DataFrame([1, 2], index=idx) + msg = "The name c1 occurs multiple times, use a level number" + with pytest.raises(ValueError, match=msg): + df.unstack("c1") + + with pytest.raises(ValueError, match=msg): + df.T.stack("c1", future_stack=future_stack) + + def test_unstack_unused_levels(self): + # GH 17845: unused codes in index make unstack() cast int to float + idx = MultiIndex.from_product([["a"], ["A", "B", "C", "D"]])[:-1] + df = DataFrame([[1, 0]] * 3, index=idx) + + result = df.unstack() + exp_col = MultiIndex.from_product([[0, 1], ["A", "B", "C"]]) + expected = DataFrame([[1, 1, 1, 0, 0, 0]], index=["a"], columns=exp_col) + tm.assert_frame_equal(result, expected) + assert (result.columns.levels[1] == idx.levels[1]).all() + + # Unused items on both levels + levels = [[0, 1, 7], [0, 1, 2, 3]] + codes = [[0, 0, 1, 1], [0, 2, 0, 2]] + idx = MultiIndex(levels, codes) + block = np.arange(4).reshape(2, 2) + df = DataFrame(np.concatenate([block, block + 4]), index=idx) + result = df.unstack() + expected = DataFrame( + np.concatenate([block * 2, block * 2 + 1], axis=1), columns=idx + ) + tm.assert_frame_equal(result, expected) + assert (result.columns.levels[1] == idx.levels[1]).all() + + @pytest.mark.parametrize( + "level, idces, col_level, idx_level", + ( + (0, [13, 16, 6, 9, 2, 5, 8, 11], [np.nan, "a", 2], [np.nan, 5, 1]), + (1, [8, 11, 1, 4, 12, 15, 13, 16], [np.nan, 5, 1], [np.nan, "a", 2]), + ), + ) + def test_unstack_unused_levels_mixed_with_nan( + self, level, idces, col_level, idx_level + ): + # With mixed dtype and NaN + levels = [["a", 2, "c"], [1, 3, 5, 7]] + codes = [[0, -1, 1, 1], [0, 2, -1, 2]] + idx = MultiIndex(levels, codes) + data = np.arange(8) + df = DataFrame(data.reshape(4, 2), index=idx) + + result = df.unstack(level=level) + exp_data = np.zeros(18) * np.nan + exp_data[idces] = data + cols = MultiIndex.from_product([[0, 1], col_level]) + expected = DataFrame(exp_data.reshape(3, 6), index=idx_level, columns=cols) + tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize("cols", [["A", "C"], slice(None)]) + def test_unstack_unused_level(self, cols): + # GH 18562 : unused codes on the unstacked level + df = DataFrame([[2010, "a", "I"], [2011, "b", "II"]], columns=["A", "B", "C"]) + + ind = df.set_index(["A", "B", "C"], drop=False) + selection = ind.loc[(slice(None), slice(None), "I"), cols] + result = selection.unstack() + + expected = ind.iloc[[0]][cols] + expected.columns = MultiIndex.from_product( + [expected.columns, ["I"]], names=[None, "C"] + ) + expected.index = expected.index.droplevel("C") + tm.assert_frame_equal(result, expected) + + def test_unstack_long_index(self): + # PH 32624: Error when using a lot of indices to unstack. + # The error occurred only, if a lot of indices are used. + df = DataFrame( + [[1]], + columns=MultiIndex.from_tuples([[0]], names=["c1"]), + index=MultiIndex.from_tuples( + [[0, 0, 1, 0, 0, 0, 1]], + names=["i1", "i2", "i3", "i4", "i5", "i6", "i7"], + ), + ) + result = df.unstack(["i2", "i3", "i4", "i5", "i6", "i7"]) + expected = DataFrame( + [[1]], + columns=MultiIndex.from_tuples( + [[0, 0, 1, 0, 0, 0, 1]], + names=["c1", "i2", "i3", "i4", "i5", "i6", "i7"], + ), + index=Index([0], name="i1"), + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_multi_level_cols(self): + # PH 24729: Unstack a df with multi level columns + df = DataFrame( + [[0.0, 0.0], [0.0, 0.0]], + columns=MultiIndex.from_tuples( + [["B", "C"], ["B", "D"]], names=["c1", "c2"] + ), + index=MultiIndex.from_tuples( + [[10, 20, 30], [10, 20, 40]], names=["i1", "i2", "i3"] + ), + ) + assert df.unstack(["i2", "i1"]).columns.names[-2:] == ["i2", "i1"] + + def test_unstack_multi_level_rows_and_cols(self): + # PH 28306: Unstack df with multi level cols and rows + df = DataFrame( + [[1, 2], [3, 4], [-1, -2], [-3, -4]], + columns=MultiIndex.from_tuples([["a", "b", "c"], ["d", "e", "f"]]), + index=MultiIndex.from_tuples( + [ + ["m1", "P3", 222], + ["m1", "A5", 111], + ["m2", "P3", 222], + ["m2", "A5", 111], + ], + names=["i1", "i2", "i3"], + ), + ) + result = df.unstack(["i3", "i2"]) + expected = df.unstack(["i3"]).unstack(["i2"]) + tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize("idx", [("jim", "joe"), ("joe", "jim")]) + @pytest.mark.parametrize("lev", list(range(2))) + def test_unstack_nan_index1(self, idx, lev): + # GH7466 + def cast(val): + val_str = "" if val != val else val + return f"{val_str:1}" + + df = DataFrame( + { + "jim": ["a", "b", np.nan, "d"], + "joe": ["w", "x", "y", "z"], + "jolie": ["a.w", "b.x", " .y", "d.z"], + } + ) + + left = df.set_index(["jim", "joe"]).unstack()["jolie"] + right = df.set_index(["joe", "jim"]).unstack()["jolie"].T + tm.assert_frame_equal(left, right) + + mi = df.set_index(list(idx)) + udf = mi.unstack(level=lev) + assert udf.notna().values.sum() == len(df) + mk_list = lambda a: list(a) if isinstance(a, tuple) else [a] + rows, cols = udf["jolie"].notna().values.nonzero() + for i, j in zip(rows, cols): + left = sorted(udf["jolie"].iloc[i, j].split(".")) + right = mk_list(udf["jolie"].index[i]) + mk_list(udf["jolie"].columns[j]) + right = sorted(map(cast, right)) + assert left == right + + @pytest.mark.parametrize("idx", itertools.permutations(["1st", "2nd", "3rd"])) + @pytest.mark.parametrize("lev", list(range(3))) + @pytest.mark.parametrize("col", ["4th", "5th"]) + def test_unstack_nan_index_repeats(self, idx, lev, col): + def cast(val): + val_str = "" if val != val else val + return f"{val_str:1}" + + df = DataFrame( + { + "1st": ["d"] * 3 + + [np.nan] * 5 + + ["a"] * 2 + + ["c"] * 3 + + ["e"] * 2 + + ["b"] * 5, + "2nd": ["y"] * 2 + + ["w"] * 3 + + [np.nan] * 3 + + ["z"] * 4 + + [np.nan] * 3 + + ["x"] * 3 + + [np.nan] * 2, + "3rd": [ + 67, + 39, + 53, + 72, + 57, + 80, + 31, + 18, + 11, + 30, + 59, + 50, + 62, + 59, + 76, + 52, + 14, + 53, + 60, + 51, + ], + } + ) + + df["4th"], df["5th"] = ( + df.apply(lambda r: ".".join(map(cast, r)), axis=1), + df.apply(lambda r: ".".join(map(cast, r.iloc[::-1])), axis=1), + ) + + mi = df.set_index(list(idx)) + udf = mi.unstack(level=lev) + assert udf.notna().values.sum() == 2 * len(df) + mk_list = lambda a: list(a) if isinstance(a, tuple) else [a] + rows, cols = udf[col].notna().values.nonzero() + for i, j in zip(rows, cols): + left = sorted(udf[col].iloc[i, j].split(".")) + right = mk_list(udf[col].index[i]) + mk_list(udf[col].columns[j]) + right = sorted(map(cast, right)) + assert left == right + + def test_unstack_nan_index2(self): + # GH7403 + df = DataFrame({"A": list("aaaabbbb"), "B": range(8), "C": range(8)}) + # Explicit cast to avoid implicit cast when setting to np.nan + df = df.astype({"B": "float"}) + df.iloc[3, 1] = np.nan + left = df.set_index(["A", "B"]).unstack(0) + + vals = [ + [3, 0, 1, 2, np.nan, np.nan, np.nan, np.nan], + [np.nan, np.nan, np.nan, np.nan, 4, 5, 6, 7], + ] + vals = list(map(list, zip(*vals))) + idx = Index([np.nan, 0, 1, 2, 4, 5, 6, 7], name="B") + cols = MultiIndex( + levels=[["C"], ["a", "b"]], codes=[[0, 0], [0, 1]], names=[None, "A"] + ) + + right = DataFrame(vals, columns=cols, index=idx) + tm.assert_frame_equal(left, right) + + df = DataFrame({"A": list("aaaabbbb"), "B": list(range(4)) * 2, "C": range(8)}) + # Explicit cast to avoid implicit cast when setting to np.nan + df = df.astype({"B": "float"}) + df.iloc[2, 1] = np.nan + left = df.set_index(["A", "B"]).unstack(0) + + vals = [[2, np.nan], [0, 4], [1, 5], [np.nan, 6], [3, 7]] + cols = MultiIndex( + levels=[["C"], ["a", "b"]], codes=[[0, 0], [0, 1]], names=[None, "A"] + ) + idx = Index([np.nan, 0, 1, 2, 3], name="B") + right = DataFrame(vals, columns=cols, index=idx) + tm.assert_frame_equal(left, right) + + df = DataFrame({"A": list("aaaabbbb"), "B": list(range(4)) * 2, "C": range(8)}) + # Explicit cast to avoid implicit cast when setting to np.nan + df = df.astype({"B": "float"}) + df.iloc[3, 1] = np.nan + left = df.set_index(["A", "B"]).unstack(0) + + vals = [[3, np.nan], [0, 4], [1, 5], [2, 6], [np.nan, 7]] + cols = MultiIndex( + levels=[["C"], ["a", "b"]], codes=[[0, 0], [0, 1]], names=[None, "A"] + ) + idx = Index([np.nan, 0, 1, 2, 3], name="B") + right = DataFrame(vals, columns=cols, index=idx) + tm.assert_frame_equal(left, right) + + def test_unstack_nan_index3(self, using_array_manager): + # GH7401 + df = DataFrame( + { + "A": list("aaaaabbbbb"), + "B": (date_range("2012-01-01", periods=5).tolist() * 2), + "C": np.arange(10), + } + ) + + df.iloc[3, 1] = np.nan + left = df.set_index(["A", "B"]).unstack() + + vals = np.array([[3, 0, 1, 2, np.nan, 4], [np.nan, 5, 6, 7, 8, 9]]) + idx = Index(["a", "b"], name="A") + cols = MultiIndex( + levels=[["C"], date_range("2012-01-01", periods=5)], + codes=[[0, 0, 0, 0, 0, 0], [-1, 0, 1, 2, 3, 4]], + names=[None, "B"], + ) + + right = DataFrame(vals, columns=cols, index=idx) + if using_array_manager: + # INFO(ArrayManager) with ArrayManager preserve dtype where possible + cols = right.columns[[1, 2, 3, 5]] + right[cols] = right[cols].astype(df["C"].dtype) + tm.assert_frame_equal(left, right) + + def test_unstack_nan_index4(self): + # GH4862 + vals = [ + ["Hg", np.nan, np.nan, 680585148], + ["U", 0.0, np.nan, 680585148], + ["Pb", 7.07e-06, np.nan, 680585148], + ["Sn", 2.3614e-05, 0.0133, 680607017], + ["Ag", 0.0, 0.0133, 680607017], + ["Hg", -0.00015, 0.0133, 680607017], + ] + df = DataFrame( + vals, + columns=["agent", "change", "dosage", "s_id"], + index=[17263, 17264, 17265, 17266, 17267, 17268], + ) + + left = df.copy().set_index(["s_id", "dosage", "agent"]).unstack() + + vals = [ + [np.nan, np.nan, 7.07e-06, np.nan, 0.0], + [0.0, -0.00015, np.nan, 2.3614e-05, np.nan], + ] + + idx = MultiIndex( + levels=[[680585148, 680607017], [0.0133]], + codes=[[0, 1], [-1, 0]], + names=["s_id", "dosage"], + ) + + cols = MultiIndex( + levels=[["change"], ["Ag", "Hg", "Pb", "Sn", "U"]], + codes=[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4]], + names=[None, "agent"], + ) + + right = DataFrame(vals, columns=cols, index=idx) + tm.assert_frame_equal(left, right) + + left = df.loc[17264:].copy().set_index(["s_id", "dosage", "agent"]) + tm.assert_frame_equal(left.unstack(), right) + + def test_unstack_nan_index5(self): + # GH9497 - multiple unstack with nulls + df = DataFrame( + { + "1st": [1, 2, 1, 2, 1, 2], + "2nd": date_range("2014-02-01", periods=6, freq="D"), + "jim": 100 + np.arange(6), + "joe": (np.random.default_rng(2).standard_normal(6) * 10).round(2), + } + ) + + df["3rd"] = df["2nd"] - pd.Timestamp("2014-02-02") + df.loc[1, "2nd"] = df.loc[3, "2nd"] = np.nan + df.loc[1, "3rd"] = df.loc[4, "3rd"] = np.nan + + left = df.set_index(["1st", "2nd", "3rd"]).unstack(["2nd", "3rd"]) + assert left.notna().values.sum() == 2 * len(df) + + for col in ["jim", "joe"]: + for _, r in df.iterrows(): + key = r["1st"], (col, r["2nd"], r["3rd"]) + assert r[col] == left.loc[key] + + def test_stack_datetime_column_multiIndex(self, future_stack): + # GH 8039 + t = datetime(2014, 1, 1) + df = DataFrame([1, 2, 3, 4], columns=MultiIndex.from_tuples([(t, "A", "B")])) + warn = None if future_stack else FutureWarning + msg = "The previous implementation of stack is deprecated" + with tm.assert_produces_warning(warn, match=msg): + result = df.stack(future_stack=future_stack) + + eidx = MultiIndex.from_product([(0, 1, 2, 3), ("B",)]) + ecols = MultiIndex.from_tuples([(t, "A")]) + expected = DataFrame([1, 2, 3, 4], index=eidx, columns=ecols) + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + @pytest.mark.parametrize( + "multiindex_columns", + [ + [0, 1, 2, 3, 4], + [0, 1, 2, 3], + [0, 1, 2, 4], + [0, 1, 2], + [1, 2, 3], + [2, 3, 4], + [0, 1], + [0, 2], + [0, 3], + [0], + [2], + [4], + [4, 3, 2, 1, 0], + [3, 2, 1, 0], + [4, 2, 1, 0], + [2, 1, 0], + [3, 2, 1], + [4, 3, 2], + [1, 0], + [2, 0], + [3, 0], + ], + ) + @pytest.mark.parametrize("level", (-1, 0, 1, [0, 1], [1, 0])) + def test_stack_partial_multiIndex(self, multiindex_columns, level, future_stack): + # GH 8844 + dropna = False if not future_stack else lib.no_default + full_multiindex = MultiIndex.from_tuples( + [("B", "x"), ("B", "z"), ("A", "y"), ("C", "x"), ("C", "u")], + names=["Upper", "Lower"], + ) + multiindex = full_multiindex[multiindex_columns] + df = DataFrame( + np.arange(3 * len(multiindex)).reshape(3, len(multiindex)), + columns=multiindex, + ) + result = df.stack(level=level, dropna=dropna, future_stack=future_stack) + + if isinstance(level, int) and not future_stack: + # Stacking a single level should not make any all-NaN rows, + # so df.stack(level=level, dropna=False) should be the same + # as df.stack(level=level, dropna=True). + expected = df.stack(level=level, dropna=True, future_stack=future_stack) + if isinstance(expected, Series): + tm.assert_series_equal(result, expected) + else: + tm.assert_frame_equal(result, expected) + + df.columns = MultiIndex.from_tuples( + df.columns.to_numpy(), names=df.columns.names + ) + expected = df.stack(level=level, dropna=dropna, future_stack=future_stack) + if isinstance(expected, Series): + tm.assert_series_equal(result, expected) + else: + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_full_multiIndex(self, future_stack): + # GH 8844 + full_multiindex = MultiIndex.from_tuples( + [("B", "x"), ("B", "z"), ("A", "y"), ("C", "x"), ("C", "u")], + names=["Upper", "Lower"], + ) + df = DataFrame(np.arange(6).reshape(2, 3), columns=full_multiindex[[0, 1, 3]]) + dropna = False if not future_stack else lib.no_default + result = df.stack(dropna=dropna, future_stack=future_stack) + expected = DataFrame( + [[0, 2], [1, np.nan], [3, 5], [4, np.nan]], + index=MultiIndex( + levels=[[0, 1], ["u", "x", "y", "z"]], + codes=[[0, 0, 1, 1], [1, 3, 1, 3]], + names=[None, "Lower"], + ), + columns=Index(["B", "C"], name="Upper"), + ) + expected["B"] = expected["B"].astype(df.dtypes.iloc[0]) + tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize("ordered", [False, True]) + def test_stack_preserve_categorical_dtype(self, ordered, future_stack): + # GH13854 + cidx = pd.CategoricalIndex(list("yxz"), categories=list("xyz"), ordered=ordered) + df = DataFrame([[10, 11, 12]], columns=cidx) + result = df.stack(future_stack=future_stack) + + # `MultiIndex.from_product` preserves categorical dtype - + # it's tested elsewhere. + midx = MultiIndex.from_product([df.index, cidx]) + expected = Series([10, 11, 12], index=midx) + + tm.assert_series_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + @pytest.mark.parametrize("ordered", [False, True]) + @pytest.mark.parametrize( + "labels,data", + [ + (list("xyz"), [10, 11, 12, 13, 14, 15]), + (list("zyx"), [14, 15, 12, 13, 10, 11]), + ], + ) + def test_stack_multi_preserve_categorical_dtype( + self, ordered, labels, data, future_stack + ): + # GH-36991 + cidx = pd.CategoricalIndex(labels, categories=sorted(labels), ordered=ordered) + cidx2 = pd.CategoricalIndex(["u", "v"], ordered=ordered) + midx = MultiIndex.from_product([cidx, cidx2]) + df = DataFrame([sorted(data)], columns=midx) + result = df.stack([0, 1], future_stack=future_stack) + + labels = labels if future_stack else sorted(labels) + s_cidx = pd.CategoricalIndex(labels, ordered=ordered) + expected_data = sorted(data) if future_stack else data + expected = Series( + expected_data, index=MultiIndex.from_product([[0], s_cidx, cidx2]) + ) + + tm.assert_series_equal(result, expected) + + def test_stack_preserve_categorical_dtype_values(self, future_stack): + # GH-23077 + cat = pd.Categorical(["a", "a", "b", "c"]) + df = DataFrame({"A": cat, "B": cat}) + result = df.stack(future_stack=future_stack) + index = MultiIndex.from_product([[0, 1, 2, 3], ["A", "B"]]) + expected = Series( + pd.Categorical(["a", "a", "a", "a", "b", "b", "c", "c"]), index=index + ) + tm.assert_series_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + @pytest.mark.filterwarnings("ignore:Downcasting object dtype arrays:FutureWarning") + @pytest.mark.parametrize( + "index, columns", + [ + ([0, 0, 1, 1], MultiIndex.from_product([[1, 2], ["a", "b"]])), + ([0, 0, 2, 3], MultiIndex.from_product([[1, 2], ["a", "b"]])), + ([0, 1, 2, 3], MultiIndex.from_product([[1, 2], ["a", "b"]])), + ], + ) + def test_stack_multi_columns_non_unique_index(self, index, columns, future_stack): + # GH-28301 + + df = DataFrame(index=index, columns=columns).fillna(1) + stacked = df.stack(future_stack=future_stack) + new_index = MultiIndex.from_tuples(stacked.index.to_numpy()) + expected = DataFrame( + stacked.to_numpy(), index=new_index, columns=stacked.columns + ) + tm.assert_frame_equal(stacked, expected) + stacked_codes = np.asarray(stacked.index.codes) + expected_codes = np.asarray(new_index.codes) + tm.assert_numpy_array_equal(stacked_codes, expected_codes) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + @pytest.mark.parametrize( + "vals1, vals2, dtype1, dtype2, expected_dtype", + [ + ([1, 2], [3.0, 4.0], "Int64", "Float64", "Float64"), + ([1, 2], ["foo", "bar"], "Int64", "string", "object"), + ], + ) + def test_stack_multi_columns_mixed_extension_types( + self, vals1, vals2, dtype1, dtype2, expected_dtype, future_stack + ): + # GH45740 + df = DataFrame( + { + ("A", 1): Series(vals1, dtype=dtype1), + ("A", 2): Series(vals2, dtype=dtype2), + } + ) + result = df.stack(future_stack=future_stack) + expected = ( + df.astype(object).stack(future_stack=future_stack).astype(expected_dtype) + ) + tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize("level", [0, 1]) + def test_unstack_mixed_extension_types(self, level): + index = MultiIndex.from_tuples([("A", 0), ("A", 1), ("B", 1)], names=["a", "b"]) + df = DataFrame( + { + "A": pd.array([0, 1, None], dtype="Int64"), + "B": pd.Categorical(["a", "a", "b"]), + }, + index=index, + ) + + result = df.unstack(level=level) + expected = df.astype(object).unstack(level=level) + if level == 0: + expected[("A", "B")] = expected[("A", "B")].fillna(pd.NA) + else: + expected[("A", 0)] = expected[("A", 0)].fillna(pd.NA) + + expected_dtypes = Series( + [df.A.dtype] * 2 + [df.B.dtype] * 2, index=result.columns + ) + tm.assert_series_equal(result.dtypes, expected_dtypes) + tm.assert_frame_equal(result.astype(object), expected) + + @pytest.mark.parametrize("level", [0, "baz"]) + def test_unstack_swaplevel_sortlevel(self, level): + # GH 20994 + mi = MultiIndex.from_product([[0], ["d", "c"]], names=["bar", "baz"]) + df = DataFrame([[0, 2], [1, 3]], index=mi, columns=["B", "A"]) + df.columns.name = "foo" + + expected = DataFrame( + [[3, 1, 2, 0]], + columns=MultiIndex.from_tuples( + [("c", "A"), ("c", "B"), ("d", "A"), ("d", "B")], names=["baz", "foo"] + ), + ) + expected.index.name = "bar" + + result = df.unstack().swaplevel(axis=1).sort_index(axis=1, level=level) + tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize("dtype", ["float64", "Float64"]) +def test_unstack_sort_false(frame_or_series, dtype): + # GH 15105 + index = MultiIndex.from_tuples( + [("two", "z", "b"), ("two", "y", "a"), ("one", "z", "b"), ("one", "y", "a")] + ) + obj = frame_or_series(np.arange(1.0, 5.0), index=index, dtype=dtype) + result = obj.unstack(level=-1, sort=False) + + if frame_or_series is DataFrame: + expected_columns = MultiIndex.from_tuples([(0, "b"), (0, "a")]) + else: + expected_columns = ["b", "a"] + expected = DataFrame( + [[1.0, np.nan], [np.nan, 2.0], [3.0, np.nan], [np.nan, 4.0]], + columns=expected_columns, + index=MultiIndex.from_tuples( + [("two", "z"), ("two", "y"), ("one", "z"), ("one", "y")] + ), + dtype=dtype, + ) + tm.assert_frame_equal(result, expected) + + result = obj.unstack(level=[1, 2], sort=False) + + if frame_or_series is DataFrame: + expected_columns = MultiIndex.from_tuples([(0, "z", "b"), (0, "y", "a")]) + else: + expected_columns = MultiIndex.from_tuples([("z", "b"), ("y", "a")]) + expected = DataFrame( + [[1.0, 2.0], [3.0, 4.0]], + index=["two", "one"], + columns=expected_columns, + dtype=dtype, + ) + tm.assert_frame_equal(result, expected) + + +def test_unstack_fill_frame_object(): + # GH12815 Test unstacking with object. + data = Series(["a", "b", "c", "a"], dtype="object") + data.index = MultiIndex.from_tuples( + [("x", "a"), ("x", "b"), ("y", "b"), ("z", "a")] + ) + + # By default missing values will be NaN + result = data.unstack() + expected = DataFrame( + {"a": ["a", np.nan, "a"], "b": ["b", "c", np.nan]}, + index=list("xyz"), + dtype=object, + ) + tm.assert_frame_equal(result, expected) + + # Fill with any value replaces missing values as expected + result = data.unstack(fill_value="d") + expected = DataFrame( + {"a": ["a", "d", "a"], "b": ["b", "c", "d"]}, index=list("xyz"), dtype=object + ) + tm.assert_frame_equal(result, expected) + + +def test_unstack_timezone_aware_values(): + # GH 18338 + df = DataFrame( + { + "timestamp": [pd.Timestamp("2017-08-27 01:00:00.709949+0000", tz="UTC")], + "a": ["a"], + "b": ["b"], + "c": ["c"], + }, + columns=["timestamp", "a", "b", "c"], + ) + result = df.set_index(["a", "b"]).unstack() + expected = DataFrame( + [[pd.Timestamp("2017-08-27 01:00:00.709949+0000", tz="UTC"), "c"]], + index=Index(["a"], name="a"), + columns=MultiIndex( + levels=[["timestamp", "c"], ["b"]], + codes=[[0, 1], [0, 0]], + names=[None, "b"], + ), + ) + tm.assert_frame_equal(result, expected) + + +def test_stack_timezone_aware_values(future_stack): + # GH 19420 + ts = date_range(freq="D", start="20180101", end="20180103", tz="America/New_York") + df = DataFrame({"A": ts}, index=["a", "b", "c"]) + result = df.stack(future_stack=future_stack) + expected = Series( + ts, + index=MultiIndex(levels=[["a", "b", "c"], ["A"]], codes=[[0, 1, 2], [0, 0, 0]]), + ) + tm.assert_series_equal(result, expected) + + +@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated") +@pytest.mark.parametrize("dropna", [True, False, lib.no_default]) +def test_stack_empty_frame(dropna, future_stack): + # GH 36113 + levels = [np.array([], dtype=np.int64), np.array([], dtype=np.int64)] + expected = Series(dtype=np.float64, index=MultiIndex(levels=levels, codes=[[], []])) + if future_stack and dropna is not lib.no_default: + with pytest.raises(ValueError, match="dropna must be unspecified"): + DataFrame(dtype=np.float64).stack(dropna=dropna, future_stack=future_stack) + else: + result = DataFrame(dtype=np.float64).stack( + dropna=dropna, future_stack=future_stack + ) + tm.assert_series_equal(result, expected) + + +@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated") +@pytest.mark.parametrize("dropna", [True, False, lib.no_default]) +@pytest.mark.parametrize("fill_value", [None, 0]) +def test_stack_unstack_empty_frame(dropna, fill_value, future_stack): + # GH 36113 + if future_stack and dropna is not lib.no_default: + with pytest.raises(ValueError, match="dropna must be unspecified"): + DataFrame(dtype=np.int64).stack( + dropna=dropna, future_stack=future_stack + ).unstack(fill_value=fill_value) + else: + result = ( + DataFrame(dtype=np.int64) + .stack(dropna=dropna, future_stack=future_stack) + .unstack(fill_value=fill_value) + ) + expected = DataFrame(dtype=np.int64) + tm.assert_frame_equal(result, expected) + + +def test_unstack_single_index_series(): + # GH 36113 + msg = r"index must be a MultiIndex to unstack.*" + with pytest.raises(ValueError, match=msg): + Series(dtype=np.int64).unstack() + + +def test_unstacking_multi_index_df(): + # see gh-30740 + df = DataFrame( + { + "name": ["Alice", "Bob"], + "score": [9.5, 8], + "employed": [False, True], + "kids": [0, 0], + "gender": ["female", "male"], + } + ) + df = df.set_index(["name", "employed", "kids", "gender"]) + df = df.unstack(["gender"], fill_value=0) + expected = df.unstack("employed", fill_value=0).unstack("kids", fill_value=0) + result = df.unstack(["employed", "kids"], fill_value=0) + expected = DataFrame( + [[9.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 8.0]], + index=Index(["Alice", "Bob"], name="name"), + columns=MultiIndex.from_tuples( + [ + ("score", "female", False, 0), + ("score", "female", True, 0), + ("score", "male", False, 0), + ("score", "male", True, 0), + ], + names=[None, "gender", "employed", "kids"], + ), + ) + tm.assert_frame_equal(result, expected) + + +@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated") +def test_stack_positional_level_duplicate_column_names(future_stack): + # https://github.com/pandas-dev/pandas/issues/36353 + columns = MultiIndex.from_product([("x", "y"), ("y", "z")], names=["a", "a"]) + df = DataFrame([[1, 1, 1, 1]], columns=columns) + result = df.stack(0, future_stack=future_stack) + + new_columns = Index(["y", "z"], name="a") + new_index = MultiIndex.from_tuples([(0, "x"), (0, "y")], names=[None, "a"]) + expected = DataFrame([[1, 1], [1, 1]], index=new_index, columns=new_columns) + + tm.assert_frame_equal(result, expected) + + +def test_unstack_non_slice_like_blocks(using_array_manager): + # Case where the mgr_locs of a DataFrame's underlying blocks are not slice-like + + mi = MultiIndex.from_product([range(5), ["A", "B", "C"]]) + df = DataFrame( + { + 0: np.random.default_rng(2).standard_normal(15), + 1: np.random.default_rng(2).standard_normal(15).astype(np.int64), + 2: np.random.default_rng(2).standard_normal(15), + 3: np.random.default_rng(2).standard_normal(15), + }, + index=mi, + ) + if not using_array_manager: + assert any(not x.mgr_locs.is_slice_like for x in df._mgr.blocks) + + res = df.unstack() + + expected = pd.concat([df[n].unstack() for n in range(4)], keys=range(4), axis=1) + tm.assert_frame_equal(res, expected) + + +@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated") +def test_stack_sort_false(future_stack): + # GH 15105 + data = [[1, 2, 3.0, 4.0], [2, 3, 4.0, 5.0], [3, 4, np.nan, np.nan]] + df = DataFrame( + data, + columns=MultiIndex( + levels=[["B", "A"], ["x", "y"]], codes=[[0, 0, 1, 1], [0, 1, 0, 1]] + ), + ) + kwargs = {} if future_stack else {"sort": False} + result = df.stack(level=0, future_stack=future_stack, **kwargs) + if future_stack: + expected = DataFrame( + { + "x": [1.0, 3.0, 2.0, 4.0, 3.0, np.nan], + "y": [2.0, 4.0, 3.0, 5.0, 4.0, np.nan], + }, + index=MultiIndex.from_arrays( + [[0, 0, 1, 1, 2, 2], ["B", "A", "B", "A", "B", "A"]] + ), + ) + else: + expected = DataFrame( + {"x": [1.0, 3.0, 2.0, 4.0, 3.0], "y": [2.0, 4.0, 3.0, 5.0, 4.0]}, + index=MultiIndex.from_arrays([[0, 0, 1, 1, 2], ["B", "A", "B", "A", "B"]]), + ) + tm.assert_frame_equal(result, expected) + + # Codes sorted in this call + df = DataFrame( + data, + columns=MultiIndex.from_arrays([["B", "B", "A", "A"], ["x", "y", "x", "y"]]), + ) + kwargs = {} if future_stack else {"sort": False} + result = df.stack(level=0, future_stack=future_stack, **kwargs) + tm.assert_frame_equal(result, expected) + + +@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated") +def test_stack_sort_false_multi_level(future_stack): + # GH 15105 + idx = MultiIndex.from_tuples([("weight", "kg"), ("height", "m")]) + df = DataFrame([[1.0, 2.0], [3.0, 4.0]], index=["cat", "dog"], columns=idx) + kwargs = {} if future_stack else {"sort": False} + result = df.stack([0, 1], future_stack=future_stack, **kwargs) + expected_index = MultiIndex.from_tuples( + [ + ("cat", "weight", "kg"), + ("cat", "height", "m"), + ("dog", "weight", "kg"), + ("dog", "height", "m"), + ] + ) + expected = Series([1.0, 2.0, 3.0, 4.0], index=expected_index) + tm.assert_series_equal(result, expected) + + +class TestStackUnstackMultiLevel: + def test_unstack(self, multiindex_year_month_day_dataframe_random_data): + # just check that it works for now + ymd = multiindex_year_month_day_dataframe_random_data + + unstacked = ymd.unstack() + unstacked.unstack() + + # test that ints work + ymd.astype(int).unstack() + + # test that int32 work + ymd.astype(np.int32).unstack() + + @pytest.mark.parametrize( + "result_rows,result_columns,index_product,expected_row", + [ + ( + [[1, 1, None, None, 30.0, None], [2, 2, None, None, 30.0, None]], + ["ix1", "ix2", "col1", "col2", "col3", "col4"], + 2, + [None, None, 30.0, None], + ), + ( + [[1, 1, None, None, 30.0], [2, 2, None, None, 30.0]], + ["ix1", "ix2", "col1", "col2", "col3"], + 2, + [None, None, 30.0], + ), + ( + [[1, 1, None, None, 30.0], [2, None, None, None, 30.0]], + ["ix1", "ix2", "col1", "col2", "col3"], + None, + [None, None, 30.0], + ), + ], + ) + def test_unstack_partial( + self, result_rows, result_columns, index_product, expected_row + ): + # check for regressions on this issue: + # https://github.com/pandas-dev/pandas/issues/19351 + # make sure DataFrame.unstack() works when its run on a subset of the DataFrame + # and the Index levels contain values that are not present in the subset + result = DataFrame(result_rows, columns=result_columns).set_index( + ["ix1", "ix2"] + ) + result = result.iloc[1:2].unstack("ix2") + expected = DataFrame( + [expected_row], + columns=MultiIndex.from_product( + [result_columns[2:], [index_product]], names=[None, "ix2"] + ), + index=Index([2], name="ix1"), + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_multiple_no_empty_columns(self): + index = MultiIndex.from_tuples( + [(0, "foo", 0), (0, "bar", 0), (1, "baz", 1), (1, "qux", 1)] + ) + + s = Series(np.random.default_rng(2).standard_normal(4), index=index) + + unstacked = s.unstack([1, 2]) + expected = unstacked.dropna(axis=1, how="all") + tm.assert_frame_equal(unstacked, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack(self, multiindex_year_month_day_dataframe_random_data, future_stack): + ymd = multiindex_year_month_day_dataframe_random_data + + # regular roundtrip + unstacked = ymd.unstack() + restacked = unstacked.stack(future_stack=future_stack) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + restacked = restacked.dropna(how="all") + tm.assert_frame_equal(restacked, ymd) + + unlexsorted = ymd.sort_index(level=2) + + unstacked = unlexsorted.unstack(2) + restacked = unstacked.stack(future_stack=future_stack) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + restacked = restacked.dropna(how="all") + tm.assert_frame_equal(restacked.sort_index(level=0), ymd) + + unlexsorted = unlexsorted[::-1] + unstacked = unlexsorted.unstack(1) + restacked = unstacked.stack(future_stack=future_stack).swaplevel(1, 2) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + restacked = restacked.dropna(how="all") + tm.assert_frame_equal(restacked.sort_index(level=0), ymd) + + unlexsorted = unlexsorted.swaplevel(0, 1) + unstacked = unlexsorted.unstack(0).swaplevel(0, 1, axis=1) + restacked = unstacked.stack(0, future_stack=future_stack).swaplevel(1, 2) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + restacked = restacked.dropna(how="all") + tm.assert_frame_equal(restacked.sort_index(level=0), ymd) + + # columns unsorted + unstacked = ymd.unstack() + restacked = unstacked.stack(future_stack=future_stack) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + restacked = restacked.dropna(how="all") + tm.assert_frame_equal(restacked, ymd) + + # more than 2 levels in the columns + unstacked = ymd.unstack(1).unstack(1) + + result = unstacked.stack(1, future_stack=future_stack) + expected = ymd.unstack() + tm.assert_frame_equal(result, expected) + + result = unstacked.stack(2, future_stack=future_stack) + expected = ymd.unstack(1) + tm.assert_frame_equal(result, expected) + + result = unstacked.stack(0, future_stack=future_stack) + expected = ymd.stack(future_stack=future_stack).unstack(1).unstack(1) + tm.assert_frame_equal(result, expected) + + # not all levels present in each echelon + unstacked = ymd.unstack(2).loc[:, ::3] + stacked = unstacked.stack(future_stack=future_stack).stack( + future_stack=future_stack + ) + ymd_stacked = ymd.stack(future_stack=future_stack) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + stacked = stacked.dropna(how="all") + ymd_stacked = ymd_stacked.dropna(how="all") + tm.assert_series_equal(stacked, ymd_stacked.reindex(stacked.index)) + + # stack with negative number + result = ymd.unstack(0).stack(-2, future_stack=future_stack) + expected = ymd.unstack(0).stack(0, future_stack=future_stack) + tm.assert_equal(result, expected) + + @pytest.mark.parametrize( + "idx, columns, exp_idx", + [ + [ + list("abab"), + ["1st", "2nd", "1st"], + MultiIndex( + levels=[["a", "b"], ["1st", "2nd"]], + codes=[np.tile(np.arange(2).repeat(3), 2), np.tile([0, 1, 0], 4)], + ), + ], + [ + MultiIndex.from_tuples((("a", 2), ("b", 1), ("a", 1), ("b", 2))), + ["1st", "2nd", "1st"], + MultiIndex( + levels=[["a", "b"], [1, 2], ["1st", "2nd"]], + codes=[ + np.tile(np.arange(2).repeat(3), 2), + np.repeat([1, 0, 1], [3, 6, 3]), + np.tile([0, 1, 0], 4), + ], + ), + ], + ], + ) + def test_stack_duplicate_index(self, idx, columns, exp_idx, future_stack): + # GH10417 + df = DataFrame( + np.arange(12).reshape(4, 3), + index=idx, + columns=columns, + ) + if future_stack: + msg = "Columns with duplicate values are not supported in stack" + with pytest.raises(ValueError, match=msg): + df.stack(future_stack=future_stack) + else: + result = df.stack(future_stack=future_stack) + expected = Series(np.arange(12), index=exp_idx) + tm.assert_series_equal(result, expected) + assert result.index.is_unique is False + li, ri = result.index, expected.index + tm.assert_index_equal(li, ri) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_unstack_odd_failure(self, future_stack): + mi = MultiIndex.from_arrays( + [ + ["Fri"] * 4 + ["Sat"] * 2 + ["Sun"] * 2 + ["Thu"] * 3, + ["Dinner"] * 2 + ["Lunch"] * 2 + ["Dinner"] * 5 + ["Lunch"] * 2, + ["No", "Yes"] * 4 + ["No", "No", "Yes"], + ], + names=["day", "time", "smoker"], + ) + df = DataFrame( + { + "sum": np.arange(11, dtype="float64"), + "len": np.arange(11, dtype="float64"), + }, + index=mi, + ) + # it works, #2100 + result = df.unstack(2) + + recons = result.stack(future_stack=future_stack) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + recons = recons.dropna(how="all") + tm.assert_frame_equal(recons, df) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_mixed_dtype(self, multiindex_dataframe_random_data, future_stack): + frame = multiindex_dataframe_random_data + + df = frame.T + df["foo", "four"] = "foo" + df = df.sort_index(level=1, axis=1) + + stacked = df.stack(future_stack=future_stack) + result = df["foo"].stack(future_stack=future_stack).sort_index() + tm.assert_series_equal(stacked["foo"], result, check_names=False) + assert result.name is None + assert stacked["bar"].dtype == np.float64 + + def test_unstack_bug(self, future_stack): + df = DataFrame( + { + "state": ["naive", "naive", "naive", "active", "active", "active"], + "exp": ["a", "b", "b", "b", "a", "a"], + "barcode": [1, 2, 3, 4, 1, 3], + "v": ["hi", "hi", "bye", "bye", "bye", "peace"], + "extra": np.arange(6.0), + } + ) + + msg = "DataFrameGroupBy.apply operated on the grouping columns" + with tm.assert_produces_warning(FutureWarning, match=msg): + result = df.groupby(["state", "exp", "barcode", "v"]).apply(len) + + unstacked = result.unstack() + restacked = unstacked.stack(future_stack=future_stack) + tm.assert_series_equal(restacked, result.reindex(restacked.index).astype(float)) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_unstack_preserve_names( + self, multiindex_dataframe_random_data, future_stack + ): + frame = multiindex_dataframe_random_data + + unstacked = frame.unstack() + assert unstacked.index.name == "first" + assert unstacked.columns.names == ["exp", "second"] + + restacked = unstacked.stack(future_stack=future_stack) + assert restacked.index.names == frame.index.names + + @pytest.mark.parametrize("method", ["stack", "unstack"]) + def test_stack_unstack_wrong_level_name( + self, method, multiindex_dataframe_random_data, future_stack + ): + # GH 18303 - wrong level name should raise + frame = multiindex_dataframe_random_data + + # A DataFrame with flat axes: + df = frame.loc["foo"] + + kwargs = {"future_stack": future_stack} if method == "stack" else {} + with pytest.raises(KeyError, match="does not match index name"): + getattr(df, method)("mistake", **kwargs) + + if method == "unstack": + # Same on a Series: + s = df.iloc[:, 0] + with pytest.raises(KeyError, match="does not match index name"): + getattr(s, method)("mistake", **kwargs) + + def test_unstack_level_name(self, multiindex_dataframe_random_data): + frame = multiindex_dataframe_random_data + + result = frame.unstack("second") + expected = frame.unstack(level=1) + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_level_name(self, multiindex_dataframe_random_data, future_stack): + frame = multiindex_dataframe_random_data + + unstacked = frame.unstack("second") + result = unstacked.stack("exp", future_stack=future_stack) + expected = frame.unstack().stack(0, future_stack=future_stack) + tm.assert_frame_equal(result, expected) + + result = frame.stack("exp", future_stack=future_stack) + expected = frame.stack(future_stack=future_stack) + tm.assert_series_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_unstack_multiple( + self, multiindex_year_month_day_dataframe_random_data, future_stack + ): + ymd = multiindex_year_month_day_dataframe_random_data + + unstacked = ymd.unstack(["year", "month"]) + expected = ymd.unstack("year").unstack("month") + tm.assert_frame_equal(unstacked, expected) + assert unstacked.columns.names == expected.columns.names + + # series + s = ymd["A"] + s_unstacked = s.unstack(["year", "month"]) + tm.assert_frame_equal(s_unstacked, expected["A"]) + + restacked = unstacked.stack(["year", "month"], future_stack=future_stack) + if future_stack: + # NA values in unstacked persist to restacked in version 3 + restacked = restacked.dropna(how="all") + restacked = restacked.swaplevel(0, 1).swaplevel(1, 2) + restacked = restacked.sort_index(level=0) + + tm.assert_frame_equal(restacked, ymd) + assert restacked.index.names == ymd.index.names + + # GH #451 + unstacked = ymd.unstack([1, 2]) + expected = ymd.unstack(1).unstack(1).dropna(axis=1, how="all") + tm.assert_frame_equal(unstacked, expected) + + unstacked = ymd.unstack([2, 1]) + expected = ymd.unstack(2).unstack(1).dropna(axis=1, how="all") + tm.assert_frame_equal(unstacked, expected.loc[:, unstacked.columns]) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_names_and_numbers( + self, multiindex_year_month_day_dataframe_random_data, future_stack + ): + ymd = multiindex_year_month_day_dataframe_random_data + + unstacked = ymd.unstack(["year", "month"]) + + # Can't use mixture of names and numbers to stack + with pytest.raises(ValueError, match="level should contain"): + unstacked.stack([0, "month"], future_stack=future_stack) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_multiple_out_of_bounds( + self, multiindex_year_month_day_dataframe_random_data, future_stack + ): + # nlevels == 3 + ymd = multiindex_year_month_day_dataframe_random_data + + unstacked = ymd.unstack(["year", "month"]) + + with pytest.raises(IndexError, match="Too many levels"): + unstacked.stack([2, 3], future_stack=future_stack) + with pytest.raises(IndexError, match="not a valid level number"): + unstacked.stack([-4, -3], future_stack=future_stack) + + def test_unstack_period_series(self): + # GH4342 + idx1 = pd.PeriodIndex( + ["2013-01", "2013-01", "2013-02", "2013-02", "2013-03", "2013-03"], + freq="M", + name="period", + ) + idx2 = Index(["A", "B"] * 3, name="str") + value = [1, 2, 3, 4, 5, 6] + + idx = MultiIndex.from_arrays([idx1, idx2]) + s = Series(value, index=idx) + + result1 = s.unstack() + result2 = s.unstack(level=1) + result3 = s.unstack(level=0) + + e_idx = pd.PeriodIndex( + ["2013-01", "2013-02", "2013-03"], freq="M", name="period" + ) + expected = DataFrame( + {"A": [1, 3, 5], "B": [2, 4, 6]}, index=e_idx, columns=["A", "B"] + ) + expected.columns.name = "str" + + tm.assert_frame_equal(result1, expected) + tm.assert_frame_equal(result2, expected) + tm.assert_frame_equal(result3, expected.T) + + idx1 = pd.PeriodIndex( + ["2013-01", "2013-01", "2013-02", "2013-02", "2013-03", "2013-03"], + freq="M", + name="period1", + ) + + idx2 = pd.PeriodIndex( + ["2013-12", "2013-11", "2013-10", "2013-09", "2013-08", "2013-07"], + freq="M", + name="period2", + ) + idx = MultiIndex.from_arrays([idx1, idx2]) + s = Series(value, index=idx) + + result1 = s.unstack() + result2 = s.unstack(level=1) + result3 = s.unstack(level=0) + + e_idx = pd.PeriodIndex( + ["2013-01", "2013-02", "2013-03"], freq="M", name="period1" + ) + e_cols = pd.PeriodIndex( + ["2013-07", "2013-08", "2013-09", "2013-10", "2013-11", "2013-12"], + freq="M", + name="period2", + ) + expected = DataFrame( + [ + [np.nan, np.nan, np.nan, np.nan, 2, 1], + [np.nan, np.nan, 4, 3, np.nan, np.nan], + [6, 5, np.nan, np.nan, np.nan, np.nan], + ], + index=e_idx, + columns=e_cols, + ) + + tm.assert_frame_equal(result1, expected) + tm.assert_frame_equal(result2, expected) + tm.assert_frame_equal(result3, expected.T) + + def test_unstack_period_frame(self): + # GH4342 + idx1 = pd.PeriodIndex( + ["2014-01", "2014-02", "2014-02", "2014-02", "2014-01", "2014-01"], + freq="M", + name="period1", + ) + idx2 = pd.PeriodIndex( + ["2013-12", "2013-12", "2014-02", "2013-10", "2013-10", "2014-02"], + freq="M", + name="period2", + ) + value = {"A": [1, 2, 3, 4, 5, 6], "B": [6, 5, 4, 3, 2, 1]} + idx = MultiIndex.from_arrays([idx1, idx2]) + df = DataFrame(value, index=idx) + + result1 = df.unstack() + result2 = df.unstack(level=1) + result3 = df.unstack(level=0) + + e_1 = pd.PeriodIndex(["2014-01", "2014-02"], freq="M", name="period1") + e_2 = pd.PeriodIndex( + ["2013-10", "2013-12", "2014-02", "2013-10", "2013-12", "2014-02"], + freq="M", + name="period2", + ) + e_cols = MultiIndex.from_arrays(["A A A B B B".split(), e_2]) + expected = DataFrame( + [[5, 1, 6, 2, 6, 1], [4, 2, 3, 3, 5, 4]], index=e_1, columns=e_cols + ) + + tm.assert_frame_equal(result1, expected) + tm.assert_frame_equal(result2, expected) + + e_1 = pd.PeriodIndex( + ["2014-01", "2014-02", "2014-01", "2014-02"], freq="M", name="period1" + ) + e_2 = pd.PeriodIndex( + ["2013-10", "2013-12", "2014-02"], freq="M", name="period2" + ) + e_cols = MultiIndex.from_arrays(["A A B B".split(), e_1]) + expected = DataFrame( + [[5, 4, 2, 3], [1, 2, 6, 5], [6, 3, 1, 4]], index=e_2, columns=e_cols + ) + + tm.assert_frame_equal(result3, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_multiple_bug(self, future_stack, using_infer_string): + # bug when some uniques are not present in the data GH#3170 + id_col = ([1] * 3) + ([2] * 3) + name = (["a"] * 3) + (["b"] * 3) + date = pd.to_datetime(["2013-01-03", "2013-01-04", "2013-01-05"] * 2) + var1 = np.random.default_rng(2).integers(0, 100, 6) + df = DataFrame({"ID": id_col, "NAME": name, "DATE": date, "VAR1": var1}) + + multi = df.set_index(["DATE", "ID"]) + multi.columns.name = "Params" + unst = multi.unstack("ID") + msg = re.escape("agg function failed [how->mean,dtype->") + if using_infer_string: + msg = "dtype 'str' does not support operation 'mean'" + with pytest.raises(TypeError, match=msg): + unst.resample("W-THU").mean() + down = unst.resample("W-THU").mean(numeric_only=True) + rs = down.stack("ID", future_stack=future_stack) + xp = ( + unst.loc[:, ["VAR1"]] + .resample("W-THU") + .mean() + .stack("ID", future_stack=future_stack) + ) + xp.columns.name = "Params" + tm.assert_frame_equal(rs, xp) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_dropna(self, future_stack): + # GH#3997 + df = DataFrame({"A": ["a1", "a2"], "B": ["b1", "b2"], "C": [1, 1]}) + df = df.set_index(["A", "B"]) + + dropna = False if not future_stack else lib.no_default + stacked = df.unstack().stack(dropna=dropna, future_stack=future_stack) + assert len(stacked) > len(stacked.dropna()) + + if future_stack: + with pytest.raises(ValueError, match="dropna must be unspecified"): + df.unstack().stack(dropna=True, future_stack=future_stack) + else: + stacked = df.unstack().stack(dropna=True, future_stack=future_stack) + tm.assert_frame_equal(stacked, stacked.dropna()) + + def test_unstack_multiple_hierarchical(self, future_stack): + df = DataFrame( + index=[ + [0, 0, 0, 0, 1, 1, 1, 1], + [0, 0, 1, 1, 0, 0, 1, 1], + [0, 1, 0, 1, 0, 1, 0, 1], + ], + columns=[[0, 0, 1, 1], [0, 1, 0, 1]], + ) + + df.index.names = ["a", "b", "c"] + df.columns.names = ["d", "e"] + + # it works! + df.unstack(["b", "c"]) + + def test_unstack_sparse_keyspace(self): + # memory problems with naive impl GH#2278 + # Generate Long File & Test Pivot + NUM_ROWS = 1000 + + df = DataFrame( + { + "A": np.random.default_rng(2).integers(100, size=NUM_ROWS), + "B": np.random.default_rng(3).integers(300, size=NUM_ROWS), + "C": np.random.default_rng(4).integers(-7, 7, size=NUM_ROWS), + "D": np.random.default_rng(5).integers(-19, 19, size=NUM_ROWS), + "E": np.random.default_rng(6).integers(3000, size=NUM_ROWS), + "F": np.random.default_rng(7).standard_normal(NUM_ROWS), + } + ) + + idf = df.set_index(["A", "B", "C", "D", "E"]) + + # it works! is sufficient + idf.unstack("E") + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_unstack_unobserved_keys(self, future_stack): + # related to GH#2278 refactoring + levels = [[0, 1], [0, 1, 2, 3]] + codes = [[0, 0, 1, 1], [0, 2, 0, 2]] + + index = MultiIndex(levels, codes) + + df = DataFrame(np.random.default_rng(2).standard_normal((4, 2)), index=index) + + result = df.unstack() + assert len(result.columns) == 4 + + recons = result.stack(future_stack=future_stack) + tm.assert_frame_equal(recons, df) + + @pytest.mark.slow + def test_unstack_number_of_levels_larger_than_int32(self, monkeypatch): + # GH#20601 + # GH 26314: Change ValueError to PerformanceWarning + + class MockUnstacker(reshape_lib._Unstacker): + def __init__(self, *args, **kwargs) -> None: + # __init__ will raise the warning + super().__init__(*args, **kwargs) + raise Exception("Don't compute final result.") + + with monkeypatch.context() as m: + m.setattr(reshape_lib, "_Unstacker", MockUnstacker) + df = DataFrame( + np.zeros((2**16, 2)), + index=[np.arange(2**16), np.arange(2**16)], + ) + msg = "The following operation may generate" + with tm.assert_produces_warning(PerformanceWarning, match=msg): + with pytest.raises(Exception, match="Don't compute final result."): + df.unstack() + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + @pytest.mark.parametrize( + "levels", + itertools.chain.from_iterable( + itertools.product(itertools.permutations([0, 1, 2], width), repeat=2) + for width in [2, 3] + ), + ) + @pytest.mark.parametrize("stack_lev", range(2)) + @pytest.mark.parametrize("sort", [True, False]) + def test_stack_order_with_unsorted_levels( + self, levels, stack_lev, sort, future_stack + ): + # GH#16323 + # deep check for 1-row case + columns = MultiIndex(levels=levels, codes=[[0, 0, 1, 1], [0, 1, 0, 1]]) + df = DataFrame(columns=columns, data=[range(4)]) + kwargs = {} if future_stack else {"sort": sort} + df_stacked = df.stack(stack_lev, future_stack=future_stack, **kwargs) + for row in df.index: + for col in df.columns: + expected = df.loc[row, col] + result_row = row, col[stack_lev] + result_col = col[1 - stack_lev] + result = df_stacked.loc[result_row, result_col] + assert result == expected + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_order_with_unsorted_levels_multi_row(self, future_stack): + # GH#16323 + + # check multi-row case + mi = MultiIndex( + levels=[["A", "C", "B"], ["B", "A", "C"]], + codes=[np.repeat(range(3), 3), np.tile(range(3), 3)], + ) + df = DataFrame( + columns=mi, index=range(5), data=np.arange(5 * len(mi)).reshape(5, -1) + ) + assert all( + df.loc[row, col] + == df.stack(0, future_stack=future_stack).loc[(row, col[0]), col[1]] + for row in df.index + for col in df.columns + ) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_order_with_unsorted_levels_multi_row_2(self, future_stack): + # GH#53636 + levels = ((0, 1), (1, 0)) + stack_lev = 1 + columns = MultiIndex(levels=levels, codes=[[0, 0, 1, 1], [0, 1, 0, 1]]) + df = DataFrame(columns=columns, data=[range(4)], index=[1, 0, 2, 3]) + kwargs = {} if future_stack else {"sort": True} + result = df.stack(stack_lev, future_stack=future_stack, **kwargs) + expected_index = MultiIndex( + levels=[[0, 1, 2, 3], [0, 1]], + codes=[[1, 1, 0, 0, 2, 2, 3, 3], [1, 0, 1, 0, 1, 0, 1, 0]], + ) + expected = DataFrame( + { + 0: [0, 1, 0, 1, 0, 1, 0, 1], + 1: [2, 3, 2, 3, 2, 3, 2, 3], + }, + index=expected_index, + ) + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_unstack_unordered_multiindex(self, future_stack): + # GH# 18265 + values = np.arange(5) + data = np.vstack( + [ + [f"b{x}" for x in values], # b0, b1, .. + [f"a{x}" for x in values], # a0, a1, .. + ] + ) + df = DataFrame(data.T, columns=["b", "a"]) + df.columns.name = "first" + second_level_dict = {"x": df} + multi_level_df = pd.concat(second_level_dict, axis=1) + multi_level_df.columns.names = ["second", "first"] + df = multi_level_df.reindex(sorted(multi_level_df.columns), axis=1) + result = df.stack(["first", "second"], future_stack=future_stack).unstack( + ["first", "second"] + ) + expected = DataFrame( + [["a0", "b0"], ["a1", "b1"], ["a2", "b2"], ["a3", "b3"], ["a4", "b4"]], + index=[0, 1, 2, 3, 4], + columns=MultiIndex.from_tuples( + [("a", "x"), ("b", "x")], names=["first", "second"] + ), + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_preserve_types( + self, multiindex_year_month_day_dataframe_random_data, using_infer_string + ): + # GH#403 + ymd = multiindex_year_month_day_dataframe_random_data + ymd["E"] = "foo" + ymd["F"] = 2 + + unstacked = ymd.unstack("month") + assert unstacked["A", 1].dtype == np.float64 + assert ( + unstacked["E", 1].dtype == np.object_ + if not using_infer_string + else "string" + ) + assert unstacked["F", 1].dtype == np.float64 + + def test_unstack_group_index_overflow(self, future_stack): + codes = np.tile(np.arange(500), 2) + level = np.arange(500) + + index = MultiIndex( + levels=[level] * 8 + [[0, 1]], + codes=[codes] * 8 + [np.arange(2).repeat(500)], + ) + + s = Series(np.arange(1000), index=index) + result = s.unstack() + assert result.shape == (500, 2) + + # test roundtrip + stacked = result.stack(future_stack=future_stack) + tm.assert_series_equal(s, stacked.reindex(s.index)) + + # put it at beginning + index = MultiIndex( + levels=[[0, 1]] + [level] * 8, + codes=[np.arange(2).repeat(500)] + [codes] * 8, + ) + + s = Series(np.arange(1000), index=index) + result = s.unstack(0) + assert result.shape == (500, 2) + + # put it in middle + index = MultiIndex( + levels=[level] * 4 + [[0, 1]] + [level] * 4, + codes=([codes] * 4 + [np.arange(2).repeat(500)] + [codes] * 4), + ) + + s = Series(np.arange(1000), index=index) + result = s.unstack(4) + assert result.shape == (500, 2) + + def test_unstack_with_missing_int_cast_to_float(self, using_array_manager): + # https://github.com/pandas-dev/pandas/issues/37115 + df = DataFrame( + { + "a": ["A", "A", "B"], + "b": ["ca", "cb", "cb"], + "v": [10] * 3, + } + ).set_index(["a", "b"]) + + # add another int column to get 2 blocks + df["is_"] = 1 + if not using_array_manager: + assert len(df._mgr.blocks) == 2 + + result = df.unstack("b") + result[("is_", "ca")] = result[("is_", "ca")].fillna(0) + + expected = DataFrame( + [[10.0, 10.0, 1.0, 1.0], [np.nan, 10.0, 0.0, 1.0]], + index=Index(["A", "B"], name="a"), + columns=MultiIndex.from_tuples( + [("v", "ca"), ("v", "cb"), ("is_", "ca"), ("is_", "cb")], + names=[None, "b"], + ), + ) + if using_array_manager: + # INFO(ArrayManager) with ArrayManager preserve dtype where possible + expected[("v", "cb")] = expected[("v", "cb")].astype("int64") + expected[("is_", "cb")] = expected[("is_", "cb")].astype("int64") + tm.assert_frame_equal(result, expected) + + def test_unstack_with_level_has_nan(self): + # GH 37510 + df1 = DataFrame( + { + "L1": [1, 2, 3, 4], + "L2": [3, 4, 1, 2], + "L3": [1, 1, 1, 1], + "x": [1, 2, 3, 4], + } + ) + df1 = df1.set_index(["L1", "L2", "L3"]) + new_levels = ["n1", "n2", "n3", None] + df1.index = df1.index.set_levels(levels=new_levels, level="L1") + df1.index = df1.index.set_levels(levels=new_levels, level="L2") + + result = df1.unstack("L3")[("x", 1)].sort_index().index + expected = MultiIndex( + levels=[["n1", "n2", "n3", None], ["n1", "n2", "n3", None]], + codes=[[0, 1, 2, 3], [2, 3, 0, 1]], + names=["L1", "L2"], + ) + + tm.assert_index_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_nan_in_multiindex_columns(self, future_stack): + # GH#39481 + df = DataFrame( + np.zeros([1, 5]), + columns=MultiIndex.from_tuples( + [ + (0, None, None), + (0, 2, 0), + (0, 2, 1), + (0, 3, 0), + (0, 3, 1), + ], + ), + ) + result = df.stack(2, future_stack=future_stack) + if future_stack: + index = MultiIndex(levels=[[0], [0.0, 1.0]], codes=[[0, 0, 0], [-1, 0, 1]]) + columns = MultiIndex(levels=[[0], [2, 3]], codes=[[0, 0, 0], [-1, 0, 1]]) + else: + index = Index([(0, None), (0, 0), (0, 1)]) + columns = Index([(0, None), (0, 2), (0, 3)]) + expected = DataFrame( + [[0.0, np.nan, np.nan], [np.nan, 0.0, 0.0], [np.nan, 0.0, 0.0]], + index=index, + columns=columns, + ) + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_multi_level_stack_categorical(self, future_stack): + # GH 15239 + midx = MultiIndex.from_arrays( + [ + ["A"] * 2 + ["B"] * 2, + pd.Categorical(list("abab")), + pd.Categorical(list("ccdd")), + ] + ) + df = DataFrame(np.arange(8).reshape(2, 4), columns=midx) + result = df.stack([1, 2], future_stack=future_stack) + if future_stack: + expected = DataFrame( + [ + [0, np.nan], + [1, np.nan], + [np.nan, 2], + [np.nan, 3], + [4, np.nan], + [5, np.nan], + [np.nan, 6], + [np.nan, 7], + ], + columns=["A", "B"], + index=MultiIndex.from_arrays( + [ + [0] * 4 + [1] * 4, + pd.Categorical(list("abababab")), + pd.Categorical(list("ccddccdd")), + ] + ), + ) + else: + expected = DataFrame( + [ + [0, np.nan], + [np.nan, 2], + [1, np.nan], + [np.nan, 3], + [4, np.nan], + [np.nan, 6], + [5, np.nan], + [np.nan, 7], + ], + columns=["A", "B"], + index=MultiIndex.from_arrays( + [ + [0] * 4 + [1] * 4, + pd.Categorical(list("aabbaabb")), + pd.Categorical(list("cdcdcdcd")), + ] + ), + ) + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_nan_level(self, future_stack): + # GH 9406 + df_nan = DataFrame( + np.arange(4).reshape(2, 2), + columns=MultiIndex.from_tuples( + [("A", np.nan), ("B", "b")], names=["Upper", "Lower"] + ), + index=Index([0, 1], name="Num"), + dtype=np.float64, + ) + result = df_nan.stack(future_stack=future_stack) + if future_stack: + index = MultiIndex( + levels=[[0, 1], [np.nan, "b"]], + codes=[[0, 0, 1, 1], [0, 1, 0, 1]], + names=["Num", "Lower"], + ) + else: + index = MultiIndex.from_tuples( + [(0, np.nan), (0, "b"), (1, np.nan), (1, "b")], names=["Num", "Lower"] + ) + expected = DataFrame( + [[0.0, np.nan], [np.nan, 1], [2.0, np.nan], [np.nan, 3.0]], + columns=Index(["A", "B"], name="Upper"), + index=index, + ) + tm.assert_frame_equal(result, expected) + + def test_unstack_categorical_columns(self): + # GH 14018 + idx = MultiIndex.from_product([["A"], [0, 1]]) + df = DataFrame({"cat": pd.Categorical(["a", "b"])}, index=idx) + result = df.unstack() + expected = DataFrame( + { + 0: pd.Categorical(["a"], categories=["a", "b"]), + 1: pd.Categorical(["b"], categories=["a", "b"]), + }, + index=["A"], + ) + expected.columns = MultiIndex.from_tuples([("cat", 0), ("cat", 1)]) + tm.assert_frame_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_unsorted(self, future_stack): + # GH 16925 + PAE = ["ITA", "FRA"] + VAR = ["A1", "A2"] + TYP = ["CRT", "DBT", "NET"] + MI = MultiIndex.from_product([PAE, VAR, TYP], names=["PAE", "VAR", "TYP"]) + + V = list(range(len(MI))) + DF = DataFrame(data=V, index=MI, columns=["VALUE"]) + + DF = DF.unstack(["VAR", "TYP"]) + DF.columns = DF.columns.droplevel(0) + DF.loc[:, ("A0", "NET")] = 9999 + + result = DF.stack(["VAR", "TYP"], future_stack=future_stack).sort_index() + expected = ( + DF.sort_index(axis=1) + .stack(["VAR", "TYP"], future_stack=future_stack) + .sort_index() + ) + tm.assert_series_equal(result, expected) + + @pytest.mark.filterwarnings( + "ignore:The previous implementation of stack is deprecated" + ) + def test_stack_nullable_dtype(self, future_stack): + # GH#43561 + columns = MultiIndex.from_product( + [["54511", "54515"], ["r", "t_mean"]], names=["station", "element"] + ) + index = Index([1, 2, 3], name="time") + + arr = np.array([[50, 226, 10, 215], [10, 215, 9, 220], [305, 232, 111, 220]]) + df = DataFrame(arr, columns=columns, index=index, dtype=pd.Int64Dtype()) + + result = df.stack("station", future_stack=future_stack) + + expected = ( + df.astype(np.int64) + .stack("station", future_stack=future_stack) + .astype(pd.Int64Dtype()) + ) + tm.assert_frame_equal(result, expected) + + # non-homogeneous case + df[df.columns[0]] = df[df.columns[0]].astype(pd.Float64Dtype()) + result = df.stack("station", future_stack=future_stack) + + expected = DataFrame( + { + "r": pd.array( + [50.0, 10.0, 10.0, 9.0, 305.0, 111.0], dtype=pd.Float64Dtype() + ), + "t_mean": pd.array( + [226, 215, 215, 220, 232, 220], dtype=pd.Int64Dtype() + ), + }, + index=MultiIndex.from_product([index, columns.levels[0]]), + ) + expected.columns.name = "element" + tm.assert_frame_equal(result, expected) + + def test_unstack_mixed_level_names(self): + # GH#48763 + arrays = [["a", "a"], [1, 2], ["red", "blue"]] + idx = MultiIndex.from_arrays(arrays, names=("x", 0, "y")) + df = DataFrame({"m": [1, 2]}, index=idx) + result = df.unstack("x") + expected = DataFrame( + [[1], [2]], + columns=MultiIndex.from_tuples([("m", "a")], names=[None, "x"]), + index=MultiIndex.from_tuples([(1, "red"), (2, "blue")], names=[0, "y"]), + ) + tm.assert_frame_equal(result, expected) + + +def test_stack_tuple_columns(future_stack): + # GH#54948 - test stack when the input has a non-MultiIndex with tuples + df = DataFrame( + [[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=[("a", 1), ("a", 2), ("b", 1)] + ) + result = df.stack(future_stack=future_stack) + expected = Series( + [1, 2, 3, 4, 5, 6, 7, 8, 9], + index=MultiIndex( + levels=[[0, 1, 2], [("a", 1), ("a", 2), ("b", 1)]], + codes=[[0, 0, 0, 1, 1, 1, 2, 2, 2], [0, 1, 2, 0, 1, 2, 0, 1, 2]], + ), + ) + tm.assert_series_equal(result, expected) + + +@pytest.mark.parametrize( + "dtype, na_value", + [ + ("float64", np.nan), + ("Float64", np.nan), + ("Float64", pd.NA), + ("Int64", pd.NA), + ], +) +@pytest.mark.parametrize("test_multiindex", [True, False]) +def test_stack_preserves_na(dtype, na_value, test_multiindex): + # GH#56573 + if test_multiindex: + index = MultiIndex.from_arrays(2 * [Index([na_value], dtype=dtype)]) + else: + index = Index([na_value], dtype=dtype) + df = DataFrame({"a": [1]}, index=index) + result = df.stack(future_stack=True) + + if test_multiindex: + expected_index = MultiIndex.from_arrays( + [ + Index([na_value], dtype=dtype), + Index([na_value], dtype=dtype), + Index(["a"]), + ] + ) + else: + expected_index = MultiIndex.from_arrays( + [ + Index([na_value], dtype=dtype), + Index(["a"]), + ] + ) + expected = Series(1, index=expected_index) + tm.assert_series_equal(result, expected) diff --git a/shared/package-files/32/320b3d7ae0eb563e60d7a62387de282960b1ab1a94b376935691bb8cc4967ed0/blob b/shared/package-files/32/320b3d7ae0eb563e60d7a62387de282960b1ab1a94b376935691bb8cc4967ed0/blob new file mode 100644 index 0000000000000000000000000000000000000000..48e1e3609a4605b5960de1547d3b19e95e06ef6a --- /dev/null +++ b/shared/package-files/32/320b3d7ae0eb563e60d7a62387de282960b1ab1a94b376935691bb8cc4967ed0/blob @@ -0,0 +1,1194 @@ +############################################################################# +# This code draws from the Python Optimal Transport version of the +# network simplex algorithm, which in turn was adapted from the LEMON +# library. The copyrights/comment blocks for those are preserved below. +# The Python/Numba implementation was adapted by Leland McInnes (2020). +# +# * This file has been adapted by Nicolas Bonneel (2013), +# * from network_simplex.h from LEMON, a generic C++ optimization library, +# * to implement a lightweight network simplex for mass transport, more +# * memory efficient that the original file. A previous version of this file +# * is used as part of the Displacement Interpolation project, +# * Web: http://www.cs.ubc.ca/labs/imager/tr/2011/DisplacementInterpolation/ +# * +# * +# **** Original file Copyright Notice : +# * +# * Copyright (C) 2003-2010 +# * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport +# * (Egervary Research Group on Combinatorial Optimization, EGRES). +# * +# * Permission to use, modify and distribute this software is granted +# * provided that this copyright notice appears in all copies. For +# * precise terms see the accompanying LICENSE file. +# * +# * This software is provided "AS IS" with no warranty of any kind, +# * express or implied, and with no claim as to its suitability for any +# * purpose. + +import numpy as np +import numba +from collections import namedtuple +from enum import Enum, IntEnum + +_mock_identity = np.eye(2, dtype=np.float32) +_mock_ones = np.ones(2, dtype=np.float32) +_dummy_cost = np.zeros((2, 2), dtype=np.float64) + +# Accuracy tolerance and net supply tolerance +EPSILON = 2.2204460492503131e-15 +NET_SUPPLY_ERROR_TOLERANCE = 1e-8 + +## Defaults to double for everythig in POT +INFINITY = np.finfo(np.float64).max +MAX = np.finfo(np.float64).max + +dummy_cost = np.zeros((2, 2), dtype=np.float64) + +# Invalid Arc num +INVALID = -1 + +# Problem Status +class ProblemStatus(Enum): + OPTIMAL = 0 + MAX_ITER_REACHED = 1 + UNBOUNDED = 2 + INFEASIBLE = 3 + + +# Arc States +class ArcState(IntEnum): + STATE_UPPER = -1 + STATE_TREE = 0 + STATE_LOWER = 1 + + +SpanningTree = namedtuple( + "SpanningTree", + [ + "parent", # int array + "pred", # int array + "thread", # int array + "rev_thread", # int array + "succ_num", # int array + "last_succ", # int array + "forward", # bool array + "state", # state array + "root", # int + ], +) +DiGraph = namedtuple( + "DiGraph", + [ + "n_nodes", # int + "n_arcs", # int + "n", # int + "m", # int + "use_arc_mixing", # bool + "num_total_big_subsequence_numbers", # int + "subsequence_length", # int + "num_big_subsequences", # int + "mixing_coeff", + ], +) +NodeArcData = namedtuple( + "NodeArcData", + [ + "cost", # double array + "supply", # double array + "flow", # double array + "pi", # double array + "source", # unsigned int array + "target", # unsigned int array + ], +) +LeavingArcData = namedtuple( + "LeavingArcData", ["u_in", "u_out", "v_in", "delta", "change"] +) + +# Just reproduce a simpler version of numpy isclose (not numba supported yet) +@numba.njit() +def isclose(a, b, rtol=1.0e-5, atol=EPSILON): + diff = np.abs(a - b) + return diff <= (atol + rtol * np.abs(b)) + + +# locals: c, min, e, cnt, a +# modifies _in_arc, _next_arc, +@numba.njit(locals={"a": numba.uint32, "e": numba.uint32}) +def find_entering_arc( + pivot_block_size, + pivot_next_arc, + search_arc_num, + state_vector, + node_arc_data, + in_arc, +): + min = 0 + cnt = pivot_block_size + + # Pull from tuple for quick reference + cost = node_arc_data.cost + pi = node_arc_data.pi + source = node_arc_data.source + target = node_arc_data.target + + for e in range(pivot_next_arc, search_arc_num): + c = state_vector[e] * (cost[e] + pi[source[e]] - pi[target[e]]) + if c < min: + min = c + in_arc = e + + cnt -= 1 + if cnt == 0: + if np.fabs(pi[source[in_arc]]) > np.fabs(pi[target[in_arc]]): + a = np.fabs(pi[source[in_arc]]) + else: + a = np.fabs(pi[target[in_arc]]) + + if a <= np.fabs(cost[in_arc]): + a = np.fabs(cost[in_arc]) + + if min < -(EPSILON * a): + pivot_next_arc = e + return in_arc, pivot_next_arc + else: + cnt = pivot_block_size + + for e in range(pivot_next_arc): + c = state_vector[e] * (cost[e] + pi[source[e]] - pi[target[e]]) + if c < min: + min = c + in_arc = e + + cnt -= 1 + if cnt == 0: + if np.fabs(pi[source[in_arc]]) > np.fabs(pi[target[in_arc]]): + a = np.fabs(pi[source[in_arc]]) + else: + a = np.fabs(pi[target[in_arc]]) + + if a <= np.fabs(cost[in_arc]): + a = np.fabs(cost[in_arc]) + + if min < -(EPSILON * a): + pivot_next_arc = e + return in_arc, pivot_next_arc + else: + cnt = pivot_block_size + + # assert(pivot_block.next_arc[0] == 0 or e == pivot_block.next_arc[0] - 1) + + if np.fabs(pi[source[in_arc]]) > np.fabs(pi[target[in_arc]]): + a = np.fabs(pi[source[in_arc]]) + else: + a = np.fabs(pi[target[in_arc]]) + + if a <= np.fabs(cost[in_arc]): + a = np.fabs(cost[in_arc]) + + if min >= -(EPSILON * a): + return -1, 0 + + return in_arc, pivot_next_arc + + +# Find the join node +# Operates with graph (_source, _target) and MST (_succ_num, _parent, in_arc) data +# locals: u, v +# modifies: join +@numba.njit(locals={"u": numba.types.uint16, "v": numba.types.uint16}) +def find_join_node(source, target, succ_num, parent, in_arc): + u = source[in_arc] + v = target[in_arc] + while u != v: + if succ_num[u] < succ_num[v]: + u = parent[u] + else: + v = parent[v] + + join = u + + return join + + +# Find the leaving arc of the cycle and returns true if the +# leaving arc is not the same as the entering arc +# locals: first, second, result, d, e +# modifies: u_in, v_in, u_out, delta +@numba.njit( + locals={ + "u": numba.uint16, + "u_in": numba.uint16, + "u_out": numba.uint16, + "v_in": numba.uint16, + "first": numba.uint16, + "second": numba.uint16, + "result": numba.uint8, + "in_arc": numba.uint32, + } +) +def find_leaving_arc(join, in_arc, node_arc_data, spanning_tree): + source = node_arc_data.source + target = node_arc_data.target + flow = node_arc_data.flow + + state = spanning_tree.state + forward = spanning_tree.forward + pred = spanning_tree.pred + parent = spanning_tree.parent + + u_out = -1 # May not be set, but we need to return something? + + # Initialize first and second nodes according to the direction + # of the cycle + if state[in_arc] == ArcState.STATE_LOWER: + first = source[in_arc] + second = target[in_arc] + else: + first = target[in_arc] + second = source[in_arc] + + delta = INFINITY + result = 0 + + # Search the cycle along the path form the first node to the root + u = first + while u != join: + e = pred[u] + if forward[u]: + d = flow[e] + else: + d = INFINITY + + if d < delta: + delta = d + u_out = u + result = 1 + + u = parent[u] + + # Search the cycle along the path form the second node to the root + u = second + while u != join: + e = pred[u] + if forward[u]: + d = INFINITY + else: + d = flow[e] + + if d <= delta: + delta = d + u_out = u + result = 2 + + u = parent[u] + + if result == 1: + u_in = first + v_in = second + else: + u_in = second + v_in = first + + return LeavingArcData(u_in, u_out, v_in, delta, result != 0) + + +# Change _flow and _state vectors +# locals: val, u +# modifies: _state, _flow +@numba.njit(locals={"u": numba.uint16, "in_arc": numba.uint32, "val": numba.float64}) +def update_flow(join, leaving_arc_data, node_arc_data, spanning_tree, in_arc): + source = node_arc_data.source + target = node_arc_data.target + flow = node_arc_data.flow + + state = spanning_tree.state + pred = spanning_tree.pred + parent = spanning_tree.parent + forward = spanning_tree.forward + + # Augment along the cycle + if leaving_arc_data.delta > 0: + val = state[in_arc] * leaving_arc_data.delta + flow[in_arc] += val + u = source[in_arc] + while u != join: + if forward[u]: + flow[pred[u]] -= val + else: + flow[pred[u]] += val + + u = parent[u] + + u = target[in_arc] + while u != join: + if forward[u]: + flow[pred[u]] += val + else: + flow[pred[u]] -= val + + u = parent[u] + + # Update the state of the entering and leaving arcs + if leaving_arc_data.change: + state[in_arc] = ArcState.STATE_TREE + if flow[pred[leaving_arc_data.u_out]] == 0: + state[pred[leaving_arc_data.u_out]] = ArcState.STATE_LOWER + else: + state[pred[leaving_arc_data.u_out]] = ArcState.STATE_UPPER + else: + state[in_arc] = -state[in_arc] + + +# Update the tree structure +# locals: u, w, old_rev_thread, old_succ_num, old_last_succ, tmp_sc, tmp_ls +# more locals: up_limit_in, up_limit_out, _dirty_revs +# modifies: v_out, _thread, _rev_thread, _parent, _last_succ, +# modifies: _pred, _forward, _succ_num +@numba.njit( + locals={ + "u": numba.int32, + "w": numba.int32, + "u_in": numba.uint16, + "u_out": numba.uint16, + "v_in": numba.uint16, + "right": numba.uint16, + "stem": numba.uint16, + "new_stem": numba.uint16, + "par_stem": numba.uint16, + "in_arc": numba.uint32, + } +) +def update_spanning_tree(spanning_tree, leaving_arc_data, join, in_arc, source): + + parent = spanning_tree.parent + thread = spanning_tree.thread + rev_thread = spanning_tree.rev_thread + succ_num = spanning_tree.succ_num + last_succ = spanning_tree.last_succ + forward = spanning_tree.forward + pred = spanning_tree.pred + + u_out = leaving_arc_data.u_out + u_in = leaving_arc_data.u_in + v_in = leaving_arc_data.v_in + + old_rev_thread = rev_thread[u_out] + old_succ_num = succ_num[u_out] + old_last_succ = last_succ[u_out] + v_out = parent[u_out] + + u = last_succ[u_in] # the last successor of u_in + right = thread[u] # the node after it + + # Handle the case when old_rev_thread equals to v_in + # (it also means that join and v_out coincide) + if old_rev_thread == v_in: + last = thread[last_succ[u_out]] + else: + last = thread[v_in] + + # Update _thread and _parent along the stem nodes (i.e. the nodes + # between u_in and u_out, whose parent have to be changed) + thread[v_in] = stem = u_in + dirty_revs = [] + dirty_revs.append(v_in) + par_stem = v_in + while stem != u_out: + # Insert the next stem node into the thread list + new_stem = parent[stem] + thread[u] = new_stem + dirty_revs.append(u) + + # Remove the subtree of stem from the thread list + w = rev_thread[stem] + thread[w] = right + rev_thread[right] = w + + # Change the parent node and shift stem nodes + parent[stem] = par_stem + par_stem = stem + stem = new_stem + + # Update u and right + if last_succ[stem] == last_succ[par_stem]: + u = rev_thread[par_stem] + else: + u = last_succ[stem] + + right = thread[u] + + parent[u_out] = par_stem + thread[u] = last + rev_thread[last] = u + last_succ[u_out] = u + + # Remove the subtree of u_out from the thread list except for + # the case when old_rev_thread equals to v_in + # (it also means that join and v_out coincide) + if old_rev_thread != v_in: + thread[old_rev_thread] = right + rev_thread[right] = old_rev_thread + + # Update _rev_thread using the new _thread values + for i in range(len(dirty_revs)): + u = dirty_revs[i] + rev_thread[thread[u]] = u + + # Update _pred, _forward, _last_succ and _succ_num for the + # stem nodes from u_out to u_in + tmp_sc = 0 + tmp_ls = last_succ[u_out] + u = u_out + while u != u_in: + w = parent[u] + pred[u] = pred[w] + forward[u] = not forward[w] + tmp_sc += succ_num[u] - succ_num[w] + succ_num[u] = tmp_sc + last_succ[w] = tmp_ls + u = w + + pred[u_in] = in_arc + forward[u_in] = u_in == source[in_arc] + succ_num[u_in] = old_succ_num + + # Set limits for updating _last_succ form v_in and v_out + # towards the root + up_limit_in = -1 + up_limit_out = -1 + if last_succ[join] == v_in: + up_limit_out = join + else: + up_limit_in = join + + # Update _last_succ from v_in towards the root + u = v_in + while u != up_limit_in and last_succ[u] == v_in: + last_succ[u] = last_succ[u_out] + u = parent[u] + + # Update _last_succ from v_out towards the root + if join != old_rev_thread and v_in != old_rev_thread: + u = v_out + while u != up_limit_out and last_succ[u] == old_last_succ: + last_succ[u] = old_rev_thread + u = parent[u] + + else: + u = v_out + while u != up_limit_out and last_succ[u] == old_last_succ: + last_succ[u] = last_succ[u_out] + u = parent[u] + + # Update _succ_num from v_in to join + u = v_in + while u != join: + succ_num[u] += old_succ_num + u = parent[u] + + # Update _succ_num from v_out to join + u = v_out + while u != join: + succ_num[u] -= old_succ_num + u = parent[u] + + +# Update potentials +# locals: sigma, end +# modifies: _pi +@numba.njit( + fastmath=True, + inline="always", + locals={"u": numba.uint16, "u_in": numba.uint16, "v_in": numba.uint16}, +) +def update_potential(leaving_arc_data, pi, cost, spanning_tree): + + thread = spanning_tree.thread + pred = spanning_tree.pred + forward = spanning_tree.forward + last_succ = spanning_tree.last_succ + + u_in = leaving_arc_data.u_in + v_in = leaving_arc_data.v_in + + if forward[u_in]: + sigma = pi[v_in] - pi[u_in] - cost[pred[u_in]] + else: + sigma = pi[v_in] - pi[u_in] + cost[pred[u_in]] + + # Update potentials in the subtree, which has been moved + end = thread[last_succ[u_in]] + u = u_in + while u != end: + pi[u] += sigma + u = thread[u] + + +# If we have mixed arcs (for better random access) +# we need a more complicated function to get the ID of a given arc +@numba.njit() +def arc_id(arc, graph): + k = graph.n_arcs - arc - 1 + if graph.use_arc_mixing: + smallv = (k > graph.num_total_big_subsequence_numbers) & 1 + k -= graph.num_total_big_subsequence_numbers * smallv + subsequence_length2 = graph.subsequence_length - smallv + subsequence_num = ( + k // subsequence_length2 + ) + graph.num_big_subsequences * smallv + subsequence_offset = (k % subsequence_length2) * graph.mixing_coeff + + return subsequence_offset + subsequence_num + else: + return k + + +# Heuristic initial pivots +# locals: curr, total, supply_nodes, demand_nodes, u +# modifies: +@numba.njit(locals={"i": numba.uint16}) +def construct_initial_pivots(graph, node_arc_data, spanning_tree): + + cost = node_arc_data.cost + pi = node_arc_data.pi + source = node_arc_data.source + target = node_arc_data.target + supply = node_arc_data.supply + + n1 = graph.n + n2 = graph.m + n_nodes = graph.n_nodes + n_arcs = graph.n_arcs + + state = spanning_tree.state + + total = 0 + supply_nodes = [] + demand_nodes = [] + + for u in range(n_nodes): + curr = supply[n_nodes - u - 1] # _node_id(u) + if curr > 0: + total += curr + supply_nodes.append(u) + elif curr < 0: + demand_nodes.append(u) + + arc_vector = [] + if len(supply_nodes) == 1 and len(demand_nodes) == 1: + # Perform a reverse graph search from the sink to the source + reached = np.zeros(n_nodes, dtype=np.bool_) + s = supply_nodes[0] + t = demand_nodes[0] + stack = [] + reached[t] = True + stack.append(t) + while len(stack) > 0: + u = stack[-1] + v = stack[-1] + stack.pop(-1) + if v == s: + break + + first_arc = n_arcs + v - n_nodes if v >= n1 else -1 + for a in range(first_arc, -1, -n2): + u = a // n2 + if reached[u]: + continue + + j = arc_id(a, graph) + if INFINITY >= total: + arc_vector.append(j) + reached[u] = True + stack.append(u) + + else: + # Find the min. cost incomming arc for each demand node + for i in range(len(demand_nodes)): + v = demand_nodes[i] + c = MAX + min_cost = MAX + min_arc = INVALID + first_arc = n_arcs + v - n_nodes if v >= n1 else -1 + for a in range(first_arc, -1, -n2): + c = cost[arc_id(a, graph)] + if c < min_cost: + min_cost = c + min_arc = a + + if min_arc != INVALID: + arc_vector.append(arc_id(min_arc, graph)) + + # Perform heuristic initial pivots + in_arc = -1 + for i in range(len(arc_vector)): + in_arc = arc_vector[i] + # Bad arcs + if ( + state[in_arc] * (cost[in_arc] + pi[source[in_arc]] - pi[target[in_arc]]) + >= 0 + ): + continue + + join = find_join_node( + source, target, spanning_tree.succ_num, spanning_tree.parent, in_arc + ) + leaving_arc_data = find_leaving_arc(join, in_arc, node_arc_data, spanning_tree) + if leaving_arc_data.delta >= MAX: + return False, in_arc + + update_flow(join, leaving_arc_data, node_arc_data, spanning_tree, in_arc) + if leaving_arc_data.change: + update_spanning_tree(spanning_tree, leaving_arc_data, join, in_arc, source) + update_potential(leaving_arc_data, pi, cost, spanning_tree) + + return True, in_arc + + +@numba.njit() +def allocate_graph_structures(n, m, use_arc_mixing=True): + + # Size bipartite graph + n_nodes = n + m + n_arcs = n * m + + # Resize vectors + all_node_num = n_nodes + 1 + max_arc_num = n_arcs + 2 * n_nodes + root = n_nodes + + source = np.zeros(max_arc_num, dtype=np.uint16) + target = np.zeros(max_arc_num, dtype=np.uint16) + cost = np.ones(max_arc_num, dtype=np.float64) + supply = np.zeros(all_node_num, dtype=np.float64) + flow = np.zeros(max_arc_num, dtype=np.float64) + pi = np.zeros(all_node_num, dtype=np.float64) + + parent = np.zeros(all_node_num, dtype=np.int32) + pred = np.zeros(all_node_num, dtype=np.int32) + forward = np.zeros(all_node_num, dtype=np.bool_) + thread = np.zeros(all_node_num, dtype=np.int32) + rev_thread = np.zeros(all_node_num, dtype=np.int32) + succ_num = np.zeros(all_node_num, dtype=np.int32) + last_succ = np.zeros(all_node_num, dtype=np.int32) + state = np.zeros(max_arc_num, dtype=np.int8) + + if use_arc_mixing: + # Store the arcs in a mixed order + k = max(np.int32(np.sqrt(n_arcs)), 10) + mixing_coeff = k + subsequence_length = (n_arcs // mixing_coeff) + 1 + num_big_subsequences = n_arcs % mixing_coeff + num_total_big_subsequence_numbers = subsequence_length * num_big_subsequences + + i = 0 + j = 0 + for a in range(n_arcs - 1, -1, -1): + source[i] = n_nodes - (a // m) - 1 + target[i] = n_nodes - ((a % m) + n) - 1 + i += k + if i >= n_arcs: + j += 1 + i = j + + else: + # dummy values + subsequence_length = 0 + mixing_coeff = 0 + num_big_subsequences = 0 + num_total_big_subsequence_numbers = 0 + # Store the arcs in the original order + i = 0 + for a in range(n_arcs - 1, -1, -1): + source[i] = n_nodes - (a // m) - 1 + target[i] = n_nodes - ((a % m) + n) - 1 + i += 1 + + node_arc_data = NodeArcData(cost, supply, flow, pi, source, target) + spanning_tree = SpanningTree( + parent, pred, thread, rev_thread, succ_num, last_succ, forward, state, root + ) + graph = DiGraph( + n_nodes, + n_arcs, + n, + m, + use_arc_mixing, + num_total_big_subsequence_numbers, + subsequence_length, + num_big_subsequences, + mixing_coeff, + ) + + return node_arc_data, spanning_tree, graph + + +@numba.njit(locals={"u": numba.uint16, "e": numba.uint32}) +def initialize_graph_structures(graph, node_arc_data, spanning_tree): + + n_nodes = graph.n_nodes + n_arcs = graph.n_arcs + + # unpack arrays + cost = node_arc_data.cost + supply = node_arc_data.supply + flow = node_arc_data.flow + pi = node_arc_data.pi + source = node_arc_data.source + target = node_arc_data.target + + parent = spanning_tree.parent + pred = spanning_tree.pred + thread = spanning_tree.thread + rev_thread = spanning_tree.rev_thread + succ_num = spanning_tree.succ_num + last_succ = spanning_tree.last_succ + forward = spanning_tree.forward + state = spanning_tree.state + + if n_nodes == 0: + return False + + # Check the sum of supply values + net_supply = 0 + for i in range(n_nodes): + net_supply += supply[i] + + if np.fabs(net_supply) > NET_SUPPLY_ERROR_TOLERANCE: + return False + + # Fix using doubles + # Initialize artifical cost + artificial_cost = 0.0 + for i in range(n_arcs): + if cost[i] > artificial_cost: + artificial_cost = cost[i] + # reset flow and state vectors + if flow[i] != 0: + flow[i] = 0 + state[i] = ArcState.STATE_LOWER + + artificial_cost = (artificial_cost + 1) * n_nodes + + # Set data for the artificial root node + root = n_nodes + parent[root] = -1 + pred[root] = -1 + thread[root] = 0 + rev_thread[0] = root + succ_num[root] = n_nodes + 1 + last_succ[root] = root - 1 + supply[root] = -net_supply + pi[root] = 0 + + # Add artificial arcs and initialize the spanning tree data structure + # EQ supply constraints + e = n_arcs + for u in range(n_nodes): + parent[u] = root + pred[u] = e + thread[u] = u + 1 + rev_thread[u + 1] = u + succ_num[u] = 1 + last_succ[u] = u + state[e] = ArcState.STATE_TREE + if supply[u] >= 0: + forward[u] = True + pi[u] = 0 + source[e] = u + target[e] = root + flow[e] = supply[u] + cost[e] = 0 + else: + forward[u] = False + pi[u] = artificial_cost + source[e] = root + target[e] = u + flow[e] = -supply[u] + cost[e] = artificial_cost + e += 1 + + return True + + +@numba.njit() +def initialize_supply(left_node_supply, right_node_supply, graph, supply): + for n in range(graph.n_nodes): + if n < graph.n: + supply[graph.n_nodes - n - 1] = left_node_supply[n] + else: + supply[graph.n_nodes - n - 1] = right_node_supply[n - graph.n] + + +@numba.njit(inline="always") +def set_cost(arc, cost_val, cost, graph): + cost[arc_id(arc, graph)] = cost_val + + +@numba.njit(locals={"i": numba.uint16, "j": numba.uint16}) +def initialize_cost(cost_matrix, graph, cost): + for i in range(cost_matrix.shape[0]): + for j in range(cost_matrix.shape[1]): + set_cost(i * cost_matrix.shape[1] + j, cost_matrix[i, j], cost, graph) + + +@numba.njit(fastmath=True, locals={"i": numba.uint32}) +def total_cost(flow, cost): + c = 0.0 + for i in range(flow.shape[0]): + c += flow[i] * cost[i] + return c + + +@numba.njit(nogil=True) +def network_simplex_core(node_arc_data, spanning_tree, graph, max_iter): + + # pivot_block = PivotBlock( + # max(np.int32(np.sqrt(graph.n_arcs)), 10), + # np.zeros(1, dtype=np.int32), + # graph.n_arcs, + # ) + pivot_block_size = max(np.int32(np.sqrt(graph.n_arcs)), 10) + search_arc_num = graph.n_arcs + solution_status = ProblemStatus.OPTIMAL + + # Perform heuristic initial pivots + bounded, in_arc = construct_initial_pivots(graph, node_arc_data, spanning_tree) + if not bounded: + return ProblemStatus.UNBOUNDED + + iter_number = 0 + # pivot.setDantzig(true); + # Execute the Network Simplex algorithm + in_arc, pivot_next_arc = find_entering_arc( + pivot_block_size, 0, search_arc_num, spanning_tree.state, node_arc_data, in_arc + ) + while in_arc >= 0: + iter_number += 1 + if max_iter > 0 and iter_number >= max_iter: + solution_status = ProblemStatus.MAX_ITER_REACHED + break + + join = find_join_node( + node_arc_data.source, + node_arc_data.target, + spanning_tree.succ_num, + spanning_tree.parent, + in_arc, + ) + leaving_arc_data = find_leaving_arc(join, in_arc, node_arc_data, spanning_tree) + if leaving_arc_data.delta >= MAX: + return ProblemStatus.UNBOUNDED + + update_flow(join, leaving_arc_data, node_arc_data, spanning_tree, in_arc) + + if leaving_arc_data.change: + update_spanning_tree( + spanning_tree, leaving_arc_data, join, in_arc, node_arc_data.source + ) + update_potential( + leaving_arc_data, node_arc_data.pi, node_arc_data.cost, spanning_tree + ) + + in_arc, pivot_next_arc = find_entering_arc( + pivot_block_size, + pivot_next_arc, + search_arc_num, + spanning_tree.state, + node_arc_data, + in_arc, + ) + + flow = node_arc_data.flow + pi = node_arc_data.pi + + # Check feasibility + if solution_status == ProblemStatus.OPTIMAL: + for e in range(graph.n_arcs, graph.n_arcs + graph.n_nodes): + if flow[e] != 0: + if np.abs(flow[e]) > EPSILON: + return ProblemStatus.INFEASIBLE + else: + flow[e] = 0 + + # Shift potentials to meet the requirements of the GEQ/LEQ type + # optimality conditions + max_pot = -INFINITY + for i in range(graph.n_nodes): + if pi[i] > max_pot: + max_pot = pi[i] + if max_pot > 0: + for i in range(graph.n_nodes): + pi[i] -= max_pot + + return solution_status + + +####################################################### +# SINKHORN distances in various variations +####################################################### + + +@numba.njit( + fastmath=True, + parallel=True, + locals={"diff": numba.float32, "result": numba.float32}, + cache=False, +) +def right_marginal_error(u, K, v, y): + uK = u @ K + result = 0.0 + for i in numba.prange(uK.shape[0]): + diff = y[i] - uK[i] * v[i] + result += diff * diff + return np.sqrt(result) + + +@numba.njit( + fastmath=True, + parallel=True, + locals={"diff": numba.float32, "result": numba.float32}, + cache=False, +) +def right_marginal_error_batch(u, K, v, y): + uK = K.T @ u + result = 0.0 + for i in numba.prange(uK.shape[0]): + for j in range(uK.shape[1]): + diff = y[j, i] - uK[i, j] * v[i, j] + result += diff * diff + return np.sqrt(result) + + +@numba.njit(fastmath=True, parallel=True, cache=False) +def transport_plan(K, u, v): + i_dim = K.shape[0] + j_dim = K.shape[1] + result = np.empty_like(K) + for i in numba.prange(i_dim): + for j in range(j_dim): + result[i, j] = u[i] * K[i, j] * v[j] + + return result + + +@numba.njit(fastmath=True, parallel=True, locals={"result": numba.float32}, cache=False) +def relative_change_in_plan(old_u, old_v, new_u, new_v): + i_dim = old_u.shape[0] + j_dim = old_v.shape[0] + result = 0.0 + for i in numba.prange(i_dim): + for j in range(j_dim): + old_uv = old_u[i] * old_v[j] + result += np.float32(np.abs(old_uv - new_u[i] * new_v[j]) / old_uv) + + return result / (i_dim * j_dim) + + +@numba.njit(fastmath=True, parallel=True, cache=False) +def precompute_K_prime(K, x): + i_dim = K.shape[0] + j_dim = K.shape[1] + result = np.empty_like(K) + for i in numba.prange(i_dim): + if x[i] > 0.0: + x_i_inverse = 1.0 / x[i] + else: + x_i_inverse = INFINITY + for j in range(j_dim): + result[i, j] = x_i_inverse * K[i, j] + + return result + + +@numba.njit(fastmath=True, parallel=True, cache=False) +def K_from_cost(cost, regularization): + i_dim = cost.shape[0] + j_dim = cost.shape[1] + result = np.empty_like(cost) + for i in numba.prange(i_dim): + for j in range(j_dim): + scaled_cost = cost[i, j] / regularization + result[i, j] = np.exp(-scaled_cost) + + return result + + +@numba.njit(fastmath=True, cache=True) +def sinkhorn_iterations( + x, y, u, v, K, max_iter=1000, error_tolerance=1e-9, change_tolerance=1e-9 +): + K_prime = precompute_K_prime(K, x) + + prev_u = u + prev_v = v + + for iteration in range(max_iter): + + next_v = y / (K.T @ u) + + if np.any(~np.isfinite(next_v)): + break + + next_u = 1.0 / (K_prime @ next_v) + + if np.any(~np.isfinite(next_u)): + break + + u = next_u + v = next_v + + if iteration % 20 == 0: + # Check if values in plan have changed significantly since last 20 iterations + relative_change = relative_change_in_plan(prev_u, prev_v, next_u, next_v) + if relative_change <= change_tolerance: + break + + prev_u = u + prev_v = v + + if iteration % 10 == 0: + # Check if right marginal error is less than tolerance every 10 iterations + err = right_marginal_error(u, K, v, y) + if err <= error_tolerance: + break + + return u, v + + +@numba.njit(fastmath=True, cache=True) +def sinkhorn_iterations_batch(x, y, u, v, K, max_iter=1000, error_tolerance=1e-9): + K_prime = precompute_K_prime(K, x) + + for iteration in range(max_iter): + + next_v = y.T / (K.T @ u) + + if np.any(~np.isfinite(next_v)): + break + + next_u = 1.0 / (K_prime @ next_v) + + if np.any(~np.isfinite(next_u)): + break + + u = next_u + v = next_v + + if iteration % 10 == 0: + # Check if right marginal error is less than tolerance every 10 iterations + err = right_marginal_error_batch(u, K, v, y) + if err <= error_tolerance: + break + + return u, v + + +@numba.njit(fastmath=True, cache=True) +def sinkhorn_transport_plan( + x, + y, + cost=_dummy_cost, + regularization=1.0, + max_iter=1000, + error_tolerance=1e-9, + change_tolerance=1e-9, +): + dim_x = x.shape[0] + dim_y = y.shape[0] + u = np.full(dim_x, 1.0 / dim_x, dtype=cost.dtype) + v = np.full(dim_y, 1.0 / dim_y, dtype=cost.dtype) + + K = K_from_cost(cost, regularization) + u, v = sinkhorn_iterations( + x, + y, + u, + v, + K, + max_iter=max_iter, + error_tolerance=error_tolerance, + change_tolerance=change_tolerance, + ) + + return transport_plan(K, u, v) + + +@numba.njit(fastmath=True, cache=True) +def sinkhorn_distance(x, y, cost=_dummy_cost, regularization=1.0): + transport_plan = sinkhorn_transport_plan( + x, y, cost=cost, regularization=regularization + ) + dim_i = transport_plan.shape[0] + dim_j = transport_plan.shape[1] + result = 0.0 + for i in range(dim_i): + for j in range(dim_j): + result += transport_plan[i, j] * cost[i, j] + + return result + + +@numba.njit(fastmath=True, parallel=True, cache=False) +def sinkhorn_distance_batch(x, y, cost=_dummy_cost, regularization=1.0): + dim_x = x.shape[0] + dim_y = y.shape[0] + + batch_size = y.shape[1] + + u = np.full((dim_x, batch_size), 1.0 / dim_x, dtype=cost.dtype) + v = np.full((dim_y, batch_size), 1.0 / dim_y, dtype=cost.dtype) + + K = K_from_cost(cost, regularization) + u, v = sinkhorn_iterations_batch( + x, + y, + u, + v, + K, + ) + + i_dim = K.shape[0] + j_dim = K.shape[1] + result = np.zeros(batch_size) + for i in range(i_dim): + for j in range(j_dim): + K_times_cost = K[i, j] * cost[i, j] + for batch in range(batch_size): + result[batch] += u[i, batch] * K_times_cost * v[j, batch] + + return result + + +def make_fixed_cost_sinkhorn_distance(cost, regularization=1.0): + + K = K_from_cost(cost, regularization) + dim_x = K.shape[0] + dim_y = K.shape[1] + + @numba.njit(fastmath=True) + def closure(x, y): + u = np.full(dim_x, 1.0 / dim_x, dtype=cost.dtype) + v = np.full(dim_y, 1.0 / dim_y, dtype=cost.dtype) + + K = K_from_cost(cost, regularization) + u, v = sinkhorn_iterations( + x, + y, + u, + v, + K, + ) + + current_plan = transport_plan(K, u, v) + + result = 0.0 + for i in range(dim_x): + for j in range(dim_y): + result += current_plan[i, j] * cost[i, j] + + return result + + return closure diff --git a/shared/package-files/32/320cceeab3e51f6f4515bee7920fbb652418523bd0f769be82a892f9bab9676c/blob b/shared/package-files/32/320cceeab3e51f6f4515bee7920fbb652418523bd0f769be82a892f9bab9676c/blob new file mode 100644 index 0000000000000000000000000000000000000000..92fc2115e9731cca3008b4ca0f5fbfe020196849 --- /dev/null +++ b/shared/package-files/32/320cceeab3e51f6f4515bee7920fbb652418523bd0f769be82a892f9bab9676c/blob @@ -0,0 +1,33 @@ +from collections import UserList +from datetime import datetime +from typing import Any, Dict, List, Optional, Sequence, Union + +from django.core.exceptions import ValidationError +from django.utils.safestring import SafeText + +def pretty_name(name: str) -> str: ... +def flatatt(attrs: Dict[str, Any]) -> SafeText: ... + +class ErrorDict(dict): + def as_data(self) -> Dict[str, List[ValidationError]]: ... + def get_json_data(self, escape_html: bool = ...) -> Dict[str, Any]: ... + def as_json(self, escape_html: bool = ...) -> str: ... + def as_ul(self) -> str: ... + def as_text(self) -> str: ... + +class ErrorList(UserList): + data: List[Union[ValidationError, str]] + error_class: str = ... + def __init__( + self, + initlist: Optional[Union[ErrorList, Sequence[Union[str, Exception]]]] = ..., + error_class: Optional[str] = ..., + ) -> None: ... + def as_data(self) -> List[ValidationError]: ... + def get_json_data(self, escape_html: bool = ...) -> List[Dict[str, str]]: ... + def as_json(self, escape_html: bool = ...) -> str: ... + def as_ul(self) -> str: ... + def as_text(self) -> str: ... + +def from_current_timezone(value: datetime) -> datetime: ... +def to_current_timezone(value: datetime) -> datetime: ... diff --git a/shared/package-files/32/320de8e22b5d74767e87fabe35eacbdff562c3ae498f6fcec9628f7fc895e0e9/blob b/shared/package-files/32/320de8e22b5d74767e87fabe35eacbdff562c3ae498f6fcec9628f7fc895e0e9/blob new file mode 100644 index 0000000000000000000000000000000000000000..8b3aa9aeb267455bc993057bec369c74cf807a96 --- /dev/null +++ b/shared/package-files/32/320de8e22b5d74767e87fabe35eacbdff562c3ae498f6fcec9628f7fc895e0e9/blob @@ -0,0 +1,493 @@ +import contextlib +import fnmatch +import hashlib +import logging +import os +import re +import shutil +import sys +import warnings as _warnings +from concurrent.futures import Executor, ProcessPoolExecutor, ThreadPoolExecutor +from errno import EACCES, ENOENT, EPERM, EROFS +from itertools import chain +from os.path import ( + abspath, + basename, + dirname, + isdir, + isfile, + islink, + join, + lexists, + normpath, + split, +) +from stat import S_IEXEC, S_IMODE, S_ISDIR, S_ISREG, S_IWRITE +from subprocess import STDOUT, CalledProcessError, check_output, list2cmdline +from tempfile import NamedTemporaryFile, mkdtemp + +on_win = sys.platform == "win32" +log = logging.getLogger(__file__) +CONDA_TEMP_EXTENSION = ".c~" + + +def which(executable): + from distutils.spawn import find_executable + + return find_executable(executable) + + +def make_writable(path): + try: + mode = os.lstat(path).st_mode + if S_ISDIR(mode): + os.chmod(path, S_IMODE(mode) | S_IWRITE | S_IEXEC) + elif S_ISREG(mode) or islink(path): + os.chmod(path, S_IMODE(mode) | S_IWRITE) + else: + log.debug("path cannot be made writable: %s", path) + return True + except Exception as e: + eno = getattr(e, "errno", None) + if eno in (ENOENT,): + log.debug("tried to make writable, but didn't exist: %s", path) + raise + elif eno in (EACCES, EPERM, EROFS): + log.debug("tried make writable but failed: %s\n%r", path, e) + return False + else: + log.warn("Error making path writable: %s\n%r", path, e) + raise + + +class DummyExecutor(Executor): + def map(self, func, *iterables): + for iterable in iterables: + for thing in iterable: + yield func(thing) + + +def get_executor(processes): + return DummyExecutor() if processes == 1 else ProcessPoolExecutor(max_workers=processes) + + +def recursive_make_writable(path): + # The need for this function was pointed out at + # https://github.com/conda/conda/issues/3266#issuecomment-239241915 + # Especially on windows, file removal will often fail because it is marked read-only + if isdir(path): + for root, dirs, files in os.walk(path): + for path in chain.from_iterable((files, dirs)): + try: + make_writable(join(root, path)) + except: + pass + else: + try: + make_writable(path) + except: + pass + + +def quote_for_shell(arguments, shell=None): + if not shell: + shell = "cmd.exe" if on_win else "bash" + if shell == "cmd.exe": + return list2cmdline(arguments) + else: + # If any multiline argument gets mixed with any other argument (which is true if we've + # arrived in this function) then we just quote it. This assumes something like: + # ['python', '-c', 'a\nmultiline\nprogram\n'] + # It may make sense to allow specifying a replacement character for '\n' too? e.g. ';' + quoted = [] + # This could all be replaced with some regex wizardry but that is less readable and + # for code like this, readability is very important. + for arg in arguments: + if '"' in arg: + quote = "'" + elif "'" in arg: + quote = '"' + elif not any(_ in arg for _ in (" ", "\n")): + quote = "" + else: + quote = '"' + quoted.append(quote + arg + quote) + return " ".join(quoted) + + +def rmtree(path, *args, **kwargs): + # subprocessing to delete large folders can be quite a bit faster + path = normpath(path) + if on_win: + try: + # the fastest way seems to be using DEL to recursively delete files + # https://www.ghacks.net/2017/07/18/how-to-delete-large-folders-in-windows-super-fast/ + # However, this is not entirely safe, as it can end up following symlinks to folders + # https://superuser.com/a/306618/184799 + # so, we stick with the slower, but hopefully safer way. Maybe if we figured out how + # to scan for any possible symlinks, we could do the faster way. + # out = check_output('DEL /F/Q/S *.* > NUL 2> NUL'.format(path), shell=True, + # stderr=STDOUT, cwd=path) + + out = check_output(f'RD /S /Q "{path}" > NUL 2> NUL', shell=True, stderr=STDOUT) + except: + try: + # Try to delete in Unicode + name = None + + with NamedTemporaryFile(suffix=".bat", delete=False) as batch_file: + batch_file.write(f"RD /S {quote_for_shell([path])}\n") + batch_file.write("chcp 65001\n") + batch_file.write(f"RD /S {quote_for_shell([path])}\n") + batch_file.write("EXIT 0\n") + name = batch_file.name + # If the above is bugged we can end up deleting hard-drives, so we check + # that 'path' appears in it. This is not bulletproof but it could save you (me). + with open(name) as contents: + content = contents.read() + assert path in content + comspec = os.environ["COMSPEC"] + CREATE_NO_WINDOW = 0x08000000 + # It is essential that we `pass stdout=None, stderr=None, stdin=None` here because + # if we do not, then the standard console handles get attached and chcp affects the + # parent process (and any which share those console handles!) + out = check_output( + [comspec, "/d", "/c", name], + shell=False, + stdout=None, + stderr=None, + stdin=None, + creationflags=CREATE_NO_WINDOW, + ) + + except CalledProcessError as e: + if e.returncode != 5: + log.error(f"Removing folder {path} the fast way failed. Output was: {out}") + raise + else: + log.debug(f"removing dir contents the fast way failed. Output was: {out}") + else: + try: + os.makedirs(".empty") + except: + pass + # yes, this looks strange. See + # https://unix.stackexchange.com/a/79656/34459 + # https://web.archive.org/web/20130929001850/http://linuxnote.net/jianingy/en/linux/a-fast-way-to-remove-huge-number-of-files.html # NOQA + rsync = which("rsync") + if rsync and isdir(".empty"): + try: + out = check_output( + [ + rsync, + "-a", + "--force", + "--delete", + join(os.getcwd(), ".empty") + "/", + path + "/", + ], + stderr=STDOUT, + ) + except CalledProcessError: + log.debug(f"removing dir contents the fast way failed. Output was: {out}") + shutil.rmtree(".empty") + shutil.rmtree(path) + + +def unlink_or_rename_to_trash(path): + """If files are in use, especially on windows, we can't remove them. + The fallback path is to rename them (but keep their folder the same), + which maintains the file handle validity. See comments at: + https://serverfault.com/a/503769 + """ + try: + make_writable(path) + os.unlink(path) + except OSError: + try: + os.rename(path, path + ".conda_trash") + except OSError: + if on_win: + # on windows, it is important to use the rename program, as just using python's + # rename leads to permission errors when files are in use. + with NamedTemporaryFile(suffix=".bat") as trash_script: + with open(trash_script, "w") as f: + f.write('@pushd "%1"\n') + f.write("@REM Rename src to dest") + f.write('@ren "%2" "%3" > NUL 2> NUL")') + + _dirname, _fn = split(path) + dest_fn = path + ".conda_trash" + counter = 1 + while isfile(dest_fn): + dest_fn = dest_fn.splitext[0] + f".conda_trash_{counter}" + counter += 1 + out = "< empty >" + try: + out = check_output( + [ + "cmd.exe", + "/C", + trash_script, + _dirname, + _fn, + basename(dest_fn), + ], + stderr=STDOUT, + ) + except CalledProcessError: + log.warn( + "renaming file path {} to trash failed. Output was: {}".format( + path, out + ) + ) + + log.warn( + "Could not remove or rename {}. Please remove this file manually (you " + "may need to reboot to free file handles)".format(path) + ) + + +def remove_empty_parent_paths(path): + # recurse to clean up empty folders that were created to have a nested hierarchy + parent_path = dirname(path) + while isdir(parent_path) and not os.listdir(parent_path): + rmdir(parent_path) + parent_path = dirname(parent_path) + + +def rm_rf(path, clean_empty_parents=False, *args, **kw): + """ + Completely delete path + max_retries is the number of times to retry on failure. The default is 5. This only applies + to deleting a directory. + If removing path fails and trash is True, files will be moved to the trash directory. + """ + recursive_make_writable(path) + try: + path = abspath(path) + if isdir(path) and not islink(path): + rmdir(path) + elif lexists(path): + unlink_or_rename_to_trash(path) + else: + log.debug("rm_rf failed. Not a link, file, or directory: %s", path) + finally: + if lexists(path): + log.info("rm_rf failed for %s", path) + return False + if isdir(path): + delete_trash(path) + if clean_empty_parents: + remove_empty_parent_paths(path) + return True + + +# aliases that all do the same thing (legacy compat) +try_rmdir_all_empty = move_to_trash = move_path_to_trash = rm_rf + + +def delete_trash(prefix): + if not prefix: + prefix = sys.prefix + exclude = {"envs"} + for root, dirs, files in os.walk(prefix, topdown=True): + dirs[:] = [d for d in dirs if d not in exclude] + for fn in files: + if fnmatch.fnmatch(fn, "*.conda_trash*") or fnmatch.fnmatch( + fn, "*" + CONDA_TEMP_EXTENSION + ): + filename = join(root, fn) + try: + os.unlink(filename) + remove_empty_parent_paths(filename) + except OSError as e: + log.debug("%r errno %d\nCannot unlink %s.", e, e.errno, filename) + + +def rmdir(dirpath): + if not isdir(dirpath): + return + try: + rmtree(dirpath) + # we don't really care about errors that much. We'll catch remaining files + # with slower python logic. + except: + pass + + for root, dirs, files in os.walk(dirpath, topdown=False): + for f in files: + unlink_or_rename_to_trash(join(root, f)) + + +# we have our own TemporaryDirectory class because it's faster and handles disk issues better. +class TemporaryDirectory: + """Create and return a temporary directory. This has the same + behavior as mkdtemp but can be used as a context manager. For + example: + + with TemporaryDirectory() as tmpdir: + ... + + Upon exiting the context, the directory and everything contained + in it are removed. + """ + + # Handle mkdtemp raising an exception + name = None + _closed = False + + def __init__(self, suffix="", prefix=".cph_tmp", dir=os.getcwd()): + self.name = mkdtemp(suffix, prefix, dir) + + def __repr__(self): + return f"<{self.__class__.__name__} {self.name!r}>" + + def __enter__(self): + return self.name + + def cleanup(self, _warn=False, _warnings=_warnings): + if self.name and not self._closed: + try: + rm_rf(self.name) + except: + _warnings.warn( + 'Conda-package-handling says: "I tried to clean up, ' + "but I could not. There is a mess in %s that you might " + 'want to clean up yourself. Sorry..."' % self.name + ) + self._closed = True + if _warn and _warnings.warn: + _warnings.warn( + f"Implicitly cleaning up {self!r}", + _warnings.ResourceWarning, + ) + + def __exit__(self, exc, value, tb): + self.cleanup() + + def __del__(self): + # Issue a ResourceWarning if implicit cleanup needed + self.cleanup(_warn=True) + + +@contextlib.contextmanager +def tmp_chdir(dest): + curdir = os.getcwd() + try: + os.chdir(dest) + yield + finally: + os.chdir(curdir) + + +def ensure_list(arg): + if isinstance(arg, str) or not hasattr(arg, "__iter__"): + if arg is not None: + arg = [arg] + else: + arg = [] + return arg + + +def filter_files( + files_list, + prefix, + filter_patterns=( + r"(.*[\\\\/])?\.git[\\\\/].*", + r"(.*[\\\\/])?\.git$", + r"(.*)?\.DS_Store.*", + r".*\.la$", + r"conda-meta.*", + ), +): + """Remove things like the .git directory from the list of files to be copied""" + for pattern in filter_patterns: + r = re.compile(pattern) + files_list = set(files_list) - set(filter(r.match, files_list)) + return [ + f + for f in files_list + if + # `islink` prevents symlinks to directories from being removed + os.path.islink(os.path.join(prefix, f)) or not os.path.isdir(os.path.join(prefix, f)) + ] + + +def filter_info_files(files_list, prefix): + return filter_files( + files_list, + prefix, + filter_patterns=( + "info[\\\\/]index\\.json", + "info[\\\\/]files", + "info[\\\\/]paths\\.json", + "info[\\\\/]about\\.json", + "info[\\\\/]has_prefix", + "info[\\\\/]hash_input_files", # legacy, not used anymore + "info[\\\\/]hash_input\\.json", + "info[\\\\/]run_exports\\.yaml", # legacy + "info[\\\\/]run_exports\\.json", # current + "info[\\\\/]git", + "info[\\\\/]recipe[\\\\/].*", + "info[\\\\/]recipe_log.json", + "info[\\\\/]recipe.tar", + "info[\\\\/]test[\\\\/].*", + "info[\\\\/]LICENSE.*", + "info[\\\\/]requires", + "info[\\\\/]meta", + "info[\\\\/]platform", + "info[\\\\/]no_link", + "info[\\\\/]link\\.json", + "info[\\\\/]icon\\.png", + ), + ) + + +def _checksum(fd, algorithm, buffersize=65536): + hash_impl = getattr(hashlib, algorithm) + if not hash_impl: + raise ValueError(f"Unrecognized hash algorithm: {algorithm}") + else: + hash_impl = hash_impl() + for block in iter(lambda: fd.read(buffersize), b""): + hash_impl.update(block) + return hash_impl.hexdigest() + + +def sha256_checksum(fd): + return _checksum(fd, "sha256") + + +def md5_checksum(fd): + return _checksum(fd, "md5") + + +def checksum(fn, algorithm, buffersize=1 << 18): + """ + Calculate a checksum for a filename (not an open file). + """ + with open(fn, "rb") as fd: + return _checksum(fd, algorithm, buffersize) + + +def checksums(fn, algorithms, buffersize=1 << 18): + """ + Calculate multiple checksums for a filename in parallel. + """ + with ThreadPoolExecutor(max_workers=len(algorithms)) as e: + # take care not to share hash_impl between threads + results = [e.submit(checksum, fn, algorithm, buffersize) for algorithm in algorithms] + return [result.result() for result in results] + + +def anonymize_tarinfo(tarinfo): + """ + Remove user id, name from tarinfo. + """ + # also remove timestamps? + tarinfo.uid = 0 + tarinfo.uname = "" + tarinfo.gid = 0 + tarinfo.gname = "" + return tarinfo diff --git a/shared/package-files/32/320e1d8e583d6c7c1f5a26bb913b1315d62a8ec594ca23ff52b9a517218214c9/blob b/shared/package-files/32/320e1d8e583d6c7c1f5a26bb913b1315d62a8ec594ca23ff52b9a517218214c9/blob new file mode 100644 index 0000000000000000000000000000000000000000..5a4f10ed85baabd4a10da33c7695abdb959a0eb6 --- /dev/null +++ b/shared/package-files/32/320e1d8e583d6c7c1f5a26bb913b1315d62a8ec594ca23ff52b9a517218214c9/blob @@ -0,0 +1,30 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_cslt_compress(Tensor input) -> Tensor +inline at::Tensor _cslt_compress(const at::Tensor & input) { + return at::_ops::_cslt_compress::call(input); +} + +} diff --git a/shared/package-files/32/320f996f1f43e0a3bf44729c901672b9a07966798be64ff26f0f953aff41021a/blob b/shared/package-files/32/320f996f1f43e0a3bf44729c901672b9a07966798be64ff26f0f953aff41021a/blob new file mode 100644 index 0000000000000000000000000000000000000000..f3f8f0e1fdf4c230a2913b6274dbaf681fa4df17 --- /dev/null +++ b/shared/package-files/32/320f996f1f43e0a3bf44729c901672b9a07966798be64ff26f0f953aff41021a/blob @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor cudnn_affine_grid_generator(const at::Tensor & theta, int64_t N, int64_t C, int64_t H, int64_t W); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/32/32108975cdae6500033fd995ff28642facdcfabeb25e22f82894d3f488d0c868/blob b/shared/package-files/32/32108975cdae6500033fd995ff28642facdcfabeb25e22f82894d3f488d0c868/blob new file mode 100644 index 0000000000000000000000000000000000000000..b9290baae61fe8b96dffeeebb1e840c9d2949608 --- /dev/null +++ b/shared/package-files/32/32108975cdae6500033fd995ff28642facdcfabeb25e22f82894d3f488d0c868/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_sparse_csr_prod.dim_dtype(Tensor self, int[1] dim, bool keepdim=False, *, ScalarType? dtype=None) -> Tensor +inline at::Tensor _sparse_csr_prod(const at::Tensor & self, at::IntArrayRef dim, bool keepdim=false, c10::optional dtype=c10::nullopt) { + return at::_ops::_sparse_csr_prod_dim_dtype::call(self, dim, keepdim, dtype); +} + +// aten::_sparse_csr_prod.dim_dtype_out(Tensor self, int[1] dim, bool keepdim=False, *, ScalarType? dtype=None, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & _sparse_csr_prod_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef dim, bool keepdim=false, c10::optional dtype=c10::nullopt) { + return at::_ops::_sparse_csr_prod_dim_dtype_out::call(self, dim, keepdim, dtype, out); +} +// aten::_sparse_csr_prod.dim_dtype_out(Tensor self, int[1] dim, bool keepdim=False, *, ScalarType? dtype=None, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & _sparse_csr_prod_outf(const at::Tensor & self, at::IntArrayRef dim, bool keepdim, c10::optional dtype, at::Tensor & out) { + return at::_ops::_sparse_csr_prod_dim_dtype_out::call(self, dim, keepdim, dtype, out); +} + +} diff --git a/shared/package-files/32/3211959beba2d9a5e95409567047d8ff854d4f9e77d8e623d030a34943ac516e/blob b/shared/package-files/32/3211959beba2d9a5e95409567047d8ff854d4f9e77d8e623d030a34943ac516e/blob new file mode 100644 index 0000000000000000000000000000000000000000..96480c7fc0691227420033242b69b04e895d1d3c --- /dev/null +++ b/shared/package-files/32/3211959beba2d9a5e95409567047d8ff854d4f9e77d8e623d030a34943ac516e/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3211959beba2d9a5e95409567047d8ff854d4f9e77d8e623d030a34943ac516e +size 14798681 diff --git a/shared/package-files/32/321245e3a66997b61f2214325015e61b9a64398230c37092ae487220afc52f9f/blob b/shared/package-files/32/321245e3a66997b61f2214325015e61b9a64398230c37092ae487220afc52f9f/blob new file mode 100644 index 0000000000000000000000000000000000000000..5c75e8bdab2a1c0c5ba574677301b316554ad321 --- /dev/null +++ b/shared/package-files/32/321245e3a66997b61f2214325015e61b9a64398230c37092ae487220afc52f9f/blob @@ -0,0 +1,136 @@ +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +from google.protobuf.descriptor import ( + Descriptor as google___protobuf___descriptor___Descriptor, + EnumDescriptor as google___protobuf___descriptor___EnumDescriptor, + FileDescriptor as google___protobuf___descriptor___FileDescriptor, +) + +from google.protobuf.descriptor_pb2 import ( + FileDescriptorProto as google___protobuf___descriptor_pb2___FileDescriptorProto, + GeneratedCodeInfo as google___protobuf___descriptor_pb2___GeneratedCodeInfo, +) + +from google.protobuf.internal.containers import ( + RepeatedCompositeFieldContainer as google___protobuf___internal___containers___RepeatedCompositeFieldContainer, + RepeatedScalarFieldContainer as google___protobuf___internal___containers___RepeatedScalarFieldContainer, +) + +from google.protobuf.internal.enum_type_wrapper import ( + _EnumTypeWrapper as google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper, +) + +from google.protobuf.message import ( + Message as google___protobuf___message___Message, +) + +from typing import ( + Iterable as typing___Iterable, + NewType as typing___NewType, + Optional as typing___Optional, + Text as typing___Text, + cast as typing___cast, +) + +from typing_extensions import ( + Literal as typing_extensions___Literal, +) + + +builtin___bool = bool +builtin___bytes = bytes +builtin___float = float +builtin___int = int + + +DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ... + +class Version(google___protobuf___message___Message): + DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... + major: builtin___int = ... + minor: builtin___int = ... + patch: builtin___int = ... + suffix: typing___Text = ... + + def __init__(self, + *, + major : typing___Optional[builtin___int] = None, + minor : typing___Optional[builtin___int] = None, + patch : typing___Optional[builtin___int] = None, + suffix : typing___Optional[typing___Text] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"major",b"major",u"minor",b"minor",u"patch",b"patch",u"suffix",b"suffix"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"major",b"major",u"minor",b"minor",u"patch",b"patch",u"suffix",b"suffix"]) -> None: ... +type___Version = Version + +class CodeGeneratorRequest(google___protobuf___message___Message): + DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... + file_to_generate: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] = ... + parameter: typing___Text = ... + + @property + def proto_file(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[google___protobuf___descriptor_pb2___FileDescriptorProto]: ... + + @property + def compiler_version(self) -> type___Version: ... + + def __init__(self, + *, + file_to_generate : typing___Optional[typing___Iterable[typing___Text]] = None, + parameter : typing___Optional[typing___Text] = None, + proto_file : typing___Optional[typing___Iterable[google___protobuf___descriptor_pb2___FileDescriptorProto]] = None, + compiler_version : typing___Optional[type___Version] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"compiler_version",b"compiler_version",u"parameter",b"parameter"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"compiler_version",b"compiler_version",u"file_to_generate",b"file_to_generate",u"parameter",b"parameter",u"proto_file",b"proto_file"]) -> None: ... +type___CodeGeneratorRequest = CodeGeneratorRequest + +class CodeGeneratorResponse(google___protobuf___message___Message): + DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... + FeatureValue = typing___NewType('FeatureValue', builtin___int) + type___FeatureValue = FeatureValue + Feature: _Feature + class _Feature(google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper[CodeGeneratorResponse.FeatureValue]): + DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ... + FEATURE_NONE = typing___cast(CodeGeneratorResponse.FeatureValue, 0) + FEATURE_PROTO3_OPTIONAL = typing___cast(CodeGeneratorResponse.FeatureValue, 1) + FEATURE_NONE = typing___cast(CodeGeneratorResponse.FeatureValue, 0) + FEATURE_PROTO3_OPTIONAL = typing___cast(CodeGeneratorResponse.FeatureValue, 1) + + class File(google___protobuf___message___Message): + DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... + name: typing___Text = ... + insertion_point: typing___Text = ... + content: typing___Text = ... + + @property + def generated_code_info(self) -> google___protobuf___descriptor_pb2___GeneratedCodeInfo: ... + + def __init__(self, + *, + name : typing___Optional[typing___Text] = None, + insertion_point : typing___Optional[typing___Text] = None, + content : typing___Optional[typing___Text] = None, + generated_code_info : typing___Optional[google___protobuf___descriptor_pb2___GeneratedCodeInfo] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"content",b"content",u"generated_code_info",b"generated_code_info",u"insertion_point",b"insertion_point",u"name",b"name"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"content",b"content",u"generated_code_info",b"generated_code_info",u"insertion_point",b"insertion_point",u"name",b"name"]) -> None: ... + type___File = File + + error: typing___Text = ... + supported_features: builtin___int = ... + + @property + def file(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___CodeGeneratorResponse.File]: ... + + def __init__(self, + *, + error : typing___Optional[typing___Text] = None, + supported_features : typing___Optional[builtin___int] = None, + file : typing___Optional[typing___Iterable[type___CodeGeneratorResponse.File]] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"error",b"error",u"supported_features",b"supported_features"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"error",b"error",u"file",b"file",u"supported_features",b"supported_features"]) -> None: ... +type___CodeGeneratorResponse = CodeGeneratorResponse diff --git a/shared/package-files/32/3212543684feef77fea9442b687e6b7f67d93e5144135aa44fd5f0180e4c0591/blob b/shared/package-files/32/3212543684feef77fea9442b687e6b7f67d93e5144135aa44fd5f0180e4c0591/blob new file mode 100644 index 0000000000000000000000000000000000000000..2da48e78d2c8df7a5cb6b858b1e503406e4c220d --- /dev/null +++ b/shared/package-files/32/3212543684feef77fea9442b687e6b7f67d93e5144135aa44fd5f0180e4c0591/blob @@ -0,0 +1,91 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::slice_backward(Tensor grad_output, SymInt[] input_sizes, int dim, SymInt start, SymInt end, SymInt step) -> Tensor +inline at::Tensor slice_backward(const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t start, int64_t end, int64_t step) { + return at::_ops::slice_backward::call(grad_output, c10::fromIntArrayRefSlow(input_sizes), dim, start, end, step); +} +namespace symint { + template ::value>> + at::Tensor slice_backward(const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t start, int64_t end, int64_t step) { + return at::_ops::slice_backward::call(grad_output, c10::fromIntArrayRefSlow(input_sizes), dim, start, end, step); + } +} + +// aten::slice_backward(Tensor grad_output, SymInt[] input_sizes, int dim, SymInt start, SymInt end, SymInt step) -> Tensor +inline at::Tensor slice_backward_symint(const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt start, c10::SymInt end, c10::SymInt step) { + return at::_ops::slice_backward::call(grad_output, input_sizes, dim, start, end, step); +} +namespace symint { + template ::value>> + at::Tensor slice_backward(const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt start, c10::SymInt end, c10::SymInt step) { + return at::_ops::slice_backward::call(grad_output, input_sizes, dim, start, end, step); + } +} + +// aten::slice_backward.out(Tensor grad_output, SymInt[] input_sizes, int dim, SymInt start, SymInt end, SymInt step, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_backward_out(at::Tensor & out, const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t start, int64_t end, int64_t step) { + return at::_ops::slice_backward_out::call(grad_output, c10::fromIntArrayRefSlow(input_sizes), dim, start, end, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_backward_out(at::Tensor & out, const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t start, int64_t end, int64_t step) { + return at::_ops::slice_backward_out::call(grad_output, c10::fromIntArrayRefSlow(input_sizes), dim, start, end, step, out); + } +} + +// aten::slice_backward.out(Tensor grad_output, SymInt[] input_sizes, int dim, SymInt start, SymInt end, SymInt step, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_backward_outf(const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t start, int64_t end, int64_t step, at::Tensor & out) { + return at::_ops::slice_backward_out::call(grad_output, c10::fromIntArrayRefSlow(input_sizes), dim, start, end, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_backward_outf(const at::Tensor & grad_output, at::IntArrayRef input_sizes, int64_t dim, int64_t start, int64_t end, int64_t step, at::Tensor & out) { + return at::_ops::slice_backward_out::call(grad_output, c10::fromIntArrayRefSlow(input_sizes), dim, start, end, step, out); + } +} + +// aten::slice_backward.out(Tensor grad_output, SymInt[] input_sizes, int dim, SymInt start, SymInt end, SymInt step, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_backward_symint_out(at::Tensor & out, const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt start, c10::SymInt end, c10::SymInt step) { + return at::_ops::slice_backward_out::call(grad_output, input_sizes, dim, start, end, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_backward_out(at::Tensor & out, const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt start, c10::SymInt end, c10::SymInt step) { + return at::_ops::slice_backward_out::call(grad_output, input_sizes, dim, start, end, step, out); + } +} + +// aten::slice_backward.out(Tensor grad_output, SymInt[] input_sizes, int dim, SymInt start, SymInt end, SymInt step, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_backward_symint_outf(const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt start, c10::SymInt end, c10::SymInt step, at::Tensor & out) { + return at::_ops::slice_backward_out::call(grad_output, input_sizes, dim, start, end, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_backward_outf(const at::Tensor & grad_output, c10::SymIntArrayRef input_sizes, int64_t dim, c10::SymInt start, c10::SymInt end, c10::SymInt step, at::Tensor & out) { + return at::_ops::slice_backward_out::call(grad_output, input_sizes, dim, start, end, step, out); + } +} + +} diff --git a/shared/package-files/32/3212bc4d893d7ebbc7cddea573d04eb8b5a6d7319c5658bf1154d70c5f28a16e/blob b/shared/package-files/32/3212bc4d893d7ebbc7cddea573d04eb8b5a6d7319c5658bf1154d70c5f28a16e/blob new file mode 100644 index 0000000000000000000000000000000000000000..1cf6efb0f1a10ddfc8b79f3dd3c042d6f944b8fc Binary files /dev/null and b/shared/package-files/32/3212bc4d893d7ebbc7cddea573d04eb8b5a6d7319c5658bf1154d70c5f28a16e/blob differ diff --git a/shared/package-files/32/321333b3eaad9ecbf633186bc625d4a60c4c736def0fa00665add2ab899eecb1/blob b/shared/package-files/32/321333b3eaad9ecbf633186bc625d4a60c4c736def0fa00665add2ab899eecb1/blob new file mode 100644 index 0000000000000000000000000000000000000000..6c07389b29ad4558077353dd65eccb32c722dcba --- /dev/null +++ b/shared/package-files/32/321333b3eaad9ecbf633186bc625d4a60c4c736def0fa00665add2ab899eecb1/blob @@ -0,0 +1,294 @@ +"Test replace, coverage 78%." + +from idlelib.replace import ReplaceDialog +import unittest +from test.support import requires +requires('gui') +from tkinter import Tk, Text + +from unittest.mock import Mock +from idlelib.idle_test.mock_tk import Mbox +import idlelib.searchengine as se + +orig_mbox = se.messagebox +showerror = Mbox.showerror + + +class ReplaceDialogTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + se.messagebox = Mbox + cls.engine = se.SearchEngine(cls.root) + cls.dialog = ReplaceDialog(cls.root, cls.engine) + cls.dialog.bell = lambda: None + cls.dialog.ok = Mock() + cls.text = Text(cls.root) + cls.text.undo_block_start = Mock() + cls.text.undo_block_stop = Mock() + cls.dialog.text = cls.text + + @classmethod + def tearDownClass(cls): + se.messagebox = orig_mbox + del cls.text, cls.dialog, cls.engine + cls.root.destroy() + del cls.root + + def setUp(self): + self.text.insert('insert', 'This is a sample sTring') + + def tearDown(self): + self.engine.patvar.set('') + self.dialog.replvar.set('') + self.engine.wordvar.set(False) + self.engine.casevar.set(False) + self.engine.revar.set(False) + self.engine.wrapvar.set(True) + self.engine.backvar.set(False) + showerror.title = '' + showerror.message = '' + self.text.delete('1.0', 'end') + + def test_replace_simple(self): + # Test replace function with all options at default setting. + # Wrap around - True + # Regular Expression - False + # Match case - False + # Match word - False + # Direction - Forwards + text = self.text + equal = self.assertEqual + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + + # test accessor method + self.engine.setpat('asdf') + equal(self.engine.getpat(), pv.get()) + + # text found and replaced + pv.set('a') + rv.set('asdf') + replace() + equal(text.get('1.8', '1.12'), 'asdf') + + # don't "match word" case + text.mark_set('insert', '1.0') + pv.set('is') + rv.set('hello') + replace() + equal(text.get('1.2', '1.7'), 'hello') + + # don't "match case" case + pv.set('string') + rv.set('world') + replace() + equal(text.get('1.23', '1.28'), 'world') + + # without "regular expression" case + text.mark_set('insert', 'end') + text.insert('insert', '\nline42:') + before_text = text.get('1.0', 'end') + pv.set(r'[a-z][\d]+') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + # test with wrap around selected and complete a cycle + text.mark_set('insert', '1.9') + pv.set('i') + rv.set('j') + replace() + equal(text.get('1.8'), 'i') + equal(text.get('2.1'), 'j') + replace() + equal(text.get('2.1'), 'j') + equal(text.get('1.8'), 'j') + before_text = text.get('1.0', 'end') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + # text not found + before_text = text.get('1.0', 'end') + pv.set('foobar') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + # test access method + self.dialog.find_it(0) + + def test_replace_wrap_around(self): + text = self.text + equal = self.assertEqual + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.wrapvar.set(False) + + # replace candidate found both after and before 'insert' + text.mark_set('insert', '1.4') + pv.set('i') + rv.set('j') + replace() + equal(text.get('1.2'), 'i') + equal(text.get('1.5'), 'j') + replace() + equal(text.get('1.2'), 'i') + equal(text.get('1.20'), 'j') + replace() + equal(text.get('1.2'), 'i') + + # replace candidate found only before 'insert' + text.mark_set('insert', '1.8') + pv.set('is') + before_text = text.get('1.0', 'end') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + def test_replace_whole_word(self): + text = self.text + equal = self.assertEqual + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.wordvar.set(True) + + pv.set('is') + rv.set('hello') + replace() + equal(text.get('1.0', '1.4'), 'This') + equal(text.get('1.5', '1.10'), 'hello') + + def test_replace_match_case(self): + equal = self.assertEqual + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.casevar.set(True) + + before_text = self.text.get('1.0', 'end') + pv.set('this') + rv.set('that') + replace() + after_text = self.text.get('1.0', 'end') + equal(before_text, after_text) + + pv.set('This') + replace() + equal(text.get('1.0', '1.4'), 'that') + + def test_replace_regex(self): + equal = self.assertEqual + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.revar.set(True) + + before_text = text.get('1.0', 'end') + pv.set(r'[a-z][\d]+') + rv.set('hello') + replace() + after_text = text.get('1.0', 'end') + equal(before_text, after_text) + + text.insert('insert', '\nline42') + replace() + equal(text.get('2.0', '2.8'), 'linhello') + + pv.set('') + replace() + self.assertIn('error', showerror.title) + self.assertIn('Empty', showerror.message) + + pv.set(r'[\d') + replace() + self.assertIn('error', showerror.title) + self.assertIn('Pattern', showerror.message) + + showerror.title = '' + showerror.message = '' + pv.set('[a]') + rv.set('test\\') + replace() + self.assertIn('error', showerror.title) + self.assertIn('Invalid Replace Expression', showerror.message) + + # test access method + self.engine.setcookedpat("?") + equal(pv.get(), "\\?") + + def test_replace_backwards(self): + equal = self.assertEqual + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace = self.dialog.replace_it + self.engine.backvar.set(True) + + text.insert('insert', '\nis as ') + + pv.set('is') + rv.set('was') + replace() + equal(text.get('1.2', '1.4'), 'is') + equal(text.get('2.0', '2.3'), 'was') + replace() + equal(text.get('1.5', '1.8'), 'was') + replace() + equal(text.get('1.2', '1.5'), 'was') + + def test_replace_all(self): + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace_all = self.dialog.replace_all + + text.insert('insert', '\n') + text.insert('insert', text.get('1.0', 'end')*100) + pv.set('is') + rv.set('was') + replace_all() + self.assertNotIn('is', text.get('1.0', 'end')) + + self.engine.revar.set(True) + pv.set('') + replace_all() + self.assertIn('error', showerror.title) + self.assertIn('Empty', showerror.message) + + pv.set('[s][T]') + rv.set('\\') + replace_all() + + self.engine.revar.set(False) + pv.set('text which is not present') + rv.set('foobar') + replace_all() + + def test_default_command(self): + text = self.text + pv = self.engine.patvar + rv = self.dialog.replvar + replace_find = self.dialog.default_command + equal = self.assertEqual + + pv.set('This') + rv.set('was') + replace_find() + equal(text.get('sel.first', 'sel.last'), 'was') + + self.engine.revar.set(True) + pv.set('') + replace_find() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/shared/package-files/32/32142548019430c5f8baba4dab0f88e8d2b663c846343045d375f7749dce490b/blob b/shared/package-files/32/32142548019430c5f8baba4dab0f88e8d2b663c846343045d375f7749dce490b/blob new file mode 100644 index 0000000000000000000000000000000000000000..ae2e2d3852f178a798dba66676d2e45cc3e904ef Binary files /dev/null and b/shared/package-files/32/32142548019430c5f8baba4dab0f88e8d2b663c846343045d375f7749dce490b/blob differ diff --git a/shared/package-files/32/3216fd20e5c0bf873a9e4936e10438cd135dbfc15c60a373707cc7d98e35312f/blob b/shared/package-files/32/3216fd20e5c0bf873a9e4936e10438cd135dbfc15c60a373707cc7d98e35312f/blob new file mode 100644 index 0000000000000000000000000000000000000000..603471784ac99a5a451b8f88e229d35cea875873 --- /dev/null +++ b/shared/package-files/32/3216fd20e5c0bf873a9e4936e10438cd135dbfc15c60a373707cc7d98e35312f/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API binary_cross_entropy_backward { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, const at::Tensor &, const c10::optional &, int64_t); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::binary_cross_entropy_backward") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "binary_cross_entropy_backward(Tensor grad_output, Tensor self, Tensor target, Tensor? weight=None, int reduction=Mean) -> Tensor") + static at::Tensor call(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, const c10::optional & weight, int64_t reduction); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, const c10::optional & weight, int64_t reduction); +}; + +struct TORCH_API binary_cross_entropy_backward_grad_input { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, const at::Tensor &, const c10::optional &, int64_t, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::binary_cross_entropy_backward") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "grad_input") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "binary_cross_entropy_backward.grad_input(Tensor grad_output, Tensor self, Tensor target, Tensor? weight=None, int reduction=Mean, *, Tensor(a!) grad_input) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, const c10::optional & weight, int64_t reduction, at::Tensor & grad_input); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, const c10::optional & weight, int64_t reduction, at::Tensor & grad_input); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/32/32183bd6f9e38dbe1f9b48d98230e8596f2b0093017a1f1a0c233be608c4a4a4/blob b/shared/package-files/32/32183bd6f9e38dbe1f9b48d98230e8596f2b0093017a1f1a0c233be608c4a4a4/blob new file mode 100644 index 0000000000000000000000000000000000000000..beeaf1d76a63673b6622709cda598dfcb295bba4 --- /dev/null +++ b/shared/package-files/32/32183bd6f9e38dbe1f9b48d98230e8596f2b0093017a1f1a0c233be608c4a4a4/blob @@ -0,0 +1,228 @@ +from sympy.core.add import Add +from sympy.core.expr import unchanged +from sympy.core.mul import Mul +from sympy.core.symbol import symbols +from sympy.core.relational import Eq +from sympy.concrete.summations import Sum +from sympy.functions.elementary.complexes import im, re +from sympy.functions.elementary.piecewise import Piecewise +from sympy.matrices.immutable import ImmutableDenseMatrix +from sympy.matrices.expressions.matexpr import MatrixSymbol +from sympy.matrices.expressions.matadd import MatAdd +from sympy.matrices.expressions.special import ( + ZeroMatrix, GenericZeroMatrix, Identity, GenericIdentity, OneMatrix) +from sympy.matrices.expressions.matmul import MatMul +from sympy.testing.pytest import raises + + +def test_zero_matrix_creation(): + assert unchanged(ZeroMatrix, 2, 2) + assert unchanged(ZeroMatrix, 0, 0) + raises(ValueError, lambda: ZeroMatrix(-1, 2)) + raises(ValueError, lambda: ZeroMatrix(2.0, 2)) + raises(ValueError, lambda: ZeroMatrix(2j, 2)) + raises(ValueError, lambda: ZeroMatrix(2, -1)) + raises(ValueError, lambda: ZeroMatrix(2, 2.0)) + raises(ValueError, lambda: ZeroMatrix(2, 2j)) + + n = symbols('n') + assert unchanged(ZeroMatrix, n, n) + n = symbols('n', integer=False) + raises(ValueError, lambda: ZeroMatrix(n, n)) + n = symbols('n', negative=True) + raises(ValueError, lambda: ZeroMatrix(n, n)) + + +def test_generic_zero_matrix(): + z = GenericZeroMatrix() + n = symbols('n', integer=True) + A = MatrixSymbol("A", n, n) + + assert z == z + assert z != A + assert A != z + + assert z.is_ZeroMatrix + + raises(TypeError, lambda: z.shape) + raises(TypeError, lambda: z.rows) + raises(TypeError, lambda: z.cols) + + assert MatAdd() == z + assert MatAdd(z, A) == MatAdd(A) + # Make sure it is hashable + hash(z) + + +def test_identity_matrix_creation(): + assert Identity(2) + assert Identity(0) + raises(ValueError, lambda: Identity(-1)) + raises(ValueError, lambda: Identity(2.0)) + raises(ValueError, lambda: Identity(2j)) + + n = symbols('n') + assert Identity(n) + n = symbols('n', integer=False) + raises(ValueError, lambda: Identity(n)) + n = symbols('n', negative=True) + raises(ValueError, lambda: Identity(n)) + + +def test_generic_identity(): + I = GenericIdentity() + n = symbols('n', integer=True) + A = MatrixSymbol("A", n, n) + + assert I == I + assert I != A + assert A != I + + assert I.is_Identity + assert I**-1 == I + + raises(TypeError, lambda: I.shape) + raises(TypeError, lambda: I.rows) + raises(TypeError, lambda: I.cols) + + assert MatMul() == I + assert MatMul(I, A) == MatMul(A) + # Make sure it is hashable + hash(I) + + +def test_one_matrix_creation(): + assert OneMatrix(2, 2) + assert OneMatrix(0, 0) + assert Eq(OneMatrix(1, 1), Identity(1)) + raises(ValueError, lambda: OneMatrix(-1, 2)) + raises(ValueError, lambda: OneMatrix(2.0, 2)) + raises(ValueError, lambda: OneMatrix(2j, 2)) + raises(ValueError, lambda: OneMatrix(2, -1)) + raises(ValueError, lambda: OneMatrix(2, 2.0)) + raises(ValueError, lambda: OneMatrix(2, 2j)) + + n = symbols('n') + assert OneMatrix(n, n) + n = symbols('n', integer=False) + raises(ValueError, lambda: OneMatrix(n, n)) + n = symbols('n', negative=True) + raises(ValueError, lambda: OneMatrix(n, n)) + + +def test_ZeroMatrix(): + n, m = symbols('n m', integer=True) + A = MatrixSymbol('A', n, m) + Z = ZeroMatrix(n, m) + + assert A + Z == A + assert A*Z.T == ZeroMatrix(n, n) + assert Z*A.T == ZeroMatrix(n, n) + assert A - A == ZeroMatrix(*A.shape) + + assert Z + + assert Z.transpose() == ZeroMatrix(m, n) + assert Z.conjugate() == Z + assert Z.adjoint() == ZeroMatrix(m, n) + assert re(Z) == Z + assert im(Z) == Z + + assert ZeroMatrix(n, n)**0 == Identity(n) + assert ZeroMatrix(3, 3).as_explicit() == ImmutableDenseMatrix.zeros(3, 3) + + +def test_ZeroMatrix_doit(): + n = symbols('n', integer=True) + Znn = ZeroMatrix(Add(n, n, evaluate=False), n) + assert isinstance(Znn.rows, Add) + assert Znn.doit() == ZeroMatrix(2*n, n) + assert isinstance(Znn.doit().rows, Mul) + + +def test_OneMatrix(): + n, m = symbols('n m', integer=True) + A = MatrixSymbol('A', n, m) + U = OneMatrix(n, m) + + assert U.shape == (n, m) + assert isinstance(A + U, Add) + assert U.transpose() == OneMatrix(m, n) + assert U.conjugate() == U + assert U.adjoint() == OneMatrix(m, n) + assert re(U) == U + assert im(U) == ZeroMatrix(n, m) + + assert OneMatrix(n, n) ** 0 == Identity(n) + + U = OneMatrix(n, n) + assert U[1, 2] == 1 + + U = OneMatrix(2, 3) + assert U.as_explicit() == ImmutableDenseMatrix.ones(2, 3) + + +def test_OneMatrix_doit(): + n = symbols('n', integer=True) + Unn = OneMatrix(Add(n, n, evaluate=False), n) + assert isinstance(Unn.rows, Add) + assert Unn.doit() == OneMatrix(2 * n, n) + assert isinstance(Unn.doit().rows, Mul) + + +def test_OneMatrix_mul(): + n, m, k = symbols('n m k', integer=True) + w = MatrixSymbol('w', n, 1) + assert OneMatrix(n, m) * OneMatrix(m, k) == OneMatrix(n, k) * m + assert w * OneMatrix(1, 1) == w + assert OneMatrix(1, 1) * w.T == w.T + + +def test_Identity(): + n, m = symbols('n m', integer=True) + A = MatrixSymbol('A', n, m) + i, j = symbols('i j') + + In = Identity(n) + Im = Identity(m) + + assert A*Im == A + assert In*A == A + + assert In.transpose() == In + assert In.inverse() == In + assert In.conjugate() == In + assert In.adjoint() == In + assert re(In) == In + assert im(In) == ZeroMatrix(n, n) + + assert In[i, j] != 0 + assert Sum(In[i, j], (i, 0, n-1), (j, 0, n-1)).subs(n,3).doit() == 3 + assert Sum(Sum(In[i, j], (i, 0, n-1)), (j, 0, n-1)).subs(n,3).doit() == 3 + + # If range exceeds the limit `(0, n-1)`, do not remove `Piecewise`: + expr = Sum(In[i, j], (i, 0, n-1)) + assert expr.doit() == 1 + expr = Sum(In[i, j], (i, 0, n-2)) + assert expr.doit().dummy_eq( + Piecewise( + (1, (j >= 0) & (j <= n-2)), + (0, True) + ) + ) + expr = Sum(In[i, j], (i, 1, n-1)) + assert expr.doit().dummy_eq( + Piecewise( + (1, (j >= 1) & (j <= n-1)), + (0, True) + ) + ) + assert Identity(3).as_explicit() == ImmutableDenseMatrix.eye(3) + + +def test_Identity_doit(): + n = symbols('n', integer=True) + Inn = Identity(Add(n, n, evaluate=False)) + assert isinstance(Inn.rows, Add) + assert Inn.doit() == Identity(2*n) + assert isinstance(Inn.doit().rows, Mul) diff --git a/shared/package-files/32/32191fb149da315122ea846b71f4e0a7a875ff54024bc6efc6dc2813a6ea652e/blob b/shared/package-files/32/32191fb149da315122ea846b71f4e0a7a875ff54024bc6efc6dc2813a6ea652e/blob new file mode 100644 index 0000000000000000000000000000000000000000..68b3dc19a965d0c30bdceba78599487b8589c392 --- /dev/null +++ b/shared/package-files/32/32191fb149da315122ea846b71f4e0a7a875ff54024bc6efc6dc2813a6ea652e/blob @@ -0,0 +1,22 @@ +from typing import Optional + +class AESCCM(object): + def __init__(self, key: bytes, tag_length: Optional[int]) -> None: ... + def decrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ... + def encrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ... + @classmethod + def generate_key(cls, bit_length: int) -> bytes: ... + +class AESGCM(object): + def __init__(self, key: bytes) -> None: ... + def decrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ... + def encrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ... + @classmethod + def generate_key(cls, bit_length: int) -> bytes: ... + +class ChaCha20Poly1305(object): + def __init__(self, key: bytes) -> None: ... + def decrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ... + def encrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ... + @classmethod + def generate_key(cls) -> bytes: ... diff --git a/shared/package-files/32/3219b2a5be56cf119d05a429c9269ef4d6e21499659047b3762b631da8dded10/blob b/shared/package-files/32/3219b2a5be56cf119d05a429c9269ef4d6e21499659047b3762b631da8dded10/blob new file mode 100644 index 0000000000000000000000000000000000000000..f1654e46fad0d391c24cab6dc921bbd912551f57 --- /dev/null +++ b/shared/package-files/32/3219b2a5be56cf119d05a429c9269ef4d6e21499659047b3762b631da8dded10/blob @@ -0,0 +1,87 @@ +""" + pygments.lexers.solidity + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Solidity. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, include, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Whitespace + +__all__ = ['SolidityLexer'] + + +class SolidityLexer(RegexLexer): + """ + For Solidity source code. + + .. versionadded:: 2.5 + """ + + name = 'Solidity' + aliases = ['solidity'] + filenames = ['*.sol'] + mimetypes = [] + + datatype = ( + r'\b(address|bool|(?:(?:bytes|hash|int|string|uint)(?:8|16|24|32|40|48|56|64' + r'|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208' + r'|216|224|232|240|248|256)?))\b' + ) + + tokens = { + 'root': [ + include('whitespace'), + include('comments'), + (r'\bpragma\s+solidity\b', Keyword, 'pragma'), + (r'\b(contract)(\s+)([a-zA-Z_]\w*)', + bygroups(Keyword, Whitespace, Name.Entity)), + (datatype + r'(\s+)((?:external|public|internal|private)\s+)?' + + r'([a-zA-Z_]\w*)', + bygroups(Keyword.Type, Whitespace, Keyword, Name.Variable)), + (r'\b(enum|event|function|struct)(\s+)([a-zA-Z_]\w*)', + bygroups(Keyword.Type, Whitespace, Name.Variable)), + (r'\b(msg|block|tx)\.([A-Za-z_][a-zA-Z0-9_]*)\b', Keyword), + (words(( + 'block', 'break', 'constant', 'constructor', 'continue', + 'contract', 'do', 'else', 'external', 'false', 'for', + 'function', 'if', 'import', 'inherited', 'internal', 'is', + 'library', 'mapping', 'memory', 'modifier', 'msg', 'new', + 'payable', 'private', 'public', 'require', 'return', + 'returns', 'struct', 'suicide', 'throw', 'this', 'true', + 'tx', 'var', 'while'), prefix=r'\b', suffix=r'\b'), + Keyword.Type), + (words(('keccak256',), prefix=r'\b', suffix=r'\b'), Name.Builtin), + (datatype, Keyword.Type), + include('constants'), + (r'[a-zA-Z_]\w*', Text), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r'[.;{}(),\[\]]', Punctuation) + ], + 'comments': [ + (r'//(\n|[\w\W]*?[^\\]\n)', Comment.Single), + (r'/(\\\n)?[*][\w\W]*?[*](\\\n)?/', Comment.Multiline), + (r'/(\\\n)?[*][\w\W]*', Comment.Multiline) + ], + 'constants': [ + (r'("(\\"|.)*?")', String.Double), + (r"('(\\'|.)*?')", String.Single), + (r'\b0[xX][0-9a-fA-F]+\b', Number.Hex), + (r'\b\d+\b', Number.Decimal), + ], + 'pragma': [ + include('whitespace'), + include('comments'), + (r'(\^|>=|<)(\s*)(\d+\.\d+\.\d+)', + bygroups(Operator, Whitespace, Keyword)), + (r';', Punctuation, '#pop') + ], + 'whitespace': [ + (r'\s+', Whitespace), + (r'\n', Whitespace) + ] + } diff --git a/shared/package-files/32/321f0293b95d07de6fd2df7c9da5fee13bd9bbb8ae47241731c526ba427c1e2f/blob b/shared/package-files/32/321f0293b95d07de6fd2df7c9da5fee13bd9bbb8ae47241731c526ba427c1e2f/blob new file mode 100644 index 0000000000000000000000000000000000000000..642b34b8cf46b175f3834e80c6b23691fac55df7 --- /dev/null +++ b/shared/package-files/32/321f0293b95d07de6fd2df7c9da5fee13bd9bbb8ae47241731c526ba427c1e2f/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:321f0293b95d07de6fd2df7c9da5fee13bd9bbb8ae47241731c526ba427c1e2f +size 436640 diff --git a/shared/package-files/32/3221d56abebe6de504615129a97391217e1ff06dbd238ec3dfa92b7a5b5d7e84/blob b/shared/package-files/32/3221d56abebe6de504615129a97391217e1ff06dbd238ec3dfa92b7a5b5d7e84/blob new file mode 100644 index 0000000000000000000000000000000000000000..0768cb12e87a54aa7fc0d10a04d97953eaa8aa41 --- /dev/null +++ b/shared/package-files/32/3221d56abebe6de504615129a97391217e1ff06dbd238ec3dfa92b7a5b5d7e84/blob @@ -0,0 +1,33 @@ +from numpy.distutils.fcompiler import FCompiler + +compilers = ['PathScaleFCompiler'] + +class PathScaleFCompiler(FCompiler): + + compiler_type = 'pathf95' + description = 'PathScale Fortran Compiler' + version_pattern = r'PathScale\(TM\) Compiler Suite: Version (?P[\d.]+)' + + executables = { + 'version_cmd' : ["pathf95", "-version"], + 'compiler_f77' : ["pathf95", "-fixedform"], + 'compiler_fix' : ["pathf95", "-fixedform"], + 'compiler_f90' : ["pathf95"], + 'linker_so' : ["pathf95", "-shared"], + 'archiver' : ["ar", "-cr"], + 'ranlib' : ["ranlib"] + } + pic_flags = ['-fPIC'] + module_dir_switch = '-module ' # Don't remove ending space! + module_include_switch = '-I' + + def get_flags_opt(self): + return ['-O3'] + def get_flags_debug(self): + return ['-g'] + +if __name__ == '__main__': + from distutils import log + log.set_verbosity(2) + from numpy.distutils import customized_fcompiler + print(customized_fcompiler(compiler='pathf95').get_version()) diff --git a/shared/package-files/32/32258d53e28c9d2c075b977388a296199f18363315d016297765aac4f57cec8f/blob b/shared/package-files/32/32258d53e28c9d2c075b977388a296199f18363315d016297765aac4f57cec8f/blob new file mode 100644 index 0000000000000000000000000000000000000000..34ac03e2cda11361558616a9afd01ac9946192d8 --- /dev/null +++ b/shared/package-files/32/32258d53e28c9d2c075b977388a296199f18363315d016297765aac4f57cec8f/blob @@ -0,0 +1,30 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_has_same_storage_numel(Tensor self, Tensor other) -> bool +inline bool _has_same_storage_numel(const at::Tensor & self, const at::Tensor & other) { + return at::_ops::_has_same_storage_numel::call(self, other); +} + +} diff --git a/shared/package-files/32/322745165c7c739c69422e50ecd36bf6e1b991115dc19348c6dec887aba48817/blob b/shared/package-files/32/322745165c7c739c69422e50ecd36bf6e1b991115dc19348c6dec887aba48817/blob new file mode 100644 index 0000000000000000000000000000000000000000..3385923bc75f293ea2dfeb5cf0f6a317f3d4419b --- /dev/null +++ b/shared/package-files/32/322745165c7c739c69422e50ecd36bf6e1b991115dc19348c6dec887aba48817/blob @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API ::std::tuple min(const at::Tensor & self, at::Dimname dim, bool keepdim=false); +TORCH_API ::std::tuple min_out(at::Tensor & min, at::Tensor & min_indices, const at::Tensor & self, at::Dimname dim, bool keepdim=false); +TORCH_API ::std::tuple min_outf(const at::Tensor & self, at::Dimname dim, bool keepdim, at::Tensor & min, at::Tensor & min_indices); +TORCH_API at::Tensor min(const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & min_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & min_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/32/3227f4f6071f45f20edae842a8d37d382fcd5e080a8b36eec1acfa49c1b33141/blob b/shared/package-files/32/3227f4f6071f45f20edae842a8d37d382fcd5e080a8b36eec1acfa49c1b33141/blob new file mode 100644 index 0000000000000000000000000000000000000000..41ecf9ee6b82317137b1a6accee14ad8c1b5a35a --- /dev/null +++ b/shared/package-files/32/3227f4f6071f45f20edae842a8d37d382fcd5e080a8b36eec1acfa49c1b33141/blob @@ -0,0 +1,125 @@ +import numpy as np +import pytest + +from pandas import ( + DatetimeIndex, + Index, + date_range, + factorize, +) +import pandas._testing as tm + + +class TestDatetimeIndexFactorize: + def test_factorize(self): + idx1 = DatetimeIndex( + ["2014-01", "2014-01", "2014-02", "2014-02", "2014-03", "2014-03"] + ) + + exp_arr = np.array([0, 0, 1, 1, 2, 2], dtype=np.intp) + exp_idx = DatetimeIndex(["2014-01", "2014-02", "2014-03"]) + + arr, idx = idx1.factorize() + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, exp_idx) + assert idx.freq == exp_idx.freq + + arr, idx = idx1.factorize(sort=True) + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, exp_idx) + assert idx.freq == exp_idx.freq + + # tz must be preserved + idx1 = idx1.tz_localize("Asia/Tokyo") + exp_idx = exp_idx.tz_localize("Asia/Tokyo") + + arr, idx = idx1.factorize() + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, exp_idx) + assert idx.freq == exp_idx.freq + + idx2 = DatetimeIndex( + ["2014-03", "2014-03", "2014-02", "2014-01", "2014-03", "2014-01"] + ) + + exp_arr = np.array([2, 2, 1, 0, 2, 0], dtype=np.intp) + exp_idx = DatetimeIndex(["2014-01", "2014-02", "2014-03"]) + arr, idx = idx2.factorize(sort=True) + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, exp_idx) + assert idx.freq == exp_idx.freq + + exp_arr = np.array([0, 0, 1, 2, 0, 2], dtype=np.intp) + exp_idx = DatetimeIndex(["2014-03", "2014-02", "2014-01"]) + arr, idx = idx2.factorize() + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, exp_idx) + assert idx.freq == exp_idx.freq + + def test_factorize_preserves_freq(self): + # GH#38120 freq should be preserved + idx3 = date_range("2000-01", periods=4, freq="ME", tz="Asia/Tokyo") + exp_arr = np.array([0, 1, 2, 3], dtype=np.intp) + + arr, idx = idx3.factorize() + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, idx3) + assert idx.freq == idx3.freq + + arr, idx = factorize(idx3) + tm.assert_numpy_array_equal(arr, exp_arr) + tm.assert_index_equal(idx, idx3) + assert idx.freq == idx3.freq + + def test_factorize_tz(self, tz_naive_fixture, index_or_series): + tz = tz_naive_fixture + # GH#13750 + base = date_range("2016-11-05", freq="h", periods=100, tz=tz) + idx = base.repeat(5) + + exp_arr = np.arange(100, dtype=np.intp).repeat(5) + + obj = index_or_series(idx) + + arr, res = obj.factorize() + tm.assert_numpy_array_equal(arr, exp_arr) + expected = base._with_freq(None) + tm.assert_index_equal(res, expected) + assert res.freq == expected.freq + + def test_factorize_dst(self, index_or_series): + # GH#13750 + idx = date_range("2016-11-06", freq="h", periods=12, tz="US/Eastern") + obj = index_or_series(idx) + + arr, res = obj.factorize() + tm.assert_numpy_array_equal(arr, np.arange(12, dtype=np.intp)) + tm.assert_index_equal(res, idx) + if index_or_series is Index: + assert res.freq == idx.freq + + idx = date_range("2016-06-13", freq="h", periods=12, tz="US/Eastern") + obj = index_or_series(idx) + + arr, res = obj.factorize() + tm.assert_numpy_array_equal(arr, np.arange(12, dtype=np.intp)) + tm.assert_index_equal(res, idx) + if index_or_series is Index: + assert res.freq == idx.freq + + @pytest.mark.parametrize("sort", [True, False]) + def test_factorize_no_freq_non_nano(self, tz_naive_fixture, sort): + # GH#51978 case that does not go through the fastpath based on + # non-None freq + tz = tz_naive_fixture + idx = date_range("2016-11-06", freq="h", periods=5, tz=tz)[[0, 4, 1, 3, 2]] + exp_codes, exp_uniques = idx.factorize(sort=sort) + + res_codes, res_uniques = idx.as_unit("s").factorize(sort=sort) + + tm.assert_numpy_array_equal(res_codes, exp_codes) + tm.assert_index_equal(res_uniques, exp_uniques.as_unit("s")) + + res_codes, res_uniques = idx.as_unit("s").to_series().factorize(sort=sort) + tm.assert_numpy_array_equal(res_codes, exp_codes) + tm.assert_index_equal(res_uniques, exp_uniques.as_unit("s")) diff --git a/shared/package-files/32/322a98cc2207bcd6cc1fe2dd4582effb84f410803b8432ade462d1d084532dd2/blob b/shared/package-files/32/322a98cc2207bcd6cc1fe2dd4582effb84f410803b8432ade462d1d084532dd2/blob new file mode 100644 index 0000000000000000000000000000000000000000..684c6586f091350c347f2b6150935f5214ffec27 --- /dev/null +++ b/shared/package-files/32/322a98cc2207bcd6cc1fe2dd4582effb84f410803b8432ade462d1d084532dd2/blob @@ -0,0 +1,75 @@ +import logging +import os +import tempfile +import shutil +import json +from subprocess import check_call, check_output +from tarfile import TarFile + +from dateutil.zoneinfo import METADATA_FN, ZONEFILENAME + + +def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None): + """Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* + + filename is the timezone tarball from ``ftp.iana.org/tz``. + + """ + tmpdir = tempfile.mkdtemp() + zonedir = os.path.join(tmpdir, "zoneinfo") + moduledir = os.path.dirname(__file__) + try: + with TarFile.open(filename) as tf: + for name in zonegroups: + tf.extract(name, tmpdir) + filepaths = [os.path.join(tmpdir, n) for n in zonegroups] + + _run_zic(zonedir, filepaths) + + # write metadata file + with open(os.path.join(zonedir, METADATA_FN), 'w') as f: + json.dump(metadata, f, indent=4, sort_keys=True) + target = os.path.join(moduledir, ZONEFILENAME) + with TarFile.open(target, "w:%s" % format) as tf: + for entry in os.listdir(zonedir): + entrypath = os.path.join(zonedir, entry) + tf.add(entrypath, entry) + finally: + shutil.rmtree(tmpdir) + + +def _run_zic(zonedir, filepaths): + """Calls the ``zic`` compiler in a compatible way to get a "fat" binary. + + Recent versions of ``zic`` default to ``-b slim``, while older versions + don't even have the ``-b`` option (but default to "fat" binaries). The + current version of dateutil does not support Version 2+ TZif files, which + causes problems when used in conjunction with "slim" binaries, so this + function is used to ensure that we always get a "fat" binary. + """ + + try: + help_text = check_output(["zic", "--help"]) + except OSError as e: + _print_on_nosuchfile(e) + raise + + if b"-b " in help_text: + bloat_args = ["-b", "fat"] + else: + bloat_args = [] + + check_call(["zic"] + bloat_args + ["-d", zonedir] + filepaths) + + +def _print_on_nosuchfile(e): + """Print helpful troubleshooting message + + e is an exception raised by subprocess.check_call() + + """ + if e.errno == 2: + logging.error( + "Could not find zic. Perhaps you need to install " + "libc-bin or some other package that provides it, " + "or it's not in your PATH?") diff --git a/shared/package-files/32/322b66ac1f492a2dbdf42851ccbf072f4027493d420a4dd4b4dddc63b2483245/blob b/shared/package-files/32/322b66ac1f492a2dbdf42851ccbf072f4027493d420a4dd4b4dddc63b2483245/blob new file mode 100644 index 0000000000000000000000000000000000000000..5da0dbed3d919b953d75a0a62277122087b85ea3 --- /dev/null +++ b/shared/package-files/32/322b66ac1f492a2dbdf42851ccbf072f4027493d420a4dd4b4dddc63b2483245/blob @@ -0,0 +1,86 @@ +from __future__ import annotations + +import dataclasses +from typing import Dict + +from torch.onnx._internal.fx import _pass, diagnostics, registration + + +@dataclasses.dataclass +class UnsupportedFxNodesAnalysisResult(_pass.AnalysisResult): + unsupported_op_to_target_mapping: Dict[str, Dict[str, None]] + + +class UnsupportedFxNodesAnalysis(_pass.Analysis): + """An analysis that detects unsupported FX nodes in the graph.""" + + def _lint( + self, + analysis_result: UnsupportedFxNodesAnalysisResult, + diagnostic_level: diagnostics.infra.Level, + ): + """Lint the graph and emit diagnostics if unsupported FX nodes are found.""" + if not analysis_result.unsupported_op_to_target_mapping: + return + + normalized_op_targets_map = { + op: list(targets.keys()) + for op, targets in analysis_result.unsupported_op_to_target_mapping.items() + } + + rule = diagnostics.rules.unsupported_fx_node_analysis + diagnostic = diagnostics.Diagnostic( + rule, + level=diagnostic_level, + message=rule.format_message(normalized_op_targets_map), + ) + self.diagnostic_context.log_and_raise_if_error(diagnostic) + + def analyze( + self, diagnostic_level: diagnostics.infra.Level + ) -> UnsupportedFxNodesAnalysisResult: + """Analyze the graph, emit diagnostics and return a result that contains unsupported FX nodes. + + Args: + diagnostic_level: The diagnostic level to use when emitting diagnostics. + + Returns: + An analysis result that contains unsupported FX nodes. + + Raises: + RuntimeErrorWithDiagnostic: If diagnostics are emitted and the diagnostic + level is `ERROR`. + """ + + op_to_target_mapping: Dict[str, Dict[str, None]] = {} + for node in self.module.graph.nodes: + if node.op == "call_function": + # NOTE: OPSchema matcher is not in this analysis scope. + internal_opname: registration.OpName = ( + self.onnxfunction_dispatcher._get_aten_name( + node=node, diagnostic_context=self.diagnostic_context + ) + ) + overload_registration = ( + self.onnxfunction_dispatcher.onnx_registry.is_registered_op( + namespace=internal_opname.namespace, + op_name=internal_opname.op_name, + overload=internal_opname.overload, + ) + ) + # NOTE: Fall back to default overload if the ONNX registry doesn't have the overload. + default_registration = ( + self.onnxfunction_dispatcher.onnx_registry.is_registered_op( + namespace=internal_opname.namespace, + op_name=internal_opname.op_name, + overload=None, + ) + ) + if not overload_registration and not default_registration: + op_to_target_mapping.setdefault(node.op, {}).setdefault( + str(node.target), None + ) + + analysis_result = UnsupportedFxNodesAnalysisResult(op_to_target_mapping) + self._lint(analysis_result, diagnostic_level) + return analysis_result diff --git a/shared/package-files/32/322ce163824bf29a9cb8fdacb9494fd61324c0bd5f228c981e489a10ab8aa934/blob b/shared/package-files/32/322ce163824bf29a9cb8fdacb9494fd61324c0bd5f228c981e489a10ab8aa934/blob new file mode 100644 index 0000000000000000000000000000000000000000..821ed02bb1b1d7c2047d5e5dcb3049cc2bf8ad02 --- /dev/null +++ b/shared/package-files/32/322ce163824bf29a9cb8fdacb9494fd61324c0bd5f228c981e489a10ab8aa934/blob @@ -0,0 +1,195 @@ +"""Sparse matrix norms. + +""" +import numpy as np +from scipy.sparse import issparse +from scipy.sparse.linalg import svds +from scipy.sparse._sputils import convert_pydata_sparse_to_scipy +import scipy.sparse as sp + +from numpy import sqrt, abs + +__all__ = ['norm'] + + +def _sparse_frobenius_norm(x): + data = sp._sputils._todata(x) + return np.linalg.norm(data) + + +def norm(x, ord=None, axis=None): + """ + Norm of a sparse matrix + + This function is able to return one of seven different matrix norms, + depending on the value of the ``ord`` parameter. + + Parameters + ---------- + x : a sparse array + Input sparse array. + ord : {non-zero int, inf, -inf, 'fro'}, optional + Order of the norm (see table under ``Notes``). inf means numpy's + `inf` object. + axis : {int, 2-tuple of ints, None}, optional + If `axis` is an integer, it specifies the axis of `x` along which to + compute the vector norms. If `axis` is a 2-tuple, it specifies the + axes that hold 2-D matrices, and the matrix norms of these matrices + are computed. If `axis` is None then either a vector norm (when `x` + is 1-D) or a matrix norm (when `x` is 2-D) is returned. + + Returns + ------- + n : float or ndarray + + Notes + ----- + Some of the ord are not implemented because some associated functions like, + _multi_svd_norm, are not yet available for sparse array. + + This docstring is modified based on numpy.linalg.norm. + https://github.com/numpy/numpy/blob/main/numpy/linalg/linalg.py + + The following norms can be calculated: + + ===== ============================ + ord norm for sparse arrays + ===== ============================ + None Frobenius norm + 'fro' Frobenius norm + inf max(sum(abs(x), axis=1)) + -inf min(sum(abs(x), axis=1)) + 0 abs(x).sum(axis=axis) + 1 max(sum(abs(x), axis=0)) + -1 min(sum(abs(x), axis=0)) + 2 Spectral norm (the largest singular value) + -2 Not implemented + other Not implemented + ===== ============================ + + The Frobenius norm is given by [1]_: + + :math:`||A||_F = [\\sum_{i,j} abs(a_{i,j})^2]^{1/2}` + + References + ---------- + .. [1] G. H. Golub and C. F. Van Loan, *Matrix Computations*, + Baltimore, MD, Johns Hopkins University Press, 1985, pg. 15 + + Examples + -------- + >>> from scipy.sparse import csr_array, diags_array + >>> import numpy as np + >>> from scipy.sparse.linalg import norm + >>> a = np.arange(9) - 4 + >>> a + array([-4, -3, -2, -1, 0, 1, 2, 3, 4]) + >>> b = a.reshape((3, 3)) + >>> b + array([[-4, -3, -2], + [-1, 0, 1], + [ 2, 3, 4]]) + + >>> b = csr_array(b) + >>> norm(b) + 7.745966692414834 + >>> norm(b, 'fro') + 7.745966692414834 + >>> norm(b, np.inf) + 9 + >>> norm(b, -np.inf) + 2 + >>> norm(b, 1) + 7 + >>> norm(b, -1) + 6 + + The matrix 2-norm or the spectral norm is the largest singular + value, computed approximately and with limitations. + + >>> b = diags_array([-1, 1], [0, 1], shape=(9, 10)) + >>> norm(b, 2) + 1.9753... + """ + x = convert_pydata_sparse_to_scipy(x, target_format="csr") + if not issparse(x): + raise TypeError("input is not sparse. use numpy.linalg.norm") + + # Check the default case first and handle it immediately. + if axis is None and ord in (None, 'fro', 'f'): + return _sparse_frobenius_norm(x) + + # Some norms require functions that are not implemented for all types. + x = x.tocsr() + + if axis is None: + axis = tuple(range(x.ndim)) + elif not isinstance(axis, tuple): + msg = "'axis' must be None, an integer or a tuple of integers" + try: + int_axis = int(axis) + except TypeError as e: + raise TypeError(msg) from e + if axis != int_axis: + raise TypeError(msg) + axis = (int_axis,) + + nd = x.ndim + if len(axis) == 2: + row_axis, col_axis = axis + if not (-nd <= row_axis < nd and -nd <= col_axis < nd): + message = f'Invalid axis {axis!r} for an array with shape {x.shape!r}' + raise ValueError(message) + if row_axis % nd == col_axis % nd: + raise ValueError('Duplicate axes given.') + if ord == 2: + # Only solver="lobpcg" supports all numpy dtypes + _, s, _ = svds(x, k=1, solver="lobpcg") + return s[0] + elif ord == -2: + raise NotImplementedError + #return _multi_svd_norm(x, row_axis, col_axis, amin) + elif ord == 1: + return abs(x).sum(axis=row_axis).max() + elif ord == np.inf: + return abs(x).sum(axis=col_axis).max() + elif ord == -1: + return abs(x).sum(axis=row_axis).min() + elif ord == -np.inf: + return abs(x).sum(axis=col_axis).min() + elif ord in (None, 'f', 'fro'): + # The axis order does not matter for this norm. + return _sparse_frobenius_norm(x) + else: + raise ValueError("Invalid norm order for matrices.") + elif len(axis) == 1: + a, = axis + if not (-nd <= a < nd): + message = f'Invalid axis {axis!r} for an array with shape {x.shape!r}' + raise ValueError(message) + if ord == np.inf: + M = abs(x).max(axis=a) + elif ord == -np.inf: + M = abs(x).min(axis=a) + elif ord == 0: + # Zero norm + M = (x != 0).sum(axis=a) + elif ord == 1: + # special case for speedup + M = abs(x).sum(axis=a) + elif ord in (2, None): + M = sqrt(abs(x).power(2).sum(axis=a)) + else: + try: + ord + 1 + except TypeError as e: + raise ValueError('Invalid norm order for vectors.') from e + M = np.power(abs(x).power(ord).sum(axis=a), 1 / ord) + if hasattr(M, 'toarray'): + return M.toarray().ravel() + elif hasattr(M, 'A'): + return M.A.ravel() + else: + return M.ravel() + else: + raise ValueError("Improper number of dimensions to norm.") diff --git a/shared/package-files/32/322e7aba5ee2b4d4ba3436cca4a3890ae7e31d5a9a498e7fadbb0d44d2c4e7ad/blob b/shared/package-files/32/322e7aba5ee2b4d4ba3436cca4a3890ae7e31d5a9a498e7fadbb0d44d2c4e7ad/blob new file mode 100644 index 0000000000000000000000000000000000000000..dd60fde43422889c53ebd7cf86fbac99c8c6f282 --- /dev/null +++ b/shared/package-files/32/322e7aba5ee2b4d4ba3436cca4a3890ae7e31d5a9a498e7fadbb0d44d2c4e7ad/blob @@ -0,0 +1,184 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include +#include +#include +#include +#include + +#include "arrow/result.h" +#include "arrow/status.h" +#include "arrow/type.h" +#include "arrow/type_fwd.h" + +#include "parquet/level_conversion.h" +#include "parquet/platform.h" +#include "parquet/schema.h" + +namespace parquet { + +class ArrowReaderProperties; +class ArrowWriterProperties; +class WriterProperties; + +namespace arrow { + +/// \defgroup arrow-to-parquet-schema-conversion Functions to convert an Arrow +/// schema into a Parquet schema. +/// +/// @{ + +PARQUET_EXPORT +::arrow::Status FieldToNode(const std::shared_ptr<::arrow::Field>& field, + const WriterProperties& properties, + const ArrowWriterProperties& arrow_properties, + schema::NodePtr* out); + +PARQUET_EXPORT +::arrow::Status ToParquetSchema(const ::arrow::Schema* arrow_schema, + const WriterProperties& properties, + const ArrowWriterProperties& arrow_properties, + std::shared_ptr* out); + +PARQUET_EXPORT +::arrow::Status ToParquetSchema(const ::arrow::Schema* arrow_schema, + const WriterProperties& properties, + std::shared_ptr* out); + +/// @} + +/// \defgroup parquet-to-arrow-schema-conversion Functions to convert a Parquet +/// schema into an Arrow schema. +/// +/// @{ + +PARQUET_EXPORT +::arrow::Status FromParquetSchema( + const SchemaDescriptor* parquet_schema, const ArrowReaderProperties& properties, + const std::shared_ptr& key_value_metadata, + std::shared_ptr<::arrow::Schema>* out); + +PARQUET_EXPORT +::arrow::Status FromParquetSchema(const SchemaDescriptor* parquet_schema, + const ArrowReaderProperties& properties, + std::shared_ptr<::arrow::Schema>* out); + +PARQUET_EXPORT +::arrow::Status FromParquetSchema(const SchemaDescriptor* parquet_schema, + std::shared_ptr<::arrow::Schema>* out); + +/// @} + +/// \brief Bridge between an arrow::Field and parquet column indices. +struct PARQUET_EXPORT SchemaField { + std::shared_ptr<::arrow::Field> field; + std::vector children; + + // Only set for leaf nodes + int column_index = -1; + + parquet::internal::LevelInfo level_info; + + bool is_leaf() const { return column_index != -1; } +}; + +/// \brief Bridge between a parquet Schema and an arrow Schema. +/// +/// Expose parquet columns as a tree structure. Useful traverse and link +/// between arrow's Schema and parquet's Schema. +struct PARQUET_EXPORT SchemaManifest { + static ::arrow::Status Make( + const SchemaDescriptor* schema, + const std::shared_ptr& metadata, + const ArrowReaderProperties& properties, SchemaManifest* manifest); + + const SchemaDescriptor* descr; + std::shared_ptr<::arrow::Schema> origin_schema; + std::shared_ptr schema_metadata; + std::vector schema_fields; + + std::unordered_map column_index_to_field; + std::unordered_map child_to_parent; + + ::arrow::Status GetColumnField(int column_index, const SchemaField** out) const { + auto it = column_index_to_field.find(column_index); + if (it == column_index_to_field.end()) { + return ::arrow::Status::KeyError("Column index ", column_index, + " not found in schema manifest, may be malformed"); + } + *out = it->second; + return ::arrow::Status::OK(); + } + + const SchemaField* GetParent(const SchemaField* field) const { + // Returns nullptr also if not found + auto it = child_to_parent.find(field); + if (it == child_to_parent.end()) { + return NULLPTR; + } + return it->second; + } + + /// Coalesce a list of field indices (relative to the equivalent arrow::Schema) which + /// correspond to the column root (first node below the parquet schema's root group) of + /// each leaf referenced in column_indices. + /// + /// For example, for leaves `a.b.c`, `a.b.d.e`, and `i.j.k` (column_indices=[0,1,3]) + /// the roots are `a` and `i` (return=[0,2]). + /// + /// root + /// -- a <------ + /// -- -- b | | + /// -- -- -- c | + /// -- -- -- d | + /// -- -- -- -- e + /// -- f + /// -- -- g + /// -- -- -- h + /// -- i <--- + /// -- -- j | + /// -- -- -- k + ::arrow::Result> GetFieldIndices( + const std::vector& column_indices) const { + const schema::GroupNode* group = descr->group_node(); + std::unordered_set already_added; + + std::vector out; + for (int column_idx : column_indices) { + if (column_idx < 0 || column_idx >= descr->num_columns()) { + return ::arrow::Status::IndexError("Column index ", column_idx, " is not valid"); + } + + auto field_node = descr->GetColumnRoot(column_idx); + auto field_idx = group->FieldIndex(*field_node); + if (field_idx == -1) { + return ::arrow::Status::IndexError("Column index ", column_idx, " is not valid"); + } + + if (already_added.insert(field_idx).second) { + out.push_back(field_idx); + } + } + return out; + } +}; + +} // namespace arrow +} // namespace parquet diff --git a/shared/package-files/32/32325d17fca654bea6b60431f9a4abfebb0d3716938b6a4714b8f268f081ab94/blob b/shared/package-files/32/32325d17fca654bea6b60431f9a4abfebb0d3716938b6a4714b8f268f081ab94/blob new file mode 100644 index 0000000000000000000000000000000000000000..574e90178fb489fe99c99ea0c72df57ceec4b249 --- /dev/null +++ b/shared/package-files/32/32325d17fca654bea6b60431f9a4abfebb0d3716938b6a4714b8f268f081ab94/blob @@ -0,0 +1,1335 @@ +from sympy.core.mod import Mod +from sympy.core.numbers import (I, oo, pi) +from sympy.functions.combinatorial.factorials import factorial +from sympy.functions.elementary.exponential import (exp, log) +from sympy.functions.elementary.miscellaneous import sqrt +from sympy.functions.elementary.trigonometric import (asin, sin) +from sympy.simplify.simplify import simplify +from sympy.core import Symbol, S, Rational, Integer, Dummy, Wild, Pow +from sympy.core.assumptions import (assumptions, check_assumptions, + failing_assumptions, common_assumptions, _generate_assumption_rules, + _load_pre_generated_assumption_rules) +from sympy.core.facts import InconsistentAssumptions +from sympy.core.random import seed +from sympy.combinatorics import Permutation +from sympy.combinatorics.perm_groups import PermutationGroup + +from sympy.testing.pytest import raises, XFAIL + + +def test_symbol_unset(): + x = Symbol('x', real=True, integer=True) + assert x.is_real is True + assert x.is_integer is True + assert x.is_imaginary is False + assert x.is_noninteger is False + assert x.is_number is False + + +def test_zero(): + z = Integer(0) + assert z.is_commutative is True + assert z.is_integer is True + assert z.is_rational is True + assert z.is_algebraic is True + assert z.is_transcendental is False + assert z.is_real is True + assert z.is_complex is True + assert z.is_noninteger is False + assert z.is_irrational is False + assert z.is_imaginary is False + assert z.is_positive is False + assert z.is_negative is False + assert z.is_nonpositive is True + assert z.is_nonnegative is True + assert z.is_even is True + assert z.is_odd is False + assert z.is_finite is True + assert z.is_infinite is False + assert z.is_comparable is True + assert z.is_prime is False + assert z.is_composite is False + assert z.is_number is True + + +def test_one(): + z = Integer(1) + assert z.is_commutative is True + assert z.is_integer is True + assert z.is_rational is True + assert z.is_algebraic is True + assert z.is_transcendental is False + assert z.is_real is True + assert z.is_complex is True + assert z.is_noninteger is False + assert z.is_irrational is False + assert z.is_imaginary is False + assert z.is_positive is True + assert z.is_negative is False + assert z.is_nonpositive is False + assert z.is_nonnegative is True + assert z.is_even is False + assert z.is_odd is True + assert z.is_finite is True + assert z.is_infinite is False + assert z.is_comparable is True + assert z.is_prime is False + assert z.is_number is True + assert z.is_composite is False # issue 8807 + + +def test_negativeone(): + z = Integer(-1) + assert z.is_commutative is True + assert z.is_integer is True + assert z.is_rational is True + assert z.is_algebraic is True + assert z.is_transcendental is False + assert z.is_real is True + assert z.is_complex is True + assert z.is_noninteger is False + assert z.is_irrational is False + assert z.is_imaginary is False + assert z.is_positive is False + assert z.is_negative is True + assert z.is_nonpositive is True + assert z.is_nonnegative is False + assert z.is_even is False + assert z.is_odd is True + assert z.is_finite is True + assert z.is_infinite is False + assert z.is_comparable is True + assert z.is_prime is False + assert z.is_composite is False + assert z.is_number is True + + +def test_infinity(): + oo = S.Infinity + + assert oo.is_commutative is True + assert oo.is_integer is False + assert oo.is_rational is False + assert oo.is_algebraic is False + assert oo.is_transcendental is False + assert oo.is_extended_real is True + assert oo.is_real is False + assert oo.is_complex is False + assert oo.is_noninteger is True + assert oo.is_irrational is False + assert oo.is_imaginary is False + assert oo.is_nonzero is False + assert oo.is_positive is False + assert oo.is_negative is False + assert oo.is_nonpositive is False + assert oo.is_nonnegative is False + assert oo.is_extended_nonzero is True + assert oo.is_extended_positive is True + assert oo.is_extended_negative is False + assert oo.is_extended_nonpositive is False + assert oo.is_extended_nonnegative is True + assert oo.is_even is False + assert oo.is_odd is False + assert oo.is_finite is False + assert oo.is_infinite is True + assert oo.is_comparable is True + assert oo.is_prime is False + assert oo.is_composite is False + assert oo.is_number is True + + +def test_neg_infinity(): + mm = S.NegativeInfinity + + assert mm.is_commutative is True + assert mm.is_integer is False + assert mm.is_rational is False + assert mm.is_algebraic is False + assert mm.is_transcendental is False + assert mm.is_extended_real is True + assert mm.is_real is False + assert mm.is_complex is False + assert mm.is_noninteger is True + assert mm.is_irrational is False + assert mm.is_imaginary is False + assert mm.is_nonzero is False + assert mm.is_positive is False + assert mm.is_negative is False + assert mm.is_nonpositive is False + assert mm.is_nonnegative is False + assert mm.is_extended_nonzero is True + assert mm.is_extended_positive is False + assert mm.is_extended_negative is True + assert mm.is_extended_nonpositive is True + assert mm.is_extended_nonnegative is False + assert mm.is_even is False + assert mm.is_odd is False + assert mm.is_finite is False + assert mm.is_infinite is True + assert mm.is_comparable is True + assert mm.is_prime is False + assert mm.is_composite is False + assert mm.is_number is True + + +def test_zoo(): + zoo = S.ComplexInfinity + assert zoo.is_complex is False + assert zoo.is_real is False + assert zoo.is_prime is False + + +def test_nan(): + nan = S.NaN + + assert nan.is_commutative is True + assert nan.is_integer is None + assert nan.is_rational is None + assert nan.is_algebraic is None + assert nan.is_transcendental is None + assert nan.is_real is None + assert nan.is_complex is None + assert nan.is_noninteger is None + assert nan.is_irrational is None + assert nan.is_imaginary is None + assert nan.is_positive is None + assert nan.is_negative is None + assert nan.is_nonpositive is None + assert nan.is_nonnegative is None + assert nan.is_even is None + assert nan.is_odd is None + assert nan.is_finite is None + assert nan.is_infinite is None + assert nan.is_comparable is False + assert nan.is_prime is None + assert nan.is_composite is None + assert nan.is_number is True + + +def test_pos_rational(): + r = Rational(3, 4) + assert r.is_commutative is True + assert r.is_integer is False + assert r.is_rational is True + assert r.is_algebraic is True + assert r.is_transcendental is False + assert r.is_real is True + assert r.is_complex is True + assert r.is_noninteger is True + assert r.is_irrational is False + assert r.is_imaginary is False + assert r.is_positive is True + assert r.is_negative is False + assert r.is_nonpositive is False + assert r.is_nonnegative is True + assert r.is_even is False + assert r.is_odd is False + assert r.is_finite is True + assert r.is_infinite is False + assert r.is_comparable is True + assert r.is_prime is False + assert r.is_composite is False + + r = Rational(1, 4) + assert r.is_nonpositive is False + assert r.is_positive is True + assert r.is_negative is False + assert r.is_nonnegative is True + r = Rational(5, 4) + assert r.is_negative is False + assert r.is_positive is True + assert r.is_nonpositive is False + assert r.is_nonnegative is True + r = Rational(5, 3) + assert r.is_nonnegative is True + assert r.is_positive is True + assert r.is_negative is False + assert r.is_nonpositive is False + + +def test_neg_rational(): + r = Rational(-3, 4) + assert r.is_positive is False + assert r.is_nonpositive is True + assert r.is_negative is True + assert r.is_nonnegative is False + r = Rational(-1, 4) + assert r.is_nonpositive is True + assert r.is_positive is False + assert r.is_negative is True + assert r.is_nonnegative is False + r = Rational(-5, 4) + assert r.is_negative is True + assert r.is_positive is False + assert r.is_nonpositive is True + assert r.is_nonnegative is False + r = Rational(-5, 3) + assert r.is_nonnegative is False + assert r.is_positive is False + assert r.is_negative is True + assert r.is_nonpositive is True + + +def test_pi(): + z = S.Pi + assert z.is_commutative is True + assert z.is_integer is False + assert z.is_rational is False + assert z.is_algebraic is False + assert z.is_transcendental is True + assert z.is_real is True + assert z.is_complex is True + assert z.is_noninteger is True + assert z.is_irrational is True + assert z.is_imaginary is False + assert z.is_positive is True + assert z.is_negative is False + assert z.is_nonpositive is False + assert z.is_nonnegative is True + assert z.is_even is False + assert z.is_odd is False + assert z.is_finite is True + assert z.is_infinite is False + assert z.is_comparable is True + assert z.is_prime is False + assert z.is_composite is False + + +def test_E(): + z = S.Exp1 + assert z.is_commutative is True + assert z.is_integer is False + assert z.is_rational is False + assert z.is_algebraic is False + assert z.is_transcendental is True + assert z.is_real is True + assert z.is_complex is True + assert z.is_noninteger is True + assert z.is_irrational is True + assert z.is_imaginary is False + assert z.is_positive is True + assert z.is_negative is False + assert z.is_nonpositive is False + assert z.is_nonnegative is True + assert z.is_even is False + assert z.is_odd is False + assert z.is_finite is True + assert z.is_infinite is False + assert z.is_comparable is True + assert z.is_prime is False + assert z.is_composite is False + + +def test_I(): + z = S.ImaginaryUnit + assert z.is_commutative is True + assert z.is_integer is False + assert z.is_rational is False + assert z.is_algebraic is True + assert z.is_transcendental is False + assert z.is_real is False + assert z.is_complex is True + assert z.is_noninteger is False + assert z.is_irrational is False + assert z.is_imaginary is True + assert z.is_positive is False + assert z.is_negative is False + assert z.is_nonpositive is False + assert z.is_nonnegative is False + assert z.is_even is False + assert z.is_odd is False + assert z.is_finite is True + assert z.is_infinite is False + assert z.is_comparable is False + assert z.is_prime is False + assert z.is_composite is False + + +def test_symbol_real_false(): + # issue 3848 + a = Symbol('a', real=False) + + assert a.is_real is False + assert a.is_integer is False + assert a.is_zero is False + + assert a.is_negative is False + assert a.is_positive is False + assert a.is_nonnegative is False + assert a.is_nonpositive is False + assert a.is_nonzero is False + + assert a.is_extended_negative is None + assert a.is_extended_positive is None + assert a.is_extended_nonnegative is None + assert a.is_extended_nonpositive is None + assert a.is_extended_nonzero is None + + +def test_symbol_extended_real_false(): + # issue 3848 + a = Symbol('a', extended_real=False) + + assert a.is_real is False + assert a.is_integer is False + assert a.is_zero is False + + assert a.is_negative is False + assert a.is_positive is False + assert a.is_nonnegative is False + assert a.is_nonpositive is False + assert a.is_nonzero is False + + assert a.is_extended_negative is False + assert a.is_extended_positive is False + assert a.is_extended_nonnegative is False + assert a.is_extended_nonpositive is False + assert a.is_extended_nonzero is False + + +def test_symbol_imaginary(): + a = Symbol('a', imaginary=True) + + assert a.is_real is False + assert a.is_integer is False + assert a.is_negative is False + assert a.is_positive is False + assert a.is_nonnegative is False + assert a.is_nonpositive is False + assert a.is_zero is False + assert a.is_nonzero is False # since nonzero -> real + + +def test_symbol_zero(): + x = Symbol('x', zero=True) + assert x.is_positive is False + assert x.is_nonpositive + assert x.is_negative is False + assert x.is_nonnegative + assert x.is_zero is True + # TODO Change to x.is_nonzero is None + # See https://github.com/sympy/sympy/pull/9583 + assert x.is_nonzero is False + assert x.is_finite is True + + +def test_symbol_positive(): + x = Symbol('x', positive=True) + assert x.is_positive is True + assert x.is_nonpositive is False + assert x.is_negative is False + assert x.is_nonnegative is True + assert x.is_zero is False + assert x.is_nonzero is True + + +def test_neg_symbol_positive(): + x = -Symbol('x', positive=True) + assert x.is_positive is False + assert x.is_nonpositive is True + assert x.is_negative is True + assert x.is_nonnegative is False + assert x.is_zero is False + assert x.is_nonzero is True + + +def test_symbol_nonpositive(): + x = Symbol('x', nonpositive=True) + assert x.is_positive is False + assert x.is_nonpositive is True + assert x.is_negative is None + assert x.is_nonnegative is None + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_neg_symbol_nonpositive(): + x = -Symbol('x', nonpositive=True) + assert x.is_positive is None + assert x.is_nonpositive is None + assert x.is_negative is False + assert x.is_nonnegative is True + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_symbol_falsepositive(): + x = Symbol('x', positive=False) + assert x.is_positive is False + assert x.is_nonpositive is None + assert x.is_negative is None + assert x.is_nonnegative is None + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_symbol_falsepositive_mul(): + # To test pull request 9379 + # Explicit handling of arg.is_positive=False was added to Mul._eval_is_positive + x = 2*Symbol('x', positive=False) + assert x.is_positive is False # This was None before + assert x.is_nonpositive is None + assert x.is_negative is None + assert x.is_nonnegative is None + assert x.is_zero is None + assert x.is_nonzero is None + + +@XFAIL +def test_symbol_infinitereal_mul(): + ix = Symbol('ix', infinite=True, extended_real=True) + assert (-ix).is_extended_positive is None + + +def test_neg_symbol_falsepositive(): + x = -Symbol('x', positive=False) + assert x.is_positive is None + assert x.is_nonpositive is None + assert x.is_negative is False + assert x.is_nonnegative is None + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_neg_symbol_falsenegative(): + # To test pull request 9379 + # Explicit handling of arg.is_negative=False was added to Mul._eval_is_positive + x = -Symbol('x', negative=False) + assert x.is_positive is False # This was None before + assert x.is_nonpositive is None + assert x.is_negative is None + assert x.is_nonnegative is None + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_symbol_falsepositive_real(): + x = Symbol('x', positive=False, real=True) + assert x.is_positive is False + assert x.is_nonpositive is True + assert x.is_negative is None + assert x.is_nonnegative is None + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_neg_symbol_falsepositive_real(): + x = -Symbol('x', positive=False, real=True) + assert x.is_positive is None + assert x.is_nonpositive is None + assert x.is_negative is False + assert x.is_nonnegative is True + assert x.is_zero is None + assert x.is_nonzero is None + + +def test_symbol_falsenonnegative(): + x = Symbol('x', nonnegative=False) + assert x.is_positive is False + assert x.is_nonpositive is None + assert x.is_negative is None + assert x.is_nonnegative is False + assert x.is_zero is False + assert x.is_nonzero is None + + +@XFAIL +def test_neg_symbol_falsenonnegative(): + x = -Symbol('x', nonnegative=False) + assert x.is_positive is None + assert x.is_nonpositive is False # this currently returns None + assert x.is_negative is False # this currently returns None + assert x.is_nonnegative is None + assert x.is_zero is False # this currently returns None + assert x.is_nonzero is True # this currently returns None + + +def test_symbol_falsenonnegative_real(): + x = Symbol('x', nonnegative=False, real=True) + assert x.is_positive is False + assert x.is_nonpositive is True + assert x.is_negative is True + assert x.is_nonnegative is False + assert x.is_zero is False + assert x.is_nonzero is True + + +def test_neg_symbol_falsenonnegative_real(): + x = -Symbol('x', nonnegative=False, real=True) + assert x.is_positive is True + assert x.is_nonpositive is False + assert x.is_negative is False + assert x.is_nonnegative is True + assert x.is_zero is False + assert x.is_nonzero is True + + +def test_prime(): + assert S.NegativeOne.is_prime is False + assert S(-2).is_prime is False + assert S(-4).is_prime is False + assert S.Zero.is_prime is False + assert S.One.is_prime is False + assert S(2).is_prime is True + assert S(17).is_prime is True + assert S(4).is_prime is False + + +def test_composite(): + assert S.NegativeOne.is_composite is False + assert S(-2).is_composite is False + assert S(-4).is_composite is False + assert S.Zero.is_composite is False + assert S(2).is_composite is False + assert S(17).is_composite is False + assert S(4).is_composite is True + x = Dummy(integer=True, positive=True, prime=False) + assert x.is_composite is None # x could be 1 + assert (x + 1).is_composite is None + x = Dummy(positive=True, even=True, prime=False) + assert x.is_integer is True + assert x.is_composite is True + + +def test_prime_symbol(): + x = Symbol('x', prime=True) + assert x.is_prime is True + assert x.is_integer is True + assert x.is_positive is True + assert x.is_negative is False + assert x.is_nonpositive is False + assert x.is_nonnegative is True + + x = Symbol('x', prime=False) + assert x.is_prime is False + assert x.is_integer is None + assert x.is_positive is None + assert x.is_negative is None + assert x.is_nonpositive is None + assert x.is_nonnegative is None + + +def test_symbol_noncommutative(): + x = Symbol('x', commutative=True) + assert x.is_complex is None + + x = Symbol('x', commutative=False) + assert x.is_integer is False + assert x.is_rational is False + assert x.is_algebraic is False + assert x.is_irrational is False + assert x.is_real is False + assert x.is_complex is False + + +def test_other_symbol(): + x = Symbol('x', integer=True) + assert x.is_integer is True + assert x.is_real is True + assert x.is_finite is True + + x = Symbol('x', integer=True, nonnegative=True) + assert x.is_integer is True + assert x.is_nonnegative is True + assert x.is_negative is False + assert x.is_positive is None + assert x.is_finite is True + + x = Symbol('x', integer=True, nonpositive=True) + assert x.is_integer is True + assert x.is_nonpositive is True + assert x.is_positive is False + assert x.is_negative is None + assert x.is_finite is True + + x = Symbol('x', odd=True) + assert x.is_odd is True + assert x.is_even is False + assert x.is_integer is True + assert x.is_finite is True + + x = Symbol('x', odd=False) + assert x.is_odd is False + assert x.is_even is None + assert x.is_integer is None + assert x.is_finite is None + + x = Symbol('x', even=True) + assert x.is_even is True + assert x.is_odd is False + assert x.is_integer is True + assert x.is_finite is True + + x = Symbol('x', even=False) + assert x.is_even is False + assert x.is_odd is None + assert x.is_integer is None + assert x.is_finite is None + + x = Symbol('x', integer=True, nonnegative=True) + assert x.is_integer is True + assert x.is_nonnegative is True + assert x.is_finite is True + + x = Symbol('x', integer=True, nonpositive=True) + assert x.is_integer is True + assert x.is_nonpositive is True + assert x.is_finite is True + + x = Symbol('x', rational=True) + assert x.is_real is True + assert x.is_finite is True + + x = Symbol('x', rational=False) + assert x.is_real is None + assert x.is_finite is None + + x = Symbol('x', irrational=True) + assert x.is_real is True + assert x.is_finite is True + + x = Symbol('x', irrational=False) + assert x.is_real is None + assert x.is_finite is None + + with raises(AttributeError): + x.is_real = False + + x = Symbol('x', algebraic=True) + assert x.is_transcendental is False + x = Symbol('x', transcendental=True) + assert x.is_algebraic is False + assert x.is_rational is False + assert x.is_integer is False + + +def test_evaluate_false(): + # Previously this failed because the assumptions query would make new + # expressions and some of the evaluation logic would fail under + # evaluate(False). + from sympy.core.parameters import evaluate + from sympy.abc import x, h + f = 2**x**7 + with evaluate(False): + fh = f.xreplace({x: x+h}) + assert fh.exp.is_rational is None + + +def test_issue_3825(): + """catch: hash instability""" + x = Symbol("x") + y = Symbol("y") + a1 = x + y + a2 = y + x + a2.is_comparable + + h1 = hash(a1) + h2 = hash(a2) + assert h1 == h2 + + +def test_issue_4822(): + z = (-1)**Rational(1, 3)*(1 - I*sqrt(3)) + assert z.is_real in [True, None] + + +def test_hash_vs_typeinfo(): + """seemingly different typeinfo, but in fact equal""" + + # the following two are semantically equal + x1 = Symbol('x', even=True) + x2 = Symbol('x', integer=True, odd=False) + + assert hash(x1) == hash(x2) + assert x1 == x2 + + +def test_hash_vs_typeinfo_2(): + """different typeinfo should mean !eq""" + # the following two are semantically different + x = Symbol('x') + x1 = Symbol('x', even=True) + + assert x != x1 + assert hash(x) != hash(x1) # This might fail with very low probability + + +def test_hash_vs_eq(): + """catch: different hash for equal objects""" + a = 1 + S.Pi # important: do not fold it into a Number instance + ha = hash(a) # it should be Add/Mul/... to trigger the bug + + a.is_positive # this uses .evalf() and deduces it is positive + assert a.is_positive is True + + # be sure that hash stayed the same + assert ha == hash(a) + + # now b should be the same expression + b = a.expand(trig=True) + hb = hash(b) + + assert a == b + assert ha == hb + + +def test_Add_is_pos_neg(): + # these cover lines not covered by the rest of tests in core + n = Symbol('n', extended_negative=True, infinite=True) + nn = Symbol('n', extended_nonnegative=True, infinite=True) + np = Symbol('n', extended_nonpositive=True, infinite=True) + p = Symbol('p', extended_positive=True, infinite=True) + r = Dummy(extended_real=True, finite=False) + x = Symbol('x') + xf = Symbol('xf', finite=True) + assert (n + p).is_extended_positive is None + assert (n + x).is_extended_positive is None + assert (p + x).is_extended_positive is None + assert (n + p).is_extended_negative is None + assert (n + x).is_extended_negative is None + assert (p + x).is_extended_negative is None + + assert (n + xf).is_extended_positive is False + assert (p + xf).is_extended_positive is True + assert (n + xf).is_extended_negative is True + assert (p + xf).is_extended_negative is False + + assert (x - S.Infinity).is_extended_negative is None # issue 7798 + # issue 8046, 16.2 + assert (p + nn).is_extended_positive + assert (n + np).is_extended_negative + assert (p + r).is_extended_positive is None + + +def test_Add_is_imaginary(): + nn = Dummy(nonnegative=True) + assert (I*nn + I).is_imaginary # issue 8046, 17 + + +def test_Add_is_algebraic(): + a = Symbol('a', algebraic=True) + b = Symbol('a', algebraic=True) + na = Symbol('na', algebraic=False) + nb = Symbol('nb', algebraic=False) + x = Symbol('x') + assert (a + b).is_algebraic + assert (na + nb).is_algebraic is None + assert (a + na).is_algebraic is False + assert (a + x).is_algebraic is None + assert (na + x).is_algebraic is None + + +def test_Mul_is_algebraic(): + a = Symbol('a', algebraic=True) + b = Symbol('b', algebraic=True) + na = Symbol('na', algebraic=False) + an = Symbol('an', algebraic=True, nonzero=True) + nb = Symbol('nb', algebraic=False) + x = Symbol('x') + assert (a*b).is_algebraic is True + assert (na*nb).is_algebraic is None + assert (a*na).is_algebraic is None + assert (an*na).is_algebraic is False + assert (a*x).is_algebraic is None + assert (na*x).is_algebraic is None + + +def test_Pow_is_algebraic(): + e = Symbol('e', algebraic=True) + + assert Pow(1, e, evaluate=False).is_algebraic + assert Pow(0, e, evaluate=False).is_algebraic + + a = Symbol('a', algebraic=True) + azf = Symbol('azf', algebraic=True, zero=False) + na = Symbol('na', algebraic=False) + ia = Symbol('ia', algebraic=True, irrational=True) + ib = Symbol('ib', algebraic=True, irrational=True) + r = Symbol('r', rational=True) + x = Symbol('x') + assert (a**2).is_algebraic is True + assert (a**r).is_algebraic is None + assert (azf**r).is_algebraic is True + assert (a**x).is_algebraic is None + assert (na**r).is_algebraic is None + assert (ia**r).is_algebraic is True + assert (ia**ib).is_algebraic is False + + assert (a**e).is_algebraic is None + + # Gelfond-Schneider constant: + assert Pow(2, sqrt(2), evaluate=False).is_algebraic is False + + assert Pow(S.GoldenRatio, sqrt(3), evaluate=False).is_algebraic is False + + # issue 8649 + t = Symbol('t', real=True, transcendental=True) + n = Symbol('n', integer=True) + assert (t**n).is_algebraic is None + assert (t**n).is_integer is None + + assert (pi**3).is_algebraic is False + r = Symbol('r', zero=True) + assert (pi**r).is_algebraic is True + + +def test_Mul_is_prime_composite(): + x = Symbol('x', positive=True, integer=True) + y = Symbol('y', positive=True, integer=True) + assert (x*y).is_prime is None + assert ( (x+1)*(y+1) ).is_prime is False + assert ( (x+1)*(y+1) ).is_composite is True + + x = Symbol('x', positive=True) + assert ( (x+1)*(y+1) ).is_prime is None + assert ( (x+1)*(y+1) ).is_composite is None + + +def test_Pow_is_pos_neg(): + z = Symbol('z', real=True) + w = Symbol('w', nonpositive=True) + + assert (S.NegativeOne**S(2)).is_positive is True + assert (S.One**z).is_positive is True + assert (S.NegativeOne**S(3)).is_positive is False + assert (S.Zero**S.Zero).is_positive is True # 0**0 is 1 + assert (w**S(3)).is_positive is False + assert (w**S(2)).is_positive is None + assert (I**2).is_positive is False + assert (I**4).is_positive is True + + # tests emerging from #16332 issue + p = Symbol('p', zero=True) + q = Symbol('q', zero=False, real=True) + j = Symbol('j', zero=False, even=True) + x = Symbol('x', zero=True) + y = Symbol('y', zero=True) + assert (p**q).is_positive is False + assert (p**q).is_negative is False + assert (p**j).is_positive is False + assert (x**y).is_positive is True # 0**0 + assert (x**y).is_negative is False + + +def test_Pow_is_prime_composite(): + x = Symbol('x', positive=True, integer=True) + y = Symbol('y', positive=True, integer=True) + assert (x**y).is_prime is None + assert ( x**(y+1) ).is_prime is False + assert ( x**(y+1) ).is_composite is None + assert ( (x+1)**(y+1) ).is_composite is True + assert ( (-x-1)**(2*y) ).is_composite is True + + x = Symbol('x', positive=True) + assert (x**y).is_prime is None + + +def test_Mul_is_infinite(): + x = Symbol('x') + f = Symbol('f', finite=True) + i = Symbol('i', infinite=True) + z = Dummy(zero=True) + nzf = Dummy(finite=True, zero=False) + from sympy.core.mul import Mul + assert (x*f).is_finite is None + assert (x*i).is_finite is None + assert (f*i).is_finite is None + assert (x*f*i).is_finite is None + assert (z*i).is_finite is None + assert (nzf*i).is_finite is False + assert (z*f).is_finite is True + assert Mul(0, f, evaluate=False).is_finite is True + assert Mul(0, i, evaluate=False).is_finite is None + + assert (x*f).is_infinite is None + assert (x*i).is_infinite is None + assert (f*i).is_infinite is None + assert (x*f*i).is_infinite is None + assert (z*i).is_infinite is S.NaN.is_infinite + assert (nzf*i).is_infinite is True + assert (z*f).is_infinite is False + assert Mul(0, f, evaluate=False).is_infinite is False + assert Mul(0, i, evaluate=False).is_infinite is S.NaN.is_infinite + + +def test_Add_is_infinite(): + x = Symbol('x') + f = Symbol('f', finite=True) + i = Symbol('i', infinite=True) + i2 = Symbol('i2', infinite=True) + z = Dummy(zero=True) + nzf = Dummy(finite=True, zero=False) + from sympy.core.add import Add + assert (x+f).is_finite is None + assert (x+i).is_finite is None + assert (f+i).is_finite is False + assert (x+f+i).is_finite is None + assert (z+i).is_finite is False + assert (nzf+i).is_finite is False + assert (z+f).is_finite is True + assert (i+i2).is_finite is None + assert Add(0, f, evaluate=False).is_finite is True + assert Add(0, i, evaluate=False).is_finite is False + + assert (x+f).is_infinite is None + assert (x+i).is_infinite is None + assert (f+i).is_infinite is True + assert (x+f+i).is_infinite is None + assert (z+i).is_infinite is True + assert (nzf+i).is_infinite is True + assert (z+f).is_infinite is False + assert (i+i2).is_infinite is None + assert Add(0, f, evaluate=False).is_infinite is False + assert Add(0, i, evaluate=False).is_infinite is True + + +def test_special_is_rational(): + i = Symbol('i', integer=True) + i2 = Symbol('i2', integer=True) + ni = Symbol('ni', integer=True, nonzero=True) + r = Symbol('r', rational=True) + rn = Symbol('r', rational=True, nonzero=True) + nr = Symbol('nr', irrational=True) + x = Symbol('x') + assert sqrt(3).is_rational is False + assert (3 + sqrt(3)).is_rational is False + assert (3*sqrt(3)).is_rational is False + assert exp(3).is_rational is False + assert exp(ni).is_rational is False + assert exp(rn).is_rational is False + assert exp(x).is_rational is None + assert exp(log(3), evaluate=False).is_rational is True + assert log(exp(3), evaluate=False).is_rational is True + assert log(3).is_rational is False + assert log(ni + 1).is_rational is False + assert log(rn + 1).is_rational is False + assert log(x).is_rational is None + assert (sqrt(3) + sqrt(5)).is_rational is None + assert (sqrt(3) + S.Pi).is_rational is False + assert (x**i).is_rational is None + assert (i**i).is_rational is True + assert (i**i2).is_rational is None + assert (r**i).is_rational is None + assert (r**r).is_rational is None + assert (r**x).is_rational is None + assert (nr**i).is_rational is None # issue 8598 + assert (nr**Symbol('z', zero=True)).is_rational + assert sin(1).is_rational is False + assert sin(ni).is_rational is False + assert sin(rn).is_rational is False + assert sin(x).is_rational is None + assert asin(r).is_rational is False + assert sin(asin(3), evaluate=False).is_rational is True + + +@XFAIL +def test_issue_6275(): + x = Symbol('x') + # both zero or both Muls...but neither "change would be very appreciated. + # This is similar to x/x => 1 even though if x = 0, it is really nan. + assert isinstance(x*0, type(0*S.Infinity)) + if 0*S.Infinity is S.NaN: + b = Symbol('b', finite=None) + assert (b*0).is_zero is None + + +def test_sanitize_assumptions(): + # issue 6666 + for cls in (Symbol, Dummy, Wild): + x = cls('x', real=1, positive=0) + assert x.is_real is True + assert x.is_positive is False + assert cls('', real=True, positive=None).is_positive is None + raises(ValueError, lambda: cls('', commutative=None)) + raises(ValueError, lambda: Symbol._sanitize({"commutative": None})) + + +def test_special_assumptions(): + e = -3 - sqrt(5) + (-sqrt(10)/2 - sqrt(2)/2)**2 + assert simplify(e < 0) is S.false + assert simplify(e > 0) is S.false + assert (e == 0) is False # it's not a literal 0 + assert e.equals(0) is True + + +def test_inconsistent(): + # cf. issues 5795 and 5545 + raises(InconsistentAssumptions, lambda: Symbol('x', real=True, + commutative=False)) + + +def test_issue_6631(): + assert ((-1)**(I)).is_real is True + assert ((-1)**(I*2)).is_real is True + assert ((-1)**(I/2)).is_real is True + assert ((-1)**(I*S.Pi)).is_real is True + assert (I**(I + 2)).is_real is True + + +def test_issue_2730(): + assert (1/(1 + I)).is_real is False + + +def test_issue_4149(): + assert (3 + I).is_complex + assert (3 + I).is_imaginary is False + assert (3*I + S.Pi*I).is_imaginary + # as Zero.is_imaginary is False, see issue 7649 + y = Symbol('y', real=True) + assert (3*I + S.Pi*I + y*I).is_imaginary is None + p = Symbol('p', positive=True) + assert (3*I + S.Pi*I + p*I).is_imaginary + n = Symbol('n', negative=True) + assert (-3*I - S.Pi*I + n*I).is_imaginary + + i = Symbol('i', imaginary=True) + assert ([(i**a).is_imaginary for a in range(4)] == + [False, True, False, True]) + + # tests from the PR #7887: + e = S("-sqrt(3)*I/2 + 0.866025403784439*I") + assert e.is_real is False + assert e.is_imaginary + + +def test_issue_2920(): + n = Symbol('n', negative=True) + assert sqrt(n).is_imaginary + + +def test_issue_7899(): + x = Symbol('x', real=True) + assert (I*x).is_real is None + assert ((x - I)*(x - 1)).is_zero is None + assert ((x - I)*(x - 1)).is_real is None + + +@XFAIL +def test_issue_7993(): + x = Dummy(integer=True) + y = Dummy(noninteger=True) + assert (x - y).is_zero is False + + +def test_issue_8075(): + raises(InconsistentAssumptions, lambda: Dummy(zero=True, finite=False)) + raises(InconsistentAssumptions, lambda: Dummy(zero=True, infinite=True)) + + +def test_issue_8642(): + x = Symbol('x', real=True, integer=False) + assert (x*2).is_integer is None, (x*2).is_integer + + +def test_issues_8632_8633_8638_8675_8992(): + p = Dummy(integer=True, positive=True) + nn = Dummy(integer=True, nonnegative=True) + assert (p - S.Half).is_positive + assert (p - 1).is_nonnegative + assert (nn + 1).is_positive + assert (-p + 1).is_nonpositive + assert (-nn - 1).is_negative + prime = Dummy(prime=True) + assert (prime - 2).is_nonnegative + assert (prime - 3).is_nonnegative is None + even = Dummy(positive=True, even=True) + assert (even - 2).is_nonnegative + + p = Dummy(positive=True) + assert (p/(p + 1) - 1).is_negative + assert ((p + 2)**3 - S.Half).is_positive + n = Dummy(negative=True) + assert (n - 3).is_nonpositive + + +def test_issue_9115_9150(): + n = Dummy('n', integer=True, nonnegative=True) + assert (factorial(n) >= 1) == True + assert (factorial(n) < 1) == False + + assert factorial(n + 1).is_even is None + assert factorial(n + 2).is_even is True + assert factorial(n + 2) >= 2 + + +def test_issue_9165(): + z = Symbol('z', zero=True) + f = Symbol('f', finite=False) + assert 0/z is S.NaN + assert 0*(1/z) is S.NaN + assert 0*f is S.NaN + + +def test_issue_10024(): + x = Dummy('x') + assert Mod(x, 2*pi).is_zero is None + + +def test_issue_10302(): + x = Symbol('x') + r = Symbol('r', real=True) + u = -(3*2**pi)**(1/pi) + 2*3**(1/pi) + i = u + u*I + + assert i.is_real is None # w/o simplification this should fail + assert (u + i).is_zero is None + assert (1 + i).is_zero is False + + a = Dummy('a', zero=True) + assert (a + I).is_zero is False + assert (a + r*I).is_zero is None + assert (a + I).is_imaginary + assert (a + x + I).is_imaginary is None + assert (a + r*I + I).is_imaginary is None + + +def test_complex_reciprocal_imaginary(): + assert (1 / (4 + 3*I)).is_imaginary is False + + +def test_issue_16313(): + x = Symbol('x', extended_real=False) + k = Symbol('k', real=True) + l = Symbol('l', real=True, zero=False) + assert (-x).is_real is False + assert (k*x).is_real is None # k can be zero also + assert (l*x).is_real is False + assert (l*x*x).is_real is None # since x*x can be a real number + assert (-x).is_positive is False + + +def test_issue_16579(): + # extended_real -> finite | infinite + x = Symbol('x', extended_real=True, infinite=False) + y = Symbol('y', extended_real=True, finite=False) + assert x.is_finite is True + assert y.is_infinite is True + + # With PR 16978, complex now implies finite + c = Symbol('c', complex=True) + assert c.is_finite is True + raises(InconsistentAssumptions, lambda: Dummy(complex=True, finite=False)) + + # Now infinite == !finite + nf = Symbol('nf', finite=False) + assert nf.is_infinite is True + + +def test_issue_17556(): + z = I*oo + assert z.is_imaginary is False + assert z.is_finite is False + + +def test_issue_21651(): + k = Symbol('k', positive=True, integer=True) + exp = 2*2**(-k) + assert exp.is_integer is None + + +def test_assumptions_copy(): + assert assumptions(Symbol('x'), {"commutative": True} + ) == {'commutative': True} + assert assumptions(Symbol('x'), ['integer']) == {} + assert assumptions(Symbol('x'), ['commutative'] + ) == {'commutative': True} + assert assumptions(Symbol('x')) == {'commutative': True} + assert assumptions(1)['positive'] + assert assumptions(3 + I) == { + 'algebraic': True, + 'commutative': True, + 'complex': True, + 'composite': False, + 'even': False, + 'extended_negative': False, + 'extended_nonnegative': False, + 'extended_nonpositive': False, + 'extended_nonzero': False, + 'extended_positive': False, + 'extended_real': False, + 'finite': True, + 'imaginary': False, + 'infinite': False, + 'integer': False, + 'irrational': False, + 'negative': False, + 'noninteger': False, + 'nonnegative': False, + 'nonpositive': False, + 'nonzero': False, + 'odd': False, + 'positive': False, + 'prime': False, + 'rational': False, + 'real': False, + 'transcendental': False, + 'zero': False} + + +def test_check_assumptions(): + assert check_assumptions(1, 0) is False + x = Symbol('x', positive=True) + assert check_assumptions(1, x) is True + assert check_assumptions(1, 1) is True + assert check_assumptions(-1, 1) is False + i = Symbol('i', integer=True) + # don't know if i is positive (or prime, etc...) + assert check_assumptions(i, 1) is None + assert check_assumptions(Dummy(integer=None), integer=True) is None + assert check_assumptions(Dummy(integer=None), integer=False) is None + assert check_assumptions(Dummy(integer=False), integer=True) is False + assert check_assumptions(Dummy(integer=True), integer=False) is False + # no T/F assumptions to check + assert check_assumptions(Dummy(integer=False), integer=None) is True + raises(ValueError, lambda: check_assumptions(2*x, x, positive=True)) + + +def test_failing_assumptions(): + x = Symbol('x', positive=True) + y = Symbol('y') + assert failing_assumptions(6*x + y, **x.assumptions0) == \ + {'real': None, 'imaginary': None, 'complex': None, 'hermitian': None, + 'positive': None, 'nonpositive': None, 'nonnegative': None, 'nonzero': None, + 'negative': None, 'zero': None, 'extended_real': None, 'finite': None, + 'infinite': None, 'extended_negative': None, 'extended_nonnegative': None, + 'extended_nonpositive': None, 'extended_nonzero': None, + 'extended_positive': None } + + +def test_common_assumptions(): + assert common_assumptions([0, 1, 2] + ) == {'algebraic': True, 'irrational': False, 'hermitian': + True, 'extended_real': True, 'real': True, 'extended_negative': + False, 'extended_nonnegative': True, 'integer': True, + 'rational': True, 'imaginary': False, 'complex': True, + 'commutative': True,'noninteger': False, 'composite': False, + 'infinite': False, 'nonnegative': True, 'finite': True, + 'transcendental': False,'negative': False} + assert common_assumptions([0, 1, 2], 'positive integer'.split() + ) == {'integer': True} + assert common_assumptions([0, 1, 2], []) == {} + assert common_assumptions([], ['integer']) == {} + assert common_assumptions([0], ['integer']) == {'integer': True} + +def test_pre_generated_assumption_rules_are_valid(): + # check the pre-generated assumptions match freshly generated assumptions + # if this check fails, consider updating the assumptions + # see sympy.core.assumptions._generate_assumption_rules + pre_generated_assumptions =_load_pre_generated_assumption_rules() + generated_assumptions =_generate_assumption_rules() + assert pre_generated_assumptions._to_python() == generated_assumptions._to_python(), "pre-generated assumptions are invalid, see sympy.core.assumptions._generate_assumption_rules" + + +def test_ask_shuffle(): + grp = PermutationGroup(Permutation(1, 0, 2), Permutation(2, 1, 3)) + + seed(123) + first = grp.random() + seed(123) + simplify(I) + second = grp.random() + seed(123) + simplify(-I) + third = grp.random() + + assert first == second == third diff --git a/shared/package-files/32/3233a2802ef9cfaaa844c9201e21eaa2dedeab17f00d94ab11f94930f9be6c71/blob b/shared/package-files/32/3233a2802ef9cfaaa844c9201e21eaa2dedeab17f00d94ab11f94930f9be6c71/blob new file mode 100644 index 0000000000000000000000000000000000000000..843cffc6b3ddd6eb01483bcf1b5c33c717e027b6 --- /dev/null +++ b/shared/package-files/32/3233a2802ef9cfaaa844c9201e21eaa2dedeab17f00d94ab11f94930f9be6c71/blob @@ -0,0 +1,151 @@ +import hashlib +from typing import TYPE_CHECKING, BinaryIO, Dict, Iterable, List, Optional + +from pip._internal.exceptions import HashMismatch, HashMissing, InstallationError +from pip._internal.utils.misc import read_chunks + +if TYPE_CHECKING: + from hashlib import _Hash + + # NoReturn introduced in 3.6.2; imported only for type checking to maintain + # pip compatibility with older patch versions of Python 3.6 + from typing import NoReturn + + +# The recommended hash algo of the moment. Change this whenever the state of +# the art changes; it won't hurt backward compatibility. +FAVORITE_HASH = "sha256" + + +# Names of hashlib algorithms allowed by the --hash option and ``pip hash`` +# Currently, those are the ones at least as collision-resistant as sha256. +STRONG_HASHES = ["sha256", "sha384", "sha512"] + + +class Hashes: + """A wrapper that builds multiple hashes at once and checks them against + known-good values + + """ + + def __init__(self, hashes: Optional[Dict[str, List[str]]] = None) -> None: + """ + :param hashes: A dict of algorithm names pointing to lists of allowed + hex digests + """ + allowed = {} + if hashes is not None: + for alg, keys in hashes.items(): + # Make sure values are always sorted (to ease equality checks) + allowed[alg] = sorted(keys) + self._allowed = allowed + + def __and__(self, other: "Hashes") -> "Hashes": + if not isinstance(other, Hashes): + return NotImplemented + + # If either of the Hashes object is entirely empty (i.e. no hash + # specified at all), all hashes from the other object are allowed. + if not other: + return self + if not self: + return other + + # Otherwise only hashes that present in both objects are allowed. + new = {} + for alg, values in other._allowed.items(): + if alg not in self._allowed: + continue + new[alg] = [v for v in values if v in self._allowed[alg]] + return Hashes(new) + + @property + def digest_count(self) -> int: + return sum(len(digests) for digests in self._allowed.values()) + + def is_hash_allowed(self, hash_name: str, hex_digest: str) -> bool: + """Return whether the given hex digest is allowed.""" + return hex_digest in self._allowed.get(hash_name, []) + + def check_against_chunks(self, chunks: Iterable[bytes]) -> None: + """Check good hashes against ones built from iterable of chunks of + data. + + Raise HashMismatch if none match. + + """ + gots = {} + for hash_name in self._allowed.keys(): + try: + gots[hash_name] = hashlib.new(hash_name) + except (ValueError, TypeError): + raise InstallationError(f"Unknown hash name: {hash_name}") + + for chunk in chunks: + for hash in gots.values(): + hash.update(chunk) + + for hash_name, got in gots.items(): + if got.hexdigest() in self._allowed[hash_name]: + return + self._raise(gots) + + def _raise(self, gots: Dict[str, "_Hash"]) -> "NoReturn": + raise HashMismatch(self._allowed, gots) + + def check_against_file(self, file: BinaryIO) -> None: + """Check good hashes against a file-like object + + Raise HashMismatch if none match. + + """ + return self.check_against_chunks(read_chunks(file)) + + def check_against_path(self, path: str) -> None: + with open(path, "rb") as file: + return self.check_against_file(file) + + def has_one_of(self, hashes: Dict[str, str]) -> bool: + """Return whether any of the given hashes are allowed.""" + for hash_name, hex_digest in hashes.items(): + if self.is_hash_allowed(hash_name, hex_digest): + return True + return False + + def __bool__(self) -> bool: + """Return whether I know any known-good hashes.""" + return bool(self._allowed) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Hashes): + return NotImplemented + return self._allowed == other._allowed + + def __hash__(self) -> int: + return hash( + ",".join( + sorted( + ":".join((alg, digest)) + for alg, digest_list in self._allowed.items() + for digest in digest_list + ) + ) + ) + + +class MissingHashes(Hashes): + """A workalike for Hashes used when we're missing a hash for a requirement + + It computes the actual hash of the requirement and raises a HashMissing + exception showing it to the user. + + """ + + def __init__(self) -> None: + """Don't offer the ``hashes`` kwarg.""" + # Pass our favorite hash in to generate a "gotten hash". With the + # empty list, it will never match, so an error will always raise. + super().__init__(hashes={FAVORITE_HASH: []}) + + def _raise(self, gots: Dict[str, "_Hash"]) -> "NoReturn": + raise HashMissing(gots[FAVORITE_HASH].hexdigest()) diff --git a/shared/package-files/32/323560dd7d8305a117ab3ee787395bf5a26076de4ec4e75b182114a65ad562ad/blob b/shared/package-files/32/323560dd7d8305a117ab3ee787395bf5a26076de4ec4e75b182114a65ad562ad/blob new file mode 100644 index 0000000000000000000000000000000000000000..753803e798d8fd06c3820c3b557b44b6fd9336ca --- /dev/null +++ b/shared/package-files/32/323560dd7d8305a117ab3ee787395bf5a26076de4ec4e75b182114a65ad562ad/blob @@ -0,0 +1,24 @@ +import numpy as np + +""" +Generate data sets for testing elastic net fits of GLMs. +""" + +n = 200 +p = 5 + +# Logistic +exog = np.random.normal(size=(n, p)) +lin_pred = exog.sum(1) * 0.2 +exp_val = 1 / (1 + np.exp(-lin_pred)) +endog = 1 * (np.random.uniform(size=n) < exp_val) +mat = np.concatenate((endog[:, None], exog), axis=1) +np.savetxt("enet_binomial.csv", mat, fmt="%.2f", delimiter=",") + +# Poisson +exog = np.random.normal(size=(n, p)) +lin_pred = exog.sum(1) * 0.2 +exp_val = np.exp(lin_pred) +endog = np.random.poisson(exp_val) +mat = np.concatenate((endog[:, None], exog), axis=1) +np.savetxt("enet_poisson.csv", mat, fmt="%.2f", delimiter=",") diff --git a/shared/package-files/32/3236a309ba2bdd7fc90877810d424fd3f9326a3e65b1ba25b28bc247e98d7f1b/blob b/shared/package-files/32/3236a309ba2bdd7fc90877810d424fd3f9326a3e65b1ba25b28bc247e98d7f1b/blob new file mode 100644 index 0000000000000000000000000000000000000000..b1fbdc733ca8f5ea881e861ec15ef87aae26aef2 --- /dev/null +++ b/shared/package-files/32/3236a309ba2bdd7fc90877810d424fd3f9326a3e65b1ba25b28bc247e98d7f1b/blob @@ -0,0 +1,239 @@ +import weakref +from collections.abc import Callable as _Callable +from collections.abc import Mapping, Sequence +from typing import Any, Final, Hashable, Iterable, NamedTuple, Self, TypeAlias + +from _typeshed import Incomplete +from typing_extensions import Generic, TypeVar, override + +from numba.core import dispatcher +from numba.core.typing.context import Context +from numba.core.typing.templates import FunctionTemplate, Signature + +from .abstract import Callable, DTypeSpec, Dummy, Literal, Type +from .common import Opaque + +_T_co = TypeVar("_T_co", covariant=True) +_ThisT = TypeVar("_ThisT", bound=Type) +_ThisT_co = TypeVar("_ThisT_co", bound=Type, default=Type, covariant=True) +_TemplateTypeT = TypeVar("_TemplateTypeT", bound=_TemplateType) +_DispatcherT_co = TypeVar( + "_DispatcherT_co", + bound=dispatcher.Dispatcher, + default=dispatcher.Dispatcher, + covariant=True, +) +_TupleT_co = TypeVar( + "_TupleT_co", + bound=tuple[Any, ...], + default=tuple[Any, ...], + covariant=True, +) + +_TemplateType: TypeAlias = type[FunctionTemplate] +_AnyCallable: TypeAlias = _Callable[..., Any] +_BoundFunctionKey: TypeAlias = tuple[Hashable, _ThisT, _Callable[..., object] | None] +_GetPointerFn: TypeAlias = _Callable[[Any], int] + +### + +def argsnkwargs_to_str(args: Iterable[object], kwargs: Mapping[str, object]) -> str: ... + +class BaseFunction(Callable): + templates: Final[tuple[_TemplateType, ...]] + typing_key: Final[Hashable] + + # this free `_TemplateT` is needed because `list` is invariant + def __init__( + self, + template: tuple[_TemplateTypeT, ...] | list[_TemplateTypeT] | _TemplateTypeT, + ) -> None: ... + + # + @property + @override + def key(self) -> tuple[Incomplete, tuple[_TemplateType, ...]]: ... + + # + @override + def get_impl_key(self, sig: Signature) -> Hashable: ... + @override + def get_call_type( + self, + context: Context, + args: tuple[Type, ...], + kws: Mapping[str, Type], + ) -> Signature | None: ... + @override + def get_call_signatures(self) -> tuple[Sequence[Signature], bool]: ... + +class Function(BaseFunction, Opaque): ... + +class BoundFunction(Callable, Opaque, Generic[_ThisT_co]): + template: Final[_TemplateType] + typing_key: Final[Hashable] + this: _ThisT_co + + def __init__(self, template: _TemplateType, this: _ThisT_co) -> None: ... + + # + @override + def unify( + self, + typingctx: Context, + other: _ThisT, + ) -> BoundFunction[_ThisT_co | _ThisT] | None: ... + + # + def copy(self, this: _ThisT) -> BoundFunction[_ThisT]: ... + + # + @property + @override + def key(self) -> _BoundFunctionKey[_ThisT_co]: ... + @override + def get_impl_key(self, sig: Signature) -> Hashable: ... + @override + def get_call_type( + self, + context: Context, + args: tuple[Type, ...], + kws: Mapping[str, Type], + ) -> Signature | None: ... + @override + def get_call_signatures(self) -> tuple[Sequence[Signature], bool]: ... + +class MakeFunctionLiteral(Literal[_T_co], Opaque): ... + +class WeakType(Type, Generic[_T_co]): + @property + @override + def key(self) -> weakref.ref[_T_co]: ... + + # + @override + def __eq__(self, other: Self) -> bool: ... # type: ignore[override] # pyrefly:ignore[bad-override] + @override + def __hash__(self) -> int: ... + +class Dispatcher(WeakType[_DispatcherT_co], Callable, Dummy, Generic[_DispatcherT_co]): + def __init__(self, dispatcher: _DispatcherT_co) -> None: ... + + # + @property + def dispatcher(self) -> _DispatcherT_co: ... + + # + @override + def get_call_type( + self, + context: Context, + args: tuple[Type, ...], + kws: Mapping[str, Type], + ) -> Signature | None: ... + @override + def get_call_signatures(self) -> tuple[Sequence[Signature], bool]: ... + @override + def get_impl_key(self, sig: Signature) -> _AnyCallable: ... + def get_overload(self, sig: Signature) -> _AnyCallable: ... + +class ObjModeDispatcher(Dispatcher[_DispatcherT_co], Generic[_DispatcherT_co]): ... + +class ExternalFunctionPointer(BaseFunction): + sig: Final[Signature] + requires_gil: Final[bool] + get_pointer: Final[_GetPointerFn] + cconv: Final[str | None] + + def __init__( + self, + sig: Signature, + get_pointer: _GetPointerFn, + cconv: str | None = None, + ) -> None: ... + + # + @property + @override + def key(self) -> tuple[Signature, str | None, _GetPointerFn]: ... # type: ignore[override] # pyrefly:ignore[bad-override] + +class ExternalFunction(Function): + symbol: Final[str] + sig: Final[Signature] + + def __init__(self, symbol: str, sig: Signature) -> None: ... + + # + @property + @override + def key(self) -> tuple[str, Signature]: ... # type: ignore[override] # pyrefly:ignore[bad-override] + +class NamedTupleClass(Callable, Opaque, Generic[_TupleT_co]): + instance_class: type[_TupleT_co] + + def __init__(self, instance_class: type[_TupleT_co]) -> None: ... + + # + @property + @override + def key(self) -> type[_TupleT_co]: ... + + # + @override + def get_call_type( + self, + context: Context, + args: tuple[Type, ...], + kws: Mapping[str, Type], + ) -> None: ... + @override + def get_call_signatures(self) -> tuple[tuple[()], bool]: ... + @override + def get_impl_key(self, sig: Signature) -> type[Self]: ... + +class NumberClass(Callable, DTypeSpec, Opaque, Generic[_T_co]): + instance_type: _T_co + + def __init__(self, instance_type: _T_co) -> None: ... + + # + @property + @override + def key(self) -> _T_co: ... + @property + @override + def dtype(self) -> _T_co: ... + + # + @override + def get_call_type( + self, + context: Context, + args: tuple[Type, ...], + kws: Mapping[str, Type], + ) -> None: ... + @override + def get_call_signatures(self) -> tuple[tuple[()], bool]: ... + @override + def get_impl_key(self, sig: Signature) -> type[Self]: ... + +class _RecursiveCallOverloads(NamedTuple): + qualname: str + uid: int + +class RecursiveCall(Opaque, Generic[_DispatcherT_co]): + dispatcher_type: Dispatcher[_DispatcherT_co] + + def __init__(self, dispatcher_type: Dispatcher[_DispatcherT_co]) -> None: ... + @property + @override + def key(self) -> Dispatcher[_DispatcherT_co]: ... + + # + def add_overloads( + self, + args: tuple[Type, ...], + qualname: str, + uid: int, + ) -> None: ... + def get_overloads(self, args: tuple[Type, ...]) -> _RecursiveCallOverloads: ... diff --git a/shared/package-files/32/323cd1f3e4ea7d5f01f80b5509681de168dbf7e34e0cd68991eb2dc710dacd5d/blob b/shared/package-files/32/323cd1f3e4ea7d5f01f80b5509681de168dbf7e34e0cd68991eb2dc710dacd5d/blob new file mode 100644 index 0000000000000000000000000000000000000000..3884d20d4603a6d1d12db498820113181ae687d4 --- /dev/null +++ b/shared/package-files/32/323cd1f3e4ea7d5f01f80b5509681de168dbf7e34e0cd68991eb2dc710dacd5d/blob @@ -0,0 +1,200 @@ +0.00,0.42,0.45,0.24,-0.28,0.68 +0.00,0.62,0.12,0.94,-1.49,-0.53 +1.00,-1.32,-0.69,-0.30,0.50,0.82 +0.00,0.25,-1.27,0.28,2.00,-0.61 +1.00,0.51,0.08,0.21,1.00,-1.36 +1.00,1.88,-0.63,-0.53,-2.08,0.16 +1.00,-0.67,1.09,1.43,0.26,0.73 +0.00,-1.61,-1.07,-1.37,-0.17,0.10 +0.00,1.08,1.04,0.78,-0.62,-2.36 +1.00,-1.32,-0.69,1.24,-1.05,0.29 +0.00,-0.26,1.46,-0.92,1.75,-1.52 +1.00,-0.67,0.63,0.18,1.80,0.70 +0.00,0.12,-0.91,-1.25,-1.49,1.57 +0.00,-1.31,-0.79,0.45,-0.30,-0.98 +1.00,-0.33,1.97,-0.99,-0.23,-1.76 +0.00,1.50,0.95,0.47,-1.14,-0.92 +0.00,1.21,0.22,-0.79,-0.54,0.23 +1.00,-0.12,0.38,0.34,-0.79,-0.66 +1.00,0.32,-0.02,-0.10,1.46,-1.05 +1.00,1.44,-0.47,1.08,0.05,-0.78 +0.00,0.10,-0.57,-0.09,-0.24,-0.19 +0.00,1.30,-0.99,-1.25,-0.36,-0.20 +0.00,-0.48,-0.64,0.56,0.48,1.40 +0.00,0.28,0.39,-2.01,-1.74,-0.47 +1.00,0.51,1.81,0.81,-0.86,0.68 +1.00,-3.04,0.21,-0.67,-0.09,0.56 +1.00,1.44,0.74,0.55,1.14,0.35 +1.00,2.15,-0.07,1.84,0.75,0.03 +1.00,-3.68,1.72,1.68,0.18,-0.23 +0.00,-0.93,0.01,-0.62,0.11,-0.59 +0.00,-0.04,1.09,0.31,0.84,1.33 +0.00,0.69,0.37,-1.40,-0.12,-1.20 +1.00,-0.66,0.48,0.68,-1.03,-1.74 +0.00,0.00,1.83,-0.07,0.35,-0.92 +0.00,1.32,-2.05,1.24,1.00,-0.39 +0.00,-1.17,-1.28,0.31,1.45,1.00 +0.00,-0.64,0.35,-0.86,1.26,-2.51 +1.00,-1.16,-1.45,-0.83,-0.23,1.59 +1.00,1.34,0.57,-0.38,0.14,-0.90 +0.00,-0.01,-0.96,1.03,-2.48,-1.42 +1.00,0.06,0.19,-0.76,-0.15,0.15 +0.00,-1.00,-1.96,-1.18,-0.75,0.74 +0.00,-1.27,0.15,-0.86,-0.20,-0.39 +1.00,-0.90,2.16,1.72,-0.69,-0.68 +1.00,-1.34,1.88,-0.47,-0.28,-1.31 +1.00,-1.13,-0.74,0.09,0.52,0.06 +1.00,1.03,0.17,-1.08,1.79,-0.47 +0.00,-0.16,-0.93,0.45,-1.58,-0.38 +1.00,-0.51,0.02,-0.84,-0.68,1.24 +1.00,0.58,-0.65,0.17,1.20,-0.09 +1.00,0.65,0.42,-0.14,1.14,-0.62 +1.00,0.58,1.51,-0.10,1.55,0.99 +0.00,1.15,-0.47,-0.85,0.63,0.04 +1.00,-1.32,-0.95,0.23,2.30,0.71 +0.00,0.37,-0.04,-1.43,-0.05,-0.10 +1.00,0.50,-0.28,0.69,2.27,1.33 +0.00,-1.05,-2.08,-1.63,0.57,-0.24 +1.00,0.70,0.40,0.35,0.20,-0.11 +1.00,-0.14,-1.21,-0.04,-0.52,0.21 +1.00,-1.38,-2.20,-0.43,0.44,-0.44 +1.00,-0.77,0.23,-0.12,0.11,1.24 +0.00,0.17,-1.04,-1.90,0.26,-0.77 +1.00,1.36,0.67,0.47,0.61,1.16 +1.00,-1.70,1.42,0.77,1.77,1.68 +0.00,-0.91,-0.25,-0.40,-0.24,1.15 +0.00,-1.43,-1.82,-1.24,-1.42,-0.74 +0.00,-0.62,-0.71,-3.27,0.86,0.73 +0.00,-0.66,-0.50,0.34,-0.41,-1.24 +0.00,-0.65,-2.60,0.80,0.64,0.10 +1.00,0.63,-0.29,1.92,0.50,0.51 +0.00,-0.27,0.12,-1.15,0.19,-1.93 +1.00,-1.27,-1.13,-1.23,1.63,1.30 +0.00,-0.68,0.47,-0.27,1.25,-0.29 +0.00,-1.88,-1.73,-0.32,0.67,-0.94 +1.00,0.73,0.62,-1.24,0.16,-0.24 +0.00,-0.54,-1.90,-0.45,1.56,1.27 +1.00,1.28,-0.12,-0.53,1.03,0.91 +0.00,-0.07,-0.11,-2.01,-0.34,-0.61 +1.00,-0.21,-0.02,1.21,-0.16,0.34 +1.00,1.10,-1.87,-0.51,-0.63,0.81 +1.00,2.25,-1.74,-0.88,-0.53,0.53 +1.00,-1.34,0.60,0.03,0.35,0.85 +0.00,-1.04,-0.84,-0.24,-1.17,-1.57 +0.00,1.88,-0.66,0.87,-0.46,0.17 +0.00,-2.24,-0.81,-0.36,1.00,0.12 +0.00,-1.28,0.77,-0.64,-1.20,-0.24 +1.00,1.31,-1.58,0.15,-0.83,0.91 +1.00,0.56,-0.89,-0.01,-0.05,1.59 +0.00,-0.17,-0.18,-0.20,0.87,-0.53 +0.00,0.54,0.58,0.41,1.58,0.77 +0.00,-0.53,-0.24,-0.49,-0.35,-0.04 +1.00,0.79,0.54,-0.27,0.28,-0.26 +0.00,-1.20,-1.04,-0.69,-1.32,0.76 +1.00,0.21,0.06,-0.37,0.87,-0.75 +0.00,0.70,1.24,0.75,-0.17,-0.78 +1.00,0.20,1.47,-0.70,-2.32,-0.76 +1.00,-0.20,-1.14,1.11,-2.40,-0.38 +0.00,0.43,0.35,0.43,-1.37,-0.40 +0.00,-0.27,0.64,0.54,-0.65,-0.48 +1.00,1.07,0.77,-0.44,-0.05,-0.41 +1.00,-0.51,-1.70,-0.46,-1.45,0.54 +0.00,-1.23,-0.34,-1.83,-1.21,-1.57 +0.00,0.11,-0.68,0.65,0.25,0.14 +0.00,-0.04,-0.81,1.11,0.41,0.47 +1.00,-0.90,0.57,-0.92,0.51,-0.58 +1.00,1.34,-1.06,0.33,-0.50,-0.22 +0.00,-0.91,-1.85,0.02,-1.67,-0.73 +0.00,-1.43,-0.42,1.75,-0.49,0.08 +1.00,0.75,0.14,-0.55,0.03,-0.82 +0.00,2.21,-0.48,-2.20,-1.09,1.67 +1.00,0.71,-1.50,-0.71,0.05,2.14 +1.00,-2.32,0.26,-0.69,-1.01,0.27 +1.00,-0.38,0.59,1.06,0.74,-0.03 +1.00,-0.99,-0.17,-0.08,-0.76,-0.11 +0.00,1.29,-1.86,0.33,0.16,-0.06 +0.00,0.58,-1.56,-0.97,0.42,1.93 +0.00,-0.96,-0.20,-1.60,-0.47,0.53 +0.00,0.82,0.12,-0.56,1.02,0.85 +0.00,-1.38,-0.13,0.94,0.40,0.70 +0.00,-0.58,-1.20,-1.64,0.03,-0.85 +0.00,-0.52,-0.76,0.44,1.26,0.55 +1.00,-1.28,0.61,-0.35,-1.13,-0.12 +1.00,-1.20,2.10,0.62,-1.67,-0.33 +0.00,-0.90,-0.69,-0.98,-1.63,0.84 +1.00,1.75,2.48,-0.04,0.00,0.25 +0.00,-0.48,1.86,-2.13,0.87,-0.20 +1.00,0.22,0.66,0.59,0.79,2.09 +1.00,0.52,1.85,-0.32,-0.78,-0.77 +0.00,1.00,-0.59,-1.02,1.88,0.60 +1.00,-1.33,0.05,-0.07,0.96,1.66 +0.00,-0.13,0.88,0.25,-0.20,1.22 +1.00,-0.55,-0.62,-0.81,0.16,0.75 +1.00,-0.60,1.66,-0.90,1.04,1.07 +1.00,2.19,0.83,0.03,-2.03,0.19 +1.00,1.27,-2.35,1.26,-0.56,-0.79 +1.00,1.20,-0.71,-0.37,-0.30,2.33 +0.00,0.17,-1.56,1.28,0.16,-0.06 +1.00,0.04,-0.52,1.09,-1.00,0.46 +1.00,0.75,-0.58,0.15,-1.85,-0.36 +1.00,0.68,1.69,1.54,0.60,0.47 +1.00,-0.38,0.66,1.25,0.18,0.59 +1.00,-0.28,1.11,1.86,0.37,-0.53 +0.00,1.25,-1.66,1.22,-0.69,-0.47 +0.00,-1.14,-0.42,0.88,0.64,0.41 +0.00,0.39,0.91,0.15,0.30,0.34 +0.00,0.96,-0.68,1.63,-0.30,0.01 +0.00,-0.39,-1.36,0.71,-1.62,0.65 +0.00,0.04,-0.98,0.63,0.61,0.33 +0.00,-0.27,1.83,-1.77,0.91,0.79 +0.00,-0.80,-0.01,-0.81,-0.73,0.51 +0.00,-0.86,-1.16,-0.98,-0.54,1.07 +1.00,0.12,-0.35,0.97,1.27,-0.65 +1.00,-0.50,-1.27,0.53,2.28,1.71 +1.00,0.22,-0.10,0.28,0.10,1.48 +0.00,-0.10,-0.56,0.34,-0.25,0.85 +0.00,0.05,-0.97,-2.22,0.72,-0.69 +0.00,-0.20,0.19,-1.82,1.34,-1.21 +1.00,-0.36,0.23,-0.33,0.13,0.21 +1.00,-0.39,-1.46,-0.82,0.27,0.57 +1.00,-0.12,-1.23,-1.97,0.81,-0.08 +0.00,0.54,1.61,-0.27,-0.97,-0.70 +0.00,-0.20,-0.82,0.61,-2.51,-0.53 +1.00,-0.23,0.68,1.84,2.21,0.30 +1.00,-0.80,0.63,-0.12,-1.27,-0.17 +1.00,0.81,-0.14,1.02,0.20,-0.16 +1.00,1.52,-1.64,-0.31,0.84,-0.41 +1.00,-0.14,0.63,0.39,-0.01,-0.17 +0.00,0.62,1.66,0.60,-1.59,-1.81 +0.00,-1.14,0.27,0.16,-0.94,-0.11 +1.00,-1.13,-0.45,1.02,-1.19,-0.45 +0.00,0.38,0.04,-0.26,0.71,0.42 +1.00,1.35,0.23,-1.55,-1.19,-2.59 +1.00,0.87,0.57,-0.51,-0.70,-0.29 +0.00,-0.60,0.06,-0.34,0.43,-0.34 +0.00,0.80,-0.07,1.16,-0.54,-2.22 +0.00,0.70,-1.24,-1.00,-1.43,-0.92 +1.00,-1.11,-0.92,-0.51,-0.93,-0.18 +1.00,-0.29,-0.69,0.41,0.84,1.10 +1.00,0.45,0.92,-0.83,1.22,0.64 +0.00,-0.83,-0.74,1.30,-0.79,0.96 +1.00,-0.41,0.24,-0.12,-0.96,-0.51 +0.00,0.52,-1.95,-0.44,1.06,-0.69 +1.00,-0.54,1.29,1.56,1.16,-1.01 +1.00,-0.39,-0.41,0.25,-0.22,0.45 +0.00,-0.97,0.90,-0.17,0.01,0.03 +1.00,-2.52,1.53,-3.83,2.25,-0.13 +1.00,0.42,-0.44,3.15,-1.38,-1.99 +1.00,1.38,-0.39,-0.54,-0.37,1.21 +1.00,-1.21,1.33,0.99,-1.83,0.80 +0.00,-0.39,-0.50,0.68,-0.39,-0.13 +0.00,-1.36,-0.00,0.35,-1.09,0.60 +0.00,-0.22,-0.02,0.92,0.35,0.07 +1.00,-0.58,-0.34,-1.03,-1.53,0.81 +1.00,-0.07,-1.50,-0.04,0.86,0.78 +0.00,-0.89,-1.18,-0.21,-1.15,0.40 +0.00,0.31,-0.97,-0.09,0.67,0.33 +0.00,1.15,0.43,-0.43,-0.54,-1.09 +1.00,-0.78,0.44,0.44,0.54,1.40 +1.00,-1.08,-0.68,0.26,-0.26,-2.14 +0.00,0.27,2.21,-0.58,-0.37,0.84 diff --git a/shared/package-files/32/323e6f214cd09790edb0f7b788ccd2eeb47ef3c53d1ca5b672c42a51d6b824d3/blob b/shared/package-files/32/323e6f214cd09790edb0f7b788ccd2eeb47ef3c53d1ca5b672c42a51d6b824d3/blob new file mode 100644 index 0000000000000000000000000000000000000000..7eba33c1c5b13cbd9b7566f450d524a45cf8b65e Binary files /dev/null and b/shared/package-files/32/323e6f214cd09790edb0f7b788ccd2eeb47ef3c53d1ca5b672c42a51d6b824d3/blob differ diff --git a/shared/package-files/32/323ebfb193d521090740fab408b3e04efc55b56893194b4f2b1408d276440086/blob b/shared/package-files/32/323ebfb193d521090740fab408b3e04efc55b56893194b4f2b1408d276440086/blob new file mode 100644 index 0000000000000000000000000000000000000000..b10f365d03b774d0904a0defab63a07f693f1090 --- /dev/null +++ b/shared/package-files/32/323ebfb193d521090740fab408b3e04efc55b56893194b4f2b1408d276440086/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor arctan2(const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & arctan2_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & arctan2_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out); +TORCH_API at::Tensor & arctan2_(at::Tensor & self, const at::Tensor & other); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/32/323fdf8d2d1c55173b1dff999637c7c7beed99fd94d2f0820ef9cf262df3d335/blob b/shared/package-files/32/323fdf8d2d1c55173b1dff999637c7c7beed99fd94d2f0820ef9cf262df3d335/blob new file mode 100644 index 0000000000000000000000000000000000000000..03a9647cad833479e4fd2ac75987aca21f1e0633 --- /dev/null +++ b/shared/package-files/32/323fdf8d2d1c55173b1dff999637c7c7beed99fd94d2f0820ef9cf262df3d335/blob @@ -0,0 +1,226 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +namespace torch::autograd { + +using edge_list = std::vector; +struct ReadyQueue; + +static constexpr int NO_DEVICE = -2; +static constexpr int CPU_DEVICE = -1; + +// GraphTask holds metadata needed for a single execution of backward() +struct GraphTask : std::enable_shared_from_this { + std::atomic outstanding_tasks_{0}; + // Indicates if an error occurred while executing any task. When this is + // true, it signals all threads to stop executing. + std::atomic_bool has_error_{false}; + std::atomic_bool future_completed_{false}; + // It is safe to read keep_graph_ without synchronization + bool keep_graph_; + + // To protect reads/writes to not_ready_, dependencies_, captured_vars_, + // has_error_, future_result_, cpu_ready_queue_, and leaf_streams. + std::mutex mutex_; + std::unordered_map not_ready_; + std::unordered_map dependencies_; + + // Records the nodes that are in the graph + std::unordered_set nodes_in_graph_; + c10::SmallVector graph_roots_; + // Note [Exec info] + // Exec info is created for each GraphTask, which allows filtering paths on + // the graph that are not needed. It has a bit complicated semantics. If it's + // empty, it means the task is run in a "default" mode, which means that all + // next_edges we encounter should get executed. If it's not empty, only + // functions that have an entry and this entry has needed == True should be + // executed. exec_info is only empty when the graph is executed via + // .backward() and the inputs parameter is not passed. Otherwise, when + // executed through .grad(), or when inputs arg is specified for .backward(), + // exec_info will be non-empty. + // + struct ExecInfo { + struct Capture { + Capture(const Capture&) = delete; + Capture(Capture&&) = default; + + Capture(int input_idx, int output_idx) + : input_idx_(input_idx), output_idx_(output_idx) {} + int input_idx_; // within Node inputs + int output_idx_; // within the output vector of a GraphTask + + // This hook will be executed after a grad is captured. The captured + // grad will be replaced by the return value of the hook. + struct GradCaptureHook { + virtual ~GradCaptureHook() = default; + virtual at::Tensor operator()(const at::Tensor& grad) = 0; + }; + // NOTE [Deprecated capture hooks] + // + // The current status of capture hooks is that we continue to support + // the single usage of it by distributed in the dist_engine. If anyone + // else needs to use it for other purposes, they should file an issue. + // + // Capture hooks were originally created because there did not exist + // any way to register pre/post hooks to grad_fn in a way such that it + // would still be executed even if that is the grad_fn of a Tensor + // passed as input= of .grad. As far as I know, only dist_engine uses + // this hook. + // + // However, there are other alternatives today like tensor hooks that can + // replace the usage that originally motivated its creation. Also, + // Captures hooks are an outlier in terms of the types of hook that + // autograd offers in how it is registered and behaves, e.g. it is a hook + // registered not to the graph, but to a particular graph_task! This makes + // it a burden to maintain. + // + // It would be very nice to clean up/do a migration from pre/post + // hooks used in distributed to use tensor hooks, but for now we just + // mark this method as deprecated to prevent additional usage. + // + // If you still think you really need to capture hooks, please file an + // issue (and tag autograd). + const std::vector>& + DO_NOT_USE_DEPRECATED_get_capture_hooks() const { + return hooks_; + } + // See NOTE [deprecated capture hooks] + void DO_NOT_USE_DEPRECATED_register_capture_hook( + std::unique_ptr hook) { + hooks_.push_back(std::move(hook)); + } + + private: + // The hooks will be called one by one in the order as they were added. + // The input grad of a hook will be the output of its preceding hook. The + // first hook will take the captured grad as the input. The output of the + // last hook will replace the captured grad. + std::vector> hooks_; + }; + + bool should_execute() const { + return needed_ || captures_; + } + + bool needed_ = false; + std::unique_ptr> captures_; + }; + // exec_info_ is safe to read without synchronization + std::unordered_map exec_info_; + // Captures variables are grads captured that we return to the user. After + // execution of the GraphTask is completed, the captured_vars_ are moved + // out of the GraphTask and are no longer valid. + std::vector captured_vars_; + + // Note: this field is not ready to be used until the proper + // `thread_locals_.set_grad_mode()` call in the constructor. + at::ThreadLocalState thread_locals_ = at::ThreadLocalState(); + + std::unordered_set leaf_streams; + + // Per-device current streams of the execute() that called this GraphTask. + // These will be synced with leaf_streams in exec_post_processing. + std::vector> caller_current_streams_; + + // Collects caller_current_streams_ for the accelerator device. + void stash_current_streams(); + + void init_to_execute( + Node& graph_root, + const edge_list& outputs, + bool accumulate_grad, + uint64_t min_topo_nr); + + // The value of worker_device in the thread that created this task. + // See Note [Reentrant backwards] + // Safe to read owner_ and reentrant_depth_ without synchronization + int owner_; + // The number of parent graph tasks for this graph task + // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members) + const int reentrant_depth_; + + bool can_checkpoint() const { + return exec_info_.empty(); + } + + // check if the GraphTask is completed or not + bool completed(); + // mark the graph task as completed and trigger post processing + void mark_as_completed_and_run_post_processing(); + + // Set an appropriate exception on this graph_task which was encountered while + // running the provided function. + void set_exception(std::exception_ptr eptr, const std::shared_ptr& fn); + + // Set an appropriate exception on this graph_task which was encountered while + // running the provided function. But doesn't signal completion on + // 'future_result_' right away. The user needs to explicitly mark + // 'future_result_' completed with an appropriate exception. + void set_exception_without_signal(const std::shared_ptr& fn); + + // Whether or not to stop execution for this GraphTask when an error is + // encountered. When set to true, this would cause Engine::execute() to throw + // an exception as soon as the autograd engine receives an exception. + bool exit_on_error_; + + // CPU threads are dedicated to processing CPU work for the backward they + // invoked. So any given graph task maintains its own cpu_ready_queue_ where + // you should send work for it to be done. We memoize the cpu_ready_queue_ per + // GraphTask so that we know which ready queue we should push to if we are on + // device thread (i.e. GPU) and but next NodeTask should be run on CPU. + std::shared_ptr cpu_ready_queue_; + + // Future representing the completion of the graph task. Notified when all + // tasks are done. + c10::intrusive_ptr future_result_; + + // Final callbacks installed during execution of this GraphTask + std::vector> final_callbacks_; + // To protect reads and writes to final_callbacks_. Intentionally no reusing + // mutex_ as the two are protecting different data structures. + std::mutex final_callbacks_lock_; + + utils::DelayWarningHandler warning_handler_; + + uint64_t id_; + + GraphTask( + bool keep_graph, + bool grad_mode, + int reentrant_depth, + std::shared_ptr cpu_ready_queue, + c10::SmallVector graph_roots, + bool exit_on_error = false); + + private: + // run GraphTask post processing + void exec_post_processing(); +}; + +// The guard that sets and restores current_graph_task. +class GraphTaskGuard { + public: + explicit GraphTaskGuard(std::shared_ptr graph_task); + ~GraphTaskGuard(); + + void restore_current_graph_task(); + + private: + std::shared_ptr last_graph_task_; +}; + +TORCH_API const std::unordered_map* +get_current_graph_task_exec_info(); +TORCH_API const std::unordered_set* +get_current_graph_task_nodes_in_graph(); +TORCH_API bool get_current_graph_task_keep_graph(); +TORCH_API std::vector get_current_graph_task_execution_order(); +TORCH_API int get_current_graph_task_id(); +void add_node_to_current_graph_task_exec_info(Node* fn); + +} // namespace torch::autograd diff --git a/shared/package-files/32/32409f05d42f6c2b622e00c5688029d23725c23da6221c202f727402cbeadf54/blob b/shared/package-files/32/32409f05d42f6c2b622e00c5688029d23725c23da6221c202f727402cbeadf54/blob new file mode 100644 index 0000000000000000000000000000000000000000..971cce6c55a84e08a182e3b25bf9a7e362937e01 --- /dev/null +++ b/shared/package-files/32/32409f05d42f6c2b622e00c5688029d23725c23da6221c202f727402cbeadf54/blob @@ -0,0 +1,607 @@ +import pickle +import tempfile +import shutil +import os + +import numpy as np +from numpy import pi +from numpy.testing import (assert_array_almost_equal, + assert_equal, assert_warns, + assert_allclose) +import pytest +from pytest import raises as assert_raises + +from scipy.odr import (Data, Model, ODR, RealData, OdrStop, OdrWarning, + multilinear, exponential, unilinear, quadratic, + polynomial) + + +class TestODR: + + # Bad Data for 'x' + + def test_bad_data(self): + assert_raises(ValueError, Data, 2, 1) + assert_raises(ValueError, RealData, 2, 1) + + # Empty Data for 'x' + def empty_data_func(self, B, x): + return B[0]*x + B[1] + + @pytest.mark.thread_unsafe + def test_empty_data(self): + beta0 = [0.02, 0.0] + linear = Model(self.empty_data_func) + + empty_dat = Data([], []) + assert_warns(OdrWarning, ODR, + empty_dat, linear, beta0=beta0) + + empty_dat = RealData([], []) + assert_warns(OdrWarning, ODR, + empty_dat, linear, beta0=beta0) + + # Explicit Example + + def explicit_fcn(self, B, x): + ret = B[0] + B[1] * np.power(np.exp(B[2]*x) - 1.0, 2) + return ret + + def explicit_fjd(self, B, x): + eBx = np.exp(B[2]*x) + ret = B[1] * 2.0 * (eBx-1.0) * B[2] * eBx + return ret + + def explicit_fjb(self, B, x): + eBx = np.exp(B[2]*x) + res = np.vstack([np.ones(x.shape[-1]), + np.power(eBx-1.0, 2), + B[1]*2.0*(eBx-1.0)*eBx*x]) + return res + + def test_explicit(self): + explicit_mod = Model( + self.explicit_fcn, + fjacb=self.explicit_fjb, + fjacd=self.explicit_fjd, + meta=dict(name='Sample Explicit Model', + ref='ODRPACK UG, pg. 39'), + ) + explicit_dat = Data([0.,0.,5.,7.,7.5,10.,16.,26.,30.,34.,34.5,100.], + [1265.,1263.6,1258.,1254.,1253.,1249.8,1237.,1218.,1220.6, + 1213.8,1215.5,1212.]) + explicit_odr = ODR(explicit_dat, explicit_mod, beta0=[1500.0, -50.0, -0.1], + ifixx=[0,0,1,1,1,1,1,1,1,1,1,0]) + explicit_odr.set_job(deriv=2) + explicit_odr.set_iprint(init=0, iter=0, final=0) + + out = explicit_odr.run() + assert_array_almost_equal( + out.beta, + np.array([1.2646548050648876e+03, -5.4018409956678255e+01, + -8.7849712165253724e-02]), + ) + assert_array_almost_equal( + out.sd_beta, + np.array([1.0349270280543437, 1.583997785262061, 0.0063321988657267]), + ) + assert_array_almost_equal( + out.cov_beta, + np.array([[4.4949592379003039e-01, -3.7421976890364739e-01, + -8.0978217468468912e-04], + [-3.7421976890364739e-01, 1.0529686462751804e+00, + -1.9453521827942002e-03], + [-8.0978217468468912e-04, -1.9453521827942002e-03, + 1.6827336938454476e-05]]), + ) + + # Implicit Example + + def implicit_fcn(self, B, x): + return (B[2]*np.power(x[0]-B[0], 2) + + 2.0*B[3]*(x[0]-B[0])*(x[1]-B[1]) + + B[4]*np.power(x[1]-B[1], 2) - 1.0) + + def test_implicit(self): + implicit_mod = Model( + self.implicit_fcn, + implicit=1, + meta=dict(name='Sample Implicit Model', + ref='ODRPACK UG, pg. 49'), + ) + implicit_dat = Data([ + [0.5,1.2,1.6,1.86,2.12,2.36,2.44,2.36,2.06,1.74,1.34,0.9,-0.28, + -0.78,-1.36,-1.9,-2.5,-2.88,-3.18,-3.44], + [-0.12,-0.6,-1.,-1.4,-2.54,-3.36,-4.,-4.75,-5.25,-5.64,-5.97,-6.32, + -6.44,-6.44,-6.41,-6.25,-5.88,-5.5,-5.24,-4.86]], + 1, + ) + implicit_odr = ODR(implicit_dat, implicit_mod, + beta0=[-1.0, -3.0, 0.09, 0.02, 0.08]) + + out = implicit_odr.run() + assert_array_almost_equal( + out.beta, + np.array([-0.9993809167281279, -2.9310484652026476, 0.0875730502693354, + 0.0162299708984738, 0.0797537982976416]), + ) + assert_array_almost_equal( + out.sd_beta, + np.array([0.1113840353364371, 0.1097673310686467, 0.0041060738314314, + 0.0027500347539902, 0.0034962501532468]), + ) + assert_allclose( + out.cov_beta, + np.array([[2.1089274602333052e+00, -1.9437686411979040e+00, + 7.0263550868344446e-02, -4.7175267373474862e-02, + 5.2515575927380355e-02], + [-1.9437686411979040e+00, 2.0481509222414456e+00, + -6.1600515853057307e-02, 4.6268827806232933e-02, + -5.8822307501391467e-02], + [7.0263550868344446e-02, -6.1600515853057307e-02, + 2.8659542561579308e-03, -1.4628662260014491e-03, + 1.4528860663055824e-03], + [-4.7175267373474862e-02, 4.6268827806232933e-02, + -1.4628662260014491e-03, 1.2855592885514335e-03, + -1.2692942951415293e-03], + [5.2515575927380355e-02, -5.8822307501391467e-02, + 1.4528860663055824e-03, -1.2692942951415293e-03, + 2.0778813389755596e-03]]), + rtol=1e-6, atol=2e-6, + ) + + # Multi-variable Example + + def multi_fcn(self, B, x): + if (x < 0.0).any(): + raise OdrStop + theta = pi*B[3]/2. + ctheta = np.cos(theta) + stheta = np.sin(theta) + omega = np.power(2.*pi*x*np.exp(-B[2]), B[3]) + phi = np.arctan2((omega*stheta), (1.0 + omega*ctheta)) + r = (B[0] - B[1]) * np.power(np.sqrt(np.power(1.0 + omega*ctheta, 2) + + np.power(omega*stheta, 2)), -B[4]) + ret = np.vstack([B[1] + r*np.cos(B[4]*phi), + r*np.sin(B[4]*phi)]) + return ret + + def test_multi(self): + multi_mod = Model( + self.multi_fcn, + meta=dict(name='Sample Multi-Response Model', + ref='ODRPACK UG, pg. 56'), + ) + + multi_x = np.array([30.0, 50.0, 70.0, 100.0, 150.0, 200.0, 300.0, 500.0, + 700.0, 1000.0, 1500.0, 2000.0, 3000.0, 5000.0, 7000.0, 10000.0, + 15000.0, 20000.0, 30000.0, 50000.0, 70000.0, 100000.0, 150000.0]) + multi_y = np.array([ + [4.22, 4.167, 4.132, 4.038, 4.019, 3.956, 3.884, 3.784, 3.713, + 3.633, 3.54, 3.433, 3.358, 3.258, 3.193, 3.128, 3.059, 2.984, + 2.934, 2.876, 2.838, 2.798, 2.759], + [0.136, 0.167, 0.188, 0.212, 0.236, 0.257, 0.276, 0.297, 0.309, + 0.311, 0.314, 0.311, 0.305, 0.289, 0.277, 0.255, 0.24, 0.218, + 0.202, 0.182, 0.168, 0.153, 0.139], + ]) + n = len(multi_x) + multi_we = np.zeros((2, 2, n), dtype=float) + multi_ifixx = np.ones(n, dtype=int) + multi_delta = np.zeros(n, dtype=float) + + multi_we[0,0,:] = 559.6 + multi_we[1,0,:] = multi_we[0,1,:] = -1634.0 + multi_we[1,1,:] = 8397.0 + + for i in range(n): + if multi_x[i] < 100.0: + multi_ifixx[i] = 0 + elif multi_x[i] <= 150.0: + pass # defaults are fine + elif multi_x[i] <= 1000.0: + multi_delta[i] = 25.0 + elif multi_x[i] <= 10000.0: + multi_delta[i] = 560.0 + elif multi_x[i] <= 100000.0: + multi_delta[i] = 9500.0 + else: + multi_delta[i] = 144000.0 + if multi_x[i] == 100.0 or multi_x[i] == 150.0: + multi_we[:,:,i] = 0.0 + + multi_dat = Data(multi_x, multi_y, wd=1e-4/np.power(multi_x, 2), + we=multi_we) + multi_odr = ODR(multi_dat, multi_mod, beta0=[4.,2.,7.,.4,.5], + delta0=multi_delta, ifixx=multi_ifixx) + multi_odr.set_job(deriv=1, del_init=1) + + out = multi_odr.run() + assert_array_almost_equal( + out.beta, + np.array([4.3799880305938963, 2.4333057577497703, 8.0028845899503978, + 0.5101147161764654, 0.5173902330489161]), + ) + assert_array_almost_equal( + out.sd_beta, + np.array([0.0130625231081944, 0.0130499785273277, 0.1167085962217757, + 0.0132642749596149, 0.0288529201353984]), + ) + assert_array_almost_equal( + out.cov_beta, + np.array([[0.0064918418231375, 0.0036159705923791, 0.0438637051470406, + -0.0058700836512467, 0.011281212888768], + [0.0036159705923791, 0.0064793789429006, 0.0517610978353126, + -0.0051181304940204, 0.0130726943624117], + [0.0438637051470406, 0.0517610978353126, 0.5182263323095322, + -0.0563083340093696, 0.1269490939468611], + [-0.0058700836512467, -0.0051181304940204, -0.0563083340093696, + 0.0066939246261263, -0.0140184391377962], + [0.011281212888768, 0.0130726943624117, 0.1269490939468611, + -0.0140184391377962, 0.0316733013820852]]), + ) + + # Pearson's Data + # K. Pearson, Philosophical Magazine, 2, 559 (1901) + + def pearson_fcn(self, B, x): + return B[0] + B[1]*x + + def test_pearson(self): + p_x = np.array([0.,.9,1.8,2.6,3.3,4.4,5.2,6.1,6.5,7.4]) + p_y = np.array([5.9,5.4,4.4,4.6,3.5,3.7,2.8,2.8,2.4,1.5]) + p_sx = np.array([.03,.03,.04,.035,.07,.11,.13,.22,.74,1.]) + p_sy = np.array([1.,.74,.5,.35,.22,.22,.12,.12,.1,.04]) + + p_dat = RealData(p_x, p_y, sx=p_sx, sy=p_sy) + + # Reverse the data to test invariance of results + pr_dat = RealData(p_y, p_x, sx=p_sy, sy=p_sx) + + p_mod = Model(self.pearson_fcn, meta=dict(name='Uni-linear Fit')) + + p_odr = ODR(p_dat, p_mod, beta0=[1.,1.]) + pr_odr = ODR(pr_dat, p_mod, beta0=[1.,1.]) + + out = p_odr.run() + assert_array_almost_equal( + out.beta, + np.array([5.4767400299231674, -0.4796082367610305]), + ) + assert_array_almost_equal( + out.sd_beta, + np.array([0.3590121690702467, 0.0706291186037444]), + ) + assert_array_almost_equal( + out.cov_beta, + np.array([[0.0854275622946333, -0.0161807025443155], + [-0.0161807025443155, 0.003306337993922]]), + ) + + rout = pr_odr.run() + assert_array_almost_equal( + rout.beta, + np.array([11.4192022410781231, -2.0850374506165474]), + ) + assert_array_almost_equal( + rout.sd_beta, + np.array([0.9820231665657161, 0.3070515616198911]), + ) + assert_array_almost_equal( + rout.cov_beta, + np.array([[0.6391799462548782, -0.1955657291119177], + [-0.1955657291119177, 0.0624888159223392]]), + ) + + # Lorentz Peak + # The data is taken from one of the undergraduate physics labs I performed. + + def lorentz(self, beta, x): + return (beta[0]*beta[1]*beta[2] / np.sqrt(np.power(x*x - + beta[2]*beta[2], 2.0) + np.power(beta[1]*x, 2.0))) + + def test_lorentz(self): + l_sy = np.array([.29]*18) + l_sx = np.array([.000972971,.000948268,.000707632,.000706679, + .000706074, .000703918,.000698955,.000456856, + .000455207,.000662717,.000654619,.000652694, + .000000859202,.00106589,.00106378,.00125483, .00140818,.00241839]) + + l_dat = RealData( + [3.9094, 3.85945, 3.84976, 3.84716, 3.84551, 3.83964, 3.82608, + 3.78847, 3.78163, 3.72558, 3.70274, 3.6973, 3.67373, 3.65982, + 3.6562, 3.62498, 3.55525, 3.41886], + [652, 910.5, 984, 1000, 1007.5, 1053, 1160.5, 1409.5, 1430, 1122, + 957.5, 920, 777.5, 709.5, 698, 578.5, 418.5, 275.5], + sx=l_sx, + sy=l_sy, + ) + l_mod = Model(self.lorentz, meta=dict(name='Lorentz Peak')) + l_odr = ODR(l_dat, l_mod, beta0=(1000., .1, 3.8)) + + out = l_odr.run() + assert_array_almost_equal( + out.beta, + np.array([1.4306780846149925e+03, 1.3390509034538309e-01, + 3.7798193600109009e+00]), + ) + assert_array_almost_equal( + out.sd_beta, + np.array([7.3621186811330963e-01, 3.5068899941471650e-04, + 2.4451209281408992e-04]), + ) + assert_array_almost_equal( + out.cov_beta, + np.array([[2.4714409064597873e-01, -6.9067261911110836e-05, + -3.1236953270424990e-05], + [-6.9067261911110836e-05, 5.6077531517333009e-08, + 3.6133261832722601e-08], + [-3.1236953270424990e-05, 3.6133261832722601e-08, + 2.7261220025171730e-08]]), + ) + + def test_ticket_1253(self): + def linear(c, x): + return c[0]*x+c[1] + + c = [2.0, 3.0] + x = np.linspace(0, 10) + y = linear(c, x) + + model = Model(linear) + data = Data(x, y, wd=1.0, we=1.0) + job = ODR(data, model, beta0=[1.0, 1.0]) + result = job.run() + assert_equal(result.info, 2) + + # Verify fix for gh-9140 + + def test_ifixx(self): + x1 = [-2.01, -0.99, -0.001, 1.02, 1.98] + x2 = [3.98, 1.01, 0.001, 0.998, 4.01] + fix = np.vstack((np.zeros_like(x1, dtype=int), np.ones_like(x2, dtype=int))) + data = Data(np.vstack((x1, x2)), y=1, fix=fix) + model = Model(lambda beta, x: x[1, :] - beta[0] * x[0, :]**2., implicit=True) + + odr1 = ODR(data, model, beta0=np.array([1.])) + sol1 = odr1.run() + odr2 = ODR(data, model, beta0=np.array([1.]), ifixx=fix) + sol2 = odr2.run() + assert_equal(sol1.beta, sol2.beta) + + # verify bugfix for #11800 in #11802 + def test_ticket_11800(self): + # parameters + beta_true = np.array([1.0, 2.3, 1.1, -1.0, 1.3, 0.5]) + nr_measurements = 10 + + std_dev_x = 0.01 + x_error = np.array([[0.00063445, 0.00515731, 0.00162719, 0.01022866, + -0.01624845, 0.00482652, 0.00275988, -0.00714734, -0.00929201, -0.00687301], + [-0.00831623, -0.00821211, -0.00203459, 0.00938266, -0.00701829, + 0.0032169, 0.00259194, -0.00581017, -0.0030283, 0.01014164]]) + + std_dev_y = 0.05 + y_error = np.array([[0.05275304, 0.04519563, -0.07524086, 0.03575642, + 0.04745194, 0.03806645, 0.07061601, -0.00753604, -0.02592543, -0.02394929], + [0.03632366, 0.06642266, 0.08373122, 0.03988822, -0.0092536, + -0.03750469, -0.03198903, 0.01642066, 0.01293648, -0.05627085]]) + + beta_solution = np.array([ + 2.62920235756665876536e+00, -1.26608484996299608838e+02, + 1.29703572775403074502e+02, -1.88560985401185465804e+00, + 7.83834160771274923718e+01, -7.64124076838087091801e+01]) + + # model's function and Jacobians + def func(beta, x): + y0 = beta[0] + beta[1] * x[0, :] + beta[2] * x[1, :] + y1 = beta[3] + beta[4] * x[0, :] + beta[5] * x[1, :] + + return np.vstack((y0, y1)) + + def df_dbeta_odr(beta, x): + nr_meas = np.shape(x)[1] + zeros = np.zeros(nr_meas) + ones = np.ones(nr_meas) + + dy0 = np.array([ones, x[0, :], x[1, :], zeros, zeros, zeros]) + dy1 = np.array([zeros, zeros, zeros, ones, x[0, :], x[1, :]]) + + return np.stack((dy0, dy1)) + + def df_dx_odr(beta, x): + nr_meas = np.shape(x)[1] + ones = np.ones(nr_meas) + + dy0 = np.array([beta[1] * ones, beta[2] * ones]) + dy1 = np.array([beta[4] * ones, beta[5] * ones]) + return np.stack((dy0, dy1)) + + # do measurements with errors in independent and dependent variables + x0_true = np.linspace(1, 10, nr_measurements) + x1_true = np.linspace(1, 10, nr_measurements) + x_true = np.array([x0_true, x1_true]) + + y_true = func(beta_true, x_true) + + x_meas = x_true + x_error + y_meas = y_true + y_error + + # estimate model's parameters + model_f = Model(func, fjacb=df_dbeta_odr, fjacd=df_dx_odr) + + data = RealData(x_meas, y_meas, sx=std_dev_x, sy=std_dev_y) + + odr_obj = ODR(data, model_f, beta0=0.9 * beta_true, maxit=100) + #odr_obj.set_iprint(init=2, iter=0, iter_step=1, final=1) + odr_obj.set_job(deriv=3) + + odr_out = odr_obj.run() + + # check results + assert_equal(odr_out.info, 1) + assert_array_almost_equal(odr_out.beta, beta_solution) + + def test_multilinear_model(self): + x = np.linspace(0.0, 5.0) + y = 10.0 + 5.0 * x + data = Data(x, y) + odr_obj = ODR(data, multilinear) + output = odr_obj.run() + assert_array_almost_equal(output.beta, [10.0, 5.0]) + + def test_exponential_model(self): + x = np.linspace(0.0, 5.0) + y = -10.0 + np.exp(0.5*x) + data = Data(x, y) + odr_obj = ODR(data, exponential) + output = odr_obj.run() + assert_array_almost_equal(output.beta, [-10.0, 0.5]) + + def test_polynomial_model(self): + x = np.linspace(0.0, 5.0) + y = 1.0 + 2.0 * x + 3.0 * x ** 2 + 4.0 * x ** 3 + poly_model = polynomial(3) + data = Data(x, y) + odr_obj = ODR(data, poly_model) + output = odr_obj.run() + assert_array_almost_equal(output.beta, [1.0, 2.0, 3.0, 4.0]) + + def test_unilinear_model(self): + x = np.linspace(0.0, 5.0) + y = 1.0 * x + 2.0 + data = Data(x, y) + odr_obj = ODR(data, unilinear) + output = odr_obj.run() + assert_array_almost_equal(output.beta, [1.0, 2.0]) + + def test_quadratic_model(self): + x = np.linspace(0.0, 5.0) + y = 1.0 * x ** 2 + 2.0 * x + 3.0 + data = Data(x, y) + odr_obj = ODR(data, quadratic) + output = odr_obj.run() + assert_array_almost_equal(output.beta, [1.0, 2.0, 3.0]) + + def test_work_ind(self): + + def func(par, x): + b0, b1 = par + return b0 + b1 * x + + # generate some data + n_data = 4 + x = np.arange(n_data) + y = np.where(x % 2, x + 0.1, x - 0.1) + x_err = np.full(n_data, 0.1) + y_err = np.full(n_data, 0.1) + + # do the fitting + linear_model = Model(func) + real_data = RealData(x, y, sx=x_err, sy=y_err) + odr_obj = ODR(real_data, linear_model, beta0=[0.4, 0.4]) + odr_obj.set_job(fit_type=0) + out = odr_obj.run() + + sd_ind = out.work_ind['sd'] + assert_array_almost_equal(out.sd_beta, + out.work[sd_ind:sd_ind + len(out.sd_beta)]) + + @pytest.mark.skipif(True, reason="Fortran I/O prone to crashing so better " + "not to run this test, see gh-13127") + def test_output_file_overwrite(self): + """ + Verify fix for gh-1892 + """ + def func(b, x): + return b[0] + b[1] * x + + p = Model(func) + data = Data(np.arange(10), 12 * np.arange(10)) + tmp_dir = tempfile.mkdtemp() + error_file_path = os.path.join(tmp_dir, "error.dat") + report_file_path = os.path.join(tmp_dir, "report.dat") + try: + ODR(data, p, beta0=[0.1, 13], errfile=error_file_path, + rptfile=report_file_path).run() + ODR(data, p, beta0=[0.1, 13], errfile=error_file_path, + rptfile=report_file_path, overwrite=True).run() + finally: + # remove output files for clean up + shutil.rmtree(tmp_dir) + + def test_odr_model_default_meta(self): + def func(b, x): + return b[0] + b[1] * x + + p = Model(func) + p.set_meta(name='Sample Model Meta', ref='ODRPACK') + assert_equal(p.meta, {'name': 'Sample Model Meta', 'ref': 'ODRPACK'}) + + def test_work_array_del_init(self): + """ + Verify fix for gh-18739 where del_init=1 fails. + """ + def func(b, x): + return b[0] + b[1] * x + + # generate some data + n_data = 4 + x = np.arange(n_data) + y = np.where(x % 2, x + 0.1, x - 0.1) + x_err = np.full(n_data, 0.1) + y_err = np.full(n_data, 0.1) + + linear_model = Model(func) + # Try various shapes of the `we` array from various `sy` and `covy` + rd0 = RealData(x, y, sx=x_err, sy=y_err) + rd1 = RealData(x, y, sx=x_err, sy=0.1) + rd2 = RealData(x, y, sx=x_err, sy=[0.1]) + rd3 = RealData(x, y, sx=x_err, sy=np.full((1, n_data), 0.1)) + rd4 = RealData(x, y, sx=x_err, covy=[[0.01]]) + rd5 = RealData(x, y, sx=x_err, covy=np.full((1, 1, n_data), 0.01)) + for rd in [rd0, rd1, rd2, rd3, rd4, rd5]: + odr_obj = ODR(rd, linear_model, beta0=[0.4, 0.4], + delta0=np.full(n_data, -0.1)) + odr_obj.set_job(fit_type=0, del_init=1) + # Just make sure that it runs without raising an exception. + odr_obj.run() + + def test_pickling_data(self): + x = np.linspace(0.0, 5.0) + y = 1.0 * x + 2.0 + data = Data(x, y) + + obj_pickle = pickle.dumps(data) + del data + pickle.loads(obj_pickle) + + def test_pickling_real_data(self): + x = np.linspace(0.0, 5.0) + y = 1.0 * x + 2.0 + data = RealData(x, y) + + obj_pickle = pickle.dumps(data) + del data + pickle.loads(obj_pickle) + + def test_pickling_model(self): + obj_pickle = pickle.dumps(unilinear) + pickle.loads(obj_pickle) + + def test_pickling_odr(self): + x = np.linspace(0.0, 5.0) + y = 1.0 * x + 2.0 + odr_obj = ODR(Data(x, y), unilinear) + + obj_pickle = pickle.dumps(odr_obj) + del odr_obj + pickle.loads(obj_pickle) + + def test_pickling_output(self): + x = np.linspace(0.0, 5.0) + y = 1.0 * x + 2.0 + output = ODR(Data(x, y), unilinear).run + + obj_pickle = pickle.dumps(output) + del output + pickle.loads(obj_pickle) diff --git a/shared/package-files/32/32417db3cbb65fef7f09e8bdb098b19636f6fc8fc1ff850ea95c7489178a214d/blob b/shared/package-files/32/32417db3cbb65fef7f09e8bdb098b19636f6fc8fc1ff850ea95c7489178a214d/blob new file mode 100644 index 0000000000000000000000000000000000000000..370ce9fe922fab333b8acc418e36d57a228d74e5 --- /dev/null +++ b/shared/package-files/32/32417db3cbb65fef7f09e8bdb098b19636f6fc8fc1ff850ea95c7489178a214d/blob @@ -0,0 +1,846 @@ +# Original code by: +# John Gill +# Copyright 2004 John Gill and John Hunter +# +# Subsequent changes: +# The Matplotlib development team +# Copyright The Matplotlib development team + +""" +Tables drawing. + +.. note:: + The table implementation in Matplotlib is lightly maintained. For a more + featureful table implementation, you may wish to try `blume + `_. + +Use the factory function `~matplotlib.table.table` to create a ready-made +table from texts. If you need more control, use the `.Table` class and its +methods. + +The table consists of a grid of cells, which are indexed by (row, column). +The cell (0, 0) is positioned at the top left. + +Thanks to John Gill for providing the class and table. +""" + +import numpy as np + +from . import _api, _docstring +from .artist import Artist, allow_rasterization +from .patches import Rectangle +from .text import Text +from .transforms import Bbox +from .path import Path + +from .cbook import _is_pandas_dataframe + + +class Cell(Rectangle): + """ + A cell is a `.Rectangle` with some associated `.Text`. + + As a user, you'll most likely not creates cells yourself. Instead, you + should use either the `~matplotlib.table.table` factory function or + `.Table.add_cell`. + """ + + PAD = 0.1 + """Padding between text and rectangle.""" + + _edges = 'BRTL' + _edge_aliases = {'open': '', + 'closed': _edges, # default + 'horizontal': 'BT', + 'vertical': 'RL' + } + + def __init__(self, xy, width, height, *, + edgecolor='k', facecolor='w', + fill=True, + text='', + loc='right', + fontproperties=None, + visible_edges='closed', + ): + """ + Parameters + ---------- + xy : 2-tuple + The position of the bottom left corner of the cell. + width : float + The cell width. + height : float + The cell height. + edgecolor : :mpltype:`color`, default: 'k' + The color of the cell border. + facecolor : :mpltype:`color`, default: 'w' + The cell facecolor. + fill : bool, default: True + Whether the cell background is filled. + text : str, optional + The cell text. + loc : {'right', 'center', 'left'} + The alignment of the text within the cell. + fontproperties : dict, optional + A dict defining the font properties of the text. Supported keys and + values are the keyword arguments accepted by `.FontProperties`. + visible_edges : {'closed', 'open', 'horizontal', 'vertical'} or \ +substring of 'BRTL' + The cell edges to be drawn with a line: a substring of 'BRTL' + (bottom, right, top, left), or one of 'open' (no edges drawn), + 'closed' (all edges drawn), 'horizontal' (bottom and top), + 'vertical' (right and left). + """ + + # Call base + super().__init__(xy, width=width, height=height, fill=fill, + edgecolor=edgecolor, facecolor=facecolor) + self.set_clip_on(False) + self.visible_edges = visible_edges + + # Create text object + self._loc = loc + self._text = Text(x=xy[0], y=xy[1], clip_on=False, + text=text, fontproperties=fontproperties, + horizontalalignment=loc, verticalalignment='center') + + def set_transform(self, t): + super().set_transform(t) + # the text does not get the transform! + self.stale = True + + def set_figure(self, fig): + super().set_figure(fig) + self._text.set_figure(fig) + + def get_text(self): + """Return the cell `.Text` instance.""" + return self._text + + def set_fontsize(self, size): + """Set the text fontsize.""" + self._text.set_fontsize(size) + self.stale = True + + def get_fontsize(self): + """Return the cell fontsize.""" + return self._text.get_fontsize() + + def auto_set_font_size(self, renderer): + """Shrink font size until the text fits into the cell width.""" + fontsize = self.get_fontsize() + required = self.get_required_width(renderer) + while fontsize > 1 and required > self.get_width(): + fontsize -= 1 + self.set_fontsize(fontsize) + required = self.get_required_width(renderer) + + return fontsize + + @allow_rasterization + def draw(self, renderer): + if not self.get_visible(): + return + # draw the rectangle + super().draw(renderer) + # position the text + self._set_text_position(renderer) + self._text.draw(renderer) + self.stale = False + + def _set_text_position(self, renderer): + """Set text up so it is drawn in the right place.""" + bbox = self.get_window_extent(renderer) + # center vertically + y = bbox.y0 + bbox.height / 2 + # position horizontally + loc = self._text.get_horizontalalignment() + if loc == 'center': + x = bbox.x0 + bbox.width / 2 + elif loc == 'left': + x = bbox.x0 + bbox.width * self.PAD + else: # right. + x = bbox.x0 + bbox.width * (1 - self.PAD) + self._text.set_position((x, y)) + + def get_text_bounds(self, renderer): + """ + Return the text bounds as *(x, y, width, height)* in table coordinates. + """ + return (self._text.get_window_extent(renderer) + .transformed(self.get_data_transform().inverted()) + .bounds) + + def get_required_width(self, renderer): + """Return the minimal required width for the cell.""" + l, b, w, h = self.get_text_bounds(renderer) + return w * (1.0 + (2.0 * self.PAD)) + + @_docstring.interpd + def set_text_props(self, **kwargs): + """ + Update the text properties. + + Valid keyword arguments are: + + %(Text:kwdoc)s + """ + self._text._internal_update(kwargs) + self.stale = True + + @property + def visible_edges(self): + """ + The cell edges to be drawn with a line. + + Reading this property returns a substring of 'BRTL' (bottom, right, + top, left'). + + When setting this property, you can use a substring of 'BRTL' or one + of {'open', 'closed', 'horizontal', 'vertical'}. + """ + return self._visible_edges + + @visible_edges.setter + def visible_edges(self, value): + if value is None: + self._visible_edges = self._edges + elif value in self._edge_aliases: + self._visible_edges = self._edge_aliases[value] + else: + if any(edge not in self._edges for edge in value): + raise ValueError('Invalid edge param {}, must only be one of ' + '{} or string of {}'.format( + value, + ", ".join(self._edge_aliases), + ", ".join(self._edges))) + self._visible_edges = value + self.stale = True + + def get_path(self): + """Return a `.Path` for the `.visible_edges`.""" + codes = [Path.MOVETO] + codes.extend( + Path.LINETO if edge in self._visible_edges else Path.MOVETO + for edge in self._edges) + if Path.MOVETO not in codes[1:]: # All sides are visible + codes[-1] = Path.CLOSEPOLY + return Path( + [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0]], + codes, + readonly=True + ) + + +CustomCell = Cell # Backcompat. alias. + + +class Table(Artist): + """ + A table of cells. + + The table consists of a grid of cells, which are indexed by (row, column). + + For a simple table, you'll have a full grid of cells with indices from + (0, 0) to (num_rows-1, num_cols-1), in which the cell (0, 0) is positioned + at the top left. However, you can also add cells with negative indices. + You don't have to add a cell to every grid position, so you can create + tables that have holes. + + *Note*: You'll usually not create an empty table from scratch. Instead use + `~matplotlib.table.table` to create a table from data. + """ + codes = {'best': 0, + 'upper right': 1, # default + 'upper left': 2, + 'lower left': 3, + 'lower right': 4, + 'center left': 5, + 'center right': 6, + 'lower center': 7, + 'upper center': 8, + 'center': 9, + 'top right': 10, + 'top left': 11, + 'bottom left': 12, + 'bottom right': 13, + 'right': 14, + 'left': 15, + 'top': 16, + 'bottom': 17, + } + """Possible values where to place the table relative to the Axes.""" + + FONTSIZE = 10 + + AXESPAD = 0.02 + """The border between the Axes and the table edge in Axes units.""" + + def __init__(self, ax, loc=None, bbox=None, **kwargs): + """ + Parameters + ---------- + ax : `~matplotlib.axes.Axes` + The `~.axes.Axes` to plot the table into. + loc : str, optional + The position of the cell with respect to *ax*. This must be one of + the `~.Table.codes`. + bbox : `.Bbox` or [xmin, ymin, width, height], optional + A bounding box to draw the table into. If this is not *None*, this + overrides *loc*. + + Other Parameters + ---------------- + **kwargs + `.Artist` properties. + """ + + super().__init__() + + if isinstance(loc, str): + if loc not in self.codes: + raise ValueError( + "Unrecognized location {!r}. Valid locations are\n\t{}" + .format(loc, '\n\t'.join(self.codes))) + loc = self.codes[loc] + self.set_figure(ax.get_figure(root=False)) + self._axes = ax + self._loc = loc + self._bbox = bbox + + # use axes coords + ax._unstale_viewLim() + self.set_transform(ax.transAxes) + + self._cells = {} + self._edges = None + self._autoColumns = [] + self._autoFontsize = True + self._internal_update(kwargs) + + self.set_clip_on(False) + + def add_cell(self, row, col, *args, **kwargs): + """ + Create a cell and add it to the table. + + Parameters + ---------- + row : int + Row index. + col : int + Column index. + *args, **kwargs + All other parameters are passed on to `Cell`. + + Returns + ------- + `.Cell` + The created cell. + + """ + xy = (0, 0) + cell = Cell(xy, visible_edges=self.edges, *args, **kwargs) + self[row, col] = cell + return cell + + def __setitem__(self, position, cell): + """ + Set a custom cell in a given position. + """ + _api.check_isinstance(Cell, cell=cell) + try: + row, col = position[0], position[1] + except Exception as err: + raise KeyError('Only tuples length 2 are accepted as ' + 'coordinates') from err + cell.set_figure(self.get_figure(root=False)) + cell.set_transform(self.get_transform()) + cell.set_clip_on(False) + self._cells[row, col] = cell + self.stale = True + + def __getitem__(self, position): + """Retrieve a custom cell from a given position.""" + return self._cells[position] + + @property + def edges(self): + """ + The default value of `~.Cell.visible_edges` for newly added + cells using `.add_cell`. + + Notes + ----- + This setting does currently only affect newly created cells using + `.add_cell`. + + To change existing cells, you have to set their edges explicitly:: + + for c in tab.get_celld().values(): + c.visible_edges = 'horizontal' + + """ + return self._edges + + @edges.setter + def edges(self, value): + self._edges = value + self.stale = True + + def _approx_text_height(self): + return (self.FONTSIZE / 72.0 * self.get_figure(root=True).dpi / + self._axes.bbox.height * 1.2) + + @allow_rasterization + def draw(self, renderer): + # docstring inherited + + # Need a renderer to do hit tests on mouseevent; assume the last one + # will do + if renderer is None: + renderer = self.get_figure(root=True)._get_renderer() + if renderer is None: + raise RuntimeError('No renderer defined') + + if not self.get_visible(): + return + renderer.open_group('table', gid=self.get_gid()) + self._update_positions(renderer) + + for key in sorted(self._cells): + self._cells[key].draw(renderer) + + renderer.close_group('table') + self.stale = False + + def _get_grid_bbox(self, renderer): + """ + Get a bbox, in axes coordinates for the cells. + + Only include those in the range (0, 0) to (maxRow, maxCol). + """ + boxes = [cell.get_window_extent(renderer) + for (row, col), cell in self._cells.items() + if row >= 0 and col >= 0] + bbox = Bbox.union(boxes) + return bbox.transformed(self.get_transform().inverted()) + + def contains(self, mouseevent): + # docstring inherited + if self._different_canvas(mouseevent): + return False, {} + # TODO: Return index of the cell containing the cursor so that the user + # doesn't have to bind to each one individually. + renderer = self.get_figure(root=True)._get_renderer() + if renderer is not None: + boxes = [cell.get_window_extent(renderer) + for (row, col), cell in self._cells.items() + if row >= 0 and col >= 0] + bbox = Bbox.union(boxes) + return bbox.contains(mouseevent.x, mouseevent.y), {} + else: + return False, {} + + def get_children(self): + """Return the Artists contained by the table.""" + return list(self._cells.values()) + + def get_window_extent(self, renderer=None): + # docstring inherited + if renderer is None: + renderer = self.get_figure(root=True)._get_renderer() + self._update_positions(renderer) + boxes = [cell.get_window_extent(renderer) + for cell in self._cells.values()] + return Bbox.union(boxes) + + def _do_cell_alignment(self): + """ + Calculate row heights and column widths; position cells accordingly. + """ + # Calculate row/column widths + widths = {} + heights = {} + for (row, col), cell in self._cells.items(): + height = heights.setdefault(row, 0.0) + heights[row] = max(height, cell.get_height()) + width = widths.setdefault(col, 0.0) + widths[col] = max(width, cell.get_width()) + + # work out left position for each column + xpos = 0 + lefts = {} + for col in sorted(widths): + lefts[col] = xpos + xpos += widths[col] + + ypos = 0 + bottoms = {} + for row in sorted(heights, reverse=True): + bottoms[row] = ypos + ypos += heights[row] + + # set cell positions + for (row, col), cell in self._cells.items(): + cell.set_x(lefts[col]) + cell.set_y(bottoms[row]) + + def auto_set_column_width(self, col): + """ + Automatically set the widths of given columns to optimal sizes. + + Parameters + ---------- + col : int or sequence of ints + The indices of the columns to auto-scale. + """ + col1d = np.atleast_1d(col) + if not np.issubdtype(col1d.dtype, np.integer): + raise TypeError("col must be an int or sequence of ints.") + for cell in col1d: + self._autoColumns.append(cell) + + self.stale = True + + def _auto_set_column_width(self, col, renderer): + """Automatically set width for column.""" + cells = [cell for key, cell in self._cells.items() if key[1] == col] + max_width = max((cell.get_required_width(renderer) for cell in cells), + default=0) + for cell in cells: + cell.set_width(max_width) + + def auto_set_font_size(self, value=True): + """Automatically set font size.""" + self._autoFontsize = value + self.stale = True + + def _auto_set_font_size(self, renderer): + + if len(self._cells) == 0: + return + fontsize = next(iter(self._cells.values())).get_fontsize() + cells = [] + for key, cell in self._cells.items(): + # ignore auto-sized columns + if key[1] in self._autoColumns: + continue + size = cell.auto_set_font_size(renderer) + fontsize = min(fontsize, size) + cells.append(cell) + + # now set all fontsizes equal + for cell in self._cells.values(): + cell.set_fontsize(fontsize) + + def scale(self, xscale, yscale): + """Scale column widths by *xscale* and row heights by *yscale*.""" + for c in self._cells.values(): + c.set_width(c.get_width() * xscale) + c.set_height(c.get_height() * yscale) + + def set_fontsize(self, size): + """ + Set the font size, in points, of the cell text. + + Parameters + ---------- + size : float + + Notes + ----- + As long as auto font size has not been disabled, the value will be + clipped such that the text fits horizontally into the cell. + + You can disable this behavior using `.auto_set_font_size`. + + >>> the_table.auto_set_font_size(False) + >>> the_table.set_fontsize(20) + + However, there is no automatic scaling of the row height so that the + text may exceed the cell boundary. + """ + for cell in self._cells.values(): + cell.set_fontsize(size) + self.stale = True + + def _offset(self, ox, oy): + """Move all the artists by ox, oy (axes coords).""" + for c in self._cells.values(): + x, y = c.get_x(), c.get_y() + c.set_x(x + ox) + c.set_y(y + oy) + + def _update_positions(self, renderer): + # called from renderer to allow more precise estimates of + # widths and heights with get_window_extent + + # Do any auto width setting + for col in self._autoColumns: + self._auto_set_column_width(col, renderer) + + if self._autoFontsize: + self._auto_set_font_size(renderer) + + # Align all the cells + self._do_cell_alignment() + + bbox = self._get_grid_bbox(renderer) + l, b, w, h = bbox.bounds + + if self._bbox is not None: + # Position according to bbox + if isinstance(self._bbox, Bbox): + rl, rb, rw, rh = self._bbox.bounds + else: + rl, rb, rw, rh = self._bbox + self.scale(rw / w, rh / h) + ox = rl - l + oy = rb - b + self._do_cell_alignment() + else: + # Position using loc + (BEST, UR, UL, LL, LR, CL, CR, LC, UC, C, + TR, TL, BL, BR, R, L, T, B) = range(len(self.codes)) + # defaults for center + ox = (0.5 - w / 2) - l + oy = (0.5 - h / 2) - b + if self._loc in (UL, LL, CL): # left + ox = self.AXESPAD - l + if self._loc in (BEST, UR, LR, R, CR): # right + ox = 1 - (l + w + self.AXESPAD) + if self._loc in (BEST, UR, UL, UC): # upper + oy = 1 - (b + h + self.AXESPAD) + if self._loc in (LL, LR, LC): # lower + oy = self.AXESPAD - b + if self._loc in (LC, UC, C): # center x + ox = (0.5 - w / 2) - l + if self._loc in (CL, CR, C): # center y + oy = (0.5 - h / 2) - b + + if self._loc in (TL, BL, L): # out left + ox = - (l + w) + if self._loc in (TR, BR, R): # out right + ox = 1.0 - l + if self._loc in (TR, TL, T): # out top + oy = 1.0 - b + if self._loc in (BL, BR, B): # out bottom + oy = - (b + h) + + self._offset(ox, oy) + + def get_celld(self): + r""" + Return a dict of cells in the table mapping *(row, column)* to + `.Cell`\s. + + Notes + ----- + You can also directly index into the Table object to access individual + cells:: + + cell = table[row, col] + + """ + return self._cells + + +@_docstring.interpd +def table(ax, + cellText=None, cellColours=None, + cellLoc='right', colWidths=None, + rowLabels=None, rowColours=None, rowLoc='left', + colLabels=None, colColours=None, colLoc='center', + loc='bottom', bbox=None, edges='closed', + **kwargs): + """ + Add a table to an `~.axes.Axes`. + + At least one of *cellText* or *cellColours* must be specified. These + parameters must be 2D lists, in which the outer lists define the rows and + the inner list define the column values per row. Each row must have the + same number of elements. + + The table can optionally have row and column headers, which are configured + using *rowLabels*, *rowColours*, *rowLoc* and *colLabels*, *colColours*, + *colLoc* respectively. + + For finer grained control over tables, use the `.Table` class and add it to + the Axes with `.Axes.add_table`. + + Parameters + ---------- + cellText : 2D list of str or pandas.DataFrame, optional + The texts to place into the table cells. + + *Note*: Line breaks in the strings are currently not accounted for and + will result in the text exceeding the cell boundaries. + + cellColours : 2D list of :mpltype:`color`, optional + The background colors of the cells. + + cellLoc : {'right', 'center', 'left'} + The alignment of the text within the cells. + + colWidths : list of float, optional + The column widths in units of the axes. If not given, all columns will + have a width of *1 / ncols*. + + rowLabels : list of str, optional + The text of the row header cells. + + rowColours : list of :mpltype:`color`, optional + The colors of the row header cells. + + rowLoc : {'left', 'center', 'right'} + The text alignment of the row header cells. + + colLabels : list of str, optional + The text of the column header cells. + + colColours : list of :mpltype:`color`, optional + The colors of the column header cells. + + colLoc : {'center', 'left', 'right'} + The text alignment of the column header cells. + + loc : str, default: 'bottom' + The position of the cell with respect to *ax*. This must be one of + the `~.Table.codes`. + + bbox : `.Bbox` or [xmin, ymin, width, height], optional + A bounding box to draw the table into. If this is not *None*, this + overrides *loc*. + + edges : {'closed', 'open', 'horizontal', 'vertical'} or substring of 'BRTL' + The cell edges to be drawn with a line. See also + `~.Cell.visible_edges`. + + Returns + ------- + `~matplotlib.table.Table` + The created table. + + Other Parameters + ---------------- + **kwargs + `.Table` properties. + + %(Table:kwdoc)s + """ + + if cellColours is None and cellText is None: + raise ValueError('At least one argument from "cellColours" or ' + '"cellText" must be provided to create a table.') + + # Check we have some cellText + if cellText is None: + # assume just colours are needed + rows = len(cellColours) + cols = len(cellColours[0]) + cellText = [[''] * cols] * rows + + # Check if we have a Pandas DataFrame + if _is_pandas_dataframe(cellText): + # if rowLabels/colLabels are empty, use DataFrame entries. + # Otherwise, throw an error. + if rowLabels is None: + rowLabels = cellText.index + else: + raise ValueError("rowLabels cannot be used alongside Pandas DataFrame") + if colLabels is None: + colLabels = cellText.columns + else: + raise ValueError("colLabels cannot be used alongside Pandas DataFrame") + # Update cellText with only values + cellText = cellText.values + + rows = len(cellText) + cols = len(cellText[0]) + for row in cellText: + if len(row) != cols: + raise ValueError(f"Each row in 'cellText' must have {cols} " + "columns") + + if cellColours is not None: + if len(cellColours) != rows: + raise ValueError(f"'cellColours' must have {rows} rows") + for row in cellColours: + if len(row) != cols: + raise ValueError("Each row in 'cellColours' must have " + f"{cols} columns") + else: + cellColours = ['w' * cols] * rows + + # Set colwidths if not given + if colWidths is None: + colWidths = [1.0 / cols] * cols + + # Fill in missing information for column + # and row labels + rowLabelWidth = 0 + if rowLabels is None: + if rowColours is not None: + rowLabels = [''] * rows + rowLabelWidth = colWidths[0] + elif rowColours is None: + rowColours = 'w' * rows + + if rowLabels is not None: + if len(rowLabels) != rows: + raise ValueError(f"'rowLabels' must be of length {rows}") + + # If we have column labels, need to shift + # the text and colour arrays down 1 row + offset = 1 + if colLabels is None: + if colColours is not None: + colLabels = [''] * cols + else: + offset = 0 + elif colColours is None: + colColours = 'w' * cols + + # Set up cell colours if not given + if cellColours is None: + cellColours = ['w' * cols] * rows + + # Now create the table + table = Table(ax, loc, bbox, **kwargs) + table.edges = edges + height = table._approx_text_height() + + # Add the cells + for row in range(rows): + for col in range(cols): + table.add_cell(row + offset, col, + width=colWidths[col], height=height, + text=cellText[row][col], + facecolor=cellColours[row][col], + loc=cellLoc) + # Do column labels + if colLabels is not None: + for col in range(cols): + table.add_cell(0, col, + width=colWidths[col], height=height, + text=colLabels[col], facecolor=colColours[col], + loc=colLoc) + + # Do row labels + if rowLabels is not None: + for row in range(rows): + table.add_cell(row + offset, -1, + width=rowLabelWidth or 1e-15, height=height, + text=rowLabels[row], facecolor=rowColours[row], + loc=rowLoc) + if rowLabelWidth == 0: + table.auto_set_column_width(-1) + + # set_fontsize is only effective after cells are added + if "fontsize" in kwargs: + table.set_fontsize(kwargs["fontsize"]) + + ax.add_table(table) + return table diff --git a/shared/package-files/32/3242055be14104744f53fc54196919feb1888a429d30a0281f5eca633c3bbc8b/blob b/shared/package-files/32/3242055be14104744f53fc54196919feb1888a429d30a0281f5eca633c3bbc8b/blob new file mode 100644 index 0000000000000000000000000000000000000000..4cfb091cbf1569b21cc812edf62a8f9e60ab3fef --- /dev/null +++ b/shared/package-files/32/3242055be14104744f53fc54196919feb1888a429d30a0281f5eca633c3bbc8b/blob @@ -0,0 +1,212 @@ +# mypy: ignore-errors + +# noqa: F401, E501 +# This is an auto-generated file. Please do not modify it by hand. +# To re-generate, run: +# cd ~/pytorch && python +# torchgen/fuse_attention_patterns/gen_attention_patterns.py + +import torch +import torch._inductor + +aten = torch.ops.aten +prims = torch.ops.prims + +from torch._inductor.pattern_matcher import ( + Arg, + CallFunction, + CallFunctionVarArgs, + CallMethod, + CallMethodVarArgs, + CallModule, + CallModuleVarArgs, + ExclusiveKeywordArg, + Ignored, + KeywordArg, + ListOf, + MultiOutputPattern, + PatternExpr, + RepeatedExpr, + _TargetArgsExpr, + _TargetExpr, + _TargetExprVarArgs, +) +permute_default = CallFunction(aten.permute.default, KeywordArg('query'), Ignored()) +expand_default = CallFunction(aten.expand.default, permute_default, Ignored()) +clone_default = CallFunction(aten.clone.default, expand_default, memory_format=torch.contiguous_format) +view_default = CallFunction(aten.view.default, clone_default, Ignored(), _users=2) +permute_default_1 = CallFunction(aten.permute.default, KeywordArg('key'), Ignored()) +permute_default_2 = CallFunction(aten.permute.default, permute_default_1, Ignored()) +expand_default_1 = CallFunction(aten.expand.default, permute_default_2, Ignored()) +clone_default_1 = CallFunction(aten.clone.default, expand_default_1, memory_format=torch.contiguous_format) +view_default_1 = CallFunction(aten.view.default, clone_default_1, Ignored(), _users=2) +bmm_default = CallFunction(aten.bmm.default, view_default, view_default_1) +view_default_2 = CallFunction(aten.view.default, bmm_default, Ignored()) +div_Tensor = CallFunction(aten.div.Tensor, view_default_2, KeywordArg('inv_scale'), _users=2) +amax_default = CallFunction(aten.amax.default, div_Tensor, Ignored(), True) +sub_Tensor = CallFunction(aten.sub.Tensor, div_Tensor, amax_default) +exp_default = CallFunction(aten.exp.default, sub_Tensor, _users=2) +sum_dim_IntList = CallFunction(aten.sum.dim_IntList, exp_default, Ignored(), True) +div_Tensor_1 = CallFunction(aten.div.Tensor, exp_default, sum_dim_IntList, _users=2) +expand_default_2 = CallFunction(aten.expand.default, div_Tensor_1, Ignored()) +view_default_3 = CallFunction(aten.view.default, expand_default_2, Ignored(), _users=2) +permute_default_3 = CallFunction(aten.permute.default, KeywordArg('value'), Ignored()) +expand_default_3 = CallFunction(aten.expand.default, permute_default_3, Ignored()) +clone_default_2 = CallFunction(aten.clone.default, expand_default_3, memory_format=torch.contiguous_format) +view_default_4 = CallFunction(aten.view.default, clone_default_2, Ignored(), _users=2) +bmm_default_1 = CallFunction(aten.bmm.default, view_default_3, view_default_4) +view_default_5 = CallFunction(aten.view.default, bmm_default_1, Ignored()) +view_default_6 = CallFunction(aten.view.default, KeywordArg('tangents_1'), Ignored(), _users=2) +permute_default_4 = CallFunction(aten.permute.default, view_default_4, Ignored()) +bmm_default_2 = CallFunction(aten.bmm.default, view_default_6, permute_default_4) +view_default_7 = CallFunction(aten.view.default, bmm_default_2, Ignored()) +alias_default = CallFunction(aten.alias.default, div_Tensor_1) +alias_default_1 = CallFunction(aten.alias.default, alias_default) +alias_default_2 = CallFunction(aten.alias.default, alias_default_1) +alias_default_3 = CallFunction(aten.alias.default, alias_default_2, _users=2) +mul_Tensor = CallFunction(aten.mul.Tensor, view_default_7, alias_default_3, _users=2) +sum_dim_IntList_1 = CallFunction(aten.sum.dim_IntList, mul_Tensor, Ignored(), True) +mul_Tensor_1 = CallFunction(aten.mul.Tensor, alias_default_3, sum_dim_IntList_1) +sub_Tensor_1 = CallFunction(aten.sub.Tensor, mul_Tensor, mul_Tensor_1) +div_Tensor_2 = CallFunction(aten.div.Tensor, sub_Tensor_1, KeywordArg('inv_scale')) +view_default_8 = CallFunction(aten.view.default, div_Tensor_2, Ignored(), _users=2) +permute_default_5 = CallFunction(aten.permute.default, view_default_1, Ignored()) +bmm_default_3 = CallFunction(aten.bmm.default, view_default_8, permute_default_5) +view_default_9 = CallFunction(aten.view.default, bmm_default_3, Ignored()) +permute_default_6 = CallFunction(aten.permute.default, view_default_9, Ignored()) +permute_default_7 = CallFunction(aten.permute.default, view_default, Ignored()) +bmm_default_4 = CallFunction(aten.bmm.default, permute_default_7, view_default_8) +view_default_10 = CallFunction(aten.view.default, bmm_default_4, Ignored()) +permute_default_8 = CallFunction(aten.permute.default, view_default_10, Ignored()) +permute_default_9 = CallFunction(aten.permute.default, permute_default_8, Ignored()) +permute_default_10 = CallFunction(aten.permute.default, view_default_3, Ignored()) +bmm_default_5 = CallFunction(aten.bmm.default, permute_default_10, view_default_6) +view_default_11 = CallFunction(aten.view.default, bmm_default_5, Ignored()) +permute_default_11 = CallFunction(aten.permute.default, view_default_11, Ignored()) +_sfdp_pattern_11_training = MultiOutputPattern([view_default_5, + permute_default_6, + permute_default_9, + permute_default_11, + None +]) + + +permute_default = CallFunction(aten.permute.default, KeywordArg('query'), Ignored()) +expand_default = CallFunction(aten.expand.default, permute_default, Ignored()) +clone_default = CallFunction(aten.clone.default, expand_default, memory_format=torch.contiguous_format) +view_default = CallFunction(aten.view.default, clone_default, Ignored()) +permute_default_1 = CallFunction(aten.permute.default, KeywordArg('key'), Ignored()) +permute_default_2 = CallFunction(aten.permute.default, permute_default_1, Ignored()) +expand_default_1 = CallFunction(aten.expand.default, permute_default_2, Ignored()) +clone_default_1 = CallFunction(aten.clone.default, expand_default_1, memory_format=torch.contiguous_format) +view_default_1 = CallFunction(aten.view.default, clone_default_1, Ignored()) +bmm_default = CallFunction(aten.bmm.default, view_default, view_default_1) +view_default_2 = CallFunction(aten.view.default, bmm_default, Ignored()) +div_Tensor = CallFunction(aten.div.Tensor, view_default_2, KeywordArg('inv_scale'), _users=2) +amax_default = CallFunction(aten.amax.default, div_Tensor, Ignored(), True) +sub_Tensor = CallFunction(aten.sub.Tensor, div_Tensor, amax_default) +exp_default = CallFunction(aten.exp.default, sub_Tensor, _users=2) +sum_dim_IntList = CallFunction(aten.sum.dim_IntList, exp_default, Ignored(), True) +div_Tensor_1 = CallFunction(aten.div.Tensor, exp_default, sum_dim_IntList) +expand_default_2 = CallFunction(aten.expand.default, div_Tensor_1, Ignored()) +view_default_3 = CallFunction(aten.view.default, expand_default_2, Ignored()) +permute_default_3 = CallFunction(aten.permute.default, KeywordArg('value'), Ignored()) +expand_default_3 = CallFunction(aten.expand.default, permute_default_3, Ignored()) +clone_default_2 = CallFunction(aten.clone.default, expand_default_3, memory_format=torch.contiguous_format) +view_default_4 = CallFunction(aten.view.default, clone_default_2, Ignored()) +bmm_default_1 = CallFunction(aten.bmm.default, view_default_3, view_default_4) +_sfdp_pattern_11_inference = CallFunction(aten.view.default, bmm_default_1, Ignored()) + + +permute_default = CallFunction(aten.permute.default, KeywordArg('query'), Ignored()) +expand_default = CallFunction(aten.expand.default, permute_default, Ignored()) +clone_default = CallFunction(aten.clone.default, expand_default, memory_format=torch.contiguous_format) +view_default = CallFunction(aten.view.default, clone_default, Ignored(), _users=2) +permute_default_1 = CallFunction(aten.permute.default, KeywordArg('key'), Ignored()) +permute_default_2 = CallFunction(aten.permute.default, permute_default_1, Ignored()) +expand_default_1 = CallFunction(aten.expand.default, permute_default_2, Ignored()) +clone_default_1 = CallFunction(aten.clone.default, expand_default_1, memory_format=torch.contiguous_format) +view_default_1 = CallFunction(aten.view.default, clone_default_1, Ignored(), _users=2) +bmm_default = CallFunction(aten.bmm.default, view_default, view_default_1) +view_default_2 = CallFunction(aten.view.default, bmm_default, Ignored()) +div_Tensor = CallFunction(aten.div.Tensor, view_default_2, KeywordArg('inv_scale')) +convert_element_type_default = CallFunction(prims.convert_element_type.default, div_Tensor, Ignored(), _users=2) +amax_default = CallFunction(aten.amax.default, convert_element_type_default, Ignored(), True) +sub_Tensor = CallFunction(aten.sub.Tensor, convert_element_type_default, amax_default) +exp_default = CallFunction(aten.exp.default, sub_Tensor, _users=2) +sum_dim_IntList = CallFunction(aten.sum.dim_IntList, exp_default, Ignored(), True) +div_Tensor_1 = CallFunction(aten.div.Tensor, exp_default, sum_dim_IntList) +convert_element_type_default_1 = CallFunction(prims.convert_element_type.default, div_Tensor_1, Ignored(), _users=2) +expand_default_2 = CallFunction(aten.expand.default, convert_element_type_default_1, Ignored()) +view_default_3 = CallFunction(aten.view.default, expand_default_2, Ignored(), _users=2) +permute_default_3 = CallFunction(aten.permute.default, KeywordArg('value'), Ignored()) +expand_default_3 = CallFunction(aten.expand.default, permute_default_3, Ignored()) +clone_default_2 = CallFunction(aten.clone.default, expand_default_3, memory_format=torch.contiguous_format) +view_default_4 = CallFunction(aten.view.default, clone_default_2, Ignored(), _users=2) +bmm_default_1 = CallFunction(aten.bmm.default, view_default_3, view_default_4) +view_default_5 = CallFunction(aten.view.default, bmm_default_1, Ignored()) +view_default_6 = CallFunction(aten.view.default, KeywordArg('tangents_1'), Ignored(), _users=2) +permute_default_4 = CallFunction(aten.permute.default, view_default_4, Ignored()) +bmm_default_2 = CallFunction(aten.bmm.default, view_default_6, permute_default_4) +view_default_7 = CallFunction(aten.view.default, bmm_default_2, Ignored()) +convert_element_type_default_2 = CallFunction(prims.convert_element_type.default, view_default_7, Ignored()) +alias_default = CallFunction(aten.alias.default, convert_element_type_default_1) +alias_default_1 = CallFunction(aten.alias.default, alias_default) +alias_default_2 = CallFunction(aten.alias.default, alias_default_1) +alias_default_3 = CallFunction(aten.alias.default, alias_default_2) +convert_element_type_default_3 = CallFunction(prims.convert_element_type.default, alias_default_3, Ignored(), _users=2) +mul_Tensor = CallFunction(aten.mul.Tensor, convert_element_type_default_2, convert_element_type_default_3, _users=2) +sum_dim_IntList_1 = CallFunction(aten.sum.dim_IntList, mul_Tensor, Ignored(), True) +mul_Tensor_1 = CallFunction(aten.mul.Tensor, convert_element_type_default_3, sum_dim_IntList_1) +sub_Tensor_1 = CallFunction(aten.sub.Tensor, mul_Tensor, mul_Tensor_1) +convert_element_type_default_4 = CallFunction(prims.convert_element_type.default, sub_Tensor_1, Ignored()) +div_Tensor_2 = CallFunction(aten.div.Tensor, convert_element_type_default_4, KeywordArg('inv_scale')) +view_default_8 = CallFunction(aten.view.default, div_Tensor_2, Ignored(), _users=2) +permute_default_5 = CallFunction(aten.permute.default, view_default_1, Ignored()) +bmm_default_3 = CallFunction(aten.bmm.default, view_default_8, permute_default_5) +view_default_9 = CallFunction(aten.view.default, bmm_default_3, Ignored()) +permute_default_6 = CallFunction(aten.permute.default, view_default_9, Ignored()) +permute_default_7 = CallFunction(aten.permute.default, view_default, Ignored()) +bmm_default_4 = CallFunction(aten.bmm.default, permute_default_7, view_default_8) +view_default_10 = CallFunction(aten.view.default, bmm_default_4, Ignored()) +permute_default_8 = CallFunction(aten.permute.default, view_default_10, Ignored()) +permute_default_9 = CallFunction(aten.permute.default, permute_default_8, Ignored()) +permute_default_10 = CallFunction(aten.permute.default, view_default_3, Ignored()) +bmm_default_5 = CallFunction(aten.bmm.default, permute_default_10, view_default_6) +view_default_11 = CallFunction(aten.view.default, bmm_default_5, Ignored()) +permute_default_11 = CallFunction(aten.permute.default, view_default_11, Ignored()) +_sfdp_pattern_11_half_training = MultiOutputPattern([view_default_5, + permute_default_6, + permute_default_9, + permute_default_11, + None +]) + + +permute_default = CallFunction(aten.permute.default, KeywordArg('query'), Ignored()) +expand_default = CallFunction(aten.expand.default, permute_default, Ignored()) +clone_default = CallFunction(aten.clone.default, expand_default, memory_format=torch.contiguous_format) +view_default = CallFunction(aten.view.default, clone_default, Ignored()) +permute_default_1 = CallFunction(aten.permute.default, KeywordArg('key'), Ignored()) +permute_default_2 = CallFunction(aten.permute.default, permute_default_1, Ignored()) +expand_default_1 = CallFunction(aten.expand.default, permute_default_2, Ignored()) +clone_default_1 = CallFunction(aten.clone.default, expand_default_1, memory_format=torch.contiguous_format) +view_default_1 = CallFunction(aten.view.default, clone_default_1, Ignored()) +bmm_default = CallFunction(aten.bmm.default, view_default, view_default_1) +view_default_2 = CallFunction(aten.view.default, bmm_default, Ignored()) +div_Tensor = CallFunction(aten.div.Tensor, view_default_2, KeywordArg('inv_scale')) +convert_element_type_default = CallFunction(prims.convert_element_type.default, div_Tensor, Ignored(), _users=2) +amax_default = CallFunction(aten.amax.default, convert_element_type_default, Ignored(), True) +sub_Tensor = CallFunction(aten.sub.Tensor, convert_element_type_default, amax_default) +exp_default = CallFunction(aten.exp.default, sub_Tensor, _users=2) +sum_dim_IntList = CallFunction(aten.sum.dim_IntList, exp_default, Ignored(), True) +div_Tensor_1 = CallFunction(aten.div.Tensor, exp_default, sum_dim_IntList) +convert_element_type_default_1 = CallFunction(prims.convert_element_type.default, div_Tensor_1, Ignored()) +expand_default_2 = CallFunction(aten.expand.default, convert_element_type_default_1, Ignored()) +view_default_3 = CallFunction(aten.view.default, expand_default_2, Ignored()) +permute_default_3 = CallFunction(aten.permute.default, KeywordArg('value'), Ignored()) +expand_default_3 = CallFunction(aten.expand.default, permute_default_3, Ignored()) +clone_default_2 = CallFunction(aten.clone.default, expand_default_3, memory_format=torch.contiguous_format) +view_default_4 = CallFunction(aten.view.default, clone_default_2, Ignored()) +bmm_default_1 = CallFunction(aten.bmm.default, view_default_3, view_default_4) +_sfdp_pattern_11_half_inference = CallFunction(aten.view.default, bmm_default_1, Ignored()) diff --git a/shared/package-files/32/32459867484ab8dcaea50f07e42cfc3294f69546165ab418bf0c7b48b90edb71/blob b/shared/package-files/32/32459867484ab8dcaea50f07e42cfc3294f69546165ab418bf0c7b48b90edb71/blob new file mode 100644 index 0000000000000000000000000000000000000000..38dafef8bc64a3917b0d5630d9a8cee439e8f9ff --- /dev/null +++ b/shared/package-files/32/32459867484ab8dcaea50f07e42cfc3294f69546165ab418bf0c7b48b90edb71/blob @@ -0,0 +1,221 @@ +""" +Tests for RLMDetS and RLMDetSMM (statsmodels.robust.resistant_linear_model). + +Neither estimator has a closed-form solution or a reference implementation +in another package, so correctness is checked two independent ways: + +* the M-scale defining equation ``mean(rho(resid / raw_scale)) == + scale_bias`` must hold at the returned ``(params, scale)`` -- this is + the algebraic condition an S-estimator solution must satisfy by + definition, derived directly from ``RLMDetS.__init__`` and + ``RLM._estimate_scale``, independent of how ``fit`` gets there; +* under gross contamination, both estimators must recover the true + regression coefficients far better than OLS, which is the entire + reason to use them. +""" +from pathlib import Path + +import numpy as np +from numpy.testing import assert_allclose +import pytest + +import statsmodels.api as sm +from statsmodels.robust.resistant_linear_model import ( + DetSStartResult, + RLMDetS, + RLMDetSMM, +) + +cur_dir = Path(__file__).parent.resolve() + + +def _moment_condition(mod, res, rtol=1e-4): + """(params, scale) satisfy the S-estimator's M-scale equation. + + Only valid where params and scale were determined jointly by a single + S-type fixed point using ``mod.norm``/``mod.mscale`` -- i.e. for + ``RLMDetS.fit``, not for ``RLMDetSMM.fit``'s second (M) stage, which + reweights with a different norm and, in the fixed-scale branch, does + not re-solve the scale equation at all. + + ``res.scale`` carries RLM's extra ``sqrt(nobs / df_resid)`` factor + (see ``RLM._estimate_scale``), so back it out before checking against + ``mscale.scale_bias``. + """ + endog, exog = mod.endog, mod.exog + resid = endog - exog @ res.params + df_resid = exog.shape[0] - exog.shape[1] + raw_scale = res.scale * np.sqrt(df_resid / exog.shape[0]) + lhs = np.mean(mod.norm.rho(resid / raw_scale)) + assert_allclose(lhs, mod.mscale.scale_bias, rtol=rtol) + + +def _normal_equations(mod, res, norm, atol=1e-4): + """The weighted normal equations X' W(resid/scale) resid == 0 hold. + + This is the first-order condition any converged (weighted) IRLS fit + satisfies for the norm that produced its final weights, regardless of + how the scale itself was obtained -- so unlike ``_moment_condition`` + it applies uniformly to every RLMDetS/RLMDetSMM code path. + """ + endog, exog = mod.endog, mod.exog + resid = endog - exog @ res.params + weights = norm.weights(resid / res.scale) + grad = exog.T @ (weights * resid) + assert_allclose(grad, 0, atol=atol) + + +def _stackloss(): + from statsmodels.datasets.stackloss import load + data = load() + endog = np.asarray(data.endog) + exog = sm.add_constant(np.asarray(data.exog)) + return endog, exog + + +def _contaminated(n=200, k=3, frac=0.2, seed=12345): + rng = np.random.default_rng(seed) + exog = sm.add_constant(rng.standard_normal((n, k))) + beta = np.array([1.0, 2.0, -1.5, 0.5]) + endog = exog @ beta + rng.standard_normal(n) * 0.5 + n_out = int(frac * n) + idx = rng.choice(n, n_out, replace=False) + endog[idx] += rng.choice([-1, 1], n_out) * rng.uniform(15, 25, n_out) + return endog, exog, beta + + +class TestRLMDetS: + + def test_fit_moment_condition_and_start_results(self): + endog, exog = _stackloss() + mod = RLMDetS(endog, exog, breakdown_point=0.5) + res = mod.fit(h=14) + _moment_condition(mod, res) + + assert res.model_dets is mod + results_iter = res._results.results_iter + assert len(results_iter) > 0 + for entry in results_iter.values(): + assert isinstance(entry, DetSStartResult) + assert entry.scale > 0 + assert entry.params.shape == (exog.shape[1],) + + def test_fit_beats_ols_under_contamination(self): + endog, exog, beta = _contaminated() + mod = RLMDetS(endog, exog) + res = mod.fit(h=120) + ols = sm.OLS(endog, exog).fit() + + err_dets = np.linalg.norm(res.params - beta) + err_ols = np.linalg.norm(ols.params - beta) + assert err_dets < 0.3 + assert err_dets < 0.3 * err_ols + _moment_condition(mod, res) + _normal_equations(mod, res, mod.norm) + + def test_start_params_extra(self): + endog, exog = _stackloss() + mod = RLMDetS(endog, exog) + ols_params = sm.OLS(endog, exog).fit().params + res = mod.fit(h=14, start_params_extra=[np.asarray(ols_params)]) + _moment_condition(mod, res) + + def test_univariate_quantile_start(self): + # exog is constant-only, so data_start is empty and + # _get_start_params falls back to endog quantiles. + endog, _ = _stackloss() + exog = np.ones((len(endog), 1)) + mod = RLMDetS(endog, exog) + + starts = mod._get_start_params(h=14) + assert len(starts) == 3 + assert_allclose(sorted(s[0] for s in starts), + np.quantile(endog, [0.25, 0.5, 0.75])) + + res = mod.fit(h=14) + _moment_condition(mod, res) + + def test_include_endog_and_col_indices(self): + endog, exog = _stackloss() + n_extra = exog.shape[1] - 1 + + mod = RLMDetS(endog, exog, include_endog=True) + assert mod.data_start.shape == (len(endog), n_extra + 1) + res = mod.fit(h=14) + _moment_condition(mod, res) + + mod2 = RLMDetS(endog, exog, col_indices=[1, 2]) + assert mod2.data_start.shape == (len(endog), 2) + res2 = mod2.fit(h=14) + _moment_condition(mod2, res2) + + +class TestRLMDetSMM: + + def test_fit_default_h(self): + # Regression test: h=None previously reached np.argpartition(d, + # None) inside _get_detcov_startidx and raised a bare + # "TypeError: Partition index must be integer" -- fit()'s + # documented default was unreachable. + endog, exog = _stackloss() + mod = RLMDetSMM(endog, exog) + res = mod.fit() + assert np.isfinite(res.scale) + assert res.scale > 0 + assert res._results.results_dets is not None + _normal_equations(mod, res, mod.norm_mean) + + def test_fit_beats_ols_under_contamination(self): + endog, exog, beta = _contaminated() + mod = RLMDetSMM(endog, exog, efficiency=0.95) + res = mod.fit(h=120) + ols = sm.OLS(endog, exog).fit() + + err_detsmm = np.linalg.norm(res.params - beta) + err_ols = np.linalg.norm(ols.params - beta) + assert err_detsmm < 0.3 + assert err_detsmm < 0.3 * err_ols + _normal_equations(mod, res, mod.norm_mean) + + def test_efficiency_close_to_ols_on_clean_data(self): + rng = np.random.default_rng(999) + n, k = 300, 3 + exog = sm.add_constant(rng.standard_normal((n, k))) + beta = np.array([1.0, 2.0, -1.5, 0.5]) + endog = exog @ beta + rng.standard_normal(n) * 0.5 + + mod = RLMDetSMM(endog, exog, efficiency=0.95) + res = mod.fit(h=200) + ols = sm.OLS(endog, exog).fit() + assert_allclose(res.params, ols.params, atol=0.25) + _normal_equations(mod, res, mod.norm_mean) + + def test_scale_binding(self): + endog, exog = _stackloss() + mod = RLMDetSMM(endog, exog) + res = mod.fit(h=14, scale_binding=True) + assert np.isfinite(res.scale) + assert res.scale > 0 + assert res._results.results_dets is not None + _normal_equations(mod, res, mod.norm_mean) + + def test_start_tuple_skips_s_stage(self): + endog, exog = _stackloss() + res_s = RLMDetS(endog, exog).fit(h=14) + + mod = RLMDetSMM(endog, exog) + res = mod.fit(start=(np.asarray(res_s.params), res_s.scale)) + assert res._results.results_dets is None + assert np.isfinite(res.scale) + assert res.scale > 0 + _normal_equations(mod, res, mod.norm_mean) + + @pytest.mark.parametrize("breakdown_point", [0.25, 0.5]) + def test_breakdown_point_passthrough(self, breakdown_point): + endog, exog = _stackloss() + mod = RLMDetSMM(endog, exog, breakdown_point=breakdown_point) + assert mod.breakdown_point == breakdown_point + res = mod.fit(h=14) + assert np.isfinite(res.scale) + assert res.scale > 0 + _normal_equations(mod, res, mod.norm_mean) diff --git a/shared/package-files/32/3245c26feced6b48a616cfeb03e0b35565dadebaa1e1c679abc8d9ae2b88c603/blob b/shared/package-files/32/3245c26feced6b48a616cfeb03e0b35565dadebaa1e1c679abc8d9ae2b88c603/blob new file mode 100644 index 0000000000000000000000000000000000000000..5639567d666686dd81ca5b4b032fb44f039eb782 --- /dev/null +++ b/shared/package-files/32/3245c26feced6b48a616cfeb03e0b35565dadebaa1e1c679abc8d9ae2b88c603/blob @@ -0,0 +1,10 @@ +#pragma once + +namespace at { +struct TensorIteratorBase; + +namespace native { + +void direct_copy_kernel_cuda(TensorIteratorBase &iter); + +}} // namespace at::native diff --git a/shared/package-files/32/32480f004cc641df91ab4c343d95d25f62da7515a150409c8ac258f254ab9b84/blob b/shared/package-files/32/32480f004cc641df91ab4c343d95d25f62da7515a150409c8ac258f254ab9b84/blob new file mode 100644 index 0000000000000000000000000000000000000000..8c5661e93a205bf4fb22404d4fc50f902cc31369 --- /dev/null +++ b/shared/package-files/32/32480f004cc641df91ab4c343d95d25f62da7515a150409c8ac258f254ab9b84/blob @@ -0,0 +1 @@ +# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. diff --git a/shared/package-files/32/324abef1dbe9719d97854e4656decbd489269e3254532dce331ee11ca8d04813/blob b/shared/package-files/32/324abef1dbe9719d97854e4656decbd489269e3254532dce331ee11ca8d04813/blob new file mode 100644 index 0000000000000000000000000000000000000000..08e58a347e86f6a50c79b79b3322d29b082fa9c9 --- /dev/null +++ b/shared/package-files/32/324abef1dbe9719d97854e4656decbd489269e3254532dce331ee11ca8d04813/blob @@ -0,0 +1,91 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::slice_scatter(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor +inline at::Tensor slice_scatter(const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, int64_t step=1) { + return at::_ops::slice_scatter::call(self, src, dim, start.has_value() ? c10::make_optional(c10::SymInt(*start)) : c10::nullopt, end.has_value() ? c10::make_optional(c10::SymInt(*end)) : c10::nullopt, step); +} +namespace symint { + template ::value>> + at::Tensor slice_scatter(const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, int64_t step=1) { + return at::_ops::slice_scatter::call(self, src, dim, start.has_value() ? c10::make_optional(c10::SymInt(*start)) : c10::nullopt, end.has_value() ? c10::make_optional(c10::SymInt(*end)) : c10::nullopt, step); + } +} + +// aten::slice_scatter(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1) -> Tensor +inline at::Tensor slice_scatter_symint(const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, c10::SymInt step=1) { + return at::_ops::slice_scatter::call(self, src, dim, start, end, step); +} +namespace symint { + template ::value>> + at::Tensor slice_scatter(const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, c10::SymInt step=1) { + return at::_ops::slice_scatter::call(self, src, dim, start, end, step); + } +} + +// aten::slice_scatter.out(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_scatter_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, int64_t step=1) { + return at::_ops::slice_scatter_out::call(self, src, dim, start.has_value() ? c10::make_optional(c10::SymInt(*start)) : c10::nullopt, end.has_value() ? c10::make_optional(c10::SymInt(*end)) : c10::nullopt, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_scatter_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, int64_t step=1) { + return at::_ops::slice_scatter_out::call(self, src, dim, start.has_value() ? c10::make_optional(c10::SymInt(*start)) : c10::nullopt, end.has_value() ? c10::make_optional(c10::SymInt(*end)) : c10::nullopt, step, out); + } +} + +// aten::slice_scatter.out(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_scatter_outf(const at::Tensor & self, const at::Tensor & src, int64_t dim, c10::optional start, c10::optional end, int64_t step, at::Tensor & out) { + return at::_ops::slice_scatter_out::call(self, src, dim, start.has_value() ? c10::make_optional(c10::SymInt(*start)) : c10::nullopt, end.has_value() ? c10::make_optional(c10::SymInt(*end)) : c10::nullopt, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_scatter_outf(const at::Tensor & self, const at::Tensor & src, int64_t dim, c10::optional start, c10::optional end, int64_t step, at::Tensor & out) { + return at::_ops::slice_scatter_out::call(self, src, dim, start.has_value() ? c10::make_optional(c10::SymInt(*start)) : c10::nullopt, end.has_value() ? c10::make_optional(c10::SymInt(*end)) : c10::nullopt, step, out); + } +} + +// aten::slice_scatter.out(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_scatter_symint_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, c10::SymInt step=1) { + return at::_ops::slice_scatter_out::call(self, src, dim, start, end, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_scatter_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & src, int64_t dim=0, c10::optional start=c10::nullopt, c10::optional end=c10::nullopt, c10::SymInt step=1) { + return at::_ops::slice_scatter_out::call(self, src, dim, start, end, step, out); + } +} + +// aten::slice_scatter.out(Tensor self, Tensor src, int dim=0, SymInt? start=None, SymInt? end=None, SymInt step=1, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & slice_scatter_symint_outf(const at::Tensor & self, const at::Tensor & src, int64_t dim, c10::optional start, c10::optional end, c10::SymInt step, at::Tensor & out) { + return at::_ops::slice_scatter_out::call(self, src, dim, start, end, step, out); +} +namespace symint { + template ::value>> + at::Tensor & slice_scatter_outf(const at::Tensor & self, const at::Tensor & src, int64_t dim, c10::optional start, c10::optional end, c10::SymInt step, at::Tensor & out) { + return at::_ops::slice_scatter_out::call(self, src, dim, start, end, step, out); + } +} + +} diff --git a/shared/package-files/32/324b38c7e4a3f573236c5fdddcc8b3939e3e79838b994352cb32df6c8950a8c9/blob b/shared/package-files/32/324b38c7e4a3f573236c5fdddcc8b3939e3e79838b994352cb32df6c8950a8c9/blob new file mode 100644 index 0000000000000000000000000000000000000000..76da4ee5236e935303a92bc74e746613bb8cffe5 --- /dev/null +++ b/shared/package-files/32/324b38c7e4a3f573236c5fdddcc8b3939e3e79838b994352cb32df6c8950a8c9/blob @@ -0,0 +1,528 @@ +import numpy as np +import sys +import traceback + +from numba import jit, njit +from numba.core import types, errors, utils +from numba.tests.support import (TestCase, expected_failure_py311, + expected_failure_py312, + expected_failure_py313, + expected_failure_py314, + expected_failure_py315, + ) +import unittest + + +force_pyobj_flags = {'nopython': False, 'forceobj': True} +no_pyobj_flags = {'nopython': True, '_nrt': False} +no_pyobj_flags_w_nrt = {'nopython': True, '_nrt': True} +no_gil_flags = {'nopython': True, 'nogil': True, '_nrt': True} + + +class MyError(Exception): + pass + + +class OtherError(Exception): + pass + + +class UDEArgsToSuper(Exception): + def __init__(self, arg, value0): + super(UDEArgsToSuper, self).__init__(arg) + self.value0 = value0 + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + same = True + same |= self.args == other.args + same |= self.value0 == other.value0 + return same + + def __hash__(self): + return hash((super(UDEArgsToSuper).__hash__(), self.value0)) + + +class UDENoArgSuper(Exception): + def __init__(self, arg, value0): + super(UDENoArgSuper, self).__init__() + self.deferarg = arg + self.value0 = value0 + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + same = True + same |= self.args == other.args + same |= self.deferarg == other.deferarg + same |= self.value0 == other.value0 + return same + + def __hash__(self): + return hash((super(UDENoArgSuper).__hash__(), self.deferarg, + self.value0)) + + +def raise_class(exc): + def raiser(i): + if i == 1: + raise exc + elif i == 2: + raise ValueError + elif i == 3: + # The exception type is looked up on a module (issue #1624) + raise np.linalg.LinAlgError + return i + return raiser + + +def raise_instance(exc, arg): + def raiser(i): + if i == 1: + raise exc(arg, 1) + elif i == 2: + raise ValueError(arg, 2) + elif i == 3: + raise np.linalg.LinAlgError(arg, 3) + return i + return raiser + + +def raise_instance_runtime_args(exc): + def raiser(i, arg): + if i == 1: + raise exc(arg, 1) + elif i == 2: + raise ValueError(arg, 2) + elif i == 3: + raise np.linalg.LinAlgError(arg, 3) + return i + return raiser + + +def reraise(): + raise + + +def outer_function(inner): + def outer(i): + if i == 3: + raise OtherError("bar", 3) + return inner(i) + return outer + + +def assert_usecase(i): + assert i == 1, "bar" + + +def ude_bug_usecase(): + raise UDEArgsToSuper() # oops user forgot args to exception ctor + + +def raise_runtime_value(arg): + raise ValueError(arg) + + +class TestRaising(TestCase): + + def test_unituple_index_error(self): + def pyfunc(a, i): + return a.shape[i] + + cfunc = njit((types.Array(types.int32, 1, 'A'), types.int32),)(pyfunc) + + a = np.empty(2, dtype=np.int32) + + self.assertEqual(cfunc(a, 0), pyfunc(a, 0)) + + with self.assertRaises(IndexError) as cm: + cfunc(a, 2) + self.assertEqual(str(cm.exception), "tuple index out of range") + + def check_against_python(self, exec_mode, pyfunc, cfunc, + expected_error_class, *args): + + assert exec_mode in (force_pyobj_flags, no_pyobj_flags, + no_pyobj_flags_w_nrt, no_gil_flags) + + # invariant of mode, check the error class and args are the same + with self.assertRaises(expected_error_class) as pyerr: + pyfunc(*args) + with self.assertRaises(expected_error_class) as jiterr: + cfunc(*args) + self.assertEqual(pyerr.exception.args, jiterr.exception.args) + + # special equality check for UDEs + if isinstance(pyerr.exception, (UDEArgsToSuper, UDENoArgSuper)): + self.assertTrue(pyerr.exception == jiterr.exception) + + # in npm check bottom of traceback matches as frame injection with + # location info should ensure this + if exec_mode is no_pyobj_flags: + + # we only care about the bottom two frames, the error and the + # location it was raised. + try: + pyfunc(*args) + except Exception: + py_frames = traceback.format_exception(*sys.exc_info()) + expected_frames = py_frames[-2:] + + try: + cfunc(*args) + except Exception: + c_frames = traceback.format_exception(*sys.exc_info()) + got_frames = c_frames[-2:] + + # check exception and the injected frame are the same + for expf, gotf in zip(expected_frames, got_frames): + # Note use of assertIn not assertEqual, Py 3.11 has markers (^) + # that point to the variable causing the problem, Numba doesn't + # do this so only the start of the string will match. + self.assertIn(gotf, expf) + + def check_raise_class(self, flags): + pyfunc = raise_class(MyError) + cfunc = jit((types.int32,), **flags)(pyfunc) + self.assertEqual(cfunc(0), 0) + self.check_against_python(flags, pyfunc, cfunc, MyError, 1) + self.check_against_python(flags, pyfunc, cfunc, ValueError, 2) + self.check_against_python(flags, pyfunc, cfunc, + np.linalg.LinAlgError, 3) + + def test_raise_class_nopython(self): + self.check_raise_class(flags=no_pyobj_flags) + + def test_raise_class_objmode(self): + self.check_raise_class(flags=force_pyobj_flags) + + def check_raise_instance(self, flags): + for clazz in [MyError, UDEArgsToSuper, + UDENoArgSuper]: + pyfunc = raise_instance(clazz, "some message") + cfunc = jit((types.int32,), **flags)(pyfunc) + + self.assertEqual(cfunc(0), 0) + self.check_against_python(flags, pyfunc, cfunc, clazz, 1) + self.check_against_python(flags, pyfunc, cfunc, ValueError, 2) + self.check_against_python(flags, pyfunc, cfunc, + np.linalg.LinAlgError, 3) + + def test_raise_instance_objmode(self): + self.check_raise_instance(flags=force_pyobj_flags) + + def test_raise_instance_nopython(self): + self.check_raise_instance(flags=no_pyobj_flags) + + def check_raise_nested(self, flags, **jit_args): + """ + Check exception propagation from nested functions. + """ + for clazz in [MyError, UDEArgsToSuper, + UDENoArgSuper]: + inner_pyfunc = raise_instance(clazz, "some message") + pyfunc = outer_function(inner_pyfunc) + inner_cfunc = jit(**jit_args)(inner_pyfunc) + cfunc = jit(**jit_args)(outer_function(inner_cfunc)) + + self.check_against_python(flags, pyfunc, cfunc, clazz, 1) + self.check_against_python(flags, pyfunc, cfunc, ValueError, 2) + self.check_against_python(flags, pyfunc, cfunc, OtherError, 3) + + def test_raise_nested_objmode(self): + self.check_raise_nested(force_pyobj_flags, forceobj=True) + + def test_raise_nested_nopython(self): + self.check_raise_nested(no_pyobj_flags, nopython=True) + + def check_reraise(self, flags): + def raise_exc(exc): + raise exc + pyfunc = reraise + cfunc = jit((), **flags)(pyfunc) + for op, err in [(lambda : raise_exc(ZeroDivisionError), + ZeroDivisionError), + (lambda : raise_exc(UDEArgsToSuper("msg", 1)), + UDEArgsToSuper), + (lambda : raise_exc(UDENoArgSuper("msg", 1)), + UDENoArgSuper)]: + def gen_impl(fn): + def impl(): + try: + op() + except err: + fn() + return impl + pybased = gen_impl(pyfunc) + cbased = gen_impl(cfunc) + self.check_against_python(flags, pybased, cbased, err,) + + def test_reraise_objmode(self): + self.check_reraise(flags=force_pyobj_flags) + + def test_reraise_nopython(self): + self.check_reraise(flags=no_pyobj_flags) + + def check_raise_invalid_class(self, cls, flags): + pyfunc = raise_class(cls) + cfunc = jit((types.int32,), **flags)(pyfunc) + with self.assertRaises(TypeError) as cm: + cfunc(1) + self.assertEqual(str(cm.exception), + "exceptions must derive from BaseException") + + def test_raise_invalid_class_objmode(self): + self.check_raise_invalid_class(int, flags=force_pyobj_flags) + self.check_raise_invalid_class(1, flags=force_pyobj_flags) + + def test_raise_invalid_class_nopython(self): + msg = "Encountered unsupported constant type used for exception" + with self.assertRaises(errors.UnsupportedError) as raises: + self.check_raise_invalid_class(int, flags=no_pyobj_flags) + self.assertIn(msg, str(raises.exception)) + with self.assertRaises(errors.UnsupportedError) as raises: + self.check_raise_invalid_class(1, flags=no_pyobj_flags) + self.assertIn(msg, str(raises.exception)) + + def test_raise_bare_string_nopython(self): + @njit + def foo(): + raise "illegal" + msg = ("Directly raising a string constant as an exception is not " + "supported") + with self.assertRaises(errors.UnsupportedError) as raises: + foo() + self.assertIn(msg, str(raises.exception)) + + def check_assert_statement(self, flags): + pyfunc = assert_usecase + cfunc = jit((types.int32,), **flags)(pyfunc) + cfunc(1) + self.check_against_python(flags, pyfunc, cfunc, AssertionError, 2) + + def test_assert_statement_objmode(self): + self.check_assert_statement(flags=force_pyobj_flags) + + def test_assert_statement_nopython(self): + self.check_assert_statement(flags=no_pyobj_flags) + + def check_raise_from_exec_string(self, flags): + # issue #3428 + simple_raise = "def f(a):\n raise exc('msg', 10)" + assert_raise = "def f(a):\n assert a != 1" + py312_pep695_raise = "def f[T: int](a: T) -> T:\n assert a != 1" + py312_pep695_raise_2 = "def f[T: int\n](a: T) -> T:\n assert a != 1" + test_cases = [ + (assert_raise, AssertionError), + (simple_raise, UDEArgsToSuper), + (simple_raise, UDENoArgSuper), + ] + if utils.PYVERSION >= (3, 12): + # Added for https://github.com/numba/numba/issues/9443 + test_cases.append((py312_pep695_raise, AssertionError)) + test_cases.append((py312_pep695_raise_2, AssertionError)) + for f_text, exc in test_cases: + loc = {} + exec(f_text, {'exc': exc}, loc) + pyfunc = loc['f'] + cfunc = jit((types.int32,), **flags)(pyfunc) + self.check_against_python(flags, pyfunc, cfunc, exc, 1) + + def test_assert_from_exec_string_objmode(self): + self.check_raise_from_exec_string(flags=force_pyobj_flags) + + def test_assert_from_exec_string_nopython(self): + self.check_raise_from_exec_string(flags=no_pyobj_flags) + + def check_user_code_error_traceback(self, flags): + # this test checks that if a user tries to compile code that contains + # a bug in exception initialisation (e.g. missing arg) then this also + # has a frame injected with the location information. + pyfunc = ude_bug_usecase + cfunc = jit((), **flags)(pyfunc) + self.check_against_python(flags, pyfunc, cfunc, TypeError) + + def test_user_code_error_traceback_objmode(self): + self.check_user_code_error_traceback(flags=force_pyobj_flags) + + def test_user_code_error_traceback_nopython(self): + self.check_user_code_error_traceback(flags=no_pyobj_flags) + + def check_raise_runtime_value(self, flags): + pyfunc = raise_runtime_value + cfunc = jit((types.string,), **flags)(pyfunc) + self.check_against_python(flags, pyfunc, cfunc, ValueError, 'hello') + + def test_raise_runtime_value_objmode(self): + self.check_raise_runtime_value(flags=force_pyobj_flags) + + def test_raise_runtime_value_nopython(self): + self.check_raise_runtime_value(flags=no_pyobj_flags_w_nrt) + + def test_raise_runtime_value_nogil(self): + self.check_raise_runtime_value(flags=no_gil_flags) + + def check_raise_instance_with_runtime_args(self, flags): + for clazz in [MyError, UDEArgsToSuper, + UDENoArgSuper]: + pyfunc = raise_instance_runtime_args(clazz) + cfunc = jit((types.int32, types.string), **flags)(pyfunc) + + self.assertEqual(cfunc(0, 'test'), 0) + self.check_against_python(flags, pyfunc, cfunc, clazz, 1, 'hello') + self.check_against_python(flags, pyfunc, cfunc, ValueError, 2, + 'world') + self.check_against_python(flags, pyfunc, cfunc, + np.linalg.LinAlgError, 3, 'linalg') + + def test_raise_instance_with_runtime_args_objmode(self): + self.check_raise_instance_with_runtime_args(flags=force_pyobj_flags) + + def test_raise_instance_with_runtime_args_nopython(self): + self.check_raise_instance_with_runtime_args(flags=no_pyobj_flags_w_nrt) + + def test_raise_instance_with_runtime_args_nogil(self): + self.check_raise_instance_with_runtime_args(flags=no_gil_flags) + + def test_dynamic_raise_bad_args(self): + def raise_literal_dict(): + raise ValueError({'a': 1, 'b': np.ones(4)}) + + def raise_range(): + raise ValueError(range(3)) + + def raise_rng(rng): + raise ValueError(rng.bit_generator) + + funcs = [ + (raise_literal_dict, ()), + (raise_range, ()), + (raise_rng, (types.npy_rng,)), + ] + + for pyfunc, argtypes in funcs: + msg = '.*Cannot convert native .* to a Python object.*' + with self.assertRaisesRegex(errors.TypingError, msg): + njit(argtypes)(pyfunc) + + def test_dynamic_raise_dict(self): + @njit + def raise_literal_dict2(): + raise ValueError({'a': 1, 'b': 3}) + + msg = "{a: 1, b: 3}" + with self.assertRaisesRegex(ValueError, msg): + raise_literal_dict2() + + def test_dynamic_raise_literal_message(self): + @njit + def raise_literal_message(a): + if a == 0: + msg = "A was 0" + raise ValueError(msg) + if a == 1: + msg = "A was 1" + raise ValueError(msg) + if a == 2: + msg = "A was 2" + raise ValueError(msg) + + for i in range(3): + with self.subTest(i=i): + with self.assertRaises(ValueError) as raises: + raise_literal_message(i) + self.assertEqual(str(raises.exception), f"A was {i}") + + def test_dynamic_raise_single_literal_message(self): + @njit + def raise_single_literal_message(arg): + msg = "False" + if arg: + msg = "True" + raise ValueError(msg) + + for arg in (False, True): + with self.subTest(arg=arg): + with self.assertRaises(ValueError) as raises: + raise_single_literal_message(arg) + self.assertEqual(str(raises.exception), str(arg)) + + def test_dynamic_raise_mixed_int_width(self): + @njit + def raise_mixed_int_width(a): + if a == 0: + value = np.int64(-7) + raise ValueError(value) + value = np.uint64(2 ** 63) + raise ValueError(value) + + cases = [(0, "-7"), (1, str(2 ** 63))] + for arg, expected in cases: + with self.subTest(arg=arg): + with self.assertRaises(ValueError) as raises: + raise_mixed_int_width(arg) + self.assertEqual(str(raises.exception), expected) + + def test_disable_nrt(self): + @njit(_nrt=False) + def raise_with_no_nrt(i): + raise ValueError(i) + + msg = 'NRT required but not enabled' + with self.assertRaisesRegex(errors.NumbaRuntimeError, msg): + raise_with_no_nrt(123) + + def test_try_raise(self): + + @njit + def raise_(a): + raise ValueError(a) + + @njit + def try_raise(a): + try: + raise_(a) + except Exception: + pass + return a + 1 + + self.assertEqual(try_raise.py_func(3), try_raise(3)) + + @expected_failure_py311 + @expected_failure_py312 + @expected_failure_py313 + @expected_failure_py314 + @expected_failure_py315 + def test_dynamic_raise(self): + + @njit + def raise_(a): + raise ValueError(a) + + @njit + def try_raise_(a): + try: + raise_(a) + except Exception: + raise ValueError(a) + + args = [ + 1, + 1.1, + 'hello', + np.ones(3), + [1, 2], + (1, 2), + set([1, 2]), + ] + for fn in (raise_, try_raise_): + for arg in args: + with self.assertRaises(ValueError) as e: + fn(arg) + self.assertEqual((arg,), e.exception.args) + + +if __name__ == '__main__': + unittest.main() diff --git a/shared/package-files/32/324b55e45fa06b8bcf5f8a185d949a16c35222804de38b8e3e366df986ba1bb0/blob b/shared/package-files/32/324b55e45fa06b8bcf5f8a185d949a16c35222804de38b8e3e366df986ba1bb0/blob new file mode 100644 index 0000000000000000000000000000000000000000..33bbdb86b8125ae28498f0d807854c12d47d9b7e --- /dev/null +++ b/shared/package-files/32/324b55e45fa06b8bcf5f8a185d949a16c35222804de38b8e3e366df986ba1bb0/blob @@ -0,0 +1,11 @@ +prefix=/opt/conda +exec_prefix=/opt/conda +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: fmt +Description: A modern formatting library +Version: 9.1.0 +Libs: -L${libdir} -lfmt +Cflags: -I${includedir} + diff --git a/shared/package-files/32/324bc7df8f8707e7b1a3955e92bafefc71c0b40ed40d6e151c07fc8f50d8672e/blob b/shared/package-files/32/324bc7df8f8707e7b1a3955e92bafefc71c0b40ed40d6e151c07fc8f50d8672e/blob new file mode 100644 index 0000000000000000000000000000000000000000..cec99a843301c3d0c80e3746ac5e565b5cf634d9 --- /dev/null +++ b/shared/package-files/32/324bc7df8f8707e7b1a3955e92bafefc71c0b40ed40d6e151c07fc8f50d8672e/blob @@ -0,0 +1,1286 @@ +#pragma once + +// Parse arguments to Python functions implemented in C++ +// This is similar to PyArg_ParseTupleAndKeywords(), but specifically handles +// the types relevant to PyTorch and distinguishes between overloaded function +// signatures. +// +// Example: +// +// static PythonArgParser parser({ +// "norm(Scalar p, int64_t dim, bool keepdim=False)", +// "norm(Scalar p=2)", +// }); +// ParsedArgs<3> parsed_args; +// auto r = parser.parse(args, kwargs, parsed_args); +// if (r.idx == 0) { +// norm(r.scalar(0), r.int64(1), r.bool(0)); +// } else { +// norm(r.scalar(0)); +// } +// +// We auto-generate most uses of PythonArgParser; the generated files +// are torch/csrc/autograd/generated/python_*.cpp +// +// Some gotchas that you should watch out for: +// +// - Note [Order of overloads matters] +// Order of overloads matters. A set of input arguments may +// bind to multiple argument specs; we will always pick the +// first one in PythonArgParser. However, when you are writing +// overloads in, e.g., native_functions.yaml, you don't have to +// worry about what order you write them, because the code +// generation logic always gives the overloads a canonical +// order, where Tensor overloads come first, before Scalar overloads. +// This logic is in sort_declarations in +// tools/autograd/gen_python_functions.py +// +// - Zero-dim tensors (e.g., torch.tensor(2)) bind to both +// Scalar and Tensor, UNLESS they require grad (in which case +// they only bind to Tensor). + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +inline bool THPUtils_checkScalar(PyObject* obj) { +#ifdef USE_NUMPY + if (torch::utils::is_numpy_scalar(obj)) { + return true; + } +#endif + return PyFloat_Check(obj) || PyLong_Check(obj) || PyComplex_Check(obj) || + torch::is_symint(py::handle(obj)) || + torch::is_symfloat(py::handle(obj)) || torch::is_symbool(py::handle(obj)); +} + +namespace torch { + +bool should_allow_numbers_as_tensors(const std::string& name); + +enum class ParameterType { + TENSOR, + SCALAR, + INT64, + SYM_INT, + DOUBLE, + COMPLEX, + TENSOR_LIST, + INT_LIST, + GENERATOR, + BOOL, + STORAGE, + PYOBJECT, + SCALARTYPE, + LAYOUT, + MEMORY_FORMAT, + DEVICE, + STREAM, + STRING, + DIMNAME, + DIMNAME_LIST, + QSCHEME, + FLOAT_LIST, + SCALAR_LIST, + SYM_INT_LIST, + DISPATCH_KEY_SET +}; + +struct FunctionParameter; +struct FunctionSignature; +struct PythonArgs; + +// Contains bound Python arguments in declaration order +template +struct ParsedArgs { + ParsedArgs() : args() {} + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays) + PyObject* args[N]; +}; + +// A PythonArgParser contains a list of valid signatures. Instances are +// typically global variables and should be immutable. +struct PYBIND11_EXPORT PythonArgParser { + explicit PythonArgParser( + const std::vector& fmts, + bool traceable = false); + + // meant only for `torch` functions. + template + inline PythonArgs parse( + PyObject* self, + PyObject* args, + PyObject* kwargs, + ParsedArgs& dst); + + template + inline PythonArgs parse(PyObject* args, PyObject* kwargs, ParsedArgs& dst); + + inline PythonArgs parse(PyObject* self, ParsedArgs<0>& dst); + + // Formatted strings of non-hidden signatures + std::vector get_signatures() const; + + private: + [[noreturn]] void print_error( + PyObject* self, + PyObject* args, + PyObject* kwargs, + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays) + PyObject* parsed_args[]); + void check_deprecated(const FunctionSignature& signature); + PythonArgs raw_parse( + PyObject* self, + PyObject* args, + PyObject* kwargs, + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays) + PyObject* parsed_args[]); + + std::vector signatures_; + std::string function_name; + size_t max_args; + bool traceable; +}; + +// FunctionSignature represents a single valid signature for a Python function. +// It is immutable once constructed. The contained data can be concurrently +// accessed by multiple calls. +struct FunctionSignature { + explicit FunctionSignature(const std::string& fmt, int index); + + bool parse( + PyObject* self, + PyObject* args, + PyObject* kwargs, + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays) + PyObject* dst[], + std::vector& overloaded_args, + bool raise_exception); + + std::string toString() const; + + std::string name; + std::vector params; + size_t min_args; + size_t max_args; + size_t max_pos_args; + int index; + bool hidden; + bool deprecated; +}; + +// PythonArgs contains bound Python arguments for an actual invocation +// along with references to the matched signature. +struct PythonArgs { + PythonArgs( + bool traceable, + const FunctionSignature& signature, + PyObject** args, + std::vector overloaded_args) + : idx(signature.index), + traceable(traceable), + signature(signature), + args(args), + overloaded_args(std::move(overloaded_args)) {} + + int idx; + bool traceable; + const FunctionSignature& signature; + PyObject** args; + std::vector overloaded_args; // NOTE: borrowed references + + inline bool has_torch_function(); + inline std::string get_func_name(); + inline at::Tensor tensor(int i); + inline c10::optional optionalTensor(int i); + inline at::Scalar scalar(int i); + inline at::Scalar scalarWithDefault(int i, const at::Scalar& default_scalar); + inline std::vector scalarlist(int i); + inline std::vector tensorlist(int i); + inline torch::List> list_of_optional_tensors(int i); + template + inline std::array tensorlist_n(int i); + inline std::vector intlist(int i); + inline std::vector symintlist(int i); + inline c10::OptionalArray intlistOptional(int i); + inline c10::OptionalArray symintlistOptional(int i); + inline std::vector intlistWithDefault( + int i, + std::vector default_intlist); + inline c10::optional generator(int i); + inline at::Storage storage(int i); + inline at::Storage storage( + int i, + at::ScalarType& storage_scalar_type, + bool& is_typed_storage); + inline c10::Stream stream(int i); + inline at::ScalarType scalartype(int i); + inline at::ScalarType scalartypeWithDefault( + int i, + at::ScalarType default_scalartype); + inline c10::optional scalartypeOptional(int i); + inline c10::optional scalarOptional(int i); + inline c10::optional toInt64Optional(int i); + inline c10::optional toSymIntOptional(int i); + inline c10::optional toBoolOptional(int i); + inline c10::optional toDoubleOptional(int i); + inline c10::OptionalArray doublelistOptional(int i); + inline std::vector doublelist(int i); + inline std::vector getDoublelist(int i); + inline at::Layout layout(int i); + inline at::Layout layoutWithDefault(int i, at::Layout default_layout); + inline c10::optional layoutOptional(int i); + inline at::Device device(int i); + inline at::Device deviceWithDefault(int i, const at::Device& default_device); + inline c10::optional deviceOptional(int i); + inline at::Dimname dimname(int i); + inline std::vector dimnamelist(int i); + inline c10::optional> toDimnameListOptional(int i); + inline at::MemoryFormat memoryformat(int i); + inline c10::optional memoryformatOptional(int i); + inline at::QScheme toQScheme(int i); + inline std::string string(int i); + inline std::string stringWithDefault(int i, const std::string& default_str); + inline c10::optional stringOptional(int i); + inline c10::string_view stringView(int i); + inline c10::string_view stringViewWithDefault( + int i, + const c10::string_view default_str); + inline c10::optional stringViewOptional(int i); + inline PyObject* pyobject(int i); + inline int64_t toInt64(int i); + inline c10::SymInt toSymInt(int i); + inline c10::SymBool toSymBool(int i); + inline int64_t toInt64WithDefault(int i, int64_t default_int); + inline double toDouble(int i); + inline double toDoubleWithDefault(int i, double default_double); + inline c10::complex toComplex(int i); + inline c10::complex toComplexWithDefault( + int i, + c10::complex default_complex); + inline bool toBool(int i); + inline bool toBoolWithDefault(int i, bool default_bool); + inline bool isNone(int i); + inline c10::optional toDispatchKeySetOptional(int i); + + private: + at::Tensor tensor_slow(int i); + at::Scalar scalar_slow(int i); + at::Scalar scalar_slow(PyObject* arg); +}; + +// FunctionParameter is a single formal parameter of a Python function. +// It is immutable once constructed. +struct FunctionParameter { + FunctionParameter(const std::string& fmt, bool keyword_only); + + bool check( + PyObject* obj, + std::vector& overloaded_args, + int argnum, + int64_t* failed_idx = nullptr); + + void set_default_str(const std::string& str); + std::string type_name() const; + + ParameterType type_; + bool optional; + bool allow_none; + bool keyword_only; + bool allow_numbers_as_tensors = false; + int size; + std::string name; + // having this as a raw PyObject * will presumably leak it, but these are only + // held by static objects anyway, and Py_Finalize can already be called when + // this is destructed. + PyObject* python_name; + // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) + at::SmallVector numpy_python_names; + at::Scalar default_scalar; + std::vector default_intlist; + std::string default_string; + union { + bool default_bool; + int64_t default_int; + double default_double; + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays) + double default_complex[2]; // see Scalar + at::ScalarType default_scalartype; + at::Layout default_layout; + }; +}; + +template +inline PythonArgs PythonArgParser::parse( + PyObject* self, + PyObject* args, + PyObject* kwargs, + ParsedArgs& dst) { + TORCH_CHECK_VALUE( + N >= max_args, + "PythonArgParser: dst ParsedArgs buffer does not have enough capacity, expected ", + max_args, + " (got ", + N, + ")"); + return raw_parse(self, args, kwargs, dst.args); +} + +template +inline PythonArgs PythonArgParser::parse( + PyObject* args, + PyObject* kwargs, + ParsedArgs& dst) { + return parse(nullptr, args, kwargs, dst); +} + +inline PythonArgs PythonArgParser::parse(PyObject* self, ParsedArgs<0>& dst) { + return parse(self, nullptr, nullptr, dst); +} + +inline bool PythonArgs::has_torch_function() { + return !overloaded_args.empty() || at::impl::torch_function_mode_enabled(); +} + +inline std::string PythonArgs::get_func_name() { + return signature.name; +} + +// TODO: this can return MaybeOwned +inline at::Tensor PythonArgs::tensor(int i) { + if (args[i] && THPVariable_CheckExact(args[i])) { + return THPVariable_Unpack(args[i]); + } + return tensor_slow(i); +} + +inline c10::optional PythonArgs::optionalTensor(int i) { + at::Tensor t = tensor(i); + // NOLINTNEXTLINE(bugprone-branch-clone) + if (t.defined()) { + return t; + } else { + return c10::nullopt; + } +} + +inline at::Scalar PythonArgs::scalar(int i) { + if (!args[i]) + return signature.params[i].default_scalar; + return scalar_slow(i); +} + +inline std::vector PythonArgs::scalarlist(int i) { + if (!args[i]) + return std::vector(); + auto tuple = six::isTuple(args[i]); + THPObjectPtr arg = six::maybeAsTuple(args[i]); + // NOLINTNEXTLINE(bugprone-branch-clone) + auto size = tuple ? PyTuple_GET_SIZE(arg.get()) : PyList_GET_SIZE(arg.get()); + std::vector res(size); + for (const auto idx : c10::irange(size)) { + PyObject* obj = tuple ? PyTuple_GET_ITEM(arg.get(), idx) + : PyList_GET_ITEM(arg.get(), idx); + res[idx] = scalar_slow(obj); + } + return res; +} + +inline at::Scalar PythonArgs::scalarWithDefault( + int i, + const at::Scalar& default_scalar) { + if (!args[i]) + return default_scalar; + return scalar_slow(i); +} + +inline c10::optional PythonArgs::scalarOptional(int i) { + if (!args[i]) + return c10::nullopt; + return scalar_slow(i); +} + +inline std::vector PythonArgs::tensorlist(int i) { + if (!args[i]) + return std::vector(); + auto tuple = six::isTuple(args[i]); + THPObjectPtr arg = six::maybeAsTuple(args[i]); + // NOLINTNEXTLINE(bugprone-branch-clone) + auto size = tuple ? PyTuple_GET_SIZE(arg.get()) : PyList_GET_SIZE(arg.get()); + std::vector res(size); + for (const auto idx : c10::irange(size)) { + PyObject* obj = tuple ? PyTuple_GET_ITEM(arg.get(), idx) + : PyList_GET_ITEM(arg.get(), idx); + // This is checked by the argument parser so it's safe to cast without + // checking if this is a tensor first + res[idx] = THPVariable_Unpack(obj); + } + return res; +} + +inline torch::List> PythonArgs:: + list_of_optional_tensors(int i) { + if (!args[i]) + return torch::List>(); + auto tuple = six::isTuple(args[i]); + THPObjectPtr arg = six::maybeAsTuple(args[i]); + // NOLINTNEXTLINE(bugprone-branch-clone) + auto size = tuple ? PyTuple_GET_SIZE(arg.get()) : PyList_GET_SIZE(arg.get()); + torch::List> res; + res.reserve(size); + for (const auto idx : c10::irange(size)) { + PyObject* obj = tuple ? PyTuple_GET_ITEM(arg.get(), idx) + : PyList_GET_ITEM(arg.get(), idx); + // This is checked by the argument parser so it's safe to cast without + // checking if this is a tensor first + res.push_back(THPVariable_Unpack(obj)); + } + return res; +} + +template +inline std::array PythonArgs::tensorlist_n(int i) { + auto res = std::array(); + if (!args[i]) + return res; + auto tuple = six::isTuple(args[i]); + THPObjectPtr arg = six::maybeAsTuple(args[i]); + // NOLINTNEXTLINE(bugprone-branch-clone) + auto size = tuple ? PyTuple_GET_SIZE(arg.get()) : PyList_GET_SIZE(arg.get()); + if (size != N) { + throw TypeError("expected tuple of %d elements but got %d", N, (int)size); + } + for (const auto idx : c10::irange(size)) { + PyObject* obj = tuple ? PyTuple_GET_ITEM(arg.get(), idx) + : PyList_GET_ITEM(arg.get(), idx); + // This is checked by the argument parser so it's safe to cast without + // checking if this is a tensor first + res[idx] = THPVariable_Unpack(obj); + } + return res; +} + +inline std::vector PythonArgs::intlist(int i) { + return intlistWithDefault(i, signature.params[i].default_intlist); +} + +inline PyObject* toPyObject(c10::SymInt symint) { + if (symint.is_symbolic()) { + auto r = py::cast(symint).release().ptr(); + TORCH_INTERNAL_ASSERT(r); + return r; + } else { + auto m = symint.maybe_as_int(); + return THPUtils_packInt64(*m); + } +} + +inline void throw_intlist_exception( + const torch::PythonArgs* args, + size_t i, + PyObject* obj, + size_t idx, + const std::exception& e = python_error()) { + std::string error = strlen(e.what()) + ? e.what() + : std::string("type must be ") + args->signature.params[i].type_name() + + ",but got " + Py_TYPE(obj)->tp_name; + throw TypeError( + "%s(): argument '%s' failed to unpack the object at pos %zu with error \"%s\"", + args->signature.name.c_str(), + args->signature.params[i].name.c_str(), + idx + 1, + error.c_str()); +} + +inline std::vector PythonArgs::symintlist(int i) { + if (!args[i]) { + return c10::fmap(signature.params[i].default_intlist, [](int64_t di) { + return c10::SymInt(di); + }); + } + + const auto size1 = signature.params[i].size; + if (size1 > 0 && THPUtils_checkLong(args[i])) { + return std::vector( + size1, c10::SymInt(THPUtils_unpackLong(args[i]))); + } + + if (size1 > 0 && torch::is_symint(py::handle(args[i]))) { + auto si = py::handle(args[i]).cast(); + return std::vector(size1, si); + } + + PyObject* arg = args[i]; + auto tuple = PyTuple_Check(arg); + // NOLINTNEXTLINE(bugprone-branch-clone) + const auto size2 = tuple ? PyTuple_GET_SIZE(arg) : PyList_GET_SIZE(arg); + std::vector res; + res.reserve(size2); + for (const auto idx : c10::irange(size2)) { + PyObject* obj = + tuple ? PyTuple_GET_ITEM(arg, idx) : PyList_GET_ITEM(arg, idx); + + // Elements of torch.Size are tensors during tracing, and we need to + // record extra information before they are turned into an IntArrayRef + if (traceable && jit::tracer::isTracing() && THPVariable_Check(obj)) { + auto& var = THPVariable_Unpack(obj); + jit::tracer::ArgumentStash::stashIntArrayRefElem( + signature.params[i].name, size2, idx, var); + try { + res.emplace_back(var.item()); + continue; + } catch (std::exception& e) { + throw_intlist_exception(this, i, obj, idx, e); + } + continue; + } else { + // convert tensor to scalar outside of try / catch, + // so that Tensor subclass exceptions will not be caught. + if (THPUtils_checkLongExact(obj)) { + // Fast path for plain numbers + try { + res.emplace_back(THPUtils_unpackLong(obj)); + } catch (std::exception& e) { + throw_intlist_exception(this, i, obj, idx, e); + } + } else if (THPVariable_Check(obj)) { + auto& var = THPVariable_Unpack(obj); + if (var.numel() != 1 || + !at::isIntegralType( + var.dtype().toScalarType(), /*include_bool*/ true)) { + throw_intlist_exception(this, i, obj, idx); + } + auto scalar = var.item(); + TORCH_CHECK(scalar.isIntegral(/*include bool*/ false)); + res.push_back(scalar.toSymInt()); + } else { + try { + if (is_symint(py::handle(obj))) { + res.push_back(py::handle(obj).cast()); + } else { + res.emplace_back(THPUtils_unpackIndex(obj)); + } + } catch (std::exception& e) { + throw_intlist_exception(this, i, obj, idx, e); + } + } + } + } + + return res; +} + +inline std::vector PythonArgs::intlistWithDefault( + int i, + std::vector default_intlist) { + if (!args[i]) + return default_intlist; + PyObject* arg = args[i]; + const auto size1 = signature.params[i].size; + if (size1 > 0 && THPUtils_checkLong(arg)) { + return std::vector(size1, THPUtils_unpackLong(arg)); + } + if (size1 > 0 && torch::is_symint(py::handle(arg))) { + return std::vector( + size1, + py::handle(arg).cast().guard_int(__FILE__, __LINE__)); + } + auto tuple = PyTuple_Check(arg); + // NOLINTNEXTLINE(bugprone-branch-clone) + const auto size2 = tuple ? PyTuple_GET_SIZE(arg) : PyList_GET_SIZE(arg); + std::vector res(size2); + for (const auto idx : c10::irange(size2)) { + PyObject* obj = + tuple ? PyTuple_GET_ITEM(arg, idx) : PyList_GET_ITEM(arg, idx); + // Elements of torch.Size are tensors during tracing, and we need to + // record extra information before they are turned into an IntArrayRef + if (traceable && jit::tracer::isTracing() && THPVariable_Check(obj)) { + auto& var = THPVariable_Unpack(obj); + jit::tracer::ArgumentStash::stashIntArrayRefElem( + signature.params[i].name, size2, idx, var); + try { + res[idx] = var.item(); + continue; + } catch (std::exception& e) { + throw_intlist_exception(this, i, obj, idx, e); + } + } else { + // convert tensor to scalar outside of try / catch, + // so that Tensor subclass exceptions will not be caught. + if (THPUtils_checkLongExact(obj)) { + // Fast path for plain numbers + try { + res[idx] = THPUtils_unpackLong(obj); + } catch (std::exception& e) { + throw_intlist_exception(this, i, obj, idx, e); + } + } else if (torch::is_symint(py::handle(obj))) { + res[idx] = py::cast(py::handle(obj)) + .guard_int(__FILE__, __LINE__); + } else if (THPVariable_Check(obj)) { + auto& var = THPVariable_Unpack(obj); + if (var.numel() != 1 || + !at::isIntegralType( + var.dtype().toScalarType(), /*include_bool*/ true)) { + throw_intlist_exception(this, i, obj, idx); + } + res[idx] = var.item(); + } else { + try { + res[idx] = THPUtils_unpackIndex(obj); + } catch (std::exception& e) { + throw_intlist_exception(this, i, obj, idx, e); + } + } + } + } + return res; +} + +inline c10::OptionalArray PythonArgs::intlistOptional(int i) { + if (!args[i]) { + return {}; + } + return intlist(i); +} + +inline c10::OptionalArray PythonArgs::symintlistOptional(int i) { + if (!args[i]) { + return {}; + } + return symintlist(i); +} + +inline std::vector PythonArgs::getDoublelist(int i) { + PyObject* arg = args[i]; + auto tuple = PyTuple_Check(arg); + // NOLINTNEXTLINE(bugprone-branch-clone) + auto size = tuple ? PyTuple_GET_SIZE(arg) : PyList_GET_SIZE(arg); + std::vector res(size); + for (const auto idx : c10::irange(size)) { + PyObject* obj = + tuple ? PyTuple_GET_ITEM(arg, idx) : PyList_GET_ITEM(arg, idx); + try { + res[idx] = THPUtils_unpackDouble(obj); + } catch (const std::exception& e) { + throw TypeError( + "%s(): argument '%s' must be %s, but found element of type %s at pos %zu", + signature.name.c_str(), + signature.params[i].name.c_str(), + signature.params[i].type_name().c_str(), + Py_TYPE(obj)->tp_name, + idx + 1); + } + } + return res; +} + +inline c10::OptionalArray PythonArgs::doublelistOptional(int i) { + if (!args[i]) { + return {}; + } + return this->getDoublelist(i); +} + +inline std::vector PythonArgs::doublelist(int i) { + if (!args[i]) { + return {}; + } + return this->getDoublelist(i); +} + +inline c10::optional PythonArgs::toDispatchKeySetOptional( + int i) { + if (!args[i]) { + return {}; + } + return py::cast(py::handle(args[i])); +} + +inline at::ScalarType PythonArgs::scalartypeWithDefault( + int i, + at::ScalarType default_scalartype) { + if (!args[i]) + return default_scalartype; + return scalartype(i); +} + +inline at::ScalarType toScalarType(PyObject* obj) { + if (obj == (PyObject*)&PyFloat_Type) { + return at::ScalarType::Double; + } + if (obj == (PyObject*)&PyBool_Type) { + return at::ScalarType::Bool; + } + if (obj == (PyObject*)&PyLong_Type) { + return at::ScalarType::Long; + } + return reinterpret_cast(obj)->scalar_type; +} + +inline at::ScalarType PythonArgs::scalartype(int i) { + if (!args[i]) { + auto scalartype = signature.params[i].default_scalartype; + return (scalartype == at::ScalarType::Undefined) + ? torch::tensors::get_default_scalar_type() + : scalartype; + } + PyObject* obj = args[i]; + return toScalarType(obj); +} + +inline c10::optional PythonArgs::scalartypeOptional(int i) { + if (!args[i]) + return c10::nullopt; + return scalartype(i); +} + +inline at::Layout toLayout(PyObject* obj) { + const auto layout = reinterpret_cast(obj); + return layout->layout; +} + +inline at::Layout PythonArgs::layout(int i) { + if (!args[i]) + return signature.params[i].default_layout; + return toLayout(args[i]); +} + +inline at::Layout PythonArgs::layoutWithDefault( + int i, + at::Layout default_layout) { + if (!args[i]) + return default_layout; + return layout(i); +} + +inline c10::optional PythonArgs::layoutOptional(int i) { + if (!args[i]) + return c10::nullopt; + return layout(i); +} + +inline at::Device toDevice(PyObject* obj) { + if (THPDevice_Check(obj)) { + const auto device = reinterpret_cast(obj); + return device->device; + } + if (THPUtils_checkLong(obj)) { + const auto device_index = THPUtils_unpackLong(obj); + TORCH_CHECK(device_index >= 0, "Device index must not be negative"); + if (c10::is_privateuse1_backend_registered()) { + return at::Device( + c10::DeviceType::PrivateUse1, + static_cast(device_index)); + } + return at::Device( + c10::DeviceType::CUDA, static_cast(device_index)); + } + const std::string& device_str = THPUtils_unpackString(obj); + return at::Device(device_str); +} + +inline at::Device PythonArgs::device(int i) { + if (!args[i]) { + return torch::tensors::get_default_device(); + } + return toDevice(args[i]); +} + +inline at::Device PythonArgs::deviceWithDefault( + int i, + const at::Device& default_device) { + if (!args[i]) + return default_device; + return device(i); +} + +inline c10::optional PythonArgs::deviceOptional(int i) { + if (!args[i]) + return c10::nullopt; + return device(i); +} + +inline at::Dimname PythonArgs::dimname(int i) { + TORCH_INTERNAL_ASSERT(args[i] != nullptr); + return THPDimname_parse(args[i]); +} + +inline std::vector parseDimnameList(PyObject* arg) { + auto tuple = PyTuple_Check(arg); + // NOLINTNEXTLINE(bugprone-branch-clone) + auto size = tuple ? PyTuple_GET_SIZE(arg) : PyList_GET_SIZE(arg); + std::vector res; + res.reserve(size); + for (const auto idx : c10::irange(size)) { + PyObject* obj = + tuple ? PyTuple_GET_ITEM(arg, idx) : PyList_GET_ITEM(arg, idx); + res.push_back(THPDimname_parse(obj)); + } + return res; +} + +inline c10::optional> PythonArgs:: + toDimnameListOptional(int i) { + if (!args[i]) + return c10::nullopt; + return parseDimnameList(args[i]); +} + +inline std::vector PythonArgs::dimnamelist(int i) { + TORCH_INTERNAL_ASSERT(args[i]); + PyObject* arg = args[i]; + auto size = signature.params[i].size; + TORCH_INTERNAL_ASSERT(size == 0 || size == 1); + if (size == 1 && THPUtils_checkDimname(arg)) { + return {THPDimname_parse(arg)}; + } + return parseDimnameList(arg); +} + +inline at::MemoryFormat PythonArgs::memoryformat(int i) { + if (!args[i]) + return at::MemoryFormat::Contiguous; + TORCH_CHECK( + THPMemoryFormat_Check(args[i]), + "memory_format arg must be an instance of the torch.memory_format"); + const auto memory_format = reinterpret_cast(args[i]); + return memory_format->memory_format; +} + +inline c10::optional PythonArgs::memoryformatOptional(int i) { + if (!args[i]) + return c10::nullopt; + return memoryformat(i); +} + +inline at::QScheme PythonArgs::toQScheme(int i) { + if (!args[i]) + return at::kPerTensorAffine; + TORCH_CHECK( + THPQScheme_Check(args[i]), + "qscheme arg must be an instance of the torch.qscheme"); + const auto qscheme = reinterpret_cast(args[i]); + return qscheme->qscheme; +} + +inline std::string PythonArgs::string(int i) { + return stringWithDefault(i, signature.params[i].default_string); +} + +inline std::string PythonArgs::stringWithDefault( + int i, + const std::string& default_str) { + if (!args[i]) + return default_str; + return THPUtils_unpackString(args[i]); +} + +inline c10::optional PythonArgs::stringOptional(int i) { + if (!args[i]) + return c10::nullopt; + return THPUtils_unpackString(args[i]); +} + +inline c10::string_view PythonArgs::stringView(int i) { + return stringViewWithDefault(i, signature.params[i].default_string); +} + +inline c10::string_view PythonArgs::stringViewWithDefault( + int i, + const c10::string_view default_str) { + if (!args[i]) + return default_str; + return THPUtils_unpackStringView(args[i]); +} + +inline c10::optional PythonArgs::stringViewOptional(int i) { + if (!args[i]) + return c10::nullopt; + return THPUtils_unpackStringView(args[i]); +} + +inline int64_t PythonArgs::toInt64(int i) { + if (!args[i]) + return signature.params[i].default_int; + if (traceable && jit::tracer::isTracing() && THPVariable_Check(args[i])) { + auto& var = THPVariable_Unpack(args[i]); + jit::tracer::ArgumentStash::stashValue( + signature.params[i].name, idx, var, c10::IntType::get()); + } + if (torch::is_symint(py::handle(args[i]))) { + return py::cast(py::handle(args[i])) + .guard_int(__FILE__, __LINE__); + } + return THPUtils_unpackLong(args[i]); +} + +inline c10::SymInt PythonArgs::toSymInt(int i) { + if (!args[i]) { + return c10::SymInt(signature.params[i].default_int); + } + + if (traceable && jit::tracer::isTracing() && THPVariable_Check(args[i])) { + auto& var = THPVariable_Unpack(args[i]); + jit::tracer::ArgumentStash::stashValue( + signature.params[i].name, idx, var, c10::IntType::get()); + } + + return py::cast(py::handle(args[i])); +} + +inline c10::SymBool PythonArgs::toSymBool(int i) { + if (!args[i]) { + return c10::SymBool(signature.params[i].default_bool); + } + if (traceable && jit::tracer::isTracing() && THPVariable_Check(args[i])) { + auto& var = THPVariable_Unpack(args[i]); + jit::tracer::ArgumentStash::stashValue( + signature.params[i].name, idx, var, c10::BoolType::get()); + } + + return py::cast(py::handle(args[i])); +} + +inline int64_t PythonArgs::toInt64WithDefault(int i, int64_t default_int) { + if (!args[i]) + return default_int; + return toInt64(i); +} + +inline c10::optional PythonArgs::toInt64Optional(int i) { + if (!args[i]) + return c10::nullopt; + return toInt64(i); +} + +inline c10::optional PythonArgs::toSymIntOptional(int i) { + if (!args[i]) + return c10::nullopt; + return toSymInt(i); +} + +inline c10::optional PythonArgs::toBoolOptional(int i) { + if (!args[i]) { + return c10::nullopt; + } + return toBool(i); +} + +inline c10::optional PythonArgs::toDoubleOptional(int i) { + if (!args[i]) { + return c10::nullopt; + } + return toDouble(i); +} + +inline double PythonArgs::toDouble(int i) { + if (!args[i]) + return signature.params[i].default_double; + if (torch::is_symfloat(py::handle(args[i]))) { + return py::cast(py::handle(args[i])) + .guard_float(__FILE__, __LINE__); + } + if (torch::is_symint(py::handle(args[i]))) { + return static_cast(py::cast(py::handle(args[i])) + .guard_int(__FILE__, __LINE__)); + } + return THPUtils_unpackDouble(args[i]); +} + +inline bool PythonArgs::toBool(int i) { + if (!args[i]) + return signature.params[i].default_bool; + if (torch::is_symbool(py::handle(args[i]))) { + return py::cast(py::handle(args[i])) + .guard_bool(__FILE__, __LINE__); + } + return args[i] == Py_True; +} + +inline double PythonArgs::toDoubleWithDefault(int i, double default_double) { + if (!args[i]) + return default_double; + return toDouble(i); +} + +inline c10::complex PythonArgs::toComplex(int i) { + if (!args[i]) + return *(reinterpret_cast*>( + signature.params[i].default_complex)); + return THPUtils_unpackComplexDouble(args[i]); +} + +inline c10::complex PythonArgs::toComplexWithDefault( + int i, + c10::complex default_value) { + if (!args[i]) + return default_value; + return toComplex(i); +} + +inline bool PythonArgs::toBoolWithDefault(int i, bool default_bool) { + if (!args[i]) + return default_bool; + return toBool(i); +} + +inline bool PythonArgs::isNone(int i) { + return args[i] == nullptr; +} + +inline c10::optional PythonArgs::generator(int i) { + if (!args[i]) + return c10::nullopt; + return reinterpret_cast(args[i])->cdata; +} + +inline at::Storage PythonArgs::storage(int i) { + if (!args[i]) + return at::Storage(); + return createStorage(args[i]); +} + +inline at::Storage PythonArgs::storage( + int i, + at::ScalarType& storage_scalar_type, + bool& is_typed_storage) { + at::Storage storage; + if (!args[i]) { + storage = at::Storage(); + is_typed_storage = false; + storage_scalar_type = at::ScalarType::Undefined; + } else { + std::tie(storage, storage_scalar_type, is_typed_storage) = + createStorageGetType(args[i]); + } + return storage; +} + +inline c10::Stream PythonArgs::stream(int i) { + if (!args[i]) + return c10::Stream( + c10::Stream::Default::DEFAULT, c10::Device(c10::DeviceType::CPU, -1)); + if (!THPStream_Check(args[i])) { + throw TypeError( + "expected Stream object. Got '%s'", Py_TYPE(args[i])->tp_name); + } + return c10::Stream::unpack3( + ((THPStream*)args[i])->stream_id, + static_cast(((THPStream*)args[i])->device_index), + static_cast(((THPStream*)args[i])->device_type)); +} + +inline PyObject* PythonArgs::pyobject(int i) { + if (!args[i]) + return Py_None; + return args[i]; +} + +/* + * + * Handle __torch_function__ overrides if we know that there are overloaded + * arguments. All objects stored in r.overloaded_args must have a + * __torch_function__ implementation and the arguments must be ordered in order + * of precedence. Precedence goes from left to right in the order of the + * signature of the function the overloaded arguments were passed to, except + * subclasses are always considered before superclasses. + * + * If the result of calling __torch_function__ is NotImplemented, the + * next implementation in the precedence order is called. If all + * arguments return NotImplemented from their __torch_function__ + * implementation, a TypeError is raised in Python. + * + * Assumes overloaded_args has at least one entry. All entries must have + * a __torch_function__ attribute that resolves to a callable that + * accepts a torch API function, a tuple of arguments, and a dict of + * keyword arguments for the torch API function. + * + * It is sufficient to call PythonArgs::has_torch_function before + * calling this function to verify that there are valid arguments + * present. If that is not done then special care must be taken to + * ensure there are arguments that are overloaded with + * __torch_function__. + * + * See torch._overrides.handle_torch_function for the equivalent + * code in the pure-python implementation. + * + * 'r' is a parsed PythonArgs instance, returned from + * PythonArgParser::parse. + * + * 'args' is a reference to the python tuple of arguments to the torch + * API function. + * + * 'kwargs' is a reference to the python dict of keyword arguments to + * the torch API function. + * + * 'torch_api' is a reference to a python torch API namespace. + * + * 'torch_api_function' is the reference to the original torch method, usually, + * we can use torch_api and func_name to get torch_api_function. In some cases, + * e.g., torch custom op, we create the function in C++, if we still use + * torch_api and func_name to fetch original api, a cyclic call will happen. + * + * 'overloaded_args' is the args which have overloaded __torch_function__. + * + * 'func_name' is the named of the original torch method. + * + * TODO: we could use different names for the following 'handle_torch_function' + * instead of overloading. + * + */ +// Used for Tensor methods with arguments. +auto handle_torch_function( + PythonArgs& r, + PyObject* self, + PyObject* args, + PyObject* kwargs, + PyObject* torch_api, + const char* module_name, + const char* func_name_override = nullptr) -> PyObject*; + +// Used for functions which needs to parse python args. +auto handle_torch_function( + PythonArgs& r, + PyObject* args, + PyObject* kwargs, + PyObject* torch_api, + const char* module_name, + const char* func_name_override = nullptr) -> PyObject*; + +// Used for functions that have no argument parsing. +auto handle_torch_function( + PyObject* self, + const std::string& func_name, + PyObject* args = nullptr, + PyObject* kwargs = nullptr, + PyObject* torch_api = THPVariableClass, + const std::string& module_name = "torch.Tensor") -> PyObject*; + +// Used for functions created in C++, e.g., C++ custom op, which doesn't use +// PythonArgParser to get overloaded_args. +enum class TorchFunctionName { TorchFunction, TorchDispatch }; + +auto TORCH_PYTHON_API handle_torch_function_no_python_arg_parser( + at::ArrayRef overloaded_args, + PyObject* args, + PyObject* kwargs, + const char* func_name, + PyObject* torch_api_function, + const char* module_name, + TorchFunctionName torch_function_name = TorchFunctionName::TorchFunction) + -> PyObject*; + +// Used for getters of Tensor properties +auto handle_torch_function_getter( + THPVariable* self, + const std::string& property_name) -> PyObject*; + +// Used for setters of Tensor properties. +auto handle_torch_function_setter( + THPVariable* self, + const std::string& property_name, + PyObject* value) -> int; + +// Used for __getitem__ and __setitem__ +auto handle_torch_function_indexing( + PyObject* self, + PyObject* index, + PyObject* val = nullptr) -> PyObject*; + +/* + * Check if the input obj is Tensor type, including its subclass, or overloaded + * type. If the type defines __torch_function__, it also returns true. + * Otherwise returns flase. If the class is not torch.Tensor, and it defines + * __torch_function__, we append obj to overloaded_args. + * + * 'obj': the input argument to be checked + * 'overloaded_args': the vector to append the overloaded args. + */ +bool is_tensor_and_append_overloaded( + PyObject* obj, + std::vector* overloaded_args); + +/* + * Check if the input obj is Tensor List or Tensor Tuple type. First check + * whether obj is Tuple or List type, if true, iterate over each element and + * check whether it is Tensor type, including its subclass or overloaded type. + * At the same time, the overloaded arg is appended to the overloaded_args. + * + * 'obj': the input argument to be checked + * 'overloaded_args': the vector to append the overloaded args. + * 'argnum': the number of total arguments of the function being checked. + * 'throw_error': whether throw error if any element in the list or tuple is + * not tensor type or overloaded. + */ +bool is_tensor_list_and_append_overloaded( + PyObject* obj, + std::vector* overloaded_args, + int argnum, + bool throw_error); + +/* Given an argument that is definitely a tensor and is definitely overloaded, + * append it to the overloaded arguments list. Use this instead of + * is_tensor_and_append_overloaded in situations where you have a PyObject + * and you know it definitely is a Tensor and it is definitely overloaded. + * + * 'overloaded_args': the vector to append the overloaded args + * 'obj': the input tensor that is overloaded + */ +void append_overloaded_tensor( + std::vector* overloaded_args, + PyObject* obj); + +/* Given an argument that is definitely a type and is definitely overloaded, + * append it to the overloaded arguments list. Use this only with + * __torch_dispatch__, where we operate on classes that have a + * __torch_dispatch__ classmethod. + * + * 'overloaded_args': the vector to append the overloaded type + * 'obj': the input class that has a __torch_dispatch__ classmethod. + */ +void append_overloaded_type( + std::vector* overloaded_args, + PyObject* obj); + +} // namespace torch diff --git a/shared/package-files/32/324cceb2911a13bad228b62b2793776ce4300df1ec710cd805611eceaf81ba62/blob b/shared/package-files/32/324cceb2911a13bad228b62b2793776ce4300df1ec710cd805611eceaf81ba62/blob new file mode 100644 index 0000000000000000000000000000000000000000..ba22c393bafcc3d830b3d3d2e11d3b453db68d13 --- /dev/null +++ b/shared/package-files/32/324cceb2911a13bad228b62b2793776ce4300df1ec710cd805611eceaf81ba62/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:324cceb2911a13bad228b62b2793776ce4300df1ec710cd805611eceaf81ba62 +size 143232 diff --git a/shared/package-files/32/32528f32242acc327ab543207af44eaf99f4cb236e6e3226b91614a8cf231756/blob b/shared/package-files/32/32528f32242acc327ab543207af44eaf99f4cb236e6e3226b91614a8cf231756/blob new file mode 100644 index 0000000000000000000000000000000000000000..09ac19f97671e40ff5bd2ccbc20838cde962bcaf --- /dev/null +++ b/shared/package-files/32/32528f32242acc327ab543207af44eaf99f4cb236e6e3226b91614a8cf231756/blob @@ -0,0 +1,70 @@ +# This file also re-exports symbols for wider use. We configure mypy and flake8 +# to be aware that this file does this. + +from jedi.inference.compiled.value import CompiledValue, CompiledName, \ + CompiledValueFilter, CompiledValueName, create_from_access_path +from jedi.inference.base_value import LazyValueWrapper + + +def builtin_from_name(inference_state, string): + typing_builtins_module = inference_state.builtins_module + if string in ('None', 'True', 'False'): + builtins, = typing_builtins_module.non_stub_value_set + filter_ = next(builtins.get_filters()) + else: + filter_ = next(typing_builtins_module.get_filters()) + name, = filter_.get(string) + value, = name.infer() + return value + + +class ExactValue(LazyValueWrapper): + """ + This class represents exact values, that makes operations like additions + and exact boolean values possible, while still being a "normal" stub. + """ + def __init__(self, compiled_value): + self.inference_state = compiled_value.inference_state + self._compiled_value = compiled_value + + def __getattribute__(self, name): + if name in ('get_safe_value', 'execute_operation', 'access_handle', + 'negate', 'py__bool__', 'is_compiled'): + return getattr(self._compiled_value, name) + return super().__getattribute__(name) + + def _get_wrapped_value(self): + instance, = builtin_from_name( + self.inference_state, self._compiled_value.name.string_name).execute_with_values() + return instance + + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, self._compiled_value) + + +def create_simple_object(inference_state, obj): + """ + Only allows creations of objects that are easily picklable across Python + versions. + """ + assert type(obj) in (int, float, str, bytes, slice, complex, bool), repr(obj) + compiled_value = create_from_access_path( + inference_state, + inference_state.compiled_subprocess.create_simple_object(obj) + ) + return ExactValue(compiled_value) + + +def get_string_value_set(inference_state): + return builtin_from_name(inference_state, 'str').execute_with_values() + + +def load_module(inference_state, dotted_name, **kwargs): + # Temporary, some tensorflow builtins cannot be loaded, so it's tried again + # and again and it's really slow. + if dotted_name.startswith('tensorflow.'): + return None + access_path = inference_state.compiled_subprocess.load_module(dotted_name=dotted_name, **kwargs) + if access_path is None: + return None + return create_from_access_path(inference_state, access_path) diff --git a/shared/package-files/32/3255c26491aa76e261f8c934a472f0d3aa0dc5e5b57ef3cfde2c5fa3648cf1a9/blob b/shared/package-files/32/3255c26491aa76e261f8c934a472f0d3aa0dc5e5b57ef3cfde2c5fa3648cf1a9/blob new file mode 100644 index 0000000000000000000000000000000000000000..334ca4825094f1bb181fcea9a37d40cf5206d3b8 --- /dev/null +++ b/shared/package-files/32/3255c26491aa76e261f8c934a472f0d3aa0dc5e5b57ef3cfde2c5fa3648cf1a9/blob @@ -0,0 +1,15 @@ +from .tz import ( + datetime_ambiguous as datetime_ambiguous, + datetime_exists as datetime_exists, + gettz as gettz, + resolve_imaginary as resolve_imaginary, + tzfile as tzfile, + tzical as tzical, + tzlocal as tzlocal, + tzoffset as tzoffset, + tzrange as tzrange, + tzstr as tzstr, + tzutc as tzutc, +) + +UTC: tzutc diff --git a/shared/package-files/32/32579ffdd8269f4c338c5c59037a016ed1eb420adf759c3ff24d662d83593f80/blob b/shared/package-files/32/32579ffdd8269f4c338c5c59037a016ed1eb420adf759c3ff24d662d83593f80/blob new file mode 100644 index 0000000000000000000000000000000000000000..46db9a69dfb3e7aee5c150ac6795234cd455dfe5 --- /dev/null +++ b/shared/package-files/32/32579ffdd8269f4c338c5c59037a016ed1eb420adf759c3ff24d662d83593f80/blob @@ -0,0 +1,290 @@ +import numpy as np + + +def check_arguments(fun, y0, support_complex): + """Helper function for checking arguments common to all solvers.""" + y0 = np.asarray(y0) + if np.issubdtype(y0.dtype, np.complexfloating): + if not support_complex: + raise ValueError("`y0` is complex, but the chosen solver does " + "not support integration in a complex domain.") + dtype = complex + else: + dtype = float + y0 = y0.astype(dtype, copy=False) + + if y0.ndim != 1: + raise ValueError("`y0` must be 1-dimensional.") + + if not np.isfinite(y0).all(): + raise ValueError("All components of the initial state `y0` must be finite.") + + def fun_wrapped(t, y): + return np.asarray(fun(t, y), dtype=dtype) + + return fun_wrapped, y0 + + +class OdeSolver: + """Base class for ODE solvers. + + In order to implement a new solver you need to follow the guidelines: + + 1. A constructor must accept parameters presented in the base class + (listed below) along with any other parameters specific to a solver. + 2. A constructor must accept arbitrary extraneous arguments + ``**extraneous``, but warn that these arguments are irrelevant + using `common.warn_extraneous` function. Do not pass these + arguments to the base class. + 3. A solver must implement a private method `_step_impl(self)` which + propagates a solver one step further. It must return tuple + ``(success, message)``, where ``success`` is a boolean indicating + whether a step was successful, and ``message`` is a string + containing description of a failure if a step failed or None + otherwise. + 4. A solver must implement a private method `_dense_output_impl(self)`, + which returns a `DenseOutput` object covering the last successful + step. + 5. A solver must have attributes listed below in Attributes section. + Note that ``t_old`` and ``step_size`` are updated automatically. + 6. Use `fun(self, t, y)` method for the system rhs evaluation, this + way the number of function evaluations (`nfev`) will be tracked + automatically. + 7. For convenience, a base class provides `fun_single(self, t, y)` and + `fun_vectorized(self, t, y)` for evaluating the rhs in + non-vectorized and vectorized fashions respectively (regardless of + how `fun` from the constructor is implemented). These calls don't + increment `nfev`. + 8. If a solver uses a Jacobian matrix and LU decompositions, it should + track the number of Jacobian evaluations (`njev`) and the number of + LU decompositions (`nlu`). + 9. By convention, the function evaluations used to compute a finite + difference approximation of the Jacobian should not be counted in + `nfev`, thus use `fun_single(self, t, y)` or + `fun_vectorized(self, t, y)` when computing a finite difference + approximation of the Jacobian. + + Parameters + ---------- + fun : callable + Right-hand side of the system: the time derivative of the state ``y`` + at time ``t``. The calling signature is ``fun(t, y)``, where ``t`` is a + scalar and ``y`` is an ndarray with ``len(y) = len(y0)``. ``fun`` must + return an array of the same shape as ``y``. See `vectorized` for more + information. + t0 : float + Initial time. + y0 : array_like, shape (n,) + Initial state. + t_bound : float + Boundary time --- the integration won't continue beyond it. It also + determines the direction of the integration. + vectorized : bool + Whether `fun` can be called in a vectorized fashion. Default is False. + + If ``vectorized`` is False, `fun` will always be called with ``y`` of + shape ``(n,)``, where ``n = len(y0)``. + + If ``vectorized`` is True, `fun` may be called with ``y`` of shape + ``(n, k)``, where ``k`` is an integer. In this case, `fun` must behave + such that ``fun(t, y)[:, i] == fun(t, y[:, i])`` (i.e. each column of + the returned array is the time derivative of the state corresponding + with a column of ``y``). + + Setting ``vectorized=True`` allows for faster finite difference + approximation of the Jacobian by methods 'Radau' and 'BDF', but + will result in slower execution for other methods. It can also + result in slower overall execution for 'Radau' and 'BDF' in some + circumstances (e.g. small ``len(y0)``). + support_complex : bool, optional + Whether integration in a complex domain should be supported. + Generally determined by a derived solver class capabilities. + Default is False. + + Attributes + ---------- + n : int + Number of equations. + status : string + Current status of the solver: 'running', 'finished' or 'failed'. + t_bound : float + Boundary time. + direction : float + Integration direction: +1 or -1. + t : float + Current time. + y : ndarray + Current state. + t_old : float + Previous time. None if no steps were made yet. + step_size : float + Size of the last successful step. None if no steps were made yet. + nfev : int + Number of the system's rhs evaluations. + njev : int + Number of the Jacobian evaluations. + nlu : int + Number of LU decompositions. + """ + TOO_SMALL_STEP = "Required step size is less than spacing between numbers." + + def __init__(self, fun, t0, y0, t_bound, vectorized, + support_complex=False): + self.t_old = None + self.t = t0 + self._fun, self.y = check_arguments(fun, y0, support_complex) + self.t_bound = t_bound + self.vectorized = vectorized + + if vectorized: + def fun_single(t, y): + return self._fun(t, y[:, None]).ravel() + fun_vectorized = self._fun + else: + fun_single = self._fun + + def fun_vectorized(t, y): + f = np.empty_like(y) + for i, yi in enumerate(y.T): + f[:, i] = self._fun(t, yi) + return f + + def fun(t, y): + self.nfev += 1 + return self.fun_single(t, y) + + self.fun = fun + self.fun_single = fun_single + self.fun_vectorized = fun_vectorized + + self.direction = np.sign(t_bound - t0) if t_bound != t0 else 1 + self.n = self.y.size + self.status = 'running' + + self.nfev = 0 + self.njev = 0 + self.nlu = 0 + + @property + def step_size(self): + if self.t_old is None: + return None + else: + return np.abs(self.t - self.t_old) + + def step(self): + """Perform one integration step. + + Returns + ------- + message : string or None + Report from the solver. Typically a reason for a failure if + `self.status` is 'failed' after the step was taken or None + otherwise. + """ + if self.status != 'running': + raise RuntimeError("Attempt to step on a failed or finished " + "solver.") + + if self.n == 0 or self.t == self.t_bound: + # Handle corner cases of empty solver or no integration. + self.t_old = self.t + self.t = self.t_bound + message = None + self.status = 'finished' + else: + t = self.t + success, message = self._step_impl() + + if not success: + self.status = 'failed' + else: + self.t_old = t + if self.direction * (self.t - self.t_bound) >= 0: + self.status = 'finished' + + return message + + def dense_output(self): + """Compute a local interpolant over the last successful step. + + Returns + ------- + sol : `DenseOutput` + Local interpolant over the last successful step. + """ + if self.t_old is None: + raise RuntimeError("Dense output is available after a successful " + "step was made.") + + if self.n == 0 or self.t == self.t_old: + # Handle corner cases of empty solver and no integration. + return ConstantDenseOutput(self.t_old, self.t, self.y) + else: + return self._dense_output_impl() + + def _step_impl(self): + raise NotImplementedError + + def _dense_output_impl(self): + raise NotImplementedError + + +class DenseOutput: + """Base class for local interpolant over step made by an ODE solver. + + It interpolates between `t_min` and `t_max` (see Attributes below). + Evaluation outside this interval is not forbidden, but the accuracy is not + guaranteed. + + Attributes + ---------- + t_min, t_max : float + Time range of the interpolation. + """ + def __init__(self, t_old, t): + self.t_old = t_old + self.t = t + self.t_min = min(t, t_old) + self.t_max = max(t, t_old) + + def __call__(self, t): + """Evaluate the interpolant. + + Parameters + ---------- + t : float or array_like with shape (n_points,) + Points to evaluate the solution at. + + Returns + ------- + y : ndarray, shape (n,) or (n, n_points) + Computed values. Shape depends on whether `t` was a scalar or a + 1-D array. + """ + t = np.asarray(t) + if t.ndim > 1: + raise ValueError("`t` must be a float or a 1-D array.") + return self._call_impl(t) + + def _call_impl(self, t): + raise NotImplementedError + + +class ConstantDenseOutput(DenseOutput): + """Constant value interpolator. + + This class used for degenerate integration cases: equal integration limits + or a system with 0 equations. + """ + def __init__(self, t_old, t, value): + super().__init__(t_old, t) + self.value = value + + def _call_impl(self, t): + if t.ndim == 0: + return self.value + else: + ret = np.empty((self.value.shape[0], t.shape[0])) + ret[:] = self.value[:, None] + return ret diff --git a/shared/package-files/32/325baaa5dfd8c1575c76065f4aefbfa1575a764fc98d7f45b8f1858e7fd2e990/blob b/shared/package-files/32/325baaa5dfd8c1575c76065f4aefbfa1575a764fc98d7f45b8f1858e7fd2e990/blob new file mode 100644 index 0000000000000000000000000000000000000000..7cfddef7ddff87275ebf31eb7ec10e65d26f8668 --- /dev/null +++ b/shared/package-files/32/325baaa5dfd8c1575c76065f4aefbfa1575a764fc98d7f45b8f1858e7fd2e990/blob @@ -0,0 +1,53 @@ +""" +Entrypoint for testing from the top-level namespace. +""" +from __future__ import annotations + +import os +import sys + +from pandas.compat._optional import import_optional_dependency + +PKG = os.path.dirname(os.path.dirname(__file__)) + + +def test(extra_args: list[str] | None = None, run_doctests: bool = False) -> None: + """ + Run the pandas test suite using pytest. + + By default, runs with the marks -m "not slow and not network and not db" + + Parameters + ---------- + extra_args : list[str], default None + Extra marks to run the tests. + run_doctests : bool, default False + Whether to only run the Python and Cython doctests. If you would like to run + both doctests/regular tests, just append "--doctest-modules"/"--doctest-cython" + to extra_args. + + Examples + -------- + >>> pd.test() # doctest: +SKIP + running: pytest... + """ + pytest = import_optional_dependency("pytest") + import_optional_dependency("hypothesis") + cmd = ["-m not slow and not network and not db"] + if extra_args: + if not isinstance(extra_args, list): + extra_args = [extra_args] + cmd = extra_args + if run_doctests: + cmd = [ + "--doctest-modules", + "--doctest-cython", + f"--ignore={os.path.join(PKG, 'tests')}", + ] + cmd += [PKG] + joined = " ".join(cmd) + print(f"running: pytest {joined}") + sys.exit(pytest.main(cmd)) + + +__all__ = ["test"] diff --git a/shared/package-files/32/325be43a6adf155859f3b9ea0c83fddd8302efb7535bf9ff49c0b6f6f3096c11/blob b/shared/package-files/32/325be43a6adf155859f3b9ea0c83fddd8302efb7535bf9ff49c0b6f6f3096c11/blob new file mode 100644 index 0000000000000000000000000000000000000000..632f69b67466ce199eeffb326eb350e4815454d7 --- /dev/null +++ b/shared/package-files/32/325be43a6adf155859f3b9ea0c83fddd8302efb7535bf9ff49c0b6f6f3096c11/blob @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor upsample_nearest2d(const at::Tensor & self, at::IntArrayRef output_size, c10::optional scales_h=c10::nullopt, c10::optional scales_w=c10::nullopt); +TORCH_API at::Tensor upsample_nearest2d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional scales_h=c10::nullopt, c10::optional scales_w=c10::nullopt); +TORCH_API at::Tensor & upsample_nearest2d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size, c10::optional scales_h=c10::nullopt, c10::optional scales_w=c10::nullopt); +TORCH_API at::Tensor & upsample_nearest2d_outf(const at::Tensor & self, at::IntArrayRef output_size, c10::optional scales_h, c10::optional scales_w, at::Tensor & out); +TORCH_API at::Tensor & upsample_nearest2d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional scales_h=c10::nullopt, c10::optional scales_w=c10::nullopt); +TORCH_API at::Tensor & upsample_nearest2d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, c10::optional scales_h, c10::optional scales_w, at::Tensor & out); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/32/325c454b26039c1311808ab3a44029b08985c725094a0e8476e6c35402a94da9/blob b/shared/package-files/32/325c454b26039c1311808ab3a44029b08985c725094a0e8476e6c35402a94da9/blob new file mode 100644 index 0000000000000000000000000000000000000000..0efef1f08b0c554711e52d63d9477e86a9d04bb2 --- /dev/null +++ b/shared/package-files/32/325c454b26039c1311808ab3a44029b08985c725094a0e8476e6c35402a94da9/blob @@ -0,0 +1,357 @@ +#!/usr/bin/env python +"""Print installed dependency versions for diagnostics""" + +from functools import reduce +import os +from pathlib import Path +import platform +import sys + + +def safe_version(module, attr="__version__", *others): + """ + Return a version attribute from a module, or a fallback message + + Parameters + ---------- + module : module + The imported module to inspect. + attr : str or list of str, optional + Name of the attribute (or chain of nested attribute names) to + look up on ``module``, e.g., ``"__version__"`` or + ``["version", "version"]``. Default is ``"__version__"``. + *others : str + Additional attribute names to try, in order, if ``attr`` is not + found on ``module``. + + Returns + ------- + str + The value of the located version attribute, or + ``"Cannot detect version"`` if none of the attributes exist. + """ + if not isinstance(attr, list): + attr = [attr] + try: + return reduce(getattr, [module, *attr]) + except AttributeError: + if others: + return safe_version(module, others[0], *others[1:]) + return "Cannot detect version" + + +def _show_versions_only(): + print("\nINSTALLED VERSIONS") + print("------------------") + print("Python: {:d}.{:d}.{:d}.{}.{}".format(*sys.version_info[:])) + + uname = platform.uname() + sysname = uname.system + release = uname.release + version = uname.version + machine = uname.machine + print(f"OS: {sysname} {release} {version} {machine}") + print(f"byteorder: {sys.byteorder}") + print("LC_ALL: {}".format(os.environ.get("LC_ALL", "None"))) + print("LANG: {}".format(os.environ.get("LANG", "None"))) + try: + import statsmodels + + has_sm = True + except ImportError: + has_sm = False + + print("\nstatsmodels\n===========\n") + if has_sm: + print(f"Installed: {safe_version(statsmodels)}") + else: + print("Not installed") + + print("\nRequired Dependencies\n=====================\n") + try: + import Cython + + print(f"cython: {safe_version(Cython)}") + except ImportError: + print("cython: Not installed") + + try: + import numpy as np + + print(f"numpy: {safe_version(np)}") + except ImportError: + print("numpy: Not installed") + + try: + import scipy + + print(f"scipy: {safe_version(scipy)}") + except ImportError: + print("scipy: Not installed") + + try: + import pandas as pd + + print(f"pandas: {safe_version(pd)}") + except ImportError: + print("pandas: Not installed") + + try: + import dateutil + + print(f" dateutil: {safe_version(dateutil)}") + except ImportError: + print(" dateutil: not installed") + + try: + import patsy + + print(f"patsy: {safe_version(patsy)}") + except ImportError: + print("patsy: Not installed") + + try: + import formulaic + + print(f"formulaic: {safe_version(formulaic)}") + except ImportError: + print("formulaic: Not installed") + + print("\nOptional Dependencies\n=====================\n") + + try: + import matplotlib as mpl + + print(f"matplotlib: {safe_version(mpl)}") + except ImportError: + print("matplotlib: Not installed") + + try: + from cvxopt import info + + print("cvxopt: {}".format(safe_version(info, "version"))) + except ImportError: + print("cvxopt: Not installed") + + try: + import joblib + + print(f"joblib: {safe_version(joblib)} ") + except ImportError: + print("joblib: Not installed") + + print("\nDeveloper Tools\n================\n") + + try: + import IPython + + print(f"IPython: {safe_version(IPython)}") + except ImportError: + print("IPython: Not installed") + try: + import jinja2 + + print(f" jinja2: {safe_version(jinja2)}") + except ImportError: + print(" jinja2: Not installed") + + try: + import sphinx + + print(f"sphinx: {safe_version(sphinx)}") + except ImportError: + print("sphinx: Not installed") + + try: + import pygments + + print(f" pygments: {safe_version(pygments)}") + except ImportError: + print(" pygments: Not installed") + + try: + import pytest + + print(f"pytest: {safe_version(pytest)} ({Path(pytest.__file__).parent})") + except ImportError: + print("pytest: Not installed") + + try: + import virtualenv + + print(f"virtualenv: {safe_version(virtualenv)}") + except ImportError: + print("virtualenv: Not installed") + + print("\n") + + +def show_versions(show_dirs=True): + """ + List the versions of statsmodels and any installed dependencies + + Parameters + ---------- + show_dirs : bool, optional + Flag indicating to show module locations. Default is True. + + """ + if not show_dirs: + _show_versions_only() + return + print("\nINSTALLED VERSIONS") + print("------------------") + print("Python: {:d}.{:d}.{:d}.{}.{}".format(*sys.version_info[:])) + uname = platform.uname() + sysname = uname.system + release = uname.release + version = uname.version + machine = uname.machine + print(f"OS: {sysname} {release} {version} {machine}") + print(f"byteorder: {sys.byteorder}") + print("LC_ALL: {}".format(os.environ.get("LC_ALL", "None"))) + print("LANG: {}".format(os.environ.get("LANG", "None"))) + + try: + import statsmodels + + has_sm = True + except ImportError: + has_sm = False + + print("\nstatsmodels\n===========\n") + if has_sm: + print( + f"Installed: {safe_version(statsmodels)} ({Path(statsmodels.__file__).parent})" + ) + else: + print("Not installed") + + print("\nRequired Dependencies\n=====================\n") + try: + import Cython + + print(f"cython: {safe_version(Cython)} ({Path(Cython.__file__).parent})") + except ImportError: + print("cython: Not installed") + + try: + import numpy as np + + print(f"numpy: {safe_version(np)} ({Path(np.__file__).parent})") + except ImportError: + print("numpy: Not installed") + + try: + import scipy + + print(f"scipy: {safe_version(scipy)} ({Path(scipy.__file__).parent})") + except ImportError: + print("scipy: Not installed") + + try: + import pandas as pd + + print( + "pandas: {} ({})".format( + safe_version(pd, "__version__"), + Path(pd.__file__).parent, + ) + ) + except ImportError: + print("pandas: Not installed") + + try: + import dateutil + + print( + f" dateutil: {safe_version(dateutil)} ({Path(dateutil.__file__).parent})" + ) + except ImportError: + print(" dateutil: not installed") + + try: + import patsy + + print(f"patsy: {safe_version(patsy)} ({Path(patsy.__file__).parent})") + except ImportError: + print("patsy: Not installed") + + print("\nOptional Dependencies\n=====================\n") + + try: + import matplotlib as mpl + + print(f"matplotlib: {safe_version(mpl)} ({Path(mpl.__file__).parent})") + print(" backend: {} ".format(mpl.rcParams["backend"])) + except ImportError: + print("matplotlib: Not installed") + + try: + from cvxopt import info + + print( + "cvxopt: {} ({})".format( + safe_version(info, "version"), Path(info.__file__).parent + ) + ) + except ImportError: + print("cvxopt: Not installed") + + try: + import joblib + + print(f"joblib: {safe_version(joblib)} ({Path(joblib.__file__).parent})") + except ImportError: + print("joblib: Not installed") + + print("\nDeveloper Tools\n================\n") + + try: + import IPython + + print(f"IPython: {safe_version(IPython)} ({Path(IPython.__file__).parent})") + except ImportError: + print("IPython: Not installed") + try: + import jinja2 + + print(f" jinja2: {safe_version(jinja2)} ({Path(jinja2.__file__).parent})") + except ImportError: + print(" jinja2: Not installed") + + try: + import sphinx + + print(f"sphinx: {safe_version(sphinx)} ({Path(sphinx.__file__).parent})") + except ImportError: + print("sphinx: Not installed") + + try: + import pygments + + print( + f" pygments: {safe_version(pygments)} ({Path(pygments.__file__).parent})" + ) + except ImportError: + print(" pygments: Not installed") + + try: + import pytest + + print(f"pytest: {safe_version(pytest)} ({Path(pytest.__file__).parent})") + except ImportError: + print("pytest: Not installed") + + try: + import virtualenv + + print(f"virtualenv: {safe_version(virtualenv)} ({Path(virtualenv.__file__).parent})") + except ImportError: + print("virtualenv: Not installed") + + print("\n") + + +if __name__ == "__main__": + show_versions() diff --git a/shared/package-files/32/326015b294fc0c34ea0ee2fc6498712bada0d2572ca38bea23a40d43d0ac7e84/blob b/shared/package-files/32/326015b294fc0c34ea0ee2fc6498712bada0d2572ca38bea23a40d43d0ac7e84/blob new file mode 100644 index 0000000000000000000000000000000000000000..05bef3000147a1137731c25b6d07d9491b461112 --- /dev/null +++ b/shared/package-files/32/326015b294fc0c34ea0ee2fc6498712bada0d2572ca38bea23a40d43d0ac7e84/blob @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +""" +setup.py for installing F2PY + +Usage: + pip install . + +Copyright 2001-2005 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Revision: 1.32 $ +$Date: 2005/01/30 17:22:14 $ +Pearu Peterson + +""" +from numpy.distutils.core import setup +from numpy.distutils.misc_util import Configuration + + +from __version__ import version + + +def configuration(parent_package='', top_path=None): + config = Configuration('f2py', parent_package, top_path) + config.add_subpackage('tests') + config.add_subpackage('_backends') + config.add_data_dir('tests/src') + config.add_data_files( + 'src/fortranobject.c', + 'src/fortranobject.h', + '_backends/meson.build.template', + ) + config.add_data_files('*.pyi') + return config + + +if __name__ == "__main__": + + config = configuration(top_path='') + config = config.todict() + + config['classifiers'] = [ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: NumPy License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: C', + 'Programming Language :: Fortran', + 'Programming Language :: Python', + 'Topic :: Scientific/Engineering', + 'Topic :: Software Development :: Code Generators', + ] + setup(version=version, + description="F2PY - Fortran to Python Interface Generator", + author="Pearu Peterson", + author_email="pearu@cens.ioc.ee", + maintainer="Pearu Peterson", + maintainer_email="pearu@cens.ioc.ee", + license="BSD", + platforms="Unix, Windows (mingw|cygwin), Mac OSX", + long_description="""\ +The Fortran to Python Interface Generator, or F2PY for short, is a +command line tool (f2py) for generating Python C/API modules for +wrapping Fortran 77/90/95 subroutines, accessing common blocks from +Python, and calling Python functions from Fortran (call-backs). +Interfacing subroutines/data from Fortran 90/95 modules is supported.""", + url="https://numpy.org/doc/stable/f2py/", + keywords=['Fortran', 'f2py'], + **config) diff --git a/shared/package-files/32/3261b3fe6c85f84613e668eb86cccbd80d61965d88b7605a76503f9cecd97bc3/blob b/shared/package-files/32/3261b3fe6c85f84613e668eb86cccbd80d61965d88b7605a76503f9cecd97bc3/blob new file mode 100644 index 0000000000000000000000000000000000000000..4fc16a4691abf3d3ff1e5b4ca8795e05f6ccc6ea --- /dev/null +++ b/shared/package-files/32/3261b3fe6c85f84613e668eb86cccbd80d61965d88b7605a76503f9cecd97bc3/blob @@ -0,0 +1,194 @@ +""" + +Created on Sun Jun 30 20:25:22 2013 + +Author: Josef Perktold +""" + +import numpy as np +from numpy.testing import assert_allclose +import pytest + +from statsmodels.miscmodels.tmodel import TLinearModel +from statsmodels.tools.testing import Holder +from statsmodels.tools.tools import add_constant + +mm = Holder() +mm.date_label = ["Apr.1982", "Apr.1983", "Apr.1984", "Apr.1985", "Apr.1986", + "Aug.1982", "Aug.1983", "Aug.1984", "Aug.1985", "Aug.1986", + "Dec.1982", "Dec.1983", "Dec.1984", "Dec.1985", "Dec.1986", + "Feb.1284", "Feb.1982", "Feb.1983", "Feb.1985", "Feb.1986", + "Jan.1982", "Jan.1983", "Jan.1984", "Jan.1985", "Jan.1986", + "Jul.1982", "July1983", "July1984", "July1985", "July1986", + "June1982", "June1983", "June1984", "June1985", "June1986", + "Mar.1982", "Mar.1983", "Mar.1984", "Mar.1985", "Mar.1986", + "May1982", "May1983", "May1984", "May1985", "May1986", + "Nov.1982", "Nov.1983", "Nov.1984", "Nov.1985", "Nov.1986", + "Oct.1982", "Oct.1983", "Oct.1984", "Oct.1985", "Oct.1986", + "Sept.1982", "Sept.1983", "Sept.1984", "Sept.1985", + "Sept.1986"] + +mm.m_marietta = np.array([ + -0.1365, -0.0769, -0.0575, 0.0526, -0.0449, -0.0859, -0.0742, 0.6879, + -0.077, 0.085, 0.003, 0.0754, -0.0412, -0.089, 0.2319, 0.1087, 0.0375, + 0.0958, 0.0174, -0.0724, 0.075, -0.0588, -0.062, -0.0378, 0.0169, + -0.0799, -0.0147, 0.0106, -0.0421, -0.0036, 0.0876, 0.1025, -0.0499, + 0.1953, -0.0714, 0.0469, 0.1311, 0.0461, -0.0328, -0.0096, 0.1272, + -0.0077, 0.0165, -0.015, -0.1479, -0.0065, 0.039, 0.0223, -0.069, + 0.1338, 0.1458, 0.0063, 0.0692, -0.0239, -0.0568, 0.0814, -0.0889, + -0.0887, 0.1037, -0.1163 + ]) +mm.CRSP = np.array([ + -0.03, -0.0584, -0.0181, 0.0306, -0.0397, -0.0295, -0.0316, 0.1176, + 0.0075, 0.1098, 0.0408, 0.0095, 0.0301, 0.0221, 0.0269, 0.0655, + -0.003, 0.0325, -0.0374, 0.0049, 0.0105, -0.0257, 0.0186, -0.0155, + -0.0165, -0.044, 0.0094, -0.0028, -0.0591, 0.0158, -0.0238, 0.1031, + -0.0065, -0.0067, -0.0167, 0.0188, 0.0733, 0.0105, -0.007, -0.0099, + 0.0521, 0.0117, -0.0099, -0.0102, -0.0428, 0.0376, 0.0628, 0.0391, + 2e-04, 0.0688, 0.0486, -0.0174, 0.046, 0.01, -0.0594, 0.068, -0.0839, + 0.0481, 0.0136, -0.0322 + ]) +mm.am_can = np.array([ + -0.0596, -0.17, 0.0276, 0.0058, -0.0106, 0.045, -0.0243, 0.1135, + -0.0331, 0.0468, -0.0223, -0.0026, 0.0166, 0.0343, 0.0443, 0.1477, + 0.1728, -0.0372, -0.0451, -0.0257, 0.0509, 0.0035, 0.1334, -0.0458, + 0.1199, -0.0766, -0.0511, -0.0194, -0.0687, 0.0928, -0.0704, 0.0905, + 0.0232, -0.0054, 0.0082, 0.0242, 0.0153, 0.0016, 0.028, 0.0088, + 0.0734, 0.0315, -0.0276, 0.0162, -0.0975, 0.0563, 0.1368, -0.069, + 0.1044, 0.1636, -0.019, -0.0746, 0.0433, 0.0306, 0.0636, 0.0917, + -0.0796, 0.0778, -0.0353, -0.0137 + ]) +mm.date = np.array([ + 21, 17, 36, 1, 41, 31, 26, 6, 56, 51, 46, 11, 22, 18, 37, 2, 42, 32, + 27, 7, 57, 52, 47, 12, 23, 16, 38, 3, 43, 33, 28, 8, 58, 53, 48, 13, + 24, 19, 39, 4, 44, 34, 29, 9, 59, 54, 49, 14, 25, 20, 40, 5, 45, 35, + 30, 10, 60, 55, 50, 15 + ]) + + +class CheckTLinearModelMixin: + + def test_basic(self): + res1 = self.res1 + res2 = self.res2 + # location + assert_allclose(res1.params[:-2], res2.loc_fit.coefficients, atol=3e-5) + assert_allclose(res1.bse[:-2], res2.loc_fit.table[:, 1], rtol=0.003, atol=1e-5) + assert_allclose(res1.tvalues[:-2], res2.loc_fit.table[:, 2], rtol=0.003, atol=1e-5) + assert_allclose(res1.pvalues[:-2], res2.loc_fit.table[:, 3], rtol=0.009, atol=1e-5) + + # df + assert_allclose(res1.params[-2], res2.dof, rtol=5e-5) + assert_allclose(res1.bse[-2], res2.dofse, rtol=0.16, atol=1e-5) + # scale + scale_est = np.sqrt(res2.scale_fit.fitted_values.mean()) + assert_allclose(res1.params[-1], scale_est, atol=1e-5) + + assert_allclose(res1.llf, res2.logLik, atol=1e-5) + + def test_bse(self): + # check that they are roughly the same + res1 = self.res1 + assert_allclose(res1.bsejac, res1.bse, rtol=0.15, atol=0.002) + assert_allclose(res1.bsejac, res1.bse, rtol=0.1, atol=0.004) + + def test_fitted(self): + res1 = self.res1 + res2 = self.res2 + + fittedvalues = res1.predict() + resid = res1.model.endog - fittedvalues + assert_allclose(fittedvalues, res2.loc_fit.fitted_values, rtol=0.00025) + assert_allclose(resid, res2.loc_fit.residuals, atol=2e-6) # rtol=0.00036) + # TODO: no resid available as attribute + # assert_allclose(res1.resid, res2.loc_fit.residuals) + # assert_allclose(res1.fittedvalues, res2.loc_fit.fitted_values) + + def test_formula(self): + res1 = self.res1 + resf = self.resf + # converges slightly differently why? + assert_allclose(res1.params, resf.params, atol=1e-4) # rtol=2e-5, + assert_allclose(res1.bse, resf.bse, rtol=5e-5) + + assert_allclose(res1.model.endog, resf.model.endog, rtol=1e-10) + assert_allclose(res1.model.exog, resf.model.exog, rtol=1e-10) + + def test_df(self): + res = self.res1 + k_extra = getattr(self, "k_extra", 0) + nobs, k_vars = res.model.exog.shape + assert res.df_resid == nobs - k_vars - k_extra + assert res.df_model == k_vars - 1 # -1 for constant + assert len(res.params) == k_vars + k_extra + + @pytest.mark.smoke + def test_smoke(self): # TODO: break into well-scoped tests + res1 = self.res1 + resf = self.resf + contr = np.eye(len(res1.params)) + + # smoke test for summary and t_test, f_test + res1.summary() + res1.t_test(contr) + res1.f_test(contr) + + resf.summary() + resf.t_test(contr) + resf.f_test(contr) + + +class TestTModel(CheckTLinearModelMixin): + + @classmethod + def setup_class(cls): + endog = mm.m_marietta + exog = add_constant(mm.CRSP) + mod = TLinearModel(endog, exog) + res = mod.fit(method="bfgs", disp=False) + with pytest.warns(DeprecationWarning, match="Using"): + modf = TLinearModel.from_formula( + "price ~ CRSP", data={"price": mm.m_marietta, "CRSP": mm.CRSP} + ) + resf = modf.fit(method="bfgs", disp=False) + from .results_tmodel import res_t_dfest as res2 + cls.res2 = res2 + cls.res1 = res # take from module scope temporarily + cls.resf = resf + cls.k_extra = 2 + + +class TestTModelFixed: + + @classmethod + def setup_class(cls): + endog = mm.m_marietta + exog = add_constant(mm.CRSP) + mod = TLinearModel(endog, exog, fix_df=3) + res = mod.fit(method="bfgs", disp=False) + with pytest.warns(DeprecationWarning, match="Using"): + modf = TLinearModel.from_formula( + "price ~ CRSP", data={"price": mm.m_marietta, "CRSP": mm.CRSP}, fix_df=3 + ) + resf = modf.fit(method="bfgs", disp=False) + # TODO: no reference results yet + # from results_tmodel import res_t_dfest as res2 + # cls.res2 = res2 + cls.res1 = res # take from module scope temporarily + cls.resf = resf + cls.k_extra = 1 + + @pytest.mark.smoke + def test_smoke(self): # TODO: break into well-scoped tests + res1 = self.res1 + resf = self.resf + contr = np.eye(len(res1.params)) + + # smoke test for summary and t_test, f_test + res1.summary() + res1.t_test(contr) + res1.f_test(contr) + + resf.summary() + resf.t_test(contr) + resf.f_test(contr) diff --git a/shared/package-files/32/3265cff9e0f5336766e448b8108c045224927c63a259a850f9412247f58138f4/blob b/shared/package-files/32/3265cff9e0f5336766e448b8108c045224927c63a259a850f9412247f58138f4/blob new file mode 100644 index 0000000000000000000000000000000000000000..4cbecbcae84b574d57c82c9ac6b0d27e0bfd36aa --- /dev/null +++ b/shared/package-files/32/3265cff9e0f5336766e448b8108c045224927c63a259a850f9412247f58138f4/blob @@ -0,0 +1,1315 @@ +import numpy as np + +from statsmodels.tools.tools import Bunch + +llf = np.array([-245.40783909604]) + +nobs = np.array([202]) + +k = np.array([5]) + +k_exog = np.array([1]) + +sigma = np.array([.8100467417583]) + +chi2 = np.array([2153.20304012]) + +df_model = np.array([3]) + +k_ar = np.array([1]) + +k_ma = np.array([2]) + +params = np.array([ + .92817025087557, + -.89593490671979, + 1.3025011610587, + .30250063082791, + .8100467417583]) + +cov_params = np.array([ + .00638581549851, + .0001858475428, + 2.8222806545671, + .8538806860364, + -1.1429127085819, + .0001858475428, + .00132037832566, + -.14420925344502, + -.04447007102804, + .0576156187095, + 2.8222806545671, + -.14420925344502, + 40397.568324803, + 12222.977216556, + -16359.547340433, + .8538806860364, + -.04447007102804, + 12222.977216556, + 3698.2722243412, + -4949.8609964351, + -1.1429127085819, + .0576156187095, + -16359.547340433, + -4949.8609964351, + 6625.0231409853]).reshape(5, 5) + +xb = np.array([ + .92817026376724, + .92817026376724, + .69511789083481, + .77192437648773, + .66135895252228, + .77525061368942, + .64687132835388, + .79659670591354, + .65842008590698, + .71215486526489, + .69971066713333, + .72092038393021, + .68201982975006, + .76510280370712, + .64253836870193, + .78239262104034, + .64609551429749, + .74087703227997, + .71774411201477, + .7119727730751, + .73067259788513, + .67785596847534, + .70898467302322, + .71334755420685, + .72984194755554, + .7017787694931, + .75292426347733, + .67507487535477, + .78219056129456, + .78040039539337, + .71250075101852, + .82028061151505, + .63505899906158, + .79452306032181, + .72773635387421, + .79555094242096, + .76685506105423, + .77427339553833, + .82101213932037, + .77917188405991, + .78917801380157, + .86641925573349, + .78457218408585, + .83697980642319, + .83281791210175, + .85224026441574, + .75030690431595, + .8551008105278, + .78025943040848, + .72790426015854, + .84552866220474, + .72061747312546, + .78669738769531, + .73868823051453, + .78071022033691, + .78002023696899, + .83737623691559, + .98988044261932, + .72882527112961, + 1.2245427370071, + .85331875085831, + 1.1637357473373, + .86477434635162, + 1.3248475790024, + .81245219707489, + .98008638620377, + .85591268539429, + 1.0162551403046, + .8165408372879, + .78947591781616, + .94166398048401, + .93266606330872, + .85924750566483, + 1.1245046854019, + .75576168298721, + 1.0030617713928, + .91267073154449, + 1.0848042964935, + 1.0778224468231, + 1.1551086902618, + .97817331552505, + 1.4012540578842, + 1.2360861301422, + 1.3335381746292, + 1.4352362155914, + 1.4941285848618, + .9415163397789, + 1.437669634819, + 1.2404690980911, + 1.2285294532776, + 1.3219480514526, + 1.1560415029526, + .83524394035339, + .87116771936417, + 1.5561962127686, + .47358739376068, + .78093349933624, + .90549737215042, + 1.0217791795731, + .86397403478622, + 1.1526786088943, + .87662625312805, + .95803648233414, + .89513635635376, + .85281348228455, + 1.0852742195129, + .76808404922485, + .96872144937515, + 1.0732915401459, + .02145584858954, + 1.3687089681625, + .50049883127213, + 1.3895837068558, + .6889950633049, + 1.2795144319534, + .7050421833992, + 1.2218985557556, + .74481928348541, + 1.3074514865875, + .7919961810112, + 1.2807723283768, + 1.0120536088943, + 1.1938916444778, + .68923074007034, + 1.6174983978271, + .64740318059921, + 1.4949930906296, + 1.2678960561752, + 1.0586776733398, + .55762887001038, + 1.2790743112564, + .66515874862671, + 1.2538269758224, + .70554333925247, + 1.2391568422318, + .75241559743881, + 1.2129040956497, + .69235223531723, + 1.0785228013992, + .8043577671051, + 1.0037930011749, + .78750842809677, + 1.1880930662155, + .74399447441101, + 1.1791603565216, + .85870295763016, + 1.0032330751419, + .8019300699234, + 1.1696527004242, + .92376220226288, + .99186056852341, + .94733852148056, + 1.0748032331467, + .64247089624405, + .95419937372208, + .92043441534042, + .8104555606842, + .66252142190933, + 1.1178470849991, + .69223344326019, + 1.0570795536041, + .90239083766937, + .95320242643356, + 1.0541093349457, + 1.0082466602325, + 1.1376332044601, + 1.1841852664948, + .90440809726715, + 1.2733660936356, + .66835701465607, + 1.1515763998032, + .44600257277489, + .93500959873199, + 1.0847823619843, + .83353632688522, + 1.0442448854446, + 1.077241897583, + .71010553836823, + .89557945728302, + 1.0163468122482, + 1.094814658165, + .89641278982162, + 1.2808450460434, + 1.0223702192307, + .96094745397568, + 1.309353351593, + .73499941825867, + 2.4902238845825, + -.2579345703125, + 1.9272556304932, + .53125941753387, + .7708500623703, + 1.0312130451202, + 1.6360099315643, + .6022145152092, + 1.6338716745377, + 1.3494771718979, + 1.1322995424271, + 2.1901025772095, + -.72639065980911, + -.37026473879814, + 1.2391144037247, + 1.1353877782822]) + +y = np.array([ + np.nan, + 29.908170700073, + 29.84511756897, + 30.121925354004, + 30.031360626221, + 30.315252304077, + 30.196870803833, + 30.5465965271, + 30.498420715332, + 30.52215385437, + 30.619710922241, + 30.70092010498, + 30.722021102905, + 30.975101470947, + 30.862537384033, + 31.162391662598, + 31.086095809937, + 31.220876693726, + 31.407745361328, + 31.461973190308, + 31.670673370361, + 31.627857208252, + 31.728984832764, + 31.833349227905, + 32.009841918945, + 32.08177947998, + 32.33292388916, + 32.325073242188, + 32.662189483643, + 33.060398101807, + 33.162502288818, + 33.670280456543, + 33.535060882568, + 33.894519805908, + 34.127738952637, + 34.495552062988, + 34.866851806641, + 35.17427444458, + 35.721012115479, + 36.079170227051, + 36.489177703857, + 37.16641998291, + 37.584571838379, + 38.136978149414, + 38.732818603516, + 39.352241516113, + 39.65030670166, + 40.255104064941, + 40.68025970459, + 40.827903747559, + 41.445526123047, + 41.620620727539, + 41.986698150635, + 42.238689422607, + 42.580707550049, + 42.98002243042, + 43.537376403809, + 44.689880371094, + 44.928825378418, + 46.824542999268, + 47.653316497803, + 49.263732910156, + 50.164772033691, + 52.324848175049, + 53.112449645996, + 53.980087280273, + 54.855911254883, + 55.916255950928, + 56.616539001465, + 56.889472961426, + 57.941665649414, + 58.832668304443, + 59.55924987793, + 61.124504089355, + 61.555759429932, + 62.603061676025, + 63.612670898438, + 64.984802246094, + 66.577819824219, + 68.255104064941, + 69.478172302246, + 72.001251220703, + 74.236083984375, + 76.533538818359, + 79.435234069824, + 82.39412689209, + 83.541511535645, + 86.137664794922, + 88.440467834473, + 90.32852935791, + 92.82194519043, + 94.556045532227, + 95.235244750977, + 95.871170043945, + 99.056198120117, + 98.573585510254, + 98.680938720703, + 99.705497741699, + 100.82178497314, + 101.66397857666, + 103.25267791748, + 104.17662811279, + 105.0580368042, + 105.99513244629, + 106.55281066895, + 108.08527374268, + 108.46807861328, + 109.46871948242, + 110.97328948975, + 108.72145080566, + 110.86870574951, + 110.70049285889, + 112.78958892822, + 113.38899230957, + 115.0795211792, + 115.70503997803, + 117.22190093994, + 117.94481658936, + 119.80744934082, + 120.69200134277, + 122.48076629639, + 124.11205291748, + 125.69389343262, + 126.08923339844, + 129.11749267578, + 129.54739379883, + 131.99499511719, + 134.66789245605, + 135.75866699219, + 135.6576385498, + 137.47906494141, + 137.86515808105, + 139.55383300781, + 140.10552978516, + 141.73915100098, + 142.45240783691, + 144.01290893555, + 144.49235534668, + 145.57852172852, + 146.40435791016, + 147.30380249023, + 147.98750305176, + 149.58808898926, + 150.14398193359, + 151.67915344238, + 152.65870666504, + 153.6032409668, + 154.30192565918, + 155.86964416504, + 157.02377319336, + 157.99186706543, + 159.14733886719, + 160.47479248047, + 160.54246520996, + 161.35418701172, + 162.42044067383, + 162.81045532227, + 162.86251831055, + 164.31784057617, + 164.59222412109, + 165.75708007813, + 166.80238342285, + 167.65319824219, + 169.15411376953, + 170.30824279785, + 172.03762817383, + 173.88418579102, + 174.80439758301, + 176.87336730957, + 177.06834411621, + 178.55157470703, + 178.04600524902, + 178.63500976563, + 180.38478088379, + 180.83354187012, + 182.24424743652, + 183.67724609375, + 183.91009521484, + 184.59558105469, + 185.91633605957, + 187.39482116699, + 188.29640197754, + 190.38084411621, + 191.82237243652, + 192.76095581055, + 195.10935974121, + 195.43499755859, + 201.69021606445, + 199.14205932617, + 202.62725830078, + 203.23126220703, + 202.67083740234, + 204.60522460938, + 207.55601501465, + 207.94021606445, + 210.76686096191, + 213.84446716309, + 215.12928771973, + 220.80010986328, + 216.16261291504, + 211.80372619629, + 213.91012573242, + 215.60438537598]) + +resid = np.array([ + np.nan, + -.7581701874733, + -.49511715769768, + -.75192391872406, + -.49135887622833, + -.76525229215622, + -.44687059521675, + -.70659655332565, + -.68842077255249, + -.60215425491333, + -.63971120119095, + -.66091901063919, + -.51202166080475, + -.75510257482529, + -.48253855109215, + -.72239124774933, + -.60609650611877, + -.53087604045868, + -.65774464607239, + -.52197223901749, + -.7206723690033, + -.60785627365112, + -.6089842915535, + -.55334770679474, + -.62984347343445, + -.50177800655365, + -.68292456865311, + -.44507533311844, + -.38219094276428, + -.61039841175079, + -.31250306963921, + -.77027755975723, + -.4350620508194, + -.494520008564, + -.42773708701134, + -.39555323123932, + -.46685197949409, + -.27427339553833, + -.42101442813873, + -.37917038798332, + -.18917952477932, + -.36641922593117, + -.28457221388817, + -.23697751760483, + -.23281940817833, + -.45223876833916, + -.25030693411827, + -.35510078072548, + -.58026248216629, + -.22790426015854, + -.54552561044693, + -.42061823606491, + -.48669815063477, + -.43868899345398, + -.38070866465569, + -.28002023696899, + .16262374818325, + -.48988044261932, + .67117244005203, + -.02454199641943, + .44668045639992, + .0362650193274, + .83522641658783, + -.02484837733209, + -.11245145648718, + .01991361007094, + .0440888479352, + -.1162573993206, + -.51654160022736, + .11052562296391, + -.04166246205568, + -.13266679644585, + .4407517015934, + -.32450538873672, + .04423752427101, + .0969405695796, + .28733000159264, + .51519411802292, + .52217602729797, + .24489280581474, + 1.1218250989914, + .99874752759933, + .96391087770462, + 1.4664648771286, + 1.4647653102875, + .20586840808392, + 1.1584821939468, + 1.062330365181, + .65953236818314, + 1.1714720726013, + .57805341482162, + -.15604154765606, + -.23524549603462, + 1.6288322210312, + -.95619779825211, + -.67358434200287, + .1190680116415, + .09450265020132, + -.02177914790809, + .43602138757706, + .04732597246766, + -.07663082331419, + .0419635027647, + -.29513788223267, + .44718953967094, + -.38527730107307, + .0319189876318, + .43128004670143, + -2.2732961177826, + .77854722738266, + -.66871201992035, + .69950574636459, + -.08958829939365, + .41101104021072, + -.07951752096415, + .2949578166008, + -.02190163731575, + .5551837682724, + .0925500690937, + .50799924135208, + .61922925710678, + .38794788718224, + -.29389011859894, + 1.4107677936554, + -.21750450134277, + .95260292291641, + 1.4050008058548, + .03210696578026, + -.65866851806641, + .54236197471619, + -.27907428145409, + .43484738469124, + -.15383619070053, + .39446276426315, + -.03915995359421, + .34759050607681, + -.21290412545204, + .00764474179596, + .02148328535259, + -.10436081886292, + -.10379911959171, + .41248852014542, + -.18809306621552, + .35601159930229, + .12084264308214, + -.05869990959764, + -.10323911905289, + .39806687831879, + .2303563952446, + -.02376830019057, + .20813637971878, + .25265842676163, + -.57480323314667, + -.14247089624405, + .14580672979355, + -.4204343855381, + -.61045861244202, + .33747857809067, + -.41785016655922, + .10776958614588, + .14291742444038, + -.1023878082633, + .44680669903755, + .14588765799999, + .59174418449402, + .66236984729767, + .01581169478595, + .7956041097641, + -.47337827086449, + .33164295554161, + -.95156413316727, + -.34601172804832, + .66499650478363, + -.38478538393974, + .36646059155464, + .35576421022415, + -.47725108265877, + -.21010553836823, + .30441749095917, + .38366231322289, + .00517613813281, + .80359941720963, + .41915187239647, + -.02237024717033, + 1.039052605629, + -.409359395504, + 3.7650005817413, + -2.2902269363403, + 1.5579376220703, + .072744384408, + -1.3312624692917, + .90316116809845, + 1.3147799968719, + -.21801064908504, + 1.1927837133408, + 1.7281278371811, + .15252174437046, + 3.4807071685791, + -3.9110956192017, + -3.9886209964752, + .86727404594421, + .55887448787689, + .78061258792877]) + +yr = np.array([ + np.nan, + -.7581701874733, + -.49511715769768, + -.75192391872406, + -.49135887622833, + -.76525229215622, + -.44687059521675, + -.70659655332565, + -.68842077255249, + -.60215425491333, + -.63971120119095, + -.66091901063919, + -.51202166080475, + -.75510257482529, + -.48253855109215, + -.72239124774933, + -.60609650611877, + -.53087604045868, + -.65774464607239, + -.52197223901749, + -.7206723690033, + -.60785627365112, + -.6089842915535, + -.55334770679474, + -.62984347343445, + -.50177800655365, + -.68292456865311, + -.44507533311844, + -.38219094276428, + -.61039841175079, + -.31250306963921, + -.77027755975723, + -.4350620508194, + -.494520008564, + -.42773708701134, + -.39555323123932, + -.46685197949409, + -.27427339553833, + -.42101442813873, + -.37917038798332, + -.18917952477932, + -.36641922593117, + -.28457221388817, + -.23697751760483, + -.23281940817833, + -.45223876833916, + -.25030693411827, + -.35510078072548, + -.58026248216629, + -.22790426015854, + -.54552561044693, + -.42061823606491, + -.48669815063477, + -.43868899345398, + -.38070866465569, + -.28002023696899, + .16262374818325, + -.48988044261932, + .67117244005203, + -.02454199641943, + .44668045639992, + .0362650193274, + .83522641658783, + -.02484837733209, + -.11245145648718, + .01991361007094, + .0440888479352, + -.1162573993206, + -.51654160022736, + .11052562296391, + -.04166246205568, + -.13266679644585, + .4407517015934, + -.32450538873672, + .04423752427101, + .0969405695796, + .28733000159264, + .51519411802292, + .52217602729797, + .24489280581474, + 1.1218250989914, + .99874752759933, + .96391087770462, + 1.4664648771286, + 1.4647653102875, + .20586840808392, + 1.1584821939468, + 1.062330365181, + .65953236818314, + 1.1714720726013, + .57805341482162, + -.15604154765606, + -.23524549603462, + 1.6288322210312, + -.95619779825211, + -.67358434200287, + .1190680116415, + .09450265020132, + -.02177914790809, + .43602138757706, + .04732597246766, + -.07663082331419, + .0419635027647, + -.29513788223267, + .44718953967094, + -.38527730107307, + .0319189876318, + .43128004670143, + -2.2732961177826, + .77854722738266, + -.66871201992035, + .69950574636459, + -.08958829939365, + .41101104021072, + -.07951752096415, + .2949578166008, + -.02190163731575, + .5551837682724, + .0925500690937, + .50799924135208, + .61922925710678, + .38794788718224, + -.29389011859894, + 1.4107677936554, + -.21750450134277, + .95260292291641, + 1.4050008058548, + .03210696578026, + -.65866851806641, + .54236197471619, + -.27907428145409, + .43484738469124, + -.15383619070053, + .39446276426315, + -.03915995359421, + .34759050607681, + -.21290412545204, + .00764474179596, + .02148328535259, + -.10436081886292, + -.10379911959171, + .41248852014542, + -.18809306621552, + .35601159930229, + .12084264308214, + -.05869990959764, + -.10323911905289, + .39806687831879, + .2303563952446, + -.02376830019057, + .20813637971878, + .25265842676163, + -.57480323314667, + -.14247089624405, + .14580672979355, + -.4204343855381, + -.61045861244202, + .33747857809067, + -.41785016655922, + .10776958614588, + .14291742444038, + -.1023878082633, + .44680669903755, + .14588765799999, + .59174418449402, + .66236984729767, + .01581169478595, + .7956041097641, + -.47337827086449, + .33164295554161, + -.95156413316727, + -.34601172804832, + .66499650478363, + -.38478538393974, + .36646059155464, + .35576421022415, + -.47725108265877, + -.21010553836823, + .30441749095917, + .38366231322289, + .00517613813281, + .80359941720963, + .41915187239647, + -.02237024717033, + 1.039052605629, + -.409359395504, + 3.7650005817413, + -2.2902269363403, + 1.5579376220703, + .072744384408, + -1.3312624692917, + .90316116809845, + 1.3147799968719, + -.21801064908504, + 1.1927837133408, + 1.7281278371811, + .15252174437046, + 3.4807071685791, + -3.9110956192017, + -3.9886209964752, + .86727404594421, + .55887448787689, + .78061258792877]) + +mse = np.array([ + .77732294797897, + .77732294797897, + .70387578010559, + .69261533021927, + .68906670808792, + .68708789348602, + .68558460474014, + .68429106473923, + .6831266283989, + .68206071853638, + .68107759952545, + .68016695976257, + .67932069301605, + .67853212356567, + .67779558897018, + .67710596323013, + .67645901441574, + .6758508682251, + .67527812719345, + .67473775148392, + .67422717809677, + .67374390363693, + .67328584194183, + .6728510260582, + .67243778705597, + .67204451560974, + .67166984081268, + .67131245136261, + .67097115516663, + .67064493894577, + .67033278942108, + .67003381252289, + .66974723339081, + .66947221755981, + .66920816898346, + .66895437240601, + .66871029138565, + .66847538948059, + .66824907064438, + .66803097724915, + .66782057285309, + .66761755943298, + .66742146015167, + .66723203659058, + .66704881191254, + .66687160730362, + .66670006513596, + .66653394699097, + .66637301445007, + .66621696949005, + .66606563329697, + .66591882705688, + .66577625274658, + .66563785076141, + .66550332307816, + .66537261009216, + .6652455329895, + .66512185335159, + .66500157117844, + .66488444805145, + .66477036476135, + .66465926170349, + .66455101966858, + .66444545984268, + .6643425822258, + .66424214839935, + .66414421796799, + .66404861211777, + .66395533084869, + .66386413574219, + .66377514600754, + .66368812322617, + .66360312700272, + .66351997852325, + .66343873739243, + .6633592247963, + .66328144073486, + .66320532560349, + .66313081979752, + .66305786371231, + .66298645734787, + .6629164814949, + .66284799575806, + .66278082132339, + .66271501779556, + .66265046596527, + .66258722543716, + .6625252366066, + .66246438026428, + .66240465641022, + .66234612464905, + .66228866577148, + .66223222017288, + .66217684745789, + .66212248802185, + .66206908226013, + .66201663017273, + .661965072155, + .66191446781158, + .6618646979332, + .66181582212448, + .66176778078079, + .66172051429749, + .66167408227921, + .66162836551666, + .66158348321915, + .66153925657272, + .66149580478668, + .66145300865173, + .66141092777252, + .6613695025444, + .66132873296738, + .6612885594368, + .66124904155731, + .66121011972427, + .66117179393768, + .66113406419754, + .6610968708992, + .66106027364731, + .66102415323257, + .66098862886429, + .66095358133316, + .66091907024384, + .66088503599167, + .66085147857666, + .66081839799881, + .66078579425812, + .66075360774994, + .66072189807892, + .66069066524506, + .66065979003906, + .66062939167023, + .66059935092926, + .66056972742081, + .66054052114487, + .6605116724968, + .66048324108124, + .6604551076889, + .66042739152908, + .66040003299713, + .66037303209305, + .66034632921219, + .66032004356384, + .66029399633408, + .66026836633682, + .66024297475815, + .66021794080734, + .66019320487976, + .6601687669754, + .66014462709427, + .66012072563171, + .66009718179703, + .66007387638092, + .66005086898804, + .66002810001373, + .66000562906265, + .65998339653015, + .65996146202087, + .65993976593018, + .65991830825806, + .65989708900452, + .65987610816956, + .65985536575317, + .65983480215073, + .6598145365715, + .65979450941086, + .65977466106415, + .65975499153137, + .65973562002182, + .6597164273262, + .65969741344452, + .65967857837677, + .6596599817276, + .65964162349701, + .65962338447571, + .65960538387299, + .6595875620842, + .65956991910934, + .65955245494843, + .65953516960144, + .65951806306839, + .65950113534927, + .65948438644409, + .6594677567482, + .65945136547089, + .65943509340286, + .65941900014877, + .65940302610397, + .65938723087311, + .65937161445618, + .65935611724854, + .65934079885483, + .65932559967041, + .65931057929993, + .65929567813873, + .65928089618683, + .65926629304886, + .65925180912018, + .65923744440079, + .65922319889069, + .65920913219452, + .65919518470764, + .65918135643005]) + +stdp = np.array([ + .92817026376724, + .92817026376724, + .69511789083481, + .77192437648773, + .66135895252228, + .77525061368942, + .64687132835388, + .79659670591354, + .65842008590698, + .71215486526489, + .69971066713333, + .72092038393021, + .68201982975006, + .76510280370712, + .64253836870193, + .78239262104034, + .64609551429749, + .74087703227997, + .71774411201477, + .7119727730751, + .73067259788513, + .67785596847534, + .70898467302322, + .71334755420685, + .72984194755554, + .7017787694931, + .75292426347733, + .67507487535477, + .78219056129456, + .78040039539337, + .71250075101852, + .82028061151505, + .63505899906158, + .79452306032181, + .72773635387421, + .79555094242096, + .76685506105423, + .77427339553833, + .82101213932037, + .77917188405991, + .78917801380157, + .86641925573349, + .78457218408585, + .83697980642319, + .83281791210175, + .85224026441574, + .75030690431595, + .8551008105278, + .78025943040848, + .72790426015854, + .84552866220474, + .72061747312546, + .78669738769531, + .73868823051453, + .78071022033691, + .78002023696899, + .83737623691559, + .98988044261932, + .72882527112961, + 1.2245427370071, + .85331875085831, + 1.1637357473373, + .86477434635162, + 1.3248475790024, + .81245219707489, + .98008638620377, + .85591268539429, + 1.0162551403046, + .8165408372879, + .78947591781616, + .94166398048401, + .93266606330872, + .85924750566483, + 1.1245046854019, + .75576168298721, + 1.0030617713928, + .91267073154449, + 1.0848042964935, + 1.0778224468231, + 1.1551086902618, + .97817331552505, + 1.4012540578842, + 1.2360861301422, + 1.3335381746292, + 1.4352362155914, + 1.4941285848618, + .9415163397789, + 1.437669634819, + 1.2404690980911, + 1.2285294532776, + 1.3219480514526, + 1.1560415029526, + .83524394035339, + .87116771936417, + 1.5561962127686, + .47358739376068, + .78093349933624, + .90549737215042, + 1.0217791795731, + .86397403478622, + 1.1526786088943, + .87662625312805, + .95803648233414, + .89513635635376, + .85281348228455, + 1.0852742195129, + .76808404922485, + .96872144937515, + 1.0732915401459, + .02145584858954, + 1.3687089681625, + .50049883127213, + 1.3895837068558, + .6889950633049, + 1.2795144319534, + .7050421833992, + 1.2218985557556, + .74481928348541, + 1.3074514865875, + .7919961810112, + 1.2807723283768, + 1.0120536088943, + 1.1938916444778, + .68923074007034, + 1.6174983978271, + .64740318059921, + 1.4949930906296, + 1.2678960561752, + 1.0586776733398, + .55762887001038, + 1.2790743112564, + .66515874862671, + 1.2538269758224, + .70554333925247, + 1.2391568422318, + .75241559743881, + 1.2129040956497, + .69235223531723, + 1.0785228013992, + .8043577671051, + 1.0037930011749, + .78750842809677, + 1.1880930662155, + .74399447441101, + 1.1791603565216, + .85870295763016, + 1.0032330751419, + .8019300699234, + 1.1696527004242, + .92376220226288, + .99186056852341, + .94733852148056, + 1.0748032331467, + .64247089624405, + .95419937372208, + .92043441534042, + .8104555606842, + .66252142190933, + 1.1178470849991, + .69223344326019, + 1.0570795536041, + .90239083766937, + .95320242643356, + 1.0541093349457, + 1.0082466602325, + 1.1376332044601, + 1.1841852664948, + .90440809726715, + 1.2733660936356, + .66835701465607, + 1.1515763998032, + .44600257277489, + .93500959873199, + 1.0847823619843, + .83353632688522, + 1.0442448854446, + 1.077241897583, + .71010553836823, + .89557945728302, + 1.0163468122482, + 1.094814658165, + .89641278982162, + 1.2808450460434, + 1.0223702192307, + .96094745397568, + 1.309353351593, + .73499941825867, + 2.4902238845825, + -.2579345703125, + 1.9272556304932, + .53125941753387, + .7708500623703, + 1.0312130451202, + 1.6360099315643, + .6022145152092, + 1.6338716745377, + 1.3494771718979, + 1.1322995424271, + 2.1901025772095, + -.72639065980911, + -.37026473879814, + 1.2391144037247, + 1.1353877782822]) + +icstats = np.array([ + 202, + np.nan, + -245.40783909604, + 5, + 500.81567819208, + 517.35701667909]) + + +results = Bunch( + llf=llf, + nobs=nobs, + k=k, + k_exog=k_exog, + sigma=sigma, + chi2=chi2, + df_model=df_model, + k_ar=k_ar, + k_ma=k_ma, + params=params, + cov_params=cov_params, + xb=xb, + y=y, + resid=resid, + yr=yr, + mse=mse, + stdp=stdp, + icstats=icstats +) diff --git a/shared/package-files/32/3266647fd7bcf4fe8bed249e4942cfa167f61882c76caf36f27930e89ede2b19/blob b/shared/package-files/32/3266647fd7bcf4fe8bed249e4942cfa167f61882c76caf36f27930e89ede2b19/blob new file mode 100644 index 0000000000000000000000000000000000000000..430543ca8dbb396242ee92fb4c8c4030cf40e3af --- /dev/null +++ b/shared/package-files/32/3266647fd7bcf4fe8bed249e4942cfa167f61882c76caf36f27930e89ede2b19/blob @@ -0,0 +1,68 @@ +from typing import ClassVar, Literal, TypeAlias + +from typing_extensions import Generic, Self, TypeVar, override + +from .abstract import ArrayCompatible, Dummy, IterableType, IteratorType, Type +from .iterators import ArrayIterator + +_TypeT_co = TypeVar("_TypeT_co", bound=Type, default=Type, covariant=True) + +_Layout: TypeAlias = Literal["C", "F", "CS", "FS", "A"] + +### + +class Opaque(Dummy): ... + +class SimpleIterableType(IterableType[_TypeT_co], Generic[_TypeT_co]): + def __init__(self, name: str, iterator_type: IteratorType[_TypeT_co]) -> None: ... + @property + @override + def iterator_type(self) -> IteratorType[_TypeT_co]: ... + +class SimpleIteratorType(IteratorType[_TypeT_co], Generic[_TypeT_co]): + def __init__(self, name: str, yield_type: _TypeT_co) -> None: ... + @property + @override + def yield_type(self) -> _TypeT_co: ... + +class Buffer(IterableType, ArrayCompatible): + LAYOUTS: ClassVar[frozenset[_Layout]] = ... + + slice_is_copy: ClassVar[bool] = False + + aligned: bool = True + mutable: bool = True + + def __init__( + self, + dtype: Type, + ndim: int, + layout: _Layout, + readonly: bool = False, + name: str | None = None, + ) -> None: ... + @property # TODO: Use generic `ArrayIterator` once we have `iterators.pyi` + @override + def iterator_type(self) -> ArrayIterator: ... + @property + @override + def as_array(self) -> Self: ... + @property + @override + def key(self) -> tuple[Type, int, _Layout, bool]: ... + + # + @property + def is_c_contig(self) -> bool: ... + @property + def is_f_contig(self) -> bool: ... + @property + def is_contig(self) -> bool: ... + + # + def copy( + self, + dtype: Type | None = None, + ndim: int | None = None, + layout: _Layout | None = None, + ) -> Self: ... diff --git a/shared/package-files/32/3266c5a45817e321b2e8f4aff109897f1f497376b113bfd8b5ef02d7130b30e9/blob b/shared/package-files/32/3266c5a45817e321b2e8f4aff109897f1f497376b113bfd8b5ef02d7130b30e9/blob new file mode 100644 index 0000000000000000000000000000000000000000..1caa0989425a2a374613794d0044f6edbbb60c29 --- /dev/null +++ b/shared/package-files/32/3266c5a45817e321b2e8f4aff109897f1f497376b113bfd8b5ef02d7130b30e9/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _cdist_backward { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, const at::Tensor &, double, const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_cdist_backward") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_cdist_backward(Tensor grad, Tensor x1, Tensor x2, float p, Tensor cdist) -> Tensor") + static at::Tensor call(const at::Tensor & grad, const at::Tensor & x1, const at::Tensor & x2, double p, const at::Tensor & cdist); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad, const at::Tensor & x1, const at::Tensor & x2, double p, const at::Tensor & cdist); +}; + +struct TORCH_API _cdist_backward_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, const at::Tensor &, double, const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_cdist_backward") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_cdist_backward.out(Tensor grad, Tensor x1, Tensor x2, float p, Tensor cdist, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & grad, const at::Tensor & x1, const at::Tensor & x2, double p, const at::Tensor & cdist, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad, const at::Tensor & x1, const at::Tensor & x2, double p, const at::Tensor & cdist, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/32/3267e6992bdbaba3b80d5dda998db1a1c9cbb04d8236c01933ec33c2c14666e0/blob b/shared/package-files/32/3267e6992bdbaba3b80d5dda998db1a1c9cbb04d8236c01933ec33c2c14666e0/blob new file mode 100644 index 0000000000000000000000000000000000000000..c053d20d3a9f24f760ce9195f00f42c65ad382b2 --- /dev/null +++ b/shared/package-files/32/3267e6992bdbaba3b80d5dda998db1a1c9cbb04d8236c01933ec33c2c14666e0/blob @@ -0,0 +1,455 @@ +#cython: boundscheck=False +#cython: wraparound=False +#cython: cdivision=False +""" +State Space Models + +Author: Chad Fulton +License: Simplified-BSD + +Notes +----- + +The dimensions used in all the BLAS / LAPACK calls below use the following +convention: + +- The dimensions of the arrays *as they are to be manipulated* are all defined + as model._k_* +- If the array in question is defined in the Statespace object + (obs, obs_intercept, design, obs_cov, state_intercept, transition, selection, + state_cov, selected_state_cov), then the dimension in-memory is defined as + model._k_* + This is because the in-memory shape of matrices changes according to whether + or not data is missing and whether or not the generalized collapse transform + is applied. +- If the array in question is defined in the Kalman filter object + (forecast_*, filtered_*, predicted_*, etc.), then the dimension in-memory is + defined as kfilter.k_* + This is because the in-memory shape of matrices only changes according to + filter_method. +- If the array in question is defined in the Kalman smoother object + (smoothed_*, etc.), then the dimension in-memory is defined as kfilter.k_* + This is because the in-memory shape of matrices only changes according to + filter_method. + +Thus, for example, a ?gemm call has the following signature: + +dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc) + +- m, n, and k are the dimensions *as they are to be manipulated*, and are + always defined as model._k_* +- lda, ldb, and ldc are the *in-memory* dimension, and they are set as + model._k_* if the array is defined in the Statespace object, otherwise + (in either the filter or smoother cases) they are set as kfilter.k_* + +Note that for ?copy calls, the number of elements to be copied is defined to be +the dimension in memory of the array that is being copied *from*. +""" + +{{py: + +TYPES = { + "s": ("np.float32_t", "np.float32", "np.NPY_FLOAT32"), + "d": ("np.float64_t", "float", "np.NPY_FLOAT64"), + "c": ("np.complex64_t", "np.complex64", "np.NPY_COMPLEX64"), + "z": ("np.complex128_t", "complex", "np.NPY_COMPLEX128"), +} + +}} + +# Typical imports +import numpy as np +cimport numpy as np +from statsmodels.includes.math cimport * +cimport scipy.linalg.cython_blas as blas +include "statsmodels/tsa/statespace/_blas_int.pxi" + +from statsmodels.tsa.statespace._kalman_smoother cimport ( + SMOOTHER_STATE, SMOOTHER_STATE_COV, SMOOTHER_DISTURBANCE, + SMOOTHER_DISTURBANCE_COV +) + +{{for prefix, types in TYPES.items()}} +{{py:cython_type, dtype, typenum = types}} +{{py: +combined_prefix = prefix +combined_cython_type = cython_type +if prefix == 'c': + combined_prefix = 'z' + combined_cython_type = 'np.complex128_t' +if prefix == 's': + combined_prefix = 'd' + combined_cython_type = 'np.float64_t' +}} + +# ### Missing Observation Conventional Kalman smoother +# +# See Durbin and Koopman (2012) Chapter 4.10 +# +# Here k_endog is the same as usual, but the design matrix and observation +# covariance matrix are enforced to be zero matrices. + +cdef int {{prefix}}smoothed_estimators_missing_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model) except *: + cdef: + blas_int inc = 1 + blas_int kf_k_states = kfilter.k_states + blas_int m_k_endog = model._k_endog + blas_int m_k_states = model._k_states + blas_int m_k_states2 = model._k_states2 + {{cython_type}} alpha = 1.0 + {{cython_type}} beta = 0.0 + {{cython_type}} gamma = -1.0 + + # Scaled smoothed estimator + # $r_{t-1} = T_t' r_t$ + # $(m \times 1) = (m \times m) (m \times 1)$ + # Note: save $r_{t-1}$ as scaled_smoothed_estimator[t] rather than + # as scaled_smoothed_estimator[t-1] because we actually need to store + # T+1 of them (r_{T-1} to r_{-1} -> r_T to r_0) + if smoother.smoother_output & (SMOOTHER_STATE | SMOOTHER_DISTURBANCE): + if model.identity_transition: + blas.{{prefix}}copy(&m_k_states, smoother._input_scaled_smoothed_estimator, &inc, smoother._scaled_smoothed_estimator, &inc) + else: + blas.{{prefix}}gemv("T", &m_k_states, &m_k_states, + &alpha, model._transition, &m_k_states, + smoother._input_scaled_smoothed_estimator, &inc, + &beta, smoother._scaled_smoothed_estimator, &inc) + + # Scaled smoothed estimator covariance matrix + # $N_{t-1} = T_t' N_t T_t$ + # $(m \times m) = (m \times m) (m \times m) (m \times m)$ + # Note: save $N_{t-1}$ as scaled_smoothed_estimator_cov[t] rather + # than as scaled_smoothed_estimator_cov[t-1] because we actually + # need to store T+1 of them (N_{T-1} to N_{-1} -> N_T to N_0) + if smoother.smoother_output & (SMOOTHER_STATE_COV | SMOOTHER_DISTURBANCE_COV): + if model.identity_transition: + blas.{{prefix}}copy(&m_k_states2, smoother._input_scaled_smoothed_estimator_cov, &inc, smoother._scaled_smoothed_estimator_cov, &inc) + else: + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_states, &m_k_states, + &alpha, smoother._input_scaled_smoothed_estimator_cov, &kf_k_states, + model._transition, &m_k_states, + &beta, smoother._tmp0, &kf_k_states) + blas.{{prefix}}gemm("T", "N", &kf_k_states, &kf_k_states, &kf_k_states, + &alpha, model._transition, &m_k_states, + smoother._tmp0, &kf_k_states, + &beta, smoother._scaled_smoothed_estimator_cov, &kf_k_states) + + # $L_t = T_t$ + blas.{{prefix}}copy(&m_k_states2, model._transition, &inc, smoother._tmpL, &inc) + + # Smoothing error + # It is undefined here, since F_t^{-1} is nan + # for i in range(kfilter.k_endog): + # smoother._smoothing_error[i] = 0 + + # Smoothing error + # $u_t = - K_t' r_t$ + # $(p \times 1) = (p \times 1) - (p \times m) (m \times 1)$ + # TODO in the missing case, I think K_t is defined to be zeros, so this + # would be unnecessary + if smoother.smoother_output & (SMOOTHER_DISTURBANCE): + blas.{{prefix}}gemv("T", &m_k_states, &m_k_endog, + &gamma, kfilter._kalman_gain, &kf_k_states, + smoother._input_scaled_smoothed_estimator, &inc, + &beta, smoother._smoothing_error, &inc) + +cdef int {{prefix}}smoothed_disturbances_missing_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model): + cdef: + blas_int inc = 1 + blas_int kf_k_posdef = kfilter.k_posdef + blas_int kf_k_states = kfilter.k_states + blas_int m_k_endog = model._k_endog + blas_int m_k_endog2 = model._k_endog2 + blas_int m_k_posdef = model._k_posdef + blas_int m_k_posdef2 = model._k_posdef2 + blas_int m_k_states = model._k_states + {{cython_type}} alpha = 1.0 + {{cython_type}} beta = 0.0 + {{cython_type}} gamma = -1.0 + + # Temporary arrays + + # $\\#_0 = R_t Q_t$ + # $(m \times r) = (m \times r) (r \times r)$ + if smoother.smoother_output & (SMOOTHER_DISTURBANCE | SMOOTHER_DISTURBANCE_COV): + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_posdef, &m_k_posdef, + &alpha, model._selection, &m_k_states, + model._state_cov, &m_k_posdef, + &beta, smoother._tmp0, &kf_k_states) + + if smoother.smoother_output & SMOOTHER_DISTURBANCE: + # Smoothed state disturbance + # $\hat \eta_t = \\#_0' r_t$ + # $(r \times 1) = (r \times m) (m \times 1)$ + blas.{{prefix}}gemv("T", &kf_k_states, &kf_k_posdef, + &alpha, smoother._tmp0, &kf_k_states, + smoother._input_scaled_smoothed_estimator, &inc, + &beta, smoother._smoothed_state_disturbance, &inc) + + if smoother.smoother_output & SMOOTHER_DISTURBANCE_COV: + # Smoothed state disturbance covariance matrix + # $Var(\eta_t | Y_n) = Q_t - \\#_0' N_t \\#_0$ + # $(r \times r) = (r \times r) - (r \times m) (m \times m) (m \times r)$ + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_posdef, &m_k_states, + &alpha, smoother._input_scaled_smoothed_estimator_cov, &kf_k_states, + smoother._tmp0, &kf_k_states, + &beta, smoother._tmpL, &kf_k_states) + blas.{{prefix}}copy(&m_k_posdef2, model._state_cov, &inc, smoother._smoothed_state_disturbance_cov, &inc) + blas.{{prefix}}gemm("T", "N", &m_k_posdef, &m_k_posdef, &m_k_states, + &gamma, smoother._tmp0, &kf_k_states, + smoother._tmpL, &kf_k_states, + &alpha, smoother._smoothed_state_disturbance_cov, &kf_k_posdef) + + + # Just return the unconditional distribution for the measurement + # disturbances corresponding to a missing observation + + # TODO this is not explicitly addressed in Durbin and Koopman Chapter 4 + # or in Koopman (1993) - need to find a source for if this is correct + # Note: this is what the MATLAB ssm toolbox does, also + + # Smoothed measurement disturbances have unconditional expected + # value of 0, so no need to do anything + + # Smoothed measurement and state disturbances have unconditional covariance + # matrix of $H_t, Q_t$, respectively + blas.{{prefix}}copy(&m_k_endog2, model._obs_cov, &inc, smoother._smoothed_measurement_disturbance_cov, &inc) + + +# ### Conventional Kalman smoother +# +# The following are the above routines as defined in the conventional Kalman +# smoother. +# +# See Durbin and Koopman (2012) Chapter 4 + +cdef int {{prefix}}smoothed_estimators_measurement_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model) except *: + cdef: + int i + blas_int inc = 1 + blas_int m_k_endog = model._k_endog + blas_int m_k_states = model._k_states + blas_int m_k_states2 = model._k_states2 + blas_int kf_k_endog = kfilter.k_endog + blas_int kf_k_states = kfilter.k_states + {{cython_type}} alpha = 1.0 + {{cython_type}} beta = 0.0 + {{cython_type}} gamma = -1.0 + + # Smoothing error + # $u_t = \\#_2 - K_t' r_t$ + # $(p \times 1) = (p \times 1) - (p \times m) (m \times 1)$ + if smoother.smoother_output & (SMOOTHER_DISTURBANCE): + blas.{{prefix}}copy(&m_k_endog, kfilter._tmp2, &inc, smoother._smoothing_error, &inc) + blas.{{prefix}}gemv("T", &m_k_states, &m_k_endog, + &gamma, kfilter._kalman_gain, &kf_k_states, + smoother._input_scaled_smoothed_estimator, &inc, + &alpha, smoother._smoothing_error, &inc) + + # $L_t = (T_t - K_t Z_t)$ = (T_t - T_t P_t Z_t' F_t^{-1} Z_t) + # $(m \times m) = (m \times m) + (m \times p) (p \times m)$ + # (this is required for any type of smoothing) + blas.{{prefix}}copy(&m_k_states2, model._transition, &inc, smoother._tmpL, &inc) + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_states, &m_k_endog, + &gamma, kfilter._kalman_gain, &kf_k_states, + model._design, &m_k_endog, + &alpha, smoother._tmpL, &kf_k_states) + + # Scaled smoothed estimator + # $r_{t-1} = Z_t' \\#_2 + L_t' r_t$ + # $(m \times 1) = (m \times p) (p \times 1) + (m \times m) (m \times 1)$ + # Note: save $r_{t-1}$ as scaled_smoothed_estimator[t] rather than + # as scaled_smoothed_estimator[t-1] because we actually need to store + # T+1 of them (r_{T-1} to r_{-1} -> r_T to r_0) + if smoother.smoother_output & (SMOOTHER_STATE | SMOOTHER_DISTURBANCE): + blas.{{prefix}}gemv("T", &m_k_states, &m_k_states, + &alpha, smoother._tmpL, &kf_k_states, + smoother._input_scaled_smoothed_estimator, &inc, + &beta, smoother._scaled_smoothed_estimator, &inc) + + blas.{{prefix}}gemv("T", &m_k_endog, &m_k_states, + &alpha, model._design, &m_k_endog, + kfilter._tmp2, &inc, + &alpha, smoother._scaled_smoothed_estimator, &inc) + + # Scaled smoothed estimator covariance matrix + # $N_{t-1} = Z_t' \\#_3 + L_t' N_t L_t$ + # $(m \times m) = (m \times p) (p \times m) + (m \times m) (m \times m) (m \times m)$ + # Note: save $N_{t-1}$ as scaled_smoothed_estimator_cov[t] rather + # than as scaled_smoothed_estimator_cov[t-1] because we actually + # need to store T+1 of them (N_{T-1} to N_{-1} -> N_T to N_0) + if smoother.smoother_output & (SMOOTHER_STATE_COV | SMOOTHER_DISTURBANCE_COV): + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_states, &m_k_states, + &alpha, smoother._input_scaled_smoothed_estimator_cov, &kf_k_states, + smoother._tmpL, &kf_k_states, + &beta, smoother._tmp0, &kf_k_states) + blas.{{prefix}}gemm("T", "N", &m_k_states, &m_k_states, &m_k_states, + &alpha, smoother._tmpL, &kf_k_states, + smoother._tmp0, &kf_k_states, + &beta, smoother._scaled_smoothed_estimator_cov, &kf_k_states) + blas.{{prefix}}gemm("T", "N", &m_k_states, &m_k_states, &m_k_endog, + &alpha, model._design, &m_k_endog, + kfilter._tmp3, &kf_k_endog, + &alpha, smoother._scaled_smoothed_estimator_cov, &kf_k_states) + +cdef int {{prefix}}smoothed_estimators_time_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model): + pass + +cdef int {{prefix}}smoothed_state_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model): + cdef int i, j + cdef: + blas_int inc = 1 + blas_int kf_k_states = kfilter.k_states + blas_int m_k_states = model._k_states + {{cython_type}} alpha = 1.0 + {{cython_type}} beta = 0.0 + {{cython_type}} gamma = -1.0 + + # Smoothed state + if smoother.smoother_output & SMOOTHER_STATE: + # $\hat \alpha_t = a_t + P_t r_{t-1}$ + # $(m \times 1) = (m \times 1) + (m \times m) (m \times 1)$ + blas.{{prefix}}copy(&kf_k_states, &kfilter.predicted_state[0,smoother.t], &inc, smoother._smoothed_state, &inc) + blas.{{prefix}}gemv("N", &m_k_states, &m_k_states, + &alpha, &kfilter.predicted_state_cov[0,0,smoother.t], &kf_k_states, + smoother._scaled_smoothed_estimator, &inc, + &alpha, smoother._smoothed_state, &inc) + + # Smoothed state covariance + if smoother.smoother_output & SMOOTHER_STATE_COV: + # $V_t = P_t [I - N_{t-1} P_t]$ + # $(m \times m) = (m \times m) [(m \times m) - (m \times m) (m \times m)]$ + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_states, &m_k_states, + &gamma, smoother._scaled_smoothed_estimator_cov, &kf_k_states, + &kfilter.predicted_state_cov[0,0,smoother.t], &kf_k_states, + &beta, smoother._tmp0, &kf_k_states) + for i in range(kfilter.k_states): + smoother.tmp0[i,i] = 1 + smoother.tmp0[i,i] + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_states, &m_k_states, + &alpha, &kfilter.predicted_state_cov[0,0,smoother.t], &kf_k_states, + smoother._tmp0, &kf_k_states, + &beta, smoother._smoothed_state_cov, &kf_k_states) + + +cdef int {{prefix}}smoothed_state_autocov_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model): + cdef: + int i + blas_int inc = 1 + blas_int kf_k_states = kfilter.k_states + blas_int mod_k_states = model.k_states + {{cython_type}} alpha = 1.0 + {{cython_type}} beta = 0.0 + {{cython_type}} gamma = -1.0 + # This function computes Cov(alpha_{t+1}, alpha_t) = Cov(alpha_t, alpha_{t+1})' + # From Durbin and Koopman, 2012, Chapter 4.7 + # Cov(alpha_{t+1}, alpha_t) = (I - P_{t+1} N_{t}) L_t P_t + + blas.{{prefix}}gemm("N", "N", &mod_k_states, &mod_k_states, &mod_k_states, + &gamma, &kfilter.predicted_state_cov[0,0,smoother.t+1], &kf_k_states, + smoother._input_scaled_smoothed_estimator_cov, &kf_k_states, + &beta, smoother._tmp0, &kf_k_states) + for i in range(kfilter.k_states): + smoother.tmp0[i,i] = 1 + smoother.tmp0[i,i] + + blas.{{prefix}}gemm("N", "N", &mod_k_states, &mod_k_states, &mod_k_states, + &alpha, smoother._tmpL, &kf_k_states, + &kfilter.predicted_state_cov[0,0,smoother.t], &kf_k_states, + &beta, smoother._tmp_autocov, &kf_k_states) + + blas.{{prefix}}gemm("N", "N", &mod_k_states, &mod_k_states, &mod_k_states, + &alpha, smoother._tmp0, &kf_k_states, + smoother._tmp_autocov, &kf_k_states, + &beta, smoother._smoothed_state_autocov, &kf_k_states) + +cdef int {{prefix}}smoothed_disturbances_conventional({{prefix}}KalmanSmoother smoother, {{prefix}}KalmanFilter kfilter, {{prefix}}Statespace model): + cdef int i, j + cdef: + blas_int inc = 1 + blas_int kf_k_endog = kfilter.k_endog + blas_int kf_k_posdef = kfilter.k_posdef + blas_int kf_k_states = kfilter.k_states + blas_int m_k_endog = model._k_endog + blas_int m_k_posdef = model._k_posdef + blas_int m_k_posdef2 = model._k_posdef2 + blas_int m_k_states = model._k_states + {{cython_type}} alpha = 1.0 + {{cython_type}} beta = 0.0 + {{cython_type}} gamma = -1.0 + + # Temporary arrays + + # $\\#_0 = R_t Q_t$ + # $(m \times r) = (m \times r) (r \times r)$ + if smoother.smoother_output & (SMOOTHER_DISTURBANCE | SMOOTHER_DISTURBANCE_COV): + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_posdef, &m_k_posdef, + &alpha, model._selection, &m_k_states, + model._state_cov, &m_k_posdef, + &beta, smoother._tmp0, &kf_k_states) + + if smoother.smoother_output & SMOOTHER_DISTURBANCE: + # Smoothed measurement disturbance + # $\hat \varepsilon_t = H_t u_t$ + # $(p \times 1) = (p \times p) (p \times 1)$ + blas.{{prefix}}gemv("N", &m_k_endog, &m_k_endog, + &alpha, model._obs_cov, &m_k_endog, + smoother._smoothing_error, &inc, + &beta, smoother._smoothed_measurement_disturbance, &inc) + + # Smoothed state disturbance + # $\hat \eta_t = \\#_0' r_t$ + # $(r \times 1) = (r \times m) (m \times 1)$ + blas.{{prefix}}gemv("T", &m_k_states, &m_k_posdef, + &alpha, smoother._tmp0, &kf_k_states, + smoother._input_scaled_smoothed_estimator, &inc, + &beta, smoother._smoothed_state_disturbance, &inc) + + if smoother.smoother_output & SMOOTHER_DISTURBANCE_COV: + # $\\#_00 = K_t H_t$ + # $(m \times p) = (m \times p) (p \times p)$ + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_endog, &m_k_endog, + &alpha, kfilter._kalman_gain, &kf_k_states, + model._obs_cov, &m_k_endog, + &beta, smoother._tmp00, &kf_k_states) + + # Smoothed measurement disturbance covariance matrix + # $Var(\varepsilon_t | Y_n) = H_t - H_t \\#_4 - \\#_00' N_t \\#_00$ + # $(p \times p) = (p \times p) - (p \times p) (p \times p) - (p \times m) (m \times m) (m \times p)$ + blas.{{prefix}}gemm("N", "N", &m_k_endog, &m_k_endog, &m_k_endog, + &gamma, model._obs_cov, &m_k_endog, + kfilter._tmp4, &kf_k_endog, + &beta, smoother._smoothed_measurement_disturbance_cov, &kf_k_endog) + + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_endog, &m_k_states, + &alpha, smoother._input_scaled_smoothed_estimator_cov, &kf_k_states, + smoother._tmp00, &kf_k_states, + &beta, smoother._tmp000, &kf_k_states) + + blas.{{prefix}}gemm("T", "N", &m_k_endog, &m_k_endog, &m_k_states, + &gamma, smoother._tmp00, &kf_k_states, + smoother._tmp000, &kf_k_states, + &alpha, smoother._smoothed_measurement_disturbance_cov, &kf_k_endog) + + # blas.{{prefix}}axpy(&model._k_endog2, &alpha, + # model._obs_cov, &inc, + # smoother._smoothed_measurement_disturbance_cov, &inc) + for i in range(kfilter.k_endog): + for j in range(i+1): + smoother._smoothed_measurement_disturbance_cov[i + j*kfilter.k_endog] = model._obs_cov[i + j*model._k_endog] + smoother._smoothed_measurement_disturbance_cov[i + j*kfilter.k_endog] + if not i == j: + smoother._smoothed_measurement_disturbance_cov[j + i*kfilter.k_endog] = model._obs_cov[j + i*model._k_endog] + smoother._smoothed_measurement_disturbance_cov[j + i*kfilter.k_endog] + + # Smoothed state disturbance covariance matrix + # $Var(\eta_t | Y_n) = Q_t - \\#_0' N_t \\#_0$ + # $(r \times r) = (r \times r) - (r \times m) (m \times m) (m \times r)$ + blas.{{prefix}}gemm("N", "N", &m_k_states, &m_k_posdef, &m_k_states, + &alpha, smoother._input_scaled_smoothed_estimator_cov, &kf_k_states, + smoother._tmp0, &kf_k_states, + &beta, smoother._tmpL, &kf_k_states) + + blas.{{prefix}}copy(&m_k_posdef2, model._state_cov, &inc, smoother._smoothed_state_disturbance_cov, &inc) + blas.{{prefix}}gemm("T", "N", &m_k_posdef, &m_k_posdef, &m_k_states, + &gamma, smoother._tmp0, &kf_k_states, + smoother._tmpL, &kf_k_states, + &alpha, smoother._smoothed_state_disturbance_cov, &kf_k_posdef) + +{{endfor}} \ No newline at end of file diff --git a/shared/package-files/32/3269b056aff788416a4cddb0c57e2d6a2a34b8df4616a35447eab204eb9c9bc3/blob b/shared/package-files/32/3269b056aff788416a4cddb0c57e2d6a2a34b8df4616a35447eab204eb9c9bc3/blob new file mode 100644 index 0000000000000000000000000000000000000000..c20d6f9971d00e6c4a64acc7fc26c7f5c8d21d3b --- /dev/null +++ b/shared/package-files/32/3269b056aff788416a4cddb0c57e2d6a2a34b8df4616a35447eab204eb9c9bc3/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3269b056aff788416a4cddb0c57e2d6a2a34b8df4616a35447eab204eb9c9bc3 +size 624464 diff --git a/shared/package-files/32/326b8a1ee706ee7b1a033172666c2c6b1ededfaef6d97a811c2fc26ade3aed9f/blob b/shared/package-files/32/326b8a1ee706ee7b1a033172666c2c6b1ededfaef6d97a811c2fc26ade3aed9f/blob new file mode 100644 index 0000000000000000000000000000000000000000..8b053651d163059d12c1a1fd2ca8c8ef0c4b1fd3 --- /dev/null +++ b/shared/package-files/32/326b8a1ee706ee7b1a033172666c2c6b1ededfaef6d97a811c2fc26ade3aed9f/blob @@ -0,0 +1,21 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API int64_t q_per_channel_axis(const at::Tensor & self); +} // namespace native +} // namespace at diff --git a/shared/package-files/32/326f7950937ae1bdd50169bf8a604bde6c2e1a758b32d015a4dc5996eac1e9e2/blob b/shared/package-files/32/326f7950937ae1bdd50169bf8a604bde6c2e1a758b32d015a4dc5996eac1e9e2/blob new file mode 100644 index 0000000000000000000000000000000000000000..2c3a444105deb3699726f08beff8f4295b5bf537 --- /dev/null +++ b/shared/package-files/32/326f7950937ae1bdd50169bf8a604bde6c2e1a758b32d015a4dc5996eac1e9e2/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:326f7950937ae1bdd50169bf8a604bde6c2e1a758b32d015a4dc5996eac1e9e2 +size 136922 diff --git a/shared/package-files/32/3270fc5dca024bd4ca78976d961dff9407e839dcbb5ba317488005aa1a93b536/blob b/shared/package-files/32/3270fc5dca024bd4ca78976d961dff9407e839dcbb5ba317488005aa1a93b536/blob new file mode 100644 index 0000000000000000000000000000000000000000..443a28ece88d690da46328acc9cc6074ccd8bb1e --- /dev/null +++ b/shared/package-files/32/3270fc5dca024bd4ca78976d961dff9407e839dcbb5ba317488005aa1a93b536/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3270fc5dca024bd4ca78976d961dff9407e839dcbb5ba317488005aa1a93b536 +size 548864 diff --git a/shared/package-files/32/3271b08d2ebcc4be44ac1c0049ebba3ebe19a47420c23a971a7babeb76fc6207/blob b/shared/package-files/32/3271b08d2ebcc4be44ac1c0049ebba3ebe19a47420c23a971a7babeb76fc6207/blob new file mode 100644 index 0000000000000000000000000000000000000000..d80839dc7e4729b948914991c9ddf8e7f3e01cb6 --- /dev/null +++ b/shared/package-files/32/3271b08d2ebcc4be44ac1c0049ebba3ebe19a47420c23a971a7babeb76fc6207/blob @@ -0,0 +1,178 @@ +import itertools +import unittest.mock +from contextlib import contextmanager +from typing import Iterator + +import torch +import torch._C +import torch._ops +import torch.utils._python_dispatch +import torch.utils._pytree as pytree + +__all__ = ["enable_python_dispatcher", "no_python_dispatcher", "enable_pre_dispatch"] + +no_python_dispatcher = torch._C._DisablePythonDispatcher +enable_python_dispatcher = torch._C._EnablePythonDispatcher +enable_pre_dispatch = torch._C._EnablePreDispatch + +CROSSREF_FUNCTIONALIZE = False + + +def all_py_loaded_overloads() -> Iterator[torch._ops.OpOverload]: + """ + Warning: the set of overloads this will report is very subtle. It is precisely + the set of torch.ops functions that have actually been accessed from Python + (e.g., we actually called torch.ops.aten.blah at some point. This is DIFFERENT + from the set of registered operators, which will in general be a larger set, + as this would include all operators which we ran C++ static initializers or + Python operator registration on. This does not eagerly populate the list on + torch.ops.aten; this list is lazy! + + In other words, this is good for traversing over everything that has an + OpOverload object allocated in Python. We use it for cache invalidation, but + don't rely on this list being complete. + + Note that even if we did report all C++ registered overloads, this isn't guaranteed + to be complete either, as a subsequent lazy load of a library which triggers more + registrations could add more things to the set. + """ + for ns in torch.ops: + packets = getattr(torch.ops, ns) + for op_name in packets: + packet = getattr(packets, op_name) + for overload in packet: + yield getattr(packet, overload) + + +@contextmanager +def suspend_functionalization(): + f_tls = torch._C._dispatch_tls_is_dispatch_key_included( + torch._C.DispatchKey.Functionalize + ) + f_rv = torch._C._functionalization_reapply_views_tls() + if f_tls: + torch._disable_functionalization() + try: + yield + finally: + if f_tls: + torch._enable_functionalization(reapply_views=f_rv) + + +def check_tensor_metadata_matches(nv, rv, desc): + assert callable(desc) + assert nv.size() == rv.size(), f"{desc()}: sizes {nv.size()} != {rv.size()}" + assert nv.dtype == rv.dtype, f"{desc()}: dtype {nv.dtype} != {rv.dtype}" + same_strides, idx = torch._prims_common.check_significant_strides( + nv, rv, only_cuda=False + ) + assert ( + same_strides + ), f"{desc()}: strides {nv.stride()} != {rv.stride()} (mismatch at index {idx})" + + +def check_metadata_matches(n, r, desc): + assert callable(desc) + n_vals, n_spec = pytree.tree_flatten(n) + r_vals, r_spec = pytree.tree_flatten(r) + # TODO: test the specs match; empirically sometimes we have a tuple + # on one side and a list on the other + assert len(n_vals) == len(r_vals), f"{len(n_vals)} != {len(r_vals)}" + for i, nv, rv in zip(range(len(n_vals)), n_vals, r_vals): + if not isinstance(rv, torch.Tensor): + continue + check_tensor_metadata_matches(nv, rv, lambda: f"{desc()} output {i}") + + +class Lit: + def __init__(self, s): + self.s = s + + def __repr__(self): + return self.s + + +def _fmt(a: object) -> object: + if isinstance(a, torch.Tensor): + return Lit( + f"torch.empty_strided({tuple(a.size())}, {a.stride()}, dtype={a.dtype})" + ) + else: + return a + + +def make_crossref_functionalize(op, final_key): + from torch._subclasses.fake_tensor import FakeTensorMode + + # This case is pretty weird, suppress it for now + if op == torch.ops.aten.lift_fresh.default: + return final_key + + def handler(*args, **kwargs): + fake_mode = FakeTensorMode() + + def fakeify_defun(t): + if isinstance(t, torch.Tensor): + if torch._is_functional_tensor(t): + r = torch._from_functional_tensor(t) + # NB: This assumes that the inner tensor sizes/strides match + # the outer tensor sizes/strides. This doesn't necessarily have to + # be the case, see discussion at + # https://github.com/pytorch/pytorch/pull/87610/files/401ddeda1d769bedc88a12de332c7357b60e51a4#r1007264456 + assert t.size() == r.size() + assert t.stride() == r.stride() + else: + r = t + # TODO: suppress guards + return fake_mode.from_tensor(r) + return t + + def maybe_detach(t): + if isinstance(t, torch.Tensor): + return t.detach() + else: + return t + + # TODO: This probably does the wrong thing if you're running other + # substantive modes with the normal op outside here + with torch.utils._python_dispatch._disable_current_modes(), suspend_functionalization(): + f_args, f_kwargs = pytree.tree_map(fakeify_defun, (args, kwargs)) + orig_f_args, orig_f_kwargs = pytree.tree_map( + maybe_detach, (f_args, f_kwargs) + ) + with fake_mode: + f_r = op(*f_args, **f_kwargs) + r = op._op_dk(final_key, *args, **kwargs) + + def desc(): + fmt_args = ", ".join( + itertools.chain( + (repr(pytree.tree_map(_fmt, a)) for a in orig_f_args), + ( + f"{k}={pytree.tree_map(_fmt, v)}" + for k, v in orig_f_kwargs.items() + ), + ) + ) + return f"{op}({fmt_args})" + + check_metadata_matches(f_r, r, desc) + return r + + return handler + + +# NB: enabling this is slow, don't do it in a hot loop. This is purely +# for debugging purposes. +@contextmanager +def enable_crossref_functionalize(): + for op in all_py_loaded_overloads(): + op._uncache_dispatch(torch._C.DispatchKey.Functionalize) + try: + with enable_python_dispatcher(), unittest.mock.patch( + "torch._dispatch.python.CROSSREF_FUNCTIONALIZE", True + ): + yield + finally: + for op in all_py_loaded_overloads(): + op._uncache_dispatch(torch._C.DispatchKey.Functionalize) diff --git a/shared/package-files/32/32727362022261ce8aef23c6033ccaa243366301dba98c16cd5a447d0c1d61ff/blob b/shared/package-files/32/32727362022261ce8aef23c6033ccaa243366301dba98c16cd5a447d0c1d61ff/blob new file mode 100644 index 0000000000000000000000000000000000000000..ad2deebbdc4fcaa02a75b658ea607869a3b79f19 --- /dev/null +++ b/shared/package-files/32/32727362022261ce8aef23c6033ccaa243366301dba98c16cd5a447d0c1d61ff/blob @@ -0,0 +1,89 @@ +from collections import OrderedDict +from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union + +from django.contrib.admin.filters import ListFilter, SimpleListFilter +from django.contrib.admin.options import ( # noqa: F401 + ModelAdmin, + IS_POPUP_VAR as IS_POPUP_VAR, + TO_FIELD_VAR as TO_FIELD_VAR, +) +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.base import Model +from django.db.models.expressions import Combinable, CombinedExpression, OrderBy +from django.db.models.query import QuerySet + +from django.db.models.options import Options +from django.forms.formsets import BaseFormSet + +ALL_VAR: str +ORDER_VAR: str +ORDER_TYPE_VAR: str +PAGE_VAR: str +SEARCH_VAR: str +ERROR_FLAG: str +IGNORED_PARAMS: Any + +class ChangeList: + model: Type[Model] = ... + opts: Options = ... + lookup_opts: Options = ... + root_queryset: QuerySet = ... + list_display: List[str] = ... + list_display_links: List[str] = ... + list_filter: Tuple = ... + date_hierarchy: None = ... + search_fields: Tuple = ... + list_select_related: bool = ... + list_per_page: int = ... + list_max_show_all: int = ... + model_admin: ModelAdmin = ... + preserved_filters: str = ... + sortable_by: Tuple[str] = ... + page_num: int = ... + show_all: bool = ... + is_popup: bool = ... + to_field: None = ... + params: Dict[Any, Any] = ... + list_editable: Tuple = ... + query: str = ... + queryset: Any = ... + title: Any = ... + pk_attname: Any = ... + formset: Optional[BaseFormSet] + def __init__( + self, + request: WSGIRequest, + model: Type[Model], + list_display: Union[List[Union[Callable, str]], Tuple[str]], + list_display_links: Optional[Union[List[Callable], List[str], Tuple[str]]], + list_filter: Union[List[Type[SimpleListFilter]], List[str], Tuple], + date_hierarchy: Optional[str], + search_fields: Union[List[str], Tuple], + list_select_related: Union[Tuple, bool], + list_per_page: int, + list_max_show_all: int, + list_editable: Union[List[str], Tuple], + model_admin: ModelAdmin, + sortable_by: Union[List[Callable], List[str], Tuple], + ) -> None: ... + def get_filters_params(self, params: None = ...) -> Dict[str, str]: ... + def get_filters(self, request: WSGIRequest) -> Tuple[List[ListFilter], bool, Dict[str, Union[bool, str]], bool]: ... + def get_query_string( + self, new_params: Optional[Dict[str, None]] = ..., remove: Optional[List[str]] = ... + ) -> str: ... + result_count: Any = ... + show_full_result_count: Any = ... + show_admin_actions: Any = ... + full_result_count: Any = ... + result_list: Any = ... + can_show_all: Any = ... + multi_page: Any = ... + paginator: Any = ... + def get_results(self, request: WSGIRequest) -> None: ... + def get_ordering_field(self, field_name: Union[Callable, str]) -> Optional[Union[CombinedExpression, str]]: ... + def get_ordering(self, request: WSGIRequest, queryset: QuerySet) -> List[Union[OrderBy, Combinable, str]]: ... + def get_ordering_field_columns(self) -> OrderedDict: ... + def get_queryset(self, request: WSGIRequest) -> QuerySet: ... + def apply_select_related(self, qs: QuerySet) -> QuerySet: ... + def has_related_field_in_list_display(self) -> bool: ... + def url_for_result(self, result: Model) -> str: ... diff --git a/shared/package-files/32/3274c9b8ef51d63ad66c52f2efd0d4e0c2005d05e016f9abf1c487416b283644/blob b/shared/package-files/32/3274c9b8ef51d63ad66c52f2efd0d4e0c2005d05e016f9abf1c487416b283644/blob new file mode 100644 index 0000000000000000000000000000000000000000..2a6f18f26a9b422ba359fdbf1dbb9e6acfdb5e35 --- /dev/null +++ b/shared/package-files/32/3274c9b8ef51d63ad66c52f2efd0d4e0c2005d05e016f9abf1c487416b283644/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API ::std::tuple geqrf(const at::Tensor & self); +TORCH_API ::std::tuple geqrf_out(at::Tensor & a, at::Tensor & tau, const at::Tensor & self); +TORCH_API ::std::tuple geqrf_outf(const at::Tensor & self, at::Tensor & a, at::Tensor & tau); + +} // namespace cpu +} // namespace at diff --git a/shared/package-files/32/3275a7d95bc6b63c412f8f9f7c4c4bc1d6e8d1927b38e155f7ef99dda936ef74/blob b/shared/package-files/32/3275a7d95bc6b63c412f8f9f7c4c4bc1d6e8d1927b38e155f7ef99dda936ef74/blob new file mode 100644 index 0000000000000000000000000000000000000000..89ff7309fb08d685f4e7858eeb6036b218ecd7f6 --- /dev/null +++ b/shared/package-files/32/3275a7d95bc6b63c412f8f9f7c4c4bc1d6e8d1927b38e155f7ef99dda936ef74/blob @@ -0,0 +1,218 @@ +# mypy: ignore-errors + +from typing import Dict, Tuple + +import torch +import torch.distributed.rpc as rpc +from torch import Tensor +from torch.distributed.rpc import RRef +from torch.testing._internal.dist_utils import ( + dist_init, + worker_name, + wait_until_pending_futures_and_users_flushed +) +from torch.testing._internal.distributed.rpc.rpc_agent_test_fixture import ( + RpcAgentTestFixture, +) + + +@torch.jit.script +def two_args_two_kwargs( + first_arg, + second_arg, + first_kwarg=torch.tensor([3, 3]), + second_kwarg=torch.tensor([4, 4]), +): + return first_arg + second_arg + first_kwarg + second_kwarg + + +@torch.jit.script +def script_rpc_async_call( + dst_worker_name: str, args: Tuple[Tensor, Tensor], kwargs: Dict[str, Tensor] +): + fut = rpc.rpc_async(dst_worker_name, two_args_two_kwargs, args, kwargs) + ret = fut.wait() + return ret + + +@torch.jit.script +def rpc_async_call_with_timeout( + dst_worker_name: str, + args: Tuple[Tensor, Tensor], + kwargs: Dict[str, Tensor], + timeout: float, +): + fut = rpc.rpc_async(dst_worker_name, two_args_two_kwargs, args, kwargs, timeout) + ret = fut.wait() + return ret + + +@torch.jit.script +def rpc_async_call_with_timeout_future_ret( + dst_worker_name: str, + args: Tuple[Tensor, Tensor], + kwargs: Dict[str, Tensor], + timeout: float, +): + fut = rpc.rpc_async(dst_worker_name, two_args_two_kwargs, args, kwargs, timeout) + return fut + + +@torch.jit.script +def rpc_async_call_future_ret( + dst_worker_name: str, args: Tuple[Tensor, Tensor], kwargs: Dict[str, Tensor] +): + fut = rpc.rpc_async(dst_worker_name, two_args_two_kwargs, args, kwargs) + return fut + +@torch.jit.script +def rref_to_here(rref_var: RRef[Tensor]) -> Tensor: + return rref_var.to_here() + +@torch.jit.script +def rref_to_here_with_timeout(rref_var: RRef[Tensor], timeout: float) -> Tensor: + return rref_var.to_here(timeout) + +@torch.jit.script +def rpc_async_with_rref_arg(dst_worker_name: str, args: Tuple[RRef[Tensor]]) -> Tensor: + fut = rpc.rpc_async(dst_worker_name, rref_to_here, args) + ret = fut.wait() + return ret + + +class JitFaultyAgentRpcTest(RpcAgentTestFixture): + """ + Run tests for rpc_async in JIT under the faulty agent test fixture to test + arbitrary timeouts. + """ + @dist_init(faulty_messages=[], messages_to_delay={"SCRIPT_CALL": 1.5}) + def test_timeout_in_torchscript_function(self): + # Call rpc_async + fut.wait() in torchscript function and ensure that + # timeout is raised. + if self.rank != 0: + return + + dst_worker_name = worker_name((self.rank + 1) % self.world_size) + + args = (torch.tensor([1, 1]), torch.tensor([2, 2])) + kwargs = { + "first_kwarg": torch.tensor([2, 2]), + "second_kwarg": torch.tensor([3, 3]), + } + expected_error = self.get_timeout_error_regex() + # Ensure that we get a timeout if we override the default timeout and + # the RPC takes longer to execute. + with self.assertRaisesRegex(RuntimeError, expected_error): + rpc_async_call_with_timeout(dst_worker_name, args, kwargs, 0.5) + + # Ensure that we timeout if we don't specify a timeout but the default + # is less than the RPC takes to execute. + rpc._set_rpc_timeout(0.001) + with self.assertRaisesRegex(RuntimeError, expected_error): + script_rpc_async_call( + dst_worker_name, args, kwargs + ) + + # Ensure that we run to completion if zero timeout is specified. + ret = rpc_async_call_with_timeout(dst_worker_name, args, kwargs, 0) + self.assertEqual(ret, torch.tensor([8, 8])) + # reset for clean shutdown + rpc._set_rpc_timeout(rpc.constants.DEFAULT_RPC_TIMEOUT_SEC) + + @dist_init(faulty_messages=[], messages_to_delay={"SCRIPT_CALL": 1.5}) + def test_timeout_in_python(self): + # Ensures timeouts are raised if we call rpc_async from within a + # torchscript function, but wait on the future in python. + if self.rank != 0: + return + + dst_worker_name = worker_name((self.rank + 1) % self.world_size) + args = (torch.tensor([1, 1]), torch.tensor([2, 2])) + kwargs = { + "first_kwarg": torch.tensor([2, 2]), + "second_kwarg": torch.tensor([3, 3]), + } + expected_error = self.get_timeout_error_regex() + + fut = rpc_async_call_with_timeout_future_ret(dst_worker_name, args, kwargs, 0.5) + with self.assertRaisesRegex(RuntimeError, expected_error): + fut.wait() + + # Ensure timeout if we don't specify but the default is less than the + # RPC takes to execute. + rpc._set_rpc_timeout(0.001) + fut = rpc_async_call_future_ret(dst_worker_name, args, kwargs) + with self.assertRaisesRegex(RuntimeError, expected_error): + fut.wait() + + # Ensure run to completion if zero timeout is specified + fut = rpc_async_call_with_timeout_future_ret(dst_worker_name, args, kwargs, 0) + result = fut.wait() + self.assertEqual(result, torch.tensor([8, 8])) + # reset for clean shutdown + rpc._set_rpc_timeout(rpc.constants.DEFAULT_RPC_TIMEOUT_SEC) + + @dist_init(faulty_messages=["SCRIPT_REMOTE_CALL"]) + def test_remote_timeout_to_here_in_jit(self): + # Test that calling to_here() in JIT will raise timeout error if + # rpc.remote failed. + if self.rank != 0: + return + dst_rank = (self.rank + 1) % self.world_size + dst_worker = f"worker{dst_rank}" + rref = rpc.remote( + dst_worker, torch.add, args=(torch.tensor(1), torch.tensor(1)) + ) + # Will ensure error handling callbacks are run. + wait_until_pending_futures_and_users_flushed() + # Call to_here() within a ScriptFunction and ensure it raises + with self.assertRaisesRegex(RuntimeError, "RRef creation"): + rref_to_here(rref) + + @dist_init(faulty_messages=[], messages_to_delay={"SCRIPT_RREF_FETCH_CALL": 1}) + def test_rref_to_here_timeout_in_jit(self): + if self.rank != 0: + return + + dst_rank = (self.rank + 1) % self.world_size + dst_worker = f"worker{dst_rank}" + rref = rpc.remote( + dst_worker, torch.add, args=(torch.tensor(1), torch.tensor(1)) + ) + expected_error = self.get_timeout_error_regex() + with self.assertRaisesRegex(RuntimeError, expected_error): + rref_to_here_with_timeout(rref, 0.01) + + rref_to_here_with_timeout(rref, 100) + + @dist_init(faulty_messages=["SCRIPT_REMOTE_CALL"]) + def test_rref_timeout_pickle_in_jit(self): + if self.rank != 0: + return + dst_rank = (self.rank + 1) % self.world_size + dst_worker = f"worker{dst_rank}" + rref = rpc.remote( + dst_worker, torch.add, args=(torch.tensor(1), torch.tensor(1)) + ) + # Will ensure error handling callbacks are run. + wait_until_pending_futures_and_users_flushed() + # Call RPC with RRef arg in JIT, which will go through JIT pickling and + # ensure error is raised. + with self.assertRaisesRegex(RuntimeError, "RRef creation"): + rpc_async_with_rref_arg(dst_worker, (rref, )) + + @dist_init(faulty_messages=["SCRIPT_REMOTE_CALL"]) + def test_rref_timeout_pickle_script_func(self): + # Similar to above test, but calls python rpc with script function. + if self.rank != 0: + return + dst_rank = (self.rank + 1) % self.world_size + dst_worker = f"worker{dst_rank}" + rref = rpc.remote( + dst_worker, torch.add, args=(torch.tensor(1), torch.tensor(1)) + ) + # Will ensure error handling callbacks are run. + wait_until_pending_futures_and_users_flushed() + # Call RPC with script function that takes RRef, ensure timeout during pickling + with self.assertRaisesRegex(RuntimeError, "RRef creation"): + rpc.rpc_sync(dst_worker, rref_to_here, args=(rref, )) diff --git a/shared/package-files/32/327712548fe5f75e2a116d82520fe58af42b27a01c3b1bf399a88d39dce53a80/blob b/shared/package-files/32/327712548fe5f75e2a116d82520fe58af42b27a01c3b1bf399a88d39dce53a80/blob new file mode 100644 index 0000000000000000000000000000000000000000..bfbcdcff51ee6e7f50325962a44209a5c5bf9653 --- /dev/null +++ b/shared/package-files/32/327712548fe5f75e2a116d82520fe58af42b27a01c3b1bf399a88d39dce53a80/blob @@ -0,0 +1,717 @@ +from datetime import ( + date, + datetime, + time, + timedelta, +) + +import numpy as np +import pytest + +from pandas._libs import index as libindex +from pandas.compat.numpy import np_long + +import pandas as pd +from pandas import ( + DatetimeIndex, + Index, + Timestamp, + bdate_range, + date_range, + notna, +) +import pandas._testing as tm + +from pandas.tseries.frequencies import to_offset + +START, END = datetime(2009, 1, 1), datetime(2010, 1, 1) + + +class TestGetItem: + def test_getitem_slice_keeps_name(self): + # GH4226 + st = Timestamp("2013-07-01 00:00:00", tz="America/Los_Angeles") + et = Timestamp("2013-07-02 00:00:00", tz="America/Los_Angeles") + dr = date_range(st, et, freq="h", name="timebucket") + assert dr[1:].name == dr.name + + @pytest.mark.parametrize("tz", [None, "Asia/Tokyo"]) + def test_getitem(self, tz): + idx = date_range("2011-01-01", "2011-01-31", freq="D", tz=tz, name="idx") + + result = idx[0] + assert result == Timestamp("2011-01-01", tz=idx.tz) + + result = idx[0:5] + expected = date_range( + "2011-01-01", "2011-01-05", freq="D", tz=idx.tz, name="idx" + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + result = idx[0:10:2] + expected = date_range( + "2011-01-01", "2011-01-09", freq="2D", tz=idx.tz, name="idx" + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + result = idx[-20:-5:3] + expected = date_range( + "2011-01-12", "2011-01-24", freq="3D", tz=idx.tz, name="idx" + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + result = idx[4::-1] + expected = DatetimeIndex( + ["2011-01-05", "2011-01-04", "2011-01-03", "2011-01-02", "2011-01-01"], + dtype=idx.dtype, + freq="-1D", + name="idx", + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + @pytest.mark.parametrize("freq", ["B", "C"]) + def test_dti_business_getitem(self, freq): + rng = bdate_range(START, END, freq=freq) + smaller = rng[:5] + exp = DatetimeIndex(rng.view(np.ndarray)[:5], freq=freq) + tm.assert_index_equal(smaller, exp) + assert smaller.freq == exp.freq + assert smaller.freq == rng.freq + + sliced = rng[::5] + assert sliced.freq == to_offset(freq) * 5 + + fancy_indexed = rng[[4, 3, 2, 1, 0]] + assert len(fancy_indexed) == 5 + assert isinstance(fancy_indexed, DatetimeIndex) + assert fancy_indexed.freq is None + + # 32-bit vs. 64-bit platforms + assert rng[4] == rng[np_long(4)] + + @pytest.mark.parametrize("freq", ["B", "C"]) + def test_dti_business_getitem_matplotlib_hackaround(self, freq): + rng = bdate_range(START, END, freq=freq) + with pytest.raises(ValueError, match="Multi-dimensional indexing"): + # GH#30588 multi-dimensional indexing deprecated + rng[:, None] + + def test_getitem_int_list(self): + dti = date_range(start="1/1/2005", end="12/1/2005", freq="ME") + dti2 = dti[[1, 3, 5]] + + v1 = dti2[0] + v2 = dti2[1] + v3 = dti2[2] + + assert v1 == Timestamp("2/28/2005") + assert v2 == Timestamp("4/30/2005") + assert v3 == Timestamp("6/30/2005") + + # getitem with non-slice drops freq + assert dti2.freq is None + + +class TestWhere: + def test_where_doesnt_retain_freq(self): + dti = date_range("20130101", periods=3, freq="D", name="idx") + cond = [True, True, False] + expected = DatetimeIndex([dti[0], dti[1], dti[0]], freq=None, name="idx") + + result = dti.where(cond, dti[::-1]) + tm.assert_index_equal(result, expected) + + def test_where_other(self): + # other is ndarray or Index + i = date_range("20130101", periods=3, tz="US/Eastern") + + for arr in [np.nan, pd.NaT]: + result = i.where(notna(i), other=arr) + expected = i + tm.assert_index_equal(result, expected) + + i2 = i.copy() + i2 = Index([pd.NaT, pd.NaT] + i[2:].tolist()) + result = i.where(notna(i2), i2) + tm.assert_index_equal(result, i2) + + i2 = i.copy() + i2 = Index([pd.NaT, pd.NaT] + i[2:].tolist()) + result = i.where(notna(i2), i2._values) + tm.assert_index_equal(result, i2) + + def test_where_invalid_dtypes(self): + dti = date_range("20130101", periods=3, tz="US/Eastern") + + tail = dti[2:].tolist() + i2 = Index([pd.NaT, pd.NaT] + tail) + + mask = notna(i2) + + # passing tz-naive ndarray to tzaware DTI + result = dti.where(mask, i2.values) + expected = Index([pd.NaT.asm8, pd.NaT.asm8] + tail, dtype=object) + tm.assert_index_equal(result, expected) + + # passing tz-aware DTI to tznaive DTI + naive = dti.tz_localize(None) + result = naive.where(mask, i2) + expected = Index([i2[0], i2[1]] + naive[2:].tolist(), dtype=object) + tm.assert_index_equal(result, expected) + + pi = i2.tz_localize(None).to_period("D") + result = dti.where(mask, pi) + expected = Index([pi[0], pi[1]] + tail, dtype=object) + tm.assert_index_equal(result, expected) + + tda = i2.asi8.view("timedelta64[ns]") + result = dti.where(mask, tda) + expected = Index([tda[0], tda[1]] + tail, dtype=object) + assert isinstance(expected[0], np.timedelta64) + tm.assert_index_equal(result, expected) + + result = dti.where(mask, i2.asi8) + expected = Index([pd.NaT._value, pd.NaT._value] + tail, dtype=object) + assert isinstance(expected[0], int) + tm.assert_index_equal(result, expected) + + # non-matching scalar + td = pd.Timedelta(days=4) + result = dti.where(mask, td) + expected = Index([td, td] + tail, dtype=object) + assert expected[0] is td + tm.assert_index_equal(result, expected) + + def test_where_mismatched_nat(self, tz_aware_fixture): + tz = tz_aware_fixture + dti = date_range("2013-01-01", periods=3, tz=tz) + cond = np.array([True, False, True]) + + tdnat = np.timedelta64("NaT", "ns") + expected = Index([dti[0], tdnat, dti[2]], dtype=object) + assert expected[1] is tdnat + + result = dti.where(cond, tdnat) + tm.assert_index_equal(result, expected) + + def test_where_tz(self): + i = date_range("20130101", periods=3, tz="US/Eastern") + result = i.where(notna(i)) + expected = i + tm.assert_index_equal(result, expected) + + i2 = i.copy() + i2 = Index([pd.NaT, pd.NaT] + i[2:].tolist()) + result = i.where(notna(i2)) + expected = i2 + tm.assert_index_equal(result, expected) + + +class TestTake: + @pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"]) + def test_dti_take_dont_lose_meta(self, tzstr): + rng = date_range("1/1/2000", periods=20, tz=tzstr) + + result = rng.take(range(5)) + assert result.tz == rng.tz + assert result.freq == rng.freq + + def test_take_nan_first_datetime(self): + index = DatetimeIndex([pd.NaT, Timestamp("20130101"), Timestamp("20130102")]) + result = index.take([-1, 0, 1]) + expected = DatetimeIndex([index[-1], index[0], index[1]]) + tm.assert_index_equal(result, expected) + + @pytest.mark.parametrize("tz", [None, "Asia/Tokyo"]) + def test_take(self, tz): + # GH#10295 + idx = date_range("2011-01-01", "2011-01-31", freq="D", name="idx", tz=tz) + + result = idx.take([0]) + assert result == Timestamp("2011-01-01", tz=idx.tz) + + result = idx.take([0, 1, 2]) + expected = date_range( + "2011-01-01", "2011-01-03", freq="D", tz=idx.tz, name="idx" + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + result = idx.take([0, 2, 4]) + expected = date_range( + "2011-01-01", "2011-01-05", freq="2D", tz=idx.tz, name="idx" + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + result = idx.take([7, 4, 1]) + expected = date_range( + "2011-01-08", "2011-01-02", freq="-3D", tz=idx.tz, name="idx" + ) + tm.assert_index_equal(result, expected) + assert result.freq == expected.freq + + result = idx.take([3, 2, 5]) + expected = DatetimeIndex( + ["2011-01-04", "2011-01-03", "2011-01-06"], + dtype=idx.dtype, + freq=None, + name="idx", + ) + tm.assert_index_equal(result, expected) + assert result.freq is None + + result = idx.take([-3, 2, 5]) + expected = DatetimeIndex( + ["2011-01-29", "2011-01-03", "2011-01-06"], + dtype=idx.dtype, + freq=None, + name="idx", + ) + tm.assert_index_equal(result, expected) + assert result.freq is None + + def test_take_invalid_kwargs(self): + idx = date_range("2011-01-01", "2011-01-31", freq="D", name="idx") + indices = [1, 6, 5, 9, 10, 13, 15, 3] + + msg = r"take\(\) got an unexpected keyword argument 'foo'" + with pytest.raises(TypeError, match=msg): + idx.take(indices, foo=2) + + msg = "the 'out' parameter is not supported" + with pytest.raises(ValueError, match=msg): + idx.take(indices, out=indices) + + msg = "the 'mode' parameter is not supported" + with pytest.raises(ValueError, match=msg): + idx.take(indices, mode="clip") + + # TODO: This method came from test_datetime; de-dup with version above + @pytest.mark.parametrize("tz", [None, "US/Eastern", "Asia/Tokyo"]) + def test_take2(self, tz): + dates = [ + datetime(2010, 1, 1, 14), + datetime(2010, 1, 1, 15), + datetime(2010, 1, 1, 17), + datetime(2010, 1, 1, 21), + ] + + idx = date_range( + start="2010-01-01 09:00", + end="2010-02-01 09:00", + freq="h", + tz=tz, + name="idx", + ) + expected = DatetimeIndex(dates, freq=None, name="idx", dtype=idx.dtype) + + taken1 = idx.take([5, 6, 8, 12]) + taken2 = idx[[5, 6, 8, 12]] + + for taken in [taken1, taken2]: + tm.assert_index_equal(taken, expected) + assert isinstance(taken, DatetimeIndex) + assert taken.freq is None + assert taken.tz == expected.tz + assert taken.name == expected.name + + def test_take_fill_value(self): + # GH#12631 + idx = DatetimeIndex(["2011-01-01", "2011-02-01", "2011-03-01"], name="xxx") + result = idx.take(np.array([1, 0, -1])) + expected = DatetimeIndex(["2011-02-01", "2011-01-01", "2011-03-01"], name="xxx") + tm.assert_index_equal(result, expected) + + # fill_value + result = idx.take(np.array([1, 0, -1]), fill_value=True) + expected = DatetimeIndex(["2011-02-01", "2011-01-01", "NaT"], name="xxx") + tm.assert_index_equal(result, expected) + + # allow_fill=False + result = idx.take(np.array([1, 0, -1]), allow_fill=False, fill_value=True) + expected = DatetimeIndex(["2011-02-01", "2011-01-01", "2011-03-01"], name="xxx") + tm.assert_index_equal(result, expected) + + msg = ( + "When allow_fill=True and fill_value is not None, " + "all indices must be >= -1" + ) + with pytest.raises(ValueError, match=msg): + idx.take(np.array([1, 0, -2]), fill_value=True) + with pytest.raises(ValueError, match=msg): + idx.take(np.array([1, 0, -5]), fill_value=True) + + msg = "out of bounds" + with pytest.raises(IndexError, match=msg): + idx.take(np.array([1, -5])) + + def test_take_fill_value_with_timezone(self): + idx = DatetimeIndex( + ["2011-01-01", "2011-02-01", "2011-03-01"], name="xxx", tz="US/Eastern" + ) + result = idx.take(np.array([1, 0, -1])) + expected = DatetimeIndex( + ["2011-02-01", "2011-01-01", "2011-03-01"], name="xxx", tz="US/Eastern" + ) + tm.assert_index_equal(result, expected) + + # fill_value + result = idx.take(np.array([1, 0, -1]), fill_value=True) + expected = DatetimeIndex( + ["2011-02-01", "2011-01-01", "NaT"], name="xxx", tz="US/Eastern" + ) + tm.assert_index_equal(result, expected) + + # allow_fill=False + result = idx.take(np.array([1, 0, -1]), allow_fill=False, fill_value=True) + expected = DatetimeIndex( + ["2011-02-01", "2011-01-01", "2011-03-01"], name="xxx", tz="US/Eastern" + ) + tm.assert_index_equal(result, expected) + + msg = ( + "When allow_fill=True and fill_value is not None, " + "all indices must be >= -1" + ) + with pytest.raises(ValueError, match=msg): + idx.take(np.array([1, 0, -2]), fill_value=True) + with pytest.raises(ValueError, match=msg): + idx.take(np.array([1, 0, -5]), fill_value=True) + + msg = "out of bounds" + with pytest.raises(IndexError, match=msg): + idx.take(np.array([1, -5])) + + +class TestGetLoc: + def test_get_loc_key_unit_mismatch(self): + idx = date_range("2000-01-01", periods=3) + key = idx[1].as_unit("ms") + loc = idx.get_loc(key) + assert loc == 1 + assert key in idx + + def test_get_loc_key_unit_mismatch_not_castable(self): + dta = date_range("2000-01-01", periods=3)._data.astype("M8[s]") + dti = DatetimeIndex(dta) + key = dta[0].as_unit("ns") + pd.Timedelta(1) + + with pytest.raises( + KeyError, match=r"Timestamp\('2000-01-01 00:00:00.000000001'\)" + ): + dti.get_loc(key) + + assert key not in dti + + def test_get_loc_time_obj(self): + # time indexing + idx = date_range("2000-01-01", periods=24, freq="h") + + result = idx.get_loc(time(12)) + expected = np.array([12]) + tm.assert_numpy_array_equal(result, expected, check_dtype=False) + + result = idx.get_loc(time(12, 30)) + expected = np.array([]) + tm.assert_numpy_array_equal(result, expected, check_dtype=False) + + @pytest.mark.parametrize("offset", [-10, 10]) + def test_get_loc_time_obj2(self, monkeypatch, offset): + # GH#8667 + size_cutoff = 50 + n = size_cutoff + offset + key = time(15, 11, 30) + start = key.hour * 3600 + key.minute * 60 + key.second + step = 24 * 3600 + + with monkeypatch.context(): + monkeypatch.setattr(libindex, "_SIZE_CUTOFF", size_cutoff) + idx = date_range("2014-11-26", periods=n, freq="s") + ts = pd.Series(np.random.default_rng(2).standard_normal(n), index=idx) + locs = np.arange(start, n, step, dtype=np.intp) + + result = ts.index.get_loc(key) + tm.assert_numpy_array_equal(result, locs) + tm.assert_series_equal(ts[key], ts.iloc[locs]) + + left, right = ts.copy(), ts.copy() + left[key] *= -10 + right.iloc[locs] *= -10 + tm.assert_series_equal(left, right) + + def test_get_loc_time_nat(self): + # GH#35114 + # Case where key's total microseconds happens to match iNaT % 1e6 // 1000 + tic = time(minute=12, second=43, microsecond=145224) + dti = DatetimeIndex([pd.NaT]) + + loc = dti.get_loc(tic) + expected = np.array([], dtype=np.intp) + tm.assert_numpy_array_equal(loc, expected) + + def test_get_loc_nat(self): + # GH#20464 + index = DatetimeIndex(["1/3/2000", "NaT"]) + assert index.get_loc(pd.NaT) == 1 + + assert index.get_loc(None) == 1 + + assert index.get_loc(np.nan) == 1 + + assert index.get_loc(pd.NA) == 1 + + assert index.get_loc(np.datetime64("NaT")) == 1 + + with pytest.raises(KeyError, match="NaT"): + index.get_loc(np.timedelta64("NaT")) + + @pytest.mark.parametrize("key", [pd.Timedelta(0), pd.Timedelta(1), timedelta(0)]) + def test_get_loc_timedelta_invalid_key(self, key): + # GH#20464 + dti = date_range("1970-01-01", periods=10) + msg = "Cannot index DatetimeIndex with [Tt]imedelta" + with pytest.raises(TypeError, match=msg): + dti.get_loc(key) + + def test_get_loc_reasonable_key_error(self): + # GH#1062 + index = DatetimeIndex(["1/3/2000"]) + with pytest.raises(KeyError, match="2000"): + index.get_loc("1/1/2000") + + def test_get_loc_year_str(self): + rng = date_range("1/1/2000", "1/1/2010") + + result = rng.get_loc("2009") + expected = slice(3288, 3653) + assert result == expected + + +class TestContains: + def test_dti_contains_with_duplicates(self): + d = datetime(2011, 12, 5, 20, 30) + ix = DatetimeIndex([d, d]) + assert d in ix + + @pytest.mark.parametrize( + "vals", + [ + [0, 1, 0], + [0, 0, -1], + [0, -1, -1], + ["2015", "2015", "2016"], + ["2015", "2015", "2014"], + ], + ) + def test_contains_nonunique(self, vals): + # GH#9512 + idx = DatetimeIndex(vals) + assert idx[0] in idx + + +class TestGetIndexer: + def test_get_indexer_date_objs(self): + rng = date_range("1/1/2000", periods=20) + + result = rng.get_indexer(rng.map(lambda x: x.date())) + expected = rng.get_indexer(rng) + tm.assert_numpy_array_equal(result, expected) + + def test_get_indexer(self): + idx = date_range("2000-01-01", periods=3) + exp = np.array([0, 1, 2], dtype=np.intp) + tm.assert_numpy_array_equal(idx.get_indexer(idx), exp) + + target = idx[0] + pd.to_timedelta(["-1 hour", "12 hours", "1 day 1 hour"]) + tm.assert_numpy_array_equal( + idx.get_indexer(target, "pad"), np.array([-1, 0, 1], dtype=np.intp) + ) + tm.assert_numpy_array_equal( + idx.get_indexer(target, "backfill"), np.array([0, 1, 2], dtype=np.intp) + ) + tm.assert_numpy_array_equal( + idx.get_indexer(target, "nearest"), np.array([0, 1, 1], dtype=np.intp) + ) + tm.assert_numpy_array_equal( + idx.get_indexer(target, "nearest", tolerance=pd.Timedelta("1 hour")), + np.array([0, -1, 1], dtype=np.intp), + ) + tol_raw = [ + pd.Timedelta("1 hour"), + pd.Timedelta("1 hour"), + pd.Timedelta("1 hour").to_timedelta64(), + ] + tm.assert_numpy_array_equal( + idx.get_indexer( + target, "nearest", tolerance=[np.timedelta64(x) for x in tol_raw] + ), + np.array([0, -1, 1], dtype=np.intp), + ) + tol_bad = [ + pd.Timedelta("2 hour").to_timedelta64(), + pd.Timedelta("1 hour").to_timedelta64(), + "foo", + ] + msg = "Could not convert 'foo' to NumPy timedelta" + with pytest.raises(ValueError, match=msg): + idx.get_indexer(target, "nearest", tolerance=tol_bad) + with pytest.raises(ValueError, match="abbreviation w/o a number"): + idx.get_indexer(idx[[0]], method="nearest", tolerance="foo") + + @pytest.mark.parametrize( + "target", + [ + [date(2020, 1, 1), Timestamp("2020-01-02")], + [Timestamp("2020-01-01"), date(2020, 1, 2)], + ], + ) + def test_get_indexer_mixed_dtypes(self, target): + # https://github.com/pandas-dev/pandas/issues/33741 + values = DatetimeIndex([Timestamp("2020-01-01"), Timestamp("2020-01-02")]) + result = values.get_indexer(target) + expected = np.array([0, 1], dtype=np.intp) + tm.assert_numpy_array_equal(result, expected) + + @pytest.mark.parametrize( + "target, positions", + [ + ([date(9999, 1, 1), Timestamp("2020-01-01")], [-1, 0]), + ([Timestamp("2020-01-01"), date(9999, 1, 1)], [0, -1]), + ([date(9999, 1, 1), date(9999, 1, 1)], [-1, -1]), + ], + ) + def test_get_indexer_out_of_bounds_date(self, target, positions): + values = DatetimeIndex([Timestamp("2020-01-01"), Timestamp("2020-01-02")]) + + result = values.get_indexer(target) + expected = np.array(positions, dtype=np.intp) + tm.assert_numpy_array_equal(result, expected) + + def test_get_indexer_pad_requires_monotonicity(self): + rng = date_range("1/1/2000", "3/1/2000", freq="B") + + # neither monotonic increasing or decreasing + rng2 = rng[[1, 0, 2]] + + msg = "index must be monotonic increasing or decreasing" + with pytest.raises(ValueError, match=msg): + rng2.get_indexer(rng, method="pad") + + +class TestMaybeCastSliceBound: + def test_maybe_cast_slice_bounds_empty(self): + # GH#14354 + empty_idx = date_range(freq="1h", periods=0, end="2015") + + right = empty_idx._maybe_cast_slice_bound("2015-01-02", "right") + exp = Timestamp("2015-01-02 23:59:59.999999999") + assert right == exp + + left = empty_idx._maybe_cast_slice_bound("2015-01-02", "left") + exp = Timestamp("2015-01-02 00:00:00") + assert left == exp + + def test_maybe_cast_slice_duplicate_monotonic(self): + # https://github.com/pandas-dev/pandas/issues/16515 + idx = DatetimeIndex(["2017", "2017"]) + result = idx._maybe_cast_slice_bound("2017-01-01", "left") + expected = Timestamp("2017-01-01") + assert result == expected + + +class TestGetSliceBounds: + @pytest.mark.parametrize("box", [date, datetime, Timestamp]) + @pytest.mark.parametrize("side, expected", [("left", 4), ("right", 5)]) + def test_get_slice_bounds_datetime_within( + self, box, side, expected, tz_aware_fixture + ): + # GH 35690 + tz = tz_aware_fixture + index = bdate_range("2000-01-03", "2000-02-11").tz_localize(tz) + key = box(year=2000, month=1, day=7) + + if tz is not None: + with pytest.raises(TypeError, match="Cannot compare tz-naive"): + # GH#36148 we require tzawareness-compat as of 2.0 + index.get_slice_bound(key, side=side) + else: + result = index.get_slice_bound(key, side=side) + assert result == expected + + @pytest.mark.parametrize("box", [datetime, Timestamp]) + @pytest.mark.parametrize("side", ["left", "right"]) + @pytest.mark.parametrize("year, expected", [(1999, 0), (2020, 30)]) + def test_get_slice_bounds_datetime_outside( + self, box, side, year, expected, tz_aware_fixture + ): + # GH 35690 + tz = tz_aware_fixture + index = bdate_range("2000-01-03", "2000-02-11").tz_localize(tz) + key = box(year=year, month=1, day=7) + + if tz is not None: + with pytest.raises(TypeError, match="Cannot compare tz-naive"): + # GH#36148 we require tzawareness-compat as of 2.0 + index.get_slice_bound(key, side=side) + else: + result = index.get_slice_bound(key, side=side) + assert result == expected + + @pytest.mark.parametrize("box", [datetime, Timestamp]) + def test_slice_datetime_locs(self, box, tz_aware_fixture): + # GH 34077 + tz = tz_aware_fixture + index = DatetimeIndex(["2010-01-01", "2010-01-03"]).tz_localize(tz) + key = box(2010, 1, 1) + + if tz is not None: + with pytest.raises(TypeError, match="Cannot compare tz-naive"): + # GH#36148 we require tzawareness-compat as of 2.0 + index.slice_locs(key, box(2010, 1, 2)) + else: + result = index.slice_locs(key, box(2010, 1, 2)) + expected = (0, 1) + assert result == expected + + +class TestIndexerBetweenTime: + def test_indexer_between_time(self): + # GH#11818 + rng = date_range("1/1/2000", "1/5/2000", freq="5min") + msg = r"Cannot convert arg \[datetime\.datetime\(2010, 1, 2, 1, 0\)\] to a time" + with pytest.raises(ValueError, match=msg): + rng.indexer_between_time(datetime(2010, 1, 2, 1), datetime(2010, 1, 2, 5)) + + @pytest.mark.parametrize("unit", ["us", "ms", "s"]) + def test_indexer_between_time_non_nano(self, unit): + # For simple cases like this, the non-nano indexer_between_time + # should match the nano result + + rng = date_range("1/1/2000", "1/5/2000", freq="5min") + arr_nano = rng._data._ndarray + + arr = arr_nano.astype(f"M8[{unit}]") + + dta = type(rng._data)._simple_new(arr, dtype=arr.dtype) + dti = DatetimeIndex(dta) + assert dti.dtype == arr.dtype + + tic = time(1, 25) + toc = time(2, 29) + + result = dti.indexer_between_time(tic, toc) + expected = rng.indexer_between_time(tic, toc) + tm.assert_numpy_array_equal(result, expected) + + # case with non-zero micros in arguments + tic = time(1, 25, 0, 45678) + toc = time(2, 29, 0, 1234) + + result = dti.indexer_between_time(tic, toc) + expected = rng.indexer_between_time(tic, toc) + tm.assert_numpy_array_equal(result, expected) diff --git a/shared/package-files/32/3277a99a9ade798d75397f674078f94f181876738f248442f82af73320e70b7f/blob b/shared/package-files/32/3277a99a9ade798d75397f674078f94f181876738f248442f82af73320e70b7f/blob new file mode 100644 index 0000000000000000000000000000000000000000..aac10596ffc699c2b229f959b9c1b26393384b03 --- /dev/null +++ b/shared/package-files/32/3277a99a9ade798d75397f674078f94f181876738f248442f82af73320e70b7f/blob @@ -0,0 +1,964 @@ +from __future__ import annotations + +from textwrap import dedent +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Literal, +) + +from pandas.util._decorators import ( + deprecate_kwarg, + doc, +) + +from pandas.core.indexers.objects import ( + BaseIndexer, + ExpandingIndexer, + GroupbyIndexer, +) +from pandas.core.window.doc import ( + _shared_docs, + create_section_header, + kwargs_numeric_only, + numba_notes, + template_header, + template_returns, + template_see_also, + window_agg_numba_parameters, + window_apply_parameters, +) +from pandas.core.window.rolling import ( + BaseWindowGroupby, + RollingAndExpandingMixin, +) + +if TYPE_CHECKING: + from pandas._typing import ( + Axis, + QuantileInterpolation, + WindowingRankType, + ) + + from pandas import ( + DataFrame, + Series, + ) + from pandas.core.generic import NDFrame + + +class Expanding(RollingAndExpandingMixin): + """ + Provide expanding window calculations. + + Parameters + ---------- + min_periods : int, default 1 + Minimum number of observations in window required to have a value; + otherwise, result is ``np.nan``. + + axis : int or str, default 0 + If ``0`` or ``'index'``, roll across the rows. + + If ``1`` or ``'columns'``, roll across the columns. + + For `Series` this parameter is unused and defaults to 0. + + method : str {'single', 'table'}, default 'single' + Execute the rolling operation per single column or row (``'single'``) + or over the entire object (``'table'``). + + This argument is only implemented when specifying ``engine='numba'`` + in the method call. + + .. versionadded:: 1.3.0 + + Returns + ------- + pandas.api.typing.Expanding + + See Also + -------- + rolling : Provides rolling window calculations. + ewm : Provides exponential weighted functions. + + Notes + ----- + See :ref:`Windowing Operations ` for further usage details + and examples. + + Examples + -------- + >>> df = pd.DataFrame({"B": [0, 1, 2, np.nan, 4]}) + >>> df + B + 0 0.0 + 1 1.0 + 2 2.0 + 3 NaN + 4 4.0 + + **min_periods** + + Expanding sum with 1 vs 3 observations needed to calculate a value. + + >>> df.expanding(1).sum() + B + 0 0.0 + 1 1.0 + 2 3.0 + 3 3.0 + 4 7.0 + >>> df.expanding(3).sum() + B + 0 NaN + 1 NaN + 2 3.0 + 3 3.0 + 4 7.0 + """ + + _attributes: list[str] = ["min_periods", "axis", "method"] + + def __init__( + self, + obj: NDFrame, + min_periods: int = 1, + axis: Axis = 0, + method: str = "single", + selection=None, + ) -> None: + super().__init__( + obj=obj, + min_periods=min_periods, + axis=axis, + method=method, + selection=selection, + ) + + def _get_window_indexer(self) -> BaseIndexer: + """ + Return an indexer class that will compute the window start and end bounds + """ + return ExpandingIndexer() + + @doc( + _shared_docs["aggregate"], + see_also=dedent( + """ + See Also + -------- + pandas.DataFrame.aggregate : Similar DataFrame method. + pandas.Series.aggregate : Similar Series method. + """ + ), + examples=dedent( + """ + Examples + -------- + >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9]}) + >>> df + A B C + 0 1 4 7 + 1 2 5 8 + 2 3 6 9 + + >>> df.ewm(alpha=0.5).mean() + A B C + 0 1.000000 4.000000 7.000000 + 1 1.666667 4.666667 7.666667 + 2 2.428571 5.428571 8.428571 + """ + ), + klass="Series/Dataframe", + axis="", + ) + def aggregate(self, func, *args, **kwargs): + return super().aggregate(func, *args, **kwargs) + + agg = aggregate + + @doc( + template_header, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().count() + a 1.0 + b 2.0 + c 3.0 + d 4.0 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="count of non NaN observations", + agg_method="count", + ) + def count(self, numeric_only: bool = False): + return super().count(numeric_only=numeric_only) + + @doc( + template_header, + create_section_header("Parameters"), + window_apply_parameters, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().apply(lambda s: s.max() - 2 * s.min()) + a -1.0 + b 0.0 + c 1.0 + d 2.0 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="custom aggregation function", + agg_method="apply", + ) + def apply( + self, + func: Callable[..., Any], + raw: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + args: tuple[Any, ...] | None = None, + kwargs: dict[str, Any] | None = None, + ): + return super().apply( + func, + raw=raw, + engine=engine, + engine_kwargs=engine_kwargs, + args=args, + kwargs=kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + window_agg_numba_parameters(), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Notes"), + numba_notes, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().sum() + a 1.0 + b 3.0 + c 6.0 + d 10.0 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="sum", + agg_method="sum", + ) + def sum( + self, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().sum( + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + window_agg_numba_parameters(), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Notes"), + numba_notes, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([3, 2, 1, 4], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().max() + a 3.0 + b 3.0 + c 3.0 + d 4.0 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="maximum", + agg_method="max", + ) + def max( + self, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().max( + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + window_agg_numba_parameters(), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Notes"), + numba_notes, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([2, 3, 4, 1], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().min() + a 2.0 + b 2.0 + c 2.0 + d 1.0 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="minimum", + agg_method="min", + ) + def min( + self, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().min( + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + window_agg_numba_parameters(), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Notes"), + numba_notes, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().mean() + a 1.0 + b 1.5 + c 2.0 + d 2.5 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="mean", + agg_method="mean", + ) + def mean( + self, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().mean( + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + window_agg_numba_parameters(), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Notes"), + numba_notes, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser.expanding().median() + a 1.0 + b 1.5 + c 2.0 + d 2.5 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="median", + agg_method="median", + ) + def median( + self, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().median( + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + dedent( + """ + ddof : int, default 1 + Delta Degrees of Freedom. The divisor used in calculations + is ``N - ddof``, where ``N`` represents the number of elements.\n + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + window_agg_numba_parameters("1.4"), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + "numpy.std : Equivalent method for NumPy array.\n", + template_see_also, + create_section_header("Notes"), + dedent( + """ + The default ``ddof`` of 1 used in :meth:`Series.std` is different + than the default ``ddof`` of 0 in :func:`numpy.std`. + + A minimum of one period is required for the rolling calculation.\n + """ + ).replace("\n", "", 1), + create_section_header("Examples"), + dedent( + """ + >>> s = pd.Series([5, 5, 6, 7, 5, 5, 5]) + + >>> s.expanding(3).std() + 0 NaN + 1 NaN + 2 0.577350 + 3 0.957427 + 4 0.894427 + 5 0.836660 + 6 0.786796 + dtype: float64 + """ + ).replace("\n", "", 1), + window_method="expanding", + aggregation_description="standard deviation", + agg_method="std", + ) + def std( + self, + ddof: int = 1, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().std( + ddof=ddof, + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + dedent( + """ + ddof : int, default 1 + Delta Degrees of Freedom. The divisor used in calculations + is ``N - ddof``, where ``N`` represents the number of elements.\n + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + window_agg_numba_parameters("1.4"), + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + "numpy.var : Equivalent method for NumPy array.\n", + template_see_also, + create_section_header("Notes"), + dedent( + """ + The default ``ddof`` of 1 used in :meth:`Series.var` is different + than the default ``ddof`` of 0 in :func:`numpy.var`. + + A minimum of one period is required for the rolling calculation.\n + """ + ).replace("\n", "", 1), + create_section_header("Examples"), + dedent( + """ + >>> s = pd.Series([5, 5, 6, 7, 5, 5, 5]) + + >>> s.expanding(3).var() + 0 NaN + 1 NaN + 2 0.333333 + 3 0.916667 + 4 0.800000 + 5 0.700000 + 6 0.619048 + dtype: float64 + """ + ).replace("\n", "", 1), + window_method="expanding", + aggregation_description="variance", + agg_method="var", + ) + def var( + self, + ddof: int = 1, + numeric_only: bool = False, + engine: Literal["cython", "numba"] | None = None, + engine_kwargs: dict[str, bool] | None = None, + ): + return super().var( + ddof=ddof, + numeric_only=numeric_only, + engine=engine, + engine_kwargs=engine_kwargs, + ) + + @doc( + template_header, + create_section_header("Parameters"), + dedent( + """ + ddof : int, default 1 + Delta Degrees of Freedom. The divisor used in calculations + is ``N - ddof``, where ``N`` represents the number of elements.\n + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Notes"), + "A minimum of one period is required for the calculation.\n\n", + create_section_header("Examples"), + dedent( + """ + >>> s = pd.Series([0, 1, 2, 3]) + + >>> s.expanding().sem() + 0 NaN + 1 0.707107 + 2 0.707107 + 3 0.745356 + dtype: float64 + """ + ).replace("\n", "", 1), + window_method="expanding", + aggregation_description="standard error of mean", + agg_method="sem", + ) + def sem(self, ddof: int = 1, numeric_only: bool = False): + return super().sem(ddof=ddof, numeric_only=numeric_only) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + "scipy.stats.skew : Third moment of a probability density.\n", + template_see_also, + create_section_header("Notes"), + "A minimum of three periods is required for the rolling calculation.\n\n", + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([-1, 0, 2, -1, 2], index=['a', 'b', 'c', 'd', 'e']) + >>> ser.expanding().skew() + a NaN + b NaN + c 0.935220 + d 1.414214 + e 0.315356 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="unbiased skewness", + agg_method="skew", + ) + def skew(self, numeric_only: bool = False): + return super().skew(numeric_only=numeric_only) + + @doc( + template_header, + create_section_header("Parameters"), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + "scipy.stats.kurtosis : Reference SciPy method.\n", + template_see_also, + create_section_header("Notes"), + "A minimum of four periods is required for the calculation.\n\n", + create_section_header("Examples"), + dedent( + """ + The example below will show a rolling calculation with a window size of + four matching the equivalent function call using `scipy.stats`. + + >>> arr = [1, 2, 3, 4, 999] + >>> import scipy.stats + >>> print(f"{{scipy.stats.kurtosis(arr[:-1], bias=False):.6f}}") + -1.200000 + >>> print(f"{{scipy.stats.kurtosis(arr, bias=False):.6f}}") + 4.999874 + >>> s = pd.Series(arr) + >>> s.expanding(4).kurt() + 0 NaN + 1 NaN + 2 NaN + 3 -1.200000 + 4 4.999874 + dtype: float64 + """ + ).replace("\n", "", 1), + window_method="expanding", + aggregation_description="Fisher's definition of kurtosis without bias", + agg_method="kurt", + ) + def kurt(self, numeric_only: bool = False): + return super().kurt(numeric_only=numeric_only) + + @doc( + template_header, + create_section_header("Parameters"), + dedent( + """ + quantile : float + Quantile to compute. 0 <= quantile <= 1. + + .. deprecated:: 2.1.0 + This will be renamed to 'q' in a future version. + interpolation : {{'linear', 'lower', 'higher', 'midpoint', 'nearest'}} + This optional parameter specifies the interpolation method to use, + when the desired quantile lies between two data points `i` and `j`: + + * linear: `i + (j - i) * fraction`, where `fraction` is the + fractional part of the index surrounded by `i` and `j`. + * lower: `i`. + * higher: `j`. + * nearest: `i` or `j` whichever is nearest. + * midpoint: (`i` + `j`) / 2. + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Examples"), + dedent( + """\ + >>> ser = pd.Series([1, 2, 3, 4, 5, 6], index=['a', 'b', 'c', 'd', 'e', 'f']) + >>> ser.expanding(min_periods=4).quantile(.25) + a NaN + b NaN + c NaN + d 1.75 + e 2.00 + f 2.25 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="quantile", + agg_method="quantile", + ) + @deprecate_kwarg(old_arg_name="quantile", new_arg_name="q") + def quantile( + self, + q: float, + interpolation: QuantileInterpolation = "linear", + numeric_only: bool = False, + ): + return super().quantile( + q=q, + interpolation=interpolation, + numeric_only=numeric_only, + ) + + @doc( + template_header, + ".. versionadded:: 1.4.0 \n\n", + create_section_header("Parameters"), + dedent( + """ + method : {{'average', 'min', 'max'}}, default 'average' + How to rank the group of records that have the same value (i.e. ties): + + * average: average rank of the group + * min: lowest rank in the group + * max: highest rank in the group + + ascending : bool, default True + Whether or not the elements should be ranked in ascending order. + pct : bool, default False + Whether or not to display the returned rankings in percentile + form. + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Examples"), + dedent( + """ + >>> s = pd.Series([1, 4, 2, 3, 5, 3]) + >>> s.expanding().rank() + 0 1.0 + 1 2.0 + 2 2.0 + 3 3.0 + 4 5.0 + 5 3.5 + dtype: float64 + + >>> s.expanding().rank(method="max") + 0 1.0 + 1 2.0 + 2 2.0 + 3 3.0 + 4 5.0 + 5 4.0 + dtype: float64 + + >>> s.expanding().rank(method="min") + 0 1.0 + 1 2.0 + 2 2.0 + 3 3.0 + 4 5.0 + 5 3.0 + dtype: float64 + """ + ).replace("\n", "", 1), + window_method="expanding", + aggregation_description="rank", + agg_method="rank", + ) + def rank( + self, + method: WindowingRankType = "average", + ascending: bool = True, + pct: bool = False, + numeric_only: bool = False, + ): + return super().rank( + method=method, + ascending=ascending, + pct=pct, + numeric_only=numeric_only, + ) + + @doc( + template_header, + create_section_header("Parameters"), + dedent( + """ + other : Series or DataFrame, optional + If not supplied then will default to self and produce pairwise + output. + pairwise : bool, default None + If False then only matching columns between self and other will be + used and the output will be a DataFrame. + If True then all pairwise combinations will be calculated and the + output will be a MultiIndexed DataFrame in the case of DataFrame + inputs. In the case of missing elements, only complete pairwise + observations will be used. + ddof : int, default 1 + Delta Degrees of Freedom. The divisor used in calculations + is ``N - ddof``, where ``N`` represents the number of elements. + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + template_see_also, + create_section_header("Examples"), + dedent( + """\ + >>> ser1 = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser2 = pd.Series([10, 11, 13, 16], index=['a', 'b', 'c', 'd']) + >>> ser1.expanding().cov(ser2) + a NaN + b 0.500000 + c 1.500000 + d 3.333333 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="sample covariance", + agg_method="cov", + ) + def cov( + self, + other: DataFrame | Series | None = None, + pairwise: bool | None = None, + ddof: int = 1, + numeric_only: bool = False, + ): + return super().cov( + other=other, + pairwise=pairwise, + ddof=ddof, + numeric_only=numeric_only, + ) + + @doc( + template_header, + create_section_header("Parameters"), + dedent( + """ + other : Series or DataFrame, optional + If not supplied then will default to self and produce pairwise + output. + pairwise : bool, default None + If False then only matching columns between self and other will be + used and the output will be a DataFrame. + If True then all pairwise combinations will be calculated and the + output will be a MultiIndexed DataFrame in the case of DataFrame + inputs. In the case of missing elements, only complete pairwise + observations will be used. + """ + ).replace("\n", "", 1), + kwargs_numeric_only, + create_section_header("Returns"), + template_returns, + create_section_header("See Also"), + dedent( + """ + cov : Similar method to calculate covariance. + numpy.corrcoef : NumPy Pearson's correlation calculation. + """ + ).replace("\n", "", 1), + template_see_also, + create_section_header("Notes"), + dedent( + """ + This function uses Pearson's definition of correlation + (https://en.wikipedia.org/wiki/Pearson_correlation_coefficient). + + When `other` is not specified, the output will be self correlation (e.g. + all 1's), except for :class:`~pandas.DataFrame` inputs with `pairwise` + set to `True`. + + Function will return ``NaN`` for correlations of equal valued sequences; + this is the result of a 0/0 division error. + + When `pairwise` is set to `False`, only matching columns between `self` and + `other` will be used. + + When `pairwise` is set to `True`, the output will be a MultiIndex DataFrame + with the original index on the first level, and the `other` DataFrame + columns on the second level. + + In the case of missing elements, only complete pairwise observations + will be used.\n + """ + ), + create_section_header("Examples"), + dedent( + """\ + >>> ser1 = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd']) + >>> ser2 = pd.Series([10, 11, 13, 16], index=['a', 'b', 'c', 'd']) + >>> ser1.expanding().corr(ser2) + a NaN + b 1.000000 + c 0.981981 + d 0.975900 + dtype: float64 + """ + ), + window_method="expanding", + aggregation_description="correlation", + agg_method="corr", + ) + def corr( + self, + other: DataFrame | Series | None = None, + pairwise: bool | None = None, + ddof: int = 1, + numeric_only: bool = False, + ): + return super().corr( + other=other, + pairwise=pairwise, + ddof=ddof, + numeric_only=numeric_only, + ) + + +class ExpandingGroupby(BaseWindowGroupby, Expanding): + """ + Provide a expanding groupby implementation. + """ + + _attributes = Expanding._attributes + BaseWindowGroupby._attributes + + def _get_window_indexer(self) -> GroupbyIndexer: + """ + Return an indexer class that will compute the window start and end bounds + + Returns + ------- + GroupbyIndexer + """ + window_indexer = GroupbyIndexer( + groupby_indices=self._grouper.indices, + window_indexer=ExpandingIndexer, + ) + return window_indexer diff --git a/shared/package-files/32/32799ec2d30e2792f8ddbd4b33ac83d5d410142c71199078c2036c6503ef29d2/blob b/shared/package-files/32/32799ec2d30e2792f8ddbd4b33ac83d5d410142c71199078c2036c6503ef29d2/blob new file mode 100644 index 0000000000000000000000000000000000000000..fe8713ecf46bfa4a60bed8e110e4c0ab3b8c8d73 --- /dev/null +++ b/shared/package-files/32/32799ec2d30e2792f8ddbd4b33ac83d5d410142c71199078c2036c6503ef29d2/blob @@ -0,0 +1,153 @@ +r"""Utilities to compile possibly incomplete Python source code. + +This module provides two interfaces, broadly similar to the builtin +function compile(), which take program text, a filename and a 'mode' +and: + +- Return code object if the command is complete and valid +- Return None if the command is incomplete +- Raise SyntaxError, ValueError or OverflowError if the command is a + syntax error (OverflowError and ValueError can be produced by + malformed literals). + +The two interfaces are: + +compile_command(source, filename, symbol): + + Compiles a single command in the manner described above. + +CommandCompiler(): + + Instances of this class have __call__ methods identical in + signature to compile_command; the difference is that if the + instance compiles program text containing a __future__ statement, + the instance 'remembers' and compiles all subsequent program texts + with the statement in force. + +The module also provides another class: + +Compile(): + + Instances of this class act like the built-in function compile, + but with 'memory' in the sense described above. +""" + +import __future__ +import warnings + +_features = [getattr(__future__, fname) + for fname in __future__.all_feature_names] + +__all__ = ["compile_command", "Compile", "CommandCompiler"] + +# The following flags match the values from Include/cpython/compile.h +# Caveat emptor: These flags are undocumented on purpose and depending +# on their effect outside the standard library is **unsupported**. +PyCF_DONT_IMPLY_DEDENT = 0x200 +PyCF_ALLOW_INCOMPLETE_INPUT = 0x4000 + +def _maybe_compile(compiler, source, filename, symbol): + # Check for source consisting of only blank lines and comments. + for line in source.split("\n"): + line = line.strip() + if line and line[0] != '#': + break # Leave it alone. + else: + if symbol != "eval": + source = "pass" # Replace it with a 'pass' statement + + # Disable compiler warnings when checking for incomplete input. + with warnings.catch_warnings(): + warnings.simplefilter("ignore", (SyntaxWarning, DeprecationWarning)) + try: + compiler(source, filename, symbol) + except SyntaxError: # Let other compile() errors propagate. + try: + compiler(source + "\n", filename, symbol) + return None + except SyntaxError as e: + if "incomplete input" in str(e): + return None + # fallthrough + + return compiler(source, filename, symbol) + + +def _is_syntax_error(err1, err2): + rep1 = repr(err1) + rep2 = repr(err2) + if "was never closed" in rep1 and "was never closed" in rep2: + return False + if rep1 == rep2: + return True + return False + +def _compile(source, filename, symbol): + return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT | PyCF_ALLOW_INCOMPLETE_INPUT) + +def compile_command(source, filename="", symbol="single"): + r"""Compile a command and determine whether it is incomplete. + + Arguments: + + source -- the source string; may contain \n characters + filename -- optional filename from which source was read; default + "" + symbol -- optional grammar start symbol; "single" (default), "exec" + or "eval" + + Return value / exceptions raised: + + - Return a code object if the command is complete and valid + - Return None if the command is incomplete + - Raise SyntaxError, ValueError or OverflowError if the command is a + syntax error (OverflowError and ValueError can be produced by + malformed literals). + """ + return _maybe_compile(_compile, source, filename, symbol) + +class Compile: + """Instances of this class behave much like the built-in compile + function, but if one is used to compile text containing a future + statement, it "remembers" and compiles all subsequent program texts + with the statement in force.""" + def __init__(self): + self.flags = PyCF_DONT_IMPLY_DEDENT | PyCF_ALLOW_INCOMPLETE_INPUT + + def __call__(self, source, filename, symbol): + codeob = compile(source, filename, symbol, self.flags, True) + for feature in _features: + if codeob.co_flags & feature.compiler_flag: + self.flags |= feature.compiler_flag + return codeob + +class CommandCompiler: + """Instances of this class have __call__ methods identical in + signature to compile_command; the difference is that if the + instance compiles program text containing a __future__ statement, + the instance 'remembers' and compiles all subsequent program texts + with the statement in force.""" + + def __init__(self,): + self.compiler = Compile() + + def __call__(self, source, filename="", symbol="single"): + r"""Compile a command and determine whether it is incomplete. + + Arguments: + + source -- the source string; may contain \n characters + filename -- optional filename from which source was read; + default "" + symbol -- optional grammar start symbol; "single" (default) or + "eval" + + Return value / exceptions raised: + + - Return a code object if the command is complete and valid + - Return None if the command is incomplete + - Raise SyntaxError, ValueError or OverflowError if the command is a + syntax error (OverflowError and ValueError can be produced by + malformed literals). + """ + return _maybe_compile(self.compiler, source, filename, symbol) diff --git a/shared/package-files/32/327d8242564b9017b5161587eeb332b82ac0a7d3732f26b2ddee198030f0e014/blob b/shared/package-files/32/327d8242564b9017b5161587eeb332b82ac0a7d3732f26b2ddee198030f0e014/blob new file mode 100644 index 0000000000000000000000000000000000000000..f1386c061174e068cc35eb79d540532a9d4c6c6e --- /dev/null +++ b/shared/package-files/32/327d8242564b9017b5161587eeb332b82ac0a7d3732f26b2ddee198030f0e014/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API ::std::tuple linalg_lu_factor_ex(const at::Tensor & A, bool pivot=true, bool check_errors=false); +TORCH_API ::std::tuple linalg_lu_factor_ex_out(at::Tensor & LU, at::Tensor & pivots, at::Tensor & info, const at::Tensor & A, bool pivot=true, bool check_errors=false); +TORCH_API ::std::tuple linalg_lu_factor_ex_outf(const at::Tensor & A, bool pivot, bool check_errors, at::Tensor & LU, at::Tensor & pivots, at::Tensor & info); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/32/327e4fab88034e2087cf2191c3b9b9e2c8016d7c7bab299b83959227cc48c22b/blob b/shared/package-files/32/327e4fab88034e2087cf2191c3b9b9e2c8016d7c7bab299b83959227cc48c22b/blob new file mode 100644 index 0000000000000000000000000000000000000000..21230134079caf8c1919949d88ccf5a985defdff --- /dev/null +++ b/shared/package-files/32/327e4fab88034e2087cf2191c3b9b9e2c8016d7c7bab299b83959227cc48c22b/blob @@ -0,0 +1,63 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_add_relu.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor +inline at::Tensor _add_relu(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1) { + return at::_ops::_add_relu_Tensor::call(self, other, alpha); +} + +// aten::_add_relu_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!) +inline at::Tensor & _add_relu_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1) { + return at::_ops::_add_relu__Tensor::call(self, other, alpha); +} + +// aten::_add_relu.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & _add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1) { + return at::_ops::_add_relu_out::call(self, other, alpha, out); +} +// aten::_add_relu.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & _add_relu_outf(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out) { + return at::_ops::_add_relu_out::call(self, other, alpha, out); +} + +// aten::_add_relu.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor +inline at::Tensor _add_relu(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1) { + return at::_ops::_add_relu_Scalar::call(self, other, alpha); +} + +// aten::_add_relu_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!) +inline at::Tensor & _add_relu_(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1) { + return at::_ops::_add_relu__Scalar::call(self, other, alpha); +} + +// aten::_add_relu.Scalar_out(Tensor self, Scalar other, Scalar alpha=1, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & _add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1) { + return at::_ops::_add_relu_Scalar_out::call(self, other, alpha, out); +} +// aten::_add_relu.Scalar_out(Tensor self, Scalar other, Scalar alpha=1, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & _add_relu_outf(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out) { + return at::_ops::_add_relu_Scalar_out::call(self, other, alpha, out); +} + +} diff --git a/shared/package-files/32/32806640e01151678f6af55de6f562502e0dd2ec9c172654e8ba90e3bf8d3a1a/blob b/shared/package-files/32/32806640e01151678f6af55de6f562502e0dd2ec9c172654e8ba90e3bf8d3a1a/blob new file mode 100644 index 0000000000000000000000000000000000000000..5091f69000bc2974c62ddae3b8f610aa06f87ce1 --- /dev/null +++ b/shared/package-files/32/32806640e01151678f6af55de6f562502e0dd2ec9c172654e8ba90e3bf8d3a1a/blob @@ -0,0 +1,2445 @@ +import collections +import dataclasses +import functools +import itertools +import logging +import math +import operator +import os +import pprint +import textwrap +from typing import ( + Any, + Counter, + DefaultDict, + Dict, + Generic, + List, + Optional, + Sequence, + Set, + Tuple, + TypeVar, + Union, +) + +import sympy + +import torch +from torch._dynamo.utils import dynamo_timed +from torch._inductor.metrics import get_metric_table, is_metric_table_enabled +from torch.utils._triton import has_triton + +from . import comms, config, dependencies, ir, metrics +from .codegen.common import get_scheduling_for_device, Kernel +from .comm_analysis import estimate_nccl_collective_runtime +from .dependencies import Dep, MemoryDep, StarDep, WeakDep +from .ir import ComputedBuffer, MultiOutput, MultiOutputLayout +from .sizevars import SimplifyIndexing +from .utils import ( + cache_on_self, + cmp, + free_symbol_has, + get_device_tflops, + get_dtype_size, + get_gpu_dram_gbps, + green_text, + is_collective, + is_wait, + red_text, + sympy_product, +) +from .virtualized import V + + +log = logging.getLogger(__name__) +fusion_log = torch._logging.getArtifactLogger(__name__, "fusion") + + +class WhyNoFuse: + # TODO when we drop support for Python < 3.10, we can use + # @dataclass(slots=True) instead of manually specifying __slots__. + __slots__ = ["node1", "node2", "reason", "args"] + reason: str + args: Tuple[Any, ...] + + def __init__(self, node1: "BaseSchedulerNode", node2: "BaseSchedulerNode"): + self.node1 = node1 + self.node2 = node2 + + def __call__(self, reason, *args): + self.reason = reason + self.args = args + fusion_log.debug(self) + + def __str__(self): + return f"cannot fuse {self.node1.get_name()} with {self.node2.get_name()}: " + ( + self.reason % self.args + ) + + +def pformat(obj): + if isinstance(obj, set): + # pformat has trouble with sets of sympy exprs + obj = sorted(obj, key=str) + result = pprint.pformat(obj, indent=4) + if "\n" in result: + return f"\n{textwrap.indent(result, ' '*4)}" + return result + + +class OutputNode: + def __init__(self, dep): + self.unmet_dependencies = {dep} + self.inverse_users = [] + + def is_reduction(self): + return False + + def get_alias_names(self): + return () + + def get_name(self): + return "OUTPUT" + + __repr__ = get_name + + +def _prune_redundant_deps(node, name_to_fused_node): + """ + Prunes weakdeps intended for mutation ordering + on an upstream fused node if after fusion there is another dependency + on the fused upstream node, making the weakdep redundant + + In essence this enforces an ordering on fusions. As fusions occur, weakdeps will + be incrementally removed, enabling other fusions, ensuring they are fused in order. + """ + name_to_dep_count: Counter[str] = collections.Counter() + + for dep in node.unmet_dependencies: + if not isinstance(dep, WeakDep): + name_to_dep_count[name_to_fused_node[dep.name].get_name()] += 1 + + def should_prune(dep): + if isinstance(dep, WeakDep): + is_redundant = ( + name_to_dep_count[name_to_fused_node[dep.name].get_name()] > 0 + ) + # These can occur because fused nodes always gather deps from their snodes + # If B has a weakdep on A + # B gets fused with C, then any time BC is fused, the weakdep will reappear + is_self_dep = name_to_fused_node[dep.name] == node + return is_redundant or is_self_dep + else: + return False + + deps_to_prune = {dep for dep in node.unmet_dependencies if should_prune(dep)} + + if deps_to_prune: + node.unmet_dependencies = node.unmet_dependencies - deps_to_prune + node.set_read_writes(node.read_writes.remove_reads(deps_to_prune)) + + +# TODO(xmfan): reuse an existing mapping for this if it exists, or formalize this into ir.py:ExternKernel +kernel_name_to_op = { + "extern_kernels.convolution": torch.ops.aten.convolution, + "extern_kernels.mm": torch.ops.aten.mm, + "extern_kernels.bmm": torch.ops.aten.bmm, + "extern_kernels.addmm": torch.ops.aten.addmm, +} + + +class BaseSchedulerNode: + def __init__(self, scheduler: "Scheduler", node: ir.Buffer): + self.scheduler: Scheduler = scheduler + self.node: ir.Buffer = node + self.users: List[NodeUser] = [] + self.inverse_users: List[BaseSchedulerNode] = [] + self.node_users: List[BaseSchedulerNode] = [] + self.set_read_writes(node.get_read_writes()) + self.ancestors: Set[str] = set() + self.min_order: int + self.max_order: int + self.last_usage: Set[ + str + ] = set() # buffers that won't be used after this kernel + self.written = False + + def __repr__(self): + return f"{type(self).__name__}(name={self.get_name()!r})" + + def debug_str(self) -> str: + """Longer form printout for trace logs""" + name = self.get_name() + lines = [ + f"{name}: {type(self).__name__}({type(getattr(self, 'node', None)).__name__})", + f"{name}.writes = {pformat(self.read_writes.writes)}", + f"{name}.unmet_dependencies = {pformat(self.unmet_dependencies)}", + f"{name}.met_dependencies = {pformat(self.read_writes.reads - self.unmet_dependencies)}", + f"{name}.users = {self.users}", + ] + try: + lines += [ + self.debug_str_extra(), + ] + except Exception: + log.warning("Ignoring error in debug_str()", exc_info=True) + + return "\n".join(lines).rstrip() + + def debug_str_extra(self) -> str: + return "" + + def log_details(self): + log.info( + "%s: unmet_dependencies = %s, writes = %s", + self, + self.unmet_dependencies, + self.read_writes.writes, + ) + + def update_mutated_names(self, renames: Dict[str, str]): + self.set_read_writes(self.read_writes.rename(renames)) + + def add_mutation_dep(self, dep): + self.set_read_writes(self.read_writes.with_read(dep)) + + def add_fake_dep(self, dep): + self.set_read_writes(self.read_writes.with_read(dep)) + + def set_users(self, users: List["NodeUser"]): + # deduplicate + result: Dict[int, NodeUser] = {} + for use in users: + if id(use.node) in result: + result[id(use.node)] = use.merge(result[id(use.node)]) + else: + result[id(use.node)] = use + self.users = list(result.values()) + + def set_last_usage( + self, future_used_buffers: Set[str], mutation_real_name: Dict[str, str] + ): + used_buffers = self.used_or_aliased_buffer_names() + used_buffers = {mutation_real_name.get(k, k) for k in used_buffers} + self.last_usage = used_buffers - future_used_buffers + + def get_aliases(self): + return self.node.get_alias_names() + + def get_mutations(self): + return self.node.get_mutation_names() + + def has_aliasing_or_mutation(self): + return bool(self.get_aliases() or self.get_mutations()) + + def set_read_writes(self, rw: dependencies.ReadWrites): + self.read_writes: dependencies.ReadWrites = rw + self.unmet_dependencies = self.read_writes.reads + self.prune_deps() + + def op_counts(self): + return self.read_writes.op_counts + + def used_buffer_names(self) -> Set[str]: + return { + dep.name + for dep in itertools.chain(self.read_writes.reads, self.read_writes.writes) + } + + def used_or_aliased_buffer_names(self) -> Set[str]: + used_names = set() + + for dep in itertools.chain(self.read_writes.reads, self.read_writes.writes): + used_names.add(dep.name) + if V.graph.name_to_buffer.get(dep.name): + layout = V.graph.name_to_buffer[dep.name].get_layout() + # needed to avoid deallocating aliased buffer + # if there are still uses of aliases ahead + if isinstance(layout, ir.AliasedLayout): + used_names.add(layout.view.data.get_name()) + return used_names + + def prune_deps(self): + self.unmet_dependencies = { + dep + for dep in self.unmet_dependencies + if dep.name not in self.scheduler.available_buffer_names + } + + def prune_weak_deps(self): + # Prune weak dependencies on buffers that have been removed + def should_prune(dep): + return isinstance(dep, WeakDep) and dep.name in V.graph.removed_buffers + + to_remove = {dep for dep in self.read_writes.reads if should_prune(dep)} + self.set_read_writes(self.read_writes.remove_reads(to_remove)) + + def prune_redundant_deps(self, name_to_fused_node): + _prune_redundant_deps(self, name_to_fused_node) + + def get_name(self) -> str: + return self.node.get_name() + + def get_first_name(self) -> str: + return self.get_name() + + def get_names(self) -> Set[str]: + return {self.get_name()} + + def get_nodes(self) -> Sequence["BaseSchedulerNode"]: + return [self] + + def get_device(self): + return self.node.get_device() + + def is_reduction(self): + return False + + def is_split_scan(self): + return False + + def is_template(self): + return False + + def is_extern(self): + return False + + def is_foreach(self): + return False + + def can_inplace(self, read_dep: dependencies.MemoryDep): + return False + + def has_side_effects(self): + return False + + def decide_inplace_update(self): + """ + Decide if there should be inplace updates for the node + and record the decision in the active kernel. + """ + if not self.node.should_allocate(): + return + + if isinstance(self, (SchedulerNode,)) and ( + self.node.get_alias_names() or self.node.get_mutation_names() + ): + return + + if ( + ( + isinstance(self, (SchedulerNode,)) + # o what have i done. lets make this an api + or ( + isinstance(self, ExternKernelSchedulerNode) + and isinstance(self.node, (ir.AllReduce, ir.InPlaceHint)) + ) + ) + and config.inplace_buffers + and ( + not isinstance(V.kernel, torch._inductor.codegen.triton.TritonKernel) + or getattr(V.kernel, "mutations", None) is not None + ) + ): + from .codegen.wrapper import buffer_reuse_key + + ordered_reads = sorted(self.read_writes.reads, key=lambda x: x.name) + + for read in ordered_reads: + input_node: Optional[ + BaseSchedulerNode + ] = self.scheduler.name_to_node.get(read.name) + if input_node and V.graph.wrapper_code.can_reuse(input_node, self): + assert input_node.users is not None + remaining_uses = [ + x + for x in input_node.users + if x.node.get_name() + not in self.scheduler.available_buffer_names + ] + if ( + len(remaining_uses) == 1 + and remaining_uses[0].can_inplace + and remaining_uses[0].node is self + and not isinstance( + input_node.node.get_layout(), + ( + ir.MultiOutputLayout, + ir.MutationLayout, + ir.AliasedLayout, + ), + ) + and not ( + isinstance( + input_node.node, (ir.FallbackKernel, ir.MultiOutput) + ) + and len(input_node.node.get_alias_names()) > 0 + ) + and buffer_reuse_key(input_node.node) + == buffer_reuse_key(self.node) + ): + # hacky check for if V.kernel is a real kernel or NullHandler + if hasattr(V.kernel, "args"): + # if there isn't a triton kernel, then we don't need to call triton-specific things. + # but TODO this might be a convenient place to signal to the Collective kernels to inplace + # (and, can we make "kernel" less generic of a name?) + V.kernel.args.make_inplace( + input_node.get_name(), self.get_name() + ) + # mutations not tracked in cpp kernels + if isinstance( + V.kernel, torch._inductor.codegen.triton.TritonKernel + ): + V.kernel.mutations.add(input_node.get_name()) + V.kernel.mutations.add(self.get_name()) + + # update last usage of reused node + self.last_usage.discard(input_node.get_name()) + + V.kernel.inplace_update_buffers[ + self.get_name() + ] = input_node.get_name() + break + + def allocate(self): + if not self.node.should_allocate(): + return + + if isinstance(self, (SchedulerNode,)) and ( + self.node.get_alias_names() or self.node.get_mutation_names() + ): + V.graph.wrapper_code.codegen_allocation(self.node) + return + + # hacky check for if V.kernel is a real kernel or NullHandler + if ( + hasattr(V.kernel, "args") + and self.get_name() in V.kernel.inplace_update_buffers + ): + V.graph.wrapper_code.codegen_inplace_reuse( + self.scheduler.name_to_node[ + V.kernel.inplace_update_buffers[self.get_name()] + ].node, + self.node, + ) + else: + V.graph.wrapper_code.codegen_allocation(self.node) + + def can_free(self): + # There's no real allocated buffer, no need to free it + if isinstance(self.node.layout, ir.NoneLayout): + return False + for use in self.users: + if isinstance(use.node, OutputNode): + return False + return True + + def codegen_originating_info(self, buffer, only_once=True): + if not config.comment_origin: + return + + if only_once and self.written: + return + origins = self.node.origins + out_lines = [] + + for o in origins: + if o.op == "output": + # These are boring and samey + continue + + out_lines.append("") + # TODO(voz): Should the pragma be constant somewhere? + out_lines.append("#pragma CMT ORIGIN:") + op_info_str = f"#pragma CMT {o.op} {o.target}" + if "seq_nr" in o.meta: + op_info_str = op_info_str + f" seq_nr:{o.meta['seq_nr']}" + out_lines.append(op_info_str) + if "stack_trace" in o.meta: + stack_trace = f"{o.meta['stack_trace']}" + stack_trace_last_line = stack_trace.split("|")[-1] + out_lines.append( + "#pragma CMT " + + stack_trace_last_line.replace("{", "{{") + .replace("}", "}}") + .replace("\n", "\\") + ) + out_lines.append("#pragma CMT END ORIGIN") + out_lines.append("") + + if len(out_lines) == 0: + return + + # TODO(voz): Ostensibly, we should not need this. But there are cases where C++ codegen does + # not use BracesBuffer, so we have no good indicator of a C++ buffer atm. + buffer.writelines(out_lines) + self.written = True + + def get_read_write_buffers_sizes(self) -> int: + """ + Counting the number of bytes accessed for a kernel is + surprisingly tricky. In particular, there is a differentiation + between 'theoretical' memory accesses and practical memory + accesses. For example, a layernorm kernel may actually access an + input 3 times, but in theory, it only needs to access its input + once (and may be optimized to do so through say, persistent + reductions) + + Another example is that even though a buffer is passed in, we may + not access the entire buffer. This may occur if we are accessing + a slice of the buffer. Another tricky case is for indirect + indexing, where the amount of bytes accessed depends on the + values of the input. + + What this function aims to compute is the memory accesses for + worst-case inputs, best-case optimization. What this means is + that for each buffer we compute the amount of potential accesses in two ways and take the minimum. + + 1. Numel in ranges multiplied by number of deps the buffer has + 2. The buffer size + """ + if isinstance(self, NopKernelSchedulerNode): + return 0 + if isinstance(self, ExternKernelSchedulerNode) and isinstance( + self.node, MultiOutput + ): + return 0 + + if isinstance(self, SchedulerNode): + node_numel = V.graph.sizevars.size_hint( + sympy_product(self.get_ranges()[0]) + * sympy_product(self.get_ranges()[1]) + ) + else: + node_numel = int(1e9) + buf_accesses = collections.defaultdict(list) + for dep in self.read_writes.reads | self.read_writes.writes: + buf_accesses[dep.name].append(dep) + + reads = {dep.name for dep in self.read_writes.reads} + writes = {dep.name for dep in self.read_writes.writes} + + def is_materialized(buf, snodes): + users = self.scheduler.name_to_node[buf].users + buf_uses = {user.node for user in users} + return len(buf_uses - set(snodes)) > 0 + + if isinstance(self, FusedSchedulerNode): + removed_buffers = { + dep for dep in writes if not is_materialized(dep, self.snodes) + } + writes = writes - removed_buffers + reads = reads - removed_buffers + node_bytes = 0 + + for buf_name in reads | writes: + buf_accessed_elems = sum([node_numel for dep in buf_accesses[buf_name]]) + buf: Union[ir.Buffer, ir.TensorBox] + if buf_name in V.graph.name_to_buffer: + buf = V.graph.name_to_buffer[buf_name] + elif buf_name in V.graph.graph_inputs: + buf = V.graph.graph_inputs[buf_name] + else: + continue + + def get_buf_elems(buf): + return V.graph.sizevars.size_hint(sympy_product(buf.get_size())) + + # Kind of a lazy way to get the MultiOutput nodes corresponding to + # a MultiOutputLayout + if isinstance(buf.layout, MultiOutputLayout): + users = self.scheduler.name_to_node[buf.get_name()].users + buf_elems = sum(get_buf_elems(user.node.node) for user in users) + else: + buf_elems = get_buf_elems(buf) + + node_bytes += min(buf_elems, buf_accessed_elems) * get_dtype_size( + buf.get_dtype() + ) + + return node_bytes + + def get_estimated_runtime(self) -> float: + """ + Returns estimated op runtime in nanoseconds (ns) + """ + layout = None + dtype = None + if not hasattr(self, "node") or not self.node: + assert isinstance( + self, (FusedSchedulerNode, ForeachKernelSchedulerNode) + ), f"{type(self)=}" + assert self.snodes + if not self.snodes[0].node: + return 0 + layout = self.snodes[0].node.get_layout() + dtype = self.snodes[0].node.get_dtype() + else: + layout = self.node.get_layout() + dtype = self.node.get_dtype() + + if "cuda" != layout.device.type: + # default to no reordering based on runtime + return 0 + + # Collective kernels + if is_collective(self.node): + return estimate_nccl_collective_runtime(self.node) + elif is_wait(self.node): + # ir.Wait is only used for collective ops. + # The time needed for the collective op is already estimated and considered + # when we are processing the collective op IR node, so ir.Wait takes 0 time + # since it doesn't take extra time to get the result after the collective is completed. + return 0 + + try: + gpu_memory_bandwidth = get_gpu_dram_gbps() + gpu_flops = get_device_tflops(dtype) * 10**12 + except Exception: + return 0 + + if isinstance(self, ExternKernelSchedulerNode): + assert isinstance(self.node, ir.ExternKernel), f"{type(self.node)=}" + op = kernel_name_to_op.get( + getattr(self.node, "python_kernel_name", ""), None + ) + + # if there is a resolved op, dry-run using fake mode and record flop count + if op is not None: + from torch._subclasses.fake_tensor import FakeTensorMode + from torch.utils.flop_counter import FlopCounterMode + + with FakeTensorMode(), FlopCounterMode( + display=False + ) as flop_counter_mode: + from .ir import ir_node_to_tensor + + fake_inputs = [ + ir_node_to_tensor(input, guard_shape=False) + for input in self.node.inputs + ] + cls = self.node.__class__ + cls.process_kernel(op, *fake_inputs, **self.node.kwargs) + + # TODO(xmfan): find a better heuristic to model FLOPS/latency relationship + factor = 1.0 + counted_flops = flop_counter_mode.get_total_flops() + counted_bytes = self.get_read_write_buffers_sizes() + compute_time = (factor * counted_flops / gpu_flops) * 1e9 + transfer_time = counted_bytes / gpu_memory_bandwidth + + # Return estimated runtime in nanoseconds + return max(compute_time, transfer_time) + + elif isinstance(self, FusedSchedulerNode) or isinstance( + self.node, ComputedBuffer + ): + # Return estimated runtime in nanoseconds (bytes / gbps) + return self.get_read_write_buffers_sizes() / gpu_memory_bandwidth + + return 0 + + +class ExternKernelSchedulerNode(BaseSchedulerNode): + def debug_str_extra(self) -> str: + return f"{self.get_name()}.node.kernel = {getattr(self.node, 'python_kernel_name', None)}" + + def is_extern(self): + return True + + def has_side_effects(self): + return hasattr(self.node, "has_side_effects") and self.node.has_side_effects() + + def can_inplace(self, read_dep: dependencies.MemoryDep): + if self.get_aliases() or self.is_template(): + return False + + if read_dep.name not in self.scheduler.name_to_node: + # don't allow reuse of an 'input' buffer, we don't own it + # (would this have been fixed if I tracked mutations properly above?) + return False + if not isinstance( + self.node, (torch._inductor.ir.AllReduce, torch._inductor.ir.InPlaceHint) + ): + # TODO make this a property of the IR + return False + + if len(self.read_writes.writes) == 1: + write_dep = next(iter(self.read_writes.writes)) + numel_diff = read_dep.get_numel() - write_dep.get_numel() + return V.graph.sizevars.simplify(numel_diff) == 0 + + return False + + +class NopKernelSchedulerNode(BaseSchedulerNode): + pass + + +class SchedulerNode(BaseSchedulerNode): + def __init__( + self, + scheduler: "Scheduler", + node: Union[ir.ComputedBuffer, ir.TemplateBuffer], + ): + super().__init__(scheduler, node) + self._compute_attrs() + + def _compute_attrs( + self, + extra_indexing_constraints: Optional[Tuple[Dict[Any, Any], List[Any]]] = None, + ): + assert isinstance(self.node, (ir.ComputedBuffer, ir.TemplateBuffer)) + self._sizes, self._body = self.node.simplify_and_reorder( + extra_indexing_constraints=extra_indexing_constraints + ) + + group_fn = self.scheduler.get_backend(self.node.get_device()).group_fn + self.group = (self.node.get_device(), group_fn(self._sizes)) + + if isinstance(self.node, ir.TemplateBuffer): + self.set_read_writes(self.node.normalized_read_writes()) + else: + self.set_read_writes( + dependencies.extract_read_writes( + self._body, *self._sizes, normalize=True + ) + ) + + def recompute_size_and_body( + self, extra_indexing_constraints: Tuple[Dict[Any, Any], List[Any]] + ): + self._compute_attrs(extra_indexing_constraints=extra_indexing_constraints) + + def debug_str_extra(self) -> str: + name = self.get_name() + lines = [ + f"{name}.group.device = {self.group[0]}", + f"{name}.group.iteration = {self.group[1]}", + f"{name}.sizes = {self._sizes}", + ] + if self.get_aliases(): + lines.append(f"{name}.aliases = {pformat(self.get_aliases())}") + if self.get_mutations(): + lines.append(f"{name}.mutations = {pformat(self.get_mutations())}") + if isinstance(self._body, ir.LoopBody): + lines.append(f"class {name}_loop_body:") + lines.append(textwrap.indent(self._body.debug_str(), " ")) + return "\n".join(lines) + + def get_ranges(self): + return self._sizes + + def is_reduction(self): + assert isinstance( + self.node, (ir.ComputedBuffer, ir.TemplateBuffer) + ), f"{type(self.node)=}" + return bool(self.node.get_reduction_type()) + + def is_split_scan(self): + assert isinstance( + self.node, (ir.ComputedBuffer, ir.TemplateBuffer) + ), f"{type(self.node)=}" + return isinstance(self.node, ir.ComputedBuffer) and isinstance( + self.node.data, ir.SplitScan + ) + + def is_template(self): + return isinstance(self.node, ir.TemplateBuffer) + + def get_template_node(self): + return self.node if self.is_template() else None + + def run(self, *index_vars): + self.decide_inplace_update() + self.mark_run() + self.codegen(index_vars) + + def mark_run(self): + self.allocate() + + def ranges_from_index_vars(self, index_vars): + sizes = self._sizes + assert sum(map(len, sizes)) == sum(map(len, index_vars)) + var_ranges = dict( + zip( + itertools.chain.from_iterable(index_vars), + itertools.chain.from_iterable(sizes), + ) + ) + return var_ranges + + def codegen(self, index_vars): + var_ranges = self.ranges_from_index_vars(index_vars) + try: + with V.set_ops_handler( + SimplifyIndexing(V.get_ops_handler(), var_ranges) + ), V.kernel.set_current_node(self): + self._body(*index_vars) + except Exception: + log.fatal("Error in codegen for %s", self.node) + raise + + def pointwise_read_writes(self): + """ + Get the memory dependencies in the non-reduction axis. + """ + sizes, reduction_sizes = self._sizes + + def fn(index): + return self._body(index, [sympy.Integer(0) for _ in reduction_sizes]) + + return dependencies.extract_read_writes(fn, sizes) + + def can_inplace(self, read_dep: dependencies.MemoryDep): + if self.get_aliases() or self.is_template(): + return False + if len(self.read_writes.writes) == 1 and isinstance( + read_dep, dependencies.MemoryDep + ): + write_dep = next(iter(self.read_writes.writes)) + assert isinstance(write_dep, dependencies.MemoryDep), f"{type(write_dep)=}" + return read_dep.index == write_dep.index and read_dep.size == write_dep.size + return False + + @cache_on_self + def _get_atomic_add_buffers(self) -> Set[str]: + buffers_store_as_atomic_add = set() + if isinstance(self._body, ir.LoopBody): + for node in self._body.get_nodes(): + if ( + node.op == "call_method" + and node.target == "store" + and ( + ("mode" in node.kwargs and node.kwargs["mode"] == "atomic_add") + or (len(node.args) == 5 and node.args[4] == "atomic_add") + ) + ): + buffers_store_as_atomic_add.add( + node.kwargs["name"] + if "name" in node.kwargs + else (node.args[1] if len(node.args) >= 2 else "") + ) + return buffers_store_as_atomic_add + + def has_atomic_add(self, check_buf): + return check_buf in self._get_atomic_add_buffers() + + +class FusedSchedulerNode(BaseSchedulerNode): + """ + This is a "fake" scheduler node that represents a group of scheduler nodes + that are meant to be fused together. The way it does this is by maintaining + its unmet dependencies as the union of its constituent nodes. + """ + + @classmethod + def fuse(cls, node1: BaseSchedulerNode, node2: BaseSchedulerNode): + assert node1.scheduler is node2.scheduler + assert isinstance(node1, (SchedulerNode, FusedSchedulerNode)) and isinstance( + node2, (SchedulerNode, FusedSchedulerNode) + ) + return cls(node1.scheduler, list(node1.get_nodes()) + list(node2.get_nodes())) # type: ignore[arg-type] + + def __init__(self, scheduler: "Scheduler", snodes: List[SchedulerNode]): + # NB: No need to call super().__init__() because we don't need to re-use any of its logic. + self.snodes = snodes + self.scheduler = scheduler + self.node: ir.Buffer = None # type: ignore[assignment] + self.users: List[NodeUser] = [] + self.inverse_users = [] + self.node_users = [] + self.group = max(snodes, key=lambda x: int(x.is_reduction())).group + self.ancestors = set.union( + *[x.ancestors for x in snodes if x.ancestors is not None] + ) + + self.set_read_writes( + dependencies.ReadWrites.merge_list([x.read_writes for x in snodes]) + ) + + self.unmet_dependencies = { + dep + for dep in set.union(*[x.unmet_dependencies for x in snodes]) + if dep.name not in self.get_names() + } - self.read_writes.writes + self.min_order = min([x.min_order for x in self.snodes]) + self.max_order = max([x.max_order for x in self.snodes]) + + @cache_on_self + def get_name(self) -> str: + return "_".join([x.get_name() for x in self.snodes]) + + def get_first_name(self) -> str: + return self.snodes[0].get_name() + + @cache_on_self + def get_names(self) -> Set[str]: + return set.union(*[x.get_names() for x in self.snodes]) + + def debug_str_extra(self) -> str: + lines = [ + f"{self.get_name()}.snodes[{i}] =\n{node.debug_str()}" + for i, node in enumerate(self.snodes) + ] + return textwrap.indent("\n".join(lines).rstrip(), " ") + + def set_last_usage( + self, future_used_buffers: Set[str], mutation_real_name: Dict[str, str] + ): + # Set self.last_usage using the global information + # This will be used for inter-kernel optimisations + super().set_last_usage(future_used_buffers, mutation_real_name) + # Set self.last_usage on the snodes + # This will be used for optimisations within the kernel + future_used_buffers: Set[str] = set() + for node in reversed(self.snodes): + node.set_last_usage(future_used_buffers, mutation_real_name) + future_used_buffers.update(node.last_usage) # type: ignore[arg-type] + + @cache_on_self + def used_buffer_names(self) -> Set[str]: + return set.union(*[x.used_buffer_names() for x in self.snodes]) + + @cache_on_self + def used_or_aliased_buffer_names(self) -> Set[str]: + return set.union(*[x.used_or_aliased_buffer_names() for x in self.snodes]) + + def get_nodes(self) -> List[SchedulerNode]: + return self.snodes + + def __repr__(self): + return f"{type(self).__name__}(nodes={self.get_name()})" + + @cache_on_self + def is_reduction(self): + return any(x.is_reduction() for x in self.snodes) + + @cache_on_self + def is_split_scan(self): + return any(x.is_split_scan() for x in self.snodes) + + @cache_on_self + def is_template(self): + return any(x.is_template() for x in self.snodes) + + @cache_on_self + def get_template_node(self): + for node in self.snodes: + if node.is_template(): + return node + return None + + def get_device(self): + return self.group[0] + + @cache_on_self + def has_aliasing_or_mutation(self): + return any(x.has_aliasing_or_mutation() for x in self.snodes) + + @cache_on_self + def op_counts(self): + op_counts: Counter[str] = collections.Counter() + for node in self.snodes: + op_counts.update(node.op_counts()) + return op_counts + + def has_atomic_add(self, check_buf): + return any( + ( + isinstance(sub_schedule_node1, SchedulerNode) + and sub_schedule_node1.has_atomic_add(check_buf) + ) + for sub_schedule_node1 in self.get_nodes() + ) + + # None of these need to be implemented, as a FusedSchedulerNode is just an + # abstraction for scheduling purposes + def update_mutated_names(self, renames: Dict[str, str]): + raise NotImplementedError + + def add_mutation_dep(self, name): + raise NotImplementedError + + def set_users(self, users: List["NodeUser"]): + raise NotImplementedError + + def get_aliases(self): + raise NotImplementedError + + def get_mutations(self): + raise NotImplementedError + + def can_inplace(self, read_dep: dependencies.MemoryDep): + raise NotImplementedError + + def allocate(self): + raise NotImplementedError + + def can_free(self): + raise NotImplementedError + + def debug_str(self) -> str: + """Longer form printout for trace logs""" + name = self.get_name() + node_typestr = ",".join(type(n).__name__ for n in self.snodes) + lines = [ + f"{name}: {type(self).__name__}({node_typestr})", + f"{name}.writes = {pformat(self.read_writes.writes)}", + f"{name}.unmet_dependencies = {pformat(self.unmet_dependencies)}", + f"{name}.met_dependencies = {pformat(self.read_writes.reads - self.unmet_dependencies)}", + f"{name}.users = {self.users}", + ] + try: + lines += [ + self.debug_str_extra(), + ] + except Exception: + log.warning("Ignoring error in debug_str()", exc_info=True) + + return "\n".join(lines).rstrip() + + +class ForeachKernelSchedulerNode(FusedSchedulerNode): + """Scheduler node which consists of a list of scheduler nodes that each operate on a + distinct tensor in a list of tensors.""" + + def get_consumer_subnode_for(self, producer): + if producer.get_name() in self.read_to_node: + return self.read_to_node[producer.get_name()] + + return None + + def get_producer_subnode_for(self, consumer): + for rd in consumer.read_writes.reads: + if rd.name in self.name_to_node: + return self.name_to_node[rd.name] + + return None + + @classmethod + def can_fuse(cls, producer, consumer): + why = WhyNoFuse(producer, consumer) + if producer.is_foreach() and consumer.is_foreach(): + foreach_match = len(producer.snodes) == len(consumer.snodes) + if not foreach_match: + why("foreach do not have same length") + return foreach_match and all( + producer.scheduler.can_fuse(l, r) + for l, r in zip(producer.snodes, consumer.snodes) + ) + elif consumer.is_foreach(): + consumer_subnode = consumer.get_consumer_subnode_for(producer) + if consumer_subnode is not None: + return consumer.scheduler.can_fuse(producer, consumer_subnode) + + why("candidate producer is not dep of any foreach consumer") + return False + + elif producer.is_foreach(): + producer_subnode = producer.get_producer_subnode_for(consumer) + if producer_subnode is not None: + return producer.scheduler.can_fuse(producer_subnode, consumer) + + why("candidate consumer has no dep in any foreach producer") + return False + + raise AssertionError( + "At least one node passed to ForeachKernelSchedulerNode.can_fuse should be a foreach node" + ) + + @classmethod + def fuse(cls, producer, consumer): + assert producer.is_foreach() or consumer.is_foreach() + prev_node_1 = None + prev_node_2 = None + if producer.is_foreach() and consumer.is_foreach(): + fused_nodes = [ + FusedSchedulerNode.fuse(l, r) + for l, r in zip(producer.snodes, consumer.snodes) + ] + elif producer.is_foreach(): + producer_subnode = producer.get_producer_subnode_for(consumer) + fused_nodes = [] + prev_node_1 = producer + prev_node_2 = None + for node in producer.snodes: + if node is producer_subnode: + new_node = FusedSchedulerNode.fuse(node, consumer) + prev_node_2 = new_node + fused_nodes.append(new_node) + else: + fused_nodes.append(node) + + elif consumer.is_foreach(): + consumer_subnode = consumer.get_consumer_subnode_for(producer) + fused_nodes = [] + prev_node_1 = consumer + prev_node_2 = None + + for node in consumer.snodes: + if node is consumer_subnode: + new_node = FusedSchedulerNode.fuse(producer, node) + prev_node_2 = new_node + fused_nodes.append(new_node) + else: + fused_nodes.append(node) + + return cls(producer.scheduler, fused_nodes, prev_node_1, prev_node_2) # type: ignore[possibly-undefined] + + def __init__( + self, + scheduler: "Scheduler", + nodes: List[SchedulerNode], + prev_node_1=None, + prev_node_2=None, + ): + self.read_to_node = {} + self.name_to_node = {} + + if prev_node_1 is None or prev_node_2 is None: + super().__init__(scheduler, nodes) + + for node in nodes: + for read in node.read_writes.reads: + self.read_to_node[read.name] = node + + for name in node.get_names(): + self.name_to_node[name] = node + else: + self.scheduler = scheduler + self.snodes = nodes + self.node: ir.Buffer = None # type: ignore[assignment] + self.users: List[NodeUser] = [] + + self.set_read_writes( + dependencies.ReadWrites.merge_list( + [prev_node_1.read_writes, prev_node_2.read_writes] + ) + ) + + self.unmet_dependencies = { + dep + for dep in set.union( + prev_node_1.unmet_dependencies, prev_node_2.unmet_dependencies + ) + if dep.name not in self.get_names() + } - self.read_writes.writes + + self.min_order = min([prev_node_1.min_order, prev_node_2.min_order]) + self.max_order = max([prev_node_1.max_order, prev_node_2.max_order]) + + foreach_node = prev_node_1 if prev_node_1.is_foreach() else prev_node_2 + other_node = prev_node_2 if prev_node_1.is_foreach() else prev_node_1 + + self.ancestors = foreach_node.ancestors + self.ancestors.update(other_node.ancestors) + + self.name_to_node = foreach_node.name_to_node + for name in other_node.get_names(): + self.name_to_node[name] = other_node + + self.group = (nodes[0].get_device(), "foreach") + + self.origins: Set[torch.fx.Node] = set() + + def mark_run(self): + raise NotImplementedError + + def codegen(self): + assert isinstance(self.node, ir.ComputedBuffer), f"{type(self.node)=}" + self.node.get_store_function()(self.node.make_loader()()) + + def can_free(self): + return NotImplementedError + + def is_foreach(self): + return True + + def get_subkernel_nodes(self): + """Returns a list of nodes which comprise the foreach kernel, operating on corresponding elements of our input lists. + These nodes may be vertically fused.""" + return list(self.snodes) + + def get_nodes(self): + """Returns all nodes contained in this kernel, unpacking fused nodes into their constituent scheduler nodes.""" + return list(itertools.chain.from_iterable(x.get_nodes() for x in self.snodes)) + + def get_first_name(self): + return self.snodes[0].get_first_name() + + def prune_redundant_deps(self, name_to_fused_node): + _prune_redundant_deps(self, name_to_fused_node) + + for node in self.snodes: + node.prune_redundant_deps(name_to_fused_node) + + +def pick_loop_order(stride_lengths, sizes, priority_idx=()): + """ + A heuristic to decide loop iteration orders. This has not been well + tuned and may be something we should autotune. + """ + + @functools.cmp_to_key + def index_cmp(a, b): + if sizes[a] == 1 or sizes[b] == 1: + # 1-sizes don't matter, just move them to the end + return cmp(sizes[a] == 1, sizes[b] == 1) + + stride_len_a = [sl[a] for sl in stride_lengths] + stride_len_b = [sl[b] for sl in stride_lengths] + + # equivalent to + # np.logical_or(stride_lengths[:, b] == 0, stride_lengths[:, a] < stride_lengths[:, b]).all() + a_first = sum( + sl_b == 0 or sl_a < sl_b for sl_a, sl_b in zip(stride_len_a, stride_len_b) + ) + b_first = sum( + sl_a == 0 or sl_b < sl_a for sl_a, sl_b in zip(stride_len_a, stride_len_b) + ) + if a_first > b_first: + return -1 + if b_first > a_first: + return 1 + + # otherwise contiguous + return cmp(b, a) + + order = list(reversed(range(len(stride_lengths[0])))) + if len(priority_idx) > 0: + # if we have priority node, only use that node's order + stride_lengths = [stride_lengths[pi] for pi in priority_idx] + if config.pick_loop_orders: + order.sort(key=index_cmp) + return order + + +@dataclasses.dataclass +class NodeUser: + node: BaseSchedulerNode + can_inplace: bool = False + + # A weak user must be scheduled after a given node, but doesn't actually + # use the result + is_weak: bool = False + + def __hash__(self): + return hash((self.node.get_name(), self.can_inplace, self.is_weak)) + + def __eq__(self, other): + return ( + self.get_name() == other.get_name() + and self.can_inplace == other.can_inplace + and self.is_weak == other.is_weak + ) + + def get_name(self): + return self.node.get_name() + + def merge(self, other: "NodeUser") -> "NodeUser": + assert self.node is other.node + return NodeUser( + self.node, + self.can_inplace and other.can_inplace, + self.is_weak and other.is_weak, + ) + + +_post_grad_graph_counter = itertools.count() + + +class Scheduler: + @dynamo_timed + def __init__(self, nodes): + super().__init__() + self.backends = {} + self.fuse_cache = {} + self.post_grad_graph_id = next(_post_grad_graph_counter) + + self.nodes = [] + self.available_buffer_names = { + *V.graph.graph_inputs.keys(), + *V.graph.constants.keys(), + } + + self.nodes = [self.create_scheduler_node(n) for n in nodes] + + # some new constants could have been created above + self.available_buffer_names.update(V.graph.constants.keys()) + for node in self.nodes: + node.prune_deps() + + self.name_to_node: Dict[str, BaseSchedulerNode] = { + n.get_name(): n for n in self.nodes + } + self.name_to_fused_node: Dict[ + str, BaseSchedulerNode + ] = dict() # set in fuse_nodes() + + # mutation_real_name: Maps back to the original name for codegen + # Example: + # If you mutate buf0 inside of buf1's kernel, then: + # mutation_real_name = {"buf0" : "buf1"} + # all subsequent uses of buf0 become buf1's usage in dependency graph + self.mutation_real_name = {} + + # We handle mutation by renaming modified versions of the same + # buffer in the dependency graph to prevent cycles. + # mutation_renames: tracks the current name for a given buffer + # (changed once per mutation) + # Example: + # If you mutate buf0 inside of buf1's kernel, then: + # mutation_renames = {"buf1" : "buf0"} + # in codegen we only use buf0, never buf1 + self.mutation_renames = {} + + self.compute_dependencies() + self.topological_sort_schedule() + self.dead_node_elimination() + if config.reorder_for_compute_comm_overlap: + comms.decide_global_ordering_of_comms(self.nodes) + self.compute_ancestors() + + metrics.ir_nodes_pre_fusion += len(self.nodes) + V.debug.ir_pre_fusion(self.nodes) + self.num_orig_nodes = len(self.nodes) + self.name_to_fused_node = {n.get_name(): n for n in self.nodes} + self.create_foreach_nodes() + self.topological_sort_schedule() + self.logged_slow_fusion = set() + self.fuse_nodes() + if config.reorder_for_compute_comm_overlap: + # Refresh node_users and inverse_users to reflect fused nodes + self.compute_node_users() + self.nodes = comms.reorder_compute_and_comm_for_overlap(self.nodes) + self.compute_last_usage() + V.debug.ir_post_fusion(self.nodes) + V.debug.graph_diagram(self.nodes) + self.debug_draw_graph() + + # used during codegen: + self.current_device: torch.device = None # type: ignore[assignment] + self.buffer_names_to_free = set() + + # fx graph node to the position it appears in the graph + # for debug attribution + self.origin_to_index = {} + + get_metric_table("graph_stats").add_row( + lambda: { + "graph_id": self.post_grad_graph_id, + "num_nodes_before_fusion": self.num_orig_nodes, + "num_nodes_after_fusion": len(self.nodes), + } + ) + + def debug_draw_graph(self): + """Generate an image of the graph for debugging""" + if os.environ.get("INDUCTOR_WRITE_SCHEDULER_GRAPH", None) == "1": + from .debug import draw_buffers + + draw_buffers(self.nodes, print_graph=True) + + def debug_print_nodes(self, label): + if log.isEnabledFor(logging.INFO): + log.info("%s:", label) + for node in self.nodes: + node.log_details() + + def create_scheduler_node(self, node): + assert ( + node.origins is not None + ), "All nodes passed to scheduling must have an origin" + if node.is_no_op(): + return NopKernelSchedulerNode(self, node) + elif isinstance(node, (ir.ComputedBuffer, ir.TemplateBuffer)): + return SchedulerNode(self, node) + elif isinstance(node, ir.ExternKernel): + return ExternKernelSchedulerNode(self, node) + else: + raise NotImplementedError(node) + + def create_foreach_nodes(self): + removed_node_names = set() + fe_nodes = [] + kept_node_names = self.name_to_fused_node.keys() + + for names in V.graph.lists.values(): + names = [ + name + for name in names + if name in kept_node_names + and not isinstance(self.name_to_node[name], NopKernelSchedulerNode) + ] + if not names: + # All nodes eliminated + continue + + removed_node_names.update(names) + snodes = [self.name_to_node[name] for name in names] + + fe_node = ForeachKernelSchedulerNode(self, snodes) # type: ignore[arg-type] + + fe_nodes.append(fe_node) + + for name in names: + self.name_to_fused_node[name] = fe_node + + self.nodes = [ + node for node in self.nodes if node.get_name() not in removed_node_names + ] + fe_nodes + + def compute_dependencies(self): + """ + Create dependency edges between nodes, handling aliasing and + mutation properly. + """ + + T = TypeVar("T") + + class DedupList(Generic[T]): + """ + This data structure behaves like a list except it makes sure the + elements remain unique. + Normally one could use a set/dict for this purpose however + the list in question gets elements appended as it is being + iterated over which means that we need to keep the list + semantics. + """ + + def __init__(self, items=None, membership=None): + self.items = items or list() + self.membership = membership or set() + + def append(self, node_user: T) -> None: + if node_user in self.membership: + return + self.items.append(node_user) + self.membership.add(node_user) + + def __add__(self, other: "DedupList[T]") -> "DedupList[T]": + new_membership = set.union(self.membership, other.membership) + new_items = self.items + [ + x for x in other.items if x not in self.membership + ] + return DedupList(new_items, new_membership) + + name_to_users: DefaultDict[str, DedupList[NodeUser]] = collections.defaultdict( + DedupList + ) + + # handle aliasing by using python aliasing in name_to_users + # if foo aliases bar then we will make name_to_users["foo"] point + # to the same python list as name_to_users["bar"] + for node1 in self.nodes: + node1_name = node1.get_name() + for node2_name in node1.get_aliases(): + if node1_name in name_to_users and node2_name in name_to_users: + # merge the two + list1 = name_to_users[node1_name] + list2 = name_to_users[node2_name] + combined = list1 + list2 + for key in name_to_users.keys(): + if name_to_users[key] is list1 or name_to_users[key] is list2: + name_to_users[key] = combined + elif node1_name in name_to_users: + name_to_users[node2_name] = name_to_users[node1_name] + else: + name_to_users[node1_name] = name_to_users[node2_name] + + def rename(n): + if n in self.mutation_renames: + return rename(self.mutation_renames[n]) + return n + + def dep_closure(node_name): + reachable_names = {node_name} + node = self.name_to_node[node_name] + write_dep = next(iter(node.read_writes.writes)) + for read_dep in node.read_writes.reads: + if ( + read_dep.name in self.name_to_node + and isinstance(read_dep, dependencies.MemoryDep) + and isinstance(write_dep, dependencies.MemoryDep) + and read_dep.index == write_dep.index + and read_dep.size == write_dep.size + ): + reachable_names.update(dep_closure(read_dep.name)) + return reachable_names + + def add_user(used_by_name, user_node, can_inplace=False, is_weak=False): + name_to_users[rename(used_by_name)].append( + NodeUser(user_node, can_inplace, is_weak) + ) + + unbacked_symbol_to_origin_node = {} + + for node in self.nodes: + log.debug("scheduling %s", node.node) + + # unbacked symbols don't follow ordinary buffer dependencies, so + # we track their def/uses separately + unbacked_symbol_defs = sorted( + node.node.get_unbacked_symbol_defs(), key=lambda x: x.name + ) + for s in unbacked_symbol_defs: + assert isinstance(s, sympy.Symbol) + # Pick the first definer as canonical. There may be multiple + # because if a MultiOutputLayout buffer propagates an unbacked + # symint to multiple outputs, they will all claim to def it. + if s not in unbacked_symbol_to_origin_node: + unbacked_symbol_to_origin_node[s] = node + + unbacked_symbol_uses = sorted( + node.node.get_unbacked_symbol_uses(), key=lambda x: x.name + ) + # if a kernel takes unbacked symints, register dependencies + for s in unbacked_symbol_uses: + assert ( + s in unbacked_symbol_to_origin_node + ), f"{s} not in {unbacked_symbol_to_origin_node}" + node.add_fake_dep(StarDep(unbacked_symbol_to_origin_node[s].get_name())) + + # a node will mutate either 0 or 1 buffers + assert len(node.get_mutations()) <= 1 + for alt_name in node.get_mutations(): + alt_name = rename(alt_name) + # this node must run after the prior writer + add_user(alt_name, node) + node.add_mutation_dep(StarDep(alt_name)) + for other_node in name_to_users[alt_name].items: + # this node must run after all prior readers + other_name = rename(other_node.get_name()) + known_dep_node_names = dep_closure(node.get_name()) + if other_name not in known_dep_node_names: + # If this node already directly or indirectly depends on other_node, + # we don't need to insert an extra dep. + node.add_mutation_dep(WeakDep(other_name)) + add_user(other_name, node, is_weak=True) + + # add normal non-mutation dependencies + for read in node.read_writes.reads: + is_weak = isinstance(read, WeakDep) + add_user(read.name, node, node.can_inplace(read), is_weak) + + node.update_mutated_names(self.mutation_renames) + + # update our renaming scheme for the next iteration + for alt_name in node.get_mutations(): + self.mutation_renames[rename(alt_name)] = node.get_name() + self.mutation_renames[alt_name] = node.get_name() + self.mutation_real_name[node.get_name()] = self.mutation_real_name.get( + alt_name, alt_name + ) + + # make sure outputs aren't dead-code-eliminated + for node_name in V.graph.get_output_names(): + log.debug("scheduling output %s", node_name) + add_user(node_name, OutputNode(StarDep(node_name))) + + # make sure unbacked symints aren't dead-code-eliminated + for node in V.graph.graph_outputs: + for s in node.get_unbacked_symbol_uses(): + assert ( + s in unbacked_symbol_to_origin_node + ), f"{s} not in {unbacked_symbol_to_origin_node.keys()}" + node_name = unbacked_symbol_to_origin_node[s].node.name + log.debug("scheduling output %s for unbacked symint %s", node_name, s) + add_user(node_name, OutputNode(StarDep(node_name))) + + # make sure input mutation isn't dead-code-eliminated + for name in self.mutation_renames: + if name in V.graph.graph_inputs: + add_user(name, OutputNode(StarDep(name))) + V.graph.mutated_inputs.add(name) + + inp_names = { + name: index for index, name in enumerate(V.graph.graph_inputs.keys()) + } + V.graph.mutated_input_idxs = [ + inp_names[name] for name in V.graph.mutated_inputs + ] + + # copy users information onto the nodes + for node in self.nodes: + node.set_users(name_to_users[node.get_name()].items) + + # populate inverse_users + for node in self.nodes: + for user in node.users: + user.node.inverse_users.append(node) + + def compute_node_users(self): + # set up buffer name to (fused)snode mapping + buf_to_snode = {} + for node in self.nodes: + if isinstance(node, FusedSchedulerNode): + for x in node.snodes: + buf_to_snode[x.get_name()] = node + buf_to_snode[node.get_name()] = node + + for node in self.nodes: + node.node_users = [] + node.inverse_users = [] + + # compute inverse_users + for node in self.nodes: + inverse_users = [] + for dep in node.unmet_dependencies: + assert dep.name in buf_to_snode + dep_node = buf_to_snode[dep.name] + inverse_users.append(dep_node) + node.inverse_users = inverse_users + + # compute node_users + # TODO: ideally, we should deduplicate .users and .node_users, + # but currently .users contains extra information that's difficult to + # extract into a standalone container. + node_to_users: Dict[BaseSchedulerNode, List[BaseSchedulerNode]] = {} + for node in self.nodes: + for inverse_user in node.inverse_users: + node_to_users.setdefault(inverse_user, []).append(node) + for node, users in node_to_users.items(): + node.node_users = users + + def dead_node_elimination(self): + """ + Remove any nodes without users + """ + again = True # repeat until a fixed point + while again: + updated_nodes = [] + for node in self.nodes: + + def can_eliminate_user(user: NodeUser): + return user.is_weak or user.get_name() in V.graph.removed_buffers + + can_eliminate = not node.has_side_effects() and all( + can_eliminate_user(u) for u in node.users + ) + + if not can_eliminate: + updated_nodes.append(node) + else: + # dead code + log.debug("removed dead node: %s", node.get_name()) + V.graph.removed_buffers.add(node.get_name()) + + again = len(self.nodes) > len(updated_nodes) + self.nodes = updated_nodes + + # Prune any WeakDeps no longer needed + for node in self.nodes: + node.prune_weak_deps() + + def topological_sort_schedule(self): + """ + Ensure self.nodes is in topologically sorted order + """ + seen: Set[ir.Buffer] = set() + name_to_node: Dict[str, ir.Buffer] = dict() + result: List[ir.Buffer] = [] + + def visit(n): + if n not in seen: + seen.add(n) + for dep in sorted(n.unmet_dependencies, key=lambda d: d.name): + visit(name_to_node[dep.name]) + result.append(n) + + for node in self.nodes: + for name in node.get_names(): + name_to_node[name] = node + for node in self.nodes: + visit(node) + self.nodes = result + + def compute_ancestors(self): + """ + Populate each node.ancestors + """ + # note self.nodes is topologically sorted + name_to_ancestors: Dict[str, Set[str]] = {} + for node in self.nodes: + ancestors = set() + for dep in node.unmet_dependencies: + ancestors.add(dep.name) + ancestors |= name_to_ancestors[dep.name] + name_to_ancestors[node.get_name()] = ancestors + node.ancestors = ancestors + + for order, node in enumerate(self.nodes): + node.min_order = order + node.max_order = order + + def fuse_nodes(self): + """ + Mutates self.nodes to combine nodes into FusedSchedulerNodes. + """ + for i in range(10): + old_len = len(self.nodes) + fusion_log.debug( + "===== attempting fusion (%d/10): %d nodes =====", i + 1, old_len + ) + self.fuse_nodes_once() + new_len = len(self.nodes) + fusion_log.debug( + "completed fusion round (%d/10): fused %d nodes into %d nodes\n", + i + 1, + old_len, + new_len, + ) + if new_len == old_len or new_len == 1: + fusion_log.debug("===== fusion complete (%d iterations) =====", i + 1) + break + + def benchmark_fused_nodes(self, nodes): + """ + Benchmark fused list of nodes and return the execution time + in milliseconds on randomly generated inputs. + """ + assert len(nodes) > 0 + device = nodes[0].get_device() + V.graph.scheduler = self + self.current_device = device + backend = self.get_backend(device) + return backend.benchmark_fused_nodes(nodes) + + def speedup_by_fusion(self, node1, node2): + """ + If config.benchmark_fusion is False, always return True. + Otherwise, return True if fusion can brings speedup. + """ + if not config.benchmark_fusion: + return True + + if ( + node1.is_template() + and not isinstance(node1.get_template_node(), ir.TritonTemplateBuffer) + or node1.is_foreach() + or node2.is_foreach() + ): + # TODO support benchmarking epilogue fusion + return True + + node_list_1 = node1.get_nodes() + device = node_list_1[0].get_device() + + # don't support benchmark fusion for CPU right now. + if device.type == "cpu": + return True + + node_list_2 = node2.get_nodes() + node_list_fused = node_list_1 + node_list_2 + + # We can not accurately benchmark kernel using atomic_add + # due to how we generate random integer inputs. + # Skip benchmarking them by allowing fusion. + if any( + hasattr(n.node, "data") + and hasattr(n.node.data, "scatter_mode") + and n.node.data.scatter_mode == "atomic_add" + for n in node_list_fused + ): + return True + + from triton.compiler.errors import CompilationError + + why = WhyNoFuse(node1, node2) + + try: + ms1, path1 = self.benchmark_fused_nodes(node_list_1) + if math.isinf(ms1): + why("register spilling of the first kernel") + return False + ms2, path2 = self.benchmark_fused_nodes(node_list_2) + if math.isinf(ms2): + why("register spilling of the second kernel") + return False + ms_fused, path_fused = self.benchmark_fused_nodes(node_list_fused) + if math.isinf(ms_fused): + why("register spilling of the fused kernel") + return False + except CompilationError as e: + # workaround triton issue: https://github.com/openai/triton/issues/2151 + if "Loop-carried variable" in str(e): + return True # allow fusion + else: + raise + + if fusion_log.isEnabledFor(logging.DEBUG): + if ms_fused < ms1 + ms2: + fusion_log.debug( + "can fuse (benchmark): fusing %s with %s cause %sx speedup", + node1.get_names(), + node2.get_names(), + green_text(f"{(ms1 + ms2) / ms_fused:.3f}"), + ) + else: + fusion_log.debug( + "cannot fuse (benchmark): fusing %s with %s cause %sx slowdown", + node1.get_names(), + node2.get_names(), + red_text(f"{ms_fused / (ms1 + ms2):.3f}"), + ) + + if ( + is_metric_table_enabled("slow_fusion") + and ms_fused >= ms1 + ms2 + and (path1, path2) not in self.logged_slow_fusion + ): + self.logged_slow_fusion.add((path1, path2)) + get_metric_table("slow_fusion").add_row( + lambda: { + "kernel1_path": path1, + "kernel1_latency": ms1, + "kernel2_path": path2, + "kernel2_latency": ms2, + "fused_kernel_path": path_fused, + "fused_kernel_latency": ms_fused, + "slow_down_ratio": ms_fused / (ms1 + ms2), + } + ) + return ms_fused < ms1 + ms2 + + def fuse_nodes_once(self): + """ + Mutates self.nodes to combine nodes into FusedSchedulerNodes. + + This relies on two key functions to control the logic: + - self.can_fuse(): checks if a fusion is legal + - self.score_fusion(): assigns priority to a given fusion + """ + fused_nodes = set(self.nodes) + for node1, node2 in self.get_possible_fusions(): + node1 = self.name_to_fused_node[node1.get_first_name()] + node2 = self.name_to_fused_node[node2.get_first_name()] + if self.can_fuse(node1, node2) and not self.will_fusion_create_cycle( + node1, node2 + ): + if not self.speedup_by_fusion(node1, node2): + continue + fusion_log.debug( + "fusing %s with %s", node1.get_name(), node2.get_name() + ) + + # above can_fuse asserts that node2 has the same device + device = node1.get_device() + node3 = self.get_backend(device).fuse(node1, node2) + fused_nodes.remove(node1) + fused_nodes.remove(node2) + fused_nodes.add(node3) + self.name_to_fused_node.update( + {n.get_name(): node3 for n in node3.get_nodes()} + ) + self.nodes = sorted(fused_nodes, key=lambda x: x.min_order) + self.topological_sort_schedule() + self.prune_redundant_deps() + + def prune_redundant_deps(self): + for node in self.nodes: + node.prune_redundant_deps(self.name_to_fused_node) + + def get_possible_fusions(self): + """ + Helper to find all legal fusion opportunities, sorted by self.score_fusion() + """ + possible_fusions = [] + seen = set() + + def check_all_pairs(nodes): + for node1_index, node1 in enumerate(nodes): + for node2 in nodes[node1_index + 1 :]: + key = (node1, node2) + if key in seen: + continue + seen.add(key) + + if self.can_fuse(node1, node2): + possible_fusions.append(key) + elif (node2.is_template() or node2.is_foreach()) and self.can_fuse( + node2, node1 + ): + # foreach fusions and epilogue fusions are order dependent + possible_fusions.append((node2, node1)) + + buffer_names_grouping = collections.defaultdict(list) + for node in self.nodes: + for buf in node.used_buffer_names(): + buffer_names_grouping[buf].append(node) + for node_grouping in buffer_names_grouping.values(): + check_all_pairs(node_grouping) + + if config.aggressive_fusion: + group_grouping = collections.defaultdict(list) + for node in self.nodes: + group = getattr(node, "group", None) + if group: + group_grouping[group].append(node) + for node_grouping in group_grouping.values(): + check_all_pairs(node_grouping) + + possible_fusions.sort(key=self.score_fusion_key, reverse=True) + fusion_log.debug("found %d possible fusions", len(possible_fusions)) + return possible_fusions + + def will_fusion_create_cycle(self, node1, node2): + """ + Finds whether there's a path from node1 to node2 (or vice-versa) + caused indirectly by other fusions. + """ + + def found_path(node): + # only fused nodes can introduce new ancestors. + if isinstance(node, FusedSchedulerNode) and node not in visited: + visited.add(node) + if node.get_names().issubset(combined_ancestors): + # All fusion outputs are in ancestors of node1 and node2, thus + # cannot introduce new path: + # + # 1. if output is neither descendent of node1 or node2, the + # output cannot introduce a path + # 2. due to [can_fuse]: if WLOG output is descendent of node1, it cannot be + # on path(node1->node2), hence it cannot be ancestor of node2 + # 3. due to [acyclic]: if WLOG output is descendent of node1, it cannot be + # ancestor of node1 + return False + else: + # continue DFS of new ancestors introduced by the fusion + return bool(combined_names & node.ancestors) or any( + found_path(self.name_to_fused_node[n]) + for n in node.ancestors - combined_ancestors + ) + return False + + visited = set() + combined_names = node1.get_names() | node2.get_names() + combined_ancestors = (node1.ancestors | node2.ancestors) - combined_names + cycle = any(found_path(self.name_to_fused_node[n]) for n in combined_ancestors) + if cycle: + WhyNoFuse(node1, node2)("will create cycle") + return cycle + + def can_fusion_increase_peak_memory( + self, node1: BaseSchedulerNode, node2: BaseSchedulerNode + ): + """ + This function prevents fusion for nodes that can increase memory + footprint. This problem is more common in horizontal fusion, where nodes + that are far apart in the original order get fused, lengthening the live + intervals of tensors. This is very evident in models with activation + checkpointing, where the recomputed nodes from different checkpointed + regions get fused and significantly increase the memory footprint. + + The current attempt is a quick, possibly hacky, heuristic to prevent the + fusion of nodes that are far away in the original order. + + A better but difficult to implement heurisitic would be to use live + intervals of the buffers, find region of peak pressure in the original + program and prevent fusion that crosses that peak region. We might need + special care or good approximation in this implementation, as fusion of + node changes live intervals, and re-computing live intervals and peak + memory after each fusion can introduce large compilation overhead. + """ + proximity_score = max( + abs(node1.min_order - node2.max_order), + abs(node2.min_order - node1.max_order), + ) + return proximity_score > 64 + + def can_fuse(self, node1: BaseSchedulerNode, node2: BaseSchedulerNode): + """ + Determine if it is possible to combine node1 and node2 into a + single fused node. + """ + + if node1 is node2: + return False + + why = WhyNoFuse(node1, node2) + + if ( + isinstance(node1, (ExternKernelSchedulerNode, NopKernelSchedulerNode)) + and not node1.is_template() + ): + why("node1 is extern or nop") + return False + if ( + isinstance(node2, (ExternKernelSchedulerNode, NopKernelSchedulerNode)) + and not node2.is_template() + ): + why("node2 is extern or nop") + return False + + if node2.get_names() & node1.ancestors: + why("node1 must go before node2") + return False + + if ( + isinstance(node1, (FusedSchedulerNode, SchedulerNode)) + and isinstance(node2, SchedulerNode) + and isinstance(node2._body, ir.LoopBody) + ): + # Fix issue: https://github.com/pytorch/pytorch/issues/108963 + # Check: + # If node2 reads a buf which is a mutation buf of node1(SchedulerNode) or among nodes in node1(FusedSchedulerNode), + # we will get the corresponding mutation buf and check if this mutation buf is stored by atomic_add mode. + # If True, we will disable the fusion of node1 and node2. + if any( + ( + node2_used_buf in self.mutation_renames + and node1.has_atomic_add(self.mutation_renames[node2_used_buf]) + ) + for node2_used_buf in node2._body.reads_name2expr.keys() + ): + return False + + if node2.is_template(): + why("templates can only fuse epilogues") + return False + if node1.is_template() and ( + node2.has_aliasing_or_mutation() + or node2.is_reduction() + or not config.epilogue_fusion + ): + why("template epilogue not satisfied") + return False + + device = node1.get_device() + device2 = node2.get_device() + if device != device2: + why("device mismatch (%s vs %s)", device, device2) + return False + del device2 + + no_shared_data = self.score_fusion_memory(node1, node2) == 0 + if no_shared_data and ( + not config.aggressive_fusion or node1.is_reduction() or node2.is_reduction() + ): + why("no shared data") + return False # heuristic not needed for correctness + + if ( + not node1.is_foreach() + and not node2.is_foreach() + and len(node1.get_nodes()) + len(node2.get_nodes()) > config.max_fusion_size + ): + why("exceeds max fusion") + return False # heuristic not needed for correctness + + if node1.get_names() & node2.ancestors: + # node2 depends on node1 outputs + if not self.can_fuse_vertical(node1, node2): + return False + return self.get_backend(device).can_fuse_vertical(node1, node2) + else: # nodes don't depend on each other, but may have common reads + if self.can_fusion_increase_peak_memory(node1, node2): + why("will increase peak memory") + return False + return self.get_backend(device).can_fuse_horizontal(node1, node2) + + def can_fuse_vertical(self, node1, node2): + """ + Check if it is legal to fuse a consumer (node2) into a producer (node1). + + We can fuse them if all the reads of node2 either match + corresponding writes in node1, or are written by nodes that can + be scheduled before the fusion of node1 and node2. + + We also disable fusion of a write subsequent to a read if the reads + and writes do not align. + """ + node1_names = node1.get_names() + computed_deps = set() + why = WhyNoFuse(node1, node2) + + # StarDep doesn't match MemoryDep, different indices don't match + # However, broadcasting sometimes strips dimensions, and if that's the case + # we still can match unmet dep + # if there's indirect indexing, don't match it + def fusable_read_and_write(read: Dep, write: Dep): + return ( + self.mutation_renames.get(read.name, read.name) == write.name + and (isinstance(read, MemoryDep) and isinstance(write, MemoryDep)) + and not free_symbol_has(read.index, "tmp") + and not free_symbol_has(write.index, "tmp") + and read.index == write.index + and len(read.size) >= len(write.size) + and read.size[: len(write.size)] == write.size + ) + + for rd in node2.unmet_dependencies: + for cd in node1.read_writes.writes: + if fusable_read_and_write(rd, cd): + computed_deps.add(rd) + + remaining_deps = {dep.name for dep in node2.unmet_dependencies - computed_deps} + if remaining_deps & node1_names: + # MemoryDeps didn't match and read different locations of the same buffer. + # Examples here include: + # - MemoryDep("foo", x) != MemoryDep("foo", x + 1) + # - MemoryDep("foo", x) != StarDep("foo") + why("memory deps did not match") + return False + for name in remaining_deps: + if node1_names & self.name_to_fused_node[name].ancestors: + why("intermediate nodes between node1 & node2") + return False + + # similar to can_inplace, if we are going to fuse a write subsequent to a read + # require that the indexing and size is the same + for write in node2.read_writes.writes: + for read in node1.read_writes.reads: + if write.name != self.mutation_renames.get(read.name, read.name): + continue + + # bail on StarDep + if not fusable_read_and_write(read=read, write=write): + why("fusing a write into a read with different indexing formula") + return False + + return True + + def score_fusion(self, node1: BaseSchedulerNode, node2: BaseSchedulerNode): + """ + Assign a score (higher comes first) to the fusion of node1 + and node2. When different fusions conflict with each other, + this is the way we decide what order to run them in. + + Our current score is based on: + - Estimate of the saved memory operations + - Fusions closer together in original order + """ + memory_score = self.score_fusion_memory(node1, node2) + proximity_score = -max( + abs(node1.min_order - node2.max_order), + abs(node2.min_order - node1.max_order), + ) + return ( + node1.is_template() == config.epilogue_fusion_first and memory_score > 0, + node1.is_reduction() == node2.is_reduction() and memory_score > 0, + memory_score, + proximity_score, + ) + + def score_fusion_memory(self, node1, node2): + """ + The first term in our fusion score that estimates number of saved memory operations. + """ + common_memory_deps = (node1.read_writes.reads | node1.read_writes.writes) & ( + node2.read_writes.reads | node2.read_writes.writes + ) + common_memory_deps = { + dep for dep in common_memory_deps if not dep.has_unbacked_symbols() + } + return sum(dep.numbytes_hint() for dep in common_memory_deps) + + def score_fusion_key(self, nodes): + """ + Shim for list.sort(key=...) + """ + node1, node2 = nodes + return self.score_fusion(node1, node2) + + def compute_last_usage(self): + """ + Populate node.last_usage recursively (also for the nodes within a FusedSchedulerNode) + """ + + future_used_buffers = set() + for node_name in V.graph.get_output_names(): + future_used_buffers.add(node_name) + + for node in reversed(self.nodes): + node.set_last_usage(future_used_buffers, self.mutation_real_name) + future_used_buffers.update(node.last_usage) + + def free_buffers(self): + """Free any buffers that are no longer needed""" + for name in sorted( + self.buffer_names_to_free + - V.graph.removed_buffers + - V.graph.wrapper_code.freed + ): + if name in self.name_to_node: + node = self.name_to_node[name] + if node.can_free(): + V.graph.wrapper_code.codegen_free(node.node) + elif name in V.graph.graph_inputs: + storage = V.graph.graph_inputs[name].data + assert isinstance(storage, ir.StorageBox) and storage.is_input_buffer() + V.graph.wrapper_code.codegen_free(storage.data) + + self.buffer_names_to_free.clear() + + def remove_kernel_local_buffers(self): + """ + Any buffers that are both created and have a last use in the + same kernel can be removed. + """ + + # V.kernel.store_buffer_names should represent the set of nodes + # get fused + fused_node_names = V.kernel.store_buffer_names + names_to_remove = [] + for out_buf in V.kernel.store_buffer_names: + users = self.name_to_node[out_buf].users + assert users is not None + users = {user.get_name() for user in users if not user.is_weak} + if users.issubset(fused_node_names): + names_to_remove.append(out_buf) + + def remove_filter(n): + return ( + n not in V.kernel.must_keep_buffers + and n not in V.kernel.args.input_buffers + and n not in self.mutation_renames + and n not in self.mutation_real_name + ) + + names_to_remove = list(filter(remove_filter, names_to_remove)) + + for name in names_to_remove: + if name in V.kernel.args.inplace_buffers: + buf = V.kernel.args.inplace_buffers[name] + if isinstance(buf, str) and buf.startswith("REMOVED"): + continue + remove = all(n in names_to_remove for n in buf.other_names) + if remove: + self.remove_inplace_buffer(name) + V.kernel.inplaced_to_remove.add(name) + else: + self.remove_buffer(name) + + def remove_buffer(self, name): + # Assign a special value instead of deleting the entry + # because we still rely on output_buffers's length to + # generate unique arg name. + log.debug("remove_buffer(%r)", name) + V.kernel.args.output_buffers[name] = "REMOVED" + V.kernel.removed_buffers.add(name) + + def remove_inplace_buffer(self, name): + log.debug("removing_inplace_buffer(%r)", name) + inner_name = V.kernel.args.inplace_buffers[name].inner_name + V.kernel.args.inplace_buffers[name] = inner_name.replace( + "in_out_ptr", "REMOVED" + ) + V.kernel.removed_buffers.add(name) + + def flush(self): + for backend in self.backends.values(): + backend.flush() + self.free_buffers() + + def codegen_extern_call(self, scheduler_node: ExternKernelSchedulerNode): + assert isinstance(scheduler_node, ExternKernelSchedulerNode) + # 'decide_inplace_update' stores the inplace update decisions in + # the current kernel from where 'allocate' retrieve those decisions. + # We have to make sure there is a non-NULL kernel handler to store + # those inplace update decisions. + with V.set_kernel_handler(Kernel(increase_kernel_count=False)): + scheduler_node.decide_inplace_update() + scheduler_node.allocate() + node = scheduler_node.node + assert isinstance(node, ir.ExternKernel), f"{type(node)=}" + node.codegen(V.graph.wrapper_code) + self.free_buffers() + + def create_backend(self, device: torch.device): + assert ( + device.type != "cuda" or device.index is not None + ), f"{device} should have been normalized in lowering" + V.graph.add_device_info(device) + + device_scheduling = get_scheduling_for_device(device.type) + if device_scheduling is None: + raise RuntimeError(f"Unsupported device type: {device.type}") + + if device.type == "cuda" and not has_triton(): + device_props = torch.cuda.get_device_properties(device) + if device_props.major < 7: + raise RuntimeError( + f"Found {device_props.name} which is too old to be supported by the triton GPU compiler, which is used as the backend. Triton only supports devices of CUDA Capability >= 7.0, but your device is of CUDA capability {device_props.major}.{device_props.minor}" # noqa: B950 + ) + else: + raise RuntimeError( + "Cannot find a working triton installation. More information on installing Triton can be found at https://github.com/openai/triton" # noqa: B950 + ) + + return device_scheduling(self) + + def get_backend(self, device: torch.device): + if device not in self.backends: + self.backends[device] = self.create_backend(device) + return self.backends[device] + + def enter_context(self, node): + def get_order(n): + if n not in self.origin_to_index: + self.origin_to_index.update({n: i for i, n in enumerate(n.graph.nodes)}) + return self.origin_to_index[n] + + # Use a dict to have ordering + origins = { + (get_order(e), e): None for n in node.get_nodes() for e in n.node.origins + } + origins = list(origins.keys()) + if origins: + _, last = max(origins, key=operator.itemgetter(0)) + V.graph.wrapper_code.enter_context(last) + + @dynamo_timed + def codegen(self): + for node in self.nodes: + try: + log.debug( + "Generating code for node %s with estimated runtime %f", + node.get_name(), + node.get_estimated_runtime(), + ) + except Exception as e: + log.debug( + "Generating code for node %s with estimated runtime 0.0", + node.get_name(), + ) + + self.enter_context(node) + + if not isinstance(node, NopKernelSchedulerNode): + device = node.get_device() + if ( + device != self.current_device + or node.is_extern() + or node.is_template() + ): + self.flush() + if device != self.current_device: + if device.type == "cuda": + if self.current_device and self.current_device.type == "cuda": + V.graph.wrapper_code.codegen_device_guard_exit() + assert device.index is not None, "device should have an index" + V.graph.wrapper_code.codegen_device_guard_enter(device.index) + elif self.current_device and self.current_device.type == "cuda": + V.graph.wrapper_code.codegen_device_guard_exit() + self.current_device = device + + self.buffer_names_to_free.update(node.last_usage) + + if node.is_template(): + node, *epilogue = node.get_nodes() + self.get_backend(device).codegen_template(node, epilogue) # type: ignore[possibly-undefined] + elif node.is_extern(): + self.codegen_extern_call(node) + elif node.is_foreach(): + self.get_backend(device).codegen_foreach(node) # type: ignore[possibly-undefined] + elif isinstance(node, (FusedSchedulerNode, SchedulerNode)): + self.get_backend(device).codegen_nodes(node.get_nodes()) # type: ignore[possibly-undefined] + else: + assert isinstance(node, NopKernelSchedulerNode) + node.allocate() + + if config.debug_check_inf_and_nan: + V.graph.wrapper_code.generate_inf_and_nan_checker(node) + + if config.triton.debug_sync_kernel: + self.get_backend(device).codegen_sync() # type: ignore[possibly-undefined] + + self.available_buffer_names.update(node.get_names()) + + if not isinstance(node, NopKernelSchedulerNode): + device = node.get_device() + if self.get_backend(device).ready_to_flush(): + self.flush() + + if self.current_device and self.current_device.type == "cuda": + # exit the outermost CUDA device guard. this is + # important for nested indentation codegen-ing. + V.graph.wrapper_code.codegen_device_guard_exit() + + self.flush() + + def is_unaligned_buffer(self, buf_name): + if buf_name in V.graph.graph_inputs or buf_name in V.graph.constants: + # all graph inputs or constants are assumed to be aligned + return False + node = self.name_to_node[buf_name] + layout = node.node.get_layout() + if isinstance(layout, ir.AliasedLayout): + return not layout.maybe_guard_aligned() + else: + return False + + +class BaseScheduling: + def can_fuse_vertical(self, node1: BaseSchedulerNode, node2: BaseSchedulerNode): + """ + Check whether node1 and node2 can be vertically fused or not. + """ + raise NotImplementedError() + + def can_fuse_horizontal(self, node1: BaseSchedulerNode, node2: BaseSchedulerNode): + """ + Check whether node1 and node2 can be horizontally fused or not. + """ + raise NotImplementedError() + + def fuse(self, node1: BaseSchedulerNode, node2: BaseSchedulerNode): + """ + Fuse two nodes + """ + if node1.is_foreach() or node2.is_foreach(): + return ForeachKernelSchedulerNode.fuse(node1, node2) + else: + return FusedSchedulerNode.fuse(node1, node2) + + def group_fn(self, sizes): + """ + Process the iteration sizes in case a transformation needs to be applied. + """ + raise NotImplementedError() + + def codegen_template( + self, template_node: SchedulerNode, epilogue_nodes: List[SchedulerNode] + ): + """ + Given a template node, generate a kernel. + + This function is only available for triton now. If the third-party backend behaves as a sub-class + of TritonScheduling, it can override it or reuse it. + """ + raise NotImplementedError() + + def codegen_nodes(self, nodes: List[SchedulerNode]): + """ + Generate a kernel given a list of pre-fused nodes. + """ + raise NotImplementedError() + + def codegen_sync(self): + """ + Generate synchronization code for the kernel. This method depends on the hardware characteristics. + """ + raise NotImplementedError() + + def ready_to_flush(self) -> bool: + """ + Check whether the backend is requesting the scheduler to flush the generated kernel. + If not supported, please return False. + """ + return False + + def flush(self): + """ + Flush the generated kernel and python wrapper code to the source code file. + """ + raise NotImplementedError() + + def benchmark_fused_nodes(self, nodes): + """ + Benchmark fused list of nodes and return the execution time + in milliseconds on randomly generated inputs. + """ + raise NotImplementedError() diff --git a/shared/package-files/32/3281f56c5323866af89441df67c4e51eeee541f9df3d7dbb17c552facf852dae/blob b/shared/package-files/32/3281f56c5323866af89441df67c4e51eeee541f9df3d7dbb17c552facf852dae/blob new file mode 100644 index 0000000000000000000000000000000000000000..31cfaba98004e83c0aba84ead7f66b4e62552771 --- /dev/null +++ b/shared/package-files/32/3281f56c5323866af89441df67c4e51eeee541f9df3d7dbb17c552facf852dae/blob @@ -0,0 +1,52 @@ +// Copyright © 2022 Apple Inc. + +#pragma once + +#include +#include +#include +#include + +namespace at { +namespace mps::detail { + +static const uint32_t PHILOX_STATE_N = 7; +struct rng_data_pod { + std::array state{1}; + uint64_t seed = default_rng_seed_val; +}; + +TORCH_API const Generator& getDefaultMPSGenerator(); +TORCH_API Generator createMPSGenerator(uint64_t seed_val = default_rng_seed_val); + +} // namespace mps::detail + +struct TORCH_API MPSGeneratorImpl : public c10::GeneratorImpl { + // Constructors + MPSGeneratorImpl(uint64_t seed_in = default_rng_seed_val); + ~MPSGeneratorImpl() override = default; + + // MPSGeneratorImpl methods + std::shared_ptr clone() const; + void set_current_seed(uint64_t seed) override; + void set_offset(uint64_t offset) override; + uint64_t get_offset() const override; + uint64_t current_seed() const override; + uint64_t seed() override; + void set_state(const c10::TensorImpl& new_state) override; + c10::intrusive_ptr get_state() const override; + void update_philox_counters(); + + void set_engine(at::Philox4_32 engine) { engine_ = engine; }; + at::Philox4_32 engine() { return engine_; }; + uint32_t* state_data() { return data_.state.data(); } + static DeviceType device_type() { return DeviceType::MPS; }; + +private: + mps::detail::rng_data_pod data_; + at::Philox4_32 engine_; + + MPSGeneratorImpl* clone_impl() const override; +}; + +} // namespace at diff --git a/shared/package-files/32/328316a05d5defc85baed3f1d18a527c088052a6c6f362585079d151f9f3f0bf/blob b/shared/package-files/32/328316a05d5defc85baed3f1d18a527c088052a6c6f362585079d151f9f3f0bf/blob new file mode 100644 index 0000000000000000000000000000000000000000..46b1c6cf59e4315625174cbee47fa76554fee481 --- /dev/null +++ b/shared/package-files/32/328316a05d5defc85baed3f1d18a527c088052a6c6f362585079d151f9f3f0bf/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:328316a05d5defc85baed3f1d18a527c088052a6c6f362585079d151f9f3f0bf +size 174969 diff --git a/shared/package-files/32/3283f4c6088d5bfa5354cfb7c38635f1f39d84d1516c4c7c21a36bf3ac147b46/blob b/shared/package-files/32/3283f4c6088d5bfa5354cfb7c38635f1f39d84d1516c4c7c21a36bf3ac147b46/blob new file mode 100644 index 0000000000000000000000000000000000000000..713202d6fa315829d8e7f64249308a1b45e46c78 Binary files /dev/null and b/shared/package-files/32/3283f4c6088d5bfa5354cfb7c38635f1f39d84d1516c4c7c21a36bf3ac147b46/blob differ diff --git a/shared/package-files/32/3287cf5a6748adb00f2b4aed50d30af8121731e18b621671cd41ff26350d198d/blob b/shared/package-files/32/3287cf5a6748adb00f2b4aed50d30af8121731e18b621671cd41ff26350d198d/blob new file mode 100644 index 0000000000000000000000000000000000000000..3da681329cc202a55983ce121f9f0efec4b7df68 --- /dev/null +++ b/shared/package-files/32/3287cf5a6748adb00f2b4aed50d30af8121731e18b621671cd41ff26350d198d/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_thnn_fused_gru_cell(Tensor input_gates, Tensor hidden_gates, Tensor hx, Tensor? input_bias=None, Tensor? hidden_bias=None) -> (Tensor, Tensor) +inline ::std::tuple _thnn_fused_gru_cell(const at::Tensor & input_gates, const at::Tensor & hidden_gates, const at::Tensor & hx, const c10::optional & input_bias={}, const c10::optional & hidden_bias={}) { + return at::_ops::_thnn_fused_gru_cell::call(input_gates, hidden_gates, hx, input_bias, hidden_bias); +} + +// aten::_thnn_fused_gru_cell.out(Tensor input_gates, Tensor hidden_gates, Tensor hx, Tensor? input_bias=None, Tensor? hidden_bias=None, *, Tensor(a!) out0, Tensor(b!) out1) -> (Tensor(a!), Tensor(b!)) +inline ::std::tuple _thnn_fused_gru_cell_out(at::Tensor & out0, at::Tensor & out1, const at::Tensor & input_gates, const at::Tensor & hidden_gates, const at::Tensor & hx, const c10::optional & input_bias={}, const c10::optional & hidden_bias={}) { + return at::_ops::_thnn_fused_gru_cell_out::call(input_gates, hidden_gates, hx, input_bias, hidden_bias, out0, out1); +} +// aten::_thnn_fused_gru_cell.out(Tensor input_gates, Tensor hidden_gates, Tensor hx, Tensor? input_bias=None, Tensor? hidden_bias=None, *, Tensor(a!) out0, Tensor(b!) out1) -> (Tensor(a!), Tensor(b!)) +inline ::std::tuple _thnn_fused_gru_cell_outf(const at::Tensor & input_gates, const at::Tensor & hidden_gates, const at::Tensor & hx, const c10::optional & input_bias, const c10::optional & hidden_bias, at::Tensor & out0, at::Tensor & out1) { + return at::_ops::_thnn_fused_gru_cell_out::call(input_gates, hidden_gates, hx, input_bias, hidden_bias, out0, out1); +} + +} diff --git a/shared/package-files/32/3287e42c001c3be0310c140b556e30ae11f023cc6c9d11055f51e914735c7d1a/blob b/shared/package-files/32/3287e42c001c3be0310c140b556e30ae11f023cc6c9d11055f51e914735c7d1a/blob new file mode 100644 index 0000000000000000000000000000000000000000..2ea991c7452b1511f08f0c2d44cac3c286050108 --- /dev/null +++ b/shared/package-files/32/3287e42c001c3be0310c140b556e30ae11f023cc6c9d11055f51e914735c7d1a/blob @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautogradnonfunctional { + +TORCH_API at::Tensor _trilinear(const at::Tensor & i1, const at::Tensor & i2, const at::Tensor & i3, at::IntArrayRef expand1, at::IntArrayRef expand2, at::IntArrayRef expand3, at::IntArrayRef sumdim, int64_t unroll_dim=1); + +} // namespace compositeexplicitautogradnonfunctional +} // namespace at diff --git a/shared/package-files/32/328ad6eaf4cb2b1aa947de8d841e51c6490158ec6b093caf27be88967c1becb6/blob b/shared/package-files/32/328ad6eaf4cb2b1aa947de8d841e51c6490158ec6b093caf27be88967c1becb6/blob new file mode 100644 index 0000000000000000000000000000000000000000..906725ba7b9a3745abcb09d5cf8509cfa4917449 --- /dev/null +++ b/shared/package-files/32/328ad6eaf4cb2b1aa947de8d841e51c6490158ec6b093caf27be88967c1becb6/blob @@ -0,0 +1,16 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +import pyarrow.compute as pc + +from narwhals._arrow.utils import ArrowSeriesNamespace +from narwhals._compliant.any_namespace import StructNamespace + +if TYPE_CHECKING: + from narwhals._arrow.series import ArrowSeries + + +class ArrowSeriesStructNamespace(ArrowSeriesNamespace, StructNamespace["ArrowSeries"]): + def field(self, name: str) -> ArrowSeries: + return self.with_native(pc.struct_field(self.native, name)).alias(name) diff --git a/shared/package-files/32/328c17581c5524b9a4001a26ff3a01b8b28cec8b0e254e655ae30de0f52c3d56/blob b/shared/package-files/32/328c17581c5524b9a4001a26ff3a01b8b28cec8b0e254e655ae30de0f52c3d56/blob new file mode 100644 index 0000000000000000000000000000000000000000..2a2572cd4a187ff52cf3b38bfeb10e0c4b9308f1 --- /dev/null +++ b/shared/package-files/32/328c17581c5524b9a4001a26ff3a01b8b28cec8b0e254e655ae30de0f52c3d56/blob @@ -0,0 +1,57 @@ +# coding: utf-8 + +if False: # MYPY + from typing import Dict, Any # NOQA + +_package_data = dict( + full_package_name='ruamel.yaml', + version_info=(0, 17, 21), + __version__='0.17.21', + version_timestamp='2022-02-12 09:49:22', + author='Anthon van der Neut', + author_email='a.van.der.neut@ruamel.eu', + description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA + entry_points=None, + since=2014, + extras_require={ + ':platform_python_implementation=="CPython" and python_version<"3.11"': ['ruamel.yaml.clib>=0.2.6'], # NOQA + 'jinja2': ['ruamel.yaml.jinja2>=0.2'], + 'docs': ['ryd'], + }, + classifiers=[ + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: Implementation :: CPython', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Text Processing :: Markup', + 'Typing :: Typed', + ], + keywords='yaml 1.2 parser round-trip preserve quotes order config', + read_the_docs='yaml', + supported=[(3, 5)], # minimum + tox=dict( + env='*f', # f for 3.5 + fl8excl='_test/lib', + ), + # universal=True, + python_requires='>=3', + rtfd='yaml', +) # type: Dict[Any, Any] + + +version_info = _package_data['version_info'] +__version__ = _package_data['__version__'] + +try: + from .cyaml import * # NOQA + + __with_libyaml__ = True +except (ImportError, ValueError): # for Jython + __with_libyaml__ = False + +from ruamel.yaml.main import * # NOQA diff --git a/shared/package-files/32/328e753ef0425f4725c2330f192fd26d6269243090c1560abb56be424a59bc7c/blob b/shared/package-files/32/328e753ef0425f4725c2330f192fd26d6269243090c1560abb56be424a59bc7c/blob new file mode 100644 index 0000000000000000000000000000000000000000..7ea361d8efba10c59e3ecf3b7353035ccb995f4e --- /dev/null +++ b/shared/package-files/32/328e753ef0425f4725c2330f192fd26d6269243090c1560abb56be424a59bc7c/blob @@ -0,0 +1,79 @@ +r"""Functional interface.""" +import math +from torch import Tensor +from typing import List + +from .adadelta import adadelta # type: ignore[attr-defined] # noqa: F401 +from .adagrad import adagrad, _make_sparse # type: ignore[attr-defined] # noqa: F401 +from .adam import adam # type: ignore[attr-defined] # noqa: F401 +from .adamw import adamw # type: ignore[attr-defined] # noqa: F401 +from .adamax import adamax # type: ignore[attr-defined] # noqa: F401 +from .asgd import asgd # type: ignore[attr-defined] # noqa: F401 +from .nadam import nadam # type: ignore[attr-defined] # noqa: F401 +from .radam import radam # type: ignore[attr-defined] # noqa: F401 +from .rmsprop import rmsprop # type: ignore[attr-defined] # noqa: F401 +from .rprop import rprop # type: ignore[attr-defined] # noqa: F401 +from .sgd import sgd # type: ignore[attr-defined] # noqa: F401 + + +# TODO: use foreach API in optim._functional to do all the computation + + +def sparse_adam(params: List[Tensor], + grads: List[Tensor], + exp_avgs: List[Tensor], + exp_avg_sqs: List[Tensor], + state_steps: List[int], + *, + eps: float, + beta1: float, + beta2: float, + lr: float, + maximize: bool): + r"""Functional API that performs Sparse Adam algorithm computation. + + See :class:`~torch.optim.SparseAdam` for details. + """ + for i, param in enumerate(params): + grad = grads[i] + grad = grad if not maximize else -grad + grad = grad.coalesce() # the update is non-linear so indices must be unique + grad_indices = grad._indices() + grad_values = grad._values() + if grad_values.numel() == 0: + # Skip update for empty grad + continue + size = grad.size() + + exp_avg = exp_avgs[i] + exp_avg_sq = exp_avg_sqs[i] + step = state_steps[i] + + + def make_sparse(values): + constructor = grad.new + if grad_indices.dim() == 0 or values.dim() == 0: + return constructor().resize_as_(grad) + return constructor(grad_indices, values, size) + + # Decay the first and second moment running average coefficient + # old <- b * old + (1 - b) * new + # <==> old += (1 - b) * (new - old) + old_exp_avg_values = exp_avg.sparse_mask(grad)._values() + exp_avg_update_values = grad_values.sub(old_exp_avg_values).mul_(1 - beta1) + exp_avg.add_(make_sparse(exp_avg_update_values)) + old_exp_avg_sq_values = exp_avg_sq.sparse_mask(grad)._values() + exp_avg_sq_update_values = grad_values.pow(2).sub_(old_exp_avg_sq_values).mul_(1 - beta2) + exp_avg_sq.add_(make_sparse(exp_avg_sq_update_values)) + + # Dense addition again is intended, avoiding another sparse_mask + numer = exp_avg_update_values.add_(old_exp_avg_values) + exp_avg_sq_update_values.add_(old_exp_avg_sq_values) + denom = exp_avg_sq_update_values.sqrt_().add_(eps) + del exp_avg_update_values, exp_avg_sq_update_values + + bias_correction1 = 1 - beta1 ** step + bias_correction2 = 1 - beta2 ** step + step_size = lr * math.sqrt(bias_correction2) / bias_correction1 + + param.add_(make_sparse(-step_size * numer.div_(denom))) diff --git a/shared/package-files/32/328f3c2609b2dc2b92433db95921f7e049d94acfc9058ec4f8e28f3b64a384f7/blob b/shared/package-files/32/328f3c2609b2dc2b92433db95921f7e049d94acfc9058ec4f8e28f3b64a384f7/blob new file mode 100644 index 0000000000000000000000000000000000000000..b68fb9fb3efb1f11f1d5a8908aa80dc1f9d7e46e --- /dev/null +++ b/shared/package-files/32/328f3c2609b2dc2b92433db95921f7e049d94acfc9058ec4f8e28f3b64a384f7/blob @@ -0,0 +1,266 @@ +from sympy.core import Rational, S +from sympy.simplify import simplify, trigsimp +from sympy.core.function import (Derivative, Function, diff) +from sympy.core.numbers import pi +from sympy.core.symbol import symbols +from sympy.functions.elementary.miscellaneous import sqrt +from sympy.functions.elementary.trigonometric import (cos, sin) +from sympy.integrals.integrals import Integral +from sympy.matrices.immutable import ImmutableDenseMatrix as Matrix +from sympy.vector.vector import Vector, BaseVector, VectorAdd, \ + VectorMul, VectorZero +from sympy.vector.coordsysrect import CoordSys3D +from sympy.vector.vector import Cross, Dot, cross +from sympy.testing.pytest import raises + +C = CoordSys3D('C') + +i, j, k = C.base_vectors() +a, b, c = symbols('a b c') + + +def test_cross(): + v1 = C.x * i + C.z * C.z * j + v2 = C.x * i + C.y * j + C.z * k + assert Cross(v1, v2) == Cross(C.x*C.i + C.z**2*C.j, C.x*C.i + C.y*C.j + C.z*C.k) + assert Cross(v1, v2).doit() == C.z**3*C.i + (-C.x*C.z)*C.j + (C.x*C.y - C.x*C.z**2)*C.k + assert cross(v1, v2) == C.z**3*C.i + (-C.x*C.z)*C.j + (C.x*C.y - C.x*C.z**2)*C.k + assert Cross(v1, v2) == -Cross(v2, v1) + assert Cross(v1, v2) + Cross(v2, v1) == Vector.zero + + +def test_dot(): + v1 = C.x * i + C.z * C.z * j + v2 = C.x * i + C.y * j + C.z * k + assert Dot(v1, v2) == Dot(C.x*C.i + C.z**2*C.j, C.x*C.i + C.y*C.j + C.z*C.k) + assert Dot(v1, v2).doit() == C.x**2 + C.y*C.z**2 + assert Dot(v1, v2).doit() == C.x**2 + C.y*C.z**2 + assert Dot(v1, v2) == Dot(v2, v1) + + +def test_vector_sympy(): + """ + Test whether the Vector framework confirms to the hashing + and equality testing properties of SymPy. + """ + v1 = 3*j + assert v1 == j*3 + assert v1.components == {j: 3} + v2 = 3*i + 4*j + 5*k + v3 = 2*i + 4*j + i + 4*k + k + assert v3 == v2 + assert v3.__hash__() == v2.__hash__() + + +def test_vector(): + assert isinstance(i, BaseVector) + assert i != j + assert j != k + assert k != i + assert i - i == Vector.zero + assert i + Vector.zero == i + assert i - Vector.zero == i + assert Vector.zero != 0 + assert -Vector.zero == Vector.zero + + v1 = a*i + b*j + c*k + v2 = a**2*i + b**2*j + c**2*k + v3 = v1 + v2 + v4 = 2 * v1 + v5 = a * i + + assert isinstance(v1, VectorAdd) + assert v1 - v1 == Vector.zero + assert v1 + Vector.zero == v1 + assert v1.dot(i) == a + assert v1.dot(j) == b + assert v1.dot(k) == c + assert i.dot(v2) == a**2 + assert j.dot(v2) == b**2 + assert k.dot(v2) == c**2 + assert v3.dot(i) == a**2 + a + assert v3.dot(j) == b**2 + b + assert v3.dot(k) == c**2 + c + + assert v1 + v2 == v2 + v1 + assert v1 - v2 == -1 * (v2 - v1) + assert a * v1 == v1 * a + + assert isinstance(v5, VectorMul) + assert v5.base_vector == i + assert v5.measure_number == a + assert isinstance(v4, Vector) + assert isinstance(v4, VectorAdd) + assert isinstance(v4, Vector) + assert isinstance(Vector.zero, VectorZero) + assert isinstance(Vector.zero, Vector) + assert isinstance(v1 * 0, VectorZero) + + assert v1.to_matrix(C) == Matrix([[a], [b], [c]]) + + assert i.components == {i: 1} + assert v5.components == {i: a} + assert v1.components == {i: a, j: b, k: c} + + assert VectorAdd(v1, Vector.zero) == v1 + assert VectorMul(a, v1) == v1*a + assert VectorMul(1, i) == i + assert VectorAdd(v1, Vector.zero) == v1 + assert VectorMul(0, Vector.zero) == Vector.zero + raises(TypeError, lambda: v1.outer(1)) + raises(TypeError, lambda: v1.dot(1)) + + +def test_vector_magnitude_normalize(): + assert Vector.zero.magnitude() == 0 + assert Vector.zero.normalize() == Vector.zero + + assert i.magnitude() == 1 + assert j.magnitude() == 1 + assert k.magnitude() == 1 + assert i.normalize() == i + assert j.normalize() == j + assert k.normalize() == k + + v1 = a * i + assert v1.normalize() == (a/sqrt(a**2))*i + assert v1.magnitude() == sqrt(a**2) + + v2 = a*i + b*j + c*k + assert v2.magnitude() == sqrt(a**2 + b**2 + c**2) + assert v2.normalize() == v2 / v2.magnitude() + + v3 = i + j + assert v3.normalize() == (sqrt(2)/2)*C.i + (sqrt(2)/2)*C.j + + +def test_vector_simplify(): + A, s, k, m = symbols('A, s, k, m') + + test1 = (1 / a + 1 / b) * i + assert (test1 & i) != (a + b) / (a * b) + test1 = simplify(test1) + assert (test1 & i) == (a + b) / (a * b) + assert test1.simplify() == simplify(test1) + + test2 = (A**2 * s**4 / (4 * pi * k * m**3)) * i + test2 = simplify(test2) + assert (test2 & i) == (A**2 * s**4 / (4 * pi * k * m**3)) + + test3 = ((4 + 4 * a - 2 * (2 + 2 * a)) / (2 + 2 * a)) * i + test3 = simplify(test3) + assert (test3 & i) == 0 + + test4 = ((-4 * a * b**2 - 2 * b**3 - 2 * a**2 * b) / (a + b)**2) * i + test4 = simplify(test4) + assert (test4 & i) == -2 * b + + v = (sin(a)+cos(a))**2*i - j + assert trigsimp(v) == (2*sin(a + pi/4)**2)*i + (-1)*j + assert trigsimp(v) == v.trigsimp() + + assert simplify(Vector.zero) == Vector.zero + + +def test_vector_dot(): + assert i.dot(Vector.zero) == 0 + assert Vector.zero.dot(i) == 0 + assert i & Vector.zero == 0 + + assert i.dot(i) == 1 + assert i.dot(j) == 0 + assert i.dot(k) == 0 + assert i & i == 1 + assert i & j == 0 + assert i & k == 0 + + assert j.dot(i) == 0 + assert j.dot(j) == 1 + assert j.dot(k) == 0 + assert j & i == 0 + assert j & j == 1 + assert j & k == 0 + + assert k.dot(i) == 0 + assert k.dot(j) == 0 + assert k.dot(k) == 1 + assert k & i == 0 + assert k & j == 0 + assert k & k == 1 + + raises(TypeError, lambda: k.dot(1)) + + +def test_vector_cross(): + assert i.cross(Vector.zero) == Vector.zero + assert Vector.zero.cross(i) == Vector.zero + + assert i.cross(i) == Vector.zero + assert i.cross(j) == k + assert i.cross(k) == -j + assert i ^ i == Vector.zero + assert i ^ j == k + assert i ^ k == -j + + assert j.cross(i) == -k + assert j.cross(j) == Vector.zero + assert j.cross(k) == i + assert j ^ i == -k + assert j ^ j == Vector.zero + assert j ^ k == i + + assert k.cross(i) == j + assert k.cross(j) == -i + assert k.cross(k) == Vector.zero + assert k ^ i == j + assert k ^ j == -i + assert k ^ k == Vector.zero + + assert k.cross(1) == Cross(k, 1) + + +def test_projection(): + v1 = i + j + k + v2 = 3*i + 4*j + v3 = 0*i + 0*j + assert v1.projection(v1) == i + j + k + assert v1.projection(v2) == Rational(7, 3)*C.i + Rational(7, 3)*C.j + Rational(7, 3)*C.k + assert v1.projection(v1, scalar=True) == S.One + assert v1.projection(v2, scalar=True) == Rational(7, 3) + assert v3.projection(v1) == Vector.zero + assert v3.projection(v1, scalar=True) == S.Zero + + +def test_vector_diff_integrate(): + f = Function('f') + v = f(a)*C.i + a**2*C.j - C.k + assert Derivative(v, a) == Derivative((f(a))*C.i + + a**2*C.j + (-1)*C.k, a) + assert (diff(v, a) == v.diff(a) == Derivative(v, a).doit() == + (Derivative(f(a), a))*C.i + 2*a*C.j) + assert (Integral(v, a) == (Integral(f(a), a))*C.i + + (Integral(a**2, a))*C.j + (Integral(-1, a))*C.k) + + +def test_vector_args(): + raises(ValueError, lambda: BaseVector(3, C)) + raises(TypeError, lambda: BaseVector(0, Vector.zero)) + + +def test_srepr(): + from sympy.printing.repr import srepr + res = "CoordSys3D(Str('C'), Tuple(ImmutableDenseMatrix([[Integer(1), "\ + "Integer(0), Integer(0)], [Integer(0), Integer(1), Integer(0)], "\ + "[Integer(0), Integer(0), Integer(1)]]), VectorZero())).i" + assert srepr(C.i) == res + + +def test_scalar(): + from sympy.vector import CoordSys3D + C = CoordSys3D('C') + v1 = 3*C.i + 4*C.j + 5*C.k + v2 = 3*C.i - 4*C.j + 5*C.k + assert v1.is_Vector is True + assert v1.is_scalar is False + assert (v1.dot(v2)).is_scalar is True + assert (v1.cross(v2)).is_scalar is False diff --git a/shared/package-files/32/328f813f0a1a73fbc6fdbac73926746398e3eef7831fe9c5e2791f3d753bba91/blob b/shared/package-files/32/328f813f0a1a73fbc6fdbac73926746398e3eef7831fe9c5e2791f3d753bba91/blob new file mode 100644 index 0000000000000000000000000000000000000000..80a2526a81ded1c9776ca9c8cea1879465ff3066 --- /dev/null +++ b/shared/package-files/32/328f813f0a1a73fbc6fdbac73926746398e3eef7831fe9c5e2791f3d753bba91/blob @@ -0,0 +1,119 @@ +import warnings + +import torch + +__all__ = ["detect_anomaly", "set_detect_anomaly"] + + +class detect_anomaly: + r"""Context-manager that enable anomaly detection for the autograd engine. + + This does two things: + + - Running the forward pass with detection enabled will allow the backward + pass to print the traceback of the forward operation that created the failing + backward function. + - If ``check_nan`` is ``True``, any backward computation that generate "nan" + value will raise an error. Default ``True``. + + .. warning:: + This mode should be enabled only for debugging as the different tests + will slow down your program execution. + + Example: + + >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_ANOMALY) + >>> import torch + >>> from torch import autograd + >>> class MyFunc(autograd.Function): + ... @staticmethod + ... def forward(ctx, inp): + ... return inp.clone() + ... @staticmethod + ... def backward(ctx, gO): + ... # Error during the backward pass + ... raise RuntimeError("Some error in backward") + ... return gO.clone() + >>> def run_fn(a): + ... out = MyFunc.apply(a) + ... return out.sum() + >>> inp = torch.rand(10, 10, requires_grad=True) + >>> out = run_fn(inp) + >>> out.backward() + Traceback (most recent call last): + File "", line 1, in + File "/your/pytorch/install/torch/_tensor.py", line 93, in backward + torch.autograd.backward(self, gradient, retain_graph, create_graph) + File "/your/pytorch/install/torch/autograd/__init__.py", line 90, in backward + allow_unreachable=True) # allow_unreachable flag + File "/your/pytorch/install/torch/autograd/function.py", line 76, in apply + return self._forward_cls.backward(self, *args) + File "", line 8, in backward + RuntimeError: Some error in backward + >>> with autograd.detect_anomaly(): + ... inp = torch.rand(10, 10, requires_grad=True) + ... out = run_fn(inp) + ... out.backward() + Traceback of forward call that caused the error: + File "tmp.py", line 53, in + out = run_fn(inp) + File "tmp.py", line 44, in run_fn + out = MyFunc.apply(a) + Traceback (most recent call last): + File "", line 4, in + File "/your/pytorch/install/torch/_tensor.py", line 93, in backward + torch.autograd.backward(self, gradient, retain_graph, create_graph) + File "/your/pytorch/install/torch/autograd/__init__.py", line 90, in backward + allow_unreachable=True) # allow_unreachable flag + File "/your/pytorch/install/torch/autograd/function.py", line 76, in apply + return self._forward_cls.backward(self, *args) + File "", line 8, in backward + RuntimeError: Some error in backward + + """ + + def __init__(self, check_nan=True) -> None: + self.prev = torch.is_anomaly_enabled() + self.check_nan = check_nan + self.prev_check_nan = torch.is_anomaly_check_nan_enabled() + warnings.warn( + "Anomaly Detection has been enabled. " + "This mode will increase the runtime " + "and should only be enabled for debugging.", + stacklevel=2, + ) + + def __enter__(self) -> None: + torch.set_anomaly_enabled(True, self.check_nan) + + def __exit__(self, *args: object) -> None: + torch.set_anomaly_enabled(self.prev, self.prev_check_nan) + + +class set_detect_anomaly: + r"""Context-manager that sets the anomaly detection for the autograd engine on or off. + + ``set_detect_anomaly`` will enable or disable the autograd anomaly detection + based on its argument :attr:`mode`. + It can be used as a context-manager or as a function. + + See ``detect_anomaly`` above for details of the anomaly detection behaviour. + + Args: + mode (bool): Flag whether to enable anomaly detection (``True``), + or disable (``False``). + check_nan (bool): Flag whether to raise an error when the backward + generate "nan" + + """ + + def __init__(self, mode: bool, check_nan: bool = True) -> None: + self.prev = torch.is_anomaly_enabled() + self.prev_check_nan = torch.is_anomaly_check_nan_enabled() + torch.set_anomaly_enabled(mode, check_nan) + + def __enter__(self) -> None: + pass + + def __exit__(self, *args: object) -> None: + torch.set_anomaly_enabled(self.prev, self.prev_check_nan) diff --git a/shared/package-files/32/328f93ef417d6217d2bf128e2414cbabd51b12a10d4782d6444432d6de414d7d/blob b/shared/package-files/32/328f93ef417d6217d2bf128e2414cbabd51b12a10d4782d6444432d6de414d7d/blob new file mode 100644 index 0000000000000000000000000000000000000000..268fcd9ab0852a8228b33204dd4d6c19a84fe40a --- /dev/null +++ b/shared/package-files/32/328f93ef417d6217d2bf128e2414cbabd51b12a10d4782d6444432d6de414d7d/blob @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor reflection_pad3d(const at::Tensor & self, at::IntArrayRef padding); +TORCH_API at::Tensor reflection_pad3d_symint(const at::Tensor & self, c10::SymIntArrayRef padding); +TORCH_API at::Tensor & reflection_pad3d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef padding); +TORCH_API at::Tensor & reflection_pad3d_outf(const at::Tensor & self, at::IntArrayRef padding, at::Tensor & out); +TORCH_API at::Tensor & reflection_pad3d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef padding); +TORCH_API at::Tensor & reflection_pad3d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef padding, at::Tensor & out); + +} // namespace cpu +} // namespace at diff --git a/shared/package-files/32/3290332227e6222ff7831da83fa3c2dd1da5bb7e84c2caf6f96d6b5e3b33d948/blob b/shared/package-files/32/3290332227e6222ff7831da83fa3c2dd1da5bb7e84c2caf6f96d6b5e3b33d948/blob new file mode 100644 index 0000000000000000000000000000000000000000..5466d42d4117f9935b54def71e5351fa1a0ee6ab --- /dev/null +++ b/shared/package-files/32/3290332227e6222ff7831da83fa3c2dd1da5bb7e84c2caf6f96d6b5e3b33d948/blob @@ -0,0 +1,15 @@ +from .otBase import BaseTTXConverter + + +class table__a_n_k_r(BaseTTXConverter): + """Anchor Point table + + The anchor point table provides a way to define anchor points. + These are points within the coordinate space of a given glyph, + independent of the control points used to render the glyph. + Anchor points are used in conjunction with the ``kerx`` table. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html + """ + + pass diff --git a/shared/package-files/32/3293bb5a1666aeb8cd5f8119115b36fe8cedd759927b2b6f0c7ef25534a9a532/blob b/shared/package-files/32/3293bb5a1666aeb8cd5f8119115b36fe8cedd759927b2b6f0c7ef25534a9a532/blob new file mode 100644 index 0000000000000000000000000000000000000000..f4d33d7dc783c565acaae1e314176299d0b2f381 --- /dev/null +++ b/shared/package-files/32/3293bb5a1666aeb8cd5f8119115b36fe8cedd759927b2b6f0c7ef25534a9a532/blob @@ -0,0 +1,27 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeMetaFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace at { +namespace meta { + +struct TORCH_API structured_asinh : public TensorIteratorBase { + + + void meta(const at::Tensor & self); +}; + +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32943d3b921c1c3f0d3776d19e5120806990b817bc99a7e22799847abfda1f63/blob b/shared/package-files/32/32943d3b921c1c3f0d3776d19e5120806990b817bc99a7e22799847abfda1f63/blob new file mode 100644 index 0000000000000000000000000000000000000000..439708c9923404312dfabb964615062ea32c0aea --- /dev/null +++ b/shared/package-files/32/32943d3b921c1c3f0d3776d19e5120806990b817bc99a7e22799847abfda1f63/blob @@ -0,0 +1,109 @@ +# Copyright 2006 Google, Inc. All Rights Reserved. +# Licensed to PSF under a Contributor Agreement. + +"""Fixer for has_key(). + +Calls to .has_key() methods are expressed in terms of the 'in' +operator: + + d.has_key(k) -> k in d + +CAVEATS: +1) While the primary target of this fixer is dict.has_key(), the + fixer will change any has_key() method call, regardless of its + class. + +2) Cases like this will not be converted: + + m = d.has_key + if m(k): + ... + + Only *calls* to has_key() are converted. While it is possible to + convert the above to something like + + m = d.__contains__ + if m(k): + ... + + this is currently not done. +""" + +# Local imports +from .. import pytree +from .. import fixer_base +from ..fixer_util import Name, parenthesize + + +class FixHasKey(fixer_base.BaseFix): + BM_compatible = True + + PATTERN = """ + anchor=power< + before=any+ + trailer< '.' 'has_key' > + trailer< + '(' + ( not(arglist | argument) arg=any ','> + ) + ')' + > + after=any* + > + | + negation=not_test< + 'not' + anchor=power< + before=any+ + trailer< '.' 'has_key' > + trailer< + '(' + ( not(arglist | argument) arg=any ','> + ) + ')' + > + > + > + """ + + def transform(self, node, results): + assert results + syms = self.syms + if (node.parent.type == syms.not_test and + self.pattern.match(node.parent)): + # Don't transform a node matching the first alternative of the + # pattern when its parent matches the second alternative + return None + negation = results.get("negation") + anchor = results["anchor"] + prefix = node.prefix + before = [n.clone() for n in results["before"]] + arg = results["arg"].clone() + after = results.get("after") + if after: + after = [n.clone() for n in after] + if arg.type in (syms.comparison, syms.not_test, syms.and_test, + syms.or_test, syms.test, syms.lambdef, syms.argument): + arg = parenthesize(arg) + if len(before) == 1: + before = before[0] + else: + before = pytree.Node(syms.power, before) + before.prefix = " " + n_op = Name("in", prefix=" ") + if negation: + n_not = Name("not", prefix=" ") + n_op = pytree.Node(syms.comp_op, (n_not, n_op)) + new = pytree.Node(syms.comparison, (arg, n_op, before)) + if after: + new = parenthesize(new) + new = pytree.Node(syms.power, (new,) + tuple(after)) + if node.parent.type in (syms.comparison, syms.expr, syms.xor_expr, + syms.and_expr, syms.shift_expr, + syms.arith_expr, syms.term, + syms.factor, syms.power): + new = parenthesize(new) + new.prefix = prefix + return new diff --git a/shared/package-files/32/329b9cc4d158103cad5e1eefad908ca939117ee5d3bef3294365bf024d8e9cf9/blob b/shared/package-files/32/329b9cc4d158103cad5e1eefad908ca939117ee5d3bef3294365bf024d8e9cf9/blob new file mode 100644 index 0000000000000000000000000000000000000000..38385b862c9d642b41af8d74279f98c6a427208a --- /dev/null +++ b/shared/package-files/32/329b9cc4d158103cad5e1eefad908ca939117ee5d3bef3294365bf024d8e9cf9/blob @@ -0,0 +1,38 @@ +# Warnings + + +class DegenerateDataWarning(RuntimeWarning): + """Warns when data is degenerate and results may not be reliable.""" + def __init__(self, msg=None): + if msg is None: + msg = ("Degenerate data encountered; results may not be reliable.") + self.args = (msg,) + + +class ConstantInputWarning(DegenerateDataWarning): + """Warns when all values in data are exactly equal.""" + def __init__(self, msg=None): + if msg is None: + msg = ("All values in data are exactly equal; " + "results may not be reliable.") + self.args = (msg,) + + +class NearConstantInputWarning(DegenerateDataWarning): + """Warns when all values in data are nearly equal.""" + def __init__(self, msg=None): + if msg is None: + msg = ("All values in data are nearly equal; " + "results may not be reliable.") + self.args = (msg,) + + +# Errors + + +class FitError(RuntimeError): + """Represents an error condition when fitting a distribution to data.""" + def __init__(self, msg=None): + if msg is None: + msg = ("An error occurred when fitting a distribution to data.") + self.args = (msg,) diff --git a/shared/package-files/32/329f191d3dd5e6ed6bc66411d23bd13f8e2f2d5bc9d98a7f5aa77aaf74249ab0/blob b/shared/package-files/32/329f191d3dd5e6ed6bc66411d23bd13f8e2f2d5bc9d98a7f5aa77aaf74249ab0/blob new file mode 100644 index 0000000000000000000000000000000000000000..1a070b091cfb2f83bf507dae08d0514b1825c0a8 --- /dev/null +++ b/shared/package-files/32/329f191d3dd5e6ed6bc66411d23bd13f8e2f2d5bc9d98a7f5aa77aaf74249ab0/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:329f191d3dd5e6ed6bc66411d23bd13f8e2f2d5bc9d98a7f5aa77aaf74249ab0 +size 364392 diff --git a/shared/package-files/32/32a0ca0ba630bfa8cd916b11f2b74bb9a6f31d4728e70d4eca50c711dc6f7bf2/blob b/shared/package-files/32/32a0ca0ba630bfa8cd916b11f2b74bb9a6f31d4728e70d4eca50c711dc6f7bf2/blob new file mode 100644 index 0000000000000000000000000000000000000000..6ec44e6b06cdc443b1dd930d8f06fe70be577e97 --- /dev/null +++ b/shared/package-files/32/32a0ca0ba630bfa8cd916b11f2b74bb9a6f31d4728e70d4eca50c711dc6f7bf2/blob @@ -0,0 +1,57 @@ +import numpy as np + +dtype_obj = np.dtype(np.str_) +void_dtype_obj = np.dtype([("f0", np.float64), ("f1", np.float32)]) + +np.dtype(dtype=np.int64) +np.dtype(int) +np.dtype("int") +np.dtype(None) + +np.dtype((int, 2)) +np.dtype((int, (1,))) + +np.dtype({"names": ["a", "b"], "formats": [int, float]}) +np.dtype({"names": ["a"], "formats": [int], "titles": [object]}) +np.dtype({"names": ["a"], "formats": [int], "titles": [object()]}) + +np.dtype([("name", np.str_, 16), ("grades", np.float64, (2,)), ("age", "int32")]) + +np.dtype( + { + "names": ["a", "b"], + "formats": [int, float], + "itemsize": 9, + "aligned": False, + "titles": ["x", "y"], + "offsets": [0, 1], + } +) + +np.dtype((np.float_, float)) + + +class Test: + dtype = np.dtype(float) + + +np.dtype(Test()) + +# Methods and attributes +dtype_obj.base +dtype_obj.subdtype +dtype_obj.newbyteorder() +dtype_obj.type +dtype_obj.name +dtype_obj.names + +dtype_obj * 0 +dtype_obj * 2 + +0 * dtype_obj +2 * dtype_obj + +void_dtype_obj["f0"] +void_dtype_obj[0] +void_dtype_obj[["f0", "f1"]] +void_dtype_obj[["f0"]] diff --git a/shared/package-files/32/32a14c4d05f15b81dbcc8a59f652831c1dc637c48fe328877a74e67fc83f3f16/blob b/shared/package-files/32/32a14c4d05f15b81dbcc8a59f652831c1dc637c48fe328877a74e67fc83f3f16/blob new file mode 100644 index 0000000000000000000000000000000000000000..345a060d0230ada58f769b0f6b55f43a428fc3bd --- /dev/null +++ b/shared/package-files/32/32a14c4d05f15b81dbcc8a59f652831c1dc637c48fe328877a74e67fc83f3f16/blob @@ -0,0 +1,47 @@ +######################## BEGIN LICENSE BLOCK ######################## +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Mark Pilgrim - port to Python +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA +######################### END LICENSE BLOCK ######################### + +from .mbcharsetprober import MultiByteCharSetProber +from .codingstatemachine import CodingStateMachine +from .chardistribution import EUCKRDistributionAnalysis +from .mbcssm import EUCKR_SM_MODEL + + +class EUCKRProber(MultiByteCharSetProber): + def __init__(self): + super(EUCKRProber, self).__init__() + self.coding_sm = CodingStateMachine(EUCKR_SM_MODEL) + self.distribution_analyzer = EUCKRDistributionAnalysis() + self.reset() + + @property + def charset_name(self): + return "EUC-KR" + + @property + def language(self): + return "Korean" diff --git a/shared/package-files/32/32a2dd25a6c1664cc38e249c690ee27fd766a001af5d3d906af1a81a4868de55/blob b/shared/package-files/32/32a2dd25a6c1664cc38e249c690ee27fd766a001af5d3d906af1a81a4868de55/blob new file mode 100644 index 0000000000000000000000000000000000000000..949719b97ed84da6277139a70e22203706ed6055 --- /dev/null +++ b/shared/package-files/32/32a2dd25a6c1664cc38e249c690ee27fd766a001af5d3d906af1a81a4868de55/blob @@ -0,0 +1,114 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// From Apache Impala (incubating) as of 2016-01-29. Pared down to a minimal +// set of functions needed for Apache Arrow / Apache parquet-cpp + +#pragma once + +#include +#include +#include + +#include "arrow/util/macros.h" +#include "arrow/util/visibility.h" + +namespace arrow { +namespace internal { + +/// CpuInfo is an interface to query for cpu information at runtime. The caller can +/// ask for the sizes of the caches and what hardware features are supported. +/// On Linux, this information is pulled from a couple of sys files (/proc/cpuinfo and +/// /sys/devices) +class ARROW_EXPORT CpuInfo { + public: + ~CpuInfo(); + + /// x86 features + static constexpr int64_t SSSE3 = (1LL << 0); + static constexpr int64_t SSE4_1 = (1LL << 1); + static constexpr int64_t SSE4_2 = (1LL << 2); + static constexpr int64_t POPCNT = (1LL << 3); + static constexpr int64_t AVX = (1LL << 4); + static constexpr int64_t AVX2 = (1LL << 5); + static constexpr int64_t AVX512F = (1LL << 6); + static constexpr int64_t AVX512CD = (1LL << 7); + static constexpr int64_t AVX512VL = (1LL << 8); + static constexpr int64_t AVX512DQ = (1LL << 9); + static constexpr int64_t AVX512BW = (1LL << 10); + static constexpr int64_t AVX512 = AVX512F | AVX512CD | AVX512VL | AVX512DQ | AVX512BW; + static constexpr int64_t BMI1 = (1LL << 11); + static constexpr int64_t BMI2 = (1LL << 12); + + /// Arm features + static constexpr int64_t ASIMD = (1LL << 32); + + /// Cache enums for L1 (data), L2 and L3 + enum class CacheLevel { L1 = 0, L2, L3, Last = L3 }; + + /// CPU vendors + enum class Vendor { Unknown, Intel, AMD }; + + static const CpuInfo* GetInstance(); + + /// Returns all the flags for this cpu + int64_t hardware_flags() const; + + /// Returns the number of cores (including hyper-threaded) on this machine. + int num_cores() const; + + /// Returns the vendor of the cpu. + Vendor vendor() const; + + /// Returns the model name of the cpu (e.g. Intel i7-2600) + const std::string& model_name() const; + + /// Returns the size of the cache in KB at this cache level + int64_t CacheSize(CacheLevel level) const; + + /// \brief Returns whether or not the given feature is enabled. + /// + /// IsSupported() is true iff IsDetected() is also true and the feature + /// wasn't disabled by the user (for example by setting the ARROW_USER_SIMD_LEVEL + /// environment variable). + bool IsSupported(int64_t flags) const; + + /// Returns whether or not the given feature is available on the CPU. + bool IsDetected(int64_t flags) const; + + /// Determine if the CPU meets the minimum CPU requirements and if not, issue an error + /// and terminate. + void VerifyCpuRequirements() const; + + /// Toggle a hardware feature on and off. It is not valid to turn on a feature + /// that the underlying hardware cannot support. This is useful for testing. + void EnableFeature(int64_t flag, bool enable); + + bool HasEfficientBmi2() const { + // BMI2 (pext, pdep) is only efficient on Intel X86 processors. + return vendor() == Vendor::Intel && IsSupported(BMI2); + } + + private: + CpuInfo(); + + struct Impl; + std::unique_ptr impl_; +}; + +} // namespace internal +} // namespace arrow diff --git a/shared/package-files/32/32a3f7c0bde6a8ff59654e3cb5b31d5ded1176025c826c8663d1e65508689b4c/blob b/shared/package-files/32/32a3f7c0bde6a8ff59654e3cb5b31d5ded1176025c826c8663d1e65508689b4c/blob new file mode 100644 index 0000000000000000000000000000000000000000..af28e043d4a1af25b46d2fcc92aa8b5fb19522ad --- /dev/null +++ b/shared/package-files/32/32a3f7c0bde6a8ff59654e3cb5b31d5ded1176025c826c8663d1e65508689b4c/blob @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor special_log1p(const at::Tensor & self); +TORCH_API at::Tensor & special_log1p_out(const at::Tensor & self, at::Tensor & out); +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32a5509013fcd656c1d98ef358e3f12a315c6d63dfec0c74e0ab2a78fc3befc9/blob b/shared/package-files/32/32a5509013fcd656c1d98ef358e3f12a315c6d63dfec0c74e0ab2a78fc3befc9/blob new file mode 100644 index 0000000000000000000000000000000000000000..716aa691739115faa77f02a8f5ceb07613731fea --- /dev/null +++ b/shared/package-files/32/32a5509013fcd656c1d98ef358e3f12a315c6d63dfec0c74e0ab2a78fc3befc9/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API t { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::t") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "t(Tensor(a) self) -> Tensor(a)") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API t_ { + using schema = at::Tensor & (at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::t_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "t_(Tensor(a!) self) -> Tensor(a!)") + static at::Tensor & call(at::Tensor & self); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/32/32a6463f32edd39bec3cfdc6daa94cfafd78a1d1c4f69fe1141868da9854099e/blob b/shared/package-files/32/32a6463f32edd39bec3cfdc6daa94cfafd78a1d1c4f69fe1141868da9854099e/blob new file mode 100644 index 0000000000000000000000000000000000000000..2a41c2286e93e8946ecf69248355846b14c761d1 --- /dev/null +++ b/shared/package-files/32/32a6463f32edd39bec3cfdc6daa94cfafd78a1d1c4f69fe1141868da9854099e/blob @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor & _coalesce_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & _coalesce_outf(const at::Tensor & self, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/32/32a6a6ebb58ef4891399417223aeaf4ba2284974e9f46dfcf0369d1f62c230b6/blob b/shared/package-files/32/32a6a6ebb58ef4891399417223aeaf4ba2284974e9f46dfcf0369d1f62c230b6/blob new file mode 100644 index 0000000000000000000000000000000000000000..a2c19c06fe14476a9bfa4f1f60de7a997a41191c --- /dev/null +++ b/shared/package-files/32/32a6a6ebb58ef4891399417223aeaf4ba2284974e9f46dfcf0369d1f62c230b6/blob @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +import sys + +try: + from ._version import version as __version__ +except ImportError: + __version__ = 'unknown' + +__all__ = ['easter', 'parser', 'relativedelta', 'rrule', 'tz', + 'utils', 'zoneinfo'] + +def __getattr__(name): + import importlib + + if name in __all__: + return importlib.import_module("." + name, __name__) + raise AttributeError( + "module {!r} has not attribute {!r}".format(__name__, name) + ) + + +def __dir__(): + # __dir__ should include all the lazy-importable modules as well. + return [x for x in globals() if x not in sys.modules] + __all__ diff --git a/shared/package-files/32/32a789d4f0f583deed28bf6cbaf1352d60f670ef8c58cc28f3e6a0dc55c06ae6/blob b/shared/package-files/32/32a789d4f0f583deed28bf6cbaf1352d60f670ef8c58cc28f3e6a0dc55c06ae6/blob new file mode 100644 index 0000000000000000000000000000000000000000..0a24b259310e585a34f69c00c2b2a5609894ee73 --- /dev/null +++ b/shared/package-files/32/32a789d4f0f583deed28bf6cbaf1352d60f670ef8c58cc28f3e6a0dc55c06ae6/blob @@ -0,0 +1,504 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// helpers.h includes a NumPy header, so we include this first +#include "arrow/python/numpy_init.h" +#include "arrow/python/numpy_interop.h" + +#include "arrow/python/helpers.h" + +#include +#include +#include +#include +#include + +#include "arrow/python/common.h" +#include "arrow/python/decimal.h" +#include "arrow/type_fwd.h" +#include "arrow/util/checked_cast.h" +#include "arrow/util/config.h" +#include "arrow/util/float16.h" +#include "arrow/util/logging.h" + +namespace arrow { + +using internal::checked_cast; + +namespace py { + +#define GET_PRIMITIVE_TYPE(NAME, FACTORY) \ + case Type::NAME: \ + return FACTORY() + +std::shared_ptr GetPrimitiveType(Type::type type) { + switch (type) { + case Type::NA: + return null(); + GET_PRIMITIVE_TYPE(UINT8, uint8); + GET_PRIMITIVE_TYPE(INT8, int8); + GET_PRIMITIVE_TYPE(UINT16, uint16); + GET_PRIMITIVE_TYPE(INT16, int16); + GET_PRIMITIVE_TYPE(UINT32, uint32); + GET_PRIMITIVE_TYPE(INT32, int32); + GET_PRIMITIVE_TYPE(UINT64, uint64); + GET_PRIMITIVE_TYPE(INT64, int64); + GET_PRIMITIVE_TYPE(DATE32, date32); + GET_PRIMITIVE_TYPE(DATE64, date64); + GET_PRIMITIVE_TYPE(BOOL, boolean); + GET_PRIMITIVE_TYPE(HALF_FLOAT, float16); + GET_PRIMITIVE_TYPE(FLOAT, float32); + GET_PRIMITIVE_TYPE(DOUBLE, float64); + GET_PRIMITIVE_TYPE(BINARY, binary); + GET_PRIMITIVE_TYPE(STRING, utf8); + GET_PRIMITIVE_TYPE(LARGE_BINARY, large_binary); + GET_PRIMITIVE_TYPE(LARGE_STRING, large_utf8); + GET_PRIMITIVE_TYPE(BINARY_VIEW, binary_view); + GET_PRIMITIVE_TYPE(STRING_VIEW, utf8_view); + GET_PRIMITIVE_TYPE(INTERVAL_MONTH_DAY_NANO, month_day_nano_interval); + default: + return nullptr; + } +} + +PyObject* PyFloat_FromHalf(uint16_t value) { + // Convert the uint16_t Float16 value to a PyFloat object + arrow::util::Float16 half_val = arrow::util::Float16::FromBits(value); + return PyFloat_FromDouble(half_val.ToDouble()); +} + +Result PyFloat_AsHalf(PyObject* obj) { + if (PyFloat_Check(obj)) { + arrow::util::Float16 half_val = + arrow::util::Float16::FromDouble(PyFloat_AsDouble(obj)); + return half_val.bits(); + } else if (has_numpy() && PyArray_IsScalar(obj, Half)) { + return PyArrayScalar_VAL(obj, Half); + } else { + return Status::TypeError("conversion to float16 expects a `float` or ", + "`np.float16` object, got ", Py_TYPE(obj)->tp_name); + } +} + +namespace internal { + +std::string PyBytes_AsStdString(PyObject* obj) { + ARROW_DCHECK(PyBytes_Check(obj)); + return std::string(PyBytes_AS_STRING(obj), PyBytes_GET_SIZE(obj)); +} + +Status PyUnicode_AsStdString(PyObject* obj, std::string* out) { + ARROW_DCHECK(PyUnicode_Check(obj)); + Py_ssize_t size; + // The utf-8 representation is cached on the unicode object + const char* data = PyUnicode_AsUTF8AndSize(obj, &size); + RETURN_IF_PYERROR(); + *out = std::string(data, size); + return Status::OK(); +} + +std::string PyObject_StdStringRepr(PyObject* obj) { + OwnedRef unicode_ref(PyObject_Repr(obj)); + OwnedRef bytes_ref; + + if (unicode_ref) { + bytes_ref.reset( + PyUnicode_AsEncodedString(unicode_ref.obj(), "utf8", "backslashreplace")); + } + if (!bytes_ref) { + PyErr_Clear(); + std::stringstream ss; + ss << "tp_name << "' repr() failed>"; + return ss.str(); + } + return PyBytes_AsStdString(bytes_ref.obj()); +} + +Status PyObject_StdStringStr(PyObject* obj, std::string* out) { + OwnedRef string_ref(PyObject_Str(obj)); + RETURN_IF_PYERROR(); + return PyUnicode_AsStdString(string_ref.obj(), out); +} + +Result IsModuleImported(const std::string& module_name) { + // PyImport_GetModuleDict returns with a borrowed reference + OwnedRef key(PyUnicode_FromString(module_name.c_str())); + auto is_imported = PyDict_Contains(PyImport_GetModuleDict(), key.obj()); + RETURN_IF_PYERROR(); + return is_imported; +} + +Status ImportModule(const std::string& module_name, OwnedRef* ref) { + PyObject* module = PyImport_ImportModule(module_name.c_str()); + RETURN_IF_PYERROR(); + ref->reset(module); + return Status::OK(); +} + +Status ImportFromModule(PyObject* module, const std::string& name, OwnedRef* ref) { + PyObject* attr = PyObject_GetAttrString(module, name.c_str()); + RETURN_IF_PYERROR(); + ref->reset(attr); + return Status::OK(); +} + +namespace { + +Status IntegerOverflowStatus(PyObject* obj, const std::string& overflow_message) { + if (overflow_message.empty()) { + std::string obj_as_stdstring; + RETURN_NOT_OK(PyObject_StdStringStr(obj, &obj_as_stdstring)); + return Status::Invalid("Value ", obj_as_stdstring, + " too large to fit in C integer type"); + } else { + return Status::Invalid(overflow_message); + } +} + +Result PyObjectToPyInt(PyObject* obj) { + // Try to call __index__ or __int__ on `obj` + // (starting from Python 3.10, the latter isn't done anymore by PyLong_AsLong*). + OwnedRef ref(PyNumber_Index(obj)); + if (ref) { + return std::move(ref); + } + PyErr_Clear(); + const auto nb = Py_TYPE(obj)->tp_as_number; + if (nb && nb->nb_int) { + ref.reset(nb->nb_int(obj)); + if (!ref) { + RETURN_IF_PYERROR(); + } + ARROW_DCHECK(ref); + return std::move(ref); + } + return Status::TypeError( + "object of type ", + PyObject_StdStringRepr(reinterpret_cast(Py_TYPE(obj))), + " cannot be converted to int"); +} + +// Extract C signed int from Python object +template ::value, Int> = 0> +Status CIntFromPythonImpl(PyObject* obj, Int* out, const std::string& overflow_message) { + static_assert(sizeof(Int) <= sizeof(long long), // NOLINT + "integer type larger than long long"); + + OwnedRef ref; + if (!PyLong_Check(obj)) { + ARROW_ASSIGN_OR_RAISE(ref, PyObjectToPyInt(obj)); + obj = ref.obj(); + } + + if (sizeof(Int) > sizeof(long)) { // NOLINT + const auto value = PyLong_AsLongLong(obj); + if (ARROW_PREDICT_FALSE(value == -1)) { + RETURN_IF_PYERROR(); + } + if (ARROW_PREDICT_FALSE(value < std::numeric_limits::min() || + value > std::numeric_limits::max())) { + return IntegerOverflowStatus(obj, overflow_message); + } + *out = static_cast(value); + } else { + const auto value = PyLong_AsLong(obj); + if (ARROW_PREDICT_FALSE(value == -1)) { + RETURN_IF_PYERROR(); + } + if (ARROW_PREDICT_FALSE(value < std::numeric_limits::min() || + value > std::numeric_limits::max())) { + return IntegerOverflowStatus(obj, overflow_message); + } + *out = static_cast(value); + } + return Status::OK(); +} + +// Extract C unsigned int from Python object +template ::value, Int> = 0> +Status CIntFromPythonImpl(PyObject* obj, Int* out, const std::string& overflow_message) { + static_assert(sizeof(Int) <= sizeof(unsigned long long), // NOLINT + "integer type larger than unsigned long long"); + + OwnedRef ref; + if (!PyLong_Check(obj)) { + ARROW_ASSIGN_OR_RAISE(ref, PyObjectToPyInt(obj)); + obj = ref.obj(); + } + + if (sizeof(Int) > sizeof(unsigned long)) { // NOLINT + const auto value = PyLong_AsUnsignedLongLong(obj); + if (ARROW_PREDICT_FALSE(value == static_cast(-1))) { + RETURN_IF_PYERROR(); + } + if (ARROW_PREDICT_FALSE(value > std::numeric_limits::max())) { + return IntegerOverflowStatus(obj, overflow_message); + } + *out = static_cast(value); + } else { + const auto value = PyLong_AsUnsignedLong(obj); + if (ARROW_PREDICT_FALSE(value == static_cast(-1))) { + RETURN_IF_PYERROR(); + } + if (ARROW_PREDICT_FALSE(value > std::numeric_limits::max())) { + return IntegerOverflowStatus(obj, overflow_message); + } + *out = static_cast(value); + } + return Status::OK(); +} + +} // namespace + +template +Status CIntFromPython(PyObject* obj, Int* out, const std::string& overflow_message) { + if (PyBool_Check(obj)) { + return Status::TypeError("Expected integer, got bool"); + } + return CIntFromPythonImpl(obj, out, overflow_message); +} + +template Status CIntFromPython(PyObject*, int8_t*, const std::string&); +template Status CIntFromPython(PyObject*, int16_t*, const std::string&); +template Status CIntFromPython(PyObject*, int32_t*, const std::string&); +template Status CIntFromPython(PyObject*, int64_t*, const std::string&); +template Status CIntFromPython(PyObject*, uint8_t*, const std::string&); +template Status CIntFromPython(PyObject*, uint16_t*, const std::string&); +template Status CIntFromPython(PyObject*, uint32_t*, const std::string&); +template Status CIntFromPython(PyObject*, uint64_t*, const std::string&); + +inline bool MayHaveNaN(PyObject* obj) { + // Some core types can be very quickly type-checked and do not allow NaN values + const int64_t non_nan_tpflags = Py_TPFLAGS_LONG_SUBCLASS | Py_TPFLAGS_LIST_SUBCLASS | + Py_TPFLAGS_TUPLE_SUBCLASS | Py_TPFLAGS_BYTES_SUBCLASS | + Py_TPFLAGS_UNICODE_SUBCLASS | Py_TPFLAGS_DICT_SUBCLASS | + Py_TPFLAGS_BASE_EXC_SUBCLASS | Py_TPFLAGS_TYPE_SUBCLASS; + return !PyType_HasFeature(Py_TYPE(obj), non_nan_tpflags); +} + +bool PyFloat_IsNaN(PyObject* obj) { + return PyFloat_Check(obj) && std::isnan(PyFloat_AsDouble(obj)); +} + +namespace { + +// This needs a conditional, because using std::once_flag could introduce +// a deadlock when the GIL is enabled. See +// https://github.com/apache/arrow/commit/f69061935e92e36e25bb891177ca8bc4f463b272 for +// more info. +#ifdef Py_GIL_DISABLED +static std::once_flag pandas_static_initialized; +#else +static bool pandas_static_initialized = false; +#endif + +// Once initialized, these variables hold borrowed references to Pandas static data. +// We should not use OwnedRef here because Python destructors would be +// called on a finalized interpreter. +static PyObject* pandas_NA = nullptr; +static PyObject* pandas_NaT = nullptr; +static PyObject* pandas_Timedelta = nullptr; +static PyObject* pandas_Timestamp = nullptr; +static PyTypeObject* pandas_NaTType = nullptr; +static PyObject* pandas_DateOffset = nullptr; + +void GetPandasStaticSymbols() { + OwnedRef pandas; + + // Import pandas + Status s = ImportModule("pandas", &pandas); + if (!s.ok()) { + return; + } + +#ifndef Py_GIL_DISABLED + // Since ImportModule can release the GIL, another thread could have + // already initialized the static data. + if (pandas_static_initialized) { + return; + } +#endif + + OwnedRef ref; + + // set NaT sentinel and its type + if (ImportFromModule(pandas.obj(), "NaT", &ref).ok()) { + pandas_NaT = ref.obj(); + // PyObject_Type returns a new reference but we trust that pandas.NaT will + // outlive our use of this PyObject* + pandas_NaTType = Py_TYPE(ref.obj()); + } + + // retain a reference to Timedelta + if (ImportFromModule(pandas.obj(), "Timedelta", &ref).ok()) { + pandas_Timedelta = ref.obj(); + } + + // retain a reference to Timestamp + if (ImportFromModule(pandas.obj(), "Timestamp", &ref).ok()) { + pandas_Timestamp = ref.obj(); + } + + // if pandas.NA exists, retain a reference to it + if (ImportFromModule(pandas.obj(), "NA", &ref).ok()) { + pandas_NA = ref.obj(); + } + + // Import DateOffset type + if (ImportFromModule(pandas.obj(), "DateOffset", &ref).ok()) { + pandas_DateOffset = ref.obj(); + } +} + +} // namespace + +#ifdef Py_GIL_DISABLED +void InitPandasStaticData() { + std::call_once(pandas_static_initialized, GetPandasStaticSymbols); +} +#else +void InitPandasStaticData() { + // NOTE: This is called with the GIL held. We needn't (and shouldn't, + // to avoid deadlocks) use an additional C++ lock (ARROW-10519). + if (pandas_static_initialized) { + return; + } + GetPandasStaticSymbols(); + pandas_static_initialized = true; +} +#endif + +bool PandasObjectIsNull(PyObject* obj) { + if (!MayHaveNaN(obj)) { + return false; + } + if (obj == Py_None) { + return true; + } + if (PyFloat_IsNaN(obj) || (pandas_NA && obj == pandas_NA) || + (pandas_NaTType && PyObject_TypeCheck(obj, pandas_NaTType)) || + (internal::PyDecimal_Check(obj) && internal::PyDecimal_ISNAN(obj))) { + return true; + } + return false; +} + +bool IsPandasTimedelta(PyObject* obj) { + return pandas_Timedelta && PyObject_IsInstance(obj, pandas_Timedelta); +} + +bool IsPandasTimestamp(PyObject* obj) { + return pandas_Timestamp && PyObject_IsInstance(obj, pandas_Timestamp); +} + +PyObject* BorrowPandasDataOffsetType() { return pandas_DateOffset; } + +Status InvalidValue(PyObject* obj, const std::string& why) { + auto obj_as_str = PyObject_StdStringRepr(obj); + return Status::Invalid("Could not convert ", std::move(obj_as_str), " with type ", + Py_TYPE(obj)->tp_name, ": ", why); +} + +Status InvalidType(PyObject* obj, const std::string& why) { + auto obj_as_str = PyObject_StdStringRepr(obj); + return Status::TypeError("Could not convert ", std::move(obj_as_str), " with type ", + Py_TYPE(obj)->tp_name, ": ", why); +} + +Status UnboxIntegerAsInt64(PyObject* obj, int64_t* out) { + if (PyLong_Check(obj)) { + int overflow = 0; + *out = PyLong_AsLongLongAndOverflow(obj, &overflow); + if (overflow) { + return Status::Invalid("PyLong is too large to fit int64"); + } + } else if (PyArray_IsScalar(obj, Byte)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, UByte)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, Short)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, UShort)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, Int)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, UInt)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, Long)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, ULong)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, LongLong)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, Int64)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, ULongLong)) { + *out = reinterpret_cast(obj)->obval; + } else if (PyArray_IsScalar(obj, UInt64)) { + *out = reinterpret_cast(obj)->obval; + } else { + return Status::Invalid("Integer scalar type not recognized"); + } + return Status::OK(); +} + +Status IntegerScalarToDoubleSafe(PyObject* obj, double* out) { + int64_t value = 0; + RETURN_NOT_OK(UnboxIntegerAsInt64(obj, &value)); + + constexpr int64_t kDoubleMax = 1LL << 53; + constexpr int64_t kDoubleMin = -(1LL << 53); + + if (value < kDoubleMin || value > kDoubleMax) { + return Status::Invalid("Integer value ", value, " is outside of the range exactly", + " representable by a IEEE 754 double precision value"); + } + *out = static_cast(value); + return Status::OK(); +} + +Status IntegerScalarToFloat32Safe(PyObject* obj, float* out) { + int64_t value = 0; + RETURN_NOT_OK(UnboxIntegerAsInt64(obj, &value)); + + constexpr int64_t kFloatMax = 1LL << 24; + constexpr int64_t kFloatMin = -(1LL << 24); + + if (value < kFloatMin || value > kFloatMax) { + return Status::Invalid("Integer value ", value, " is outside of the range exactly", + " representable by a IEEE 754 single precision value"); + } + *out = static_cast(value); + return Status::OK(); +} + +void DebugPrint(PyObject* obj) { + std::string repr = PyObject_StdStringRepr(obj); + PySys_WriteStderr("%s\n", repr.c_str()); +} + +bool IsThreadingEnabled() { +#ifdef ARROW_ENABLE_THREADING + return true; +#else + return false; +#endif +} + +} // namespace internal +} // namespace py +} // namespace arrow diff --git a/shared/package-files/32/32a824bfcdf64bec1d60c8532c414b439fb932cd37ec4d325238bd28c1260f57/blob b/shared/package-files/32/32a824bfcdf64bec1d60c8532c414b439fb932cd37ec4d325238bd28c1260f57/blob new file mode 100644 index 0000000000000000000000000000000000000000..b2b5cfac6290430ffb267084f79e82718dd71123 --- /dev/null +++ b/shared/package-files/32/32a824bfcdf64bec1d60c8532c414b439fb932cd37ec4d325238bd28c1260f57/blob @@ -0,0 +1,218 @@ +"""isort:skip_file""" +# Import order is significant here. + +from . import math +from . import extra +from .standard import ( + argmax, + argmin, + cdiv, + cumprod, + cumsum, + max, + maximum, + min, + minimum, + sigmoid, + softmax, + sort, + sum, + ravel, + swizzle2d, + xor_sum, + zeros, + zeros_like, +) +from .core import ( + TRITON_MAX_TENSOR_NUMEL, + abs, + advance, + arange, + associative_scan, + atomic_add, + atomic_and, + atomic_cas, + atomic_max, + atomic_min, + atomic_or, + atomic_xchg, + atomic_xor, + bfloat16, + block_type, + broadcast, + broadcast_to, + cat, + constexpr, + cos, + debug_barrier, + device_assert, + device_print, + dot, + dtype, + exp, + expand_dims, + full, + fdiv, + float16, + float32, + float64, + float8e4b15, + float8e4b15x4, + float8e4nv, + float8e5, + function_type, + inline_asm_elementwise, + int1, + int16, + int32, + int64, + int8, + load, + log, + make_block_ptr, + max_constancy, + max_contiguous, + multiple_of, + num_programs, + pi32_t, + pointer_type, + program_id, + reduce, + reshape, + sin, + sqrt, + static_assert, + static_print, + store, + static_range, + tensor, + trans, + # triton, + uint16, + uint32, + uint64, + uint8, + umulhi, + view, + void, + where, +) +from .random import ( + pair_uniform_to_normal, + philox, + philox_impl, + rand, + rand4x, + randint, + randint4x, + randn, + randn4x, + uint_to_uniform_float, +) + +__all__ = [ + "TRITON_MAX_TENSOR_NUMEL", + "abs", + "advance", + "arange", + "argmin", + "argmax", + "associative_scan", + "atomic_add", + "atomic_and", + "atomic_cas", + "atomic_max", + "atomic_min", + "atomic_or", + "atomic_xchg", + "atomic_xor", + "bfloat16", + "block_type", + "broadcast", + "broadcast_to", + "builtin", + "cat", + "cdiv", + "constexpr", + "cos", + "cumprod", + "cumsum", + "debug_barrier", + "device_assert", + "device_print", + "dot", + "dtype", + "exp", + "expand_dims", + "extra", + "fdiv", + "float16", + "float32", + "float64", + "float8e4b15", + "float8e4b15x4", + "float8e4nv", + "float8e5", + "full", + "function_type", + "inline_asm_elementwise", + "int1", + "int16", + "int32", + "int64", + "int8", + "ir", + "math", + "load", + "log", + "make_block_ptr", + "max", + "max_constancy", + "max_contiguous", + "maximum", + "min", + "minimum", + "multiple_of", + "num_programs", + "pair_uniform_to_normal", + "philox", + "philox_impl", + "pi32_t", + "pointer_type", + "program_id", + "rand", + "rand4x", + "randint", + "randint4x", + "randn", + "randn4x", + "ravel", + "reduce", + "reshape", + "sigmoid", + "sin", + "softmax", + "sort", + "sqrt", + "static_range", + "static_assert", + "static_print", + "store", + "sum", + "swizzle2d", + "tensor", + "trans", + "triton", + "uint16", + "uint32", + "uint_to_uniform_float", + "uint64", + "uint8", + "umulhi", + "view", + "void", + "where", + "xor_sum", + "zeros", + "zeros_like", +] diff --git a/shared/package-files/32/32a98c89caffc479001a81be4fb349e1875464824b3b8645a7a0261090e5ca1c/blob b/shared/package-files/32/32a98c89caffc479001a81be4fb349e1875464824b3b8645a7a0261090e5ca1c/blob new file mode 100644 index 0000000000000000000000000000000000000000..018d38cdd5003103adec60cbfd844f49ca18c932 --- /dev/null +++ b/shared/package-files/32/32a98c89caffc479001a81be4fb349e1875464824b3b8645a7a0261090e5ca1c/blob @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('ma', parent_package, top_path) + config.add_subpackage('tests') + config.add_data_files('*.pyi') + return config + +if __name__ == "__main__": + from numpy.distutils.core import setup + config = configuration(top_path='').todict() + setup(**config) diff --git a/shared/package-files/32/32acc1bc543116cbe2cff10cb867772df2f254ff2634c870aef0b46c4b696fdb/blob b/shared/package-files/32/32acc1bc543116cbe2cff10cb867772df2f254ff2634c870aef0b46c4b696fdb/blob new file mode 100644 index 0000000000000000000000000000000000000000..65c3cd99cc7433f271a5b9387abdd1ddb949d1a6 Binary files /dev/null and b/shared/package-files/32/32acc1bc543116cbe2cff10cb867772df2f254ff2634c870aef0b46c4b696fdb/blob differ diff --git a/shared/package-files/32/32b37b19593bff3156c0349f221b43dc58281609851a54e98ce9e723374fd35d/blob b/shared/package-files/32/32b37b19593bff3156c0349f221b43dc58281609851a54e98ce9e723374fd35d/blob new file mode 100644 index 0000000000000000000000000000000000000000..e5069c89a84ab89c46c95a026c8998089b73fac5 --- /dev/null +++ b/shared/package-files/32/32b37b19593bff3156c0349f221b43dc58281609851a54e98ce9e723374fd35d/blob @@ -0,0 +1,830 @@ +from sympy.holonomic import (DifferentialOperator, HolonomicFunction, + DifferentialOperators, from_hyper, + from_meijerg, expr_to_holonomic) +from sympy.holonomic.recurrence import RecurrenceOperators, HolonomicSequence +from sympy.core import EulerGamma +from sympy.core.numbers import (I, Rational, pi) +from sympy.core.singleton import S +from sympy.core.symbol import (Symbol, symbols) +from sympy.functions.elementary.exponential import (exp, log) +from sympy.functions.elementary.hyperbolic import (asinh, cosh) +from sympy.functions.elementary.miscellaneous import sqrt +from sympy.functions.elementary.trigonometric import (cos, sin) +from sympy.functions.special.bessel import besselj +from sympy.functions.special.beta_functions import beta +from sympy.functions.special.error_functions import (Ci, Si, erf, erfc) +from sympy.functions.special.gamma_functions import gamma +from sympy.functions.special.hyper import (hyper, meijerg) +from sympy.printing.str import sstr +from sympy.series.order import O +from sympy.simplify.hyperexpand import hyperexpand +from sympy.polys.domains.integerring import ZZ +from sympy.polys.domains.rationalfield import QQ +from sympy.polys.domains.realfield import RR + + +def test_DifferentialOperator(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + assert Dx == R.derivative_operator + assert Dx == DifferentialOperator([R.base.zero, R.base.one], R) + assert x * Dx + x**2 * Dx**2 == DifferentialOperator([0, x, x**2], R) + assert (x**2 + 1) + Dx + x * \ + Dx**5 == DifferentialOperator([x**2 + 1, 1, 0, 0, 0, x], R) + assert (x * Dx + x**2 + 1 - Dx * (x**3 + x))**3 == (-48 * x**6) + \ + (-57 * x**7) * Dx + (-15 * x**8) * Dx**2 + (-x**9) * Dx**3 + p = (x * Dx**2 + (x**2 + 3) * Dx**5) * (Dx + x**2) + q = (2 * x) + (4 * x**2) * Dx + (x**3) * Dx**2 + \ + (20 * x**2 + x + 60) * Dx**3 + (10 * x**3 + 30 * x) * Dx**4 + \ + (x**4 + 3 * x**2) * Dx**5 + (x**2 + 3) * Dx**6 + assert p == q + + +def test_HolonomicFunction_addition(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx**2 * x, x) + q = HolonomicFunction((2) * Dx + (x) * Dx**2, x) + assert p == q + p = HolonomicFunction(x * Dx + 1, x) + q = HolonomicFunction(Dx + 1, x) + r = HolonomicFunction((x - 2) + (x**2 - 2) * Dx + (x**2 - x) * Dx**2, x) + assert p + q == r + p = HolonomicFunction(x * Dx + Dx**2 * (x**2 + 2), x) + q = HolonomicFunction(Dx - 3, x) + r = HolonomicFunction((-54 * x**2 - 126 * x - 150) + (-135 * x**3 - 252 * x**2 - 270 * x + 140) * Dx +\ + (-27 * x**4 - 24 * x**2 + 14 * x - 150) * Dx**2 + \ + (9 * x**4 + 15 * x**3 + 38 * x**2 + 30 * x +40) * Dx**3, x) + assert p + q == r + p = HolonomicFunction(Dx**5 - 1, x) + q = HolonomicFunction(x**3 + Dx, x) + r = HolonomicFunction((-x**18 + 45*x**14 - 525*x**10 + 1575*x**6 - x**3 - 630*x**2) + \ + (-x**15 + 30*x**11 - 195*x**7 + 210*x**3 - 1)*Dx + (x**18 - 45*x**14 + 525*x**10 - \ + 1575*x**6 + x**3 + 630*x**2)*Dx**5 + (x**15 - 30*x**11 + 195*x**7 - 210*x**3 + \ + 1)*Dx**6, x) + assert p+q == r + + p = x**2 + 3*x + 8 + q = x**3 - 7*x + 5 + p = p*Dx - p.diff() + q = q*Dx - q.diff() + r = HolonomicFunction(p, x) + HolonomicFunction(q, x) + s = HolonomicFunction((6*x**2 + 18*x + 14) + (-4*x**3 - 18*x**2 - 62*x + 10)*Dx +\ + (x**4 + 6*x**3 + 31*x**2 - 10*x - 71)*Dx**2, x) + assert r == s + + +def test_HolonomicFunction_multiplication(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx+x+x*Dx**2, x) + q = HolonomicFunction(x*Dx+Dx*x+Dx**2, x) + r = HolonomicFunction((8*x**6 + 4*x**4 + 6*x**2 + 3) + (24*x**5 - 4*x**3 + 24*x)*Dx + \ + (8*x**6 + 20*x**4 + 12*x**2 + 2)*Dx**2 + (8*x**5 + 4*x**3 + 4*x)*Dx**3 + \ + (2*x**4 + x**2)*Dx**4, x) + assert p*q == r + p = HolonomicFunction(Dx**2+1, x) + q = HolonomicFunction(Dx-1, x) + r = HolonomicFunction((2) + (-2)*Dx + (1)*Dx**2, x) + assert p*q == r + p = HolonomicFunction(Dx**2+1+x+Dx, x) + q = HolonomicFunction((Dx*x-1)**2, x) + r = HolonomicFunction((4*x**7 + 11*x**6 + 16*x**5 + 4*x**4 - 6*x**3 - 7*x**2 - 8*x - 2) + \ + (8*x**6 + 26*x**5 + 24*x**4 - 3*x**3 - 11*x**2 - 6*x - 2)*Dx + \ + (8*x**6 + 18*x**5 + 15*x**4 - 3*x**3 - 6*x**2 - 6*x - 2)*Dx**2 + (8*x**5 + \ + 10*x**4 + 6*x**3 - 2*x**2 - 4*x)*Dx**3 + (4*x**5 + 3*x**4 - x**2)*Dx**4, x) + assert p*q == r + p = HolonomicFunction(x*Dx**2-1, x) + q = HolonomicFunction(Dx*x-x, x) + r = HolonomicFunction((x - 3) + (-2*x + 2)*Dx + (x)*Dx**2, x) + assert p*q == r + + +def test_addition_initial_condition(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx-1, x, 0, [3]) + q = HolonomicFunction(Dx**2+1, x, 0, [1, 0]) + r = HolonomicFunction(-1 + Dx - Dx**2 + Dx**3, x, 0, [4, 3, 2]) + assert p + q == r + p = HolonomicFunction(Dx - x + Dx**2, x, 0, [1, 2]) + q = HolonomicFunction(Dx**2 + x, x, 0, [1, 0]) + r = HolonomicFunction((-x**4 - x**3/4 - x**2 + Rational(1, 4)) + (x**3 + x**2/4 + x*Rational(3, 4) + 1)*Dx + \ + (x*Rational(-3, 2) + Rational(7, 4))*Dx**2 + (x**2 - x*Rational(7, 4) + Rational(1, 4))*Dx**3 + (x**2 + x/4 + S.Half)*Dx**4, x, 0, [2, 2, -2, 2]) + assert p + q == r + p = HolonomicFunction(Dx**2 + 4*x*Dx + x**2, x, 0, [3, 4]) + q = HolonomicFunction(Dx**2 + 1, x, 0, [1, 1]) + r = HolonomicFunction((x**6 + 2*x**4 - 5*x**2 - 6) + (4*x**5 + 36*x**3 - 32*x)*Dx + \ + (x**6 + 3*x**4 + 5*x**2 - 9)*Dx**2 + (4*x**5 + 36*x**3 - 32*x)*Dx**3 + (x**4 + \ + 10*x**2 - 3)*Dx**4, x, 0, [4, 5, -1, -17]) + assert p + q == r + q = HolonomicFunction(Dx**3 + x, x, 2, [3, 0, 1]) + p = HolonomicFunction(Dx - 1, x, 2, [1]) + r = HolonomicFunction((-x**2 - x + 1) + (x**2 + x)*Dx + (-x - 2)*Dx**3 + \ + (x + 1)*Dx**4, x, 2, [4, 1, 2, -5 ]) + assert p + q == r + p = expr_to_holonomic(sin(x)) + q = expr_to_holonomic(1/x, x0=1) + r = HolonomicFunction((x**2 + 6) + (x**3 + 2*x)*Dx + (x**2 + 6)*Dx**2 + (x**3 + 2*x)*Dx**3, \ + x, 1, [sin(1) + 1, -1 + cos(1), -sin(1) + 2]) + assert p + q == r + C_1 = symbols('C_1') + p = expr_to_holonomic(sqrt(x)) + q = expr_to_holonomic(sqrt(x**2-x)) + r = (p + q).to_expr().subs(C_1, -I/2).expand() + assert r == I*sqrt(x)*sqrt(-x + 1) + sqrt(x) + + +def test_multiplication_initial_condition(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx**2 + x*Dx - 1, x, 0, [3, 1]) + q = HolonomicFunction(Dx**2 + 1, x, 0, [1, 1]) + r = HolonomicFunction((x**4 + 14*x**2 + 60) + 4*x*Dx + (x**4 + 9*x**2 + 20)*Dx**2 + \ + (2*x**3 + 18*x)*Dx**3 + (x**2 + 10)*Dx**4, x, 0, [3, 4, 2, 3]) + assert p * q == r + p = HolonomicFunction(Dx**2 + x, x, 0, [1, 0]) + q = HolonomicFunction(Dx**3 - x**2, x, 0, [3, 3, 3]) + r = HolonomicFunction((x**8 - 37*x**7/27 - 10*x**6/27 - 164*x**5/9 - 184*x**4/9 + \ + 160*x**3/27 + 404*x**2/9 + 8*x + Rational(40, 3)) + (6*x**7 - 128*x**6/9 - 98*x**5/9 - 28*x**4/9 + \ + 8*x**3/9 + 28*x**2 + x*Rational(40, 9) - 40)*Dx + (3*x**6 - 82*x**5/9 + 76*x**4/9 + 4*x**3/3 + \ + 220*x**2/9 - x*Rational(80, 3))*Dx**2 + (-2*x**6 + 128*x**5/27 - 2*x**4/3 -80*x**2/9 + Rational(200, 9))*Dx**3 + \ + (3*x**5 - 64*x**4/9 - 28*x**3/9 + 6*x**2 - x*Rational(20, 9) - Rational(20, 3))*Dx**4 + (-4*x**3 + 64*x**2/9 + \ + x*Rational(8, 3))*Dx**5 + (x**4 - 64*x**3/27 - 4*x**2/3 + Rational(20, 9))*Dx**6, x, 0, [3, 3, 3, -3, -12, -24]) + assert p * q == r + p = HolonomicFunction(Dx - 1, x, 0, [2]) + q = HolonomicFunction(Dx**2 + 1, x, 0, [0, 1]) + r = HolonomicFunction(2 -2*Dx + Dx**2, x, 0, [0, 2]) + assert p * q == r + q = HolonomicFunction(x*Dx**2 + 1 + 2*Dx, x, 0,[0, 1]) + r = HolonomicFunction((x - 1) + (-2*x + 2)*Dx + x*Dx**2, x, 0, [0, 2]) + assert p * q == r + p = HolonomicFunction(Dx**2 - 1, x, 0, [1, 3]) + q = HolonomicFunction(Dx**3 + 1, x, 0, [1, 2, 1]) + r = HolonomicFunction(6*Dx + 3*Dx**2 + 2*Dx**3 - 3*Dx**4 + Dx**6, x, 0, [1, 5, 14, 17, 17, 2]) + assert p * q == r + p = expr_to_holonomic(sin(x)) + q = expr_to_holonomic(1/x, x0=1) + r = HolonomicFunction(x + 2*Dx + x*Dx**2, x, 1, [sin(1), -sin(1) + cos(1)]) + assert p * q == r + p = expr_to_holonomic(sqrt(x)) + q = expr_to_holonomic(sqrt(x**2-x)) + r = (p * q).to_expr() + assert r == I*x*sqrt(-x + 1) + + +def test_HolonomicFunction_composition(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx-1, x).composition(x**2+x) + r = HolonomicFunction((-2*x - 1) + Dx, x) + assert p == r + p = HolonomicFunction(Dx**2+1, x).composition(x**5+x**2+1) + r = HolonomicFunction((125*x**12 + 150*x**9 + 60*x**6 + 8*x**3) + (-20*x**3 - 2)*Dx + \ + (5*x**4 + 2*x)*Dx**2, x) + assert p == r + p = HolonomicFunction(Dx**2*x+x, x).composition(2*x**3+x**2+1) + r = HolonomicFunction((216*x**9 + 324*x**8 + 180*x**7 + 152*x**6 + 112*x**5 + \ + 36*x**4 + 4*x**3) + (24*x**4 + 16*x**3 + 3*x**2 - 6*x - 1)*Dx + (6*x**5 + 5*x**4 + \ + x**3 + 3*x**2 + x)*Dx**2, x) + assert p == r + p = HolonomicFunction(Dx**2+1, x).composition(1-x**2) + r = HolonomicFunction((4*x**3) - Dx + x*Dx**2, x) + assert p == r + p = HolonomicFunction(Dx**2+1, x).composition(x - 2/(x**2 + 1)) + r = HolonomicFunction((x**12 + 6*x**10 + 12*x**9 + 15*x**8 + 48*x**7 + 68*x**6 + \ + 72*x**5 + 111*x**4 + 112*x**3 + 54*x**2 + 12*x + 1) + (12*x**8 + 32*x**6 + \ + 24*x**4 - 4)*Dx + (x**12 + 6*x**10 + 4*x**9 + 15*x**8 + 16*x**7 + 20*x**6 + 24*x**5+ \ + 15*x**4 + 16*x**3 + 6*x**2 + 4*x + 1)*Dx**2, x) + assert p == r + + +def test_from_hyper(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + p = hyper([1, 1], [Rational(3, 2)], x**2/4) + q = HolonomicFunction((4*x) + (5*x**2 - 8)*Dx + (x**3 - 4*x)*Dx**2, x, 1, [2*sqrt(3)*pi/9, -4*sqrt(3)*pi/27 + Rational(4, 3)]) + r = from_hyper(p) + assert r == q + p = from_hyper(hyper([1], [Rational(3, 2)], x**2/4)) + q = HolonomicFunction(-x + (-x**2/2 + 2)*Dx + x*Dx**2, x) + # x0 = 1 + y0 = '[sqrt(pi)*exp(1/4)*erf(1/2), -sqrt(pi)*exp(1/4)*erf(1/2)/2 + 1]' + assert sstr(p.y0) == y0 + assert q.annihilator == p.annihilator + + +def test_from_meijerg(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + p = from_meijerg(meijerg(([], [Rational(3, 2)]), ([S.Half], [S.Half, 1]), x)) + q = HolonomicFunction(x/2 - Rational(1, 4) + (-x**2 + x/4)*Dx + x**2*Dx**2 + x**3*Dx**3, x, 1, \ + [1/sqrt(pi), 1/(2*sqrt(pi)), -1/(4*sqrt(pi))]) + assert p == q + p = from_meijerg(meijerg(([], []), ([0], []), x)) + q = HolonomicFunction(1 + Dx, x, 0, [1]) + assert p == q + p = from_meijerg(meijerg(([1], []), ([S.Half], [0]), x)) + q = HolonomicFunction((x + S.Half)*Dx + x*Dx**2, x, 1, [sqrt(pi)*erf(1), exp(-1)]) + assert p == q + p = from_meijerg(meijerg(([0], [1]), ([0], []), 2*x**2)) + q = HolonomicFunction((3*x**2 - 1)*Dx + x**3*Dx**2, x, 1, [-exp(Rational(-1, 2)) + 1, -exp(Rational(-1, 2))]) + assert p == q + + +def test_to_Sequence(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + n = symbols('n', integer=True) + _, Sn = RecurrenceOperators(ZZ.old_poly_ring(n), 'Sn') + p = HolonomicFunction(x**2*Dx**4 + x + Dx, x).to_sequence() + q = [(HolonomicSequence(1 + (n + 2)*Sn**2 + (n**4 + 6*n**3 + 11*n**2 + 6*n)*Sn**3), 0, 1)] + assert p == q + p = HolonomicFunction(x**2*Dx**4 + x**3 + Dx**2, x).to_sequence() + q = [(HolonomicSequence(1 + (n**4 + 14*n**3 + 72*n**2 + 163*n + 140)*Sn**5), 0, 0)] + assert p == q + p = HolonomicFunction(x**3*Dx**4 + 1 + Dx**2, x).to_sequence() + q = [(HolonomicSequence(1 + (n**4 - 2*n**3 - n**2 + 2*n)*Sn + (n**2 + 3*n + 2)*Sn**2), 0, 0)] + assert p == q + p = HolonomicFunction(3*x**3*Dx**4 + 2*x*Dx + x*Dx**3, x).to_sequence() + q = [(HolonomicSequence(2*n + (3*n**4 - 6*n**3 - 3*n**2 + 6*n)*Sn + (n**3 + 3*n**2 + 2*n)*Sn**2), 0, 1)] + assert p == q + + +def test_to_Sequence_Initial_Coniditons(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + n = symbols('n', integer=True) + _, Sn = RecurrenceOperators(QQ.old_poly_ring(n), 'Sn') + p = HolonomicFunction(Dx - 1, x, 0, [1]).to_sequence() + q = [(HolonomicSequence(-1 + (n + 1)*Sn, 1), 0)] + assert p == q + p = HolonomicFunction(Dx**2 + 1, x, 0, [0, 1]).to_sequence() + q = [(HolonomicSequence(1 + (n**2 + 3*n + 2)*Sn**2, [0, 1]), 0)] + assert p == q + p = HolonomicFunction(Dx**2 + 1 + x**3*Dx, x, 0, [2, 3]).to_sequence() + q = [(HolonomicSequence(n + Sn**2 + (n**2 + 7*n + 12)*Sn**4, [2, 3, -1, Rational(-1, 2), Rational(1, 12)]), 1)] + assert p == q + p = HolonomicFunction(x**3*Dx**5 + 1 + Dx, x).to_sequence() + q = [(HolonomicSequence(1 + (n + 1)*Sn + (n**5 - 5*n**3 + 4*n)*Sn**2), 0, 3)] + assert p == q + C_0, C_1, C_2, C_3 = symbols('C_0, C_1, C_2, C_3') + p = expr_to_holonomic(log(1+x**2)) + q = [(HolonomicSequence(n**2 + (n**2 + 2*n)*Sn**2, [0, 0, C_2]), 0, 1)] + assert p.to_sequence() == q + p = p.diff() + q = [(HolonomicSequence((n + 2) + (n + 2)*Sn**2, [C_0, 0]), 1, 0)] + assert p.to_sequence() == q + p = expr_to_holonomic(erf(x) + x).to_sequence() + q = [(HolonomicSequence((2*n**2 - 2*n) + (n**3 + 2*n**2 - n - 2)*Sn**2, [0, 1 + 2/sqrt(pi), 0, C_3]), 0, 2)] + assert p == q + +def test_series(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx**2 + 2*x*Dx, x, 0, [0, 1]).series(n=10) + q = x - x**3/3 + x**5/10 - x**7/42 + x**9/216 + O(x**10) + assert p == q + p = HolonomicFunction(Dx - 1, x).composition(x**2, 0, [1]) # e^(x**2) + q = HolonomicFunction(Dx**2 + 1, x, 0, [1, 0]) # cos(x) + r = (p * q).series(n=10) # expansion of cos(x) * exp(x**2) + s = 1 + x**2/2 + x**4/24 - 31*x**6/720 - 179*x**8/8064 + O(x**10) + assert r == s + t = HolonomicFunction((1 + x)*Dx**2 + Dx, x, 0, [0, 1]) # log(1 + x) + r = (p * t + q).series(n=10) + s = 1 + x - x**2 + 4*x**3/3 - 17*x**4/24 + 31*x**5/30 - 481*x**6/720 +\ + 71*x**7/105 - 20159*x**8/40320 + 379*x**9/840 + O(x**10) + assert r == s + p = HolonomicFunction((6+6*x-3*x**2) - (10*x-3*x**2-3*x**3)*Dx + \ + (4-6*x**3+2*x**4)*Dx**2, x, 0, [0, 1]).series(n=7) + q = x + x**3/6 - 3*x**4/16 + x**5/20 - 23*x**6/960 + O(x**7) + assert p == q + p = HolonomicFunction((6+6*x-3*x**2) - (10*x-3*x**2-3*x**3)*Dx + \ + (4-6*x**3+2*x**4)*Dx**2, x, 0, [1, 0]).series(n=7) + q = 1 - 3*x**2/4 - x**3/4 - 5*x**4/32 - 3*x**5/40 - 17*x**6/384 + O(x**7) + assert p == q + p = expr_to_holonomic(erf(x) + x).series(n=10) + C_3 = symbols('C_3') + q = (erf(x) + x).series(n=10) + assert p.subs(C_3, -2/(3*sqrt(pi))) == q + assert expr_to_holonomic(sqrt(x**3 + x)).series(n=10) == sqrt(x**3 + x).series(n=10) + assert expr_to_holonomic((2*x - 3*x**2)**Rational(1, 3)).series() == ((2*x - 3*x**2)**Rational(1, 3)).series() + assert expr_to_holonomic(sqrt(x**2-x)).series() == (sqrt(x**2-x)).series() + assert expr_to_holonomic(cos(x)**2/x**2, y0={-2: [1, 0, -1]}).series(n=10) == (cos(x)**2/x**2).series(n=10) + assert expr_to_holonomic(cos(x)**2/x**2, x0=1).series(n=10).together() == (cos(x)**2/x**2).series(n=10, x0=1).together() + assert expr_to_holonomic(cos(x-1)**2/(x-1)**2, x0=1, y0={-2: [1, 0, -1]}).series(n=10) \ + == (cos(x-1)**2/(x-1)**2).series(x0=1, n=10) + +def test_evalf_euler(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + + # log(1+x) + p = HolonomicFunction((1 + x)*Dx**2 + Dx, x, 0, [0, 1]) + + # path taken is a straight line from 0 to 1, on the real axis + r = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1] + s = '0.699525841805253' # approx. equal to log(2) i.e. 0.693147180559945 + assert sstr(p.evalf(r, method='Euler')[-1]) == s + + # path taken is a triangle 0-->1+i-->2 + r = [0.1 + 0.1*I] + for i in range(9): + r.append(r[-1]+0.1+0.1*I) + for i in range(10): + r.append(r[-1]+0.1-0.1*I) + + # close to the exact solution 1.09861228866811 + # imaginary part also close to zero + s = '1.07530466271334 - 0.0251200594793912*I' + assert sstr(p.evalf(r, method='Euler')[-1]) == s + + # sin(x) + p = HolonomicFunction(Dx**2 + 1, x, 0, [0, 1]) + s = '0.905546532085401 - 6.93889390390723e-18*I' + assert sstr(p.evalf(r, method='Euler')[-1]) == s + + # computing sin(pi/2) using this method + # using a linear path from 0 to pi/2 + r = [0.1] + for i in range(14): + r.append(r[-1] + 0.1) + r.append(pi/2) + s = '1.08016557252834' # close to 1.0 (exact solution) + assert sstr(p.evalf(r, method='Euler')[-1]) == s + + # trying different path, a rectangle (0-->i-->pi/2 + i-->pi/2) + # computing the same value sin(pi/2) using different path + r = [0.1*I] + for i in range(9): + r.append(r[-1]+0.1*I) + for i in range(15): + r.append(r[-1]+0.1) + r.append(pi/2+I) + for i in range(10): + r.append(r[-1]-0.1*I) + + # close to 1.0 + s = '0.976882381836257 - 1.65557671738537e-16*I' + assert sstr(p.evalf(r, method='Euler')[-1]) == s + + # cos(x) + p = HolonomicFunction(Dx**2 + 1, x, 0, [1, 0]) + # compute cos(pi) along 0-->pi + r = [0.05] + for i in range(61): + r.append(r[-1]+0.05) + r.append(pi) + # close to -1 (exact answer) + s = '-1.08140824719196' + assert sstr(p.evalf(r, method='Euler')[-1]) == s + + # a rectangular path (0 -> i -> 2+i -> 2) + r = [0.1*I] + for i in range(9): + r.append(r[-1]+0.1*I) + for i in range(20): + r.append(r[-1]+0.1) + for i in range(10): + r.append(r[-1]-0.1*I) + + p = HolonomicFunction(Dx**2 + 1, x, 0, [1,1]).evalf(r, method='Euler') + s = '0.501421652861245 - 3.88578058618805e-16*I' + assert sstr(p[-1]) == s + +def test_evalf_rk4(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + + # log(1+x) + p = HolonomicFunction((1 + x)*Dx**2 + Dx, x, 0, [0, 1]) + + # path taken is a straight line from 0 to 1, on the real axis + r = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1] + s = '0.693146363174626' # approx. equal to log(2) i.e. 0.693147180559945 + assert sstr(p.evalf(r)[-1]) == s + + # path taken is a triangle 0-->1+i-->2 + r = [0.1 + 0.1*I] + for i in range(9): + r.append(r[-1]+0.1+0.1*I) + for i in range(10): + r.append(r[-1]+0.1-0.1*I) + + # close to the exact solution 1.09861228866811 + # imaginary part also close to zero + s = '1.098616 + 1.36083e-7*I' + assert sstr(p.evalf(r)[-1].n(7)) == s + + # sin(x) + p = HolonomicFunction(Dx**2 + 1, x, 0, [0, 1]) + s = '0.90929463522785 + 1.52655665885959e-16*I' + assert sstr(p.evalf(r)[-1]) == s + + # computing sin(pi/2) using this method + # using a linear path from 0 to pi/2 + r = [0.1] + for i in range(14): + r.append(r[-1] + 0.1) + r.append(pi/2) + s = '0.999999895088917' # close to 1.0 (exact solution) + assert sstr(p.evalf(r)[-1]) == s + + # trying different path, a rectangle (0-->i-->pi/2 + i-->pi/2) + # computing the same value sin(pi/2) using different path + r = [0.1*I] + for i in range(9): + r.append(r[-1]+0.1*I) + for i in range(15): + r.append(r[-1]+0.1) + r.append(pi/2+I) + for i in range(10): + r.append(r[-1]-0.1*I) + + # close to 1.0 + s = '1.00000003415141 + 6.11940487991086e-16*I' + assert sstr(p.evalf(r)[-1]) == s + + # cos(x) + p = HolonomicFunction(Dx**2 + 1, x, 0, [1, 0]) + # compute cos(pi) along 0-->pi + r = [0.05] + for i in range(61): + r.append(r[-1]+0.05) + r.append(pi) + # close to -1 (exact answer) + s = '-0.999999993238714' + assert sstr(p.evalf(r)[-1]) == s + + # a rectangular path (0 -> i -> 2+i -> 2) + r = [0.1*I] + for i in range(9): + r.append(r[-1]+0.1*I) + for i in range(20): + r.append(r[-1]+0.1) + for i in range(10): + r.append(r[-1]-0.1*I) + + p = HolonomicFunction(Dx**2 + 1, x, 0, [1,1]).evalf(r) + s = '0.493152791638442 - 1.41553435639707e-15*I' + assert sstr(p[-1]) == s + + +def test_expr_to_holonomic(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + p = expr_to_holonomic((sin(x)/x)**2) + q = HolonomicFunction(8*x + (4*x**2 + 6)*Dx + 6*x*Dx**2 + x**2*Dx**3, x, 0, \ + [1, 0, Rational(-2, 3)]) + assert p == q + p = expr_to_holonomic(1/(1+x**2)**2) + q = HolonomicFunction(4*x + (x**2 + 1)*Dx, x, 0, [1]) + assert p == q + p = expr_to_holonomic(exp(x)*sin(x)+x*log(1+x)) + q = HolonomicFunction((2*x**3 + 10*x**2 + 20*x + 18) + (-2*x**4 - 10*x**3 - 20*x**2 \ + - 18*x)*Dx + (2*x**5 + 6*x**4 + 7*x**3 + 8*x**2 + 10*x - 4)*Dx**2 + \ + (-2*x**5 - 5*x**4 - 2*x**3 + 2*x**2 - x + 4)*Dx**3 + (x**5 + 2*x**4 - x**3 - \ + 7*x**2/2 + x + Rational(5, 2))*Dx**4, x, 0, [0, 1, 4, -1]) + assert p == q + p = expr_to_holonomic(x*exp(x)+cos(x)+1) + q = HolonomicFunction((-x - 3)*Dx + (x + 2)*Dx**2 + (-x - 3)*Dx**3 + (x + 2)*Dx**4, x, \ + 0, [2, 1, 1, 3]) + assert p == q + assert (x*exp(x)+cos(x)+1).series(n=10) == p.series(n=10) + p = expr_to_holonomic(log(1 + x)**2 + 1) + q = HolonomicFunction(Dx + (3*x + 3)*Dx**2 + (x**2 + 2*x + 1)*Dx**3, x, 0, [1, 0, 2]) + assert p == q + p = expr_to_holonomic(erf(x)**2 + x) + q = HolonomicFunction((8*x**4 - 2*x**2 + 2)*Dx**2 + (6*x**3 - x/2)*Dx**3 + \ + (x**2+ Rational(1, 4))*Dx**4, x, 0, [0, 1, 8/pi, 0]) + assert p == q + p = expr_to_holonomic(cosh(x)*x) + q = HolonomicFunction((-x**2 + 2) -2*x*Dx + x**2*Dx**2, x, 0, [0, 1]) + assert p == q + p = expr_to_holonomic(besselj(2, x)) + q = HolonomicFunction((x**2 - 4) + x*Dx + x**2*Dx**2, x, 0, [0, 0]) + assert p == q + p = expr_to_holonomic(besselj(0, x) + exp(x)) + q = HolonomicFunction((-x**2 - x/2 + S.Half) + (x**2 - x/2 - Rational(3, 2))*Dx + (-x**2 + x/2 + 1)*Dx**2 +\ + (x**2 + x/2)*Dx**3, x, 0, [2, 1, S.Half]) + assert p == q + p = expr_to_holonomic(sin(x)**2/x) + q = HolonomicFunction(4 + 4*x*Dx + 3*Dx**2 + x*Dx**3, x, 0, [0, 1, 0]) + assert p == q + p = expr_to_holonomic(sin(x)**2/x, x0=2) + q = HolonomicFunction((4) + (4*x)*Dx + (3)*Dx**2 + (x)*Dx**3, x, 2, [sin(2)**2/2, + sin(2)*cos(2) - sin(2)**2/4, -3*sin(2)**2/4 + cos(2)**2 - sin(2)*cos(2)]) + assert p == q + p = expr_to_holonomic(log(x)/2 - Ci(2*x)/2 + Ci(2)/2) + q = HolonomicFunction(4*Dx + 4*x*Dx**2 + 3*Dx**3 + x*Dx**4, x, 0, \ + [-log(2)/2 - EulerGamma/2 + Ci(2)/2, 0, 1, 0]) + assert p == q + p = p.to_expr() + q = log(x)/2 - Ci(2*x)/2 + Ci(2)/2 + assert p == q + p = expr_to_holonomic(x**S.Half, x0=1) + q = HolonomicFunction(x*Dx - S.Half, x, 1, [1]) + assert p == q + p = expr_to_holonomic(sqrt(1 + x**2)) + q = HolonomicFunction((-x) + (x**2 + 1)*Dx, x, 0, [1]) + assert p == q + assert (expr_to_holonomic(sqrt(x) + sqrt(2*x)).to_expr()-\ + (sqrt(x) + sqrt(2*x))).simplify() == 0 + assert expr_to_holonomic(3*x+2*sqrt(x)).to_expr() == 3*x+2*sqrt(x) + p = expr_to_holonomic((x**4+x**3+5*x**2+3*x+2)/x**2, lenics=3) + q = HolonomicFunction((-2*x**4 - x**3 + 3*x + 4) + (x**5 + x**4 + 5*x**3 + 3*x**2 + \ + 2*x)*Dx, x, 0, {-2: [2, 3, 5]}) + assert p == q + p = expr_to_holonomic(1/(x-1)**2, lenics=3, x0=1) + q = HolonomicFunction((2) + (x - 1)*Dx, x, 1, {-2: [1, 0, 0]}) + assert p == q + a = symbols("a") + p = expr_to_holonomic(sqrt(a*x), x=x) + assert p.to_expr() == sqrt(a)*sqrt(x) + +def test_to_hyper(): + x = symbols('x') + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx - 2, x, 0, [3]).to_hyper() + q = 3 * hyper([], [], 2*x) + assert p == q + p = hyperexpand(HolonomicFunction((1 + x) * Dx - 3, x, 0, [2]).to_hyper()).expand() + q = 2*x**3 + 6*x**2 + 6*x + 2 + assert p == q + p = HolonomicFunction((1 + x)*Dx**2 + Dx, x, 0, [0, 1]).to_hyper() + q = -x**2*hyper((2, 2, 1), (3, 2), -x)/2 + x + assert p == q + p = HolonomicFunction(2*x*Dx + Dx**2, x, 0, [0, 2/sqrt(pi)]).to_hyper() + q = 2*x*hyper((S.Half,), (Rational(3, 2),), -x**2)/sqrt(pi) + assert p == q + p = hyperexpand(HolonomicFunction(2*x*Dx + Dx**2, x, 0, [1, -2/sqrt(pi)]).to_hyper()) + q = erfc(x) + assert p.rewrite(erfc) == q + p = hyperexpand(HolonomicFunction((x**2 - 1) + x*Dx + x**2*Dx**2, + x, 0, [0, S.Half]).to_hyper()) + q = besselj(1, x) + assert p == q + p = hyperexpand(HolonomicFunction(x*Dx**2 + Dx + x, x, 0, [1, 0]).to_hyper()) + q = besselj(0, x) + assert p == q + +def test_to_expr(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(Dx - 1, x, 0, [1]).to_expr() + q = exp(x) + assert p == q + p = HolonomicFunction(Dx**2 + 1, x, 0, [1, 0]).to_expr() + q = cos(x) + assert p == q + p = HolonomicFunction(Dx**2 - 1, x, 0, [1, 0]).to_expr() + q = cosh(x) + assert p == q + p = HolonomicFunction(2 + (4*x - 1)*Dx + \ + (x**2 - x)*Dx**2, x, 0, [1, 2]).to_expr().expand() + q = 1/(x**2 - 2*x + 1) + assert p == q + p = expr_to_holonomic(sin(x)**2/x).integrate((x, 0, x)).to_expr() + q = (sin(x)**2/x).integrate((x, 0, x)) + assert p == q + C_0, C_1, C_2, C_3 = symbols('C_0, C_1, C_2, C_3') + p = expr_to_holonomic(log(1+x**2)).to_expr() + q = C_2*log(x**2 + 1) + assert p == q + p = expr_to_holonomic(log(1+x**2)).diff().to_expr() + q = C_0*x/(x**2 + 1) + assert p == q + p = expr_to_holonomic(erf(x) + x).to_expr() + q = 3*C_3*x - 3*sqrt(pi)*C_3*erf(x)/2 + x + 2*x/sqrt(pi) + assert p == q + p = expr_to_holonomic(sqrt(x), x0=1).to_expr() + assert p == sqrt(x) + assert expr_to_holonomic(sqrt(x)).to_expr() == sqrt(x) + p = expr_to_holonomic(sqrt(1 + x**2)).to_expr() + assert p == sqrt(1+x**2) + p = expr_to_holonomic((2*x**2 + 1)**Rational(2, 3)).to_expr() + assert p == (2*x**2 + 1)**Rational(2, 3) + p = expr_to_holonomic(sqrt(-x**2+2*x)).to_expr() + assert p == sqrt(x)*sqrt(-x + 2) + p = expr_to_holonomic((-2*x**3+7*x)**Rational(2, 3)).to_expr() + q = x**Rational(2, 3)*(-2*x**2 + 7)**Rational(2, 3) + assert p == q + p = from_hyper(hyper((-2, -3), (S.Half, ), x)) + s = hyperexpand(hyper((-2, -3), (S.Half, ), x)) + D_0 = Symbol('D_0') + C_0 = Symbol('C_0') + assert (p.to_expr().subs({C_0:1, D_0:0}) - s).simplify() == 0 + p.y0 = {0: [1], S.Half: [0]} + assert p.to_expr() == s + assert expr_to_holonomic(x**5).to_expr() == x**5 + assert expr_to_holonomic(2*x**3-3*x**2).to_expr().expand() == \ + 2*x**3-3*x**2 + a = symbols("a") + p = (expr_to_holonomic(1.4*x)*expr_to_holonomic(a*x, x)).to_expr() + q = 1.4*a*x**2 + assert p == q + p = (expr_to_holonomic(1.4*x)+expr_to_holonomic(a*x, x)).to_expr() + q = x*(a + 1.4) + assert p == q + p = (expr_to_holonomic(1.4*x)+expr_to_holonomic(x)).to_expr() + assert p == 2.4*x + + +def test_integrate(): + x = symbols('x') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = expr_to_holonomic(sin(x)**2/x, x0=1).integrate((x, 2, 3)) + q = '0.166270406994788' + assert sstr(p) == q + p = expr_to_holonomic(sin(x)).integrate((x, 0, x)).to_expr() + q = 1 - cos(x) + assert p == q + p = expr_to_holonomic(sin(x)).integrate((x, 0, 3)) + q = 1 - cos(3) + assert p == q + p = expr_to_holonomic(sin(x)/x, x0=1).integrate((x, 1, 2)) + q = '0.659329913368450' + assert sstr(p) == q + p = expr_to_holonomic(sin(x)**2/x, x0=1).integrate((x, 1, 0)) + q = '-0.423690480850035' + assert sstr(p) == q + p = expr_to_holonomic(sin(x)/x) + assert p.integrate(x).to_expr() == Si(x) + assert p.integrate((x, 0, 2)) == Si(2) + p = expr_to_holonomic(sin(x)**2/x) + q = p.to_expr() + assert p.integrate(x).to_expr() == q.integrate((x, 0, x)) + assert p.integrate((x, 0, 1)) == q.integrate((x, 0, 1)) + assert expr_to_holonomic(1/x, x0=1).integrate(x).to_expr() == log(x) + p = expr_to_holonomic((x + 1)**3*exp(-x), x0=-1).integrate(x).to_expr() + q = (-x**3 - 6*x**2 - 15*x + 6*exp(x + 1) - 16)*exp(-x) + assert p == q + p = expr_to_holonomic(cos(x)**2/x**2, y0={-2: [1, 0, -1]}).integrate(x).to_expr() + q = -Si(2*x) - cos(x)**2/x + assert p == q + p = expr_to_holonomic(sqrt(x**2+x)).integrate(x).to_expr() + q = (x**Rational(3, 2)*(2*x**2 + 3*x + 1) - x*sqrt(x + 1)*asinh(sqrt(x)))/(4*x*sqrt(x + 1)) + assert p == q + p = expr_to_holonomic(sqrt(x**2+1)).integrate(x).to_expr() + q = (sqrt(x**2+1)).integrate(x) + assert (p-q).simplify() == 0 + p = expr_to_holonomic(1/x**2, y0={-2:[1, 0, 0]}) + r = expr_to_holonomic(1/x**2, lenics=3) + assert p == r + q = expr_to_holonomic(cos(x)**2) + assert (r*q).integrate(x).to_expr() == -Si(2*x) - cos(x)**2/x + + +def test_diff(): + x, y = symbols('x, y') + R, Dx = DifferentialOperators(ZZ.old_poly_ring(x), 'Dx') + p = HolonomicFunction(x*Dx**2 + 1, x, 0, [0, 1]) + assert p.diff().to_expr() == p.to_expr().diff().simplify() + p = HolonomicFunction(Dx**2 - 1, x, 0, [1, 0]) + assert p.diff(x, 2).to_expr() == p.to_expr() + p = expr_to_holonomic(Si(x)) + assert p.diff().to_expr() == sin(x)/x + assert p.diff(y) == 0 + C_0, C_1, C_2, C_3 = symbols('C_0, C_1, C_2, C_3') + q = Si(x) + assert p.diff(x).to_expr() == q.diff() + assert p.diff(x, 2).to_expr().subs(C_0, Rational(-1, 3)).cancel() == q.diff(x, 2).cancel() + assert p.diff(x, 3).series().subs({C_3: Rational(-1, 3), C_0: 0}) == q.diff(x, 3).series() + + +def test_extended_domain_in_expr_to_holonomic(): + x = symbols('x') + p = expr_to_holonomic(1.2*cos(3.1*x)) + assert p.to_expr() == 1.2*cos(3.1*x) + assert sstr(p.integrate(x).to_expr()) == '0.387096774193548*sin(3.1*x)' + _, Dx = DifferentialOperators(RR.old_poly_ring(x), 'Dx') + p = expr_to_holonomic(1.1329138213*x) + q = HolonomicFunction((-1.1329138213) + (1.1329138213*x)*Dx, x, 0, {1: [1.1329138213]}) + assert p == q + assert p.to_expr() == 1.1329138213*x + assert sstr(p.integrate((x, 1, 2))) == sstr((1.1329138213*x).integrate((x, 1, 2))) + y, z = symbols('y, z') + p = expr_to_holonomic(sin(x*y*z), x=x) + assert p.to_expr() == sin(x*y*z) + assert p.integrate(x).to_expr() == (-cos(x*y*z) + 1)/(y*z) + p = expr_to_holonomic(sin(x*y + z), x=x).integrate(x).to_expr() + q = (cos(z) - cos(x*y + z))/y + assert p == q + a = symbols('a') + p = expr_to_holonomic(a*x, x) + assert p.to_expr() == a*x + assert p.integrate(x).to_expr() == a*x**2/2 + D_2, C_1 = symbols("D_2, C_1") + p = expr_to_holonomic(x) + expr_to_holonomic(1.2*cos(x)) + p = p.to_expr().subs(D_2, 0) + assert p - x - 1.2*cos(1.0*x) == 0 + p = expr_to_holonomic(x) * expr_to_holonomic(1.2*cos(x)) + p = p.to_expr().subs(C_1, 0) + assert p - 1.2*x*cos(1.0*x) == 0 + + +def test_to_meijerg(): + x = symbols('x') + assert hyperexpand(expr_to_holonomic(sin(x)).to_meijerg()) == sin(x) + assert hyperexpand(expr_to_holonomic(cos(x)).to_meijerg()) == cos(x) + assert hyperexpand(expr_to_holonomic(exp(x)).to_meijerg()) == exp(x) + assert hyperexpand(expr_to_holonomic(log(x)).to_meijerg()).simplify() == log(x) + assert expr_to_holonomic(4*x**2/3 + 7).to_meijerg() == 4*x**2/3 + 7 + assert hyperexpand(expr_to_holonomic(besselj(2, x), lenics=3).to_meijerg()) == besselj(2, x) + p = hyper((Rational(-1, 2), -3), (), x) + assert from_hyper(p).to_meijerg() == hyperexpand(p) + p = hyper((S.One, S(3)), (S(2), ), x) + assert (hyperexpand(from_hyper(p).to_meijerg()) - hyperexpand(p)).expand() == 0 + p = from_hyper(hyper((-2, -3), (S.Half, ), x)) + s = hyperexpand(hyper((-2, -3), (S.Half, ), x)) + C_0 = Symbol('C_0') + C_1 = Symbol('C_1') + D_0 = Symbol('D_0') + assert (hyperexpand(p.to_meijerg()).subs({C_0:1, D_0:0}) - s).simplify() == 0 + p.y0 = {0: [1], S.Half: [0]} + assert (hyperexpand(p.to_meijerg()) - s).simplify() == 0 + p = expr_to_holonomic(besselj(S.Half, x), initcond=False) + assert (p.to_expr() - (D_0*sin(x) + C_0*cos(x) + C_1*sin(x))/sqrt(x)).simplify() == 0 + p = expr_to_holonomic(besselj(S.Half, x), y0={Rational(-1, 2): [sqrt(2)/sqrt(pi), sqrt(2)/sqrt(pi)]}) + assert (p.to_expr() - besselj(S.Half, x) - besselj(Rational(-1, 2), x)).simplify() == 0 + + +def test_gaussian(): + mu, x = symbols("mu x") + sd = symbols("sd", positive=True) + Q = QQ[mu, sd].get_field() + e = sqrt(2)*exp(-(-mu + x)**2/(2*sd**2))/(2*sqrt(pi)*sd) + h1 = expr_to_holonomic(e, x, domain=Q) + + _, Dx = DifferentialOperators(Q.old_poly_ring(x), 'Dx') + h2 = HolonomicFunction((-mu/sd**2 + x/sd**2) + (1)*Dx, x) + + assert h1 == h2 + + +def test_beta(): + a, b, x = symbols("a b x", positive=True) + e = x**(a - 1)*(-x + 1)**(b - 1)/beta(a, b) + Q = QQ[a, b].get_field() + h1 = expr_to_holonomic(e, x, domain=Q) + + _, Dx = DifferentialOperators(Q.old_poly_ring(x), 'Dx') + h2 = HolonomicFunction((a + x*(-a - b + 2) - 1) + (x**2 - x)*Dx, x) + + assert h1 == h2 + + +def test_gamma(): + a, b, x = symbols("a b x", positive=True) + e = b**(-a)*x**(a - 1)*exp(-x/b)/gamma(a) + Q = QQ[a, b].get_field() + h1 = expr_to_holonomic(e, x, domain=Q) + + _, Dx = DifferentialOperators(Q.old_poly_ring(x), 'Dx') + h2 = HolonomicFunction((-a + 1 + x/b) + (x)*Dx, x) + + assert h1 == h2 + + +def test_symbolic_power(): + x, n = symbols("x n") + Q = QQ[n].get_field() + _, Dx = DifferentialOperators(Q.old_poly_ring(x), 'Dx') + h1 = HolonomicFunction((-1) + (x)*Dx, x) ** -n + h2 = HolonomicFunction((n) + (x)*Dx, x) + + assert h1 == h2 + + +def test_negative_power(): + x = symbols("x") + _, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + h1 = HolonomicFunction((-1) + (x)*Dx, x) ** -2 + h2 = HolonomicFunction((2) + (x)*Dx, x) + + assert h1 == h2 + + +def test_expr_in_power(): + x, n = symbols("x n") + Q = QQ[n].get_field() + _, Dx = DifferentialOperators(Q.old_poly_ring(x), 'Dx') + h1 = HolonomicFunction((-1) + (x)*Dx, x) ** (n - 3) + h2 = HolonomicFunction((-n + 3) + (x)*Dx, x) + + assert h1 == h2 + +def test_DifferentialOperatorEqPoly(): + x = symbols('x', integer=True) + R, Dx = DifferentialOperators(QQ.old_poly_ring(x), 'Dx') + do = DifferentialOperator([x**2, R.base.zero, R.base.zero], R) + do2 = DifferentialOperator([x**2, 1, x], R) + assert not do == do2 + + # polynomial comparison issue, see https://github.com/sympy/sympy/pull/15799 + # should work once that is solved + # p = do.listofpoly[0] + # assert do == p + + p2 = do2.listofpoly[0] + assert not do2 == p2 diff --git a/shared/package-files/32/32b424d64f62b7e71cb24d29fd53938ad5664d608055a67ab2b2af4369f8b89e/blob b/shared/package-files/32/32b424d64f62b7e71cb24d29fd53938ad5664d608055a67ab2b2af4369f8b89e/blob new file mode 100644 index 0000000000000000000000000000000000000000..347db4c0697c37bb9776fc1e916848829ad851ea Binary files /dev/null and b/shared/package-files/32/32b424d64f62b7e71cb24d29fd53938ad5664d608055a67ab2b2af4369f8b89e/blob differ diff --git a/shared/package-files/32/32b5cd24c6aafcdd73a2835e99f3bdf8c4f53d04de0011b3cb04f786ae60b994/blob b/shared/package-files/32/32b5cd24c6aafcdd73a2835e99f3bdf8c4f53d04de0011b3cb04f786ae60b994/blob new file mode 100644 index 0000000000000000000000000000000000000000..01d5331a63069b14241c6edad5682bc14f77ca48 --- /dev/null +++ b/shared/package-files/32/32b5cd24c6aafcdd73a2835e99f3bdf8c4f53d04de0011b3cb04f786ae60b994/blob @@ -0,0 +1,679 @@ +"""distutils.command.install + +Implements the Distutils 'install' command.""" + +import sys +import sysconfig +import os +import re + +from distutils import log +from distutils.core import Command +from distutils.debug import DEBUG +from distutils.sysconfig import get_config_vars +from distutils.errors import DistutilsPlatformError +from distutils.file_util import write_file +from distutils.util import convert_path, subst_vars, change_root +from distutils.util import get_platform +from distutils.errors import DistutilsOptionError + +from site import USER_BASE +from site import USER_SITE + +HAS_USER_SITE = (USER_SITE is not None) + +# The keys to an installation scheme; if any new types of files are to be +# installed, be sure to add an entry to every scheme in +# sysconfig._INSTALL_SCHEMES, and to SCHEME_KEYS here. +SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data') + +# The following code provides backward-compatible INSTALL_SCHEMES +# while making the sysconfig module the single point of truth. +# This makes it easier for OS distributions where they need to +# alter locations for packages installations in a single place. +# Note that this module is deprecated (PEP 632); all consumers +# of this information should switch to using sysconfig directly. +INSTALL_SCHEMES = {"unix_prefix": {}, "unix_home": {}, "nt": {}} + +# Copy from sysconfig._INSTALL_SCHEMES +for key in SCHEME_KEYS: + for distutils_scheme_name, sys_scheme_name in ( + ("unix_prefix", "posix_prefix"), ("unix_home", "posix_home"), + ("nt", "nt")): + sys_key = key + sys_scheme = sysconfig._INSTALL_SCHEMES[sys_scheme_name] + if key == "headers" and key not in sys_scheme: + # On POSIX-y platforms, Python will: + # - Build from .h files in 'headers' (only there when + # building CPython) + # - Install .h files to 'include' + # When 'headers' is missing, fall back to 'include' + sys_key = 'include' + INSTALL_SCHEMES[distutils_scheme_name][key] = sys_scheme[sys_key] + +# Transformation to different template format +for main_key in INSTALL_SCHEMES: + for key, value in INSTALL_SCHEMES[main_key].items(): + # Change all ocurences of {variable} to $variable + value = re.sub(r"\{(.+?)\}", r"$\g<1>", value) + value = value.replace("$installed_base", "$base") + value = value.replace("$py_version_nodot_plat", "$py_version_nodot") + if key == "headers": + value += "/$dist_name" + if sys.version_info >= (3, 9) and key == "platlib": + # platlibdir is available since 3.9: bpo-1294959 + value = value.replace("/lib/", "/$platlibdir/") + INSTALL_SCHEMES[main_key][key] = value + +# The following part of INSTALL_SCHEMES has a different definition +# than the one in sysconfig, but because both depend on the site module, +# the outcomes should be the same. +if HAS_USER_SITE: + INSTALL_SCHEMES['nt_user'] = { + 'purelib': '$usersite', + 'platlib': '$usersite', + 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name', + 'scripts': '$userbase/Python$py_version_nodot/Scripts', + 'data' : '$userbase', + } + + INSTALL_SCHEMES['unix_user'] = { + 'purelib': '$usersite', + 'platlib': '$usersite', + 'headers': + '$userbase/include/python$py_version_short$abiflags/$dist_name', + 'scripts': '$userbase/bin', + 'data' : '$userbase', + } + + +class install(Command): + + description = "install everything from build directory" + + user_options = [ + # Select installation scheme and set base director(y|ies) + ('prefix=', None, + "installation prefix"), + ('exec-prefix=', None, + "(Unix only) prefix for platform-specific files"), + ('home=', None, + "(Unix only) home directory to install under"), + + # Or, just set the base director(y|ies) + ('install-base=', None, + "base installation directory (instead of --prefix or --home)"), + ('install-platbase=', None, + "base installation directory for platform-specific files " + + "(instead of --exec-prefix or --home)"), + ('root=', None, + "install everything relative to this alternate root directory"), + + # Or, explicitly set the installation scheme + ('install-purelib=', None, + "installation directory for pure Python module distributions"), + ('install-platlib=', None, + "installation directory for non-pure module distributions"), + ('install-lib=', None, + "installation directory for all module distributions " + + "(overrides --install-purelib and --install-platlib)"), + + ('install-headers=', None, + "installation directory for C/C++ headers"), + ('install-scripts=', None, + "installation directory for Python scripts"), + ('install-data=', None, + "installation directory for data files"), + + # Byte-compilation options -- see install_lib.py for details, as + # these are duplicated from there (but only install_lib does + # anything with them). + ('compile', 'c', "compile .py to .pyc [default]"), + ('no-compile', None, "don't compile .py files"), + ('optimize=', 'O', + "also compile with optimization: -O1 for \"python -O\", " + "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"), + + # Miscellaneous control options + ('force', 'f', + "force installation (overwrite any existing files)"), + ('skip-build', None, + "skip rebuilding everything (for testing/debugging)"), + + # Where to install documentation (eventually!) + #('doc-format=', None, "format of documentation to generate"), + #('install-man=', None, "directory for Unix man pages"), + #('install-html=', None, "directory for HTML documentation"), + #('install-info=', None, "directory for GNU info files"), + + ('record=', None, + "filename in which to record list of installed files"), + ] + + boolean_options = ['compile', 'force', 'skip-build'] + + if HAS_USER_SITE: + user_options.append(('user', None, + "install in user site-package '%s'" % USER_SITE)) + boolean_options.append('user') + + negative_opt = {'no-compile' : 'compile'} + + + def initialize_options(self): + """Initializes options.""" + # High-level options: these select both an installation base + # and scheme. + self.prefix = None + self.exec_prefix = None + self.home = None + self.user = 0 + + # These select only the installation base; it's up to the user to + # specify the installation scheme (currently, that means supplying + # the --install-{platlib,purelib,scripts,data} options). + self.install_base = None + self.install_platbase = None + self.root = None + + # These options are the actual installation directories; if not + # supplied by the user, they are filled in using the installation + # scheme implied by prefix/exec-prefix/home and the contents of + # that installation scheme. + self.install_purelib = None # for pure module distributions + self.install_platlib = None # non-pure (dists w/ extensions) + self.install_headers = None # for C/C++ headers + self.install_lib = None # set to either purelib or platlib + self.install_scripts = None + self.install_data = None + if HAS_USER_SITE: + self.install_userbase = USER_BASE + self.install_usersite = USER_SITE + + self.compile = None + self.optimize = None + + # Deprecated + # These two are for putting non-packagized distributions into their + # own directory and creating a .pth file if it makes sense. + # 'extra_path' comes from the setup file; 'install_path_file' can + # be turned off if it makes no sense to install a .pth file. (But + # better to install it uselessly than to guess wrong and not + # install it when it's necessary and would be used!) Currently, + # 'install_path_file' is always true unless some outsider meddles + # with it. + self.extra_path = None + self.install_path_file = 1 + + # 'force' forces installation, even if target files are not + # out-of-date. 'skip_build' skips running the "build" command, + # handy if you know it's not necessary. 'warn_dir' (which is *not* + # a user option, it's just there so the bdist_* commands can turn + # it off) determines whether we warn about installing to a + # directory not in sys.path. + self.force = 0 + self.skip_build = 0 + self.warn_dir = 1 + + # These are only here as a conduit from the 'build' command to the + # 'install_*' commands that do the real work. ('build_base' isn't + # actually used anywhere, but it might be useful in future.) They + # are not user options, because if the user told the install + # command where the build directory is, that wouldn't affect the + # build command. + self.build_base = None + self.build_lib = None + + # Not defined yet because we don't know anything about + # documentation yet. + #self.install_man = None + #self.install_html = None + #self.install_info = None + + self.record = None + + + # -- Option finalizing methods ------------------------------------- + # (This is rather more involved than for most commands, + # because this is where the policy for installing third- + # party Python modules on various platforms given a wide + # array of user input is decided. Yes, it's quite complex!) + + def finalize_options(self): + """Finalizes options.""" + # This method (and its helpers, like 'finalize_unix()', + # 'finalize_other()', and 'select_scheme()') is where the default + # installation directories for modules, extension modules, and + # anything else we care to install from a Python module + # distribution. Thus, this code makes a pretty important policy + # statement about how third-party stuff is added to a Python + # installation! Note that the actual work of installation is done + # by the relatively simple 'install_*' commands; they just take + # their orders from the installation directory options determined + # here. + + # Check for errors/inconsistencies in the options; first, stuff + # that's wrong on any platform. + + if ((self.prefix or self.exec_prefix or self.home) and + (self.install_base or self.install_platbase)): + raise DistutilsOptionError( + "must supply either prefix/exec-prefix/home or " + + "install-base/install-platbase -- not both") + + if self.home and (self.prefix or self.exec_prefix): + raise DistutilsOptionError( + "must supply either home or prefix/exec-prefix -- not both") + + if self.user and (self.prefix or self.exec_prefix or self.home or + self.install_base or self.install_platbase): + raise DistutilsOptionError("can't combine user with prefix, " + "exec_prefix/home, or install_(plat)base") + + # Next, stuff that's wrong (or dubious) only on certain platforms. + if os.name != "posix": + if self.exec_prefix: + self.warn("exec-prefix option ignored on this platform") + self.exec_prefix = None + + # Now the interesting logic -- so interesting that we farm it out + # to other methods. The goal of these methods is to set the final + # values for the install_{lib,scripts,data,...} options, using as + # input a heady brew of prefix, exec_prefix, home, install_base, + # install_platbase, user-supplied versions of + # install_{purelib,platlib,lib,scripts,data,...}, and the + # INSTALL_SCHEME dictionary above. Phew! + + self.dump_dirs("pre-finalize_{unix,other}") + + if os.name == 'posix': + self.finalize_unix() + else: + self.finalize_other() + + self.dump_dirs("post-finalize_{unix,other}()") + + # Expand configuration variables, tilde, etc. in self.install_base + # and self.install_platbase -- that way, we can use $base or + # $platbase in the other installation directories and not worry + # about needing recursive variable expansion (shudder). + + py_version = sys.version.split()[0] + (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix') + try: + abiflags = sys.abiflags + except AttributeError: + # sys.abiflags may not be defined on all platforms. + abiflags = '' + self.config_vars = {'dist_name': self.distribution.get_name(), + 'dist_version': self.distribution.get_version(), + 'dist_fullname': self.distribution.get_fullname(), + 'py_version': py_version, + 'py_version_short': '%d.%d' % sys.version_info[:2], + 'py_version_nodot': '%d%d' % sys.version_info[:2], + 'sys_prefix': prefix, + 'prefix': prefix, + 'sys_exec_prefix': exec_prefix, + 'exec_prefix': exec_prefix, + 'abiflags': abiflags, + 'platlibdir': sys.platlibdir, + } + + if HAS_USER_SITE: + self.config_vars['userbase'] = self.install_userbase + self.config_vars['usersite'] = self.install_usersite + + if sysconfig.is_python_build(True): + self.config_vars['srcdir'] = sysconfig.get_config_var('srcdir') + + self.expand_basedirs() + + self.dump_dirs("post-expand_basedirs()") + + # Now define config vars for the base directories so we can expand + # everything else. + self.config_vars['base'] = self.install_base + self.config_vars['platbase'] = self.install_platbase + + if DEBUG: + from pprint import pprint + print("config vars:") + pprint(self.config_vars) + + # Expand "~" and configuration variables in the installation + # directories. + self.expand_dirs() + + self.dump_dirs("post-expand_dirs()") + + # Create directories in the home dir: + if self.user: + self.create_home_path() + + # Pick the actual directory to install all modules to: either + # install_purelib or install_platlib, depending on whether this + # module distribution is pure or not. Of course, if the user + # already specified install_lib, use their selection. + if self.install_lib is None: + if self.distribution.ext_modules: # has extensions: non-pure + self.install_lib = self.install_platlib + else: + self.install_lib = self.install_purelib + + + # Convert directories from Unix /-separated syntax to the local + # convention. + self.convert_paths('lib', 'purelib', 'platlib', + 'scripts', 'data', 'headers') + if HAS_USER_SITE: + self.convert_paths('userbase', 'usersite') + + # Deprecated + # Well, we're not actually fully completely finalized yet: we still + # have to deal with 'extra_path', which is the hack for allowing + # non-packagized module distributions (hello, Numerical Python!) to + # get their own directories. + self.handle_extra_path() + self.install_libbase = self.install_lib # needed for .pth file + self.install_lib = os.path.join(self.install_lib, self.extra_dirs) + + # If a new root directory was supplied, make all the installation + # dirs relative to it. + if self.root is not None: + self.change_roots('libbase', 'lib', 'purelib', 'platlib', + 'scripts', 'data', 'headers') + + self.dump_dirs("after prepending root") + + # Find out the build directories, ie. where to install from. + self.set_undefined_options('build', + ('build_base', 'build_base'), + ('build_lib', 'build_lib')) + + # Punt on doc directories for now -- after all, we're punting on + # documentation completely! + + def dump_dirs(self, msg): + """Dumps the list of user options.""" + if not DEBUG: + return + from distutils.fancy_getopt import longopt_xlate + log.debug(msg + ":") + for opt in self.user_options: + opt_name = opt[0] + if opt_name[-1] == "=": + opt_name = opt_name[0:-1] + if opt_name in self.negative_opt: + opt_name = self.negative_opt[opt_name] + opt_name = opt_name.translate(longopt_xlate) + val = not getattr(self, opt_name) + else: + opt_name = opt_name.translate(longopt_xlate) + val = getattr(self, opt_name) + log.debug(" %s: %s", opt_name, val) + + def finalize_unix(self): + """Finalizes options for posix platforms.""" + if self.install_base is not None or self.install_platbase is not None: + if ((self.install_lib is None and + self.install_purelib is None and + self.install_platlib is None) or + self.install_headers is None or + self.install_scripts is None or + self.install_data is None): + raise DistutilsOptionError( + "install-base or install-platbase supplied, but " + "installation scheme is incomplete") + return + + if self.user: + if self.install_userbase is None: + raise DistutilsPlatformError( + "User base directory is not specified") + self.install_base = self.install_platbase = self.install_userbase + self.select_scheme("unix_user") + elif self.home is not None: + self.install_base = self.install_platbase = self.home + self.select_scheme("unix_home") + else: + if self.prefix is None: + if self.exec_prefix is not None: + raise DistutilsOptionError( + "must not supply exec-prefix without prefix") + + self.prefix = os.path.normpath(sys.prefix) + self.exec_prefix = os.path.normpath(sys.exec_prefix) + + else: + if self.exec_prefix is None: + self.exec_prefix = self.prefix + + self.install_base = self.prefix + self.install_platbase = self.exec_prefix + self.select_scheme("unix_prefix") + + def finalize_other(self): + """Finalizes options for non-posix platforms""" + if self.user: + if self.install_userbase is None: + raise DistutilsPlatformError( + "User base directory is not specified") + self.install_base = self.install_platbase = self.install_userbase + self.select_scheme(os.name + "_user") + elif self.home is not None: + self.install_base = self.install_platbase = self.home + self.select_scheme("unix_home") + else: + if self.prefix is None: + self.prefix = os.path.normpath(sys.prefix) + + self.install_base = self.install_platbase = self.prefix + try: + self.select_scheme(os.name) + except KeyError: + raise DistutilsPlatformError( + "I don't know how to install stuff on '%s'" % os.name) + + def select_scheme(self, name): + """Sets the install directories by applying the install schemes.""" + # it's the caller's problem if they supply a bad name! + scheme = INSTALL_SCHEMES[name] + for key in SCHEME_KEYS: + attrname = 'install_' + key + if getattr(self, attrname) is None: + setattr(self, attrname, scheme[key]) + + def _expand_attrs(self, attrs): + for attr in attrs: + val = getattr(self, attr) + if val is not None: + if os.name == 'posix' or os.name == 'nt': + val = os.path.expanduser(val) + val = subst_vars(val, self.config_vars) + setattr(self, attr, val) + + def expand_basedirs(self): + """Calls `os.path.expanduser` on install_base, install_platbase and + root.""" + self._expand_attrs(['install_base', 'install_platbase', 'root']) + + def expand_dirs(self): + """Calls `os.path.expanduser` on install dirs.""" + self._expand_attrs(['install_purelib', 'install_platlib', + 'install_lib', 'install_headers', + 'install_scripts', 'install_data',]) + + def convert_paths(self, *names): + """Call `convert_path` over `names`.""" + for name in names: + attr = "install_" + name + setattr(self, attr, convert_path(getattr(self, attr))) + + def handle_extra_path(self): + """Set `path_file` and `extra_dirs` using `extra_path`.""" + if self.extra_path is None: + self.extra_path = self.distribution.extra_path + + if self.extra_path is not None: + log.warn( + "Distribution option extra_path is deprecated. " + "See issue27919 for details." + ) + if isinstance(self.extra_path, str): + self.extra_path = self.extra_path.split(',') + + if len(self.extra_path) == 1: + path_file = extra_dirs = self.extra_path[0] + elif len(self.extra_path) == 2: + path_file, extra_dirs = self.extra_path + else: + raise DistutilsOptionError( + "'extra_path' option must be a list, tuple, or " + "comma-separated string with 1 or 2 elements") + + # convert to local form in case Unix notation used (as it + # should be in setup scripts) + extra_dirs = convert_path(extra_dirs) + else: + path_file = None + extra_dirs = '' + + # XXX should we warn if path_file and not extra_dirs? (in which + # case the path file would be harmless but pointless) + self.path_file = path_file + self.extra_dirs = extra_dirs + + def change_roots(self, *names): + """Change the install directories pointed by name using root.""" + for name in names: + attr = "install_" + name + setattr(self, attr, change_root(self.root, getattr(self, attr))) + + def create_home_path(self): + """Create directories under ~.""" + if not self.user: + return + home = convert_path(os.path.expanduser("~")) + for name, path in self.config_vars.items(): + if path.startswith(home) and not os.path.isdir(path): + self.debug_print("os.makedirs('%s', 0o700)" % path) + os.makedirs(path, 0o700) + + # -- Command execution methods ------------------------------------- + + def run(self): + """Runs the command.""" + # Obviously have to build before we can install + if not self.skip_build: + self.run_command('build') + # If we built for any other platform, we can't install. + build_plat = self.distribution.get_command_obj('build').plat_name + # check warn_dir - it is a clue that the 'install' is happening + # internally, and not to sys.path, so we don't check the platform + # matches what we are running. + if self.warn_dir and build_plat != get_platform(): + raise DistutilsPlatformError("Can't install when " + "cross-compiling") + + # Run all sub-commands (at least those that need to be run) + for cmd_name in self.get_sub_commands(): + self.run_command(cmd_name) + + if self.path_file: + self.create_path_file() + + # write list of installed files, if requested. + if self.record: + outputs = self.get_outputs() + if self.root: # strip any package prefix + root_len = len(self.root) + for counter in range(len(outputs)): + outputs[counter] = outputs[counter][root_len:] + self.execute(write_file, + (self.record, outputs), + "writing list of installed files to '%s'" % + self.record) + + sys_path = map(os.path.normpath, sys.path) + sys_path = map(os.path.normcase, sys_path) + install_lib = os.path.normcase(os.path.normpath(self.install_lib)) + if (self.warn_dir and + not (self.path_file and self.install_path_file) and + install_lib not in sys_path): + log.debug(("modules installed to '%s', which is not in " + "Python's module search path (sys.path) -- " + "you'll have to change the search path yourself"), + self.install_lib) + + def create_path_file(self): + """Creates the .pth file""" + filename = os.path.join(self.install_libbase, + self.path_file + ".pth") + if self.install_path_file: + self.execute(write_file, + (filename, [self.extra_dirs]), + "creating %s" % filename) + else: + self.warn("path file '%s' not created" % filename) + + + # -- Reporting methods --------------------------------------------- + + def get_outputs(self): + """Assembles the outputs of all the sub-commands.""" + outputs = [] + for cmd_name in self.get_sub_commands(): + cmd = self.get_finalized_command(cmd_name) + # Add the contents of cmd.get_outputs(), ensuring + # that outputs doesn't contain duplicate entries + for filename in cmd.get_outputs(): + if filename not in outputs: + outputs.append(filename) + + if self.path_file and self.install_path_file: + outputs.append(os.path.join(self.install_libbase, + self.path_file + ".pth")) + + return outputs + + def get_inputs(self): + """Returns the inputs of all the sub-commands""" + # XXX gee, this looks familiar ;-( + inputs = [] + for cmd_name in self.get_sub_commands(): + cmd = self.get_finalized_command(cmd_name) + inputs.extend(cmd.get_inputs()) + + return inputs + + # -- Predicates for sub-command list ------------------------------- + + def has_lib(self): + """Returns true if the current distribution has any Python + modules to install.""" + return (self.distribution.has_pure_modules() or + self.distribution.has_ext_modules()) + + def has_headers(self): + """Returns true if the current distribution has any headers to + install.""" + return self.distribution.has_headers() + + def has_scripts(self): + """Returns true if the current distribution has any scripts to. + install.""" + return self.distribution.has_scripts() + + def has_data(self): + """Returns true if the current distribution has any data to. + install.""" + return self.distribution.has_data_files() + + # 'sub_commands': a list of commands this command might have to run to + # get its work done. See cmd.py for more info. + sub_commands = [('install_lib', has_lib), + ('install_headers', has_headers), + ('install_scripts', has_scripts), + ('install_data', has_data), + ('install_egg_info', lambda self:True), + ] diff --git a/shared/package-files/32/32ba092523c26c10d3f201acfc676aa55fca1ec96530d269c71d0c537bca255f/blob b/shared/package-files/32/32ba092523c26c10d3f201acfc676aa55fca1ec96530d269c71d0c537bca255f/blob new file mode 100644 index 0000000000000000000000000000000000000000..aa7e01e6fd17fddf07b733442208a0a4c9d87d5b --- /dev/null +++ b/shared/package-files/32/32ba092523c26c10d3f201acfc676aa55fca1ec96530d269c71d0c537bca255f/blob @@ -0,0 +1,218 @@ +from pyglet.window import key +from pyglet.window.mouse import LEFT, RIGHT, MIDDLE +from sympy.plotting.pygletplot.util import get_direction_vectors, get_basis_vectors + + +class PlotController: + + normal_mouse_sensitivity = 4.0 + modified_mouse_sensitivity = 1.0 + + normal_key_sensitivity = 160.0 + modified_key_sensitivity = 40.0 + + keymap = { + key.LEFT: 'left', + key.A: 'left', + key.NUM_4: 'left', + + key.RIGHT: 'right', + key.D: 'right', + key.NUM_6: 'right', + + key.UP: 'up', + key.W: 'up', + key.NUM_8: 'up', + + key.DOWN: 'down', + key.S: 'down', + key.NUM_2: 'down', + + key.Z: 'rotate_z_neg', + key.NUM_1: 'rotate_z_neg', + + key.C: 'rotate_z_pos', + key.NUM_3: 'rotate_z_pos', + + key.Q: 'spin_left', + key.NUM_7: 'spin_left', + key.E: 'spin_right', + key.NUM_9: 'spin_right', + + key.X: 'reset_camera', + key.NUM_5: 'reset_camera', + + key.NUM_ADD: 'zoom_in', + key.PAGEUP: 'zoom_in', + key.R: 'zoom_in', + + key.NUM_SUBTRACT: 'zoom_out', + key.PAGEDOWN: 'zoom_out', + key.F: 'zoom_out', + + key.RSHIFT: 'modify_sensitivity', + key.LSHIFT: 'modify_sensitivity', + + key.F1: 'rot_preset_xy', + key.F2: 'rot_preset_xz', + key.F3: 'rot_preset_yz', + key.F4: 'rot_preset_perspective', + + key.F5: 'toggle_axes', + key.F6: 'toggle_axe_colors', + + key.F8: 'save_image' + } + + def __init__(self, window, *, invert_mouse_zoom=False, **kwargs): + self.invert_mouse_zoom = invert_mouse_zoom + self.window = window + self.camera = window.camera + self.action = { + # Rotation around the view Y (up) vector + 'left': False, + 'right': False, + # Rotation around the view X vector + 'up': False, + 'down': False, + # Rotation around the view Z vector + 'spin_left': False, + 'spin_right': False, + # Rotation around the model Z vector + 'rotate_z_neg': False, + 'rotate_z_pos': False, + # Reset to the default rotation + 'reset_camera': False, + # Performs camera z-translation + 'zoom_in': False, + 'zoom_out': False, + # Use alternative sensitivity (speed) + 'modify_sensitivity': False, + # Rotation presets + 'rot_preset_xy': False, + 'rot_preset_xz': False, + 'rot_preset_yz': False, + 'rot_preset_perspective': False, + # axes + 'toggle_axes': False, + 'toggle_axe_colors': False, + # screenshot + 'save_image': False + } + + def update(self, dt): + z = 0 + if self.action['zoom_out']: + z -= 1 + if self.action['zoom_in']: + z += 1 + if z != 0: + self.camera.zoom_relative(z/10.0, self.get_key_sensitivity()/10.0) + + dx, dy, dz = 0, 0, 0 + if self.action['left']: + dx -= 1 + if self.action['right']: + dx += 1 + if self.action['up']: + dy -= 1 + if self.action['down']: + dy += 1 + if self.action['spin_left']: + dz += 1 + if self.action['spin_right']: + dz -= 1 + + if not self.is_2D(): + if dx != 0: + self.camera.euler_rotate(dx*dt*self.get_key_sensitivity(), + *(get_direction_vectors()[1])) + if dy != 0: + self.camera.euler_rotate(dy*dt*self.get_key_sensitivity(), + *(get_direction_vectors()[0])) + if dz != 0: + self.camera.euler_rotate(dz*dt*self.get_key_sensitivity(), + *(get_direction_vectors()[2])) + else: + self.camera.mouse_translate(0, 0, dx*dt*self.get_key_sensitivity(), + -dy*dt*self.get_key_sensitivity()) + + rz = 0 + if self.action['rotate_z_neg'] and not self.is_2D(): + rz -= 1 + if self.action['rotate_z_pos'] and not self.is_2D(): + rz += 1 + + if rz != 0: + self.camera.euler_rotate(rz*dt*self.get_key_sensitivity(), + *(get_basis_vectors()[2])) + + if self.action['reset_camera']: + self.camera.reset() + + if self.action['rot_preset_xy']: + self.camera.set_rot_preset('xy') + if self.action['rot_preset_xz']: + self.camera.set_rot_preset('xz') + if self.action['rot_preset_yz']: + self.camera.set_rot_preset('yz') + if self.action['rot_preset_perspective']: + self.camera.set_rot_preset('perspective') + + if self.action['toggle_axes']: + self.action['toggle_axes'] = False + self.camera.axes.toggle_visible() + + if self.action['toggle_axe_colors']: + self.action['toggle_axe_colors'] = False + self.camera.axes.toggle_colors() + + if self.action['save_image']: + self.action['save_image'] = False + self.window.plot.saveimage() + + return True + + def get_mouse_sensitivity(self): + if self.action['modify_sensitivity']: + return self.modified_mouse_sensitivity + else: + return self.normal_mouse_sensitivity + + def get_key_sensitivity(self): + if self.action['modify_sensitivity']: + return self.modified_key_sensitivity + else: + return self.normal_key_sensitivity + + def on_key_press(self, symbol, modifiers): + if symbol in self.keymap: + self.action[self.keymap[symbol]] = True + + def on_key_release(self, symbol, modifiers): + if symbol in self.keymap: + self.action[self.keymap[symbol]] = False + + def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers): + if buttons & LEFT: + if self.is_2D(): + self.camera.mouse_translate(x, y, dx, dy) + else: + self.camera.spherical_rotate((x - dx, y - dy), (x, y), + self.get_mouse_sensitivity()) + if buttons & MIDDLE: + self.camera.zoom_relative([1, -1][self.invert_mouse_zoom]*dy, + self.get_mouse_sensitivity()/20.0) + if buttons & RIGHT: + self.camera.mouse_translate(x, y, dx, dy) + + def on_mouse_scroll(self, x, y, dx, dy): + self.camera.zoom_relative([1, -1][self.invert_mouse_zoom]*dy, + self.get_mouse_sensitivity()) + + def is_2D(self): + functions = self.window.plot._functions + for i in functions: + if len(functions[i].i_vars) > 1 or len(functions[i].d_vars) > 2: + return False + return True diff --git a/shared/package-files/32/32bc7b191d3be854fb4055c707307abb4fc504be5a690d0ccf2e99d8d1ee4fa2/blob b/shared/package-files/32/32bc7b191d3be854fb4055c707307abb4fc504be5a690d0ccf2e99d8d1ee4fa2/blob new file mode 100644 index 0000000000000000000000000000000000000000..3bdde935ee880f79dbccd59d9b0669b526b23ddd --- /dev/null +++ b/shared/package-files/32/32bc7b191d3be854fb4055c707307abb4fc504be5a690d0ccf2e99d8d1ee4fa2/blob @@ -0,0 +1,30 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::q_per_channel_axis(Tensor self) -> int +inline int64_t q_per_channel_axis(const at::Tensor & self) { + return at::_ops::q_per_channel_axis::call(self); +} + +} diff --git a/shared/package-files/32/32bebb705fcc4da4acf606460fba5a690144f1dabad9d5edea2c44234168edd3/blob b/shared/package-files/32/32bebb705fcc4da4acf606460fba5a690144f1dabad9d5edea2c44234168edd3/blob new file mode 100644 index 0000000000000000000000000000000000000000..4e85bf372d86cb67d41d024ff5495236469dcae4 --- /dev/null +++ b/shared/package-files/32/32bebb705fcc4da4acf606460fba5a690144f1dabad9d5edea2c44234168edd3/blob @@ -0,0 +1,6 @@ +"""Expose Numba command via ``python -m numba``.""" +import sys +from numba.misc.numba_entry import main + +if __name__ == '__main__': + sys.exit(main()) diff --git a/shared/package-files/32/32c05c7c9c8c535e655b579fbb9c3b4f377831e9eb6078ae6a2c5b1cc7c0a1ca/blob b/shared/package-files/32/32c05c7c9c8c535e655b579fbb9c3b4f377831e9eb6078ae6a2c5b1cc7c0a1ca/blob new file mode 100644 index 0000000000000000000000000000000000000000..90d81bec1d35eb3996334268974885a5398b6c6c --- /dev/null +++ b/shared/package-files/32/32c05c7c9c8c535e655b579fbb9c3b4f377831e9eb6078ae6a2c5b1cc7c0a1ca/blob @@ -0,0 +1,3 @@ +functorch +torch +torchgen diff --git a/shared/package-files/32/32c1ca9105fba22a78bf4905dbc2b5463b4aab148d5729224a383cc13db46321/blob b/shared/package-files/32/32c1ca9105fba22a78bf4905dbc2b5463b4aab148d5729224a383cc13db46321/blob new file mode 100644 index 0000000000000000000000000000000000000000..b8620056a94995100fae72a66bb7e0558aae953b --- /dev/null +++ b/shared/package-files/32/32c1ca9105fba22a78bf4905dbc2b5463b4aab148d5729224a383cc13db46321/blob @@ -0,0 +1,175 @@ +import math + +import pytest + +np = pytest.importorskip("numpy") +pytest.importorskip("scipy") + + +import networkx as nx + + +class TestEigenvectorCentrality: + def test_K5(self): + """Eigenvector centrality: K5""" + G = nx.complete_graph(5) + b = nx.eigenvector_centrality(G) + v = math.sqrt(1 / 5.0) + b_answer = dict.fromkeys(G, v) + for n in sorted(G): + assert b[n] == pytest.approx(b_answer[n], abs=1e-7) + nstart = {n: 1 for n in G} + b = nx.eigenvector_centrality(G, nstart=nstart) + for n in sorted(G): + assert b[n] == pytest.approx(b_answer[n], abs=1e-7) + + b = nx.eigenvector_centrality_numpy(G) + for n in sorted(G): + assert b[n] == pytest.approx(b_answer[n], abs=1e-3) + + def test_P3(self): + """Eigenvector centrality: P3""" + G = nx.path_graph(3) + b_answer = {0: 0.5, 1: 0.7071, 2: 0.5} + b = nx.eigenvector_centrality_numpy(G) + for n in sorted(G): + assert b[n] == pytest.approx(b_answer[n], abs=1e-4) + b = nx.eigenvector_centrality(G) + for n in sorted(G): + assert b[n] == pytest.approx(b_answer[n], abs=1e-4) + + def test_P3_unweighted(self): + """Eigenvector centrality: P3""" + G = nx.path_graph(3) + b_answer = {0: 0.5, 1: 0.7071, 2: 0.5} + b = nx.eigenvector_centrality_numpy(G, weight=None) + for n in sorted(G): + assert b[n] == pytest.approx(b_answer[n], abs=1e-4) + + def test_maxiter(self): + with pytest.raises(nx.PowerIterationFailedConvergence): + G = nx.path_graph(3) + nx.eigenvector_centrality(G, max_iter=0) + + +class TestEigenvectorCentralityDirected: + @classmethod + def setup_class(cls): + G = nx.DiGraph() + + edges = [ + (1, 2), + (1, 3), + (2, 4), + (3, 2), + (3, 5), + (4, 2), + (4, 5), + (4, 6), + (5, 6), + (5, 7), + (5, 8), + (6, 8), + (7, 1), + (7, 5), + (7, 8), + (8, 6), + (8, 7), + ] + + G.add_edges_from(edges, weight=2.0) + cls.G = G.reverse() + cls.G.evc = [ + 0.25368793, + 0.19576478, + 0.32817092, + 0.40430835, + 0.48199885, + 0.15724483, + 0.51346196, + 0.32475403, + ] + + H = nx.DiGraph() + + edges = [ + (1, 2), + (1, 3), + (2, 4), + (3, 2), + (3, 5), + (4, 2), + (4, 5), + (4, 6), + (5, 6), + (5, 7), + (5, 8), + (6, 8), + (7, 1), + (7, 5), + (7, 8), + (8, 6), + (8, 7), + ] + + G.add_edges_from(edges) + cls.H = G.reverse() + cls.H.evc = [ + 0.25368793, + 0.19576478, + 0.32817092, + 0.40430835, + 0.48199885, + 0.15724483, + 0.51346196, + 0.32475403, + ] + + def test_eigenvector_centrality_weighted(self): + G = self.G + p = nx.eigenvector_centrality(G) + for a, b in zip(list(p.values()), self.G.evc): + assert a == pytest.approx(b, abs=1e-4) + + def test_eigenvector_centrality_weighted_numpy(self): + G = self.G + p = nx.eigenvector_centrality_numpy(G) + for a, b in zip(list(p.values()), self.G.evc): + assert a == pytest.approx(b, abs=1e-7) + + def test_eigenvector_centrality_unweighted(self): + G = self.H + p = nx.eigenvector_centrality(G) + for a, b in zip(list(p.values()), self.G.evc): + assert a == pytest.approx(b, abs=1e-4) + + def test_eigenvector_centrality_unweighted_numpy(self): + G = self.H + p = nx.eigenvector_centrality_numpy(G) + for a, b in zip(list(p.values()), self.G.evc): + assert a == pytest.approx(b, abs=1e-7) + + +class TestEigenvectorCentralityExceptions: + def test_multigraph(self): + with pytest.raises(nx.NetworkXException): + nx.eigenvector_centrality(nx.MultiGraph()) + + def test_multigraph_numpy(self): + with pytest.raises(nx.NetworkXException): + nx.eigenvector_centrality_numpy(nx.MultiGraph()) + + def test_empty(self): + with pytest.raises(nx.NetworkXException): + nx.eigenvector_centrality(nx.Graph()) + + def test_empty_numpy(self): + with pytest.raises(nx.NetworkXException): + nx.eigenvector_centrality_numpy(nx.Graph()) + + def test_zero_nstart(self): + G = nx.Graph([(1, 2), (1, 3), (2, 3)]) + with pytest.raises( + nx.NetworkXException, match="initial vector cannot have all zero values" + ): + nx.eigenvector_centrality(G, nstart={v: 0 for v in G}) diff --git a/shared/package-files/32/32c40e5eed16461760de68cbe75841fd5613498b29c200b251fc0aee9c848320/blob b/shared/package-files/32/32c40e5eed16461760de68cbe75841fd5613498b29c200b251fc0aee9c848320/blob new file mode 100644 index 0000000000000000000000000000000000000000..8ba628194dfede876bd50106a0c5e811e44b508b --- /dev/null +++ b/shared/package-files/32/32c40e5eed16461760de68cbe75841fd5613498b29c200b251fc0aee9c848320/blob @@ -0,0 +1,10 @@ +from typing import Any, List, Optional, Sequence, Union + +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest + +class SessionStorage(BaseStorage): + session_key: str = ... + def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... + def serialize_messages(self, messages: Sequence[Any]) -> str: ... + def deserialize_messages(self, data: Optional[Union[List[Any], str]]) -> Optional[List[Any]]: ... diff --git a/shared/package-files/32/32c6627e8d77ccb3dc8a900101d95a6d0c5041474d4b63b24a4649984ce13561/blob b/shared/package-files/32/32c6627e8d77ccb3dc8a900101d95a6d0c5041474d4b63b24a4649984ce13561/blob new file mode 100644 index 0000000000000000000000000000000000000000..03968e8699b49e9a6478be188fcf9738a1ab9330 --- /dev/null +++ b/shared/package-files/32/32c6627e8d77ccb3dc8a900101d95a6d0c5041474d4b63b24a4649984ce13561/blob @@ -0,0 +1,971 @@ +""" +Implementation of method overloads for Generator objects. +""" + +import numpy as np +from numba.core import types +from numba.core.extending import overload_method, register_jitable +from numba.np.numpy_support import as_dtype, from_dtype +from numba.np.random.generator_core import next_float, next_double +from numba.np.numpy_support import is_nonelike +from numba.core.errors import TypingError +from numba.core.types.containers import Tuple, UniTuple +from numba.np.random.distributions import \ + (random_standard_exponential_inv_f, random_standard_exponential_inv, + random_standard_exponential, random_standard_normal_f, + random_standard_gamma, random_standard_normal, random_uniform, + random_standard_exponential_f, random_standard_gamma_f, random_normal, + random_exponential, random_gamma, random_beta, random_power, + random_f,random_chisquare,random_standard_cauchy,random_pareto, + random_weibull, random_laplace, random_logistic, + random_lognormal, random_rayleigh, random_standard_t, random_wald, + random_geometric, random_zipf, random_triangular, + random_poisson, random_negative_binomial, random_logseries, + random_noncentral_chisquare, random_noncentral_f, random_binomial) +from numba.np.random import random_methods + + +def _get_proper_func(func_32, func_64, dtype, dist_name="the given"): + """ + Most of the standard NumPy distributions that accept dtype argument + only support either np.float32 or np.float64 as dtypes. + + This is a helper function that helps Numba select the proper underlying + implementation according to provided dtype. + """ + if isinstance(dtype, types.Omitted): + dtype = dtype.value + + np_dt = dtype + if isinstance(dtype, type): + nb_dt = from_dtype(np.dtype(dtype)) + elif isinstance(dtype, types.NumberClass): + nb_dt = dtype + np_dt = as_dtype(nb_dt) + + if np_dt not in [np.float32, np.float64]: + raise TypingError("Argument dtype is not one of the" + + " expected type(s): " + + " np.float32 or np.float64") + + if np_dt == np.float32: + next_func = func_32 + else: + next_func = func_64 + + return next_func, nb_dt + + +def check_size(size): + if not any([isinstance(size, UniTuple) and + isinstance(size.dtype, types.Integer), + isinstance(size, Tuple) and size.count == 0, + isinstance(size, types.Integer)]): + raise TypingError("Argument size is not one of the" + + " expected type(s): " + + " an integer, an empty tuple or a tuple of integers") + + +def check_types(obj, type_list, arg_name): + """ + Check if given object is one of the provided types. + If not raises an TypeError + """ + if isinstance(obj, types.Omitted): + obj = obj.value + + if not isinstance(type_list, (list, tuple)): + type_list = [type_list] + + if not any([isinstance(obj, _type) for _type in type_list]): + raise TypingError(f"Argument {arg_name} is not one of the" + + f" expected type(s): {type_list}") + + +# Overload the Generator().integers() +@overload_method(types.NumPyRandomGeneratorType, 'integers') +def NumPyRandomGeneratorType_integers(inst, low, high, size=None, + dtype=np.int64, endpoint=False): + check_types(low, [types.Integer, + types.Boolean, bool, int], 'low') + check_types(high, [types.Integer, types.Boolean, + bool, int], 'high') + check_types(endpoint, [types.Boolean, bool], 'endpoint') + + if isinstance(size, types.Omitted): + size = size.value + + if isinstance(dtype, types.Omitted): + dtype = dtype.value + + if isinstance(dtype, type): + nb_dt = from_dtype(np.dtype(dtype)) + _dtype = dtype + elif isinstance(dtype, types.NumberClass): + nb_dt = dtype + _dtype = as_dtype(nb_dt) + else: + raise TypingError("Argument dtype is not one of the" + + " expected type(s): " + + "np.int32, np.int64, np.int16, np.int8, " + "np.uint32, np.uint64, np.uint16, np.uint8, " + "np.bool_") + + if _dtype == np.bool_: + int_func = random_methods.random_bounded_bool_fill + lower_bound = -1 + upper_bound = 2 + else: + try: + i_info = np.iinfo(_dtype) + except ValueError: + raise TypingError("Argument dtype is not one of the" + + " expected type(s): " + + "np.int32, np.int64, np.int16, np.int8, " + "np.uint32, np.uint64, np.uint16, np.uint8, " + "np.bool_") + int_func = getattr(random_methods, + f'random_bounded_uint{i_info.bits}_fill') + lower_bound = i_info.min + upper_bound = i_info.max + + if is_nonelike(size): + def impl(inst, low, high, size=None, + dtype=np.int64, endpoint=False): + random_methods._randint_arg_check(low, high, endpoint, + lower_bound, upper_bound) + if not endpoint: + high -= dtype(1) + low = dtype(low) + high = dtype(high) + rng = high - low + return int_func(inst.bit_generator, low, rng, 1, dtype)[0] + else: + low = dtype(low) + high = dtype(high) + rng = high - low + return int_func(inst.bit_generator, low, rng, 1, dtype)[0] + return impl + else: + check_size(size) + + def impl(inst, low, high, size=None, + dtype=np.int64, endpoint=False): + random_methods._randint_arg_check(low, high, endpoint, + lower_bound, upper_bound) + if not endpoint: + high -= dtype(1) + low = dtype(low) + high = dtype(high) + rng = high - low + return int_func(inst.bit_generator, low, rng, size, dtype) + else: + low = dtype(low) + high = dtype(high) + rng = high - low + return int_func(inst.bit_generator, low, rng, size, dtype) + return impl + + +# The following `shuffle` implementation is a direct translation from: +# https://github.com/numpy/numpy/blob/95e3e7f445407e4f355b23d6a9991d8774f0eb0c/numpy/random/_generator.pyx#L4578 + +# Overload the Generator().shuffle() +@overload_method(types.NumPyRandomGeneratorType, 'shuffle') +def NumPyRandomGeneratorType_shuffle(inst, x, axis=0): + check_types(x, [types.Array], 'x') + check_types(axis, [int, types.Integer], 'axis') + + def impl(inst, x, axis=0): + if axis < 0: + axis = axis + x.ndim + if axis > x.ndim - 1 or axis < 0: + raise IndexError("Axis is out of bounds for the given array") + + z = np.swapaxes(x, 0, axis) + buf = np.empty_like(z[0, ...]) + + for i in range(len(z) - 1, 0, -1): + j = types.intp(random_methods.random_interval(inst.bit_generator, + i)) + if i == j: + continue + buf[...] = z[j, ...] + z[j, ...] = z[i, ...] + z[i, ...] = buf + + return impl + + +# The following `permutation` implementation is a direct translation from: +# https://github.com/numpy/numpy/blob/95e3e7f445407e4f355b23d6a9991d8774f0eb0c/numpy/random/_generator.pyx#L4710 +# Overload the Generator().permutation() +@overload_method(types.NumPyRandomGeneratorType, 'permutation') +def NumPyRandomGeneratorType_permutation(inst, x, axis=0): + check_types(x, [types.Array, types.Integer], 'x') + check_types(axis, [int, types.Integer], 'axis') + + IS_INT = isinstance(x, types.Integer) + + def impl(inst, x, axis=0): + if IS_INT: + new_arr = np.arange(x) + # NumPy ignores the axis argument when x is an integer + inst.shuffle(new_arr) + else: + new_arr = x.copy() + inst.shuffle(new_arr, axis=axis) + return new_arr + + return impl + + +# Overload the Generator().random() +@overload_method(types.NumPyRandomGeneratorType, 'random') +def NumPyRandomGeneratorType_random(inst, size=None, dtype=np.float64): + dist_func, nb_dt = _get_proper_func(next_float, next_double, + dtype, "random") + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, size=None, dtype=np.float64): + return nb_dt(dist_func(inst.bit_generator)) + return impl + else: + check_size(size) + + def impl(inst, size=None, dtype=np.float64): + out = np.empty(size, dtype=dtype) + out_f = out.flat + for i in range(out.size): + out_f[i] = dist_func(inst.bit_generator) + return out + return impl + + +# Overload the Generator().standard_exponential() method +@overload_method(types.NumPyRandomGeneratorType, 'standard_exponential') +def NumPyRandomGeneratorType_standard_exponential(inst, size=None, + dtype=np.float64, + method='zig'): + check_types(method, [types.UnicodeType, str], 'method') + dist_func_inv, nb_dt = _get_proper_func( + random_standard_exponential_inv_f, + random_standard_exponential_inv, + dtype + ) + + dist_func, nb_dt = _get_proper_func(random_standard_exponential_f, + random_standard_exponential, + dtype) + + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, size=None, dtype=np.float64, method='zig'): + if method == 'zig': + return nb_dt(dist_func(inst.bit_generator)) + elif method == 'inv': + return nb_dt(dist_func_inv(inst.bit_generator)) + else: + raise ValueError("Method must be either 'zig' or 'inv'") + return impl + else: + check_size(size) + + def impl(inst, size=None, dtype=np.float64, method='zig'): + out = np.empty(size, dtype=dtype) + out_f = out.flat + if method == 'zig': + for i in range(out.size): + out_f[i] = dist_func(inst.bit_generator) + elif method == 'inv': + for i in range(out.size): + out_f[i] = dist_func_inv(inst.bit_generator) + else: + raise ValueError("Method must be either 'zig' or 'inv'") + return out + return impl + + +# Overload the Generator().standard_normal() method +@overload_method(types.NumPyRandomGeneratorType, 'standard_normal') +def NumPyRandomGeneratorType_standard_normal(inst, size=None, dtype=np.float64): + dist_func, nb_dt = _get_proper_func(random_standard_normal_f, + random_standard_normal, + dtype) + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, size=None, dtype=np.float64): + return nb_dt(dist_func(inst.bit_generator)) + return impl + else: + check_size(size) + + def impl(inst, size=None, dtype=np.float64): + out = np.empty(size, dtype=dtype) + out_f = out.flat + for i in range(out.size): + out_f[i] = dist_func(inst.bit_generator) + return out + return impl + + +# Overload the Generator().standard_gamma() method +@overload_method(types.NumPyRandomGeneratorType, 'standard_gamma') +def NumPyRandomGeneratorType_standard_gamma(inst, shape, size=None, + dtype=np.float64): + check_types(shape, [types.Float, types.Integer, int, float], 'shape') + dist_func, nb_dt = _get_proper_func(random_standard_gamma_f, + random_standard_gamma, + dtype) + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, shape, size=None, dtype=np.float64): + return nb_dt(dist_func(inst.bit_generator, shape)) + return impl + else: + check_size(size) + + def impl(inst, shape, size=None, dtype=np.float64): + out = np.empty(size, dtype=dtype) + out_f = out.flat + for i in range(out.size): + out_f[i] = dist_func(inst.bit_generator, shape) + return out + return impl + + +# Overload the Generator().normal() method +@overload_method(types.NumPyRandomGeneratorType, 'normal') +def NumPyRandomGeneratorType_normal(inst, loc=0.0, scale=1.0, + size=None): + check_types(loc, [types.Float, types.Integer, int, float], 'loc') + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, loc=0.0, scale=1.0, size=None): + return random_normal(inst.bit_generator, loc, scale) + return impl + else: + check_size(size) + + def impl(inst, loc=0.0, scale=1.0, size=None): + out = np.empty(size, dtype=np.float64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_normal(inst.bit_generator, loc, scale) + return out + return impl + + +# Overload the Generator().uniform() method +@overload_method(types.NumPyRandomGeneratorType, 'uniform') +def NumPyRandomGeneratorType_uniform(inst, low=0.0, high=1.0, + size=None): + check_types(low, [types.Float, types.Integer, int, float], 'low') + check_types(high, [types.Float, types.Integer, int, float], 'high') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, low=0.0, high=1.0, size=None): + return random_uniform(inst.bit_generator, low, high - low) + return impl + else: + check_size(size) + + def impl(inst, low=0.0, high=1.0, size=None): + out = np.empty(size, dtype=np.float64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_uniform(inst.bit_generator, low, high - low) + return out + return impl + + +# Overload the Generator().exponential() method +@overload_method(types.NumPyRandomGeneratorType, 'exponential') +def NumPyRandomGeneratorType_exponential(inst, scale=1.0, size=None): + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, scale=1.0, size=None): + return random_exponential(inst.bit_generator, scale) + return impl + else: + check_size(size) + + def impl(inst, scale=1.0, size=None): + out = np.empty(size, dtype=np.float64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_exponential(inst.bit_generator, scale) + return out + return impl + + +# Overload the Generator().gamma() method +@overload_method(types.NumPyRandomGeneratorType, 'gamma') +def NumPyRandomGeneratorType_gamma(inst, shape, scale=1.0, size=None): + check_types(shape, [types.Float, types.Integer, int, float], 'shape') + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, shape, scale=1.0, size=None): + return random_gamma(inst.bit_generator, shape, scale) + return impl + else: + check_size(size) + + def impl(inst, shape, scale=1.0, size=None): + out = np.empty(size, dtype=np.float64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_gamma(inst.bit_generator, shape, scale) + return out + return impl + + +# Overload the Generator().beta() method +@overload_method(types.NumPyRandomGeneratorType, 'beta') +def NumPyRandomGeneratorType_beta(inst, a, b, size=None): + check_types(a, [types.Float, types.Integer, int, float], 'a') + check_types(b, [types.Float, types.Integer, int, float], 'b') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, a, b, size=None): + return random_beta(inst.bit_generator, a, b) + return impl + else: + check_size(size) + + def impl(inst, a, b, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_beta(inst.bit_generator, a, b) + return out + return impl + + +# Overload the Generator().f() method +@overload_method(types.NumPyRandomGeneratorType, 'f') +def NumPyRandomGeneratorType_f(inst, dfnum, dfden, size=None): + check_types(dfnum, [types.Float, types.Integer, int, float], 'dfnum') + check_types(dfden, [types.Float, types.Integer, int, float], 'dfden') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, dfnum, dfden, size=None): + return random_f(inst.bit_generator, dfnum, dfden) + return impl + else: + check_size(size) + + def impl(inst, dfnum, dfden, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_f(inst.bit_generator, dfnum, dfden) + return out + return impl + + +# Overload the Generator().chisquare() method +@overload_method(types.NumPyRandomGeneratorType, 'chisquare') +def NumPyRandomGeneratorType_chisquare(inst, df, size=None): + check_types(df, [types.Float, types.Integer, int, float], 'df') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, df, size=None): + return random_chisquare(inst.bit_generator, df) + return impl + else: + check_size(size) + + def impl(inst, df, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_chisquare(inst.bit_generator, df) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'standard_cauchy') +def NumPyRandomGeneratorType_standard_cauchy(inst, size=None): + + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, size=None): + return random_standard_cauchy(inst.bit_generator) + return impl + else: + check_size(size) + + def impl(inst, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_standard_cauchy(inst.bit_generator) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'pareto') +def NumPyRandomGeneratorType_pareto(inst, a, size=None): + check_types(a, [types.Float, types.Integer, int, float], 'a') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, a, size=None): + return random_pareto(inst.bit_generator, a) + return impl + else: + check_size(size) + + def impl(inst, a, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_pareto(inst.bit_generator, a) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'weibull') +def NumPyRandomGeneratorType_weibull(inst, a, size=None): + check_types(a, [types.Float, types.Integer, int, float], 'a') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, a, size=None): + return random_weibull(inst.bit_generator, a) + return impl + else: + check_size(size) + + def impl(inst, a, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_weibull(inst.bit_generator, a) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'power') +def NumPyRandomGeneratorType_power(inst, a, size=None): + check_types(a, [types.Float, types.Integer, int, float], 'a') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, a, size=None): + return random_power(inst.bit_generator, a) + return impl + else: + check_size(size) + + def impl(inst, a, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_power(inst.bit_generator, a) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'laplace') +def NumPyRandomGeneratorType_laplace(inst, loc=0.0, scale=1.0, size=None): + check_types(loc, [types.Float, types.Integer, int, float], 'loc') + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, loc=0.0, scale=1.0, size=None): + return random_laplace(inst.bit_generator, loc, scale) + return impl + else: + check_size(size) + + def impl(inst, loc=0.0, scale=1.0, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_laplace(inst.bit_generator, loc, scale) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'logistic') +def NumPyRandomGeneratorType_logistic(inst, loc=0.0, scale=1.0, size=None): + check_types(loc, [types.Float, types.Integer, int, float], 'loc') + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, loc=0.0, scale=1.0, size=None): + return random_logistic(inst.bit_generator, loc, scale) + return impl + else: + check_size(size) + + def impl(inst, loc=0.0, scale=1.0, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_logistic(inst.bit_generator, loc, scale) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'lognormal') +def NumPyRandomGeneratorType_lognormal(inst, mean=0.0, sigma=1.0, size=None): + check_types(mean, [types.Float, types.Integer, int, float], 'mean') + check_types(sigma, [types.Float, types.Integer, int, float], 'sigma') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, mean=0.0, sigma=1.0, size=None): + return random_lognormal(inst.bit_generator, mean, sigma) + return impl + else: + check_size(size) + + def impl(inst, mean=0.0, sigma=1.0, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_lognormal(inst.bit_generator, mean, sigma) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'rayleigh') +def NumPyRandomGeneratorType_rayleigh(inst, scale=1.0, size=None): + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, scale=1.0, size=None): + return random_rayleigh(inst.bit_generator, scale) + return impl + else: + check_size(size) + + def impl(inst, scale=1.0, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_rayleigh(inst.bit_generator, scale) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'standard_t') +def NumPyRandomGeneratorType_standard_t(inst, df, size=None): + check_types(df, [types.Float, types.Integer, int, float], 'df') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, df, size=None): + return random_standard_t(inst.bit_generator, df) + return impl + else: + check_size(size) + + def impl(inst, df, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_standard_t(inst.bit_generator, df) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'wald') +def NumPyRandomGeneratorType_wald(inst, mean, scale, size=None): + check_types(mean, [types.Float, types.Integer, int, float], 'mean') + check_types(scale, [types.Float, types.Integer, int, float], 'scale') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, mean, scale, size=None): + return random_wald(inst.bit_generator, mean, scale) + return impl + else: + check_size(size) + + def impl(inst, mean, scale, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_wald(inst.bit_generator, mean, scale) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'geometric') +def NumPyRandomGeneratorType_geometric(inst, p, size=None): + check_types(p, [types.Float, types.Integer, int, float], 'p') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, p, size=None): + return np.int64(random_geometric(inst.bit_generator, p)) + return impl + else: + check_size(size) + + def impl(inst, p, size=None): + out = np.empty(size, dtype=np.int64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_geometric(inst.bit_generator, p) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'zipf') +def NumPyRandomGeneratorType_zipf(inst, a, size=None): + check_types(a, [types.Float, types.Integer, int, float], 'a') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, a, size=None): + return np.int64(random_zipf(inst.bit_generator, a)) + return impl + else: + check_size(size) + + def impl(inst, a, size=None): + out = np.empty(size, dtype=np.int64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_zipf(inst.bit_generator, a) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'triangular') +def NumPyRandomGeneratorType_triangular(inst, left, mode, right, size=None): + check_types(left, [types.Float, types.Integer, int, float], 'left') + check_types(mode, [types.Float, types.Integer, int, float], 'mode') + check_types(right, [types.Float, types.Integer, int, float], 'right') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, left, mode, right, size=None): + return random_triangular(inst.bit_generator, left, mode, right) + return impl + else: + check_size(size) + + def impl(inst, left, mode, right, size=None): + out = np.empty(size) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_triangular(inst.bit_generator, + left, mode, right) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'poisson') +def NumPyRandomGeneratorType_poisson(inst, lam , size=None): + check_types(lam, [types.Float, types.Integer, int, float], 'lam') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, lam , size=None): + return np.int64(random_poisson(inst.bit_generator, lam)) + return impl + else: + check_size(size) + + def impl(inst, lam , size=None): + out = np.empty(size, dtype=np.int64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_poisson(inst.bit_generator, lam) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'negative_binomial') +def NumPyRandomGeneratorType_negative_binomial(inst, n, p, size=None): + check_types(n, [types.Float, types.Integer, int, float], 'n') + check_types(p, [types.Float, types.Integer, int, float], 'p') + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, n, p , size=None): + return np.int64(random_negative_binomial(inst.bit_generator, n, p)) + return impl + else: + check_size(size) + + def impl(inst, n, p , size=None): + out = np.empty(size, dtype=np.int64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_negative_binomial(inst.bit_generator, n, p) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'noncentral_chisquare') +def NumPyRandomGeneratorType_noncentral_chisquare(inst, df, nonc, size=None): + check_types(df, [types.Float, types.Integer, int, float], 'df') + check_types(nonc, [types.Float, types.Integer, int, float], 'nonc') + if isinstance(size, types.Omitted): + size = size.value + + @register_jitable + def check_arg_bounds(df, nonc): + if df <= 0: + raise ValueError("df <= 0") + if nonc < 0: + raise ValueError("nonc < 0") + + if is_nonelike(size): + def impl(inst, df, nonc, size=None): + check_arg_bounds(df, nonc) + return np.float64(random_noncentral_chisquare(inst.bit_generator, + df, nonc)) + return impl + else: + check_size(size) + + def impl(inst, df, nonc, size=None): + check_arg_bounds(df, nonc) + out = np.empty(size, dtype=np.float64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_noncentral_chisquare(inst.bit_generator, + df, nonc) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'noncentral_f') +def NumPyRandomGeneratorType_noncentral_f(inst, dfnum, dfden, nonc, size=None): + check_types(dfnum, [types.Float, types.Integer, int, float], 'dfnum') + check_types(dfden, [types.Float, types.Integer, int, float], 'dfden') + check_types(nonc, [types.Float, types.Integer, int, float], 'nonc') + if isinstance(size, types.Omitted): + size = size.value + + @register_jitable + def check_arg_bounds(dfnum, dfden, nonc): + if dfnum <= 0: + raise ValueError("dfnum <= 0") + if dfden <= 0: + raise ValueError("dfden <= 0") + if nonc < 0: + raise ValueError("nonc < 0") + + if is_nonelike(size): + def impl(inst, dfnum, dfden, nonc, size=None): + check_arg_bounds(dfnum, dfden, nonc) + return np.float64(random_noncentral_f(inst.bit_generator, + dfnum, dfden, nonc)) + return impl + else: + check_size(size) + + def impl(inst, dfnum, dfden, nonc, size=None): + check_arg_bounds(dfnum, dfden, nonc) + out = np.empty(size, dtype=np.float64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_noncentral_f(inst.bit_generator, + dfnum, dfden, nonc) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'logseries') +def NumPyRandomGeneratorType_logseries(inst, p, size=None): + check_types(p, [types.Float, types.Integer, int, float], 'p') + if isinstance(size, types.Omitted): + size = size.value + + @register_jitable + def check_arg_bounds(p): + if p < 0 or p >= 1 or np.isnan(p): + raise ValueError("p < 0, p >= 1 or p is NaN") + + if is_nonelike(size): + def impl(inst, p, size=None): + check_arg_bounds(p) + return np.int64(random_logseries(inst.bit_generator, p)) + return impl + else: + check_size(size) + + def impl(inst, p, size=None): + check_arg_bounds(p) + out = np.empty(size, dtype=np.int64) + out_f = out.flat + for i in range(out.size): + out_f[i] = random_logseries(inst.bit_generator, p) + return out + return impl + + +@overload_method(types.NumPyRandomGeneratorType, 'binomial') +def NumPyRandomGeneratorType_binomial(inst, n, p, size=None): + check_types(n, [types.Float, types.Integer, int, float], 'n') + check_types(p, [types.Float, types.Integer, int, float], 'p') + + if isinstance(size, types.Omitted): + size = size.value + + if is_nonelike(size): + def impl(inst, n, p, size=None): + return np.int64(random_binomial(inst.bit_generator, n, p)) + return impl + else: + check_size(size) + + def impl(inst, n, p, size=None): + out = np.empty(size, dtype=np.int64) + for i in np.ndindex(size): + out[i] = random_binomial(inst.bit_generator, n, p) + return out + return impl diff --git a/shared/package-files/32/32c68d31596d1d97ffc157db0d1eb8973ebcd470c13daec11e2e7a29e161ea88/blob b/shared/package-files/32/32c68d31596d1d97ffc157db0d1eb8973ebcd470c13daec11e2e7a29e161ea88/blob new file mode 100644 index 0000000000000000000000000000000000000000..24ecf7e97e3e56ea51327cc4704ff1fa749c15aa --- /dev/null +++ b/shared/package-files/32/32c68d31596d1d97ffc157db0d1eb8973ebcd470c13daec11e2e7a29e161ea88/blob @@ -0,0 +1,95 @@ +import os.path + +from tempfile import TemporaryDirectory + +import IPython.testing.tools as tt +from IPython.utils.syspathcontext import prepended_to_syspath + +ext1_content = """ +def load_ipython_extension(ip): + print("Running ext1 load") + +def unload_ipython_extension(ip): + print("Running ext1 unload") +""" + +ext2_content = """ +def load_ipython_extension(ip): + print("Running ext2 load") +""" + +ext3_content = """ +def load_ipython_extension(ip): + ip2 = get_ipython() + print(ip is ip2) +""" + +def test_extension_loading(): + em = get_ipython().extension_manager + with TemporaryDirectory() as td: + ext1 = os.path.join(td, "ext1.py") + with open(ext1, "w", encoding="utf-8") as f: + f.write(ext1_content) + + ext2 = os.path.join(td, "ext2.py") + with open(ext2, "w", encoding="utf-8") as f: + f.write(ext2_content) + + with prepended_to_syspath(td): + assert 'ext1' not in em.loaded + assert 'ext2' not in em.loaded + + # Load extension + with tt.AssertPrints("Running ext1 load"): + assert em.load_extension('ext1') is None + assert 'ext1' in em.loaded + + # Should refuse to load it again + with tt.AssertNotPrints("Running ext1 load"): + assert em.load_extension('ext1') == 'already loaded' + + # Reload + with tt.AssertPrints("Running ext1 unload"): + with tt.AssertPrints("Running ext1 load", suppress=False): + em.reload_extension('ext1') + + # Unload + with tt.AssertPrints("Running ext1 unload"): + assert em.unload_extension('ext1') is None + + # Can't unload again + with tt.AssertNotPrints("Running ext1 unload"): + assert em.unload_extension('ext1') == 'not loaded' + assert em.unload_extension('ext2') == 'not loaded' + + # Load extension 2 + with tt.AssertPrints("Running ext2 load"): + assert em.load_extension('ext2') is None + + # Can't unload this + assert em.unload_extension('ext2') == 'no unload function' + + # But can reload it + with tt.AssertPrints("Running ext2 load"): + em.reload_extension('ext2') + + +def test_extension_builtins(): + em = get_ipython().extension_manager + with TemporaryDirectory() as td: + ext3 = os.path.join(td, "ext3.py") + with open(ext3, "w", encoding="utf-8") as f: + f.write(ext3_content) + + assert 'ext3' not in em.loaded + + with prepended_to_syspath(td): + # Load extension + with tt.AssertPrints("True"): + assert em.load_extension('ext3') is None + assert 'ext3' in em.loaded + + +def test_non_extension(): + em = get_ipython().extension_manager + assert em.load_extension("sys") == "no load function" diff --git a/shared/package-files/32/32c76b43f527ebbe41f77313c8567570b734f5a2c62e95e1c2f25366147f8f46/blob b/shared/package-files/32/32c76b43f527ebbe41f77313c8567570b734f5a2c62e95e1c2f25366147f8f46/blob new file mode 100644 index 0000000000000000000000000000000000000000..cf0608fa01bbf5549d81c6edc1b3e4cd82de379b --- /dev/null +++ b/shared/package-files/32/32c76b43f527ebbe41f77313c8567570b734f5a2c62e95e1c2f25366147f8f46/blob @@ -0,0 +1,5 @@ +#pragma once + +#include +#include +#include diff --git a/shared/package-files/32/32c99a196c24e81fcf80bf6a1f8add21acba32f82b98bc4e39194e812915ec7b/blob b/shared/package-files/32/32c99a196c24e81fcf80bf6a1f8add21acba32f82b98bc4e39194e812915ec7b/blob new file mode 100644 index 0000000000000000000000000000000000000000..972857213afc30d3b3ca68c49e37d8ee806083c0 --- /dev/null +++ b/shared/package-files/32/32c99a196c24e81fcf80bf6a1f8add21acba32f82b98bc4e39194e812915ec7b/blob @@ -0,0 +1,21 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor batch_norm(const at::Tensor & input, const c10::optional & weight, const c10::optional & bias, const c10::optional & running_mean, const c10::optional & running_var, bool training, double momentum, double eps, bool cudnn_enabled); +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32d587e6579b9a97e1d58032f0030d8a3b081b34faff761213694b45240c1d81/blob b/shared/package-files/32/32d587e6579b9a97e1d58032f0030d8a3b081b34faff761213694b45240c1d81/blob new file mode 100644 index 0000000000000000000000000000000000000000..0b026ee87193a5e45023e584993f6c3b15bf7687 --- /dev/null +++ b/shared/package-files/32/32d587e6579b9a97e1d58032f0030d8a3b081b34faff761213694b45240c1d81/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::_native_batch_norm_legit_no_training(Tensor input, Tensor? weight, Tensor? bias, Tensor running_mean, Tensor running_var, float momentum, float eps) -> (Tensor, Tensor, Tensor) +inline ::std::tuple _native_batch_norm_legit_no_training(const at::Tensor & input, const c10::optional & weight, const c10::optional & bias, const at::Tensor & running_mean, const at::Tensor & running_var, double momentum, double eps) { + return at::_ops::_native_batch_norm_legit_no_training::call(input, weight, bias, running_mean, running_var, momentum, eps); +} + +// aten::_native_batch_norm_legit_no_training.out(Tensor input, Tensor? weight, Tensor? bias, Tensor running_mean, Tensor running_var, float momentum, float eps, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2) -> (Tensor(a!), Tensor(b!), Tensor(c!)) +inline ::std::tuple _native_batch_norm_legit_no_training_out(at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, const at::Tensor & input, const c10::optional & weight, const c10::optional & bias, const at::Tensor & running_mean, const at::Tensor & running_var, double momentum, double eps) { + return at::_ops::_native_batch_norm_legit_no_training_out::call(input, weight, bias, running_mean, running_var, momentum, eps, out0, out1, out2); +} +// aten::_native_batch_norm_legit_no_training.out(Tensor input, Tensor? weight, Tensor? bias, Tensor running_mean, Tensor running_var, float momentum, float eps, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2) -> (Tensor(a!), Tensor(b!), Tensor(c!)) +inline ::std::tuple _native_batch_norm_legit_no_training_outf(const at::Tensor & input, const c10::optional & weight, const c10::optional & bias, const at::Tensor & running_mean, const at::Tensor & running_var, double momentum, double eps, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2) { + return at::_ops::_native_batch_norm_legit_no_training_out::call(input, weight, bias, running_mean, running_var, momentum, eps, out0, out1, out2); +} + +} diff --git a/shared/package-files/32/32d635f1bcfcaffc9e5235056e5d37854210193f2585ba986dc071ad9bbf1405/blob b/shared/package-files/32/32d635f1bcfcaffc9e5235056e5d37854210193f2585ba986dc071ad9bbf1405/blob new file mode 100644 index 0000000000000000000000000000000000000000..5895ca6f884253d6d07434b43e8276e7baf979a1 --- /dev/null +++ b/shared/package-files/32/32d635f1bcfcaffc9e5235056e5d37854210193f2585ba986dc071ad9bbf1405/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor lgamma(const at::Tensor & self); +TORCH_API at::Tensor & lgamma_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & lgamma_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & lgamma_(at::Tensor & self); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/32/32d6c5ca78875c43c5d4d18daa7c771aefa2a881f9196c9faf309b25413b0908/blob b/shared/package-files/32/32d6c5ca78875c43c5d4d18daa7c771aefa2a881f9196c9faf309b25413b0908/blob new file mode 100644 index 0000000000000000000000000000000000000000..22292c78b7b5b3a253c1d231ad12b225acd6f390 --- /dev/null +++ b/shared/package-files/32/32d6c5ca78875c43c5d4d18daa7c771aefa2a881f9196c9faf309b25413b0908/blob @@ -0,0 +1,1378 @@ +# +# Module providing manager classes for dealing +# with shared objects +# +# multiprocessing/managers.py +# +# Copyright (c) 2006-2008, R Oudkerk +# Licensed to PSF under a Contributor Agreement. +# + +__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] + +# +# Imports +# + +import sys +import threading +import signal +import array +import queue +import time +import types +import os +from os import getpid + +from traceback import format_exc + +from . import connection +from .context import reduction, get_spawning_popen, ProcessError +from . import pool +from . import process +from . import util +from . import get_context +try: + from . import shared_memory +except ImportError: + HAS_SHMEM = False +else: + HAS_SHMEM = True + __all__.append('SharedMemoryManager') + +# +# Register some things for pickling +# + +def reduce_array(a): + return array.array, (a.typecode, a.tobytes()) +reduction.register(array.array, reduce_array) + +view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] +if view_types[0] is not list: # only needed in Py3.0 + def rebuild_as_list(obj): + return list, (list(obj),) + for view_type in view_types: + reduction.register(view_type, rebuild_as_list) + +# +# Type for identifying shared objects +# + +class Token(object): + ''' + Type to uniquely identify a shared object + ''' + __slots__ = ('typeid', 'address', 'id') + + def __init__(self, typeid, address, id): + (self.typeid, self.address, self.id) = (typeid, address, id) + + def __getstate__(self): + return (self.typeid, self.address, self.id) + + def __setstate__(self, state): + (self.typeid, self.address, self.id) = state + + def __repr__(self): + return '%s(typeid=%r, address=%r, id=%r)' % \ + (self.__class__.__name__, self.typeid, self.address, self.id) + +# +# Function for communication with a manager's server process +# + +def dispatch(c, id, methodname, args=(), kwds={}): + ''' + Send a message to manager using connection `c` and return response + ''' + c.send((id, methodname, args, kwds)) + kind, result = c.recv() + if kind == '#RETURN': + return result + raise convert_to_error(kind, result) + +def convert_to_error(kind, result): + if kind == '#ERROR': + return result + elif kind in ('#TRACEBACK', '#UNSERIALIZABLE'): + if not isinstance(result, str): + raise TypeError( + "Result {0!r} (kind '{1}') type is {2}, not str".format( + result, kind, type(result))) + if kind == '#UNSERIALIZABLE': + return RemoteError('Unserializable message: %s\n' % result) + else: + return RemoteError(result) + else: + return ValueError('Unrecognized message type {!r}'.format(kind)) + +class RemoteError(Exception): + def __str__(self): + return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) + +# +# Functions for finding the method names of an object +# + +def all_methods(obj): + ''' + Return a list of names of methods of `obj` + ''' + temp = [] + for name in dir(obj): + func = getattr(obj, name) + if callable(func): + temp.append(name) + return temp + +def public_methods(obj): + ''' + Return a list of names of methods of `obj` which do not start with '_' + ''' + return [name for name in all_methods(obj) if name[0] != '_'] + +# +# Server which is run in a process controlled by a manager +# + +class Server(object): + ''' + Server class which runs in a process controlled by a manager object + ''' + public = ['shutdown', 'create', 'accept_connection', 'get_methods', + 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] + + def __init__(self, registry, address, authkey, serializer): + if not isinstance(authkey, bytes): + raise TypeError( + "Authkey {0!r} is type {1!s}, not bytes".format( + authkey, type(authkey))) + self.registry = registry + self.authkey = process.AuthenticationString(authkey) + Listener, Client = listener_client[serializer] + + # do authentication later + self.listener = Listener(address=address, backlog=16) + self.address = self.listener.address + + self.id_to_obj = {'0': (None, ())} + self.id_to_refcount = {} + self.id_to_local_proxy_obj = {} + self.mutex = threading.Lock() + + def serve_forever(self): + ''' + Run the server forever + ''' + self.stop_event = threading.Event() + process.current_process()._manager_server = self + try: + accepter = threading.Thread(target=self.accepter) + accepter.daemon = True + accepter.start() + try: + while not self.stop_event.is_set(): + self.stop_event.wait(1) + except (KeyboardInterrupt, SystemExit): + pass + finally: + if sys.stdout != sys.__stdout__: # what about stderr? + util.debug('resetting stdout, stderr') + sys.stdout = sys.__stdout__ + sys.stderr = sys.__stderr__ + sys.exit(0) + + def accepter(self): + while True: + try: + c = self.listener.accept() + except OSError: + continue + t = threading.Thread(target=self.handle_request, args=(c,)) + t.daemon = True + t.start() + + def _handle_request(self, c): + request = None + try: + connection.deliver_challenge(c, self.authkey) + connection.answer_challenge(c, self.authkey) + request = c.recv() + ignore, funcname, args, kwds = request + assert funcname in self.public, '%r unrecognized' % funcname + func = getattr(self, funcname) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + try: + result = func(c, *args, **kwds) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + msg = ('#RETURN', result) + + try: + c.send(msg) + except Exception as e: + try: + c.send(('#TRACEBACK', format_exc())) + except Exception: + pass + util.info('Failure to send message: %r', msg) + util.info(' ... request was %r', request) + util.info(' ... exception was %r', e) + + def handle_request(self, conn): + ''' + Handle a new connection + ''' + try: + self._handle_request(conn) + except SystemExit: + # Server.serve_client() calls sys.exit(0) on EOF + pass + finally: + conn.close() + + def serve_client(self, conn): + ''' + Handle requests from the proxies in a particular process/thread + ''' + util.debug('starting server thread to service %r', + threading.current_thread().name) + + recv = conn.recv + send = conn.send + id_to_obj = self.id_to_obj + + while not self.stop_event.is_set(): + + try: + methodname = obj = None + request = recv() + ident, methodname, args, kwds = request + try: + obj, exposed, gettypeid = id_to_obj[ident] + except KeyError as ke: + try: + obj, exposed, gettypeid = \ + self.id_to_local_proxy_obj[ident] + except KeyError: + raise ke + + if methodname not in exposed: + raise AttributeError( + 'method %r of %r object is not in exposed=%r' % + (methodname, type(obj), exposed) + ) + + function = getattr(obj, methodname) + + try: + res = function(*args, **kwds) + except Exception as e: + msg = ('#ERROR', e) + else: + typeid = gettypeid and gettypeid.get(methodname, None) + if typeid: + rident, rexposed = self.create(conn, typeid, res) + token = Token(typeid, self.address, rident) + msg = ('#PROXY', (rexposed, token)) + else: + msg = ('#RETURN', res) + + except AttributeError: + if methodname is None: + msg = ('#TRACEBACK', format_exc()) + else: + try: + fallback_func = self.fallback_mapping[methodname] + result = fallback_func( + self, conn, ident, obj, *args, **kwds + ) + msg = ('#RETURN', result) + except Exception: + msg = ('#TRACEBACK', format_exc()) + + except EOFError: + util.debug('got EOF -- exiting thread serving %r', + threading.current_thread().name) + sys.exit(0) + + except Exception: + msg = ('#TRACEBACK', format_exc()) + + try: + try: + send(msg) + except Exception: + send(('#UNSERIALIZABLE', format_exc())) + except Exception as e: + util.info('exception in thread serving %r', + threading.current_thread().name) + util.info(' ... message was %r', msg) + util.info(' ... exception was %r', e) + conn.close() + sys.exit(1) + + def fallback_getvalue(self, conn, ident, obj): + return obj + + def fallback_str(self, conn, ident, obj): + return str(obj) + + def fallback_repr(self, conn, ident, obj): + return repr(obj) + + fallback_mapping = { + '__str__':fallback_str, + '__repr__':fallback_repr, + '#GETVALUE':fallback_getvalue + } + + def dummy(self, c): + pass + + def debug_info(self, c): + ''' + Return some info --- useful to spot problems with refcounting + ''' + # Perhaps include debug info about 'c'? + with self.mutex: + result = [] + keys = list(self.id_to_refcount.keys()) + keys.sort() + for ident in keys: + if ident != '0': + result.append(' %s: refcount=%s\n %s' % + (ident, self.id_to_refcount[ident], + str(self.id_to_obj[ident][0])[:75])) + return '\n'.join(result) + + def number_of_objects(self, c): + ''' + Number of shared objects + ''' + # Doesn't use (len(self.id_to_obj) - 1) as we shouldn't count ident='0' + return len(self.id_to_refcount) + + def shutdown(self, c): + ''' + Shutdown this process + ''' + try: + util.debug('manager received shutdown message') + c.send(('#RETURN', None)) + except: + import traceback + traceback.print_exc() + finally: + self.stop_event.set() + + def create(self, c, typeid, /, *args, **kwds): + ''' + Create a new shared object and return its id + ''' + with self.mutex: + callable, exposed, method_to_typeid, proxytype = \ + self.registry[typeid] + + if callable is None: + if kwds or (len(args) != 1): + raise ValueError( + "Without callable, must have one non-keyword argument") + obj = args[0] + else: + obj = callable(*args, **kwds) + + if exposed is None: + exposed = public_methods(obj) + if method_to_typeid is not None: + if not isinstance(method_to_typeid, dict): + raise TypeError( + "Method_to_typeid {0!r}: type {1!s}, not dict".format( + method_to_typeid, type(method_to_typeid))) + exposed = list(exposed) + list(method_to_typeid) + + ident = '%x' % id(obj) # convert to string because xmlrpclib + # only has 32 bit signed integers + util.debug('%r callable returned object with id %r', typeid, ident) + + self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) + if ident not in self.id_to_refcount: + self.id_to_refcount[ident] = 0 + + self.incref(c, ident) + return ident, tuple(exposed) + + def get_methods(self, c, token): + ''' + Return the methods of the shared object indicated by token + ''' + return tuple(self.id_to_obj[token.id][1]) + + def accept_connection(self, c, name): + ''' + Spawn a new thread to serve this connection + ''' + threading.current_thread().name = name + c.send(('#RETURN', None)) + self.serve_client(c) + + def incref(self, c, ident): + with self.mutex: + try: + self.id_to_refcount[ident] += 1 + except KeyError as ke: + # If no external references exist but an internal (to the + # manager) still does and a new external reference is created + # from it, restore the manager's tracking of it from the + # previously stashed internal ref. + if ident in self.id_to_local_proxy_obj: + self.id_to_refcount[ident] = 1 + self.id_to_obj[ident] = \ + self.id_to_local_proxy_obj[ident] + obj, exposed, gettypeid = self.id_to_obj[ident] + util.debug('Server re-enabled tracking & INCREF %r', ident) + else: + raise ke + + def decref(self, c, ident): + if ident not in self.id_to_refcount and \ + ident in self.id_to_local_proxy_obj: + util.debug('Server DECREF skipping %r', ident) + return + + with self.mutex: + if self.id_to_refcount[ident] <= 0: + raise AssertionError( + "Id {0!s} ({1!r}) has refcount {2:n}, not 1+".format( + ident, self.id_to_obj[ident], + self.id_to_refcount[ident])) + self.id_to_refcount[ident] -= 1 + if self.id_to_refcount[ident] == 0: + del self.id_to_refcount[ident] + + if ident not in self.id_to_refcount: + # Two-step process in case the object turns out to contain other + # proxy objects (e.g. a managed list of managed lists). + # Otherwise, deleting self.id_to_obj[ident] would trigger the + # deleting of the stored value (another managed object) which would + # in turn attempt to acquire the mutex that is already held here. + self.id_to_obj[ident] = (None, (), None) # thread-safe + util.debug('disposing of obj with id %r', ident) + with self.mutex: + del self.id_to_obj[ident] + + +# +# Class to represent state of a manager +# + +class State(object): + __slots__ = ['value'] + INITIAL = 0 + STARTED = 1 + SHUTDOWN = 2 + +# +# Mapping from serializer name to Listener and Client types +# + +listener_client = { + 'pickle' : (connection.Listener, connection.Client), + 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) + } + +# +# Definition of BaseManager +# + +class BaseManager(object): + ''' + Base class for managers + ''' + _registry = {} + _Server = Server + + def __init__(self, address=None, authkey=None, serializer='pickle', + ctx=None): + if authkey is None: + authkey = process.current_process().authkey + self._address = address # XXX not final address if eg ('', 0) + self._authkey = process.AuthenticationString(authkey) + self._state = State() + self._state.value = State.INITIAL + self._serializer = serializer + self._Listener, self._Client = listener_client[serializer] + self._ctx = ctx or get_context() + + def get_server(self): + ''' + Return server object with serve_forever() method and address attribute + ''' + if self._state.value != State.INITIAL: + if self._state.value == State.STARTED: + raise ProcessError("Already started server") + elif self._state.value == State.SHUTDOWN: + raise ProcessError("Manager has shut down") + else: + raise ProcessError( + "Unknown state {!r}".format(self._state.value)) + return Server(self._registry, self._address, + self._authkey, self._serializer) + + def connect(self): + ''' + Connect manager object to the server process + ''' + Listener, Client = listener_client[self._serializer] + conn = Client(self._address, authkey=self._authkey) + dispatch(conn, None, 'dummy') + self._state.value = State.STARTED + + def start(self, initializer=None, initargs=()): + ''' + Spawn a server process for this manager object + ''' + if self._state.value != State.INITIAL: + if self._state.value == State.STARTED: + raise ProcessError("Already started server") + elif self._state.value == State.SHUTDOWN: + raise ProcessError("Manager has shut down") + else: + raise ProcessError( + "Unknown state {!r}".format(self._state.value)) + + if initializer is not None and not callable(initializer): + raise TypeError('initializer must be a callable') + + # pipe over which we will retrieve address of server + reader, writer = connection.Pipe(duplex=False) + + # spawn process which runs a server + self._process = self._ctx.Process( + target=type(self)._run_server, + args=(self._registry, self._address, self._authkey, + self._serializer, writer, initializer, initargs), + ) + ident = ':'.join(str(i) for i in self._process._identity) + self._process.name = type(self).__name__ + '-' + ident + self._process.start() + + # get address of server + writer.close() + self._address = reader.recv() + reader.close() + + # register a finalizer + self._state.value = State.STARTED + self.shutdown = util.Finalize( + self, type(self)._finalize_manager, + args=(self._process, self._address, self._authkey, + self._state, self._Client), + exitpriority=0 + ) + + @classmethod + def _run_server(cls, registry, address, authkey, serializer, writer, + initializer=None, initargs=()): + ''' + Create a server, report its address and run it + ''' + # bpo-36368: protect server process from KeyboardInterrupt signals + signal.signal(signal.SIGINT, signal.SIG_IGN) + + if initializer is not None: + initializer(*initargs) + + # create server + server = cls._Server(registry, address, authkey, serializer) + + # inform parent process of the server's address + writer.send(server.address) + writer.close() + + # run the manager + util.info('manager serving at %r', server.address) + server.serve_forever() + + def _create(self, typeid, /, *args, **kwds): + ''' + Create a new shared object; return the token and exposed tuple + ''' + assert self._state.value == State.STARTED, 'server not yet started' + conn = self._Client(self._address, authkey=self._authkey) + try: + id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) + finally: + conn.close() + return Token(typeid, self._address, id), exposed + + def join(self, timeout=None): + ''' + Join the manager process (if it has been spawned) + ''' + if self._process is not None: + self._process.join(timeout) + if not self._process.is_alive(): + self._process = None + + def _debug_info(self): + ''' + Return some info about the servers shared objects and connections + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'debug_info') + finally: + conn.close() + + def _number_of_objects(self): + ''' + Return the number of shared objects + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'number_of_objects') + finally: + conn.close() + + def __enter__(self): + if self._state.value == State.INITIAL: + self.start() + if self._state.value != State.STARTED: + if self._state.value == State.INITIAL: + raise ProcessError("Unable to start server") + elif self._state.value == State.SHUTDOWN: + raise ProcessError("Manager has shut down") + else: + raise ProcessError( + "Unknown state {!r}".format(self._state.value)) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.shutdown() + + @staticmethod + def _finalize_manager(process, address, authkey, state, _Client): + ''' + Shutdown the manager process; will be registered as a finalizer + ''' + if process.is_alive(): + util.info('sending shutdown message to manager') + try: + conn = _Client(address, authkey=authkey) + try: + dispatch(conn, None, 'shutdown') + finally: + conn.close() + except Exception: + pass + + process.join(timeout=1.0) + if process.is_alive(): + util.info('manager still alive') + if hasattr(process, 'terminate'): + util.info('trying to `terminate()` manager process') + process.terminate() + process.join(timeout=1.0) + if process.is_alive(): + util.info('manager still alive after terminate') + + state.value = State.SHUTDOWN + try: + del BaseProxy._address_to_local[address] + except KeyError: + pass + + @property + def address(self): + return self._address + + @classmethod + def register(cls, typeid, callable=None, proxytype=None, exposed=None, + method_to_typeid=None, create_method=True): + ''' + Register a typeid with the manager type + ''' + if '_registry' not in cls.__dict__: + cls._registry = cls._registry.copy() + + if proxytype is None: + proxytype = AutoProxy + + exposed = exposed or getattr(proxytype, '_exposed_', None) + + method_to_typeid = method_to_typeid or \ + getattr(proxytype, '_method_to_typeid_', None) + + if method_to_typeid: + for key, value in list(method_to_typeid.items()): # isinstance? + assert type(key) is str, '%r is not a string' % key + assert type(value) is str, '%r is not a string' % value + + cls._registry[typeid] = ( + callable, exposed, method_to_typeid, proxytype + ) + + if create_method: + def temp(self, /, *args, **kwds): + util.debug('requesting creation of a shared %r object', typeid) + token, exp = self._create(typeid, *args, **kwds) + proxy = proxytype( + token, self._serializer, manager=self, + authkey=self._authkey, exposed=exp + ) + conn = self._Client(token.address, authkey=self._authkey) + dispatch(conn, None, 'decref', (token.id,)) + return proxy + temp.__name__ = typeid + setattr(cls, typeid, temp) + +# +# Subclass of set which get cleared after a fork +# + +class ProcessLocalSet(set): + def __init__(self): + util.register_after_fork(self, lambda obj: obj.clear()) + def __reduce__(self): + return type(self), () + +# +# Definition of BaseProxy +# + +class BaseProxy(object): + ''' + A base for proxies of shared objects + ''' + _address_to_local = {} + _mutex = util.ForkAwareThreadLock() + + def __init__(self, token, serializer, manager=None, + authkey=None, exposed=None, incref=True, manager_owned=False): + with BaseProxy._mutex: + tls_idset = BaseProxy._address_to_local.get(token.address, None) + if tls_idset is None: + tls_idset = util.ForkAwareLocal(), ProcessLocalSet() + BaseProxy._address_to_local[token.address] = tls_idset + + # self._tls is used to record the connection used by this + # thread to communicate with the manager at token.address + self._tls = tls_idset[0] + + # self._idset is used to record the identities of all shared + # objects for which the current process owns references and + # which are in the manager at token.address + self._idset = tls_idset[1] + + self._token = token + self._id = self._token.id + self._manager = manager + self._serializer = serializer + self._Client = listener_client[serializer][1] + + # Should be set to True only when a proxy object is being created + # on the manager server; primary use case: nested proxy objects. + # RebuildProxy detects when a proxy is being created on the manager + # and sets this value appropriately. + self._owned_by_manager = manager_owned + + if authkey is not None: + self._authkey = process.AuthenticationString(authkey) + elif self._manager is not None: + self._authkey = self._manager._authkey + else: + self._authkey = process.current_process().authkey + + if incref: + self._incref() + + util.register_after_fork(self, BaseProxy._after_fork) + + def _connect(self): + util.debug('making connection to manager') + name = process.current_process().name + if threading.current_thread().name != 'MainThread': + name += '|' + threading.current_thread().name + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'accept_connection', (name,)) + self._tls.connection = conn + + def _callmethod(self, methodname, args=(), kwds={}): + ''' + Try to call a method of the referent and return a copy of the result + ''' + try: + conn = self._tls.connection + except AttributeError: + util.debug('thread %r does not own a connection', + threading.current_thread().name) + self._connect() + conn = self._tls.connection + + conn.send((self._id, methodname, args, kwds)) + kind, result = conn.recv() + + if kind == '#RETURN': + return result + elif kind == '#PROXY': + exposed, token = result + proxytype = self._manager._registry[token.typeid][-1] + token.address = self._token.address + proxy = proxytype( + token, self._serializer, manager=self._manager, + authkey=self._authkey, exposed=exposed + ) + conn = self._Client(token.address, authkey=self._authkey) + dispatch(conn, None, 'decref', (token.id,)) + return proxy + raise convert_to_error(kind, result) + + def _getvalue(self): + ''' + Get a copy of the value of the referent + ''' + return self._callmethod('#GETVALUE') + + def _incref(self): + if self._owned_by_manager: + util.debug('owned_by_manager skipped INCREF of %r', self._token.id) + return + + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'incref', (self._id,)) + util.debug('INCREF %r', self._token.id) + + self._idset.add(self._id) + + state = self._manager and self._manager._state + + self._close = util.Finalize( + self, BaseProxy._decref, + args=(self._token, self._authkey, state, + self._tls, self._idset, self._Client), + exitpriority=10 + ) + + @staticmethod + def _decref(token, authkey, state, tls, idset, _Client): + idset.discard(token.id) + + # check whether manager is still alive + if state is None or state.value == State.STARTED: + # tell manager this process no longer cares about referent + try: + util.debug('DECREF %r', token.id) + conn = _Client(token.address, authkey=authkey) + dispatch(conn, None, 'decref', (token.id,)) + except Exception as e: + util.debug('... decref failed %s', e) + + else: + util.debug('DECREF %r -- manager already shutdown', token.id) + + # check whether we can close this thread's connection because + # the process owns no more references to objects for this manager + if not idset and hasattr(tls, 'connection'): + util.debug('thread %r has no more proxies so closing conn', + threading.current_thread().name) + tls.connection.close() + del tls.connection + + def _after_fork(self): + self._manager = None + try: + self._incref() + except Exception as e: + # the proxy may just be for a manager which has shutdown + util.info('incref failed: %s' % e) + + def __reduce__(self): + kwds = {} + if get_spawning_popen() is not None: + kwds['authkey'] = self._authkey + + if getattr(self, '_isauto', False): + kwds['exposed'] = self._exposed_ + return (RebuildProxy, + (AutoProxy, self._token, self._serializer, kwds)) + else: + return (RebuildProxy, + (type(self), self._token, self._serializer, kwds)) + + def __deepcopy__(self, memo): + return self._getvalue() + + def __repr__(self): + return '<%s object, typeid %r at %#x>' % \ + (type(self).__name__, self._token.typeid, id(self)) + + def __str__(self): + ''' + Return representation of the referent (or a fall-back if that fails) + ''' + try: + return self._callmethod('__repr__') + except Exception: + return repr(self)[:-1] + "; '__str__()' failed>" + +# +# Function used for unpickling +# + +def RebuildProxy(func, token, serializer, kwds): + ''' + Function used for unpickling proxy objects. + ''' + server = getattr(process.current_process(), '_manager_server', None) + if server and server.address == token.address: + util.debug('Rebuild a proxy owned by manager, token=%r', token) + kwds['manager_owned'] = True + if token.id not in server.id_to_local_proxy_obj: + server.id_to_local_proxy_obj[token.id] = \ + server.id_to_obj[token.id] + incref = ( + kwds.pop('incref', True) and + not getattr(process.current_process(), '_inheriting', False) + ) + return func(token, serializer, incref=incref, **kwds) + +# +# Functions to create proxies and proxy types +# + +def MakeProxyType(name, exposed, _cache={}): + ''' + Return a proxy type whose methods are given by `exposed` + ''' + exposed = tuple(exposed) + try: + return _cache[(name, exposed)] + except KeyError: + pass + + dic = {} + + for meth in exposed: + exec('''def %s(self, /, *args, **kwds): + return self._callmethod(%r, args, kwds)''' % (meth, meth), dic) + + ProxyType = type(name, (BaseProxy,), dic) + ProxyType._exposed_ = exposed + _cache[(name, exposed)] = ProxyType + return ProxyType + + +def AutoProxy(token, serializer, manager=None, authkey=None, + exposed=None, incref=True, manager_owned=False): + ''' + Return an auto-proxy for `token` + ''' + _Client = listener_client[serializer][1] + + if exposed is None: + conn = _Client(token.address, authkey=authkey) + try: + exposed = dispatch(conn, None, 'get_methods', (token,)) + finally: + conn.close() + + if authkey is None and manager is not None: + authkey = manager._authkey + if authkey is None: + authkey = process.current_process().authkey + + ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) + proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, + incref=incref, manager_owned=manager_owned) + proxy._isauto = True + return proxy + +# +# Types/callables which we will register with SyncManager +# + +class Namespace(object): + def __init__(self, /, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = list(self.__dict__.items()) + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return '%s(%s)' % (self.__class__.__name__, ', '.join(temp)) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def get(self): + return self._value + def set(self, value): + self._value = value + def __repr__(self): + return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) + value = property(get, set) + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +# +# Proxy types used by SyncManager +# + +class IteratorProxy(BaseProxy): + _exposed_ = ('__next__', 'send', 'throw', 'close') + def __iter__(self): + return self + def __next__(self, *args): + return self._callmethod('__next__', args) + def send(self, *args): + return self._callmethod('send', args) + def throw(self, *args): + return self._callmethod('throw', args) + def close(self, *args): + return self._callmethod('close', args) + + +class AcquirerProxy(BaseProxy): + _exposed_ = ('acquire', 'release') + def acquire(self, blocking=True, timeout=None): + args = (blocking,) if timeout is None else (blocking, timeout) + return self._callmethod('acquire', args) + def release(self): + return self._callmethod('release') + def __enter__(self): + return self._callmethod('acquire') + def __exit__(self, exc_type, exc_val, exc_tb): + return self._callmethod('release') + + +class ConditionProxy(AcquirerProxy): + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + def notify(self, n=1): + return self._callmethod('notify', (n,)) + def notify_all(self): + return self._callmethod('notify_all') + def wait_for(self, predicate, timeout=None): + result = predicate() + if result: + return result + if timeout is not None: + endtime = time.monotonic() + timeout + else: + endtime = None + waittime = None + while not result: + if endtime is not None: + waittime = endtime - time.monotonic() + if waittime <= 0: + break + self.wait(waittime) + result = predicate() + return result + + +class EventProxy(BaseProxy): + _exposed_ = ('is_set', 'set', 'clear', 'wait') + def is_set(self): + return self._callmethod('is_set') + def set(self): + return self._callmethod('set') + def clear(self): + return self._callmethod('clear') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + + +class BarrierProxy(BaseProxy): + _exposed_ = ('__getattribute__', 'wait', 'abort', 'reset') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + def abort(self): + return self._callmethod('abort') + def reset(self): + return self._callmethod('reset') + @property + def parties(self): + return self._callmethod('__getattribute__', ('parties',)) + @property + def n_waiting(self): + return self._callmethod('__getattribute__', ('n_waiting',)) + @property + def broken(self): + return self._callmethod('__getattribute__', ('broken',)) + + +class NamespaceProxy(BaseProxy): + _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') + def __getattr__(self, key): + if key[0] == '_': + return object.__getattribute__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__getattribute__', (key,)) + def __setattr__(self, key, value): + if key[0] == '_': + return object.__setattr__(self, key, value) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__setattr__', (key, value)) + def __delattr__(self, key): + if key[0] == '_': + return object.__delattr__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__delattr__', (key,)) + + +class ValueProxy(BaseProxy): + _exposed_ = ('get', 'set') + def get(self): + return self._callmethod('get') + def set(self, value): + return self._callmethod('set', (value,)) + value = property(get, set) + + __class_getitem__ = classmethod(types.GenericAlias) + + +BaseListProxy = MakeProxyType('BaseListProxy', ( + '__add__', '__contains__', '__delitem__', '__getitem__', '__len__', + '__mul__', '__reversed__', '__rmul__', '__setitem__', + 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', + 'reverse', 'sort', '__imul__' + )) +class ListProxy(BaseListProxy): + def __iadd__(self, value): + self._callmethod('extend', (value,)) + return self + def __imul__(self, value): + self._callmethod('__imul__', (value,)) + return self + + +DictProxy = MakeProxyType('DictProxy', ( + '__contains__', '__delitem__', '__getitem__', '__iter__', '__len__', + '__setitem__', 'clear', 'copy', 'get', 'items', + 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' + )) +DictProxy._method_to_typeid_ = { + '__iter__': 'Iterator', + } + + +ArrayProxy = MakeProxyType('ArrayProxy', ( + '__len__', '__getitem__', '__setitem__' + )) + + +BasePoolProxy = MakeProxyType('PoolProxy', ( + 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', + 'map', 'map_async', 'starmap', 'starmap_async', 'terminate', + )) +BasePoolProxy._method_to_typeid_ = { + 'apply_async': 'AsyncResult', + 'map_async': 'AsyncResult', + 'starmap_async': 'AsyncResult', + 'imap': 'Iterator', + 'imap_unordered': 'Iterator' + } +class PoolProxy(BasePoolProxy): + def __enter__(self): + return self + def __exit__(self, exc_type, exc_val, exc_tb): + self.terminate() + +# +# Definition of SyncManager +# + +class SyncManager(BaseManager): + ''' + Subclass of `BaseManager` which supports a number of shared object types. + + The types registered are those intended for the synchronization + of threads, plus `dict`, `list` and `Namespace`. + + The `multiprocessing.Manager()` function creates started instances of + this class. + ''' + +SyncManager.register('Queue', queue.Queue) +SyncManager.register('JoinableQueue', queue.Queue) +SyncManager.register('Event', threading.Event, EventProxy) +SyncManager.register('Lock', threading.Lock, AcquirerProxy) +SyncManager.register('RLock', threading.RLock, AcquirerProxy) +SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) +SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, + AcquirerProxy) +SyncManager.register('Condition', threading.Condition, ConditionProxy) +SyncManager.register('Barrier', threading.Barrier, BarrierProxy) +SyncManager.register('Pool', pool.Pool, PoolProxy) +SyncManager.register('list', list, ListProxy) +SyncManager.register('dict', dict, DictProxy) +SyncManager.register('Value', Value, ValueProxy) +SyncManager.register('Array', Array, ArrayProxy) +SyncManager.register('Namespace', Namespace, NamespaceProxy) + +# types returned by methods of PoolProxy +SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) +SyncManager.register('AsyncResult', create_method=False) + +# +# Definition of SharedMemoryManager and SharedMemoryServer +# + +if HAS_SHMEM: + class _SharedMemoryTracker: + "Manages one or more shared memory segments." + + def __init__(self, name, segment_names=[]): + self.shared_memory_context_name = name + self.segment_names = segment_names + + def register_segment(self, segment_name): + "Adds the supplied shared memory block name to tracker." + util.debug(f"Register segment {segment_name!r} in pid {getpid()}") + self.segment_names.append(segment_name) + + def destroy_segment(self, segment_name): + """Calls unlink() on the shared memory block with the supplied name + and removes it from the list of blocks being tracked.""" + util.debug(f"Destroy segment {segment_name!r} in pid {getpid()}") + self.segment_names.remove(segment_name) + segment = shared_memory.SharedMemory(segment_name) + segment.close() + segment.unlink() + + def unlink(self): + "Calls destroy_segment() on all tracked shared memory blocks." + for segment_name in self.segment_names[:]: + self.destroy_segment(segment_name) + + def __del__(self): + util.debug(f"Call {self.__class__.__name__}.__del__ in {getpid()}") + self.unlink() + + def __getstate__(self): + return (self.shared_memory_context_name, self.segment_names) + + def __setstate__(self, state): + self.__init__(*state) + + + class SharedMemoryServer(Server): + + public = Server.public + \ + ['track_segment', 'release_segment', 'list_segments'] + + def __init__(self, *args, **kwargs): + Server.__init__(self, *args, **kwargs) + address = self.address + # The address of Linux abstract namespaces can be bytes + if isinstance(address, bytes): + address = os.fsdecode(address) + self.shared_memory_context = \ + _SharedMemoryTracker(f"shm_{address}_{getpid()}") + util.debug(f"SharedMemoryServer started by pid {getpid()}") + + def create(self, c, typeid, /, *args, **kwargs): + """Create a new distributed-shared object (not backed by a shared + memory block) and return its id to be used in a Proxy Object.""" + # Unless set up as a shared proxy, don't make shared_memory_context + # a standard part of kwargs. This makes things easier for supplying + # simple functions. + if hasattr(self.registry[typeid][-1], "_shared_memory_proxy"): + kwargs['shared_memory_context'] = self.shared_memory_context + return Server.create(self, c, typeid, *args, **kwargs) + + def shutdown(self, c): + "Call unlink() on all tracked shared memory, terminate the Server." + self.shared_memory_context.unlink() + return Server.shutdown(self, c) + + def track_segment(self, c, segment_name): + "Adds the supplied shared memory block name to Server's tracker." + self.shared_memory_context.register_segment(segment_name) + + def release_segment(self, c, segment_name): + """Calls unlink() on the shared memory block with the supplied name + and removes it from the tracker instance inside the Server.""" + self.shared_memory_context.destroy_segment(segment_name) + + def list_segments(self, c): + """Returns a list of names of shared memory blocks that the Server + is currently tracking.""" + return self.shared_memory_context.segment_names + + + class SharedMemoryManager(BaseManager): + """Like SyncManager but uses SharedMemoryServer instead of Server. + + It provides methods for creating and returning SharedMemory instances + and for creating a list-like object (ShareableList) backed by shared + memory. It also provides methods that create and return Proxy Objects + that support synchronization across processes (i.e. multi-process-safe + locks and semaphores). + """ + + _Server = SharedMemoryServer + + def __init__(self, *args, **kwargs): + if os.name == "posix": + # bpo-36867: Ensure the resource_tracker is running before + # launching the manager process, so that concurrent + # shared_memory manipulation both in the manager and in the + # current process does not create two resource_tracker + # processes. + from . import resource_tracker + resource_tracker.ensure_running() + BaseManager.__init__(self, *args, **kwargs) + util.debug(f"{self.__class__.__name__} created by pid {getpid()}") + + def __del__(self): + util.debug(f"{self.__class__.__name__}.__del__ by pid {getpid()}") + pass + + def get_server(self): + 'Better than monkeypatching for now; merge into Server ultimately' + if self._state.value != State.INITIAL: + if self._state.value == State.STARTED: + raise ProcessError("Already started SharedMemoryServer") + elif self._state.value == State.SHUTDOWN: + raise ProcessError("SharedMemoryManager has shut down") + else: + raise ProcessError( + "Unknown state {!r}".format(self._state.value)) + return self._Server(self._registry, self._address, + self._authkey, self._serializer) + + def SharedMemory(self, size): + """Returns a new SharedMemory instance with the specified size in + bytes, to be tracked by the manager.""" + with self._Client(self._address, authkey=self._authkey) as conn: + sms = shared_memory.SharedMemory(None, create=True, size=size) + try: + dispatch(conn, None, 'track_segment', (sms.name,)) + except BaseException as e: + sms.unlink() + raise e + return sms + + def ShareableList(self, sequence): + """Returns a new ShareableList instance populated with the values + from the input sequence, to be tracked by the manager.""" + with self._Client(self._address, authkey=self._authkey) as conn: + sl = shared_memory.ShareableList(sequence) + try: + dispatch(conn, None, 'track_segment', (sl.shm.name,)) + except BaseException as e: + sl.shm.unlink() + raise e + return sl diff --git a/shared/package-files/32/32d7b39c6d2ac9779b4db6f614a27f512ae15781dc3da39011b9a4da003f24fd/blob b/shared/package-files/32/32d7b39c6d2ac9779b4db6f614a27f512ae15781dc3da39011b9a4da003f24fd/blob new file mode 100644 index 0000000000000000000000000000000000000000..ddcb0dc25ad9d91e2069a7d5edcddccbfcf3df59 --- /dev/null +++ b/shared/package-files/32/32d7b39c6d2ac9779b4db6f614a27f512ae15781dc3da39011b9a4da003f24fd/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API ::std::tuple _aminmax_out(at::Tensor & out0, at::Tensor & out1, const at::Tensor & self); +TORCH_API ::std::tuple _aminmax_outf(const at::Tensor & self, at::Tensor & out0, at::Tensor & out1); +TORCH_API ::std::tuple _aminmax_out(at::Tensor & out0, at::Tensor & out1, const at::Tensor & self, int64_t dim, bool keepdim=false); +TORCH_API ::std::tuple _aminmax_outf(const at::Tensor & self, int64_t dim, bool keepdim, at::Tensor & out0, at::Tensor & out1); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/32/32dbb792fde36c675a0ba941c5f3a69effbf53e5abf20792bf0a76aeeda899ff/blob b/shared/package-files/32/32dbb792fde36c675a0ba941c5f3a69effbf53e5abf20792bf0a76aeeda899ff/blob new file mode 100644 index 0000000000000000000000000000000000000000..4bfc4c60e91026f35bc87ba5ed791c3e1d6abd6b --- /dev/null +++ b/shared/package-files/32/32dbb792fde36c675a0ba941c5f3a69effbf53e5abf20792bf0a76aeeda899ff/blob @@ -0,0 +1,826 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates +import itertools +from typing import cast, List, Optional, Sequence, Tuple + +import torch + +from torch.distributed._tensor._utils import compute_local_shape +from torch.distributed._tensor.op_schema import ( + OpSchema, + OpStrategy, + OutputSharding, + PlacementStrategy, + RuntimeSchemaInfo, + StrategyType, + TupleStrategy, +) +from torch.distributed._tensor.ops.common_rules import pointwise_rule +from torch.distributed._tensor.ops.embedding_ops import _MaskPartial +from torch.distributed._tensor.ops.utils import ( + generate_redistribute_costs, + is_tensor_dim_sharded, + is_tensor_partial, + is_tensor_shardable, + normalize_dim, + prod, + register_op_strategy, + register_prop_rule, +) +from torch.distributed._tensor.placement_types import ( + _Partial, + DTensorSpec, + Placement, + Replicate, + Shard, +) +from torch.distributed.device_mesh import DeviceMesh + + +aten = torch.ops.aten + + +def default_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + # Default strategy by default just propagate the first input strategy + select_strategy = op_schema.args_schema[0] + assert isinstance(select_strategy, OpStrategy) + default_strategy = [] + for strategy in select_strategy.strategies: + # we create new DTensorSpecs even for default strategy to assure that + # the tensor metas are distinct between the arguments and outputs + default_strategy.append( + PlacementStrategy( + output_specs=DTensorSpec( + mesh=strategy.output_spec.mesh, + placements=strategy.output_spec.placements, + ) + ) + ) + return OpStrategy(default_strategy) + + +register_op_strategy( + [ + aten.clone.default, + aten.contiguous.default, + aten.copy_.default, + aten.detach.default, + aten.fill_.Scalar, + aten.zero_.default, + ] +)(default_strategy) + +register_op_strategy( + aten._to_copy.default, schema_info=RuntimeSchemaInfo(static_kwargkey=["dtype"]) +)(default_strategy) + + +@register_op_strategy( + [ + aten.equal.default, + aten.is_same_size.default, + ] +) +def equal_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + # equal_strategy deals with ops that comparing two tensor, we need to make sure + # sharding layout the same with two operands, we choose to follow the arg with max + # num of shards, still keep is_same_size here for completeness as they share the + # same strategy in theory. + self_strategy, other_strategy = op_schema.args_schema + assert isinstance(self_strategy, OpStrategy) + assert isinstance(other_strategy, OpStrategy) + + select_strategy = ( + self_strategy + if self_strategy.max_num_shards() >= other_strategy.max_num_shards() + else other_strategy + ) + equal_strategy = OpStrategy([]) + + for arg_strategy in select_strategy.strategies: + arg_spec = arg_strategy.output_spec + if is_tensor_partial(arg_spec): + # if the arg_spec have partial, reshard to replicate + # otherwise local shard tensor comparison would be invalid + output_spec = DTensorSpec( + mesh=arg_spec.mesh, + placements=tuple( + Replicate() if isinstance(p, _Partial) else p + for p in arg_spec.placements + ), + ) + equal_strategy.strategies.append( + PlacementStrategy(output_specs=output_spec) + ) + else: + equal_strategy.strategies.append(PlacementStrategy(arg_spec)) + return equal_strategy + + +@register_op_strategy( + [ + aten.empty_like.default, + aten.ones_like.default, + aten.rand_like.default, + aten.randn_like.default, + aten.zeros_like.default, + ], + schema_info=RuntimeSchemaInfo(1, ["dtype"]), +) +@register_op_strategy( + [aten.full_like.default], + schema_info=RuntimeSchemaInfo(2, ["dtype"]), +) +@register_op_strategy( + [ + aten.randint_like.default, + aten.randint_like.low_dtype, + aten.randint_like.low_dtype_out, + ], + schema_info=RuntimeSchemaInfo(3, ["dtype"]), +) +def create_like_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + # create_like_strategy deals with ops that creating tensors with same + # shape as input, but with specific content that does not depend on + # the input, we can propagate sharding, but we have to make sure we + # move from partial to replicated. + select_strategy = op_schema.args_schema[0] + create_like_strategy = OpStrategy([]) + assert isinstance(select_strategy, OpStrategy) + for arg_strategy in select_strategy.strategies: + arg_spec = arg_strategy.output_spec + if is_tensor_partial(arg_spec): + # if the arg_spec have partial, accept partial + # in the input_specs but output replicate for + # those corresponding mesh dims + output_spec = DTensorSpec( + mesh=arg_spec.mesh, + placements=tuple( + Replicate() if isinstance(p, _Partial) else p + for p in arg_spec.placements + ), + ) + create_like_strategy.strategies.append( + PlacementStrategy(output_specs=output_spec, input_specs=(arg_spec,)) + ) + + else: + create_like_strategy.strategies.append(PlacementStrategy(arg_spec)) + + return create_like_strategy + + +@register_op_strategy( + [ + aten.new_empty.default, + aten.new_full.default, + aten.new_ones.default, + aten.new_zeros.default, + aten.new_empty_strided.default, # TODO: re-think new_empty_strided + ], + schema_info=RuntimeSchemaInfo(1, ["dtype"]), +) +def new_factory_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + # TODO: maybe we should generate all possible shardings intead of just stay + # replicated for new factory methods + input_strategy = op_schema.args_schema[0] + new_factory_strategy = OpStrategy([]) + assert isinstance(input_strategy, OpStrategy) + for arg_strategy in input_strategy.strategies: + input_spec = arg_strategy.output_spec + replica_spec = DTensorSpec(mesh, tuple([Replicate()] * mesh.ndim)) + new_factory_strategy.strategies.append( + PlacementStrategy(output_specs=replica_spec, input_specs=(input_spec,)) + ) + + return new_factory_strategy + + +@register_op_strategy(aten.bucketize.Tensor) +def gen_bucketize_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + """Just propagate input sharding, but expect replicated for boundaries input.""" + input_strategy = op_schema.args_schema[0] + bucketize_strategy = OpStrategy([]) + assert isinstance(input_strategy, OpStrategy) + for arg_strategy in input_strategy.strategies: + arg_spec = DTensorSpec(mesh, arg_strategy.output_spec.placements) + replica_spec = DTensorSpec(mesh, tuple([Replicate()] * mesh.ndim)) + bucketize_strategy.strategies.append( + PlacementStrategy( + output_specs=arg_spec, input_specs=(arg_spec, replica_spec) + ) + ) + + return bucketize_strategy + + +@register_op_strategy(aten.slice.Tensor, schema_info=RuntimeSchemaInfo(1)) +def gen_slice_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + """Forward all shardings except the slice dimension.""" + defaults = (None, 0, None, None, 1) + input_strategy, dim, start, end, step = ( + op_schema.args_schema + defaults[len(op_schema.args_schema) :] + ) + assert isinstance(input_strategy, OpStrategy) + input_shape = input_strategy.output_shape + input_ndim = input_strategy.output_ndim + assert isinstance(dim, int) + if start is None: + start = 0 + if end is None or end > input_shape[dim]: + end = input_shape[dim] + assert isinstance(start, int) + assert isinstance(end, int) + assert isinstance(step, int) + + # normalize args + slice_dim = normalize_dim(dim, input_ndim) + start = normalize_dim(start, input_shape[dim]) + end = normalize_dim(end, input_shape[dim]) + + redundant_slice = start == 0 and end == input_shape[dim] and step == 1 + + slice_strategy = OpStrategy([]) + + for arg_strategy in input_strategy.strategies: + arg_spec = arg_strategy.output_spec + if not is_tensor_dim_sharded(arg_spec, dim=slice_dim) or redundant_slice: + # only add the strategy if the slice dim is not sharded + out_spec = DTensorSpec(mesh, arg_spec.placements) + slice_strategy.strategies.append(PlacementStrategy(output_specs=out_spec)) + if not slice_strategy.strategies: + # if all strategies are filtered out, unsharding all specs on slice dim + # of the input strategy, and use that as the op strategy + for arg_strategy in input_strategy.strategies: + arg_spec = arg_strategy.output_spec + unshard_spec = DTensorSpec( + mesh, unshard_tensor_dim(arg_spec.placements, dim=slice_dim) + ) + slice_strategy.strategies.append( + PlacementStrategy(output_specs=unshard_spec) + ) + return slice_strategy + + +def unshard_tensor_dim( + placements: Sequence[Placement], dim: int +) -> Tuple[Placement, ...]: + """Disallow the given tensor dimension to be sharded.""" + return tuple( + p if (not isinstance(p, Shard) or p.dim != dim) else Replicate() + for p in placements + ) + + +def replicate_tensor_dim( + placements: Sequence[Placement], dim: int +) -> Tuple[Placement, ...]: + """Force the given tensor dimension to be replicated.""" + # Not using p.is_shard() to avoid mypy complain about Placement not having + # attribute dim. + return tuple( + Replicate() if p.is_partial() or isinstance(p, Shard) and p.dim == dim else p + for p in placements + ) + + +@register_op_strategy(aten.slice_scatter.default, schema_info=RuntimeSchemaInfo(2)) +def gen_slice_scatter_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + # 1. number of dimensions in input and src need to match. + # 2. number of elements on all non-dim need to match between input and src. + # 3. numer of elements in src in dim need to match the slice size. + # Given the above: + # - We suggest for src to follow the sharding of input, except on the scatter dimension, + # where our best bet for now is to make them replicated as a fall-back. + # TODO: Ideally we'd like to make sure the output is re-sharded afterwards to keep input sharding. + + input_strategy = op_schema.args_schema[0] + assert isinstance(input_strategy, OpStrategy) + input_ndim = input_strategy.output_ndim + slice_dim = ( + cast(int, op_schema.args_schema[2]) if len(op_schema.args_schema) > 2 else 0 + ) + slice_dim = normalize_dim(slice_dim, input_ndim) + + slice_scatter_strategy = OpStrategy([]) + # by default follow the input strategy for both input and src + for arg_strategy in input_strategy.strategies: + arg_spec = arg_strategy.output_spec + if not ( + is_tensor_dim_sharded(arg_spec, dim=slice_dim) + or is_tensor_partial(arg_spec) + ): + # only add the strategy if the slice_scatter dim is not sharded or partial + slice_scatter_strategy.strategies.append( + PlacementStrategy(output_specs=arg_spec) + ) + + if not slice_scatter_strategy.strategies: + # if all strategies are filtered out, replicating all specs on slice_scatter dim + # of the input strategy, and use that as the op strategy + for arg_strategy in input_strategy.strategies: + arg_spec = arg_strategy.output_spec + replicate_spec = DTensorSpec( + mesh, replicate_tensor_dim(arg_spec.placements, dim=slice_dim) + ) + slice_scatter_strategy.strategies.append( + PlacementStrategy(output_specs=replicate_spec) + ) + return slice_scatter_strategy + + +@register_op_strategy(aten._local_scalar_dense.default) +def replica_only_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + """Only allow replication on the input/output.""" + replicate_spec = DTensorSpec(mesh, tuple([Replicate()] * mesh.ndim)) + return OpStrategy([PlacementStrategy(replicate_spec)]) + + +@register_op_strategy(aten.gather.default) +def gather_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + input_strategy = cast(OpStrategy, op_schema.args_schema[0]) + dim = cast(int, op_schema.args_schema[1]) + index_strategy = cast(OpStrategy, op_schema.args_schema[2]) + + input_shape = input_strategy.output_shape + index_shape = index_strategy.output_shape + + all_mesh_dim_strategies = [] + + for mesh_dim in range(mesh.ndim): + single_mesh_dim_strategies = [] + + # placement list stores placements of [output, input, index] + # first we always have replicate all for inputs and output + all_replicate: List[Placement] = [Replicate()] * 3 + single_mesh_dim_strategies.append(all_replicate) + + # input sharding, input sharded, index accepts mask partial, output follows index + # this only works when the input is sharded on the gather dimension, and + # index has size 1 on the gather dimension + if index_shape[dim] == 1: + index_partial_placement = _MaskPartial(logical_dim_size=input_shape[dim]) + input_sharding = [ + index_partial_placement, + Shard(dim), + index_partial_placement, + ] + single_mesh_dim_strategies.append(input_sharding) + + # index sharding, input replicated, index sharded, output follows index + # this only works when the sharding dimension is the gather dimension + index_sharding = [Shard(dim), Replicate(), Shard(dim)] + single_mesh_dim_strategies.append(index_sharding) + + all_mesh_dim_strategies.append(single_mesh_dim_strategies) + + strategy_combs = itertools.product(*all_mesh_dim_strategies) + + all_strategies = [] + for strategy_comb in strategy_combs: + spec_list = [] + for specs in zip(*strategy_comb): + spec_list.append(DTensorSpec(mesh, tuple(specs))) + + if is_tensor_shardable(input_shape, spec_list[1]) and is_tensor_shardable( + index_shape, spec_list[2] + ): + input_spec, index_spec = spec_list[1:] + redistribute_cost = [ + generate_redistribute_costs(input_strategy, input_spec), + generate_redistribute_costs(index_strategy, index_spec), + ] + strat = PlacementStrategy( + output_specs=spec_list[0], + input_specs=spec_list[1:], + redistribute_cost=redistribute_cost, + ) + all_strategies.append(strat) + + return OpStrategy(all_strategies) + + +@register_op_strategy(aten.stack.default, RuntimeSchemaInfo(1, needs_pytree=True)) +def stack_strategy(mesh: DeviceMesh, op_schema: OpSchema) -> StrategyType: + args_schema = op_schema.args_schema + input_tuple_strategy = args_schema[0] + assert isinstance(input_tuple_strategy, TupleStrategy), f"{input_tuple_strategy}" + dim = cast(int, args_schema[1]) if len(args_schema) > 1 else 0 + + # Follow the 1st child strategy's placement strategies + child_strategy = input_tuple_strategy.childs[0] + assert isinstance(child_strategy, OpStrategy), f"{child_strategy}" + strategies: List[PlacementStrategy] = [] + + # For each arg strategy of the child to follow, we check if every other + # child has an equal strategy. If so, then that is a valid strategy. If + # there are no such valid strategies, then we replicate. + for arg_strategy in child_strategy.strategies: + arg_spec = arg_strategy.output_spec + # For each arg strategy (whether the one to follow or other), we + # replicate the stack dim since we cannot stack on a sharded dim + if is_tensor_dim_sharded(arg_spec, dim): + arg_spec = DTensorSpec( + mesh, unshard_tensor_dim(arg_spec.placements, dim=dim) + ) + all_compatible = True + for other_child_strategy in input_tuple_strategy.childs[1:]: + has_compatible_strategy = False + assert isinstance( + other_child_strategy, OpStrategy + ), f"{other_child_strategy}" + for other_arg_strategy in other_child_strategy.strategies: + other_arg_spec = other_arg_strategy.output_spec + if is_tensor_dim_sharded(other_arg_spec, dim): + other_arg_spec = DTensorSpec( + mesh, unshard_tensor_dim(other_arg_spec.placements, dim=dim) + ) + if other_arg_spec.placements == arg_spec.placements: + has_compatible_strategy = True + break + if not has_compatible_strategy: + all_compatible = False + break + if all_compatible: + input_specs = tuple( + arg_spec for _ in range(len(input_tuple_strategy.childs)) + ) + strategies.append( + PlacementStrategy( + output_specs=DTensorSpec(mesh, arg_spec.placements), + input_specs=input_specs, + ) + ) + if not strategies: + # Arbitrarily use each child strategy's 0th strategy's output spec + input_specs = tuple( + cast(OpStrategy, child_strategy).strategies[0].output_spec + for child_strategy in input_tuple_strategy.childs + ) + replicate_spec = DTensorSpec(mesh, tuple(Replicate() for _ in range(mesh.ndim))) + strategies.append(PlacementStrategy(output_specs=replicate_spec)) + return OpStrategy(strategies) + + +@register_prop_rule(aten.index_select.default, schema_info=RuntimeSchemaInfo(1)) +def prop_index_select(op_schema: OpSchema) -> OutputSharding: + values_spec, dim, indices_spec = op_schema.args_schema + + assert isinstance(values_spec, DTensorSpec) + assert isinstance(dim, int) + assert isinstance(indices_spec, DTensorSpec) + + all_indices_spec: List[Optional[DTensorSpec]] = [ + indices_spec if dim == i else None for i in range(values_spec.ndim) + ] + + result = prop_index( + OpSchema( + op=op_schema.op, + args_schema=(values_spec, all_indices_spec), + kwargs_schema=op_schema.kwargs_schema, + ) + ) + if result.schema_suggestions: + result.schema_suggestions = [ + OpSchema( + op=op_schema.op, + args_schema=(s.args_schema[0], dim, s.args_schema[1][dim]), + kwargs_schema=op_schema.kwargs_schema, + ) + for s in result.schema_suggestions + ] + return result + + +@register_prop_rule(aten.index.Tensor, schema_info=RuntimeSchemaInfo(needs_pytree=True)) +def prop_index(op_schema: OpSchema) -> OutputSharding: + """ + Expect replicated on the first input; _mostly_ pointwise on the second input. + + TODO: exception: when the dtype of second input is "bool", then a torch.nonzero needs to be triggered first. + """ + # Current sharding constraints: + # For values: + # 1. We currently require that the dimension of values_spec be replicated or partial + # if they are being indexed on. + # 2. Other dimensions of values_spec can remain sharded if they are so. + # For indices: + # Indices can be either sharded or replicated. All index tensors need to be sharded + # in a compatible way, following the pointwise rule (including resolving _Partial + # into either sharded or replicated) + + values_spec, multi_indices_spec = op_schema.args_schema + assert isinstance(values_spec, DTensorSpec) + assert isinstance(multi_indices_spec, list) + multi_indices_spec = cast(List[Optional[DTensorSpec]], multi_indices_spec) + valid_indices_spec: List[Tuple[int, DTensorSpec]] = [ + (i, a) for i, a in enumerate(multi_indices_spec) if a is not None + ] + + # 1. All indices have to be sharded equally. Moreover, indices can be broadcast. + # Here, we piggyback on the pointwise sharding rule for indices. + indices_out = pointwise_rule( + OpSchema( + op=op_schema.op, + args_schema=tuple(v[1] for v in valid_indices_spec), + kwargs_schema={}, + ) + ) + need_reshard_on_indices = indices_out.output_spec is None + + if not need_reshard_on_indices: + # this means that our inputs are already sharded properly and we will use that as our indices_spec + assert isinstance(indices_out.output_spec, DTensorSpec) + indices_spec: DTensorSpec = indices_out.output_spec + else: + assert indices_out.schema_suggestions is not None + valid_indices_suggestion = indices_out.schema_suggestions[0] + for i, v in enumerate(valid_indices_suggestion.args_spec): + multi_indices_spec[valid_indices_spec[i][0]] = v + # we'll need to call pointwise_rule again to see what's our ideal indices_spec and then + # use that to compute our ideal values_spec + indices_output_spec = pointwise_rule(valid_indices_suggestion).output_spec + assert isinstance(indices_output_spec, DTensorSpec) + indices_spec = indices_output_spec + + lookup_dims = {v[0] for v in valid_indices_spec} + + need_reshard_on_values = tuple( + (isinstance(vp, Shard) and (vp.dim in lookup_dims or isinstance(ip, Shard))) + for vp, ip in zip(values_spec.placements, indices_spec.placements) + ) + + if not need_reshard_on_indices and not any(need_reshard_on_values): + value_placements = values_spec.placements + + all_dims_consecutive = all( + b[0] - a[0] == 1 + for b, a in zip(valid_indices_spec[1:], valid_indices_spec[:-1]) + ) + if all_dims_consecutive: + # if all index vectors are consecutives, insert at the dimension of the first index + insert_dim: int = valid_indices_spec[0][0] + else: + # else, insert on the first dimension + insert_dim = 0 + + def place(vp: Placement, ip: Placement) -> Placement: + if isinstance(vp, Shard): + return Shard( + vp.dim + if vp.dim < insert_dim + # accounts for the offset in output dimensions + else vp.dim + + indices_spec.ndim + - sum(1 if vp.dim > v[0] else 0 for v in valid_indices_spec) + ) + if isinstance(ip, Shard): + return Shard(ip.dim + insert_dim) + # _Partial or Replicated + return vp + + value_placements = tuple( + place(vp, ip) + for vp, ip in zip(values_spec.placements, indices_spec.placements) + ) + result = OutputSharding( + output_spec=DTensorSpec( + mesh=values_spec.mesh, + placements=value_placements, + ) + ) + return result + else: + result = OutputSharding( + output_spec=None, + schema_suggestions=[ + OpSchema( + op=op_schema.op, + args_schema=( + DTensorSpec( + mesh=values_spec.mesh, + placements=tuple( + [ + Replicate() if need_reshard_on_values[i] else v + for i, v in enumerate(values_spec.placements) + ] + ), + tensor_meta=values_spec.tensor_meta, + ), + multi_indices_spec, + ), + kwargs_schema=op_schema.kwargs_schema, + ) + ], + ) + return result + + +@register_prop_rule( + aten.cat.default, schema_info=RuntimeSchemaInfo(1, needs_pytree=True) +) +def cat_rule(op_schema: OpSchema) -> OutputSharding: + # torch.cat requires all tensors must either have the same shape (except + # in the concatenating dimension) or be "empty". "Empty" here strictly means + # tensor.shape is torch.Size([0]). When tensor.ndim > 1, it will be treated + # as a non-empty tensor and the shape must match on non-cat dimensions. + def is_empty(spec: DTensorSpec) -> bool: + return list(spec.shape) == [0] + + # the first arg is a list of input tensor specs + tensor_list_specs = cast(List[DTensorSpec], op_schema.args_schema[0]) + assert len(tensor_list_specs) > 0, "torch.cat expects a non-empty list of tensors" + non_empty_specs = [spec for spec in tensor_list_specs if not is_empty(spec)] + + if len(non_empty_specs) == 0: + # all tensors are empty, we can return any output sharding + return OutputSharding( + output_spec=DTensorSpec( + mesh=tensor_list_specs[0].mesh, + placements=tensor_list_specs[0].placements, + ) + ) + + assert all( + spec.ndim == non_empty_specs[0].ndim for spec in non_empty_specs + ), f"Expect all tensors to have same shape or empty, but got {tensor_list_specs}" + assert all( + spec.mesh == tensor_list_specs[0].mesh for spec in tensor_list_specs + ), f"Expect all tensors to have same mesh, but got {tensor_list_specs}" + + # ndim will also be the result's ndim + ndim = 1 + for spec in tensor_list_specs: + ndim = max(ndim, spec.ndim) + + dim = 0 # default dim = 0 + if len(op_schema.args_schema) > 1: + dim = cast(int, op_schema.args_schema[1]) + dim = normalize_dim(dim, ndim) + + # Make sure all tensors are replicated on cat dimension + need_reshard = False + tensor_list_specs_after: List[DTensorSpec] = [] + for spec in tensor_list_specs: + if not is_empty(spec) and ( + is_tensor_dim_sharded(spec, dim=dim) or is_tensor_partial(spec) + ): + need_reshard = True + tensor_list_specs_after.append( + DTensorSpec( + mesh=spec.mesh, + placements=replicate_tensor_dim(spec.placements, dim=dim), + tensor_meta=spec.tensor_meta, + ) + ) + else: + tensor_list_specs_after.append(spec) + + tensor_list_specs = tensor_list_specs_after + + # align non-cat dimensions placements based on reshard cost + non_empty_specs = [spec for spec in tensor_list_specs if not is_empty(spec)] + mesh = non_empty_specs[0].mesh + ndim = non_empty_specs[0].ndim + new_placements: List[Placement] = [] + for mesh_dim in range(mesh.ndim): + # compute the minimum cost of resharding on this mesh_dim + if any( + spec.placements[mesh_dim] != non_empty_specs[0].placements[mesh_dim] + for spec in non_empty_specs + ): + # only reshard if there is a mismatch + need_reshard = True + reshard_cost = [] + for shard_dim in range(ndim): + # compute the cost of resharding on this shard_dim + cost: float = 0.0 + for spec in non_empty_specs: + global_shape = spec.shape + if global_shape[shard_dim] < mesh.size(mesh_dim): + # found one tensor where the shard_dim is smaller than + # mesh_dim. In this case, we cannot shard on this shard_dim, + # and hence set cost to infinity. + cost = +float("inf") + elif ( + is_tensor_dim_sharded(spec, dim=shard_dim) + or prod(global_shape) == 0 + ): + continue + else: + local_shape = compute_local_shape( + global_shape, spec.mesh, spec.placements + ) + cost += prod(local_shape) * spec.mesh.size(mesh_dim) + reshard_cost.append(cost) + best_dim = reshard_cost.index(min(reshard_cost)) + new_placements.append(Shard(best_dim)) + else: + # no mismatch, keep the original placement + new_placements.append(non_empty_specs[0].placements[mesh_dim]) + + if need_reshard: + tensor_list_specs_after = [] + for spec in tensor_list_specs: + if is_empty(spec): + tensor_list_specs_after.append(spec) + else: + tensor_list_specs_after.append( + DTensorSpec( + mesh=spec.mesh, + placements=tuple(new_placements), + tensor_meta=spec.tensor_meta, + ) + ) + + return OutputSharding( + output_spec=None, + schema_suggestions=[ + OpSchema( + op=op_schema.op, + args_schema=( + tuple(tensor_list_specs_after), + *op_schema.args_schema[1:], + ), + kwargs_schema=op_schema.kwargs_schema, + ), + ], + ) + else: + # at this point, the cat dim is not sharded, + return OutputSharding( + output_spec=DTensorSpec( + mesh=non_empty_specs[0].mesh, + placements=non_empty_specs[0].placements, + ), + ) + + +@register_prop_rule( + [ + aten.split.Tensor, + aten.split_with_sizes.default, + aten.split_with_sizes_copy.default, + ], + schema_info=RuntimeSchemaInfo(1), +) +def split_rule(op_schema: OpSchema) -> OutputSharding: + output_spec_list: List[DTensorSpec] = [] + input_spec = cast(DTensorSpec, op_schema.args_schema[0]) + ndim = input_spec.ndim + split_size_or_sections = op_schema.args_schema[1] + dim = cast(int, op_schema.args_schema[2]) if len(op_schema.args_schema) > 2 else 0 + dim = normalize_dim(dim, ndim) + + # TODO: tensor to split cannot have _Partial + # in its placements for now. Will need to + # support in future. + if input_spec.sums: + raise NotImplementedError( + f"splitting distributed tensor with " + f"_Partial placement is not implemented!\n" + f"DTensorSpec={input_spec}" + ) + + # TODO: just like slice op, split replicates before + # splitting on a sharded dimension + need_reshard = False + if is_tensor_dim_sharded(input_spec, dim=dim): + need_reshard = True + input_spec = DTensorSpec( + mesh=input_spec.mesh, + placements=unshard_tensor_dim(input_spec.placements, dim=dim), + tensor_meta=input_spec.tensor_meta, + ) + + if need_reshard: + return OutputSharding( + None, + schema_suggestions=[ + OpSchema( + op=op_schema.op, + args_schema=(input_spec,) + op_schema.args_schema[1:], + kwargs_schema=op_schema.kwargs_schema, + ), + ], + ) + + def size_split(N, i): + # Last chunk will be smaller if the tensor size N + # along the given dimension dim is not divisible by i. + assert i > 0 + return [i] * (N // i) + ([N % i] if N % i != 0 else []) + + output_size_list = ( + size_split(input_spec.shape[dim], split_size_or_sections) + if isinstance(split_size_or_sections, int) + else split_size_or_sections + ) + output_spec_list = [ + DTensorSpec( + mesh=input_spec.mesh, + placements=input_spec.placements, + ) + for _ in range(len(output_size_list)) + ] + return OutputSharding(output_spec_list) diff --git a/shared/package-files/32/32de5ee25f7844229b5c8e66106b6d6719be546cb4e27e822fd09f97359a923d/blob b/shared/package-files/32/32de5ee25f7844229b5c8e66106b6d6719be546cb4e27e822fd09f97359a923d/blob new file mode 100644 index 0000000000000000000000000000000000000000..729802d12c2b3800e16b3bda2cf4e94103ae6190 --- /dev/null +++ b/shared/package-files/32/32de5ee25f7844229b5c8e66106b6d6719be546cb4e27e822fd09f97359a923d/blob @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor _grid_sampler_2d_cpu_fallback(const at::Tensor & input, const at::Tensor & grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners); +TORCH_API at::Tensor & _grid_sampler_2d_cpu_fallback_out(const at::Tensor & input, const at::Tensor & grid, int64_t interpolation_mode, int64_t padding_mode, bool align_corners, at::Tensor & out); +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32e04197156a3fa7beb848525b8c5ff82f10cb185190c4f9bb1e6013f256e84a/blob b/shared/package-files/32/32e04197156a3fa7beb848525b8c5ff82f10cb185190c4f9bb1e6013f256e84a/blob new file mode 100644 index 0000000000000000000000000000000000000000..40a12ecd8d81e8dd872987775c81e8315eb7f963 --- /dev/null +++ b/shared/package-files/32/32e04197156a3fa7beb848525b8c5ff82f10cb185190c4f9bb1e6013f256e84a/blob @@ -0,0 +1,27 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeMetaFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace at { +namespace meta { + +struct TORCH_API structured_atan2 : public TensorIteratorBase { + + + void meta(const at::Tensor & self, const at::Tensor & other); +}; + +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32e10562a1687b7884c3eb25c46fc0af809de6ddb1f4e249217f3f4a23c1c411/blob b/shared/package-files/32/32e10562a1687b7884c3eb25c46fc0af809de6ddb1f4e249217f3f4a23c1c411/blob new file mode 100644 index 0000000000000000000000000000000000000000..ed841d4da7d42e53b7143a1bd7fc3a3af979f630 --- /dev/null +++ b/shared/package-files/32/32e10562a1687b7884c3eb25c46fc0af809de6ddb1f4e249217f3f4a23c1c411/blob @@ -0,0 +1,14 @@ +import torch +from torch._C import _ImperativeEngine as ImperativeEngine + + +__all__ = ["VariableMeta", "Variable"] + + +class VariableMeta(type): + def __instancecheck__(cls, other): + return isinstance(other, torch.Tensor) + + +class Variable(torch._C._LegacyVariableBase, metaclass=VariableMeta): # type: ignore[misc] + _execution_engine = ImperativeEngine() diff --git a/shared/package-files/32/32e1228d940d3e77ddc361207c80f8c996eff6b2ad9b5070331b0a31820727d4/blob b/shared/package-files/32/32e1228d940d3e77ddc361207c80f8c996eff6b2ad9b5070331b0a31820727d4/blob new file mode 100644 index 0000000000000000000000000000000000000000..27b20e4ebb0046bb4dbe189d212ad2c5099dd946 --- /dev/null +++ b/shared/package-files/32/32e1228d940d3e77ddc361207c80f8c996eff6b2ad9b5070331b0a31820727d4/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace meta { + +TORCH_API at::Tensor digamma(const at::Tensor & self); +TORCH_API at::Tensor & digamma_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & digamma_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & digamma_(at::Tensor & self); + +} // namespace meta +} // namespace at diff --git a/shared/package-files/32/32e308ccffa8ba2b91b935393e606d53e5e4ff406dbb89b29be0b6d0cf25379f/blob b/shared/package-files/32/32e308ccffa8ba2b91b935393e606d53e5e4ff406dbb89b29be0b6d0cf25379f/blob new file mode 100644 index 0000000000000000000000000000000000000000..cca168bb0db5014db095ae398ac888580a056850 --- /dev/null +++ b/shared/package-files/32/32e308ccffa8ba2b91b935393e606d53e5e4ff406dbb89b29be0b6d0cf25379f/blob @@ -0,0 +1,186 @@ +from sympy.core import I, symbols, Basic, Mul, S +from sympy.core.mul import mul +from sympy.functions import adjoint, transpose +from sympy.matrices.common import ShapeError +from sympy.matrices import (Identity, Inverse, Matrix, MatrixSymbol, ZeroMatrix, + eye, ImmutableMatrix) +from sympy.matrices.expressions import Adjoint, Transpose, det, MatPow +from sympy.matrices.expressions.special import GenericIdentity +from sympy.matrices.expressions.matmul import (factor_in_front, remove_ids, + MatMul, combine_powers, any_zeros, unpack, only_squares) +from sympy.strategies import null_safe +from sympy.assumptions.ask import Q +from sympy.assumptions.refine import refine +from sympy.core.symbol import Symbol + +from sympy.testing.pytest import XFAIL, raises + +n, m, l, k = symbols('n m l k', integer=True) +x = symbols('x') +A = MatrixSymbol('A', n, m) +B = MatrixSymbol('B', m, l) +C = MatrixSymbol('C', n, n) +D = MatrixSymbol('D', n, n) +E = MatrixSymbol('E', m, n) + +def test_evaluate(): + assert MatMul(C, C, evaluate=True) == MatMul(C, C).doit() + +def test_adjoint(): + assert adjoint(A*B) == Adjoint(B)*Adjoint(A) + assert adjoint(2*A*B) == 2*Adjoint(B)*Adjoint(A) + assert adjoint(2*I*C) == -2*I*Adjoint(C) + + M = Matrix(2, 2, [1, 2 + I, 3, 4]) + MA = Matrix(2, 2, [1, 3, 2 - I, 4]) + assert adjoint(M) == MA + assert adjoint(2*M) == 2*MA + assert adjoint(MatMul(2, M)) == MatMul(2, MA).doit() + + +def test_transpose(): + assert transpose(A*B) == Transpose(B)*Transpose(A) + assert transpose(2*A*B) == 2*Transpose(B)*Transpose(A) + assert transpose(2*I*C) == 2*I*Transpose(C) + + M = Matrix(2, 2, [1, 2 + I, 3, 4]) + MT = Matrix(2, 2, [1, 3, 2 + I, 4]) + assert transpose(M) == MT + assert transpose(2*M) == 2*MT + assert transpose(x*M) == x*MT + assert transpose(MatMul(2, M)) == MatMul(2, MT).doit() + + +def test_factor_in_front(): + assert factor_in_front(MatMul(A, 2, B, evaluate=False)) ==\ + MatMul(2, A, B, evaluate=False) + + +def test_remove_ids(): + assert remove_ids(MatMul(A, Identity(m), B, evaluate=False)) == \ + MatMul(A, B, evaluate=False) + assert null_safe(remove_ids)(MatMul(Identity(n), evaluate=False)) == \ + MatMul(Identity(n), evaluate=False) + + +def test_combine_powers(): + assert combine_powers(MatMul(D, Inverse(D), D, evaluate=False)) == \ + MatMul(Identity(n), D, evaluate=False) + assert combine_powers(MatMul(B.T, Inverse(E*A), E, A, B, evaluate=False)) == \ + MatMul(B.T, Identity(m), B, evaluate=False) + assert combine_powers(MatMul(A, E, Inverse(A*E), D, evaluate=False)) == \ + MatMul(Identity(n), D, evaluate=False) + + +def test_any_zeros(): + assert any_zeros(MatMul(A, ZeroMatrix(m, k), evaluate=False)) == \ + ZeroMatrix(n, k) + + +def test_unpack(): + assert unpack(MatMul(A, evaluate=False)) == A + x = MatMul(A, B) + assert unpack(x) == x + + +def test_only_squares(): + assert only_squares(C) == [C] + assert only_squares(C, D) == [C, D] + assert only_squares(C, A, A.T, D) == [C, A*A.T, D] + + +def test_determinant(): + assert det(2*C) == 2**n*det(C) + assert det(2*C*D) == 2**n*det(C)*det(D) + assert det(3*C*A*A.T*D) == 3**n*det(C)*det(A*A.T)*det(D) + + +def test_doit(): + assert MatMul(C, 2, D).args == (C, 2, D) + assert MatMul(C, 2, D).doit().args == (2, C, D) + assert MatMul(C, Transpose(D*C)).args == (C, Transpose(D*C)) + assert MatMul(C, Transpose(D*C)).doit(deep=True).args == (C, C.T, D.T) + + +def test_doit_drills_down(): + X = ImmutableMatrix([[1, 2], [3, 4]]) + Y = ImmutableMatrix([[2, 3], [4, 5]]) + assert MatMul(X, MatPow(Y, 2)).doit() == X*Y**2 + assert MatMul(C, Transpose(D*C)).doit().args == (C, C.T, D.T) + + +def test_doit_deep_false_still_canonical(): + assert (MatMul(C, Transpose(D*C), 2).doit(deep=False).args == + (2, C, Transpose(D*C))) + + +def test_matmul_scalar_Matrix_doit(): + # Issue 9053 + X = Matrix([[1, 2], [3, 4]]) + assert MatMul(2, X).doit() == 2*X + + +def test_matmul_sympify(): + assert isinstance(MatMul(eye(1), eye(1)).args[0], Basic) + + +def test_collapse_MatrixBase(): + A = Matrix([[1, 1], [1, 1]]) + B = Matrix([[1, 2], [3, 4]]) + assert MatMul(A, B).doit() == ImmutableMatrix([[4, 6], [4, 6]]) + + +def test_refine(): + assert refine(C*C.T*D, Q.orthogonal(C)).doit() == D + + kC = k*C + assert refine(kC*C.T, Q.orthogonal(C)).doit() == k*Identity(n) + assert refine(kC* kC.T, Q.orthogonal(C)).doit() == (k**2)*Identity(n) + +def test_matmul_no_matrices(): + assert MatMul(1) == 1 + assert MatMul(n, m) == n*m + assert not isinstance(MatMul(n, m), MatMul) + +def test_matmul_args_cnc(): + assert MatMul(n, A, A.T).args_cnc() == [[n], [A, A.T]] + assert MatMul(A, A.T).args_cnc() == [[], [A, A.T]] + +@XFAIL +def test_matmul_args_cnc_symbols(): + # Not currently supported + a, b = symbols('a b', commutative=False) + assert MatMul(n, a, b, A, A.T).args_cnc() == [[n], [a, b, A, A.T]] + assert MatMul(n, a, A, b, A.T).args_cnc() == [[n], [a, A, b, A.T]] + +def test_issue_12950(): + M = Matrix([[Symbol("x")]]) * MatrixSymbol("A", 1, 1) + assert MatrixSymbol("A", 1, 1).as_explicit()[0]*Symbol('x') == M.as_explicit()[0] + +def test_construction_with_Mul(): + assert Mul(C, D) == MatMul(C, D) + assert Mul(D, C) == MatMul(D, C) + +def test_construction_with_mul(): + assert mul(C, D) == MatMul(C, D) + assert mul(D, C) == MatMul(D, C) + assert mul(C, D) != MatMul(D, C) + +def test_generic_identity(): + assert MatMul.identity == GenericIdentity() + assert MatMul.identity != S.One + + +def test_issue_23519(): + N = Symbol("N", integer=True) + M1 = MatrixSymbol("M1", N, N) + M2 = MatrixSymbol("M2", N, N) + I = Identity(N) + z = (M2 + 2 * (M2 + I) * M1 + I) + assert z.coeff(M1) == 2*I + 2*M2 + + +def test_shape_error(): + A = MatrixSymbol('A', 2, 2) + B = MatrixSymbol('B', 3, 3) + raises(ShapeError, lambda: MatMul(A, B)) diff --git a/shared/package-files/32/32e366a95fef11c1ccc54a3ba099f80585f9cf648264462e8baba69e48f13692/blob b/shared/package-files/32/32e366a95fef11c1ccc54a3ba099f80585f9cf648264462e8baba69e48f13692/blob new file mode 100644 index 0000000000000000000000000000000000000000..58c1c21dbc9c766481392c15f51772187763caa6 --- /dev/null +++ b/shared/package-files/32/32e366a95fef11c1ccc54a3ba099f80585f9cf648264462e8baba69e48f13692/blob @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor outer(const at::Tensor & self, const at::Tensor & vec2); +TORCH_API at::Tensor & outer_out(const at::Tensor & self, const at::Tensor & vec2, at::Tensor & out); +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32e48fe6fd6414bede1ff092a8e3e197ac437751aec110567194120b0072e818/blob b/shared/package-files/32/32e48fe6fd6414bede1ff092a8e3e197ac437751aec110567194120b0072e818/blob new file mode 100644 index 0000000000000000000000000000000000000000..b9eb6ec6b3a09a8ea683ad99bc975227b4e8184c --- /dev/null +++ b/shared/package-files/32/32e48fe6fd6414bede1ff092a8e3e197ac437751aec110567194120b0072e818/blob @@ -0,0 +1,488 @@ +"""Tests for tools for solving inequalities and systems of inequalities. """ + +from sympy.concrete.summations import Sum +from sympy.core.function import Function +from sympy.core.numbers import (I, Rational, oo, pi) +from sympy.core.relational import (Eq, Ge, Gt, Le, Lt, Ne) +from sympy.core.singleton import S +from sympy.core.symbol import (Dummy, Symbol) +from sympy.functions.elementary.complexes import Abs +from sympy.functions.elementary.exponential import (exp, log) +from sympy.functions.elementary.miscellaneous import (root, sqrt) +from sympy.functions.elementary.piecewise import Piecewise +from sympy.functions.elementary.trigonometric import (cos, sin, tan) +from sympy.integrals.integrals import Integral +from sympy.logic.boolalg import (And, Or) +from sympy.polys.polytools import (Poly, PurePoly) +from sympy.sets.sets import (FiniteSet, Interval, Union) +from sympy.solvers.inequalities import (reduce_inequalities, + solve_poly_inequality as psolve, + reduce_rational_inequalities, + solve_univariate_inequality as isolve, + reduce_abs_inequality, + _solve_inequality) +from sympy.polys.rootoftools import rootof +from sympy.solvers.solvers import solve +from sympy.solvers.solveset import solveset +from sympy.abc import x, y + +from sympy.core.mod import Mod + +from sympy.testing.pytest import raises, XFAIL + + +inf = oo.evalf() + + +def test_solve_poly_inequality(): + assert psolve(Poly(0, x), '==') == [S.Reals] + assert psolve(Poly(1, x), '==') == [S.EmptySet] + assert psolve(PurePoly(x + 1, x), ">") == [Interval(-1, oo, True, False)] + + +def test_reduce_poly_inequalities_real_interval(): + assert reduce_rational_inequalities( + [[Eq(x**2, 0)]], x, relational=False) == FiniteSet(0) + assert reduce_rational_inequalities( + [[Le(x**2, 0)]], x, relational=False) == FiniteSet(0) + assert reduce_rational_inequalities( + [[Lt(x**2, 0)]], x, relational=False) == S.EmptySet + assert reduce_rational_inequalities( + [[Ge(x**2, 0)]], x, relational=False) == \ + S.Reals if x.is_real else Interval(-oo, oo) + assert reduce_rational_inequalities( + [[Gt(x**2, 0)]], x, relational=False) == \ + FiniteSet(0).complement(S.Reals) + assert reduce_rational_inequalities( + [[Ne(x**2, 0)]], x, relational=False) == \ + FiniteSet(0).complement(S.Reals) + + assert reduce_rational_inequalities( + [[Eq(x**2, 1)]], x, relational=False) == FiniteSet(-1, 1) + assert reduce_rational_inequalities( + [[Le(x**2, 1)]], x, relational=False) == Interval(-1, 1) + assert reduce_rational_inequalities( + [[Lt(x**2, 1)]], x, relational=False) == Interval(-1, 1, True, True) + assert reduce_rational_inequalities( + [[Ge(x**2, 1)]], x, relational=False) == \ + Union(Interval(-oo, -1), Interval(1, oo)) + assert reduce_rational_inequalities( + [[Gt(x**2, 1)]], x, relational=False) == \ + Interval(-1, 1).complement(S.Reals) + assert reduce_rational_inequalities( + [[Ne(x**2, 1)]], x, relational=False) == \ + FiniteSet(-1, 1).complement(S.Reals) + assert reduce_rational_inequalities([[Eq( + x**2, 1.0)]], x, relational=False) == FiniteSet(-1.0, 1.0).evalf() + assert reduce_rational_inequalities( + [[Le(x**2, 1.0)]], x, relational=False) == Interval(-1.0, 1.0) + assert reduce_rational_inequalities([[Lt( + x**2, 1.0)]], x, relational=False) == Interval(-1.0, 1.0, True, True) + assert reduce_rational_inequalities( + [[Ge(x**2, 1.0)]], x, relational=False) == \ + Union(Interval(-inf, -1.0), Interval(1.0, inf)) + assert reduce_rational_inequalities( + [[Gt(x**2, 1.0)]], x, relational=False) == \ + Union(Interval(-inf, -1.0, right_open=True), + Interval(1.0, inf, left_open=True)) + assert reduce_rational_inequalities([[Ne( + x**2, 1.0)]], x, relational=False) == \ + FiniteSet(-1.0, 1.0).complement(S.Reals) + + s = sqrt(2) + + assert reduce_rational_inequalities([[Lt( + x**2 - 1, 0), Gt(x**2 - 1, 0)]], x, relational=False) == S.EmptySet + assert reduce_rational_inequalities([[Le(x**2 - 1, 0), Ge( + x**2 - 1, 0)]], x, relational=False) == FiniteSet(-1, 1) + assert reduce_rational_inequalities( + [[Le(x**2 - 2, 0), Ge(x**2 - 1, 0)]], x, relational=False + ) == Union(Interval(-s, -1, False, False), Interval(1, s, False, False)) + assert reduce_rational_inequalities( + [[Le(x**2 - 2, 0), Gt(x**2 - 1, 0)]], x, relational=False + ) == Union(Interval(-s, -1, False, True), Interval(1, s, True, False)) + assert reduce_rational_inequalities( + [[Lt(x**2 - 2, 0), Ge(x**2 - 1, 0)]], x, relational=False + ) == Union(Interval(-s, -1, True, False), Interval(1, s, False, True)) + assert reduce_rational_inequalities( + [[Lt(x**2 - 2, 0), Gt(x**2 - 1, 0)]], x, relational=False + ) == Union(Interval(-s, -1, True, True), Interval(1, s, True, True)) + assert reduce_rational_inequalities( + [[Lt(x**2 - 2, 0), Ne(x**2 - 1, 0)]], x, relational=False + ) == Union(Interval(-s, -1, True, True), Interval(-1, 1, True, True), + Interval(1, s, True, True)) + + assert reduce_rational_inequalities([[Lt(x**2, -1.)]], x) is S.false + + +def test_reduce_poly_inequalities_complex_relational(): + assert reduce_rational_inequalities( + [[Eq(x**2, 0)]], x, relational=True) == Eq(x, 0) + assert reduce_rational_inequalities( + [[Le(x**2, 0)]], x, relational=True) == Eq(x, 0) + assert reduce_rational_inequalities( + [[Lt(x**2, 0)]], x, relational=True) == False + assert reduce_rational_inequalities( + [[Ge(x**2, 0)]], x, relational=True) == And(Lt(-oo, x), Lt(x, oo)) + assert reduce_rational_inequalities( + [[Gt(x**2, 0)]], x, relational=True) == \ + And(Gt(x, -oo), Lt(x, oo), Ne(x, 0)) + assert reduce_rational_inequalities( + [[Ne(x**2, 0)]], x, relational=True) == \ + And(Gt(x, -oo), Lt(x, oo), Ne(x, 0)) + + for one in (S.One, S(1.0)): + inf = one*oo + assert reduce_rational_inequalities( + [[Eq(x**2, one)]], x, relational=True) == \ + Or(Eq(x, -one), Eq(x, one)) + assert reduce_rational_inequalities( + [[Le(x**2, one)]], x, relational=True) == \ + And(And(Le(-one, x), Le(x, one))) + assert reduce_rational_inequalities( + [[Lt(x**2, one)]], x, relational=True) == \ + And(And(Lt(-one, x), Lt(x, one))) + assert reduce_rational_inequalities( + [[Ge(x**2, one)]], x, relational=True) == \ + And(Or(And(Le(one, x), Lt(x, inf)), And(Le(x, -one), Lt(-inf, x)))) + assert reduce_rational_inequalities( + [[Gt(x**2, one)]], x, relational=True) == \ + And(Or(And(Lt(-inf, x), Lt(x, -one)), And(Lt(one, x), Lt(x, inf)))) + assert reduce_rational_inequalities( + [[Ne(x**2, one)]], x, relational=True) == \ + Or(And(Lt(-inf, x), Lt(x, -one)), + And(Lt(-one, x), Lt(x, one)), + And(Lt(one, x), Lt(x, inf))) + + +def test_reduce_rational_inequalities_real_relational(): + assert reduce_rational_inequalities([], x) == False + assert reduce_rational_inequalities( + [[(x**2 + 3*x + 2)/(x**2 - 16) >= 0]], x, relational=False) == \ + Union(Interval.open(-oo, -4), Interval(-2, -1), Interval.open(4, oo)) + + assert reduce_rational_inequalities( + [[((-2*x - 10)*(3 - x))/((x**2 + 5)*(x - 2)**2) < 0]], x, + relational=False) == \ + Union(Interval.open(-5, 2), Interval.open(2, 3)) + + assert reduce_rational_inequalities([[(x + 1)/(x - 5) <= 0]], x, + relational=False) == \ + Interval.Ropen(-1, 5) + + assert reduce_rational_inequalities([[(x**2 + 4*x + 3)/(x - 1) > 0]], x, + relational=False) == \ + Union(Interval.open(-3, -1), Interval.open(1, oo)) + + assert reduce_rational_inequalities([[(x**2 - 16)/(x - 1)**2 < 0]], x, + relational=False) == \ + Union(Interval.open(-4, 1), Interval.open(1, 4)) + + assert reduce_rational_inequalities([[(3*x + 1)/(x + 4) >= 1]], x, + relational=False) == \ + Union(Interval.open(-oo, -4), Interval.Ropen(Rational(3, 2), oo)) + + assert reduce_rational_inequalities([[(x - 8)/x <= 3 - x]], x, + relational=False) == \ + Union(Interval.Lopen(-oo, -2), Interval.Lopen(0, 4)) + + # issue sympy/sympy#10237 + assert reduce_rational_inequalities( + [[x < oo, x >= 0, -oo < x]], x, relational=False) == Interval(0, oo) + + +def test_reduce_abs_inequalities(): + e = abs(x - 5) < 3 + ans = And(Lt(2, x), Lt(x, 8)) + assert reduce_inequalities(e) == ans + assert reduce_inequalities(e, x) == ans + assert reduce_inequalities(abs(x - 5)) == Eq(x, 5) + assert reduce_inequalities( + abs(2*x + 3) >= 8) == Or(And(Le(Rational(5, 2), x), Lt(x, oo)), + And(Le(x, Rational(-11, 2)), Lt(-oo, x))) + assert reduce_inequalities(abs(x - 4) + abs( + 3*x - 5) < 7) == And(Lt(S.Half, x), Lt(x, 4)) + assert reduce_inequalities(abs(x - 4) + abs(3*abs(x) - 5) < 7) == \ + Or(And(S(-2) < x, x < -1), And(S.Half < x, x < 4)) + + nr = Symbol('nr', extended_real=False) + raises(TypeError, lambda: reduce_inequalities(abs(nr - 5) < 3)) + assert reduce_inequalities(x < 3, symbols=[x, nr]) == And(-oo < x, x < 3) + + +def test_reduce_inequalities_general(): + assert reduce_inequalities(Ge(sqrt(2)*x, 1)) == And(sqrt(2)/2 <= x, x < oo) + assert reduce_inequalities(x + 1 > 0) == And(S.NegativeOne < x, x < oo) + + +def test_reduce_inequalities_boolean(): + assert reduce_inequalities( + [Eq(x**2, 0), True]) == Eq(x, 0) + assert reduce_inequalities([Eq(x**2, 0), False]) == False + assert reduce_inequalities(x**2 >= 0) is S.true # issue 10196 + + +def test_reduce_inequalities_multivariate(): + assert reduce_inequalities([Ge(x**2, 1), Ge(y**2, 1)]) == And( + Or(And(Le(S.One, x), Lt(x, oo)), And(Le(x, -1), Lt(-oo, x))), + Or(And(Le(S.One, y), Lt(y, oo)), And(Le(y, -1), Lt(-oo, y)))) + + +def test_reduce_inequalities_errors(): + raises(NotImplementedError, lambda: reduce_inequalities(Ge(sin(x) + x, 1))) + raises(NotImplementedError, lambda: reduce_inequalities(Ge(x**2*y + y, 1))) + + +def test__solve_inequalities(): + assert reduce_inequalities(x + y < 1, symbols=[x]) == (x < 1 - y) + assert reduce_inequalities(x + y >= 1, symbols=[x]) == (x < oo) & (x >= -y + 1) + assert reduce_inequalities(Eq(0, x - y), symbols=[x]) == Eq(x, y) + assert reduce_inequalities(Ne(0, x - y), symbols=[x]) == Ne(x, y) + + +def test_issue_6343(): + eq = -3*x**2/2 - x*Rational(45, 4) + Rational(33, 2) > 0 + assert reduce_inequalities(eq) == \ + And(x < Rational(-15, 4) + sqrt(401)/4, -sqrt(401)/4 - Rational(15, 4) < x) + + +def test_issue_8235(): + assert reduce_inequalities(x**2 - 1 < 0) == \ + And(S.NegativeOne < x, x < 1) + assert reduce_inequalities(x**2 - 1 <= 0) == \ + And(S.NegativeOne <= x, x <= 1) + assert reduce_inequalities(x**2 - 1 > 0) == \ + Or(And(-oo < x, x < -1), And(x < oo, S.One < x)) + assert reduce_inequalities(x**2 - 1 >= 0) == \ + Or(And(-oo < x, x <= -1), And(S.One <= x, x < oo)) + + eq = x**8 + x - 9 # we want CRootOf solns here + sol = solve(eq >= 0) + tru = Or(And(rootof(eq, 1) <= x, x < oo), And(-oo < x, x <= rootof(eq, 0))) + assert sol == tru + + # recast vanilla as real + assert solve(sqrt((-x + 1)**2) < 1) == And(S.Zero < x, x < 2) + + +def test_issue_5526(): + assert reduce_inequalities(0 <= + x + Integral(y**2, (y, 1, 3)) - 1, [x]) == \ + (x >= -Integral(y**2, (y, 1, 3)) + 1) + f = Function('f') + e = Sum(f(x), (x, 1, 3)) + assert reduce_inequalities(0 <= x + e + y**2, [x]) == \ + (x >= -y**2 - Sum(f(x), (x, 1, 3))) + + +def test_solve_univariate_inequality(): + assert isolve(x**2 >= 4, x, relational=False) == Union(Interval(-oo, -2), + Interval(2, oo)) + assert isolve(x**2 >= 4, x) == Or(And(Le(2, x), Lt(x, oo)), And(Le(x, -2), + Lt(-oo, x))) + assert isolve((x - 1)*(x - 2)*(x - 3) >= 0, x, relational=False) == \ + Union(Interval(1, 2), Interval(3, oo)) + assert isolve((x - 1)*(x - 2)*(x - 3) >= 0, x) == \ + Or(And(Le(1, x), Le(x, 2)), And(Le(3, x), Lt(x, oo))) + assert isolve((x - 1)*(x - 2)*(x - 4) < 0, x, domain = FiniteSet(0, 3)) == \ + Or(Eq(x, 0), Eq(x, 3)) + # issue 2785: + assert isolve(x**3 - 2*x - 1 > 0, x, relational=False) == \ + Union(Interval(-1, -sqrt(5)/2 + S.Half, True, True), + Interval(S.Half + sqrt(5)/2, oo, True, True)) + # issue 2794: + assert isolve(x**3 - x**2 + x - 1 > 0, x, relational=False) == \ + Interval(1, oo, True) + #issue 13105 + assert isolve((x + I)*(x + 2*I) < 0, x) == Eq(x, 0) + assert isolve(((x - 1)*(x - 2) + I)*((x - 1)*(x - 2) + 2*I) < 0, x) == Or(Eq(x, 1), Eq(x, 2)) + assert isolve((((x - 1)*(x - 2) + I)*((x - 1)*(x - 2) + 2*I))/(x - 2) > 0, x) == Eq(x, 1) + raises (ValueError, lambda: isolve((x**2 - 3*x*I + 2)/x < 0, x)) + + # numerical testing in valid() is needed + assert isolve(x**7 - x - 2 > 0, x) == \ + And(rootof(x**7 - x - 2, 0) < x, x < oo) + + # handle numerator and denominator; although these would be handled as + # rational inequalities, these test confirm that the right thing is done + # when the domain is EX (e.g. when 2 is replaced with sqrt(2)) + assert isolve(1/(x - 2) > 0, x) == And(S(2) < x, x < oo) + den = ((x - 1)*(x - 2)).expand() + assert isolve((x - 1)/den <= 0, x) == \ + (x > -oo) & (x < 2) & Ne(x, 1) + + n = Dummy('n') + raises(NotImplementedError, lambda: isolve(Abs(x) <= n, x, relational=False)) + c1 = Dummy("c1", positive=True) + raises(NotImplementedError, lambda: isolve(n/c1 < 0, c1)) + n = Dummy('n', negative=True) + assert isolve(n/c1 > -2, c1) == (-n/2 < c1) + assert isolve(n/c1 < 0, c1) == True + assert isolve(n/c1 > 0, c1) == False + + zero = cos(1)**2 + sin(1)**2 - 1 + raises(NotImplementedError, lambda: isolve(x**2 < zero, x)) + raises(NotImplementedError, lambda: isolve( + x**2 < zero*I, x)) + raises(NotImplementedError, lambda: isolve(1/(x - y) < 2, x)) + raises(NotImplementedError, lambda: isolve(1/(x - y) < 0, x)) + raises(TypeError, lambda: isolve(x - I < 0, x)) + + zero = x**2 + x - x*(x + 1) + assert isolve(zero < 0, x, relational=False) is S.EmptySet + assert isolve(zero <= 0, x, relational=False) is S.Reals + + # make sure iter_solutions gets a default value + raises(NotImplementedError, lambda: isolve( + Eq(cos(x)**2 + sin(x)**2, 1), x)) + + +def test_trig_inequalities(): + # all the inequalities are solved in a periodic interval. + assert isolve(sin(x) < S.Half, x, relational=False) == \ + Union(Interval(0, pi/6, False, True), Interval.open(pi*Rational(5, 6), 2*pi)) + assert isolve(sin(x) > S.Half, x, relational=False) == \ + Interval(pi/6, pi*Rational(5, 6), True, True) + assert isolve(cos(x) < S.Zero, x, relational=False) == \ + Interval(pi/2, pi*Rational(3, 2), True, True) + assert isolve(cos(x) >= S.Zero, x, relational=False) == \ + Union(Interval(0, pi/2), Interval.Ropen(pi*Rational(3, 2), 2*pi)) + + assert isolve(tan(x) < S.One, x, relational=False) == \ + Union(Interval.Ropen(0, pi/4), Interval.open(pi/2, pi)) + + assert isolve(sin(x) <= S.Zero, x, relational=False) == \ + Union(FiniteSet(S.Zero), Interval.Ropen(pi, 2*pi)) + + assert isolve(sin(x) <= S.One, x, relational=False) == S.Reals + assert isolve(cos(x) < S(-2), x, relational=False) == S.EmptySet + assert isolve(sin(x) >= S.NegativeOne, x, relational=False) == S.Reals + assert isolve(cos(x) > S.One, x, relational=False) == S.EmptySet + + +def test_issue_9954(): + assert isolve(x**2 >= 0, x, relational=False) == S.Reals + assert isolve(x**2 >= 0, x, relational=True) == S.Reals.as_relational(x) + assert isolve(x**2 < 0, x, relational=False) == S.EmptySet + assert isolve(x**2 < 0, x, relational=True) == S.EmptySet.as_relational(x) + + +@XFAIL +def test_slow_general_univariate(): + r = rootof(x**5 - x**2 + 1, 0) + assert solve(sqrt(x) + 1/root(x, 3) > 1) == \ + Or(And(0 < x, x < r**6), And(r**6 < x, x < oo)) + + +def test_issue_8545(): + eq = 1 - x - abs(1 - x) + ans = And(Lt(1, x), Lt(x, oo)) + assert reduce_abs_inequality(eq, '<', x) == ans + eq = 1 - x - sqrt((1 - x)**2) + assert reduce_inequalities(eq < 0) == ans + + +def test_issue_8974(): + assert isolve(-oo < x, x) == And(-oo < x, x < oo) + assert isolve(oo > x, x) == And(-oo < x, x < oo) + + +def test_issue_10198(): + assert reduce_inequalities( + -1 + 1/abs(1/x - 1) < 0) == (x > -oo) & (x < S(1)/2) & Ne(x, 0) + + assert reduce_inequalities(abs(1/sqrt(x)) - 1, x) == Eq(x, 1) + assert reduce_abs_inequality(-3 + 1/abs(1 - 1/x), '<', x) == \ + Or(And(-oo < x, x < 0), + And(S.Zero < x, x < Rational(3, 4)), And(Rational(3, 2) < x, x < oo)) + raises(ValueError,lambda: reduce_abs_inequality(-3 + 1/abs( + 1 - 1/sqrt(x)), '<', x)) + + +def test_issue_10047(): + # issue 10047: this must remain an inequality, not True, since if x + # is not real the inequality is invalid + # assert solve(sin(x) < 2) == (x <= oo) + + # with PR 16956, (x <= oo) autoevaluates when x is extended_real + # which is assumed in the current implementation of inequality solvers + assert solve(sin(x) < 2) == True + assert solveset(sin(x) < 2, domain=S.Reals) == S.Reals + + +def test_issue_10268(): + assert solve(log(x) < 1000) == And(S.Zero < x, x < exp(1000)) + + +@XFAIL +def test_isolve_Sets(): + n = Dummy('n') + assert isolve(Abs(x) <= n, x, relational=False) == \ + Piecewise((S.EmptySet, n < 0), (Interval(-n, n), True)) + + +def test_integer_domain_relational_isolve(): + + dom = FiniteSet(0, 3) + x = Symbol('x',zero=False) + assert isolve((x - 1)*(x - 2)*(x - 4) < 0, x, domain=dom) == Eq(x, 3) + + x = Symbol('x') + assert isolve(x + 2 < 0, x, domain=S.Integers) == \ + (x <= -3) & (x > -oo) & Eq(Mod(x, 1), 0) + assert isolve(2 * x + 3 > 0, x, domain=S.Integers) == \ + (x >= -1) & (x < oo) & Eq(Mod(x, 1), 0) + assert isolve((x ** 2 + 3 * x - 2) < 0, x, domain=S.Integers) == \ + (x >= -3) & (x <= 0) & Eq(Mod(x, 1), 0) + assert isolve((x ** 2 + 3 * x - 2) > 0, x, domain=S.Integers) == \ + ((x >= 1) & (x < oo) & Eq(Mod(x, 1), 0)) | ( + (x <= -4) & (x > -oo) & Eq(Mod(x, 1), 0)) + + +def test_issue_10671_12466(): + assert solveset(sin(y), y, Interval(0, pi)) == FiniteSet(0, pi) + i = Interval(1, 10) + assert solveset((1/x).diff(x) < 0, x, i) == i + assert solveset((log(x - 6)/x) <= 0, x, S.Reals) == \ + Interval.Lopen(6, 7) + + +def test__solve_inequality(): + for op in (Gt, Lt, Le, Ge, Eq, Ne): + assert _solve_inequality(op(x, 1), x).lhs == x + assert _solve_inequality(op(S.One, x), x).lhs == x + # don't get tricked by symbol on right: solve it + assert _solve_inequality(Eq(2*x - 1, x), x) == Eq(x, 1) + ie = Eq(S.One, y) + assert _solve_inequality(ie, x) == ie + for fx in (x**2, exp(x), sin(x) + cos(x), x*(1 + x)): + for c in (0, 1): + e = 2*fx - c > 0 + assert _solve_inequality(e, x, linear=True) == ( + fx > c/S(2)) + assert _solve_inequality(2*x**2 + 2*x - 1 < 0, x, linear=True) == ( + x*(x + 1) < S.Half) + assert _solve_inequality(Eq(x*y, 1), x) == Eq(x*y, 1) + nz = Symbol('nz', nonzero=True) + assert _solve_inequality(Eq(x*nz, 1), x) == Eq(x, 1/nz) + assert _solve_inequality(x*nz < 1, x) == (x*nz < 1) + a = Symbol('a', positive=True) + assert _solve_inequality(a/x > 1, x) == (S.Zero < x) & (x < a) + assert _solve_inequality(a/x > 1, x, linear=True) == (1/x > 1/a) + # make sure to include conditions under which solution is valid + e = Eq(1 - x, x*(1/x - 1)) + assert _solve_inequality(e, x) == Ne(x, 0) + assert _solve_inequality(x < x*(1/x - 1), x) == (x < S.Half) & Ne(x, 0) + + +def test__pt(): + from sympy.solvers.inequalities import _pt + assert _pt(-oo, oo) == 0 + assert _pt(S.One, S(3)) == 2 + assert _pt(S.One, oo) == _pt(oo, S.One) == 2 + assert _pt(S.One, -oo) == _pt(-oo, S.One) == S.Half + assert _pt(S.NegativeOne, oo) == _pt(oo, S.NegativeOne) == Rational(-1, 2) + assert _pt(S.NegativeOne, -oo) == _pt(-oo, S.NegativeOne) == -2 + assert _pt(x, oo) == _pt(oo, x) == x + 1 + assert _pt(x, -oo) == _pt(-oo, x) == x - 1 + raises(ValueError, lambda: _pt(Dummy('i', infinite=True), S.One)) diff --git a/shared/package-files/32/32e55c08ef2da92fecea793b761abe67ad88e518be2111375164907ce48e5a93/blob b/shared/package-files/32/32e55c08ef2da92fecea793b761abe67ad88e518be2111375164907ce48e5a93/blob new file mode 100644 index 0000000000000000000000000000000000000000..a8086fad61eb91b21943bb125ccf0f2cbd9ab3c2 --- /dev/null +++ b/shared/package-files/32/32e55c08ef2da92fecea793b761abe67ad88e518be2111375164907ce48e5a93/blob @@ -0,0 +1,35 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::fbgemm_pack_quantized_matrix(Tensor input) -> Tensor +inline at::Tensor fbgemm_pack_quantized_matrix(const at::Tensor & input) { + return at::_ops::fbgemm_pack_quantized_matrix::call(input); +} + +// aten::fbgemm_pack_quantized_matrix.KN(Tensor input, int K, int N) -> Tensor +inline at::Tensor fbgemm_pack_quantized_matrix(const at::Tensor & input, int64_t K, int64_t N) { + return at::_ops::fbgemm_pack_quantized_matrix_KN::call(input, K, N); +} + +} diff --git a/shared/package-files/32/32e67aa937bc4b1afd2cd3359d2409961b3bb6df95a300e350fae13f98bca673/blob b/shared/package-files/32/32e67aa937bc4b1afd2cd3359d2409961b3bb6df95a300e350fae13f98bca673/blob new file mode 100644 index 0000000000000000000000000000000000000000..93156ca3aa1a36abb45fcfbe65a602b580652c58 Binary files /dev/null and b/shared/package-files/32/32e67aa937bc4b1afd2cd3359d2409961b3bb6df95a300e350fae13f98bca673/blob differ diff --git a/shared/package-files/32/32e7cfd5f4833a6be03bad36850b5796ec579fc31fe7ecd1aa8eb14f54115923/blob b/shared/package-files/32/32e7cfd5f4833a6be03bad36850b5796ec579fc31fe7ecd1aa8eb14f54115923/blob new file mode 100644 index 0000000000000000000000000000000000000000..ba46c9e66577e11609f6530c8b73574fe6856e8c --- /dev/null +++ b/shared/package-files/32/32e7cfd5f4833a6be03bad36850b5796ec579fc31fe7ecd1aa8eb14f54115923/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32e7cfd5f4833a6be03bad36850b5796ec579fc31fe7ecd1aa8eb14f54115923 +size 378624 diff --git a/shared/package-files/32/32e819c00a43b3c348f539d700d425504f20b8d068c16418d26fa9b693e775c9/blob b/shared/package-files/32/32e819c00a43b3c348f539d700d425504f20b8d068c16418d26fa9b693e775c9/blob new file mode 100644 index 0000000000000000000000000000000000000000..abb2b974a47eb3e5c8b4f5d4370baf4898b239ab Binary files /dev/null and b/shared/package-files/32/32e819c00a43b3c348f539d700d425504f20b8d068c16418d26fa9b693e775c9/blob differ diff --git a/shared/package-files/32/32ee2738ef2cd1bab43b497b357501b8d32175a6a5f6d5d8731951ceaa2d61bd/blob b/shared/package-files/32/32ee2738ef2cd1bab43b497b357501b8d32175a6a5f6d5d8731951ceaa2d61bd/blob new file mode 100644 index 0000000000000000000000000000000000000000..451df8b242c73b35036878feaf1f7ad302dc1f91 --- /dev/null +++ b/shared/package-files/32/32ee2738ef2cd1bab43b497b357501b8d32175a6a5f6d5d8731951ceaa2d61bd/blob @@ -0,0 +1,444 @@ +"""Indexing mixin for sparse array/matrix classes. +""" +import numpy as np +from ._sputils import isintlike +from ._base import sparray, issparse + +INT_TYPES = (int, np.integer) + + +def _broadcast_arrays(a, b): + """ + Same as np.broadcast_arrays(a, b) but old writeability rules. + + NumPy >= 1.17.0 transitions broadcast_arrays to return + read-only arrays. Set writeability explicitly to avoid warnings. + Retain the old writeability rules, as our Cython code assumes + the old behavior. + """ + x, y = np.broadcast_arrays(a, b) + x.flags.writeable = a.flags.writeable + y.flags.writeable = b.flags.writeable + return x, y + + +class IndexMixin: + """ + This class provides common dispatching and validation logic for indexing. + """ + def __getitem__(self, key): + index, new_shape = self._validate_indices(key) + + # 1D array + if len(index) == 1: + idx = index[0] + if isinstance(idx, np.ndarray): + if idx.shape == (): + idx = idx.item() + if isinstance(idx, INT_TYPES): + res = self._get_int(idx) + elif isinstance(idx, slice): + res = self._get_slice(idx) + else: # assume array idx + res = self._get_array(idx) + + # package the result and return + if not isinstance(self, sparray): + return res + # handle np.newaxis in idx when result would otherwise be a scalar + if res.shape == () and new_shape != (): + if len(new_shape) == 1: + return self.__class__([res], shape=new_shape, dtype=self.dtype) + if len(new_shape) == 2: + return self.__class__([[res]], shape=new_shape, dtype=self.dtype) + return res.reshape(new_shape) + + # 2D array + row, col = index + + # Dispatch to specialized methods. + if isinstance(row, INT_TYPES): + if isinstance(col, INT_TYPES): + res = self._get_intXint(row, col) + elif isinstance(col, slice): + res = self._get_intXslice(row, col) + elif col.ndim == 1: + res = self._get_intXarray(row, col) + elif col.ndim == 2: + res = self._get_intXarray(row, col) + else: + raise IndexError('index results in >2 dimensions') + elif isinstance(row, slice): + if isinstance(col, INT_TYPES): + res = self._get_sliceXint(row, col) + elif isinstance(col, slice): + if row == slice(None) and row == col: + res = self.copy() + else: + res = self._get_sliceXslice(row, col) + elif col.ndim == 1: + res = self._get_sliceXarray(row, col) + else: + raise IndexError('index results in >2 dimensions') + else: + if isinstance(col, INT_TYPES): + res = self._get_arrayXint(row, col) + elif isinstance(col, slice): + res = self._get_arrayXslice(row, col) + # arrayXarray preprocess + elif (row.ndim == 2 and row.shape[1] == 1 + and (col.ndim == 1 or col.shape[0] == 1)): + # outer indexing + res = self._get_columnXarray(row[:, 0], col.ravel()) + else: + # inner indexing + row, col = _broadcast_arrays(row, col) + if row.shape != col.shape: + raise IndexError('number of row and column indices differ') + if row.size == 0: + res = self.__class__(np.atleast_2d(row).shape, dtype=self.dtype) + else: + res = self._get_arrayXarray(row, col) + + # handle spmatrix (must be 2d, dont let 1d new_shape start reshape) + if not isinstance(self, sparray): + if new_shape == () or (len(new_shape) == 1 and res.ndim != 0): + # res handles cases not inflated by None + return res + if len(new_shape) == 1: + # shape inflated to 1D by None in index. Make 2D + new_shape = (1,) + new_shape + # reshape if needed (when None changes shape, e.g. A[1,:,None]) + return res if new_shape == res.shape else res.reshape(new_shape) + + # package the result and return + if res.shape != new_shape: + # handle formats that support indexing but not 1D (lil for now) + if self.format == "lil" and len(new_shape) != 2: + if res.shape == (): + return self._coo_container([res], shape = new_shape) + return res.tocoo().reshape(new_shape) + return res.reshape(new_shape) + return res + + def __setitem__(self, key, x): + index, _ = self._validate_indices(key) + + # 1D array + if len(index) == 1: + idx = index[0] + + if issparse(x): + x = x.toarray() + else: + x = np.asarray(x, dtype=self.dtype) + + if isinstance(idx, INT_TYPES): + if x.size != 1: + raise ValueError('Trying to assign a sequence to an item') + self._set_int(idx, x.flat[0]) + return + + if isinstance(idx, slice): + # check for simple case of slice that gives 1 item + # Note: Python `range` does not use lots of memory + idx_range = range(*idx.indices(self.shape[0])) + N = len(idx_range) + if N == 1 and x.size == 1: + self._set_int(idx_range[0], x.flat[0]) + return + idx = np.arange(*idx.indices(self.shape[0])) + idx_shape = idx.shape + else: + idx_shape = idx.squeeze().shape + # broadcast scalar to full 1d + if x.squeeze().shape != idx_shape: + x = np.broadcast_to(x, idx.shape) + if x.size != 0: + self._set_array(idx, x) + return + + # 2D array + row, col = index + + if isinstance(row, INT_TYPES) and isinstance(col, INT_TYPES): + x = np.asarray(x, dtype=self.dtype) + if x.size != 1: + raise ValueError('Trying to assign a sequence to an item') + self._set_intXint(row, col, x.flat[0]) + return + + if isinstance(row, slice): + row = np.arange(*row.indices(self.shape[0]))[:, None] + else: + row = np.atleast_1d(row) + + if isinstance(col, slice): + col = np.arange(*col.indices(self.shape[1]))[None, :] + if row.ndim == 1: + row = row[:, None] + else: + col = np.atleast_1d(col) + + i, j = _broadcast_arrays(row, col) + if i.shape != j.shape: + raise IndexError('number of row and column indices differ') + + if issparse(x): + if 0 in x.shape: + return + if i.ndim == 1: + # Inner indexing, so treat them like row vectors. + i = i[None] + j = j[None] + x = x.tocoo(copy=False).reshape(x._shape_as_2d, copy=True) + broadcast_row = x.shape[0] == 1 and i.shape[0] != 1 + broadcast_col = x.shape[1] == 1 and i.shape[1] != 1 + if not ((broadcast_row or x.shape[0] == i.shape[0]) and + (broadcast_col or x.shape[1] == i.shape[1])): + raise ValueError('shape mismatch in assignment') + x.sum_duplicates() + self._set_arrayXarray_sparse(i, j, x) + else: + # Make x and i into the same shape + x = np.asarray(x, dtype=self.dtype) + if x.squeeze().shape != i.squeeze().shape: + x = np.broadcast_to(x, i.shape) + if x.size == 0: + return + x = x.reshape(i.shape) + self._set_arrayXarray(i, j, x) + + def _validate_indices(self, key): + """Returns two tuples: (index tuple, requested shape tuple)""" + # single ellipsis + if key is Ellipsis: + return (slice(None),) * self.ndim, self.shape + + if not isinstance(key, tuple): + key = [key] + + ellps_pos = None + index_1st = [] + prelim_ndim = 0 + for i, idx in enumerate(key): + if idx is Ellipsis: + if ellps_pos is not None: + raise IndexError('an index can only have a single ellipsis') + ellps_pos = i + elif idx is None: + index_1st.append(idx) + elif isinstance(idx, slice) or isintlike(idx): + index_1st.append(idx) + prelim_ndim += 1 + elif (ix := _compatible_boolean_index(idx, self.ndim)) is not None: + index_1st.append(ix) + prelim_ndim += ix.ndim + elif issparse(idx): + # TODO: make sparse matrix indexing work for sparray + raise IndexError( + 'Indexing with sparse matrices is not supported ' + 'except boolean indexing where matrix and index ' + 'are equal shapes.') + else: # dense array + index_1st.append(np.asarray(idx)) + prelim_ndim += 1 + ellip_slices = (self.ndim - prelim_ndim) * [slice(None)] + if ellip_slices: + if ellps_pos is None: + index_1st.extend(ellip_slices) + else: + index_1st = index_1st[:ellps_pos] + ellip_slices + index_1st[ellps_pos:] + + # second pass (have processed ellipsis and preprocessed arrays) + idx_shape = [] + index_ndim = 0 + index = [] + array_indices = [] + for i, idx in enumerate(index_1st): + if idx is None: + idx_shape.append(1) + elif isinstance(idx, slice): + index.append(idx) + Ms = self._shape[index_ndim] + len_slice = len(range(*idx.indices(Ms))) + idx_shape.append(len_slice) + index_ndim += 1 + elif isintlike(idx): + N = self._shape[index_ndim] + if not (-N <= idx < N): + raise IndexError(f'index ({idx}) out of range') + idx = int(idx + N if idx < 0 else idx) + index.append(idx) + index_ndim += 1 + # bool array (checked in first pass) + elif idx.dtype.kind == 'b': + ix = idx + tmp_ndim = index_ndim + ix.ndim + mid_shape = self._shape[index_ndim:tmp_ndim] + if ix.shape != mid_shape: + raise IndexError( + f"bool index {i} has shape {mid_shape} instead of {ix.shape}" + ) + index.extend(ix.nonzero()) + array_indices.extend(range(index_ndim, tmp_ndim)) + index_ndim = tmp_ndim + else: # dense array + N = self._shape[index_ndim] + idx = self._asindices(idx, N) + index.append(idx) + array_indices.append(index_ndim) + index_ndim += 1 + if index_ndim > self.ndim: + raise IndexError( + f'invalid index ndim. Array is {self.ndim}D. Index needs {index_ndim}D' + ) + if len(array_indices) > 1: + idx_arrays = _broadcast_arrays(*(index[i] for i in array_indices)) + if any(idx_arrays[0].shape != ix.shape for ix in idx_arrays[1:]): + shapes = " ".join(str(ix.shape) for ix in idx_arrays) + msg = (f'shape mismatch: indexing arrays could not be broadcast ' + f'together with shapes {shapes}') + raise IndexError(msg) + # TODO: handle this for nD (adjacent arrays stay, separated move to start) + idx_shape = list(idx_arrays[0].shape) + idx_shape + elif len(array_indices) == 1: + arr_index = array_indices[0] + arr_shape = list(index[arr_index].shape) + idx_shape = idx_shape[:arr_index] + arr_shape + idx_shape[arr_index:] + if (ndim := len(idx_shape)) > 2: + raise IndexError(f'Only 1D or 2D arrays allowed. Index makes {ndim}D') + return tuple(index), tuple(idx_shape) + + def _asindices(self, idx, length): + """Convert `idx` to a valid index for an axis with a given length. + + Subclasses that need special validation can override this method. + """ + try: + x = np.asarray(idx) + except (ValueError, TypeError, MemoryError) as e: + raise IndexError('invalid index') from e + + if x.ndim not in (1, 2): + raise IndexError('Index dimension must be 1 or 2') + + if x.size == 0: + return x + + # Check bounds + max_indx = x.max() + if max_indx >= length: + raise IndexError('index (%d) out of range' % max_indx) + + min_indx = x.min() + if min_indx < 0: + if min_indx < -length: + raise IndexError('index (%d) out of range' % min_indx) + if x is idx or not x.flags.owndata: + x = x.copy() + x[x < 0] += length + return x + + def _getrow(self, i): + """Return a copy of row i of the matrix, as a (1 x n) row vector. + """ + M, N = self.shape + i = int(i) + if i < -M or i >= M: + raise IndexError('index (%d) out of range' % i) + if i < 0: + i += M + return self._get_intXslice(i, slice(None)) + + def _getcol(self, i): + """Return a copy of column i of the matrix, as a (m x 1) column vector. + """ + M, N = self.shape + i = int(i) + if i < -N or i >= N: + raise IndexError('index (%d) out of range' % i) + if i < 0: + i += N + return self._get_sliceXint(slice(None), i) + + def _get_int(self, idx): + raise NotImplementedError() + + def _get_slice(self, idx): + raise NotImplementedError() + + def _get_array(self, idx): + raise NotImplementedError() + + def _get_intXint(self, row, col): + raise NotImplementedError() + + def _get_intXarray(self, row, col): + raise NotImplementedError() + + def _get_intXslice(self, row, col): + raise NotImplementedError() + + def _get_sliceXint(self, row, col): + raise NotImplementedError() + + def _get_sliceXslice(self, row, col): + raise NotImplementedError() + + def _get_sliceXarray(self, row, col): + raise NotImplementedError() + + def _get_arrayXint(self, row, col): + raise NotImplementedError() + + def _get_arrayXslice(self, row, col): + raise NotImplementedError() + + def _get_columnXarray(self, row, col): + raise NotImplementedError() + + def _get_arrayXarray(self, row, col): + raise NotImplementedError() + + def _set_int(self, idx, x): + raise NotImplementedError() + + def _set_array(self, idx, x): + raise NotImplementedError() + + def _set_intXint(self, row, col, x): + raise NotImplementedError() + + def _set_arrayXarray(self, row, col, x): + raise NotImplementedError() + + def _set_arrayXarray_sparse(self, row, col, x): + # Fall back to densifying x + x = np.asarray(x.toarray(), dtype=self.dtype) + x, _ = _broadcast_arrays(x, row) + self._set_arrayXarray(row, col, x) + + +def _compatible_boolean_index(idx, desired_ndim): + """Check for boolean array or array-like. peek before asarray for array-like""" + # use attribute ndim to indicate a compatible array and check dtype + # if not, look at 1st element as quick rejection of bool, else slower asanyarray + if not hasattr(idx, 'ndim'): + # is first element boolean? + try: + ix = next(iter(idx), None) + for _ in range(desired_ndim): + if isinstance(ix, bool): + break + ix = next(iter(ix), None) + else: + return None + except TypeError: + return None + # since first is boolean, construct array and check all elements + idx = np.asanyarray(idx) + + if idx.dtype.kind == 'b': + return idx + return None diff --git a/shared/package-files/32/32f02447246cac0dabd39d88b65c85e5b8761617918c8d233f0834b88887d989/blob b/shared/package-files/32/32f02447246cac0dabd39d88b65c85e5b8761617918c8d233f0834b88887d989/blob new file mode 100644 index 0000000000000000000000000000000000000000..cac65063d0dbf48e37c547fba3b67f34110d5a90 Binary files /dev/null and b/shared/package-files/32/32f02447246cac0dabd39d88b65c85e5b8761617918c8d233f0834b88887d989/blob differ diff --git a/shared/package-files/32/32f37a84eec01577f84b071972f54840dd4b726ba04f8c49e4f3f5f3a5284b19/blob b/shared/package-files/32/32f37a84eec01577f84b071972f54840dd4b726ba04f8c49e4f3f5f3a5284b19/blob new file mode 100644 index 0000000000000000000000000000000000000000..65ef9e6b5915d1b4ebf416eb0eaac4deffeb1591 Binary files /dev/null and b/shared/package-files/32/32f37a84eec01577f84b071972f54840dd4b726ba04f8c49e4f3f5f3a5284b19/blob differ diff --git a/shared/package-files/32/32fbebb50f6ff07b1846588e6d491b262557b20f171d7e7474e5138daff0add3/blob b/shared/package-files/32/32fbebb50f6ff07b1846588e6d491b262557b20f171d7e7474e5138daff0add3/blob new file mode 100644 index 0000000000000000000000000000000000000000..2d85eed9b0873a13e775973fdcff7a4ac04be929 --- /dev/null +++ b/shared/package-files/32/32fbebb50f6ff07b1846588e6d491b262557b20f171d7e7474e5138daff0add3/blob @@ -0,0 +1,21 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor _mixed_dtypes_linear(const at::Tensor & input, const at::Tensor & weight, const at::Tensor & scale, const c10::optional & bias={}, c10::optional activation=c10::nullopt); +} // namespace native +} // namespace at diff --git a/shared/package-files/32/32fc48197f01bdd21dddc2b17624ea11deae5aee6773e7e1297513260b625e35/blob b/shared/package-files/32/32fc48197f01bdd21dddc2b17624ea11deae5aee6773e7e1297513260b625e35/blob new file mode 100644 index 0000000000000000000000000000000000000000..8df5389fbe8cb9055d8c4c74ed6d9c60bfbf17c9 --- /dev/null +++ b/shared/package-files/32/32fc48197f01bdd21dddc2b17624ea11deae5aee6773e7e1297513260b625e35/blob @@ -0,0 +1,19 @@ +# mypy: ignore-errors + +from .utils import ( + _gen_alignment_data, + assert_, + assert_allclose, + assert_almost_equal, + assert_array_almost_equal, + assert_array_equal, + assert_array_less, + assert_equal, + assert_raises_regex, + assert_warns, + HAS_REFCOUNT, + IS_WASM, + suppress_warnings, +) + +# from .testing import assert_allclose # FIXME diff --git a/shared/package-files/32/32fce7fcfc928486fd9bb9c98c9e087ad771c262d812c08f1ef2682bb9f6be25/blob b/shared/package-files/32/32fce7fcfc928486fd9bb9c98c9e087ad771c262d812c08f1ef2682bb9f6be25/blob new file mode 100644 index 0000000000000000000000000000000000000000..6dcb656519342e516a6f1be0bf283bb1f326214f --- /dev/null +++ b/shared/package-files/32/32fce7fcfc928486fd9bb9c98c9e087ad771c262d812c08f1ef2682bb9f6be25/blob @@ -0,0 +1,1183 @@ +""" Basic functions for manipulating 2d arrays + +""" +import functools +import operator + +from numpy.core.numeric import ( + asanyarray, arange, zeros, greater_equal, multiply, ones, + asarray, where, int8, int16, int32, int64, intp, empty, promote_types, + diagonal, nonzero, indices + ) +from numpy.core.overrides import set_array_function_like_doc, set_module +from numpy.core import overrides +from numpy.core import iinfo +from numpy.lib.stride_tricks import broadcast_to + + +__all__ = [ + 'diag', 'diagflat', 'eye', 'fliplr', 'flipud', 'tri', 'triu', + 'tril', 'vander', 'histogram2d', 'mask_indices', 'tril_indices', + 'tril_indices_from', 'triu_indices', 'triu_indices_from', ] + + +array_function_dispatch = functools.partial( + overrides.array_function_dispatch, module='numpy') + + +i1 = iinfo(int8) +i2 = iinfo(int16) +i4 = iinfo(int32) + + +def _min_int(low, high): + """ get small int that fits the range """ + if high <= i1.max and low >= i1.min: + return int8 + if high <= i2.max and low >= i2.min: + return int16 + if high <= i4.max and low >= i4.min: + return int32 + return int64 + + +def _flip_dispatcher(m): + return (m,) + + +@array_function_dispatch(_flip_dispatcher) +def fliplr(m): + """ + Reverse the order of elements along axis 1 (left/right). + + For a 2-D array, this flips the entries in each row in the left/right + direction. Columns are preserved, but appear in a different order than + before. + + Parameters + ---------- + m : array_like + Input array, must be at least 2-D. + + Returns + ------- + f : ndarray + A view of `m` with the columns reversed. Since a view + is returned, this operation is :math:`\\mathcal O(1)`. + + See Also + -------- + flipud : Flip array in the up/down direction. + flip : Flip array in one or more dimensions. + rot90 : Rotate array counterclockwise. + + Notes + ----- + Equivalent to ``m[:,::-1]`` or ``np.flip(m, axis=1)``. + Requires the array to be at least 2-D. + + Examples + -------- + >>> A = np.diag([1.,2.,3.]) + >>> A + array([[1., 0., 0.], + [0., 2., 0.], + [0., 0., 3.]]) + >>> np.fliplr(A) + array([[0., 0., 1.], + [0., 2., 0.], + [3., 0., 0.]]) + + >>> A = np.random.randn(2,3,5) + >>> np.all(np.fliplr(A) == A[:,::-1,...]) + True + + """ + m = asanyarray(m) + if m.ndim < 2: + raise ValueError("Input must be >= 2-d.") + return m[:, ::-1] + + +@array_function_dispatch(_flip_dispatcher) +def flipud(m): + """ + Reverse the order of elements along axis 0 (up/down). + + For a 2-D array, this flips the entries in each column in the up/down + direction. Rows are preserved, but appear in a different order than before. + + Parameters + ---------- + m : array_like + Input array. + + Returns + ------- + out : array_like + A view of `m` with the rows reversed. Since a view is + returned, this operation is :math:`\\mathcal O(1)`. + + See Also + -------- + fliplr : Flip array in the left/right direction. + flip : Flip array in one or more dimensions. + rot90 : Rotate array counterclockwise. + + Notes + ----- + Equivalent to ``m[::-1, ...]`` or ``np.flip(m, axis=0)``. + Requires the array to be at least 1-D. + + Examples + -------- + >>> A = np.diag([1.0, 2, 3]) + >>> A + array([[1., 0., 0.], + [0., 2., 0.], + [0., 0., 3.]]) + >>> np.flipud(A) + array([[0., 0., 3.], + [0., 2., 0.], + [1., 0., 0.]]) + + >>> A = np.random.randn(2,3,5) + >>> np.all(np.flipud(A) == A[::-1,...]) + True + + >>> np.flipud([1,2]) + array([2, 1]) + + """ + m = asanyarray(m) + if m.ndim < 1: + raise ValueError("Input must be >= 1-d.") + return m[::-1, ...] + + +@set_array_function_like_doc +@set_module('numpy') +def eye(N, M=None, k=0, dtype=float, order='C', *, like=None): + """ + Return a 2-D array with ones on the diagonal and zeros elsewhere. + + Parameters + ---------- + N : int + Number of rows in the output. + M : int, optional + Number of columns in the output. If None, defaults to `N`. + k : int, optional + Index of the diagonal: 0 (the default) refers to the main diagonal, + a positive value refers to an upper diagonal, and a negative value + to a lower diagonal. + dtype : data-type, optional + Data-type of the returned array. + order : {'C', 'F'}, optional + Whether the output should be stored in row-major (C-style) or + column-major (Fortran-style) order in memory. + + .. versionadded:: 1.14.0 + ${ARRAY_FUNCTION_LIKE} + + .. versionadded:: 1.20.0 + + Returns + ------- + I : ndarray of shape (N,M) + An array where all elements are equal to zero, except for the `k`-th + diagonal, whose values are equal to one. + + See Also + -------- + identity : (almost) equivalent function + diag : diagonal 2-D array from a 1-D array specified by the user. + + Examples + -------- + >>> np.eye(2, dtype=int) + array([[1, 0], + [0, 1]]) + >>> np.eye(3, k=1) + array([[0., 1., 0.], + [0., 0., 1.], + [0., 0., 0.]]) + + """ + if like is not None: + return _eye_with_like(like, N, M=M, k=k, dtype=dtype, order=order) + if M is None: + M = N + m = zeros((N, M), dtype=dtype, order=order) + if k >= M: + return m + # Ensure M and k are integers, so we don't get any surprise casting + # results in the expressions `M-k` and `M+1` used below. This avoids + # a problem with inputs with type (for example) np.uint64. + M = operator.index(M) + k = operator.index(k) + if k >= 0: + i = k + else: + i = (-k) * M + m[:M-k].flat[i::M+1] = 1 + return m + + +_eye_with_like = array_function_dispatch()(eye) + + +def _diag_dispatcher(v, k=None): + return (v,) + + +@array_function_dispatch(_diag_dispatcher) +def diag(v, k=0): + """ + Extract a diagonal or construct a diagonal array. + + See the more detailed documentation for ``numpy.diagonal`` if you use this + function to extract a diagonal and wish to write to the resulting array; + whether it returns a copy or a view depends on what version of numpy you + are using. + + Parameters + ---------- + v : array_like + If `v` is a 2-D array, return a copy of its `k`-th diagonal. + If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th + diagonal. + k : int, optional + Diagonal in question. The default is 0. Use `k>0` for diagonals + above the main diagonal, and `k<0` for diagonals below the main + diagonal. + + Returns + ------- + out : ndarray + The extracted diagonal or constructed diagonal array. + + See Also + -------- + diagonal : Return specified diagonals. + diagflat : Create a 2-D array with the flattened input as a diagonal. + trace : Sum along diagonals. + triu : Upper triangle of an array. + tril : Lower triangle of an array. + + Examples + -------- + >>> x = np.arange(9).reshape((3,3)) + >>> x + array([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + + >>> np.diag(x) + array([0, 4, 8]) + >>> np.diag(x, k=1) + array([1, 5]) + >>> np.diag(x, k=-1) + array([3, 7]) + + >>> np.diag(np.diag(x)) + array([[0, 0, 0], + [0, 4, 0], + [0, 0, 8]]) + + """ + v = asanyarray(v) + s = v.shape + if len(s) == 1: + n = s[0]+abs(k) + res = zeros((n, n), v.dtype) + if k >= 0: + i = k + else: + i = (-k) * n + res[:n-k].flat[i::n+1] = v + return res + elif len(s) == 2: + return diagonal(v, k) + else: + raise ValueError("Input must be 1- or 2-d.") + + +@array_function_dispatch(_diag_dispatcher) +def diagflat(v, k=0): + """ + Create a two-dimensional array with the flattened input as a diagonal. + + Parameters + ---------- + v : array_like + Input data, which is flattened and set as the `k`-th + diagonal of the output. + k : int, optional + Diagonal to set; 0, the default, corresponds to the "main" diagonal, + a positive (negative) `k` giving the number of the diagonal above + (below) the main. + + Returns + ------- + out : ndarray + The 2-D output array. + + See Also + -------- + diag : MATLAB work-alike for 1-D and 2-D arrays. + diagonal : Return specified diagonals. + trace : Sum along diagonals. + + Examples + -------- + >>> np.diagflat([[1,2], [3,4]]) + array([[1, 0, 0, 0], + [0, 2, 0, 0], + [0, 0, 3, 0], + [0, 0, 0, 4]]) + + >>> np.diagflat([1,2], 1) + array([[0, 1, 0], + [0, 0, 2], + [0, 0, 0]]) + + """ + try: + wrap = v.__array_wrap__ + except AttributeError: + wrap = None + v = asarray(v).ravel() + s = len(v) + n = s + abs(k) + res = zeros((n, n), v.dtype) + if (k >= 0): + i = arange(0, n-k, dtype=intp) + fi = i+k+i*n + else: + i = arange(0, n+k, dtype=intp) + fi = i+(i-k)*n + res.flat[fi] = v + if not wrap: + return res + return wrap(res) + + +@set_array_function_like_doc +@set_module('numpy') +def tri(N, M=None, k=0, dtype=float, *, like=None): + """ + An array with ones at and below the given diagonal and zeros elsewhere. + + Parameters + ---------- + N : int + Number of rows in the array. + M : int, optional + Number of columns in the array. + By default, `M` is taken equal to `N`. + k : int, optional + The sub-diagonal at and below which the array is filled. + `k` = 0 is the main diagonal, while `k` < 0 is below it, + and `k` > 0 is above. The default is 0. + dtype : dtype, optional + Data type of the returned array. The default is float. + ${ARRAY_FUNCTION_LIKE} + + .. versionadded:: 1.20.0 + + Returns + ------- + tri : ndarray of shape (N, M) + Array with its lower triangle filled with ones and zero elsewhere; + in other words ``T[i,j] == 1`` for ``j <= i + k``, 0 otherwise. + + Examples + -------- + >>> np.tri(3, 5, 2, dtype=int) + array([[1, 1, 1, 0, 0], + [1, 1, 1, 1, 0], + [1, 1, 1, 1, 1]]) + + >>> np.tri(3, 5, -1) + array([[0., 0., 0., 0., 0.], + [1., 0., 0., 0., 0.], + [1., 1., 0., 0., 0.]]) + + """ + if like is not None: + return _tri_with_like(like, N, M=M, k=k, dtype=dtype) + + if M is None: + M = N + + m = greater_equal.outer(arange(N, dtype=_min_int(0, N)), + arange(-k, M-k, dtype=_min_int(-k, M - k))) + + # Avoid making a copy if the requested type is already bool + m = m.astype(dtype, copy=False) + + return m + + +_tri_with_like = array_function_dispatch()(tri) + + +def _trilu_dispatcher(m, k=None): + return (m,) + + +@array_function_dispatch(_trilu_dispatcher) +def tril(m, k=0): + """ + Lower triangle of an array. + + Return a copy of an array with elements above the `k`-th diagonal zeroed. + For arrays with ``ndim`` exceeding 2, `tril` will apply to the final two + axes. + + Parameters + ---------- + m : array_like, shape (..., M, N) + Input array. + k : int, optional + Diagonal above which to zero elements. `k = 0` (the default) is the + main diagonal, `k < 0` is below it and `k > 0` is above. + + Returns + ------- + tril : ndarray, shape (..., M, N) + Lower triangle of `m`, of same shape and data-type as `m`. + + See Also + -------- + triu : same thing, only for the upper triangle + + Examples + -------- + >>> np.tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) + array([[ 0, 0, 0], + [ 4, 0, 0], + [ 7, 8, 0], + [10, 11, 12]]) + + >>> np.tril(np.arange(3*4*5).reshape(3, 4, 5)) + array([[[ 0, 0, 0, 0, 0], + [ 5, 6, 0, 0, 0], + [10, 11, 12, 0, 0], + [15, 16, 17, 18, 0]], + [[20, 0, 0, 0, 0], + [25, 26, 0, 0, 0], + [30, 31, 32, 0, 0], + [35, 36, 37, 38, 0]], + [[40, 0, 0, 0, 0], + [45, 46, 0, 0, 0], + [50, 51, 52, 0, 0], + [55, 56, 57, 58, 0]]]) + + """ + m = asanyarray(m) + mask = tri(*m.shape[-2:], k=k, dtype=bool) + + return where(mask, m, zeros(1, m.dtype)) + + +@array_function_dispatch(_trilu_dispatcher) +def triu(m, k=0): + """ + Upper triangle of an array. + + Return a copy of an array with the elements below the `k`-th diagonal + zeroed. For arrays with ``ndim`` exceeding 2, `triu` will apply to the + final two axes. + + Please refer to the documentation for `tril` for further details. + + See Also + -------- + tril : lower triangle of an array + + Examples + -------- + >>> np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) + array([[ 1, 2, 3], + [ 4, 5, 6], + [ 0, 8, 9], + [ 0, 0, 12]]) + + >>> np.triu(np.arange(3*4*5).reshape(3, 4, 5)) + array([[[ 0, 1, 2, 3, 4], + [ 0, 6, 7, 8, 9], + [ 0, 0, 12, 13, 14], + [ 0, 0, 0, 18, 19]], + [[20, 21, 22, 23, 24], + [ 0, 26, 27, 28, 29], + [ 0, 0, 32, 33, 34], + [ 0, 0, 0, 38, 39]], + [[40, 41, 42, 43, 44], + [ 0, 46, 47, 48, 49], + [ 0, 0, 52, 53, 54], + [ 0, 0, 0, 58, 59]]]) + + """ + m = asanyarray(m) + mask = tri(*m.shape[-2:], k=k-1, dtype=bool) + + return where(mask, zeros(1, m.dtype), m) + + +def _vander_dispatcher(x, N=None, increasing=None): + return (x,) + + +# Originally borrowed from John Hunter and matplotlib +@array_function_dispatch(_vander_dispatcher) +def vander(x, N=None, increasing=False): + """ + Generate a Vandermonde matrix. + + The columns of the output matrix are powers of the input vector. The + order of the powers is determined by the `increasing` boolean argument. + Specifically, when `increasing` is False, the `i`-th output column is + the input vector raised element-wise to the power of ``N - i - 1``. Such + a matrix with a geometric progression in each row is named for Alexandre- + Theophile Vandermonde. + + Parameters + ---------- + x : array_like + 1-D input array. + N : int, optional + Number of columns in the output. If `N` is not specified, a square + array is returned (``N = len(x)``). + increasing : bool, optional + Order of the powers of the columns. If True, the powers increase + from left to right, if False (the default) they are reversed. + + .. versionadded:: 1.9.0 + + Returns + ------- + out : ndarray + Vandermonde matrix. If `increasing` is False, the first column is + ``x^(N-1)``, the second ``x^(N-2)`` and so forth. If `increasing` is + True, the columns are ``x^0, x^1, ..., x^(N-1)``. + + See Also + -------- + polynomial.polynomial.polyvander + + Examples + -------- + >>> x = np.array([1, 2, 3, 5]) + >>> N = 3 + >>> np.vander(x, N) + array([[ 1, 1, 1], + [ 4, 2, 1], + [ 9, 3, 1], + [25, 5, 1]]) + + >>> np.column_stack([x**(N-1-i) for i in range(N)]) + array([[ 1, 1, 1], + [ 4, 2, 1], + [ 9, 3, 1], + [25, 5, 1]]) + + >>> x = np.array([1, 2, 3, 5]) + >>> np.vander(x) + array([[ 1, 1, 1, 1], + [ 8, 4, 2, 1], + [ 27, 9, 3, 1], + [125, 25, 5, 1]]) + >>> np.vander(x, increasing=True) + array([[ 1, 1, 1, 1], + [ 1, 2, 4, 8], + [ 1, 3, 9, 27], + [ 1, 5, 25, 125]]) + + The determinant of a square Vandermonde matrix is the product + of the differences between the values of the input vector: + + >>> np.linalg.det(np.vander(x)) + 48.000000000000043 # may vary + >>> (5-3)*(5-2)*(5-1)*(3-2)*(3-1)*(2-1) + 48 + + """ + x = asarray(x) + if x.ndim != 1: + raise ValueError("x must be a one-dimensional array or sequence.") + if N is None: + N = len(x) + + v = empty((len(x), N), dtype=promote_types(x.dtype, int)) + tmp = v[:, ::-1] if not increasing else v + + if N > 0: + tmp[:, 0] = 1 + if N > 1: + tmp[:, 1:] = x[:, None] + multiply.accumulate(tmp[:, 1:], out=tmp[:, 1:], axis=1) + + return v + + +def _histogram2d_dispatcher(x, y, bins=None, range=None, density=None, + weights=None): + yield x + yield y + + # This terrible logic is adapted from the checks in histogram2d + try: + N = len(bins) + except TypeError: + N = 1 + if N == 2: + yield from bins # bins=[x, y] + else: + yield bins + + yield weights + + +@array_function_dispatch(_histogram2d_dispatcher) +def histogram2d(x, y, bins=10, range=None, density=None, weights=None): + """ + Compute the bi-dimensional histogram of two data samples. + + Parameters + ---------- + x : array_like, shape (N,) + An array containing the x coordinates of the points to be + histogrammed. + y : array_like, shape (N,) + An array containing the y coordinates of the points to be + histogrammed. + bins : int or array_like or [int, int] or [array, array], optional + The bin specification: + + * If int, the number of bins for the two dimensions (nx=ny=bins). + * If array_like, the bin edges for the two dimensions + (x_edges=y_edges=bins). + * If [int, int], the number of bins in each dimension + (nx, ny = bins). + * If [array, array], the bin edges in each dimension + (x_edges, y_edges = bins). + * A combination [int, array] or [array, int], where int + is the number of bins and array is the bin edges. + + range : array_like, shape(2,2), optional + The leftmost and rightmost edges of the bins along each dimension + (if not specified explicitly in the `bins` parameters): + ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range + will be considered outliers and not tallied in the histogram. + density : bool, optional + If False, the default, returns the number of samples in each bin. + If True, returns the probability *density* function at the bin, + ``bin_count / sample_count / bin_area``. + weights : array_like, shape(N,), optional + An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. + Weights are normalized to 1 if `density` is True. If `density` is + False, the values of the returned histogram are equal to the sum of + the weights belonging to the samples falling into each bin. + + Returns + ------- + H : ndarray, shape(nx, ny) + The bi-dimensional histogram of samples `x` and `y`. Values in `x` + are histogrammed along the first dimension and values in `y` are + histogrammed along the second dimension. + xedges : ndarray, shape(nx+1,) + The bin edges along the first dimension. + yedges : ndarray, shape(ny+1,) + The bin edges along the second dimension. + + See Also + -------- + histogram : 1D histogram + histogramdd : Multidimensional histogram + + Notes + ----- + When `density` is True, then the returned histogram is the sample + density, defined such that the sum over bins of the product + ``bin_value * bin_area`` is 1. + + Please note that the histogram does not follow the Cartesian convention + where `x` values are on the abscissa and `y` values on the ordinate + axis. Rather, `x` is histogrammed along the first dimension of the + array (vertical), and `y` along the second dimension of the array + (horizontal). This ensures compatibility with `histogramdd`. + + Examples + -------- + >>> from matplotlib.image import NonUniformImage + >>> import matplotlib.pyplot as plt + + Construct a 2-D histogram with variable bin width. First define the bin + edges: + + >>> xedges = [0, 1, 3, 5] + >>> yedges = [0, 2, 3, 4, 6] + + Next we create a histogram H with random bin content: + + >>> x = np.random.normal(2, 1, 100) + >>> y = np.random.normal(1, 1, 100) + >>> H, xedges, yedges = np.histogram2d(x, y, bins=(xedges, yedges)) + >>> # Histogram does not follow Cartesian convention (see Notes), + >>> # therefore transpose H for visualization purposes. + >>> H = H.T + + :func:`imshow ` can only display square bins: + + >>> fig = plt.figure(figsize=(7, 3)) + >>> ax = fig.add_subplot(131, title='imshow: square bins') + >>> plt.imshow(H, interpolation='nearest', origin='lower', + ... extent=[xedges[0], xedges[-1], yedges[0], yedges[-1]]) + + + :func:`pcolormesh ` can display actual edges: + + >>> ax = fig.add_subplot(132, title='pcolormesh: actual edges', + ... aspect='equal') + >>> X, Y = np.meshgrid(xedges, yedges) + >>> ax.pcolormesh(X, Y, H) + + + :class:`NonUniformImage ` can be used to + display actual bin edges with interpolation: + + >>> ax = fig.add_subplot(133, title='NonUniformImage: interpolated', + ... aspect='equal', xlim=xedges[[0, -1]], ylim=yedges[[0, -1]]) + >>> im = NonUniformImage(ax, interpolation='bilinear') + >>> xcenters = (xedges[:-1] + xedges[1:]) / 2 + >>> ycenters = (yedges[:-1] + yedges[1:]) / 2 + >>> im.set_data(xcenters, ycenters, H) + >>> ax.add_image(im) + >>> plt.show() + + It is also possible to construct a 2-D histogram without specifying bin + edges: + + >>> # Generate non-symmetric test data + >>> n = 10000 + >>> x = np.linspace(1, 100, n) + >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 + >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges + >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) + + Now we can plot the histogram using + :func:`pcolormesh `, and a + :func:`hexbin ` for comparison. + + >>> # Plot histogram using pcolormesh + >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) + >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') + >>> ax1.plot(x, 2*np.log(x), 'k-') + >>> ax1.set_xlim(x.min(), x.max()) + >>> ax1.set_ylim(y.min(), y.max()) + >>> ax1.set_xlabel('x') + >>> ax1.set_ylabel('y') + >>> ax1.set_title('histogram2d') + >>> ax1.grid() + + >>> # Create hexbin plot for comparison + >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') + >>> ax2.plot(x, 2*np.log(x), 'k-') + >>> ax2.set_title('hexbin') + >>> ax2.set_xlim(x.min(), x.max()) + >>> ax2.set_xlabel('x') + >>> ax2.grid() + + >>> plt.show() + """ + from numpy import histogramdd + + if len(x) != len(y): + raise ValueError('x and y must have the same length.') + + try: + N = len(bins) + except TypeError: + N = 1 + + if N != 1 and N != 2: + xedges = yedges = asarray(bins) + bins = [xedges, yedges] + hist, edges = histogramdd([x, y], bins, range, density, weights) + return hist, edges[0], edges[1] + + +@set_module('numpy') +def mask_indices(n, mask_func, k=0): + """ + Return the indices to access (n, n) arrays, given a masking function. + + Assume `mask_func` is a function that, for a square array a of size + ``(n, n)`` with a possible offset argument `k`, when called as + ``mask_func(a, k)`` returns a new array with zeros in certain locations + (functions like `triu` or `tril` do precisely this). Then this function + returns the indices where the non-zero values would be located. + + Parameters + ---------- + n : int + The returned indices will be valid to access arrays of shape (n, n). + mask_func : callable + A function whose call signature is similar to that of `triu`, `tril`. + That is, ``mask_func(x, k)`` returns a boolean array, shaped like `x`. + `k` is an optional argument to the function. + k : scalar + An optional argument which is passed through to `mask_func`. Functions + like `triu`, `tril` take a second argument that is interpreted as an + offset. + + Returns + ------- + indices : tuple of arrays. + The `n` arrays of indices corresponding to the locations where + ``mask_func(np.ones((n, n)), k)`` is True. + + See Also + -------- + triu, tril, triu_indices, tril_indices + + Notes + ----- + .. versionadded:: 1.4.0 + + Examples + -------- + These are the indices that would allow you to access the upper triangular + part of any 3x3 array: + + >>> iu = np.mask_indices(3, np.triu) + + For example, if `a` is a 3x3 array: + + >>> a = np.arange(9).reshape(3, 3) + >>> a + array([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + >>> a[iu] + array([0, 1, 2, 4, 5, 8]) + + An offset can be passed also to the masking function. This gets us the + indices starting on the first diagonal right of the main one: + + >>> iu1 = np.mask_indices(3, np.triu, 1) + + with which we now extract only three elements: + + >>> a[iu1] + array([1, 2, 5]) + + """ + m = ones((n, n), int) + a = mask_func(m, k) + return nonzero(a != 0) + + +@set_module('numpy') +def tril_indices(n, k=0, m=None): + """ + Return the indices for the lower-triangle of an (n, m) array. + + Parameters + ---------- + n : int + The row dimension of the arrays for which the returned + indices will be valid. + k : int, optional + Diagonal offset (see `tril` for details). + m : int, optional + .. versionadded:: 1.9.0 + + The column dimension of the arrays for which the returned + arrays will be valid. + By default `m` is taken equal to `n`. + + + Returns + ------- + inds : tuple of arrays + The indices for the triangle. The returned tuple contains two arrays, + each with the indices along one dimension of the array. + + See also + -------- + triu_indices : similar function, for upper-triangular. + mask_indices : generic function accepting an arbitrary mask function. + tril, triu + + Notes + ----- + .. versionadded:: 1.4.0 + + Examples + -------- + Compute two different sets of indices to access 4x4 arrays, one for the + lower triangular part starting at the main diagonal, and one starting two + diagonals further right: + + >>> il1 = np.tril_indices(4) + >>> il2 = np.tril_indices(4, 2) + + Here is how they can be used with a sample array: + + >>> a = np.arange(16).reshape(4, 4) + >>> a + array([[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11], + [12, 13, 14, 15]]) + + Both for indexing: + + >>> a[il1] + array([ 0, 4, 5, ..., 13, 14, 15]) + + And for assigning values: + + >>> a[il1] = -1 + >>> a + array([[-1, 1, 2, 3], + [-1, -1, 6, 7], + [-1, -1, -1, 11], + [-1, -1, -1, -1]]) + + These cover almost the whole array (two diagonals right of the main one): + + >>> a[il2] = -10 + >>> a + array([[-10, -10, -10, 3], + [-10, -10, -10, -10], + [-10, -10, -10, -10], + [-10, -10, -10, -10]]) + + """ + tri_ = tri(n, m, k=k, dtype=bool) + + return tuple(broadcast_to(inds, tri_.shape)[tri_] + for inds in indices(tri_.shape, sparse=True)) + + +def _trilu_indices_form_dispatcher(arr, k=None): + return (arr,) + + +@array_function_dispatch(_trilu_indices_form_dispatcher) +def tril_indices_from(arr, k=0): + """ + Return the indices for the lower-triangle of arr. + + See `tril_indices` for full details. + + Parameters + ---------- + arr : array_like + The indices will be valid for square arrays whose dimensions are + the same as arr. + k : int, optional + Diagonal offset (see `tril` for details). + + Examples + -------- + + Create a 4 by 4 array. + + >>> a = np.arange(16).reshape(4, 4) + >>> a + array([[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11], + [12, 13, 14, 15]]) + + Pass the array to get the indices of the lower triangular elements. + + >>> trili = np.tril_indices_from(a) + >>> trili + (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) + + >>> a[trili] + array([ 0, 4, 5, 8, 9, 10, 12, 13, 14, 15]) + + This is syntactic sugar for tril_indices(). + + >>> np.tril_indices(a.shape[0]) + (array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) + + Use the `k` parameter to return the indices for the lower triangular array + up to the k-th diagonal. + + >>> trili1 = np.tril_indices_from(a, k=1) + >>> a[trili1] + array([ 0, 1, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15]) + + See Also + -------- + tril_indices, tril, triu_indices_from + + Notes + ----- + .. versionadded:: 1.4.0 + + """ + if arr.ndim != 2: + raise ValueError("input array must be 2-d") + return tril_indices(arr.shape[-2], k=k, m=arr.shape[-1]) + + +@set_module('numpy') +def triu_indices(n, k=0, m=None): + """ + Return the indices for the upper-triangle of an (n, m) array. + + Parameters + ---------- + n : int + The size of the arrays for which the returned indices will + be valid. + k : int, optional + Diagonal offset (see `triu` for details). + m : int, optional + .. versionadded:: 1.9.0 + + The column dimension of the arrays for which the returned + arrays will be valid. + By default `m` is taken equal to `n`. + + + Returns + ------- + inds : tuple, shape(2) of ndarrays, shape(`n`) + The indices for the triangle. The returned tuple contains two arrays, + each with the indices along one dimension of the array. Can be used + to slice a ndarray of shape(`n`, `n`). + + See also + -------- + tril_indices : similar function, for lower-triangular. + mask_indices : generic function accepting an arbitrary mask function. + triu, tril + + Notes + ----- + .. versionadded:: 1.4.0 + + Examples + -------- + Compute two different sets of indices to access 4x4 arrays, one for the + upper triangular part starting at the main diagonal, and one starting two + diagonals further right: + + >>> iu1 = np.triu_indices(4) + >>> iu2 = np.triu_indices(4, 2) + + Here is how they can be used with a sample array: + + >>> a = np.arange(16).reshape(4, 4) + >>> a + array([[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11], + [12, 13, 14, 15]]) + + Both for indexing: + + >>> a[iu1] + array([ 0, 1, 2, ..., 10, 11, 15]) + + And for assigning values: + + >>> a[iu1] = -1 + >>> a + array([[-1, -1, -1, -1], + [ 4, -1, -1, -1], + [ 8, 9, -1, -1], + [12, 13, 14, -1]]) + + These cover only a small part of the whole array (two diagonals right + of the main one): + + >>> a[iu2] = -10 + >>> a + array([[ -1, -1, -10, -10], + [ 4, -1, -1, -10], + [ 8, 9, -1, -1], + [ 12, 13, 14, -1]]) + + """ + tri_ = ~tri(n, m, k=k - 1, dtype=bool) + + return tuple(broadcast_to(inds, tri_.shape)[tri_] + for inds in indices(tri_.shape, sparse=True)) + + +@array_function_dispatch(_trilu_indices_form_dispatcher) +def triu_indices_from(arr, k=0): + """ + Return the indices for the upper-triangle of arr. + + See `triu_indices` for full details. + + Parameters + ---------- + arr : ndarray, shape(N, N) + The indices will be valid for square arrays. + k : int, optional + Diagonal offset (see `triu` for details). + + Returns + ------- + triu_indices_from : tuple, shape(2) of ndarray, shape(N) + Indices for the upper-triangle of `arr`. + + Examples + -------- + + Create a 4 by 4 array. + + >>> a = np.arange(16).reshape(4, 4) + >>> a + array([[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11], + [12, 13, 14, 15]]) + + Pass the array to get the indices of the upper triangular elements. + + >>> triui = np.triu_indices_from(a) + >>> triui + (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) + + >>> a[triui] + array([ 0, 1, 2, 3, 5, 6, 7, 10, 11, 15]) + + This is syntactic sugar for triu_indices(). + + >>> np.triu_indices(a.shape[0]) + (array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) + + Use the `k` parameter to return the indices for the upper triangular array + from the k-th diagonal. + + >>> triuim1 = np.triu_indices_from(a, k=1) + >>> a[triuim1] + array([ 1, 2, 3, 6, 7, 11]) + + + See Also + -------- + triu_indices, triu, tril_indices_from + + Notes + ----- + .. versionadded:: 1.4.0 + + """ + if arr.ndim != 2: + raise ValueError("input array must be 2-d") + return triu_indices(arr.shape[-2], k=k, m=arr.shape[-1]) diff --git a/shared/package-files/32/32fe4507eae2452bb0c2f54527ad06c314466ee16453f2d4e433d6f0a63c3539/blob b/shared/package-files/32/32fe4507eae2452bb0c2f54527ad06c314466ee16453f2d4e433d6f0a63c3539/blob new file mode 100644 index 0000000000000000000000000000000000000000..99c8ebb1e57b22059d5a545a79de7b8348d73b14 --- /dev/null +++ b/shared/package-files/32/32fe4507eae2452bb0c2f54527ad06c314466ee16453f2d4e433d6f0a63c3539/blob @@ -0,0 +1,190 @@ +import numpy as np +import pytest + +from pandas.errors import PerformanceWarning + +import pandas as pd +from pandas import ( + Index, + MultiIndex, +) +import pandas._testing as tm + + +def test_drop(idx): + dropped = idx.drop([("foo", "two"), ("qux", "one")]) + + index = MultiIndex.from_tuples([("foo", "two"), ("qux", "one")]) + dropped2 = idx.drop(index) + + expected = idx[[0, 2, 3, 5]] + tm.assert_index_equal(dropped, expected) + tm.assert_index_equal(dropped2, expected) + + dropped = idx.drop(["bar"]) + expected = idx[[0, 1, 3, 4, 5]] + tm.assert_index_equal(dropped, expected) + + dropped = idx.drop("foo") + expected = idx[[2, 3, 4, 5]] + tm.assert_index_equal(dropped, expected) + + index = MultiIndex.from_tuples([("bar", "two")]) + with pytest.raises(KeyError, match=r"^\('bar', 'two'\)$"): + idx.drop([("bar", "two")]) + with pytest.raises(KeyError, match=r"^\('bar', 'two'\)$"): + idx.drop(index) + with pytest.raises(KeyError, match=r"^'two'$"): + idx.drop(["foo", "two"]) + + # partially correct argument + mixed_index = MultiIndex.from_tuples([("qux", "one"), ("bar", "two")]) + with pytest.raises(KeyError, match=r"^\('bar', 'two'\)$"): + idx.drop(mixed_index) + + # error='ignore' + dropped = idx.drop(index, errors="ignore") + expected = idx[[0, 1, 2, 3, 4, 5]] + tm.assert_index_equal(dropped, expected) + + dropped = idx.drop(mixed_index, errors="ignore") + expected = idx[[0, 1, 2, 3, 5]] + tm.assert_index_equal(dropped, expected) + + dropped = idx.drop(["foo", "two"], errors="ignore") + expected = idx[[2, 3, 4, 5]] + tm.assert_index_equal(dropped, expected) + + # mixed partial / full drop + dropped = idx.drop(["foo", ("qux", "one")]) + expected = idx[[2, 3, 5]] + tm.assert_index_equal(dropped, expected) + + # mixed partial / full drop / error='ignore' + mixed_index = ["foo", ("qux", "one"), "two"] + with pytest.raises(KeyError, match=r"^'two'$"): + idx.drop(mixed_index) + dropped = idx.drop(mixed_index, errors="ignore") + expected = idx[[2, 3, 5]] + tm.assert_index_equal(dropped, expected) + + +def test_droplevel_with_names(idx): + index = idx[idx.get_loc("foo")] + dropped = index.droplevel(0) + assert dropped.name == "second" + + index = MultiIndex( + levels=[Index(range(4)), Index(range(4)), Index(range(4))], + codes=[ + np.array([0, 0, 1, 2, 2, 2, 3, 3]), + np.array([0, 1, 0, 0, 0, 1, 0, 1]), + np.array([1, 0, 1, 1, 0, 0, 1, 0]), + ], + names=["one", "two", "three"], + ) + dropped = index.droplevel(0) + assert dropped.names == ("two", "three") + + dropped = index.droplevel("two") + expected = index.droplevel(1) + assert dropped.equals(expected) + + +def test_droplevel_list(): + index = MultiIndex( + levels=[Index(range(4)), Index(range(4)), Index(range(4))], + codes=[ + np.array([0, 0, 1, 2, 2, 2, 3, 3]), + np.array([0, 1, 0, 0, 0, 1, 0, 1]), + np.array([1, 0, 1, 1, 0, 0, 1, 0]), + ], + names=["one", "two", "three"], + ) + + dropped = index[:2].droplevel(["three", "one"]) + expected = index[:2].droplevel(2).droplevel(0) + assert dropped.equals(expected) + + dropped = index[:2].droplevel([]) + expected = index[:2] + assert dropped.equals(expected) + + msg = ( + "Cannot remove 3 levels from an index with 3 levels: " + "at least one level must be left" + ) + with pytest.raises(ValueError, match=msg): + index[:2].droplevel(["one", "two", "three"]) + + with pytest.raises(KeyError, match="'Level four not found'"): + index[:2].droplevel(["one", "four"]) + + +def test_drop_not_lexsorted(): + # GH 12078 + + # define the lexsorted version of the multi-index + tuples = [("a", ""), ("b1", "c1"), ("b2", "c2")] + lexsorted_mi = MultiIndex.from_tuples(tuples, names=["b", "c"]) + assert lexsorted_mi._is_lexsorted() + + # and the not-lexsorted version + df = pd.DataFrame( + columns=["a", "b", "c", "d"], data=[[1, "b1", "c1", 3], [1, "b2", "c2", 4]] + ) + df = df.pivot_table(index="a", columns=["b", "c"], values="d") + df = df.reset_index() + not_lexsorted_mi = df.columns + assert not not_lexsorted_mi._is_lexsorted() + + # compare the results + tm.assert_index_equal(lexsorted_mi, not_lexsorted_mi) + with tm.assert_produces_warning(PerformanceWarning): + tm.assert_index_equal(lexsorted_mi.drop("a"), not_lexsorted_mi.drop("a")) + + +def test_drop_with_nan_in_index(nulls_fixture): + # GH#18853 + mi = MultiIndex.from_tuples([("blah", nulls_fixture)], names=["name", "date"]) + msg = r"labels \[Timestamp\('2001-01-01 00:00:00'\)\] not found in level" + with pytest.raises(KeyError, match=msg): + mi.drop(pd.Timestamp("2001"), level="date") + + +@pytest.mark.filterwarnings("ignore::pandas.errors.PerformanceWarning") +def test_drop_with_non_monotonic_duplicates(): + # GH#33494 + mi = MultiIndex.from_tuples([(1, 2), (2, 3), (1, 2)]) + result = mi.drop((1, 2)) + expected = MultiIndex.from_tuples([(2, 3)]) + tm.assert_index_equal(result, expected) + + +def test_single_level_drop_partially_missing_elements(): + # GH 37820 + + mi = MultiIndex.from_tuples([(1, 2), (2, 2), (3, 2)]) + msg = r"labels \[4\] not found in level" + with pytest.raises(KeyError, match=msg): + mi.drop(4, level=0) + with pytest.raises(KeyError, match=msg): + mi.drop([1, 4], level=0) + msg = r"labels \[nan\] not found in level" + with pytest.raises(KeyError, match=msg): + mi.drop([np.nan], level=0) + with pytest.raises(KeyError, match=msg): + mi.drop([np.nan, 1, 2, 3], level=0) + + mi = MultiIndex.from_tuples([(np.nan, 1), (1, 2)]) + msg = r"labels \['a'\] not found in level" + with pytest.raises(KeyError, match=msg): + mi.drop([np.nan, 1, "a"], level=0) + + +def test_droplevel_multiindex_one_level(): + # GH#37208 + index = MultiIndex.from_tuples([(2,)], names=("b",)) + result = index.droplevel([]) + expected = Index([2], name="b") + tm.assert_index_equal(result, expected) diff --git a/shared/package-files/33/3300593114fb9286af9360cc9d871a40e5dcbea4aedc24b832607d1dd71c7b96/blob b/shared/package-files/33/3300593114fb9286af9360cc9d871a40e5dcbea4aedc24b832607d1dd71c7b96/blob new file mode 100644 index 0000000000000000000000000000000000000000..f3602585ab0592c393fbe9526cb5aae4ae902f6c --- /dev/null +++ b/shared/package-files/33/3300593114fb9286af9360cc9d871a40e5dcbea4aedc24b832607d1dd71c7b96/blob @@ -0,0 +1,54 @@ +"""turtledemo.two_canvases + +Use TurtleScreen and RawTurtle to draw on two +distinct canvases in a separate window. The +new window must be separately closed in +addition to pressing the STOP button. +""" + +from turtle import TurtleScreen, RawTurtle, TK + +def main(): + root = TK.Tk() + cv1 = TK.Canvas(root, width=300, height=200, bg="#ddffff") + cv2 = TK.Canvas(root, width=300, height=200, bg="#ffeeee") + cv1.pack() + cv2.pack() + + s1 = TurtleScreen(cv1) + s1.bgcolor(0.85, 0.85, 1) + s2 = TurtleScreen(cv2) + s2.bgcolor(1, 0.85, 0.85) + + p = RawTurtle(s1) + q = RawTurtle(s2) + + p.color("red", (1, 0.85, 0.85)) + p.width(3) + q.color("blue", (0.85, 0.85, 1)) + q.width(3) + + for t in p,q: + t.shape("turtle") + t.lt(36) + + q.lt(180) + + for t in p, q: + t.begin_fill() + for i in range(5): + for t in p, q: + t.fd(50) + t.lt(72) + for t in p,q: + t.end_fill() + t.lt(54) + t.pu() + t.bk(50) + + return "EVENTLOOP" + + +if __name__ == '__main__': + main() + TK.mainloop() # keep window open until user closes it diff --git a/shared/package-files/33/33005b05ab9a5233626a36b6e6864ab7bbc8f5b4465df17994ad69fbc010ebb5/blob b/shared/package-files/33/33005b05ab9a5233626a36b6e6864ab7bbc8f5b4465df17994ad69fbc010ebb5/blob new file mode 100644 index 0000000000000000000000000000000000000000..3916b1a510ad6ad96227c7f9bb8bb94471798a53 --- /dev/null +++ b/shared/package-files/33/33005b05ab9a5233626a36b6e6864ab7bbc8f5b4465df17994ad69fbc010ebb5/blob @@ -0,0 +1,282 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import InvalidTag, UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.primitives import ciphers +from cryptography.hazmat.primitives.ciphers import algorithms, modes + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +class _CipherContext: + _ENCRYPT = 1 + _DECRYPT = 0 + _MAX_CHUNK_SIZE = 2**29 + + def __init__(self, backend: Backend, cipher, mode, operation: int) -> None: + self._backend = backend + self._cipher = cipher + self._mode = mode + self._operation = operation + self._tag: bytes | None = None + + if isinstance(self._cipher, ciphers.BlockCipherAlgorithm): + self._block_size_bytes = self._cipher.block_size // 8 + else: + self._block_size_bytes = 1 + + ctx = self._backend._lib.EVP_CIPHER_CTX_new() + ctx = self._backend._ffi.gc( + ctx, self._backend._lib.EVP_CIPHER_CTX_free + ) + + registry = self._backend._cipher_registry + try: + adapter = registry[type(cipher), type(mode)] + except KeyError: + raise UnsupportedAlgorithm( + "cipher {} in {} mode is not supported " + "by this backend.".format( + cipher.name, mode.name if mode else mode + ), + _Reasons.UNSUPPORTED_CIPHER, + ) + + evp_cipher = adapter(self._backend, cipher, mode) + if evp_cipher == self._backend._ffi.NULL: + msg = f"cipher {cipher.name} " + if mode is not None: + msg += f"in {mode.name} mode " + msg += ( + "is not supported by this backend (Your version of OpenSSL " + "may be too old. Current version: {}.)" + ).format(self._backend.openssl_version_text()) + raise UnsupportedAlgorithm(msg, _Reasons.UNSUPPORTED_CIPHER) + + if isinstance(mode, modes.ModeWithInitializationVector): + iv_nonce = self._backend._ffi.from_buffer( + mode.initialization_vector + ) + elif isinstance(mode, modes.ModeWithTweak): + iv_nonce = self._backend._ffi.from_buffer(mode.tweak) + elif isinstance(mode, modes.ModeWithNonce): + iv_nonce = self._backend._ffi.from_buffer(mode.nonce) + elif isinstance(cipher, algorithms.ChaCha20): + iv_nonce = self._backend._ffi.from_buffer(cipher.nonce) + else: + iv_nonce = self._backend._ffi.NULL + # begin init with cipher and operation type + res = self._backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + operation, + ) + self._backend.openssl_assert(res != 0) + # set the key length to handle variable key ciphers + res = self._backend._lib.EVP_CIPHER_CTX_set_key_length( + ctx, len(cipher.key) + ) + self._backend.openssl_assert(res != 0) + if isinstance(mode, modes.GCM): + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + self._backend._lib.EVP_CTRL_AEAD_SET_IVLEN, + len(iv_nonce), + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(res != 0) + if mode.tag is not None: + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + self._backend._lib.EVP_CTRL_AEAD_SET_TAG, + len(mode.tag), + mode.tag, + ) + self._backend.openssl_assert(res != 0) + self._tag = mode.tag + + # pass key/iv + res = self._backend._lib.EVP_CipherInit_ex( + ctx, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + self._backend._ffi.from_buffer(cipher.key), + iv_nonce, + operation, + ) + + # Check for XTS mode duplicate keys error + errors = self._backend._consume_errors() + lib = self._backend._lib + if res == 0 and ( + ( + not lib.CRYPTOGRAPHY_IS_LIBRESSL + and errors[0]._lib_reason_match( + lib.ERR_LIB_EVP, lib.EVP_R_XTS_DUPLICATED_KEYS + ) + ) + or ( + lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + lib.ERR_LIB_PROV, lib.PROV_R_XTS_DUPLICATED_KEYS + ) + ) + ): + raise ValueError("In XTS mode duplicated keys are not allowed") + + self._backend.openssl_assert(res != 0, errors=errors) + + # We purposely disable padding here as it's handled higher up in the + # API. + self._backend._lib.EVP_CIPHER_CTX_set_padding(ctx, 0) + self._ctx = ctx + + def update(self, data: bytes) -> bytes: + buf = bytearray(len(data) + self._block_size_bytes - 1) + n = self.update_into(data, buf) + return bytes(buf[:n]) + + def update_into(self, data: bytes, buf: bytes) -> int: + total_data_len = len(data) + if len(buf) < (total_data_len + self._block_size_bytes - 1): + raise ValueError( + "buffer must be at least {} bytes for this payload".format( + len(data) + self._block_size_bytes - 1 + ) + ) + + data_processed = 0 + total_out = 0 + outlen = self._backend._ffi.new("int *") + baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True) + baseinbuf = self._backend._ffi.from_buffer(data) + + while data_processed != total_data_len: + outbuf = baseoutbuf + total_out + inbuf = baseinbuf + data_processed + inlen = min(self._MAX_CHUNK_SIZE, total_data_len - data_processed) + + res = self._backend._lib.EVP_CipherUpdate( + self._ctx, outbuf, outlen, inbuf, inlen + ) + if res == 0 and isinstance(self._mode, modes.XTS): + self._backend._consume_errors() + raise ValueError( + "In XTS mode you must supply at least a full block in the " + "first update call. For AES this is 16 bytes." + ) + else: + self._backend.openssl_assert(res != 0) + data_processed += inlen + total_out += outlen[0] + + return total_out + + def finalize(self) -> bytes: + if ( + self._operation == self._DECRYPT + and isinstance(self._mode, modes.ModeWithAuthenticationTag) + and self.tag is None + ): + raise ValueError( + "Authentication tag must be provided when decrypting." + ) + + buf = self._backend._ffi.new("unsigned char[]", self._block_size_bytes) + outlen = self._backend._ffi.new("int *") + res = self._backend._lib.EVP_CipherFinal_ex(self._ctx, buf, outlen) + if res == 0: + errors = self._backend._consume_errors() + + if not errors and isinstance(self._mode, modes.GCM): + raise InvalidTag + + lib = self._backend._lib + self._backend.openssl_assert( + errors[0]._lib_reason_match( + lib.ERR_LIB_EVP, + lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH, + ) + or ( + lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + lib.ERR_LIB_PROV, + lib.PROV_R_WRONG_FINAL_BLOCK_LENGTH, + ) + ) + or ( + lib.CRYPTOGRAPHY_IS_BORINGSSL + and errors[0].reason + == lib.CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH + ), + errors=errors, + ) + raise ValueError( + "The length of the provided data is not a multiple of " + "the block length." + ) + + if ( + isinstance(self._mode, modes.GCM) + and self._operation == self._ENCRYPT + ): + tag_buf = self._backend._ffi.new( + "unsigned char[]", self._block_size_bytes + ) + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + self._ctx, + self._backend._lib.EVP_CTRL_AEAD_GET_TAG, + self._block_size_bytes, + tag_buf, + ) + self._backend.openssl_assert(res != 0) + self._tag = self._backend._ffi.buffer(tag_buf)[:] + + res = self._backend._lib.EVP_CIPHER_CTX_reset(self._ctx) + self._backend.openssl_assert(res == 1) + return self._backend._ffi.buffer(buf)[: outlen[0]] + + def finalize_with_tag(self, tag: bytes) -> bytes: + tag_len = len(tag) + if tag_len < self._mode._min_tag_length: + raise ValueError( + "Authentication tag must be {} bytes or longer.".format( + self._mode._min_tag_length + ) + ) + elif tag_len > self._block_size_bytes: + raise ValueError( + "Authentication tag cannot be more than {} bytes.".format( + self._block_size_bytes + ) + ) + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + self._ctx, self._backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag + ) + self._backend.openssl_assert(res != 0) + self._tag = tag + return self.finalize() + + def authenticate_additional_data(self, data: bytes) -> None: + outlen = self._backend._ffi.new("int *") + res = self._backend._lib.EVP_CipherUpdate( + self._ctx, + self._backend._ffi.NULL, + outlen, + self._backend._ffi.from_buffer(data), + len(data), + ) + self._backend.openssl_assert(res != 0) + + @property + def tag(self) -> bytes | None: + return self._tag diff --git a/shared/package-files/33/33085245aa389b0dcda728610cc30321790a8f619b3eeda03e24f17cccf8fccc/blob b/shared/package-files/33/33085245aa389b0dcda728610cc30321790a8f619b3eeda03e24f17cccf8fccc/blob new file mode 100644 index 0000000000000000000000000000000000000000..9ac4ed5d0c45296d42e9037f1e362d1ea5e9dabc --- /dev/null +++ b/shared/package-files/33/33085245aa389b0dcda728610cc30321790a8f619b3eeda03e24f17cccf8fccc/blob @@ -0,0 +1,47 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::linalg_vander(Tensor x, *, SymInt? N=None) -> Tensor +inline at::Tensor linalg_vander(const at::Tensor & x, c10::optional N=c10::nullopt) { + return at::_ops::linalg_vander::call(x, N.has_value() ? c10::make_optional(c10::SymInt(*N)) : c10::nullopt); +} +namespace symint { + template ::value>> + at::Tensor linalg_vander(const at::Tensor & x, c10::optional N=c10::nullopt) { + return at::_ops::linalg_vander::call(x, N.has_value() ? c10::make_optional(c10::SymInt(*N)) : c10::nullopt); + } +} + +// aten::linalg_vander(Tensor x, *, SymInt? N=None) -> Tensor +inline at::Tensor linalg_vander_symint(const at::Tensor & x, c10::optional N=c10::nullopt) { + return at::_ops::linalg_vander::call(x, N); +} +namespace symint { + template ::value>> + at::Tensor linalg_vander(const at::Tensor & x, c10::optional N=c10::nullopt) { + return at::_ops::linalg_vander::call(x, N); + } +} + +} diff --git a/shared/package-files/33/330bff9279f9946aa1f8182ee01c15e4c597b1df891a3b275190476e62de1951/blob b/shared/package-files/33/330bff9279f9946aa1f8182ee01c15e4c597b1df891a3b275190476e62de1951/blob new file mode 100644 index 0000000000000000000000000000000000000000..468790f00ea172320e2cb4fef7392f44b53ccdfa --- /dev/null +++ b/shared/package-files/33/330bff9279f9946aa1f8182ee01c15e4c597b1df891a3b275190476e62de1951/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:330bff9279f9946aa1f8182ee01c15e4c597b1df891a3b275190476e62de1951 +size 489850 diff --git a/shared/package-files/33/330fa9d3b183cadb415ca68d0794aee61c34d434176608c465ee4cd5eecf9611/blob b/shared/package-files/33/330fa9d3b183cadb415ca68d0794aee61c34d434176608c465ee4cd5eecf9611/blob new file mode 100644 index 0000000000000000000000000000000000000000..fa43fc1bc122f2ccf3942ee71791bc49eaced7a4 --- /dev/null +++ b/shared/package-files/33/330fa9d3b183cadb415ca68d0794aee61c34d434176608c465ee4cd5eecf9611/blob @@ -0,0 +1,25 @@ +from abc import ABCMeta, abstractmethod + +from cryptography.hazmat.primitives.serialization import Encoding, KeySerializationEncryption, PrivateFormat, PublicFormat + +class Ed448PrivateKey(metaclass=ABCMeta): + @classmethod + def generate(cls) -> Ed448PrivateKey: ... + @classmethod + def from_private_bytes(cls, data: bytes) -> Ed448PrivateKey: ... + @abstractmethod + def private_bytes( + self, encoding: Encoding, format: PrivateFormat, encryption_algorithm: KeySerializationEncryption + ) -> bytes: ... + @abstractmethod + def public_key(self) -> Ed448PublicKey: ... + @abstractmethod + def sign(self, data: bytes) -> bytes: ... + +class Ed448PublicKey(metaclass=ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> Ed448PublicKey: ... + @abstractmethod + def public_bytes(self, encoding: Encoding, format: PublicFormat) -> bytes: ... + @abstractmethod + def verify(self, signature: bytes, data: bytes) -> None: ... diff --git a/shared/package-files/33/3311dac7a97de32aa54d5665780a86efb20b11b5bac14e68b0f707cf127ce67b/blob b/shared/package-files/33/3311dac7a97de32aa54d5665780a86efb20b11b5bac14e68b0f707cf127ce67b/blob new file mode 100644 index 0000000000000000000000000000000000000000..26cedfd77566e7b7865345e0775af88153e74ffc --- /dev/null +++ b/shared/package-files/33/3311dac7a97de32aa54d5665780a86efb20b11b5bac14e68b0f707cf127ce67b/blob @@ -0,0 +1,76 @@ +import numpy as np +import numpy.typing as npt + +AR_f8: npt.NDArray[np.float64] = np.array([1.0]) +AR_i4 = np.array([1], dtype=np.int32) +AR_u1 = np.array([1], dtype=np.uint8) + +AR_LIKE_f = [1.5] +AR_LIKE_i = [1] + +b_f8 = np.broadcast(AR_f8) +b_i4_f8_f8 = np.broadcast(AR_i4, AR_f8, AR_f8) + +next(b_f8) +b_f8.reset() +b_f8.index +b_f8.iters +b_f8.nd +b_f8.ndim +b_f8.numiter +b_f8.shape +b_f8.size + +next(b_i4_f8_f8) +b_i4_f8_f8.reset() +b_i4_f8_f8.ndim +b_i4_f8_f8.index +b_i4_f8_f8.iters +b_i4_f8_f8.nd +b_i4_f8_f8.numiter +b_i4_f8_f8.shape +b_i4_f8_f8.size + +np.inner(AR_f8, AR_i4) + +np.where([True, True, False]) +np.where([True, True, False], 1, 0) + +np.lexsort([0, 1, 2]) + +np.can_cast(np.dtype("i8"), int) +np.can_cast(AR_f8, "f8") +np.can_cast(AR_f8, np.complex128, casting="unsafe") + +np.min_scalar_type([1]) +np.min_scalar_type(AR_f8) + +np.result_type(int, AR_i4) +np.result_type(AR_f8, AR_u1) +np.result_type(AR_f8, np.complex128) + +np.dot(AR_LIKE_f, AR_i4) +np.dot(AR_u1, 1) +np.dot(1.5j, 1) +np.dot(AR_u1, 1, out=AR_f8) + +np.vdot(AR_LIKE_f, AR_i4) +np.vdot(AR_u1, 1) +np.vdot(1.5j, 1) + +np.bincount(AR_i4) + +np.copyto(AR_f8, [1.6]) + +np.putmask(AR_f8, [True], 1.5) + +np.packbits(AR_i4) +np.packbits(AR_u1) + +np.unpackbits(AR_u1) + +np.shares_memory(1, 2) +np.shares_memory(AR_f8, AR_f8, max_work=1) + +np.may_share_memory(1, 2) +np.may_share_memory(AR_f8, AR_f8, max_work=1) diff --git a/shared/package-files/33/331296a1aed4a094512e29b9dc7e8ea3261fcfcecfdfff585171983d39271954/blob b/shared/package-files/33/331296a1aed4a094512e29b9dc7e8ea3261fcfcecfdfff585171983d39271954/blob new file mode 100644 index 0000000000000000000000000000000000000000..68df0b96f48d80f386bfe68a164bd7320c73fa6e --- /dev/null +++ b/shared/package-files/33/331296a1aed4a094512e29b9dc7e8ea3261fcfcecfdfff585171983d39271954/blob @@ -0,0 +1,27 @@ +import sys +from typing import Any + +import numpy as np +import numpy.typing as npt + +if sys.version_info >= (3, 11): + from typing import assert_type +else: + from typing_extensions import assert_type + +AR_i8: npt.NDArray[np.int64] +AR_f8: npt.NDArray[np.float64] + +assert_type(np.histogram_bin_edges(AR_i8, bins="auto"), npt.NDArray[Any]) +assert_type(np.histogram_bin_edges(AR_i8, bins="rice", range=(0, 3)), npt.NDArray[Any]) +assert_type(np.histogram_bin_edges(AR_i8, bins="scott", weights=AR_f8), npt.NDArray[Any]) + +assert_type(np.histogram(AR_i8, bins="auto"), tuple[npt.NDArray[Any], npt.NDArray[Any]]) +assert_type(np.histogram(AR_i8, bins="rice", range=(0, 3)), tuple[npt.NDArray[Any], npt.NDArray[Any]]) +assert_type(np.histogram(AR_i8, bins="scott", weights=AR_f8), tuple[npt.NDArray[Any], npt.NDArray[Any]]) +assert_type(np.histogram(AR_f8, bins=1, density=True), tuple[npt.NDArray[Any], npt.NDArray[Any]]) + +assert_type(np.histogramdd(AR_i8, bins=[1]), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]]) +assert_type(np.histogramdd(AR_i8, range=[(0, 3)]), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]]) +assert_type(np.histogramdd(AR_i8, weights=AR_f8), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]]) +assert_type(np.histogramdd(AR_f8, density=True), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]]) diff --git a/shared/package-files/33/3313b8d0e4e0ff9cff1273326fac1e4078e1b732f55a04b07e3097734ce5f366/blob b/shared/package-files/33/3313b8d0e4e0ff9cff1273326fac1e4078e1b732f55a04b07e3097734ce5f366/blob new file mode 100644 index 0000000000000000000000000000000000000000..5a7238ec7ca89aa55c3b8119b18c4e7c2e1e882e --- /dev/null +++ b/shared/package-files/33/3313b8d0e4e0ff9cff1273326fac1e4078e1b732f55a04b07e3097734ce5f366/blob @@ -0,0 +1,79 @@ +""" + pygments.lexers.parasail + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for ParaSail. + + :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Literal + +__all__ = ['ParaSailLexer'] + + +class ParaSailLexer(RegexLexer): + """ + For ParaSail source code. + + .. versionadded:: 2.1 + """ + + name = 'ParaSail' + url = 'http://www.parasail-lang.org' + aliases = ['parasail'] + filenames = ['*.psi', '*.psl'] + mimetypes = ['text/x-parasail'] + + flags = re.MULTILINE + + tokens = { + 'root': [ + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'\b(and|or|xor)=', Operator.Word), + (r'\b(and(\s+then)?|or(\s+else)?|xor|rem|mod|' + r'(is|not)\s+null)\b', + Operator.Word), + # Keywords + (r'\b(abs|abstract|all|block|class|concurrent|const|continue|' + r'each|end|exit|extends|exports|forward|func|global|implements|' + r'import|in|interface|is|lambda|locked|new|not|null|of|op|' + r'optional|private|queued|ref|return|reverse|separate|some|' + r'type|until|var|with|' + # Control flow + r'if|then|else|elsif|case|for|while|loop)\b', + Keyword.Reserved), + (r'(abstract\s+)?(interface|class|op|func|type)', + Keyword.Declaration), + # Literals + (r'"[^"]*"', String), + (r'\\[\'ntrf"0]', String.Escape), + (r'#[a-zA-Z]\w*', Literal), # Enumeration + include('numbers'), + (r"'[^']'", String.Char), + (r'[a-zA-Z]\w*', Name), + # Operators and Punctuation + (r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|' + r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|' + r'\.\.|<\.\.|\.\.<|<\.\.<)', + Operator), + (r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)', + Punctuation), + (r'\n+', Text), + ], + 'numbers': [ + (r'\d[0-9_]*#[0-9a-fA-F][0-9a-fA-F_]*#', Number.Hex), # any base + (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex), # C-like hex + (r'0[bB][01][01_]*', Number.Bin), # C-like bin + (r'\d[0-9_]*\.\d[0-9_]*[eE][+-]\d[0-9_]*', # float exp + Number.Float), + (r'\d[0-9_]*\.\d[0-9_]*', Number.Float), # float + (r'\d[0-9_]*', Number.Integer), # integer + ], + } diff --git a/shared/package-files/33/3318448046c83c176f95a97c33b5cd82e0076bee038d72810bef3dac1085e590/blob b/shared/package-files/33/3318448046c83c176f95a97c33b5cd82e0076bee038d72810bef3dac1085e590/blob new file mode 100644 index 0000000000000000000000000000000000000000..98a20da7f15c11d90a4243b8319131ceed2e8f4c --- /dev/null +++ b/shared/package-files/33/3318448046c83c176f95a97c33b5cd82e0076bee038d72810bef3dac1085e590/blob @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_tree.py + +Displays a 'breadth-first-tree' - in contrast +to the classical Logo tree drawing programs, +which use a depth-first-algorithm. + +Uses: +(1) a tree-generator, where the drawing is +quasi the side-effect, whereas the generator +always yields None. +(2) Turtle-cloning: At each branching point +the current pen is cloned. So in the end +there are 1024 turtles. +""" +from turtle import Turtle, mainloop +from time import perf_counter as clock + +def tree(plist, l, a, f): + """ plist is list of pens + l is length of branch + a is half of the angle between 2 branches + f is factor by which branch is shortened + from level to level.""" + if l > 3: + lst = [] + for p in plist: + p.forward(l) + q = p.clone() + p.left(a) + q.right(a) + lst.append(p) + lst.append(q) + for x in tree(lst, l*f, a, f): + yield None + +def maketree(): + p = Turtle() + p.setundobuffer(None) + p.hideturtle() + p.speed(0) + p.getscreen().tracer(30,0) + p.left(90) + p.penup() + p.forward(-210) + p.pendown() + t = tree([p], 200, 65, 0.6375) + for x in t: + pass + +def main(): + a=clock() + maketree() + b=clock() + return "done: %.2f sec." % (b-a) + +if __name__ == "__main__": + msg = main() + print(msg) + mainloop() diff --git a/shared/package-files/33/331c770f5e07eb18d510cfe34f14da5b2f5620d82b4662d65c9a47e5281797e7/blob b/shared/package-files/33/331c770f5e07eb18d510cfe34f14da5b2f5620d82b4662d65c9a47e5281797e7/blob new file mode 100644 index 0000000000000000000000000000000000000000..27c79e644e34d3e6f88d0329ffc4c8cc3423eba6 --- /dev/null +++ b/shared/package-files/33/331c770f5e07eb18d510cfe34f14da5b2f5620d82b4662d65c9a47e5281797e7/blob @@ -0,0 +1,69 @@ +# Copyright (C) 2012 Anaconda, Inc +# SPDX-License-Identifier: BSD-3-Clause +import random +import types +import unittest +from contextlib import contextmanager +from unittest import mock + +from conda.exceptions import SpecNotFound +from conda_env import specs + +true_func = mock.Mock(return_value=True) +false_func = mock.Mock(return_value=False) + + +@contextmanager +def patched_specs(*new_specs): + with mock.patch.object(specs, "all_specs") as all_specs: + all_specs.__iter__.return_value = new_specs + yield all_specs + + +def generate_two_specs(): + spec1 = mock.Mock(can_handle=false_func) + spec1.return_value = spec1 + spec2 = mock.Mock(can_handle=true_func) + spec2.return_value = spec2 + return spec1, spec2 + + +class DetectTestCase(unittest.TestCase): + def test_has_detect_function(self): + self.assertTrue(hasattr(specs, "detect")) + self.assertIsInstance(specs.detect, types.FunctionType) + + def test_dispatches_to_registered_specs(self): + spec1, spec2 = generate_two_specs() + with patched_specs(spec1, spec2): + actual = specs.detect(name="foo") + self.assertEqual(actual, spec2) + + def test_passes_kwargs_to_all_specs(self): + random_kwargs = { + "foo": random.randint(100, 200), + "bar%d" % random.randint(100, 200): True, + } + + spec1, spec2 = generate_two_specs() + with patched_specs(spec1, spec2): + specs.detect(**random_kwargs) + spec1.assert_called_with(**random_kwargs) + spec2.assert_called_with(**random_kwargs) + + def test_raises_exception_if_no_detection(self): + spec1 = generate_two_specs()[0] + spec1.msg = "msg" + with patched_specs(spec1): + with self.assertRaises(SpecNotFound): + specs.detect(name="foo") + + def test_has_build_msg_function(self): + self.assertTrue(hasattr(specs, "build_message")) + self.assertIsInstance(specs.build_message, types.FunctionType) + + def test_build_msg(self): + spec3 = mock.Mock(msg="error 3") + spec4 = mock.Mock(msg="error 4") + spec5 = mock.Mock(msg=None) + self.assertEqual(specs.build_message([spec3, spec4, spec5]), "error 3\nerror 4") diff --git a/shared/package-files/33/331ca6c70946040dcfc76145cb321212d027915a317aaf9b24cd5f9368e412db/blob b/shared/package-files/33/331ca6c70946040dcfc76145cb321212d027915a317aaf9b24cd5f9368e412db/blob new file mode 100644 index 0000000000000000000000000000000000000000..51208a709effc135c0d05baa56d1313bb76e2892 --- /dev/null +++ b/shared/package-files/33/331ca6c70946040dcfc76145cb321212d027915a317aaf9b24cd5f9368e412db/blob @@ -0,0 +1,172 @@ +"""Real and complex elements. """ + + +from sympy.polys.domains.domainelement import DomainElement +from sympy.utilities import public + +from mpmath.ctx_mp_python import PythonMPContext, _mpf, _mpc, _constant +from mpmath.libmp import (MPZ_ONE, fzero, fone, finf, fninf, fnan, + round_nearest, mpf_mul, repr_dps, int_types, + from_int, from_float, from_str, to_rational) +from mpmath.rational import mpq + + +@public +class RealElement(_mpf, DomainElement): + """An element of a real domain. """ + + __slots__ = ('__mpf__',) + + def _set_mpf(self, val): + self.__mpf__ = val + + _mpf_ = property(lambda self: self.__mpf__, _set_mpf) + + def parent(self): + return self.context._parent + +@public +class ComplexElement(_mpc, DomainElement): + """An element of a complex domain. """ + + __slots__ = ('__mpc__',) + + def _set_mpc(self, val): + self.__mpc__ = val + + _mpc_ = property(lambda self: self.__mpc__, _set_mpc) + + def parent(self): + return self.context._parent + +new = object.__new__ + +@public +class MPContext(PythonMPContext): + + def __init__(ctx, prec=53, dps=None, tol=None, real=False): + ctx._prec_rounding = [prec, round_nearest] + + if dps is None: + ctx._set_prec(prec) + else: + ctx._set_dps(dps) + + ctx.mpf = RealElement + ctx.mpc = ComplexElement + ctx.mpf._ctxdata = [ctx.mpf, new, ctx._prec_rounding] + ctx.mpc._ctxdata = [ctx.mpc, new, ctx._prec_rounding] + + if real: + ctx.mpf.context = ctx + else: + ctx.mpc.context = ctx + + ctx.constant = _constant + ctx.constant._ctxdata = [ctx.mpf, new, ctx._prec_rounding] + ctx.constant.context = ctx + + ctx.types = [ctx.mpf, ctx.mpc, ctx.constant] + ctx.trap_complex = True + ctx.pretty = True + + if tol is None: + ctx.tol = ctx._make_tol() + elif tol is False: + ctx.tol = fzero + else: + ctx.tol = ctx._convert_tol(tol) + + ctx.tolerance = ctx.make_mpf(ctx.tol) + + if not ctx.tolerance: + ctx.max_denom = 1000000 + else: + ctx.max_denom = int(1/ctx.tolerance) + + ctx.zero = ctx.make_mpf(fzero) + ctx.one = ctx.make_mpf(fone) + ctx.j = ctx.make_mpc((fzero, fone)) + ctx.inf = ctx.make_mpf(finf) + ctx.ninf = ctx.make_mpf(fninf) + ctx.nan = ctx.make_mpf(fnan) + + def _make_tol(ctx): + hundred = (0, 25, 2, 5) + eps = (0, MPZ_ONE, 1-ctx.prec, 1) + return mpf_mul(hundred, eps) + + def make_tol(ctx): + return ctx.make_mpf(ctx._make_tol()) + + def _convert_tol(ctx, tol): + if isinstance(tol, int_types): + return from_int(tol) + if isinstance(tol, float): + return from_float(tol) + if hasattr(tol, "_mpf_"): + return tol._mpf_ + prec, rounding = ctx._prec_rounding + if isinstance(tol, str): + return from_str(tol, prec, rounding) + raise ValueError("expected a real number, got %s" % tol) + + def _convert_fallback(ctx, x, strings): + raise TypeError("cannot create mpf from " + repr(x)) + + @property + def _repr_digits(ctx): + return repr_dps(ctx._prec) + + @property + def _str_digits(ctx): + return ctx._dps + + def to_rational(ctx, s, limit=True): + p, q = to_rational(s._mpf_) + + if not limit or q <= ctx.max_denom: + return p, q + + p0, q0, p1, q1 = 0, 1, 1, 0 + n, d = p, q + + while True: + a = n//d + q2 = q0 + a*q1 + if q2 > ctx.max_denom: + break + p0, q0, p1, q1 = p1, q1, p0 + a*p1, q2 + n, d = d, n - a*d + + k = (ctx.max_denom - q0)//q1 + + number = mpq(p, q) + bound1 = mpq(p0 + k*p1, q0 + k*q1) + bound2 = mpq(p1, q1) + + if not bound2 or not bound1: + return p, q + elif abs(bound2 - number) <= abs(bound1 - number): + return bound2._mpq_ + else: + return bound1._mpq_ + + def almosteq(ctx, s, t, rel_eps=None, abs_eps=None): + t = ctx.convert(t) + if abs_eps is None and rel_eps is None: + rel_eps = abs_eps = ctx.tolerance or ctx.make_tol() + if abs_eps is None: + abs_eps = ctx.convert(rel_eps) + elif rel_eps is None: + rel_eps = ctx.convert(abs_eps) + diff = abs(s-t) + if diff <= abs_eps: + return True + abss = abs(s) + abst = abs(t) + if abss < abst: + err = diff/abst + else: + err = diff/abss + return err <= rel_eps diff --git a/shared/package-files/33/331f3a5c201fc345c41baedd53bdc68d96598b7f0464c244af0be0ae6efe4e15/blob b/shared/package-files/33/331f3a5c201fc345c41baedd53bdc68d96598b7f0464c244af0be0ae6efe4e15/blob new file mode 100644 index 0000000000000000000000000000000000000000..df2dbd6f43bdb52879893293a222d9e98fcb38b8 --- /dev/null +++ b/shared/package-files/33/331f3a5c201fc345c41baedd53bdc68d96598b7f0464c244af0be0ae6efe4e15/blob @@ -0,0 +1,743 @@ +import gc +import platform + +import numpy as np +import pytest + +import matplotlib as mpl +from matplotlib.testing.decorators import image_comparison +import matplotlib.pyplot as plt +import matplotlib.transforms as mtransforms +from matplotlib import gridspec, ticker + + +pytestmark = [ + pytest.mark.usefixtures('text_placeholders') +] + + +def example_plot(ax, fontsize=12, nodec=False): + ax.plot([1, 2]) + ax.locator_params(nbins=3) + if not nodec: + ax.set_xlabel('x-label', fontsize=fontsize) + ax.set_ylabel('y-label', fontsize=fontsize) + ax.set_title('Title', fontsize=fontsize) + else: + ax.set_xticklabels([]) + ax.set_yticklabels([]) + + +def example_pcolor(ax, fontsize=12): + dx, dy = 0.6, 0.6 + y, x = np.mgrid[slice(-3, 3 + dy, dy), + slice(-3, 3 + dx, dx)] + z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2) + pcm = ax.pcolormesh(x, y, z[:-1, :-1], cmap='RdBu_r', vmin=-1., vmax=1., + rasterized=True) + ax.set_xlabel('x-label', fontsize=fontsize) + ax.set_ylabel('y-label', fontsize=fontsize) + ax.set_title('Title', fontsize=fontsize) + return pcm + + +@image_comparison(['constrained_layout1.png'], style='mpl20') +def test_constrained_layout1(): + """Test constrained_layout for a single subplot""" + fig = plt.figure(layout="constrained") + ax = fig.add_subplot() + example_plot(ax, fontsize=24) + + +@image_comparison(['constrained_layout2.png'], style='mpl20') +def test_constrained_layout2(): + """Test constrained_layout for 2x2 subplots""" + fig, axs = plt.subplots(2, 2, layout="constrained") + for ax in axs.flat: + example_plot(ax, fontsize=24) + + +@image_comparison(['constrained_layout3.png'], style='mpl20') +def test_constrained_layout3(): + """Test constrained_layout for colorbars with subplots""" + + fig, axs = plt.subplots(2, 2, layout="constrained") + for nn, ax in enumerate(axs.flat): + pcm = example_pcolor(ax, fontsize=24) + if nn == 3: + pad = 0.08 + else: + pad = 0.02 # default + fig.colorbar(pcm, ax=ax, pad=pad) + + +@image_comparison(['constrained_layout4.png'], style='mpl20') +def test_constrained_layout4(): + """Test constrained_layout for a single colorbar with subplots""" + + fig, axs = plt.subplots(2, 2, layout="constrained") + for ax in axs.flat: + pcm = example_pcolor(ax, fontsize=24) + fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6) + + +@image_comparison(['constrained_layout5.png'], style='mpl20') +def test_constrained_layout5(): + """ + Test constrained_layout for a single colorbar with subplots, + colorbar bottom + """ + + fig, axs = plt.subplots(2, 2, layout="constrained") + for ax in axs.flat: + pcm = example_pcolor(ax, fontsize=24) + fig.colorbar(pcm, ax=axs, + use_gridspec=False, pad=0.01, shrink=0.6, + location='bottom') + + +@image_comparison(['constrained_layout6.png'], style='mpl20') +def test_constrained_layout6(): + """Test constrained_layout for nested gridspecs""" + fig = plt.figure(layout="constrained") + gs = fig.add_gridspec(1, 2, figure=fig) + gsl = gs[0].subgridspec(2, 2) + gsr = gs[1].subgridspec(1, 2) + axsl = [] + for gs in gsl: + ax = fig.add_subplot(gs) + axsl += [ax] + example_plot(ax, fontsize=12) + ax.set_xlabel('x-label\nMultiLine') + axsr = [] + for gs in gsr: + ax = fig.add_subplot(gs) + axsr += [ax] + pcm = example_pcolor(ax, fontsize=12) + + fig.colorbar(pcm, ax=axsr, + pad=0.01, shrink=0.99, location='bottom', + ticks=ticker.MaxNLocator(nbins=5)) + + +def test_identical_subgridspec(): + + fig = plt.figure(constrained_layout=True) + + GS = fig.add_gridspec(2, 1) + + GSA = GS[0].subgridspec(1, 3) + GSB = GS[1].subgridspec(1, 3) + + axa = [] + axb = [] + for i in range(3): + axa += [fig.add_subplot(GSA[i])] + axb += [fig.add_subplot(GSB[i])] + + fig.draw_without_rendering() + # check first row above second + assert axa[0].get_position().y0 > axb[0].get_position().y1 + + +def test_constrained_layout7(): + """Test for proper warning if fig not set in GridSpec""" + with pytest.warns( + UserWarning, match=('There are no gridspecs with layoutgrids. ' + 'Possibly did not call parent GridSpec with ' + 'the "figure" keyword')): + fig = plt.figure(layout="constrained") + gs = gridspec.GridSpec(1, 2) + gsl = gridspec.GridSpecFromSubplotSpec(2, 2, gs[0]) + gsr = gridspec.GridSpecFromSubplotSpec(1, 2, gs[1]) + for gs in gsl: + fig.add_subplot(gs) + # need to trigger a draw to get warning + fig.draw_without_rendering() + + +@image_comparison(['constrained_layout8.png'], style='mpl20') +def test_constrained_layout8(): + """Test for gridspecs that are not completely full""" + + fig = plt.figure(figsize=(10, 5), layout="constrained") + gs = gridspec.GridSpec(3, 5, figure=fig) + axs = [] + for j in [0, 1]: + if j == 0: + ilist = [1] + else: + ilist = [0, 4] + for i in ilist: + ax = fig.add_subplot(gs[j, i]) + axs += [ax] + example_pcolor(ax, fontsize=9) + if i > 0: + ax.set_ylabel('') + if j < 1: + ax.set_xlabel('') + ax.set_title('') + ax = fig.add_subplot(gs[2, :]) + axs += [ax] + pcm = example_pcolor(ax, fontsize=9) + + fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6) + + +@image_comparison(['constrained_layout9.png'], style='mpl20') +def test_constrained_layout9(): + """Test for handling suptitle and for sharex and sharey""" + + fig, axs = plt.subplots(2, 2, layout="constrained", + sharex=False, sharey=False) + for ax in axs.flat: + pcm = example_pcolor(ax, fontsize=24) + ax.set_xlabel('') + ax.set_ylabel('') + ax.set_aspect(2.) + fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6) + fig.suptitle('Test Suptitle', fontsize=28) + + +@image_comparison(['constrained_layout10.png'], style='mpl20', + tol=0 if platform.machine() == 'x86_64' else 0.032) +def test_constrained_layout10(): + """Test for handling legend outside axis""" + fig, axs = plt.subplots(2, 2, layout="constrained") + for ax in axs.flat: + ax.plot(np.arange(12), label='This is a label') + ax.legend(loc='center left', bbox_to_anchor=(0.8, 0.5)) + + +@image_comparison(['constrained_layout11.png'], style='mpl20') +def test_constrained_layout11(): + """Test for multiple nested gridspecs""" + + fig = plt.figure(layout="constrained", figsize=(13, 3)) + gs0 = gridspec.GridSpec(1, 2, figure=fig) + gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0]) + gsl0 = gridspec.GridSpecFromSubplotSpec(2, 2, gsl[1]) + ax = fig.add_subplot(gs0[1]) + example_plot(ax, fontsize=9) + axs = [] + for gs in gsl0: + ax = fig.add_subplot(gs) + axs += [ax] + pcm = example_pcolor(ax, fontsize=9) + fig.colorbar(pcm, ax=axs, shrink=0.6, aspect=70.) + ax = fig.add_subplot(gsl[0]) + example_plot(ax, fontsize=9) + + +@image_comparison(['constrained_layout11rat.png'], style='mpl20') +def test_constrained_layout11rat(): + """Test for multiple nested gridspecs with width_ratios""" + + fig = plt.figure(layout="constrained", figsize=(10, 3)) + gs0 = gridspec.GridSpec(1, 2, figure=fig, width_ratios=[6, 1]) + gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0]) + gsl0 = gridspec.GridSpecFromSubplotSpec(2, 2, gsl[1], height_ratios=[2, 1]) + ax = fig.add_subplot(gs0[1]) + example_plot(ax, fontsize=9) + axs = [] + for gs in gsl0: + ax = fig.add_subplot(gs) + axs += [ax] + pcm = example_pcolor(ax, fontsize=9) + fig.colorbar(pcm, ax=axs, shrink=0.6, aspect=70.) + ax = fig.add_subplot(gsl[0]) + example_plot(ax, fontsize=9) + + +@image_comparison(['constrained_layout12.png'], style='mpl20') +def test_constrained_layout12(): + """Test that very unbalanced labeling still works.""" + fig = plt.figure(layout="constrained", figsize=(6, 8)) + + gs0 = gridspec.GridSpec(6, 2, figure=fig) + + ax1 = fig.add_subplot(gs0[:3, 1]) + ax2 = fig.add_subplot(gs0[3:, 1]) + + example_plot(ax1, fontsize=18) + example_plot(ax2, fontsize=18) + + ax = fig.add_subplot(gs0[0:2, 0]) + example_plot(ax, nodec=True) + ax = fig.add_subplot(gs0[2:4, 0]) + example_plot(ax, nodec=True) + ax = fig.add_subplot(gs0[4:, 0]) + example_plot(ax, nodec=True) + ax.set_xlabel('x-label') + + +@image_comparison(['constrained_layout13.png'], style='mpl20') +def test_constrained_layout13(): + """Test that padding works.""" + fig, axs = plt.subplots(2, 2, layout="constrained") + for ax in axs.flat: + pcm = example_pcolor(ax, fontsize=12) + fig.colorbar(pcm, ax=ax, shrink=0.6, aspect=20., pad=0.02) + with pytest.raises(TypeError): + fig.get_layout_engine().set(wpad=1, hpad=2) + fig.get_layout_engine().set(w_pad=24./72., h_pad=24./72.) + + +@image_comparison(['constrained_layout14.png'], style='mpl20') +def test_constrained_layout14(): + """Test that padding works.""" + fig, axs = plt.subplots(2, 2, layout="constrained") + for ax in axs.flat: + pcm = example_pcolor(ax, fontsize=12) + fig.colorbar(pcm, ax=ax, shrink=0.6, aspect=20., pad=0.02) + fig.get_layout_engine().set( + w_pad=3./72., h_pad=3./72., + hspace=0.2, wspace=0.2) + + +@image_comparison(['constrained_layout15.png'], style='mpl20') +def test_constrained_layout15(): + """Test that rcparams work.""" + mpl.rcParams['figure.constrained_layout.use'] = True + fig, axs = plt.subplots(2, 2) + for ax in axs.flat: + example_plot(ax, fontsize=12) + + +@image_comparison(['constrained_layout16.png'], style='mpl20') +def test_constrained_layout16(): + """Test ax.set_position.""" + fig, ax = plt.subplots(layout="constrained") + example_plot(ax, fontsize=12) + ax2 = fig.add_axes([0.2, 0.2, 0.4, 0.4]) + + +@image_comparison(['constrained_layout17.png'], style='mpl20') +def test_constrained_layout17(): + """Test uneven gridspecs""" + fig = plt.figure(layout="constrained") + gs = gridspec.GridSpec(3, 3, figure=fig) + + ax1 = fig.add_subplot(gs[0, 0]) + ax2 = fig.add_subplot(gs[0, 1:]) + ax3 = fig.add_subplot(gs[1:, 0:2]) + ax4 = fig.add_subplot(gs[1:, -1]) + + example_plot(ax1) + example_plot(ax2) + example_plot(ax3) + example_plot(ax4) + + +def test_constrained_layout18(): + """Test twinx""" + fig, ax = plt.subplots(layout="constrained") + ax2 = ax.twinx() + example_plot(ax) + example_plot(ax2, fontsize=24) + fig.draw_without_rendering() + assert all(ax.get_position().extents == ax2.get_position().extents) + + +def test_constrained_layout19(): + """Test twiny""" + fig, ax = plt.subplots(layout="constrained") + ax2 = ax.twiny() + example_plot(ax) + example_plot(ax2, fontsize=24) + ax2.set_title('') + ax.set_title('') + fig.draw_without_rendering() + assert all(ax.get_position().extents == ax2.get_position().extents) + + +def test_constrained_layout20(): + """Smoke test cl does not mess up added Axes""" + gx = np.linspace(-5, 5, 4) + img = np.hypot(gx, gx[:, None]) + + fig = plt.figure() + ax = fig.add_axes([0, 0, 1, 1]) + mesh = ax.pcolormesh(gx, gx, img[:-1, :-1]) + fig.colorbar(mesh) + + +def test_constrained_layout21(): + """#11035: repeated calls to suptitle should not alter the layout""" + fig, ax = plt.subplots(layout="constrained") + + fig.suptitle("Suptitle0") + fig.draw_without_rendering() + extents0 = np.copy(ax.get_position().extents) + + fig.suptitle("Suptitle1") + fig.draw_without_rendering() + extents1 = np.copy(ax.get_position().extents) + + np.testing.assert_allclose(extents0, extents1) + + +def test_constrained_layout22(): + """#11035: suptitle should not be include in CL if manually positioned""" + fig, ax = plt.subplots(layout="constrained") + + fig.draw_without_rendering() + extents0 = np.copy(ax.get_position().extents) + + fig.suptitle("Suptitle", y=0.5) + fig.draw_without_rendering() + extents1 = np.copy(ax.get_position().extents) + + np.testing.assert_allclose(extents0, extents1) + + +def test_constrained_layout23(): + """ + Comment in #11035: suptitle used to cause an exception when + reusing a figure w/ CL with ``clear=True``. + """ + + for i in range(2): + fig = plt.figure(layout="constrained", clear=True, num="123") + gs = fig.add_gridspec(1, 2) + sub = gs[0].subgridspec(2, 2) + fig.suptitle(f"Suptitle{i}") + + +@image_comparison(['test_colorbar_location.png'], + remove_text=True, style='mpl20') +def test_colorbar_location(): + """ + Test that colorbar handling is as expected for various complicated + cases... + """ + # Remove this line when this test image is regenerated. + plt.rcParams['pcolormesh.snap'] = False + + fig, axs = plt.subplots(4, 5, layout="constrained") + for ax in axs.flat: + pcm = example_pcolor(ax) + ax.set_xlabel('') + ax.set_ylabel('') + fig.colorbar(pcm, ax=axs[:, 1], shrink=0.4) + fig.colorbar(pcm, ax=axs[-1, :2], shrink=0.5, location='bottom') + fig.colorbar(pcm, ax=axs[0, 2:], shrink=0.5, location='bottom', pad=0.05) + fig.colorbar(pcm, ax=axs[-2, 3:], shrink=0.5, location='top') + fig.colorbar(pcm, ax=axs[0, 0], shrink=0.5, location='left') + fig.colorbar(pcm, ax=axs[1:3, 2], shrink=0.5, location='right') + + +def test_hidden_axes(): + # test that if we make an Axes not visible that constrained_layout + # still works. Note the axes still takes space in the layout + # (as does a gridspec slot that is empty) + fig, axs = plt.subplots(2, 2, layout="constrained") + axs[0, 1].set_visible(False) + fig.draw_without_rendering() + extents1 = np.copy(axs[0, 0].get_position().extents) + + np.testing.assert_allclose( + extents1, [0.046918, 0.541204, 0.477409, 0.980555], rtol=1e-5) + + +def test_colorbar_align(): + for location in ['right', 'left', 'top', 'bottom']: + fig, axs = plt.subplots(2, 2, layout="constrained") + cbs = [] + for nn, ax in enumerate(axs.flat): + ax.tick_params(direction='in') + pc = example_pcolor(ax) + cb = fig.colorbar(pc, ax=ax, location=location, shrink=0.6, + pad=0.04) + cbs += [cb] + cb.ax.tick_params(direction='in') + if nn != 1: + cb.ax.xaxis.set_ticks([]) + cb.ax.yaxis.set_ticks([]) + ax.set_xticklabels([]) + ax.set_yticklabels([]) + fig.get_layout_engine().set(w_pad=4 / 72, h_pad=4 / 72, + hspace=0.1, wspace=0.1) + + fig.draw_without_rendering() + if location in ['left', 'right']: + np.testing.assert_allclose(cbs[0].ax.get_position().x0, + cbs[2].ax.get_position().x0) + np.testing.assert_allclose(cbs[1].ax.get_position().x0, + cbs[3].ax.get_position().x0) + else: + np.testing.assert_allclose(cbs[0].ax.get_position().y0, + cbs[1].ax.get_position().y0) + np.testing.assert_allclose(cbs[2].ax.get_position().y0, + cbs[3].ax.get_position().y0) + + +@image_comparison(['test_colorbars_no_overlapV.png'], style='mpl20') +def test_colorbars_no_overlapV(): + fig = plt.figure(figsize=(2, 4), layout="constrained") + axs = fig.subplots(2, 1, sharex=True, sharey=True) + for ax in axs: + ax.yaxis.set_major_formatter(ticker.NullFormatter()) + ax.tick_params(axis='both', direction='in') + im = ax.imshow([[1, 2], [3, 4]]) + fig.colorbar(im, ax=ax, orientation="vertical") + fig.suptitle("foo") + + +@image_comparison(['test_colorbars_no_overlapH.png'], style='mpl20') +def test_colorbars_no_overlapH(): + fig = plt.figure(figsize=(4, 2), layout="constrained") + fig.suptitle("foo") + axs = fig.subplots(1, 2, sharex=True, sharey=True) + for ax in axs: + ax.yaxis.set_major_formatter(ticker.NullFormatter()) + ax.tick_params(axis='both', direction='in') + im = ax.imshow([[1, 2], [3, 4]]) + fig.colorbar(im, ax=ax, orientation="horizontal") + + +def test_manually_set_position(): + fig, axs = plt.subplots(1, 2, layout="constrained") + axs[0].set_position([0.2, 0.2, 0.3, 0.3]) + fig.draw_without_rendering() + pp = axs[0].get_position() + np.testing.assert_allclose(pp, [[0.2, 0.2], [0.5, 0.5]]) + + fig, axs = plt.subplots(1, 2, layout="constrained") + axs[0].set_position([0.2, 0.2, 0.3, 0.3]) + pc = axs[0].pcolormesh(np.random.rand(20, 20)) + fig.colorbar(pc, ax=axs[0]) + fig.draw_without_rendering() + pp = axs[0].get_position() + np.testing.assert_allclose(pp, [[0.2, 0.2], [0.44, 0.5]]) + + +@image_comparison(['test_bboxtight.png'], + remove_text=True, style='mpl20', + savefig_kwarg={'bbox_inches': 'tight'}) +def test_bboxtight(): + fig, ax = plt.subplots(layout="constrained") + ax.set_aspect(1.) + + +@image_comparison(['test_bbox.png'], + remove_text=True, style='mpl20', + savefig_kwarg={'bbox_inches': + mtransforms.Bbox([[0.5, 0], [2.5, 2]])}) +def test_bbox(): + fig, ax = plt.subplots(layout="constrained") + ax.set_aspect(1.) + + +def test_align_labels(): + """ + Tests for a bug in which constrained layout and align_ylabels on + three unevenly sized subplots, one of whose y tick labels include + negative numbers, drives the non-negative subplots' y labels off + the edge of the plot + """ + fig, (ax3, ax1, ax2) = plt.subplots(3, 1, layout="constrained", + figsize=(6.4, 8), + gridspec_kw={"height_ratios": (1, 1, + 0.7)}) + + ax1.set_ylim(0, 1) + ax1.set_ylabel("Label") + + ax2.set_ylim(-1.5, 1.5) + ax2.set_ylabel("Label") + + ax3.set_ylim(0, 1) + ax3.set_ylabel("Label") + + fig.align_ylabels(axs=(ax3, ax1, ax2)) + + fig.draw_without_rendering() + after_align = [ax1.yaxis.label.get_window_extent(), + ax2.yaxis.label.get_window_extent(), + ax3.yaxis.label.get_window_extent()] + # ensure labels are approximately aligned + np.testing.assert_allclose([after_align[0].x0, after_align[2].x0], + after_align[1].x0, rtol=0, atol=1e-05) + # ensure labels do not go off the edge + assert after_align[0].x0 >= 1 + + +def test_suplabels(): + fig, ax = plt.subplots(layout="constrained") + fig.draw_without_rendering() + pos0 = ax.get_tightbbox(fig.canvas.get_renderer()) + fig.supxlabel('Boo') + fig.supylabel('Booy') + fig.draw_without_rendering() + pos = ax.get_tightbbox(fig.canvas.get_renderer()) + assert pos.y0 > pos0.y0 + 10.0 + assert pos.x0 > pos0.x0 + 10.0 + + fig, ax = plt.subplots(layout="constrained") + fig.draw_without_rendering() + pos0 = ax.get_tightbbox(fig.canvas.get_renderer()) + # check that specifying x (y) doesn't ruin the layout + fig.supxlabel('Boo', x=0.5) + fig.supylabel('Boo', y=0.5) + fig.draw_without_rendering() + pos = ax.get_tightbbox(fig.canvas.get_renderer()) + assert pos.y0 > pos0.y0 + 10.0 + assert pos.x0 > pos0.x0 + 10.0 + + +def test_gridspec_addressing(): + fig = plt.figure() + gs = fig.add_gridspec(3, 3) + sp = fig.add_subplot(gs[0:, 1:]) + fig.draw_without_rendering() + + +def test_discouraged_api(): + fig, ax = plt.subplots(constrained_layout=True) + fig.draw_without_rendering() + + with pytest.warns(PendingDeprecationWarning, + match="will be deprecated"): + fig, ax = plt.subplots() + fig.set_constrained_layout(True) + fig.draw_without_rendering() + + with pytest.warns(PendingDeprecationWarning, + match="will be deprecated"): + fig, ax = plt.subplots() + fig.set_constrained_layout({'w_pad': 0.02, 'h_pad': 0.02}) + fig.draw_without_rendering() + + +def test_kwargs(): + fig, ax = plt.subplots(constrained_layout={'h_pad': 0.02}) + fig.draw_without_rendering() + + +def test_rect(): + fig, ax = plt.subplots(layout='constrained') + fig.get_layout_engine().set(rect=[0, 0, 0.5, 0.5]) + fig.draw_without_rendering() + ppos = ax.get_position() + assert ppos.x1 < 0.5 + assert ppos.y1 < 0.5 + + fig, ax = plt.subplots(layout='constrained') + fig.get_layout_engine().set(rect=[0.2, 0.2, 0.3, 0.3]) + fig.draw_without_rendering() + ppos = ax.get_position() + assert ppos.x1 < 0.5 + assert ppos.y1 < 0.5 + assert ppos.x0 > 0.2 + assert ppos.y0 > 0.2 + + +def test_compressed1(): + fig, axs = plt.subplots(3, 2, layout='compressed', + sharex=True, sharey=True) + for ax in axs.flat: + pc = ax.imshow(np.random.randn(20, 20)) + + fig.colorbar(pc, ax=axs) + fig.draw_without_rendering() + + pos = axs[0, 0].get_position() + np.testing.assert_allclose(pos.x0, 0.2381, atol=1e-2) + pos = axs[0, 1].get_position() + np.testing.assert_allclose(pos.x1, 0.7024, atol=1e-3) + + # wider than tall + fig, axs = plt.subplots(2, 3, layout='compressed', + sharex=True, sharey=True, figsize=(5, 4)) + for ax in axs.flat: + pc = ax.imshow(np.random.randn(20, 20)) + + fig.colorbar(pc, ax=axs) + fig.draw_without_rendering() + + pos = axs[0, 0].get_position() + np.testing.assert_allclose(pos.x0, 0.05653, atol=1e-3) + np.testing.assert_allclose(pos.y1, 0.8603, atol=1e-2) + pos = axs[1, 2].get_position() + np.testing.assert_allclose(pos.x1, 0.8728, atol=1e-3) + np.testing.assert_allclose(pos.y0, 0.1808, atol=1e-2) + + +def test_compressed_suptitle(): + fig, (ax0, ax1) = plt.subplots( + nrows=2, figsize=(4, 10), layout="compressed", + gridspec_kw={"height_ratios": (1 / 4, 3 / 4), "hspace": 0}) + + ax0.axis("equal") + ax0.set_box_aspect(1/3) + + ax1.axis("equal") + ax1.set_box_aspect(1) + + title = fig.suptitle("Title") + fig.draw_without_rendering() + assert title.get_position()[1] == pytest.approx(0.7491, abs=1e-3) + + title = fig.suptitle("Title", y=0.98) + fig.draw_without_rendering() + assert title.get_position()[1] == 0.98 + + title = fig.suptitle("Title", in_layout=False) + fig.draw_without_rendering() + assert title.get_position()[1] == 0.98 + + +@pytest.mark.parametrize('arg, state', [ + (True, True), + (False, False), + ({}, True), + ({'rect': None}, True) +]) +def test_set_constrained_layout(arg, state): + fig, ax = plt.subplots(constrained_layout=arg) + assert fig.get_constrained_layout() is state + + +def test_constrained_toggle(): + fig, ax = plt.subplots() + with pytest.warns(PendingDeprecationWarning): + fig.set_constrained_layout(True) + assert fig.get_constrained_layout() + fig.set_constrained_layout(False) + assert not fig.get_constrained_layout() + fig.set_constrained_layout(True) + assert fig.get_constrained_layout() + + +def test_layout_leak(): + # Make sure there aren't any cyclic references when using LayoutGrid + # GH #25853 + fig = plt.figure(constrained_layout=True, figsize=(10, 10)) + fig.add_subplot() + fig.draw_without_rendering() + plt.close("all") + del fig + gc.collect() + assert not any(isinstance(obj, mpl._layoutgrid.LayoutGrid) + for obj in gc.get_objects()) + + +def test_submerged_subfig(): + """ + Test that the submerged margin logic does not get called multiple times + on same axes if it is already in a subfigure + """ + fig = plt.figure(figsize=(4, 5), layout='constrained') + figures = fig.subfigures(3, 1) + axs = [] + for f in figures.flatten(): + gs = f.add_gridspec(2, 2) + for i in range(2): + axs += [f.add_subplot(gs[i, 0])] + axs[-1].plot() + f.add_subplot(gs[:, 1]).plot() + fig.draw_without_rendering() + for ax in axs[1:]: + assert np.allclose(ax.get_position().bounds[-1], + axs[0].get_position().bounds[-1], atol=1e-6) diff --git a/shared/package-files/33/331ff95d94552759b94ad3b6a79ad52bd0ffcf2a6b3dbd8e0bc9b6aa5afae36f/blob b/shared/package-files/33/331ff95d94552759b94ad3b6a79ad52bd0ffcf2a6b3dbd8e0bc9b6aa5afae36f/blob new file mode 100644 index 0000000000000000000000000000000000000000..64561c87b0da88a0458f9b0a07963a82b9da4b23 --- /dev/null +++ b/shared/package-files/33/331ff95d94552759b94ad3b6a79ad52bd0ffcf2a6b3dbd8e0bc9b6aa5afae36f/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace meta { + +TORCH_API at::Tensor fractional_max_pool2d_backward(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef output_size, const at::Tensor & indices); +TORCH_API at::Tensor & fractional_max_pool2d_backward_out(at::Tensor & grad_input, const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef output_size, const at::Tensor & indices); +TORCH_API at::Tensor & fractional_max_pool2d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef output_size, const at::Tensor & indices, at::Tensor & grad_input); + +} // namespace meta +} // namespace at diff --git a/shared/package-files/33/3321cb5b95cc165bf69527c46733f7fbe74e867c5932ead58a86485f4c5bf996/blob b/shared/package-files/33/3321cb5b95cc165bf69527c46733f7fbe74e867c5932ead58a86485f4c5bf996/blob new file mode 100644 index 0000000000000000000000000000000000000000..ff149f060524a7986d1cf20b35829e5c3214c57a --- /dev/null +++ b/shared/package-files/33/3321cb5b95cc165bf69527c46733f7fbe74e867c5932ead58a86485f4c5bf996/blob @@ -0,0 +1,2429 @@ +error(0.006990225343868906524) D0 D2 +error(0.006275863175100401641) D0 D2 ^ D8 +error(0.005689796266959423754) D0 D3 +error(0.01587663328265090379) D0 D5 +error(0.001762935736372972127) D0 D5 ^ D7 D8 +error(0.001508712453421218918) D0 D5 ^ D8 +error(0.00235364591000442264) D0 D9 +error(0.001243384657219064916) D0 D9 ^ D7 +error(1.580642242711209985e-05) D0 D9 ^ D7 ^ D8 +error(0.0001801761718108940886) D0 D9 ^ D8 +error(0.003152911682754922472) D0 D10 +error(0.001039984182036502065) D0 D10 ^ D7 D8 +error(0.0007830800400508054629) D0 D10 ^ D8 +error(0.01656467277536580879) D0 L0 +error(0.007784556979069212623) D1 D3 +error(0.02040030510796031482) D1 D9 +error(0.005000000000000000104) D1 L0 +error(0.006586171442793413086) D2 +error(0.001773053240269071044) D2 D5 +error(0.003148177047752898691) D2 D5 ^ D8 +error(0.02747102359940187255) D2 D6 +error(0.003927295511399317776) D2 D6 ^ D8 +error(0.00245549835783019036) D2 D10 +error(0.003599998822036839293) D2 D10 ^ D8 +error(0.01572429261740458661) D3 +error(0.005118261779903900827) D3 D9 +error(0.001043245677942938486) D3 D9 ^ D11 +error(0.01815650119299855661) D3 D10 +error(0.002810168605257993505) D3 D10 ^ D11 +error(0.005926517235497374275) D3 ^ D11 +error(0.01662624023923621117) D4 +error(0.01594661531170901356) D4 D7 +error(0.01806052942010510226) D4 D7 ^ D5 L0 +error(0.02047875441702822971) D4 D12 +error(0.003519754113694771851) D4 D12 ^ D13 L0 +error(0.008150765370134861049) D4 D15 +error(0.00537844292380713733) D4 D15 ^ D5 L0 +error(0.002738168297218604354) D4 D15 ^ D13 L0 +error(0.0002965916782324567623) D4 D15 ^ D13 L0 ^ D5 L0 +error(0.001283890363784154698) D4 D16 +error(0.001602423345873141931) D4 D16 ^ D5 D13 +error(0.0002821861797186517155) D4 D16 ^ D5 L0 +error(0.02002144887057245512) D4 ^ D5 L0 +error(0.003723219794832624465) D4 ^ D13 L0 +error(0.003826354170225692609) D5 D13 ^ D4 +error(0.00779054341473134869) D5 D6 +error(0.0008378118808327214779) D5 D6 ^ D4 +error(0.001708248059433341163) D5 D6 ^ D7 D8 +error(0.0001379550994543373604) D5 D6 ^ D7 D16 +error(0.009986751201416928583) D5 D6 ^ D8 +error(0.005662589825470752507) D5 D6 ^ D8 D16 +error(0.001542084858710355199) D5 D6 ^ D16 +error(0.01485984325464630856) D5 D10 +error(0.0126040627459703073) D5 D10 ^ D7 D8 +error(0.01928995727685751949) D5 D13 +error(0.002298697319621939312) D5 D13 ^ D15 D16 +error(0.0005886496968834892913) D5 D13 ^ D16 +error(0.001422053675744177573) D5 D17 +error(0.001457158197496117398) D5 D17 ^ D7 D15 +error(0.0003676716865645205377) D5 D17 ^ D7 D16 +error(9.61822287037517867e-05) D5 D17 ^ D15 D16 +error(0.002175490388390937009) D5 D18 +error(0.002016525830820338656) D5 D18 ^ D7 D8 +error(0.0007539930162785939268) D5 D18 ^ D7 D15 +error(0.002485643595095263919) D5 D18 ^ D7 D16 +error(0.000526472466251045202) D5 D18 ^ D8 D16 +error(0.001673229833584762016) D5 D18 ^ D15 D16 +error(0.02605213743577319829) D5 L0 +error(0.001904610188208808287) D7 D15 ^ D5 L0 +error(0.008120848506717640025) D6 +error(0.002287990695516844801) D6 D13 +error(0.0001413955858408526875) D6 D13 ^ D4 +error(0.001996592167412813371) D6 D13 ^ D16 +error(0.0001145955726632778647) D6 D13 ^ D16 ^ D4 +error(0.02776275525335089242) D6 D14 +error(0.004870918352301477176) D6 D14 ^ D16 +error(0.002583225587656222053) D6 D18 +error(0.0004184391677443587642) D6 D18 ^ D7 D8 +error(0.0004193576456063421803) D6 D18 ^ D7 D16 +error(0.002145193778452082842) D6 D18 ^ D8 D16 +error(0.0156781114270779301) D6 ^ D8 +error(0.001554399533594142974) D6 ^ D16 +error(0.001697684185300124505) D6 ^ D16 ^ D8 +error(0.03365826865933674999) D7 +error(0.008696770141027319531) D7 D8 +error(0.001760568521934904483) D7 D8 ^ D10 D18 +error(0.01930074729561103916) D7 D15 +error(0.003198153269174034211) D7 D15 ^ D17 D18 +error(0.002916054377451179642) D7 D16 +error(0.0001533501624704119483) D7 D16 ^ D17 D18 +error(0.001387689226253301144) D7 D19 +error(0.001361654870009728442) D7 D19 ^ D10 D18 +error(0.0002413954180492218829) D7 D19 ^ D18 +error(0.005573463780462612795) D7 ^ D0 L0 +error(0.0005314269036425286336) D7 ^ D5 L0 ^ D0 L0 +error(0.0004948413983537463525) D7 ^ D8 ^ D0 L0 +error(0.0001323329839537198049) D7 ^ D8 ^ D5 L0 +error(0.01876862577641180349) D7 ^ D9 L0 +error(0.005197254862923379563) D9 D17 ^ D7 +error(0.03625953955155194336) D8 +error(0.01756440521039070307) D8 D11 +error(0.01817063901256914249) D8 D11 ^ D10 +error(0.02146430780874410832) D8 D16 +error(0.002545513591691210033) D8 D16 ^ D18 +error(0.003087650519477554232) D8 D19 +error(0.002632878264712303681) D8 D19 ^ D10 +error(0.003662385158381735884) D8 D19 ^ D18 +error(0.0007333567923765808025) D8 D19 ^ D18 ^ D10 +error(0.0007933309098475863465) D8 ^ D0 L0 +error(0.0003163794477452313951) D8 ^ D2 +error(0.0006023440113841856862) D8 ^ D5 L0 +error(0.0005890505033242151309) D8 ^ D10 +error(0.008436810732925986711) D9 D10 +error(0.01482556205023742926) D9 D10 ^ D7 +error(0.001336117974448973499) D9 D10 ^ D8 +error(0.0006662689855090336713) D9 D10 ^ D11 +error(0.02222565681719517253) D9 D17 +error(0.008637107114675137212) D9 L0 +error(0.01000000000000000021) D10 +error(0.005051470923601393027) D10 D17 +error(0.005406777170627218715) D10 D17 ^ D7 +error(0.0004892394202587999107) D10 D17 ^ D19 +error(0.0003299629392860100241) D10 D17 ^ D19 ^ D7 +error(0.02031504564498634591) D10 D18 +error(0.002916556028322587601) D10 D18 ^ D7 +error(0.00181398596792339069) D10 D18 ^ D19 +error(0.0157476937425324523) D10 ^ D11 +error(0.001836549728297205133) D10 ^ D19 +error(0.002565690651523450452) D11 D19 ^ D10 +error(0.03611531221410463344) D11 +error(0.02315372726835283196) D11 D19 +error(0.005000000000000000104) D12 +error(0.01953734547265125604) D12 D15 +error(0.01950573954449300734) D12 D15 ^ D13 L0 +error(0.02047875441702822971) D12 D20 +error(0.003519754113694771851) D12 D20 ^ D21 L0 +error(0.008150765370134861049) D12 D23 +error(0.00537844292380713733) D12 D23 ^ D13 L0 +error(0.002738168297218604354) D12 D23 ^ D21 L0 +error(0.0002965916782324567623) D12 D23 ^ D21 L0 ^ D13 L0 +error(0.001283890363784154698) D12 D24 +error(0.001602423345873141931) D12 D24 ^ D13 D21 +error(0.0002821861797186517155) D12 D24 ^ D13 L0 +error(0.01609503918502741895) D12 ^ D13 L0 +error(0.003723219794832624465) D12 ^ D21 L0 +error(0.003826354170225692609) D13 D21 ^ D12 +error(0.008168559711865796061) D13 D14 +error(0.000592083353901149247) D13 D14 ^ D12 +error(0.0004708525723943131108) D13 D14 ^ D15 D16 +error(0.0001379550994543373604) D13 D14 ^ D15 D24 +error(0.01136592012532810538) D13 D14 ^ D16 +error(0.005662589825470752507) D13 D14 ^ D16 D24 +error(0.001542084858710355199) D13 D14 ^ D24 +error(0.01422768648916782237) D13 D18 +error(0.01064896329602458766) D13 D18 ^ D15 D16 +error(0.01928995727685751949) D13 D21 +error(0.002298697319621939312) D13 D21 ^ D23 D24 +error(0.0005886496968834892913) D13 D21 ^ D24 +error(0.001422053675744177573) D13 D25 +error(0.001457158197496117398) D13 D25 ^ D15 D23 +error(0.0003676716865645205377) D13 D25 ^ D15 D24 +error(9.61822287037517867e-05) D13 D25 ^ D23 D24 +error(0.002175490388390937009) D13 D26 +error(0.002016525830820338656) D13 D26 ^ D15 D16 +error(0.0007539930162785939268) D13 D26 ^ D15 D23 +error(0.002485643595095263919) D13 D26 ^ D15 D24 +error(0.000526472466251045202) D13 D26 ^ D16 D24 +error(0.001673229833584762016) D13 D26 ^ D23 D24 +error(0.01567844516472288036) D13 L0 +error(0.001904610188208808287) D15 D23 ^ D13 L0 +error(0.01057521640164722949) D14 +error(0.002287990695516844801) D14 D21 +error(0.0001413955858408526875) D14 D21 ^ D12 +error(0.001996592167412813371) D14 D21 ^ D24 +error(0.0001145955726632778647) D14 D21 ^ D24 ^ D12 +error(0.02776275525335089242) D14 D22 +error(0.004870918352301477176) D14 D22 ^ D24 +error(0.002583225587656222053) D14 D26 +error(0.0004184391677443587642) D14 D26 ^ D15 D16 +error(0.0004193576456063421803) D14 D26 ^ D15 D24 +error(0.002145193778452082842) D14 D26 ^ D16 D24 +error(0.01527501698855216437) D14 ^ D16 +error(0.001554399533594142974) D14 ^ D24 +error(0.001697684185300124505) D14 ^ D24 ^ D16 +error(0.01061579557716061696) D15 +error(0.007310830027292446881) D15 D16 +error(0.0001863698305450992791) D15 D16 ^ D5 L0 +error(0.0003683424846873538556) D15 D16 ^ D17 D18 +error(0.001760568521934904483) D15 D16 ^ D18 D26 +error(0.01930074729561103916) D15 D23 +error(0.003198153269174034211) D15 D23 ^ D25 D26 +error(0.002916054377451179642) D15 D24 +error(0.0001533501624704119483) D15 D24 ^ D25 D26 +error(0.001387689226253301144) D15 D27 +error(0.001361654870009728442) D15 D27 ^ D18 D26 +error(0.0002413954180492218829) D15 D27 ^ D26 +error(0.01528555969706266171) D15 ^ D17 L0 +error(0.005197254862923379563) D17 D25 ^ D15 +error(0.01150160957505306711) D16 +error(0.01572797635670877131) D16 D19 +error(0.01776891682066950376) D16 D19 ^ D18 +error(0.02146430780874410832) D16 D24 +error(0.002545513591691210033) D16 D24 ^ D26 +error(0.003087650519477554232) D16 D27 +error(0.002632878264712303681) D16 D27 ^ D18 +error(0.003662385158381735884) D16 D27 ^ D26 +error(0.0007333567923765808025) D16 D27 ^ D26 ^ D18 +error(0.00802087827867440685) D17 D18 +error(0.003050964455461190224) D17 D18 ^ D7 +error(0.01239435349828414516) D17 D18 ^ D15 +error(0.0006140138506500330022) D17 D18 ^ D19 +error(0.0004305156496025841473) D17 D18 ^ D19 ^ D7 +error(0.02222565681719517253) D17 D25 +error(0.006119433420034472125) D17 L0 +error(0.0003720004299357881862) D17 L0 ^ D5 L0 ^ D7 +error(0.0005850028327265820735) D17 L0 ^ D5 L0 ^ D15 +error(0.00101586476739196855) D17 L0 ^ D15 ^ D7 +error(0.01000000000000000021) D18 +error(0.005051470923601393027) D18 D25 +error(0.005406777170627218715) D18 D25 ^ D15 +error(0.0004892394202587999107) D18 D25 ^ D27 +error(0.0003299629392860100241) D18 D25 ^ D27 ^ D15 +error(0.02031504564498634591) D18 D26 +error(0.002916556028322587601) D18 D26 ^ D15 +error(0.00181398596792339069) D18 D26 ^ D27 +error(0.0005613420269502157611) D18 ^ D6 ^ D8 +error(0.0003732069945926920094) D18 ^ D6 ^ D16 +error(0.001306645986214824374) D18 ^ D8 +error(0.01161101870635708119) D18 ^ D19 +error(0.001836549728297205133) D18 ^ D27 +error(0.002565690651523450452) D19 D27 ^ D18 +error(0.01015291549911626241) D19 +error(0.02315372726835283196) D19 D27 +error(0.005000000000000000104) D20 +error(0.01953734547265125604) D20 D23 +error(0.01950573954449300734) D20 D23 ^ D21 L0 +error(0.02047875441702822971) D20 D28 +error(0.003519754113694771851) D20 D28 ^ D29 L0 +error(0.008150765370134861049) D20 D31 +error(0.00537844292380713733) D20 D31 ^ D21 L0 +error(0.002738168297218604354) D20 D31 ^ D29 L0 +error(0.0002965916782324567623) D20 D31 ^ D29 L0 ^ D21 L0 +error(0.001283890363784154698) D20 D32 +error(0.001602423345873141931) D20 D32 ^ D21 D29 +error(0.0002821861797186517155) D20 D32 ^ D21 L0 +error(0.01609503918502741895) D20 ^ D21 L0 +error(0.003723219794832624465) D20 ^ D29 L0 +error(0.003826354170225692609) D21 D29 ^ D20 +error(0.008168559711865796061) D21 D22 +error(0.000592083353901149247) D21 D22 ^ D20 +error(0.0004708525723943131108) D21 D22 ^ D23 D24 +error(0.0001379550994543373604) D21 D22 ^ D23 D32 +error(0.01136592012532810538) D21 D22 ^ D24 +error(0.005662589825470752507) D21 D22 ^ D24 D32 +error(0.001542084858710355199) D21 D22 ^ D32 +error(0.01422768648916782237) D21 D26 +error(0.01064896329602458766) D21 D26 ^ D23 D24 +error(0.01928995727685751949) D21 D29 +error(0.002298697319621939312) D21 D29 ^ D31 D32 +error(0.0005886496968834892913) D21 D29 ^ D32 +error(0.001422053675744177573) D21 D33 +error(0.001457158197496117398) D21 D33 ^ D23 D31 +error(0.0003676716865645205377) D21 D33 ^ D23 D32 +error(9.61822287037517867e-05) D21 D33 ^ D31 D32 +error(0.002175490388390937009) D21 D34 +error(0.002016525830820338656) D21 D34 ^ D23 D24 +error(0.0007539930162785939268) D21 D34 ^ D23 D31 +error(0.002485643595095263919) D21 D34 ^ D23 D32 +error(0.000526472466251045202) D21 D34 ^ D24 D32 +error(0.001673229833584762016) D21 D34 ^ D31 D32 +error(0.01567844516472288036) D21 L0 +error(0.001904610188208808287) D23 D31 ^ D21 L0 +error(0.01057521640164722949) D22 +error(0.002287990695516844801) D22 D29 +error(0.0001413955858408526875) D22 D29 ^ D20 +error(0.001996592167412813371) D22 D29 ^ D32 +error(0.0001145955726632778647) D22 D29 ^ D32 ^ D20 +error(0.02776275525335089242) D22 D30 +error(0.004870918352301477176) D22 D30 ^ D32 +error(0.002583225587656222053) D22 D34 +error(0.0004184391677443587642) D22 D34 ^ D23 D24 +error(0.0004193576456063421803) D22 D34 ^ D23 D32 +error(0.002145193778452082842) D22 D34 ^ D24 D32 +error(0.01527501698855216437) D22 ^ D24 +error(0.001554399533594142974) D22 ^ D32 +error(0.001697684185300124505) D22 ^ D32 ^ D24 +error(0.01061579557716061696) D23 +error(0.007310830027292446881) D23 D24 +error(0.0001863698305450992791) D23 D24 ^ D13 L0 +error(0.0003683424846873538556) D23 D24 ^ D25 D26 +error(0.001760568521934904483) D23 D24 ^ D26 D34 +error(0.01930074729561103916) D23 D31 +error(0.003198153269174034211) D23 D31 ^ D33 D34 +error(0.002916054377451179642) D23 D32 +error(0.0001533501624704119483) D23 D32 ^ D33 D34 +error(0.001387689226253301144) D23 D35 +error(0.001361654870009728442) D23 D35 ^ D26 D34 +error(0.0002413954180492218829) D23 D35 ^ D34 +error(0.01528555969706266171) D23 ^ D25 L0 +error(0.005197254862923379563) D25 D33 ^ D23 +error(0.01150160957505306711) D24 +error(0.01572797635670877131) D24 D27 +error(0.01776891682066950376) D24 D27 ^ D26 +error(0.02146430780874410832) D24 D32 +error(0.002545513591691210033) D24 D32 ^ D34 +error(0.003087650519477554232) D24 D35 +error(0.002632878264712303681) D24 D35 ^ D26 +error(0.003662385158381735884) D24 D35 ^ D34 +error(0.0007333567923765808025) D24 D35 ^ D34 ^ D26 +error(0.00802087827867440685) D25 D26 +error(0.003050964455461190224) D25 D26 ^ D15 +error(0.01239435349828414516) D25 D26 ^ D23 +error(0.0006140138506500330022) D25 D26 ^ D27 +error(0.0004305156496025841473) D25 D26 ^ D27 ^ D15 +error(0.02222565681719517253) D25 D33 +error(0.006119433420034472125) D25 L0 +error(0.0003720004299357881862) D25 L0 ^ D13 L0 ^ D15 +error(0.0005850028327265820735) D25 L0 ^ D13 L0 ^ D23 +error(0.00101586476739196855) D25 L0 ^ D23 ^ D15 +error(0.01000000000000000021) D26 +error(0.005051470923601393027) D26 D33 +error(0.005406777170627218715) D26 D33 ^ D23 +error(0.0004892394202587999107) D26 D33 ^ D35 +error(0.0003299629392860100241) D26 D33 ^ D35 ^ D23 +error(0.02031504564498634591) D26 D34 +error(0.002916556028322587601) D26 D34 ^ D23 +error(0.00181398596792339069) D26 D34 ^ D35 +error(0.0005613420269502157611) D26 ^ D14 ^ D16 +error(0.0003732069945926920094) D26 ^ D14 ^ D24 +error(0.001306645986214824374) D26 ^ D16 +error(0.01161101870635708119) D26 ^ D27 +error(0.001836549728297205133) D26 ^ D35 +error(0.002565690651523450452) D27 D35 ^ D26 +error(0.01015291549911626241) D27 +error(0.02315372726835283196) D27 D35 +error(0.005000000000000000104) D28 +error(0.01953734547265125604) D28 D31 +error(0.01950573954449300734) D28 D31 ^ D29 L0 +error(0.02047875441702822971) D28 D36 +error(0.003519754113694771851) D28 D36 ^ D37 L0 +error(0.008150765370134861049) D28 D39 +error(0.00537844292380713733) D28 D39 ^ D29 L0 +error(0.002738168297218604354) D28 D39 ^ D37 L0 +error(0.0002965916782324567623) D28 D39 ^ D37 L0 ^ D29 L0 +error(0.001283890363784154698) D28 D40 +error(0.001602423345873141931) D28 D40 ^ D29 D37 +error(0.0002821861797186517155) D28 D40 ^ D29 L0 +error(0.01609503918502741895) D28 ^ D29 L0 +error(0.003723219794832624465) D28 ^ D37 L0 +error(0.003826354170225692609) D29 D37 ^ D28 +error(0.008168559711865796061) D29 D30 +error(0.000592083353901149247) D29 D30 ^ D28 +error(0.0004708525723943131108) D29 D30 ^ D31 D32 +error(0.0001379550994543373604) D29 D30 ^ D31 D40 +error(0.01136592012532810538) D29 D30 ^ D32 +error(0.005662589825470752507) D29 D30 ^ D32 D40 +error(0.001542084858710355199) D29 D30 ^ D40 +error(0.01422768648916782237) D29 D34 +error(0.01064896329602458766) D29 D34 ^ D31 D32 +error(0.01928995727685751949) D29 D37 +error(0.002298697319621939312) D29 D37 ^ D39 D40 +error(0.0005886496968834892913) D29 D37 ^ D40 +error(0.001422053675744177573) D29 D41 +error(0.001457158197496117398) D29 D41 ^ D31 D39 +error(0.0003676716865645205377) D29 D41 ^ D31 D40 +error(9.61822287037517867e-05) D29 D41 ^ D39 D40 +error(0.002175490388390937009) D29 D42 +error(0.002016525830820338656) D29 D42 ^ D31 D32 +error(0.0007539930162785939268) D29 D42 ^ D31 D39 +error(0.002485643595095263919) D29 D42 ^ D31 D40 +error(0.000526472466251045202) D29 D42 ^ D32 D40 +error(0.001673229833584762016) D29 D42 ^ D39 D40 +error(0.01567844516472288036) D29 L0 +error(0.001904610188208808287) D31 D39 ^ D29 L0 +error(0.01057521640164722949) D30 +error(0.002287990695516844801) D30 D37 +error(0.0001413955858408526875) D30 D37 ^ D28 +error(0.001996592167412813371) D30 D37 ^ D40 +error(0.0001145955726632778647) D30 D37 ^ D40 ^ D28 +error(0.02776275525335089242) D30 D38 +error(0.004870918352301477176) D30 D38 ^ D40 +error(0.002583225587656222053) D30 D42 +error(0.0004184391677443587642) D30 D42 ^ D31 D32 +error(0.0004193576456063421803) D30 D42 ^ D31 D40 +error(0.002145193778452082842) D30 D42 ^ D32 D40 +error(0.01527501698855216437) D30 ^ D32 +error(0.001554399533594142974) D30 ^ D40 +error(0.001697684185300124505) D30 ^ D40 ^ D32 +error(0.01061579557716061696) D31 +error(0.007310830027292446881) D31 D32 +error(0.0001863698305450992791) D31 D32 ^ D21 L0 +error(0.0003683424846873538556) D31 D32 ^ D33 D34 +error(0.001760568521934904483) D31 D32 ^ D34 D42 +error(0.01930074729561103916) D31 D39 +error(0.003198153269174034211) D31 D39 ^ D41 D42 +error(0.002916054377451179642) D31 D40 +error(0.0001533501624704119483) D31 D40 ^ D41 D42 +error(0.001387689226253301144) D31 D43 +error(0.001361654870009728442) D31 D43 ^ D34 D42 +error(0.0002413954180492218829) D31 D43 ^ D42 +error(0.01528555969706266171) D31 ^ D33 L0 +error(0.005197254862923379563) D33 D41 ^ D31 +error(0.01150160957505306711) D32 +error(0.01572797635670877131) D32 D35 +error(0.01776891682066950376) D32 D35 ^ D34 +error(0.02146430780874410832) D32 D40 +error(0.002545513591691210033) D32 D40 ^ D42 +error(0.003087650519477554232) D32 D43 +error(0.002632878264712303681) D32 D43 ^ D34 +error(0.003662385158381735884) D32 D43 ^ D42 +error(0.0007333567923765808025) D32 D43 ^ D42 ^ D34 +error(0.00802087827867440685) D33 D34 +error(0.003050964455461190224) D33 D34 ^ D23 +error(0.01239435349828414516) D33 D34 ^ D31 +error(0.0006140138506500330022) D33 D34 ^ D35 +error(0.0004305156496025841473) D33 D34 ^ D35 ^ D23 +error(0.02222565681719517253) D33 D41 +error(0.006119433420034472125) D33 L0 +error(0.0003720004299357881862) D33 L0 ^ D21 L0 ^ D23 +error(0.0005850028327265820735) D33 L0 ^ D21 L0 ^ D31 +error(0.00101586476739196855) D33 L0 ^ D31 ^ D23 +error(0.01000000000000000021) D34 +error(0.005051470923601393027) D34 D41 +error(0.005406777170627218715) D34 D41 ^ D31 +error(0.0004892394202587999107) D34 D41 ^ D43 +error(0.0003299629392860100241) D34 D41 ^ D43 ^ D31 +error(0.02031504564498634591) D34 D42 +error(0.002916556028322587601) D34 D42 ^ D31 +error(0.00181398596792339069) D34 D42 ^ D43 +error(0.0005613420269502157611) D34 ^ D22 ^ D24 +error(0.0003732069945926920094) D34 ^ D22 ^ D32 +error(0.001306645986214824374) D34 ^ D24 +error(0.01161101870635708119) D34 ^ D35 +error(0.001836549728297205133) D34 ^ D43 +error(0.002565690651523450452) D35 D43 ^ D34 +error(0.01015291549911626241) D35 +error(0.02315372726835283196) D35 D43 +error(0.005000000000000000104) D36 +error(0.01953734547265125604) D36 D39 +error(0.01950573954449300734) D36 D39 ^ D37 L0 +error(0.02047875441702822971) D36 D44 +error(0.003519754113694771851) D36 D44 ^ D45 L0 +error(0.008150765370134861049) D36 D47 +error(0.00537844292380713733) D36 D47 ^ D37 L0 +error(0.002738168297218604354) D36 D47 ^ D45 L0 +error(0.0002965916782324567623) D36 D47 ^ D45 L0 ^ D37 L0 +error(0.001283890363784154698) D36 D48 +error(0.001602423345873141931) D36 D48 ^ D37 D45 +error(0.0002821861797186517155) D36 D48 ^ D37 L0 +error(0.01609503918502741895) D36 ^ D37 L0 +error(0.003723219794832624465) D36 ^ D45 L0 +error(0.003826354170225692609) D37 D45 ^ D36 +error(0.008168559711865796061) D37 D38 +error(0.000592083353901149247) D37 D38 ^ D36 +error(0.0004708525723943131108) D37 D38 ^ D39 D40 +error(0.0001379550994543373604) D37 D38 ^ D39 D48 +error(0.01136592012532810538) D37 D38 ^ D40 +error(0.005662589825470752507) D37 D38 ^ D40 D48 +error(0.001542084858710355199) D37 D38 ^ D48 +error(0.01422768648916782237) D37 D42 +error(0.01064896329602458766) D37 D42 ^ D39 D40 +error(0.01928995727685751949) D37 D45 +error(0.002298697319621939312) D37 D45 ^ D47 D48 +error(0.0005886496968834892913) D37 D45 ^ D48 +error(0.001422053675744177573) D37 D49 +error(0.001457158197496117398) D37 D49 ^ D39 D47 +error(0.0003676716865645205377) D37 D49 ^ D39 D48 +error(9.61822287037517867e-05) D37 D49 ^ D47 D48 +error(0.002175490388390937009) D37 D50 +error(0.002016525830820338656) D37 D50 ^ D39 D40 +error(0.0007539930162785939268) D37 D50 ^ D39 D47 +error(0.002485643595095263919) D37 D50 ^ D39 D48 +error(0.000526472466251045202) D37 D50 ^ D40 D48 +error(0.001673229833584762016) D37 D50 ^ D47 D48 +error(0.01567844516472288036) D37 L0 +error(0.001904610188208808287) D39 D47 ^ D37 L0 +error(0.01057521640164722949) D38 +error(0.002287990695516844801) D38 D45 +error(0.0001413955858408526875) D38 D45 ^ D36 +error(0.001996592167412813371) D38 D45 ^ D48 +error(0.0001145955726632778647) D38 D45 ^ D48 ^ D36 +error(0.02776275525335089242) D38 D46 +error(0.004870918352301477176) D38 D46 ^ D48 +error(0.002583225587656222053) D38 D50 +error(0.0004184391677443587642) D38 D50 ^ D39 D40 +error(0.0004193576456063421803) D38 D50 ^ D39 D48 +error(0.002145193778452082842) D38 D50 ^ D40 D48 +error(0.01527501698855216437) D38 ^ D40 +error(0.001554399533594142974) D38 ^ D48 +error(0.001697684185300124505) D38 ^ D48 ^ D40 +error(0.01061579557716061696) D39 +error(0.007310830027292446881) D39 D40 +error(0.0001863698305450992791) D39 D40 ^ D29 L0 +error(0.0003683424846873538556) D39 D40 ^ D41 D42 +error(0.001760568521934904483) D39 D40 ^ D42 D50 +error(0.01930074729561103916) D39 D47 +error(0.003198153269174034211) D39 D47 ^ D49 D50 +error(0.002916054377451179642) D39 D48 +error(0.0001533501624704119483) D39 D48 ^ D49 D50 +error(0.001387689226253301144) D39 D51 +error(0.001361654870009728442) D39 D51 ^ D42 D50 +error(0.0002413954180492218829) D39 D51 ^ D50 +error(0.01528555969706266171) D39 ^ D41 L0 +error(0.005197254862923379563) D41 D49 ^ D39 +error(0.01150160957505306711) D40 +error(0.01572797635670877131) D40 D43 +error(0.01776891682066950376) D40 D43 ^ D42 +error(0.02146430780874410832) D40 D48 +error(0.002545513591691210033) D40 D48 ^ D50 +error(0.003087650519477554232) D40 D51 +error(0.002632878264712303681) D40 D51 ^ D42 +error(0.003662385158381735884) D40 D51 ^ D50 +error(0.0007333567923765808025) D40 D51 ^ D50 ^ D42 +error(0.00802087827867440685) D41 D42 +error(0.003050964455461190224) D41 D42 ^ D31 +error(0.01239435349828414516) D41 D42 ^ D39 +error(0.0006140138506500330022) D41 D42 ^ D43 +error(0.0004305156496025841473) D41 D42 ^ D43 ^ D31 +error(0.02222565681719517253) D41 D49 +error(0.006119433420034472125) D41 L0 +error(0.0003720004299357881862) D41 L0 ^ D29 L0 ^ D31 +error(0.0005850028327265820735) D41 L0 ^ D29 L0 ^ D39 +error(0.00101586476739196855) D41 L0 ^ D39 ^ D31 +error(0.01000000000000000021) D42 +error(0.005051470923601393027) D42 D49 +error(0.005406777170627218715) D42 D49 ^ D39 +error(0.0004892394202587999107) D42 D49 ^ D51 +error(0.0003299629392860100241) D42 D49 ^ D51 ^ D39 +error(0.02031504564498634591) D42 D50 +error(0.002916556028322587601) D42 D50 ^ D39 +error(0.00181398596792339069) D42 D50 ^ D51 +error(0.0005613420269502157611) D42 ^ D30 ^ D32 +error(0.0003732069945926920094) D42 ^ D30 ^ D40 +error(0.001306645986214824374) D42 ^ D32 +error(0.01161101870635708119) D42 ^ D43 +error(0.001836549728297205133) D42 ^ D51 +error(0.002565690651523450452) D43 D51 ^ D42 +error(0.01015291549911626241) D43 +error(0.02315372726835283196) D43 D51 +error(0.005000000000000000104) D44 +error(0.01953734547265125604) D44 D47 +error(0.01950573954449300734) D44 D47 ^ D45 L0 +error(0.02047875441702822971) D44 D52 +error(0.003519754113694771851) D44 D52 ^ D53 L0 +error(0.008150765370134861049) D44 D55 +error(0.00537844292380713733) D44 D55 ^ D45 L0 +error(0.002738168297218604354) D44 D55 ^ D53 L0 +error(0.0002965916782324567623) D44 D55 ^ D53 L0 ^ D45 L0 +error(0.001283890363784154698) D44 D56 +error(0.001602423345873141931) D44 D56 ^ D45 D53 +error(0.0002821861797186517155) D44 D56 ^ D45 L0 +error(0.01609503918502741895) D44 ^ D45 L0 +error(0.003723219794832624465) D44 ^ D53 L0 +error(0.003826354170225692609) D45 D53 ^ D44 +error(0.008168559711865796061) D45 D46 +error(0.000592083353901149247) D45 D46 ^ D44 +error(0.0004708525723943131108) D45 D46 ^ D47 D48 +error(0.0001379550994543373604) D45 D46 ^ D47 D56 +error(0.01136592012532810538) D45 D46 ^ D48 +error(0.005662589825470752507) D45 D46 ^ D48 D56 +error(0.001542084858710355199) D45 D46 ^ D56 +error(0.01422768648916782237) D45 D50 +error(0.01064896329602458766) D45 D50 ^ D47 D48 +error(0.01928995727685751949) D45 D53 +error(0.002298697319621939312) D45 D53 ^ D55 D56 +error(0.0005886496968834892913) D45 D53 ^ D56 +error(0.001422053675744177573) D45 D57 +error(0.001457158197496117398) D45 D57 ^ D47 D55 +error(0.0003676716865645205377) D45 D57 ^ D47 D56 +error(9.61822287037517867e-05) D45 D57 ^ D55 D56 +error(0.002175490388390937009) D45 D58 +error(0.002016525830820338656) D45 D58 ^ D47 D48 +error(0.0007539930162785939268) D45 D58 ^ D47 D55 +error(0.002485643595095263919) D45 D58 ^ D47 D56 +error(0.000526472466251045202) D45 D58 ^ D48 D56 +error(0.001673229833584762016) D45 D58 ^ D55 D56 +error(0.01567844516472288036) D45 L0 +error(0.001904610188208808287) D47 D55 ^ D45 L0 +error(0.01057521640164722949) D46 +error(0.002287990695516844801) D46 D53 +error(0.0001413955858408526875) D46 D53 ^ D44 +error(0.001996592167412813371) D46 D53 ^ D56 +error(0.0001145955726632778647) D46 D53 ^ D56 ^ D44 +error(0.02776275525335089242) D46 D54 +error(0.004870918352301477176) D46 D54 ^ D56 +error(0.002583225587656222053) D46 D58 +error(0.0004184391677443587642) D46 D58 ^ D47 D48 +error(0.0004193576456063421803) D46 D58 ^ D47 D56 +error(0.002145193778452082842) D46 D58 ^ D48 D56 +error(0.01527501698855216437) D46 ^ D48 +error(0.001554399533594142974) D46 ^ D56 +error(0.001697684185300124505) D46 ^ D56 ^ D48 +error(0.01061579557716061696) D47 +error(0.007310830027292446881) D47 D48 +error(0.0001863698305450992791) D47 D48 ^ D37 L0 +error(0.0003683424846873538556) D47 D48 ^ D49 D50 +error(0.001760568521934904483) D47 D48 ^ D50 D58 +error(0.01930074729561103916) D47 D55 +error(0.003198153269174034211) D47 D55 ^ D57 D58 +error(0.002916054377451179642) D47 D56 +error(0.0001533501624704119483) D47 D56 ^ D57 D58 +error(0.001387689226253301144) D47 D59 +error(0.001361654870009728442) D47 D59 ^ D50 D58 +error(0.0002413954180492218829) D47 D59 ^ D58 +error(0.01528555969706266171) D47 ^ D49 L0 +error(0.005197254862923379563) D49 D57 ^ D47 +error(0.01150160957505306711) D48 +error(0.01572797635670877131) D48 D51 +error(0.01776891682066950376) D48 D51 ^ D50 +error(0.02146430780874410832) D48 D56 +error(0.002545513591691210033) D48 D56 ^ D58 +error(0.003087650519477554232) D48 D59 +error(0.002632878264712303681) D48 D59 ^ D50 +error(0.003662385158381735884) D48 D59 ^ D58 +error(0.0007333567923765808025) D48 D59 ^ D58 ^ D50 +error(0.00802087827867440685) D49 D50 +error(0.003050964455461190224) D49 D50 ^ D39 +error(0.01239435349828414516) D49 D50 ^ D47 +error(0.0006140138506500330022) D49 D50 ^ D51 +error(0.0004305156496025841473) D49 D50 ^ D51 ^ D39 +error(0.02222565681719517253) D49 D57 +error(0.006119433420034472125) D49 L0 +error(0.0003720004299357881862) D49 L0 ^ D37 L0 ^ D39 +error(0.0005850028327265820735) D49 L0 ^ D37 L0 ^ D47 +error(0.00101586476739196855) D49 L0 ^ D47 ^ D39 +error(0.01000000000000000021) D50 +error(0.005051470923601393027) D50 D57 +error(0.005406777170627218715) D50 D57 ^ D47 +error(0.0004892394202587999107) D50 D57 ^ D59 +error(0.0003299629392860100241) D50 D57 ^ D59 ^ D47 +error(0.02031504564498634591) D50 D58 +error(0.002916556028322587601) D50 D58 ^ D47 +error(0.00181398596792339069) D50 D58 ^ D59 +error(0.0005613420269502157611) D50 ^ D38 ^ D40 +error(0.0003732069945926920094) D50 ^ D38 ^ D48 +error(0.001306645986214824374) D50 ^ D40 +error(0.01161101870635708119) D50 ^ D51 +error(0.001836549728297205133) D50 ^ D59 +error(0.002565690651523450452) D51 D59 ^ D50 +error(0.01015291549911626241) D51 +error(0.02315372726835283196) D51 D59 +error(0.005000000000000000104) D52 +error(0.01953734547265125604) D52 D55 +error(0.01950573954449300734) D52 D55 ^ D53 L0 +error(0.02047875441702822971) D52 D60 +error(0.003519754113694771851) D52 D60 ^ D61 L0 +error(0.008150765370134861049) D52 D63 +error(0.00537844292380713733) D52 D63 ^ D53 L0 +error(0.002738168297218604354) D52 D63 ^ D61 L0 +error(0.0002965916782324567623) D52 D63 ^ D61 L0 ^ D53 L0 +error(0.001283890363784154698) D52 D64 +error(0.001602423345873141931) D52 D64 ^ D53 D61 +error(0.0002821861797186517155) D52 D64 ^ D53 L0 +error(0.01609503918502741895) D52 ^ D53 L0 +error(0.003723219794832624465) D52 ^ D61 L0 +error(0.003826354170225692609) D53 D61 ^ D52 +error(0.008168559711865796061) D53 D54 +error(0.000592083353901149247) D53 D54 ^ D52 +error(0.0004708525723943131108) D53 D54 ^ D55 D56 +error(0.0001379550994543373604) D53 D54 ^ D55 D64 +error(0.01136592012532810538) D53 D54 ^ D56 +error(0.005662589825470752507) D53 D54 ^ D56 D64 +error(0.001542084858710355199) D53 D54 ^ D64 +error(0.01422768648916782237) D53 D58 +error(0.01064896329602458766) D53 D58 ^ D55 D56 +error(0.01928995727685751949) D53 D61 +error(0.002298697319621939312) D53 D61 ^ D63 D64 +error(0.0005886496968834892913) D53 D61 ^ D64 +error(0.001422053675744177573) D53 D65 +error(0.001457158197496117398) D53 D65 ^ D55 D63 +error(0.0003676716865645205377) D53 D65 ^ D55 D64 +error(9.61822287037517867e-05) D53 D65 ^ D63 D64 +error(0.002175490388390937009) D53 D66 +error(0.002016525830820338656) D53 D66 ^ D55 D56 +error(0.0007539930162785939268) D53 D66 ^ D55 D63 +error(0.002485643595095263919) D53 D66 ^ D55 D64 +error(0.000526472466251045202) D53 D66 ^ D56 D64 +error(0.001673229833584762016) D53 D66 ^ D63 D64 +error(0.01567844516472288036) D53 L0 +error(0.001904610188208808287) D55 D63 ^ D53 L0 +error(0.01057521640164722949) D54 +error(0.002287990695516844801) D54 D61 +error(0.0001413955858408526875) D54 D61 ^ D52 +error(0.001996592167412813371) D54 D61 ^ D64 +error(0.0001145955726632778647) D54 D61 ^ D64 ^ D52 +error(0.02776275525335089242) D54 D62 +error(0.004870918352301477176) D54 D62 ^ D64 +error(0.002583225587656222053) D54 D66 +error(0.0004184391677443587642) D54 D66 ^ D55 D56 +error(0.0004193576456063421803) D54 D66 ^ D55 D64 +error(0.002145193778452082842) D54 D66 ^ D56 D64 +error(0.01527501698855216437) D54 ^ D56 +error(0.001554399533594142974) D54 ^ D64 +error(0.001697684185300124505) D54 ^ D64 ^ D56 +error(0.01061579557716061696) D55 +error(0.007310830027292446881) D55 D56 +error(0.0001863698305450992791) D55 D56 ^ D45 L0 +error(0.0003683424846873538556) D55 D56 ^ D57 D58 +error(0.001760568521934904483) D55 D56 ^ D58 D66 +error(0.01930074729561103916) D55 D63 +error(0.003198153269174034211) D55 D63 ^ D65 D66 +error(0.002916054377451179642) D55 D64 +error(0.0001533501624704119483) D55 D64 ^ D65 D66 +error(0.001387689226253301144) D55 D67 +error(0.001361654870009728442) D55 D67 ^ D58 D66 +error(0.0002413954180492218829) D55 D67 ^ D66 +error(0.01528555969706266171) D55 ^ D57 L0 +error(0.005197254862923379563) D57 D65 ^ D55 +error(0.01150160957505306711) D56 +error(0.01572797635670877131) D56 D59 +error(0.01776891682066950376) D56 D59 ^ D58 +error(0.02146430780874410832) D56 D64 +error(0.002545513591691210033) D56 D64 ^ D66 +error(0.003087650519477554232) D56 D67 +error(0.002632878264712303681) D56 D67 ^ D58 +error(0.003662385158381735884) D56 D67 ^ D66 +error(0.0007333567923765808025) D56 D67 ^ D66 ^ D58 +error(0.00802087827867440685) D57 D58 +error(0.003050964455461190224) D57 D58 ^ D47 +error(0.01239435349828414516) D57 D58 ^ D55 +error(0.0006140138506500330022) D57 D58 ^ D59 +error(0.0004305156496025841473) D57 D58 ^ D59 ^ D47 +error(0.02222565681719517253) D57 D65 +error(0.006119433420034472125) D57 L0 +error(0.0003720004299357881862) D57 L0 ^ D45 L0 ^ D47 +error(0.0005850028327265820735) D57 L0 ^ D45 L0 ^ D55 +error(0.00101586476739196855) D57 L0 ^ D55 ^ D47 +error(0.01000000000000000021) D58 +error(0.005051470923601393027) D58 D65 +error(0.005406777170627218715) D58 D65 ^ D55 +error(0.0004892394202587999107) D58 D65 ^ D67 +error(0.0003299629392860100241) D58 D65 ^ D67 ^ D55 +error(0.02031504564498634591) D58 D66 +error(0.002916556028322587601) D58 D66 ^ D55 +error(0.00181398596792339069) D58 D66 ^ D67 +error(0.0005613420269502157611) D58 ^ D46 ^ D48 +error(0.0003732069945926920094) D58 ^ D46 ^ D56 +error(0.001306645986214824374) D58 ^ D48 +error(0.01161101870635708119) D58 ^ D59 +error(0.001836549728297205133) D58 ^ D67 +error(0.002565690651523450452) D59 D67 ^ D58 +error(0.01015291549911626241) D59 +error(0.02315372726835283196) D59 D67 +error(0.005000000000000000104) D60 +error(0.01953734547265125604) D60 D63 +error(0.01950573954449300734) D60 D63 ^ D61 L0 +error(0.02047875441702822971) D60 D68 +error(0.003519754113694771851) D60 D68 ^ D69 L0 +error(0.008150765370134861049) D60 D71 +error(0.00537844292380713733) D60 D71 ^ D61 L0 +error(0.002738168297218604354) D60 D71 ^ D69 L0 +error(0.0002965916782324567623) D60 D71 ^ D69 L0 ^ D61 L0 +error(0.001283890363784154698) D60 D72 +error(0.001602423345873141931) D60 D72 ^ D61 D69 +error(0.0002821861797186517155) D60 D72 ^ D61 L0 +error(0.01609503918502741895) D60 ^ D61 L0 +error(0.003723219794832624465) D60 ^ D69 L0 +error(0.003826354170225692609) D61 D69 ^ D60 +error(0.008168559711865796061) D61 D62 +error(0.000592083353901149247) D61 D62 ^ D60 +error(0.0004708525723943131108) D61 D62 ^ D63 D64 +error(0.0001379550994543373604) D61 D62 ^ D63 D72 +error(0.01136592012532810538) D61 D62 ^ D64 +error(0.005662589825470752507) D61 D62 ^ D64 D72 +error(0.001542084858710355199) D61 D62 ^ D72 +error(0.01422768648916782237) D61 D66 +error(0.01064896329602458766) D61 D66 ^ D63 D64 +error(0.01928995727685751949) D61 D69 +error(0.002298697319621939312) D61 D69 ^ D71 D72 +error(0.0005886496968834892913) D61 D69 ^ D72 +error(0.001422053675744177573) D61 D73 +error(0.001457158197496117398) D61 D73 ^ D63 D71 +error(0.0003676716865645205377) D61 D73 ^ D63 D72 +error(9.61822287037517867e-05) D61 D73 ^ D71 D72 +error(0.002175490388390937009) D61 D74 +error(0.002016525830820338656) D61 D74 ^ D63 D64 +error(0.0007539930162785939268) D61 D74 ^ D63 D71 +error(0.002485643595095263919) D61 D74 ^ D63 D72 +error(0.000526472466251045202) D61 D74 ^ D64 D72 +error(0.001673229833584762016) D61 D74 ^ D71 D72 +error(0.01567844516472288036) D61 L0 +error(0.001904610188208808287) D63 D71 ^ D61 L0 +error(0.01057521640164722949) D62 +error(0.002287990695516844801) D62 D69 +error(0.0001413955858408526875) D62 D69 ^ D60 +error(0.001996592167412813371) D62 D69 ^ D72 +error(0.0001145955726632778647) D62 D69 ^ D72 ^ D60 +error(0.02776275525335089242) D62 D70 +error(0.004870918352301477176) D62 D70 ^ D72 +error(0.002583225587656222053) D62 D74 +error(0.0004184391677443587642) D62 D74 ^ D63 D64 +error(0.0004193576456063421803) D62 D74 ^ D63 D72 +error(0.002145193778452082842) D62 D74 ^ D64 D72 +error(0.01527501698855216437) D62 ^ D64 +error(0.001554399533594142974) D62 ^ D72 +error(0.001697684185300124505) D62 ^ D72 ^ D64 +error(0.01061579557716061696) D63 +error(0.007310830027292446881) D63 D64 +error(0.0001863698305450992791) D63 D64 ^ D53 L0 +error(0.0003683424846873538556) D63 D64 ^ D65 D66 +error(0.001760568521934904483) D63 D64 ^ D66 D74 +error(0.01930074729561103916) D63 D71 +error(0.003198153269174034211) D63 D71 ^ D73 D74 +error(0.002916054377451179642) D63 D72 +error(0.0001533501624704119483) D63 D72 ^ D73 D74 +error(0.001387689226253301144) D63 D75 +error(0.001361654870009728442) D63 D75 ^ D66 D74 +error(0.0002413954180492218829) D63 D75 ^ D74 +error(0.01528555969706266171) D63 ^ D65 L0 +error(0.005197254862923379563) D65 D73 ^ D63 +error(0.01150160957505306711) D64 +error(0.01572797635670877131) D64 D67 +error(0.01776891682066950376) D64 D67 ^ D66 +error(0.02146430780874410832) D64 D72 +error(0.002545513591691210033) D64 D72 ^ D74 +error(0.003087650519477554232) D64 D75 +error(0.002632878264712303681) D64 D75 ^ D66 +error(0.003662385158381735884) D64 D75 ^ D74 +error(0.0007333567923765808025) D64 D75 ^ D74 ^ D66 +error(0.00802087827867440685) D65 D66 +error(0.003050964455461190224) D65 D66 ^ D55 +error(0.01239435349828414516) D65 D66 ^ D63 +error(0.0006140138506500330022) D65 D66 ^ D67 +error(0.0004305156496025841473) D65 D66 ^ D67 ^ D55 +error(0.02222565681719517253) D65 D73 +error(0.006119433420034472125) D65 L0 +error(0.0003720004299357881862) D65 L0 ^ D53 L0 ^ D55 +error(0.0005850028327265820735) D65 L0 ^ D53 L0 ^ D63 +error(0.00101586476739196855) D65 L0 ^ D63 ^ D55 +error(0.01000000000000000021) D66 +error(0.005051470923601393027) D66 D73 +error(0.005406777170627218715) D66 D73 ^ D63 +error(0.0004892394202587999107) D66 D73 ^ D75 +error(0.0003299629392860100241) D66 D73 ^ D75 ^ D63 +error(0.02031504564498634591) D66 D74 +error(0.002916556028322587601) D66 D74 ^ D63 +error(0.00181398596792339069) D66 D74 ^ D75 +error(0.0005613420269502157611) D66 ^ D54 ^ D56 +error(0.0003732069945926920094) D66 ^ D54 ^ D64 +error(0.001306645986214824374) D66 ^ D56 +error(0.01161101870635708119) D66 ^ D67 +error(0.001836549728297205133) D66 ^ D75 +error(0.002565690651523450452) D67 D75 ^ D66 +error(0.01015291549911626241) D67 +error(0.02315372726835283196) D67 D75 +error(0.005000000000000000104) D68 +error(0.01953734547265125604) D68 D71 +error(0.01950573954449300734) D68 D71 ^ D69 L0 +error(0.02047875441702822971) D68 D76 +error(0.003519754113694771851) D68 D76 ^ D77 L0 +error(0.008150765370134861049) D68 D79 +error(0.00537844292380713733) D68 D79 ^ D69 L0 +error(0.002738168297218604354) D68 D79 ^ D77 L0 +error(0.0002965916782324567623) D68 D79 ^ D77 L0 ^ D69 L0 +error(0.001283890363784154698) D68 D80 +error(0.001602423345873141931) D68 D80 ^ D69 D77 +error(0.0002821861797186517155) D68 D80 ^ D69 L0 +error(0.01609503918502741895) D68 ^ D69 L0 +error(0.003723219794832624465) D68 ^ D77 L0 +error(0.003826354170225692609) D69 D77 ^ D68 +error(0.008168559711865796061) D69 D70 +error(0.000592083353901149247) D69 D70 ^ D68 +error(0.0004708525723943131108) D69 D70 ^ D71 D72 +error(0.0001379550994543373604) D69 D70 ^ D71 D80 +error(0.01136592012532810538) D69 D70 ^ D72 +error(0.005662589825470752507) D69 D70 ^ D72 D80 +error(0.001542084858710355199) D69 D70 ^ D80 +error(0.01422768648916782237) D69 D74 +error(0.01064896329602458766) D69 D74 ^ D71 D72 +error(0.01928995727685751949) D69 D77 +error(0.002298697319621939312) D69 D77 ^ D79 D80 +error(0.0005886496968834892913) D69 D77 ^ D80 +error(0.001422053675744177573) D69 D81 +error(0.001457158197496117398) D69 D81 ^ D71 D79 +error(0.0003676716865645205377) D69 D81 ^ D71 D80 +error(9.61822287037517867e-05) D69 D81 ^ D79 D80 +error(0.002175490388390937009) D69 D82 +error(0.002016525830820338656) D69 D82 ^ D71 D72 +error(0.0007539930162785939268) D69 D82 ^ D71 D79 +error(0.002485643595095263919) D69 D82 ^ D71 D80 +error(0.000526472466251045202) D69 D82 ^ D72 D80 +error(0.001673229833584762016) D69 D82 ^ D79 D80 +error(0.01567844516472288036) D69 L0 +error(0.001904610188208808287) D71 D79 ^ D69 L0 +error(0.01057521640164722949) D70 +error(0.002287990695516844801) D70 D77 +error(0.0001413955858408526875) D70 D77 ^ D68 +error(0.001996592167412813371) D70 D77 ^ D80 +error(0.0001145955726632778647) D70 D77 ^ D80 ^ D68 +error(0.02776275525335089242) D70 D78 +error(0.004870918352301477176) D70 D78 ^ D80 +error(0.002583225587656222053) D70 D82 +error(0.0004184391677443587642) D70 D82 ^ D71 D72 +error(0.0004193576456063421803) D70 D82 ^ D71 D80 +error(0.002145193778452082842) D70 D82 ^ D72 D80 +error(0.01527501698855216437) D70 ^ D72 +error(0.001554399533594142974) D70 ^ D80 +error(0.001697684185300124505) D70 ^ D80 ^ D72 +error(0.01061579557716061696) D71 +error(0.007310830027292446881) D71 D72 +error(0.0001863698305450992791) D71 D72 ^ D61 L0 +error(0.0003683424846873538556) D71 D72 ^ D73 D74 +error(0.001760568521934904483) D71 D72 ^ D74 D82 +error(0.01930074729561103916) D71 D79 +error(0.003198153269174034211) D71 D79 ^ D81 D82 +error(0.002916054377451179642) D71 D80 +error(0.0001533501624704119483) D71 D80 ^ D81 D82 +error(0.001387689226253301144) D71 D83 +error(0.001361654870009728442) D71 D83 ^ D74 D82 +error(0.0002413954180492218829) D71 D83 ^ D82 +error(0.01528555969706266171) D71 ^ D73 L0 +error(0.005197254862923379563) D73 D81 ^ D71 +error(0.01150160957505306711) D72 +error(0.01572797635670877131) D72 D75 +error(0.01776891682066950376) D72 D75 ^ D74 +error(0.02146430780874410832) D72 D80 +error(0.002545513591691210033) D72 D80 ^ D82 +error(0.003087650519477554232) D72 D83 +error(0.002632878264712303681) D72 D83 ^ D74 +error(0.003662385158381735884) D72 D83 ^ D82 +error(0.0007333567923765808025) D72 D83 ^ D82 ^ D74 +error(0.00802087827867440685) D73 D74 +error(0.003050964455461190224) D73 D74 ^ D63 +error(0.01239435349828414516) D73 D74 ^ D71 +error(0.0006140138506500330022) D73 D74 ^ D75 +error(0.0004305156496025841473) D73 D74 ^ D75 ^ D63 +error(0.02222565681719517253) D73 D81 +error(0.006119433420034472125) D73 L0 +error(0.0003720004299357881862) D73 L0 ^ D61 L0 ^ D63 +error(0.0005850028327265820735) D73 L0 ^ D61 L0 ^ D71 +error(0.00101586476739196855) D73 L0 ^ D71 ^ D63 +error(0.01000000000000000021) D74 +error(0.005051470923601393027) D74 D81 +error(0.005406777170627218715) D74 D81 ^ D71 +error(0.0004892394202587999107) D74 D81 ^ D83 +error(0.0003299629392860100241) D74 D81 ^ D83 ^ D71 +error(0.02031504564498634591) D74 D82 +error(0.002916556028322587601) D74 D82 ^ D71 +error(0.00181398596792339069) D74 D82 ^ D83 +error(0.0005613420269502157611) D74 ^ D62 ^ D64 +error(0.0003732069945926920094) D74 ^ D62 ^ D72 +error(0.001306645986214824374) D74 ^ D64 +error(0.01161101870635708119) D74 ^ D75 +error(0.001836549728297205133) D74 ^ D83 +error(0.002565690651523450452) D75 D83 ^ D74 +error(0.01015291549911626241) D75 +error(0.02315372726835283196) D75 D83 +error(0.005000000000000000104) D76 +error(0.01953734547265125604) D76 D79 +error(0.01950573954449300734) D76 D79 ^ D77 L0 +error(0.02047875441702822971) D76 D84 +error(0.003519754113694771851) D76 D84 ^ D85 L0 +error(0.008150765370134861049) D76 D87 +error(0.00537844292380713733) D76 D87 ^ D77 L0 +error(0.002738168297218604354) D76 D87 ^ D85 L0 +error(0.0002965916782324567623) D76 D87 ^ D85 L0 ^ D77 L0 +error(0.001283890363784154698) D76 D88 +error(0.001602423345873141931) D76 D88 ^ D77 D85 +error(0.0002821861797186517155) D76 D88 ^ D77 L0 +error(0.01609503918502741895) D76 ^ D77 L0 +error(0.003723219794832624465) D76 ^ D85 L0 +error(0.003826354170225692609) D77 D85 ^ D76 +error(0.008168559711865796061) D77 D78 +error(0.000592083353901149247) D77 D78 ^ D76 +error(0.0004708525723943131108) D77 D78 ^ D79 D80 +error(0.0001379550994543373604) D77 D78 ^ D79 D88 +error(0.01136592012532810538) D77 D78 ^ D80 +error(0.005662589825470752507) D77 D78 ^ D80 D88 +error(0.001542084858710355199) D77 D78 ^ D88 +error(0.01422768648916782237) D77 D82 +error(0.01064896329602458766) D77 D82 ^ D79 D80 +error(0.01928995727685751949) D77 D85 +error(0.002298697319621939312) D77 D85 ^ D87 D88 +error(0.0005886496968834892913) D77 D85 ^ D88 +error(0.001422053675744177573) D77 D89 +error(0.001457158197496117398) D77 D89 ^ D79 D87 +error(0.0003676716865645205377) D77 D89 ^ D79 D88 +error(9.61822287037517867e-05) D77 D89 ^ D87 D88 +error(0.002175490388390937009) D77 D90 +error(0.002016525830820338656) D77 D90 ^ D79 D80 +error(0.0007539930162785939268) D77 D90 ^ D79 D87 +error(0.002485643595095263919) D77 D90 ^ D79 D88 +error(0.000526472466251045202) D77 D90 ^ D80 D88 +error(0.001673229833584762016) D77 D90 ^ D87 D88 +error(0.01567844516472288036) D77 L0 +error(0.001904610188208808287) D79 D87 ^ D77 L0 +error(0.01057521640164722949) D78 +error(0.002287990695516844801) D78 D85 +error(0.0001413955858408526875) D78 D85 ^ D76 +error(0.001996592167412813371) D78 D85 ^ D88 +error(0.0001145955726632778647) D78 D85 ^ D88 ^ D76 +error(0.02776275525335089242) D78 D86 +error(0.004870918352301477176) D78 D86 ^ D88 +error(0.002583225587656222053) D78 D90 +error(0.0004184391677443587642) D78 D90 ^ D79 D80 +error(0.0004193576456063421803) D78 D90 ^ D79 D88 +error(0.002145193778452082842) D78 D90 ^ D80 D88 +error(0.01527501698855216437) D78 ^ D80 +error(0.001554399533594142974) D78 ^ D88 +error(0.001697684185300124505) D78 ^ D88 ^ D80 +error(0.01061579557716061696) D79 +error(0.007310830027292446881) D79 D80 +error(0.0001863698305450992791) D79 D80 ^ D69 L0 +error(0.0003683424846873538556) D79 D80 ^ D81 D82 +error(0.001760568521934904483) D79 D80 ^ D82 D90 +error(0.01930074729561103916) D79 D87 +error(0.003198153269174034211) D79 D87 ^ D89 D90 +error(0.002916054377451179642) D79 D88 +error(0.0001533501624704119483) D79 D88 ^ D89 D90 +error(0.001387689226253301144) D79 D91 +error(0.001361654870009728442) D79 D91 ^ D82 D90 +error(0.0002413954180492218829) D79 D91 ^ D90 +error(0.01528555969706266171) D79 ^ D81 L0 +error(0.005197254862923379563) D81 D89 ^ D79 +error(0.01150160957505306711) D80 +error(0.01572797635670877131) D80 D83 +error(0.01776891682066950376) D80 D83 ^ D82 +error(0.02146430780874410832) D80 D88 +error(0.002545513591691210033) D80 D88 ^ D90 +error(0.003087650519477554232) D80 D91 +error(0.002632878264712303681) D80 D91 ^ D82 +error(0.003662385158381735884) D80 D91 ^ D90 +error(0.0007333567923765808025) D80 D91 ^ D90 ^ D82 +error(0.00802087827867440685) D81 D82 +error(0.003050964455461190224) D81 D82 ^ D71 +error(0.01239435349828414516) D81 D82 ^ D79 +error(0.0006140138506500330022) D81 D82 ^ D83 +error(0.0004305156496025841473) D81 D82 ^ D83 ^ D71 +error(0.02222565681719517253) D81 D89 +error(0.006119433420034472125) D81 L0 +error(0.0003720004299357881862) D81 L0 ^ D69 L0 ^ D71 +error(0.0005850028327265820735) D81 L0 ^ D69 L0 ^ D79 +error(0.00101586476739196855) D81 L0 ^ D79 ^ D71 +error(0.01000000000000000021) D82 +error(0.005051470923601393027) D82 D89 +error(0.005406777170627218715) D82 D89 ^ D79 +error(0.0004892394202587999107) D82 D89 ^ D91 +error(0.0003299629392860100241) D82 D89 ^ D91 ^ D79 +error(0.02031504564498634591) D82 D90 +error(0.002916556028322587601) D82 D90 ^ D79 +error(0.00181398596792339069) D82 D90 ^ D91 +error(0.0005613420269502157611) D82 ^ D70 ^ D72 +error(0.0003732069945926920094) D82 ^ D70 ^ D80 +error(0.001306645986214824374) D82 ^ D72 +error(0.01161101870635708119) D82 ^ D83 +error(0.001836549728297205133) D82 ^ D91 +error(0.002565690651523450452) D83 D91 ^ D82 +error(0.01015291549911626241) D83 +error(0.02315372726835283196) D83 D91 +error(0.005000000000000000104) D84 +error(0.01953734547265125604) D84 D87 +error(0.01950573954449300734) D84 D87 ^ D85 L0 +error(0.02047875441702822971) D84 D92 +error(0.003519754113694771851) D84 D92 ^ D93 L0 +error(0.008150765370134861049) D84 D95 +error(0.00537844292380713733) D84 D95 ^ D85 L0 +error(0.002738168297218604354) D84 D95 ^ D93 L0 +error(0.0002965916782324567623) D84 D95 ^ D93 L0 ^ D85 L0 +error(0.001283890363784154698) D84 D96 +error(0.001602423345873141931) D84 D96 ^ D85 D93 +error(0.0002821861797186517155) D84 D96 ^ D85 L0 +error(0.01609503918502741895) D84 ^ D85 L0 +error(0.003723219794832624465) D84 ^ D93 L0 +error(0.003826354170225692609) D85 D93 ^ D84 +error(0.008168559711865796061) D85 D86 +error(0.000592083353901149247) D85 D86 ^ D84 +error(0.0004708525723943131108) D85 D86 ^ D87 D88 +error(0.0001379550994543373604) D85 D86 ^ D87 D96 +error(0.01136592012532810538) D85 D86 ^ D88 +error(0.005662589825470752507) D85 D86 ^ D88 D96 +error(0.001542084858710355199) D85 D86 ^ D96 +error(0.01422768648916782237) D85 D90 +error(0.01064896329602458766) D85 D90 ^ D87 D88 +error(0.01928995727685751949) D85 D93 +error(0.002298697319621939312) D85 D93 ^ D95 D96 +error(0.0005886496968834892913) D85 D93 ^ D96 +error(0.001422053675744177573) D85 D97 +error(0.001457158197496117398) D85 D97 ^ D87 D95 +error(0.0003676716865645205377) D85 D97 ^ D87 D96 +error(9.61822287037517867e-05) D85 D97 ^ D95 D96 +error(0.002175490388390937009) D85 D98 +error(0.002016525830820338656) D85 D98 ^ D87 D88 +error(0.0007539930162785939268) D85 D98 ^ D87 D95 +error(0.002485643595095263919) D85 D98 ^ D87 D96 +error(0.000526472466251045202) D85 D98 ^ D88 D96 +error(0.001673229833584762016) D85 D98 ^ D95 D96 +error(0.01567844516472288036) D85 L0 +error(0.001904610188208808287) D87 D95 ^ D85 L0 +error(0.01057521640164722949) D86 +error(0.002287990695516844801) D86 D93 +error(0.0001413955858408526875) D86 D93 ^ D84 +error(0.001996592167412813371) D86 D93 ^ D96 +error(0.0001145955726632778647) D86 D93 ^ D96 ^ D84 +error(0.02776275525335089242) D86 D94 +error(0.004870918352301477176) D86 D94 ^ D96 +error(0.002583225587656222053) D86 D98 +error(0.0004184391677443587642) D86 D98 ^ D87 D88 +error(0.0004193576456063421803) D86 D98 ^ D87 D96 +error(0.002145193778452082842) D86 D98 ^ D88 D96 +error(0.01527501698855216437) D86 ^ D88 +error(0.001554399533594142974) D86 ^ D96 +error(0.001697684185300124505) D86 ^ D96 ^ D88 +error(0.01061579557716061696) D87 +error(0.007310830027292446881) D87 D88 +error(0.0001863698305450992791) D87 D88 ^ D77 L0 +error(0.0003683424846873538556) D87 D88 ^ D89 D90 +error(0.001760568521934904483) D87 D88 ^ D90 D98 +error(0.01930074729561103916) D87 D95 +error(0.003198153269174034211) D87 D95 ^ D97 D98 +error(0.002916054377451179642) D87 D96 +error(0.0001533501624704119483) D87 D96 ^ D97 D98 +error(0.001387689226253301144) D87 D99 +error(0.001361654870009728442) D87 D99 ^ D90 D98 +error(0.0002413954180492218829) D87 D99 ^ D98 +error(0.01528555969706266171) D87 ^ D89 L0 +error(0.005197254862923379563) D89 D97 ^ D87 +error(0.01150160957505306711) D88 +error(0.01572797635670877131) D88 D91 +error(0.01776891682066950376) D88 D91 ^ D90 +error(0.02146430780874410832) D88 D96 +error(0.002545513591691210033) D88 D96 ^ D98 +error(0.003087650519477554232) D88 D99 +error(0.002632878264712303681) D88 D99 ^ D90 +error(0.003662385158381735884) D88 D99 ^ D98 +error(0.0007333567923765808025) D88 D99 ^ D98 ^ D90 +error(0.00802087827867440685) D89 D90 +error(0.003050964455461190224) D89 D90 ^ D79 +error(0.01239435349828414516) D89 D90 ^ D87 +error(0.0006140138506500330022) D89 D90 ^ D91 +error(0.0004305156496025841473) D89 D90 ^ D91 ^ D79 +error(0.02222565681719517253) D89 D97 +error(0.006119433420034472125) D89 L0 +error(0.0003720004299357881862) D89 L0 ^ D77 L0 ^ D79 +error(0.0005850028327265820735) D89 L0 ^ D77 L0 ^ D87 +error(0.00101586476739196855) D89 L0 ^ D87 ^ D79 +error(0.01000000000000000021) D90 +error(0.005051470923601393027) D90 D97 +error(0.005406777170627218715) D90 D97 ^ D87 +error(0.0004892394202587999107) D90 D97 ^ D99 +error(0.0003299629392860100241) D90 D97 ^ D99 ^ D87 +error(0.02031504564498634591) D90 D98 +error(0.002916556028322587601) D90 D98 ^ D87 +error(0.00181398596792339069) D90 D98 ^ D99 +error(0.0005613420269502157611) D90 ^ D78 ^ D80 +error(0.0003732069945926920094) D90 ^ D78 ^ D88 +error(0.001306645986214824374) D90 ^ D80 +error(0.01161101870635708119) D90 ^ D91 +error(0.001836549728297205133) D90 ^ D99 +error(0.002565690651523450452) D91 D99 ^ D90 +error(0.01015291549911626241) D91 +error(0.02315372726835283196) D91 D99 +error(0.005000000000000000104) D92 +error(0.01953734547265125604) D92 D95 +error(0.01950573954449300734) D92 D95 ^ D93 L0 +error(0.02047875441702822971) D92 D100 +error(0.003519754113694771851) D92 D100 ^ D101 L0 +error(0.008150765370134861049) D92 D103 +error(0.00537844292380713733) D92 D103 ^ D93 L0 +error(0.002738168297218604354) D92 D103 ^ D101 L0 +error(0.0002965916782324567623) D92 D103 ^ D101 L0 ^ D93 L0 +error(0.001283890363784154698) D92 D104 +error(0.001602423345873141931) D92 D104 ^ D93 D101 +error(0.0002821861797186517155) D92 D104 ^ D93 L0 +error(0.01609503918502741895) D92 ^ D93 L0 +error(0.003723219794832624465) D92 ^ D101 L0 +error(0.003826354170225692609) D93 D101 ^ D92 +error(0.008168559711865796061) D93 D94 +error(0.000592083353901149247) D93 D94 ^ D92 +error(0.0004708525723943131108) D93 D94 ^ D95 D96 +error(0.0001379550994543373604) D93 D94 ^ D95 D104 +error(0.01136592012532810538) D93 D94 ^ D96 +error(0.005662589825470752507) D93 D94 ^ D96 D104 +error(0.001542084858710355199) D93 D94 ^ D104 +error(0.01422768648916782237) D93 D98 +error(0.01064896329602458766) D93 D98 ^ D95 D96 +error(0.01928995727685751949) D93 D101 +error(0.002298697319621939312) D93 D101 ^ D103 D104 +error(0.0005886496968834892913) D93 D101 ^ D104 +error(0.001422053675744177573) D93 D105 +error(0.001457158197496117398) D93 D105 ^ D95 D103 +error(0.0003676716865645205377) D93 D105 ^ D95 D104 +error(9.61822287037517867e-05) D93 D105 ^ D103 D104 +error(0.002175490388390937009) D93 D106 +error(0.002016525830820338656) D93 D106 ^ D95 D96 +error(0.0007539930162785939268) D93 D106 ^ D95 D103 +error(0.002485643595095263919) D93 D106 ^ D95 D104 +error(0.000526472466251045202) D93 D106 ^ D96 D104 +error(0.001673229833584762016) D93 D106 ^ D103 D104 +error(0.01567844516472288036) D93 L0 +error(0.001904610188208808287) D95 D103 ^ D93 L0 +error(0.01057521640164722949) D94 +error(0.002287990695516844801) D94 D101 +error(0.0001413955858408526875) D94 D101 ^ D92 +error(0.001996592167412813371) D94 D101 ^ D104 +error(0.0001145955726632778647) D94 D101 ^ D104 ^ D92 +error(0.02776275525335089242) D94 D102 +error(0.004870918352301477176) D94 D102 ^ D104 +error(0.002583225587656222053) D94 D106 +error(0.0004184391677443587642) D94 D106 ^ D95 D96 +error(0.0004193576456063421803) D94 D106 ^ D95 D104 +error(0.002145193778452082842) D94 D106 ^ D96 D104 +error(0.01527501698855216437) D94 ^ D96 +error(0.001554399533594142974) D94 ^ D104 +error(0.001697684185300124505) D94 ^ D104 ^ D96 +error(0.01061579557716061696) D95 +error(0.007310830027292446881) D95 D96 +error(0.0001863698305450992791) D95 D96 ^ D85 L0 +error(0.0003683424846873538556) D95 D96 ^ D97 D98 +error(0.001760568521934904483) D95 D96 ^ D98 D106 +error(0.01930074729561103916) D95 D103 +error(0.003198153269174034211) D95 D103 ^ D105 D106 +error(0.002916054377451179642) D95 D104 +error(0.0001533501624704119483) D95 D104 ^ D105 D106 +error(0.001387689226253301144) D95 D107 +error(0.001361654870009728442) D95 D107 ^ D98 D106 +error(0.0002413954180492218829) D95 D107 ^ D106 +error(0.01528555969706266171) D95 ^ D97 L0 +error(0.005197254862923379563) D97 D105 ^ D95 +error(0.01150160957505306711) D96 +error(0.01572797635670877131) D96 D99 +error(0.01776891682066950376) D96 D99 ^ D98 +error(0.02146430780874410832) D96 D104 +error(0.002545513591691210033) D96 D104 ^ D106 +error(0.003087650519477554232) D96 D107 +error(0.002632878264712303681) D96 D107 ^ D98 +error(0.003662385158381735884) D96 D107 ^ D106 +error(0.0007333567923765808025) D96 D107 ^ D106 ^ D98 +error(0.00802087827867440685) D97 D98 +error(0.003050964455461190224) D97 D98 ^ D87 +error(0.01239435349828414516) D97 D98 ^ D95 +error(0.0006140138506500330022) D97 D98 ^ D99 +error(0.0004305156496025841473) D97 D98 ^ D99 ^ D87 +error(0.02222565681719517253) D97 D105 +error(0.006119433420034472125) D97 L0 +error(0.0003720004299357881862) D97 L0 ^ D85 L0 ^ D87 +error(0.0005850028327265820735) D97 L0 ^ D85 L0 ^ D95 +error(0.00101586476739196855) D97 L0 ^ D95 ^ D87 +error(0.01000000000000000021) D98 +error(0.005051470923601393027) D98 D105 +error(0.005406777170627218715) D98 D105 ^ D95 +error(0.0004892394202587999107) D98 D105 ^ D107 +error(0.0003299629392860100241) D98 D105 ^ D107 ^ D95 +error(0.02031504564498634591) D98 D106 +error(0.002916556028322587601) D98 D106 ^ D95 +error(0.00181398596792339069) D98 D106 ^ D107 +error(0.0005613420269502157611) D98 ^ D86 ^ D88 +error(0.0003732069945926920094) D98 ^ D86 ^ D96 +error(0.001306645986214824374) D98 ^ D88 +error(0.01161101870635708119) D98 ^ D99 +error(0.001836549728297205133) D98 ^ D107 +error(0.002565690651523450452) D99 D107 ^ D98 +error(0.01015291549911626241) D99 +error(0.02315372726835283196) D99 D107 +error(0.005000000000000000104) D100 +error(0.01953734547265125604) D100 D103 +error(0.01950573954449300734) D100 D103 ^ D101 L0 +error(0.02047875441702822971) D100 D108 +error(0.003519754113694771851) D100 D108 ^ D109 L0 +error(0.008150765370134861049) D100 D111 +error(0.00537844292380713733) D100 D111 ^ D101 L0 +error(0.002738168297218604354) D100 D111 ^ D109 L0 +error(0.0002965916782324567623) D100 D111 ^ D109 L0 ^ D101 L0 +error(0.001283890363784154698) D100 D112 +error(0.001602423345873141931) D100 D112 ^ D101 D109 +error(0.0002821861797186517155) D100 D112 ^ D101 L0 +error(0.01609503918502741895) D100 ^ D101 L0 +error(0.003723219794832624465) D100 ^ D109 L0 +error(0.003826354170225692609) D101 D109 ^ D100 +error(0.008168559711865796061) D101 D102 +error(0.000592083353901149247) D101 D102 ^ D100 +error(0.0004708525723943131108) D101 D102 ^ D103 D104 +error(0.0001379550994543373604) D101 D102 ^ D103 D112 +error(0.01136592012532810538) D101 D102 ^ D104 +error(0.005662589825470752507) D101 D102 ^ D104 D112 +error(0.001542084858710355199) D101 D102 ^ D112 +error(0.01422768648916782237) D101 D106 +error(0.01064896329602458766) D101 D106 ^ D103 D104 +error(0.01928995727685751949) D101 D109 +error(0.002298697319621939312) D101 D109 ^ D111 D112 +error(0.0005886496968834892913) D101 D109 ^ D112 +error(0.001422053675744177573) D101 D113 +error(0.001457158197496117398) D101 D113 ^ D103 D111 +error(0.0003676716865645205377) D101 D113 ^ D103 D112 +error(9.61822287037517867e-05) D101 D113 ^ D111 D112 +error(0.002175490388390937009) D101 D114 +error(0.002016525830820338656) D101 D114 ^ D103 D104 +error(0.0007539930162785939268) D101 D114 ^ D103 D111 +error(0.002485643595095263919) D101 D114 ^ D103 D112 +error(0.000526472466251045202) D101 D114 ^ D104 D112 +error(0.001673229833584762016) D101 D114 ^ D111 D112 +error(0.01567844516472288036) D101 L0 +error(0.001904610188208808287) D103 D111 ^ D101 L0 +error(0.01057521640164722949) D102 +error(0.002287990695516844801) D102 D109 +error(0.0001413955858408526875) D102 D109 ^ D100 +error(0.001996592167412813371) D102 D109 ^ D112 +error(0.0001145955726632778647) D102 D109 ^ D112 ^ D100 +error(0.02776275525335089242) D102 D110 +error(0.004870918352301477176) D102 D110 ^ D112 +error(0.002583225587656222053) D102 D114 +error(0.0004184391677443587642) D102 D114 ^ D103 D104 +error(0.0004193576456063421803) D102 D114 ^ D103 D112 +error(0.002145193778452082842) D102 D114 ^ D104 D112 +error(0.01527501698855216437) D102 ^ D104 +error(0.001554399533594142974) D102 ^ D112 +error(0.001697684185300124505) D102 ^ D112 ^ D104 +error(0.01061579557716061696) D103 +error(0.007310830027292446881) D103 D104 +error(0.0001863698305450992791) D103 D104 ^ D93 L0 +error(0.0003683424846873538556) D103 D104 ^ D105 D106 +error(0.001760568521934904483) D103 D104 ^ D106 D114 +error(0.01930074729561103916) D103 D111 +error(0.003198153269174034211) D103 D111 ^ D113 D114 +error(0.002916054377451179642) D103 D112 +error(0.0001533501624704119483) D103 D112 ^ D113 D114 +error(0.001387689226253301144) D103 D115 +error(0.001361654870009728442) D103 D115 ^ D106 D114 +error(0.0002413954180492218829) D103 D115 ^ D114 +error(0.01528555969706266171) D103 ^ D105 L0 +error(0.005197254862923379563) D105 D113 ^ D103 +error(0.01150160957505306711) D104 +error(0.01572797635670877131) D104 D107 +error(0.01776891682066950376) D104 D107 ^ D106 +error(0.02146430780874410832) D104 D112 +error(0.002545513591691210033) D104 D112 ^ D114 +error(0.003087650519477554232) D104 D115 +error(0.002632878264712303681) D104 D115 ^ D106 +error(0.003662385158381735884) D104 D115 ^ D114 +error(0.0007333567923765808025) D104 D115 ^ D114 ^ D106 +error(0.00802087827867440685) D105 D106 +error(0.003050964455461190224) D105 D106 ^ D95 +error(0.01239435349828414516) D105 D106 ^ D103 +error(0.0006140138506500330022) D105 D106 ^ D107 +error(0.0004305156496025841473) D105 D106 ^ D107 ^ D95 +error(0.02222565681719517253) D105 D113 +error(0.006119433420034472125) D105 L0 +error(0.0003720004299357881862) D105 L0 ^ D93 L0 ^ D95 +error(0.0005850028327265820735) D105 L0 ^ D93 L0 ^ D103 +error(0.00101586476739196855) D105 L0 ^ D103 ^ D95 +error(0.01000000000000000021) D106 +error(0.005051470923601393027) D106 D113 +error(0.005406777170627218715) D106 D113 ^ D103 +error(0.0004892394202587999107) D106 D113 ^ D115 +error(0.0003299629392860100241) D106 D113 ^ D115 ^ D103 +error(0.02031504564498634591) D106 D114 +error(0.002916556028322587601) D106 D114 ^ D103 +error(0.00181398596792339069) D106 D114 ^ D115 +error(0.0005613420269502157611) D106 ^ D94 ^ D96 +error(0.0003732069945926920094) D106 ^ D94 ^ D104 +error(0.001306645986214824374) D106 ^ D96 +error(0.01161101870635708119) D106 ^ D107 +error(0.001836549728297205133) D106 ^ D115 +error(0.002565690651523450452) D107 D115 ^ D106 +error(0.01015291549911626241) D107 +error(0.02315372726835283196) D107 D115 +error(0.005000000000000000104) D108 +error(0.01953734547265125604) D108 D111 +error(0.01950573954449300734) D108 D111 ^ D109 L0 +error(0.02047875441702822971) D108 D116 +error(0.003519754113694771851) D108 D116 ^ D117 L0 +error(0.008150765370134861049) D108 D119 +error(0.00537844292380713733) D108 D119 ^ D109 L0 +error(0.002738168297218604354) D108 D119 ^ D117 L0 +error(0.0002965916782324567623) D108 D119 ^ D117 L0 ^ D109 L0 +error(0.001283890363784154698) D108 D120 +error(0.001602423345873141931) D108 D120 ^ D109 D117 +error(0.0002821861797186517155) D108 D120 ^ D109 L0 +error(0.01609503918502741895) D108 ^ D109 L0 +error(0.003723219794832624465) D108 ^ D117 L0 +error(0.003826354170225692609) D109 D117 ^ D108 +error(0.008168559711865796061) D109 D110 +error(0.000592083353901149247) D109 D110 ^ D108 +error(0.0004708525723943131108) D109 D110 ^ D111 D112 +error(0.0001379550994543373604) D109 D110 ^ D111 D120 +error(0.01136592012532810538) D109 D110 ^ D112 +error(0.005662589825470752507) D109 D110 ^ D112 D120 +error(0.001542084858710355199) D109 D110 ^ D120 +error(0.01422768648916782237) D109 D114 +error(0.01064896329602458766) D109 D114 ^ D111 D112 +error(0.01928995727685751949) D109 D117 +error(0.002298697319621939312) D109 D117 ^ D119 D120 +error(0.0005886496968834892913) D109 D117 ^ D120 +error(0.001422053675744177573) D109 D121 +error(0.001457158197496117398) D109 D121 ^ D111 D119 +error(0.0003676716865645205377) D109 D121 ^ D111 D120 +error(9.61822287037517867e-05) D109 D121 ^ D119 D120 +error(0.002175490388390937009) D109 D122 +error(0.002016525830820338656) D109 D122 ^ D111 D112 +error(0.0007539930162785939268) D109 D122 ^ D111 D119 +error(0.002485643595095263919) D109 D122 ^ D111 D120 +error(0.000526472466251045202) D109 D122 ^ D112 D120 +error(0.001673229833584762016) D109 D122 ^ D119 D120 +error(0.01567844516472288036) D109 L0 +error(0.001904610188208808287) D111 D119 ^ D109 L0 +error(0.01057521640164722949) D110 +error(0.002287990695516844801) D110 D117 +error(0.0001413955858408526875) D110 D117 ^ D108 +error(0.001996592167412813371) D110 D117 ^ D120 +error(0.0001145955726632778647) D110 D117 ^ D120 ^ D108 +error(0.02776275525335089242) D110 D118 +error(0.004870918352301477176) D110 D118 ^ D120 +error(0.002583225587656222053) D110 D122 +error(0.0004184391677443587642) D110 D122 ^ D111 D112 +error(0.0004193576456063421803) D110 D122 ^ D111 D120 +error(0.002145193778452082842) D110 D122 ^ D112 D120 +error(0.01527501698855216437) D110 ^ D112 +error(0.001554399533594142974) D110 ^ D120 +error(0.001697684185300124505) D110 ^ D120 ^ D112 +error(0.01061579557716061696) D111 +error(0.007310830027292446881) D111 D112 +error(0.0001863698305450992791) D111 D112 ^ D101 L0 +error(0.0003683424846873538556) D111 D112 ^ D113 D114 +error(0.001760568521934904483) D111 D112 ^ D114 D122 +error(0.01930074729561103916) D111 D119 +error(0.003198153269174034211) D111 D119 ^ D121 D122 +error(0.002916054377451179642) D111 D120 +error(0.0001533501624704119483) D111 D120 ^ D121 D122 +error(0.001387689226253301144) D111 D123 +error(0.001361654870009728442) D111 D123 ^ D114 D122 +error(0.0002413954180492218829) D111 D123 ^ D122 +error(0.01528555969706266171) D111 ^ D113 L0 +error(0.005197254862923379563) D113 D121 ^ D111 +error(0.01150160957505306711) D112 +error(0.01572797635670877131) D112 D115 +error(0.01776891682066950376) D112 D115 ^ D114 +error(0.02146430780874410832) D112 D120 +error(0.002545513591691210033) D112 D120 ^ D122 +error(0.003087650519477554232) D112 D123 +error(0.002632878264712303681) D112 D123 ^ D114 +error(0.003662385158381735884) D112 D123 ^ D122 +error(0.0007333567923765808025) D112 D123 ^ D122 ^ D114 +error(0.00802087827867440685) D113 D114 +error(0.003050964455461190224) D113 D114 ^ D103 +error(0.01239435349828414516) D113 D114 ^ D111 +error(0.0006140138506500330022) D113 D114 ^ D115 +error(0.0004305156496025841473) D113 D114 ^ D115 ^ D103 +error(0.02222565681719517253) D113 D121 +error(0.006119433420034472125) D113 L0 +error(0.0003720004299357881862) D113 L0 ^ D101 L0 ^ D103 +error(0.0005850028327265820735) D113 L0 ^ D101 L0 ^ D111 +error(0.00101586476739196855) D113 L0 ^ D111 ^ D103 +error(0.01000000000000000021) D114 +error(0.005051470923601393027) D114 D121 +error(0.005406777170627218715) D114 D121 ^ D111 +error(0.0004892394202587999107) D114 D121 ^ D123 +error(0.0003299629392860100241) D114 D121 ^ D123 ^ D111 +error(0.02031504564498634591) D114 D122 +error(0.002916556028322587601) D114 D122 ^ D111 +error(0.00181398596792339069) D114 D122 ^ D123 +error(0.0005613420269502157611) D114 ^ D102 ^ D104 +error(0.0003732069945926920094) D114 ^ D102 ^ D112 +error(0.001306645986214824374) D114 ^ D104 +error(0.01161101870635708119) D114 ^ D115 +error(0.001836549728297205133) D114 ^ D123 +error(0.002565690651523450452) D115 D123 ^ D114 +error(0.01015291549911626241) D115 +error(0.02315372726835283196) D115 D123 +error(0.005000000000000000104) D116 +error(0.01953734547265125604) D116 D119 +error(0.01950573954449300734) D116 D119 ^ D117 L0 +error(0.02047875441702822971) D116 D124 +error(0.003519754113694771851) D116 D124 ^ D125 L0 +error(0.008150765370134861049) D116 D127 +error(0.00537844292380713733) D116 D127 ^ D117 L0 +error(0.002738168297218604354) D116 D127 ^ D125 L0 +error(0.0002965916782324567623) D116 D127 ^ D125 L0 ^ D117 L0 +error(0.001283890363784154698) D116 D128 +error(0.001602423345873141931) D116 D128 ^ D117 D125 +error(0.0002821861797186517155) D116 D128 ^ D117 L0 +error(0.01609503918502741895) D116 ^ D117 L0 +error(0.003723219794832624465) D116 ^ D125 L0 +error(0.003826354170225692609) D117 D125 ^ D116 +error(0.008168559711865796061) D117 D118 +error(0.000592083353901149247) D117 D118 ^ D116 +error(0.0004708525723943131108) D117 D118 ^ D119 D120 +error(0.0001379550994543373604) D117 D118 ^ D119 D128 +error(0.01136592012532810538) D117 D118 ^ D120 +error(0.005662589825470752507) D117 D118 ^ D120 D128 +error(0.001542084858710355199) D117 D118 ^ D128 +error(0.01422768648916782237) D117 D122 +error(0.01064896329602458766) D117 D122 ^ D119 D120 +error(0.01928995727685751949) D117 D125 +error(0.002298697319621939312) D117 D125 ^ D127 D128 +error(0.0005886496968834892913) D117 D125 ^ D128 +error(0.001422053675744177573) D117 D129 +error(0.001457158197496117398) D117 D129 ^ D119 D127 +error(0.0003676716865645205377) D117 D129 ^ D119 D128 +error(9.61822287037517867e-05) D117 D129 ^ D127 D128 +error(0.002175490388390937009) D117 D130 +error(0.002016525830820338656) D117 D130 ^ D119 D120 +error(0.0007539930162785939268) D117 D130 ^ D119 D127 +error(0.002485643595095263919) D117 D130 ^ D119 D128 +error(0.000526472466251045202) D117 D130 ^ D120 D128 +error(0.001673229833584762016) D117 D130 ^ D127 D128 +error(0.01567844516472288036) D117 L0 +error(0.001904610188208808287) D119 D127 ^ D117 L0 +error(0.01057521640164722949) D118 +error(0.002287990695516844801) D118 D125 +error(0.0001413955858408526875) D118 D125 ^ D116 +error(0.001996592167412813371) D118 D125 ^ D128 +error(0.0001145955726632778647) D118 D125 ^ D128 ^ D116 +error(0.02776275525335089242) D118 D126 +error(0.004870918352301477176) D118 D126 ^ D128 +error(0.002583225587656222053) D118 D130 +error(0.0004184391677443587642) D118 D130 ^ D119 D120 +error(0.0004193576456063421803) D118 D130 ^ D119 D128 +error(0.002145193778452082842) D118 D130 ^ D120 D128 +error(0.01527501698855216437) D118 ^ D120 +error(0.001554399533594142974) D118 ^ D128 +error(0.001697684185300124505) D118 ^ D128 ^ D120 +error(0.01061579557716061696) D119 +error(0.007310830027292446881) D119 D120 +error(0.0001863698305450992791) D119 D120 ^ D109 L0 +error(0.0003683424846873538556) D119 D120 ^ D121 D122 +error(0.001760568521934904483) D119 D120 ^ D122 D130 +error(0.01930074729561103916) D119 D127 +error(0.003198153269174034211) D119 D127 ^ D129 D130 +error(0.002916054377451179642) D119 D128 +error(0.0001533501624704119483) D119 D128 ^ D129 D130 +error(0.001387689226253301144) D119 D131 +error(0.001361654870009728442) D119 D131 ^ D122 D130 +error(0.0002413954180492218829) D119 D131 ^ D130 +error(0.01528555969706266171) D119 ^ D121 L0 +error(0.005197254862923379563) D121 D129 ^ D119 +error(0.01150160957505306711) D120 +error(0.01572797635670877131) D120 D123 +error(0.01776891682066950376) D120 D123 ^ D122 +error(0.02146430780874410832) D120 D128 +error(0.002545513591691210033) D120 D128 ^ D130 +error(0.003087650519477554232) D120 D131 +error(0.002632878264712303681) D120 D131 ^ D122 +error(0.003662385158381735884) D120 D131 ^ D130 +error(0.0007333567923765808025) D120 D131 ^ D130 ^ D122 +error(0.00802087827867440685) D121 D122 +error(0.003050964455461190224) D121 D122 ^ D111 +error(0.01239435349828414516) D121 D122 ^ D119 +error(0.0006140138506500330022) D121 D122 ^ D123 +error(0.0004305156496025841473) D121 D122 ^ D123 ^ D111 +error(0.02222565681719517253) D121 D129 +error(0.006119433420034472125) D121 L0 +error(0.0003720004299357881862) D121 L0 ^ D109 L0 ^ D111 +error(0.0005850028327265820735) D121 L0 ^ D109 L0 ^ D119 +error(0.00101586476739196855) D121 L0 ^ D119 ^ D111 +error(0.01000000000000000021) D122 +error(0.005051470923601393027) D122 D129 +error(0.005406777170627218715) D122 D129 ^ D119 +error(0.0004892394202587999107) D122 D129 ^ D131 +error(0.0003299629392860100241) D122 D129 ^ D131 ^ D119 +error(0.02031504564498634591) D122 D130 +error(0.002916556028322587601) D122 D130 ^ D119 +error(0.00181398596792339069) D122 D130 ^ D131 +error(0.0005613420269502157611) D122 ^ D110 ^ D112 +error(0.0003732069945926920094) D122 ^ D110 ^ D120 +error(0.001306645986214824374) D122 ^ D112 +error(0.01161101870635708119) D122 ^ D123 +error(0.001836549728297205133) D122 ^ D131 +error(0.002565690651523450452) D123 D131 ^ D122 +error(0.01015291549911626241) D123 +error(0.02315372726835283196) D123 D131 +error(0.005000000000000000104) D124 +error(0.01953734547265125604) D124 D127 +error(0.01950573954449300734) D124 D127 ^ D125 L0 +error(0.02047875441702822971) D124 D132 +error(0.003519754113694771851) D124 D132 ^ D133 L0 +error(0.008150765370134861049) D124 D135 +error(0.00537844292380713733) D124 D135 ^ D125 L0 +error(0.002738168297218604354) D124 D135 ^ D133 L0 +error(0.0002965916782324567623) D124 D135 ^ D133 L0 ^ D125 L0 +error(0.001283890363784154698) D124 D136 +error(0.001602423345873141931) D124 D136 ^ D125 D133 +error(0.0002821861797186517155) D124 D136 ^ D125 L0 +error(0.01609503918502741895) D124 ^ D125 L0 +error(0.003723219794832624465) D124 ^ D133 L0 +error(0.003826354170225692609) D125 D133 ^ D124 +error(0.008168559711865796061) D125 D126 +error(0.000592083353901149247) D125 D126 ^ D124 +error(0.0004708525723943131108) D125 D126 ^ D127 D128 +error(0.0001379550994543373604) D125 D126 ^ D127 D136 +error(0.01136592012532810538) D125 D126 ^ D128 +error(0.005662589825470752507) D125 D126 ^ D128 D136 +error(0.001542084858710355199) D125 D126 ^ D136 +error(0.01422768648916782237) D125 D130 +error(0.01064896329602458766) D125 D130 ^ D127 D128 +error(0.01928995727685751949) D125 D133 +error(0.002298697319621939312) D125 D133 ^ D135 D136 +error(0.0005886496968834892913) D125 D133 ^ D136 +error(0.001422053675744177573) D125 D137 +error(0.001457158197496117398) D125 D137 ^ D127 D135 +error(0.0003676716865645205377) D125 D137 ^ D127 D136 +error(9.61822287037517867e-05) D125 D137 ^ D135 D136 +error(0.002175490388390937009) D125 D138 +error(0.002016525830820338656) D125 D138 ^ D127 D128 +error(0.0007539930162785939268) D125 D138 ^ D127 D135 +error(0.002485643595095263919) D125 D138 ^ D127 D136 +error(0.000526472466251045202) D125 D138 ^ D128 D136 +error(0.001673229833584762016) D125 D138 ^ D135 D136 +error(0.01567844516472288036) D125 L0 +error(0.001904610188208808287) D127 D135 ^ D125 L0 +error(0.01057521640164722949) D126 +error(0.002287990695516844801) D126 D133 +error(0.0001413955858408526875) D126 D133 ^ D124 +error(0.001996592167412813371) D126 D133 ^ D136 +error(0.0001145955726632778647) D126 D133 ^ D136 ^ D124 +error(0.02776275525335089242) D126 D134 +error(0.004870918352301477176) D126 D134 ^ D136 +error(0.002583225587656222053) D126 D138 +error(0.0004184391677443587642) D126 D138 ^ D127 D128 +error(0.0004193576456063421803) D126 D138 ^ D127 D136 +error(0.002145193778452082842) D126 D138 ^ D128 D136 +error(0.01527501698855216437) D126 ^ D128 +error(0.001554399533594142974) D126 ^ D136 +error(0.001697684185300124505) D126 ^ D136 ^ D128 +error(0.01061579557716061696) D127 +error(0.007310830027292446881) D127 D128 +error(0.0001863698305450992791) D127 D128 ^ D117 L0 +error(0.0003683424846873538556) D127 D128 ^ D129 D130 +error(0.001760568521934904483) D127 D128 ^ D130 D138 +error(0.01930074729561103916) D127 D135 +error(0.003198153269174034211) D127 D135 ^ D137 D138 +error(0.002916054377451179642) D127 D136 +error(0.0001533501624704119483) D127 D136 ^ D137 D138 +error(0.001387689226253301144) D127 D139 +error(0.001361654870009728442) D127 D139 ^ D130 D138 +error(0.0002413954180492218829) D127 D139 ^ D138 +error(0.01528555969706266171) D127 ^ D129 L0 +error(0.005197254862923379563) D129 D137 ^ D127 +error(0.01150160957505306711) D128 +error(0.01572797635670877131) D128 D131 +error(0.01776891682066950376) D128 D131 ^ D130 +error(0.02146430780874410832) D128 D136 +error(0.002545513591691210033) D128 D136 ^ D138 +error(0.003087650519477554232) D128 D139 +error(0.002632878264712303681) D128 D139 ^ D130 +error(0.003662385158381735884) D128 D139 ^ D138 +error(0.0007333567923765808025) D128 D139 ^ D138 ^ D130 +error(0.00802087827867440685) D129 D130 +error(0.003050964455461190224) D129 D130 ^ D119 +error(0.01239435349828414516) D129 D130 ^ D127 +error(0.0006140138506500330022) D129 D130 ^ D131 +error(0.0004305156496025841473) D129 D130 ^ D131 ^ D119 +error(0.02222565681719517253) D129 D137 +error(0.006119433420034472125) D129 L0 +error(0.0003720004299357881862) D129 L0 ^ D117 L0 ^ D119 +error(0.0005850028327265820735) D129 L0 ^ D117 L0 ^ D127 +error(0.00101586476739196855) D129 L0 ^ D127 ^ D119 +error(0.01000000000000000021) D130 +error(0.005051470923601393027) D130 D137 +error(0.005406777170627218715) D130 D137 ^ D127 +error(0.0004892394202587999107) D130 D137 ^ D139 +error(0.0003299629392860100241) D130 D137 ^ D139 ^ D127 +error(0.02031504564498634591) D130 D138 +error(0.002916556028322587601) D130 D138 ^ D127 +error(0.00181398596792339069) D130 D138 ^ D139 +error(0.0005613420269502157611) D130 ^ D118 ^ D120 +error(0.0003732069945926920094) D130 ^ D118 ^ D128 +error(0.001306645986214824374) D130 ^ D120 +error(0.01161101870635708119) D130 ^ D131 +error(0.001836549728297205133) D130 ^ D139 +error(0.002565690651523450452) D131 D139 ^ D130 +error(0.01015291549911626241) D131 +error(0.02315372726835283196) D131 D139 +error(0.005000000000000000104) D132 +error(0.01953734547265125604) D132 D135 +error(0.01950573954449300734) D132 D135 ^ D133 L0 +error(0.02047875441702822971) D132 D140 +error(0.003519754113694771851) D132 D140 ^ D141 L0 +error(0.008150765370134861049) D132 D143 +error(0.00537844292380713733) D132 D143 ^ D133 L0 +error(0.002738168297218604354) D132 D143 ^ D141 L0 +error(0.0002965916782324567623) D132 D143 ^ D141 L0 ^ D133 L0 +error(0.001283890363784154698) D132 D144 +error(0.001602423345873141931) D132 D144 ^ D133 D141 +error(0.0002821861797186517155) D132 D144 ^ D133 L0 +error(0.01609503918502741895) D132 ^ D133 L0 +error(0.003723219794832624465) D132 ^ D141 L0 +error(0.003826354170225692609) D133 D141 ^ D132 +error(0.008168559711865796061) D133 D134 +error(0.000592083353901149247) D133 D134 ^ D132 +error(0.0004708525723943131108) D133 D134 ^ D135 D136 +error(0.0001379550994543373604) D133 D134 ^ D135 D144 +error(0.01136592012532810538) D133 D134 ^ D136 +error(0.005662589825470752507) D133 D134 ^ D136 D144 +error(0.001542084858710355199) D133 D134 ^ D144 +error(0.01422768648916782237) D133 D138 +error(0.01064896329602458766) D133 D138 ^ D135 D136 +error(0.01928995727685751949) D133 D141 +error(0.002298697319621939312) D133 D141 ^ D143 D144 +error(0.0005886496968834892913) D133 D141 ^ D144 +error(0.001422053675744177573) D133 D145 +error(0.001457158197496117398) D133 D145 ^ D135 D143 +error(0.0003676716865645205377) D133 D145 ^ D135 D144 +error(9.61822287037517867e-05) D133 D145 ^ D143 D144 +error(0.002175490388390937009) D133 D146 +error(0.002016525830820338656) D133 D146 ^ D135 D136 +error(0.0007539930162785939268) D133 D146 ^ D135 D143 +error(0.002485643595095263919) D133 D146 ^ D135 D144 +error(0.000526472466251045202) D133 D146 ^ D136 D144 +error(0.001673229833584762016) D133 D146 ^ D143 D144 +error(0.01567844516472288036) D133 L0 +error(0.001904610188208808287) D135 D143 ^ D133 L0 +error(0.01057521640164722949) D134 +error(0.002287990695516844801) D134 D141 +error(0.0001413955858408526875) D134 D141 ^ D132 +error(0.001996592167412813371) D134 D141 ^ D144 +error(0.0001145955726632778647) D134 D141 ^ D144 ^ D132 +error(0.02776275525335089242) D134 D142 +error(0.004870918352301477176) D134 D142 ^ D144 +error(0.002583225587656222053) D134 D146 +error(0.0004184391677443587642) D134 D146 ^ D135 D136 +error(0.0004193576456063421803) D134 D146 ^ D135 D144 +error(0.002145193778452082842) D134 D146 ^ D136 D144 +error(0.01527501698855216437) D134 ^ D136 +error(0.001554399533594142974) D134 ^ D144 +error(0.001697684185300124505) D134 ^ D144 ^ D136 +error(0.01061579557716061696) D135 +error(0.007310830027292446881) D135 D136 +error(0.0001863698305450992791) D135 D136 ^ D125 L0 +error(0.0003683424846873538556) D135 D136 ^ D137 D138 +error(0.001760568521934904483) D135 D136 ^ D138 D146 +error(0.01930074729561103916) D135 D143 +error(0.003198153269174034211) D135 D143 ^ D145 D146 +error(0.002916054377451179642) D135 D144 +error(0.0001533501624704119483) D135 D144 ^ D145 D146 +error(0.001387689226253301144) D135 D147 +error(0.001361654870009728442) D135 D147 ^ D138 D146 +error(0.0002413954180492218829) D135 D147 ^ D146 +error(0.01528555969706266171) D135 ^ D137 L0 +error(0.005197254862923379563) D137 D145 ^ D135 +error(0.01150160957505306711) D136 +error(0.01572797635670877131) D136 D139 +error(0.01776891682066950376) D136 D139 ^ D138 +error(0.02146430780874410832) D136 D144 +error(0.002545513591691210033) D136 D144 ^ D146 +error(0.003087650519477554232) D136 D147 +error(0.002632878264712303681) D136 D147 ^ D138 +error(0.003662385158381735884) D136 D147 ^ D146 +error(0.0007333567923765808025) D136 D147 ^ D146 ^ D138 +error(0.00802087827867440685) D137 D138 +error(0.003050964455461190224) D137 D138 ^ D127 +error(0.01239435349828414516) D137 D138 ^ D135 +error(0.0006140138506500330022) D137 D138 ^ D139 +error(0.0004305156496025841473) D137 D138 ^ D139 ^ D127 +error(0.02222565681719517253) D137 D145 +error(0.006119433420034472125) D137 L0 +error(0.0003720004299357881862) D137 L0 ^ D125 L0 ^ D127 +error(0.0005850028327265820735) D137 L0 ^ D125 L0 ^ D135 +error(0.00101586476739196855) D137 L0 ^ D135 ^ D127 +error(0.01000000000000000021) D138 +error(0.005051470923601393027) D138 D145 +error(0.005406777170627218715) D138 D145 ^ D135 +error(0.0004892394202587999107) D138 D145 ^ D147 +error(0.0003299629392860100241) D138 D145 ^ D147 ^ D135 +error(0.02031504564498634591) D138 D146 +error(0.002916556028322587601) D138 D146 ^ D135 +error(0.00181398596792339069) D138 D146 ^ D147 +error(0.0005613420269502157611) D138 ^ D126 ^ D128 +error(0.0003732069945926920094) D138 ^ D126 ^ D136 +error(0.001306645986214824374) D138 ^ D128 +error(0.01161101870635708119) D138 ^ D139 +error(0.001836549728297205133) D138 ^ D147 +error(0.002565690651523450452) D139 D147 ^ D138 +error(0.01015291549911626241) D139 +error(0.02315372726835283196) D139 D147 +error(0.005000000000000000104) D140 +error(0.01953734547265125604) D140 D143 +error(0.01950573954449300734) D140 D143 ^ D141 L0 +error(0.02047875441702822971) D140 D148 +error(0.003519754113694771851) D140 D148 ^ D149 L0 +error(0.008150765370134861049) D140 D151 +error(0.00537844292380713733) D140 D151 ^ D141 L0 +error(0.002738168297218604354) D140 D151 ^ D149 L0 +error(0.0002965916782324567623) D140 D151 ^ D149 L0 ^ D141 L0 +error(0.001283890363784154698) D140 D152 +error(0.001602423345873141931) D140 D152 ^ D141 D149 +error(0.0002821861797186517155) D140 D152 ^ D141 L0 +error(0.01609503918502741895) D140 ^ D141 L0 +error(0.003723219794832624465) D140 ^ D149 L0 +error(0.003826354170225692609) D141 D149 ^ D140 +error(0.008168559711865796061) D141 D142 +error(0.000592083353901149247) D141 D142 ^ D140 +error(0.0004708525723943131108) D141 D142 ^ D143 D144 +error(0.0001379550994543373604) D141 D142 ^ D143 D152 +error(0.01136592012532810538) D141 D142 ^ D144 +error(0.005662589825470752507) D141 D142 ^ D144 D152 +error(0.001542084858710355199) D141 D142 ^ D152 +error(0.01422768648916782237) D141 D146 +error(0.01064896329602458766) D141 D146 ^ D143 D144 +error(0.01928995727685751949) D141 D149 +error(0.002298697319621939312) D141 D149 ^ D151 D152 +error(0.0005886496968834892913) D141 D149 ^ D152 +error(0.001422053675744177573) D141 D153 +error(0.001457158197496117398) D141 D153 ^ D143 D151 +error(0.0003676716865645205377) D141 D153 ^ D143 D152 +error(9.61822287037517867e-05) D141 D153 ^ D151 D152 +error(0.002175490388390937009) D141 D154 +error(0.002016525830820338656) D141 D154 ^ D143 D144 +error(0.0007539930162785939268) D141 D154 ^ D143 D151 +error(0.002485643595095263919) D141 D154 ^ D143 D152 +error(0.000526472466251045202) D141 D154 ^ D144 D152 +error(0.001673229833584762016) D141 D154 ^ D151 D152 +error(0.01567844516472288036) D141 L0 +error(0.001904610188208808287) D143 D151 ^ D141 L0 +error(0.01057521640164722949) D142 +error(0.002287990695516844801) D142 D149 +error(0.0001413955858408526875) D142 D149 ^ D140 +error(0.001996592167412813371) D142 D149 ^ D152 +error(0.0001145955726632778647) D142 D149 ^ D152 ^ D140 +error(0.02776275525335089242) D142 D150 +error(0.004870918352301477176) D142 D150 ^ D152 +error(0.002583225587656222053) D142 D154 +error(0.0004184391677443587642) D142 D154 ^ D143 D144 +error(0.0004193576456063421803) D142 D154 ^ D143 D152 +error(0.002145193778452082842) D142 D154 ^ D144 D152 +error(0.01527501698855216437) D142 ^ D144 +error(0.001554399533594142974) D142 ^ D152 +error(0.001697684185300124505) D142 ^ D152 ^ D144 +error(0.01061579557716061696) D143 +error(0.007310830027292446881) D143 D144 +error(0.0001863698305450992791) D143 D144 ^ D133 L0 +error(0.0003683424846873538556) D143 D144 ^ D145 D146 +error(0.001760568521934904483) D143 D144 ^ D146 D154 +error(0.01930074729561103916) D143 D151 +error(0.003198153269174034211) D143 D151 ^ D153 D154 +error(0.002916054377451179642) D143 D152 +error(0.0001533501624704119483) D143 D152 ^ D153 D154 +error(0.001387689226253301144) D143 D155 +error(0.001361654870009728442) D143 D155 ^ D146 D154 +error(0.0002413954180492218829) D143 D155 ^ D154 +error(0.01528555969706266171) D143 ^ D145 L0 +error(0.005197254862923379563) D145 D153 ^ D143 +error(0.01150160957505306711) D144 +error(0.01572797635670877131) D144 D147 +error(0.01776891682066950376) D144 D147 ^ D146 +error(0.02146430780874410832) D144 D152 +error(0.002545513591691210033) D144 D152 ^ D154 +error(0.003087650519477554232) D144 D155 +error(0.002632878264712303681) D144 D155 ^ D146 +error(0.003662385158381735884) D144 D155 ^ D154 +error(0.0007333567923765808025) D144 D155 ^ D154 ^ D146 +error(0.00802087827867440685) D145 D146 +error(0.003050964455461190224) D145 D146 ^ D135 +error(0.01239435349828414516) D145 D146 ^ D143 +error(0.0006140138506500330022) D145 D146 ^ D147 +error(0.0004305156496025841473) D145 D146 ^ D147 ^ D135 +error(0.02222565681719517253) D145 D153 +error(0.006119433420034472125) D145 L0 +error(0.0003720004299357881862) D145 L0 ^ D133 L0 ^ D135 +error(0.0005850028327265820735) D145 L0 ^ D133 L0 ^ D143 +error(0.00101586476739196855) D145 L0 ^ D143 ^ D135 +error(0.01000000000000000021) D146 +error(0.005051470923601393027) D146 D153 +error(0.005406777170627218715) D146 D153 ^ D143 +error(0.0004892394202587999107) D146 D153 ^ D155 +error(0.0003299629392860100241) D146 D153 ^ D155 ^ D143 +error(0.02031504564498634591) D146 D154 +error(0.002916556028322587601) D146 D154 ^ D143 +error(0.00181398596792339069) D146 D154 ^ D155 +error(0.0005613420269502157611) D146 ^ D134 ^ D136 +error(0.0003732069945926920094) D146 ^ D134 ^ D144 +error(0.001306645986214824374) D146 ^ D136 +error(0.01161101870635708119) D146 ^ D147 +error(0.001836549728297205133) D146 ^ D155 +error(0.002565690651523450452) D147 D155 ^ D146 +error(0.01015291549911626241) D147 +error(0.02315372726835283196) D147 D155 +error(0.005000000000000000104) D148 +error(0.01953734547265125604) D148 D151 +error(0.01950573954449300734) D148 D151 ^ D149 L0 +error(0.02047875441702822971) D148 D156 +error(0.003519754113694771851) D148 D156 ^ D157 L0 +error(0.008150765370134861049) D148 D159 +error(0.00537844292380713733) D148 D159 ^ D149 L0 +error(0.002738168297218604354) D148 D159 ^ D157 L0 +error(0.0002965916782324567623) D148 D159 ^ D157 L0 ^ D149 L0 +error(0.001283890363784154698) D148 D160 +error(0.001602423345873141931) D148 D160 ^ D149 D157 +error(0.0002821861797186517155) D148 D160 ^ D149 L0 +error(0.01609503918502741895) D148 ^ D149 L0 +error(0.003723219794832624465) D148 ^ D157 L0 +error(0.003826354170225692609) D149 D157 ^ D148 +error(0.008168559711865796061) D149 D150 +error(0.000592083353901149247) D149 D150 ^ D148 +error(0.0004708525723943131108) D149 D150 ^ D151 D152 +error(0.0001379550994543373604) D149 D150 ^ D151 D160 +error(0.01136592012532810538) D149 D150 ^ D152 +error(0.005662589825470752507) D149 D150 ^ D152 D160 +error(0.001542084858710355199) D149 D150 ^ D160 +error(0.01422768648916782237) D149 D154 +error(0.01064896329602458766) D149 D154 ^ D151 D152 +error(0.01928995727685751949) D149 D157 +error(0.002298697319621939312) D149 D157 ^ D159 D160 +error(0.0005886496968834892913) D149 D157 ^ D160 +error(0.001422053675744177573) D149 D161 +error(0.001457158197496117398) D149 D161 ^ D151 D159 +error(0.0003676716865645205377) D149 D161 ^ D151 D160 +error(9.61822287037517867e-05) D149 D161 ^ D159 D160 +error(0.002175490388390937009) D149 D162 +error(0.002016525830820338656) D149 D162 ^ D151 D152 +error(0.0007539930162785939268) D149 D162 ^ D151 D159 +error(0.002485643595095263919) D149 D162 ^ D151 D160 +error(0.000526472466251045202) D149 D162 ^ D152 D160 +error(0.001673229833584762016) D149 D162 ^ D159 D160 +error(0.01567844516472288036) D149 L0 +error(0.001904610188208808287) D151 D159 ^ D149 L0 +error(0.01057521640164722949) D150 +error(0.002287990695516844801) D150 D157 +error(0.0001413955858408526875) D150 D157 ^ D148 +error(0.001996592167412813371) D150 D157 ^ D160 +error(0.0001145955726632778647) D150 D157 ^ D160 ^ D148 +error(0.02776275525335089242) D150 D158 +error(0.004870918352301477176) D150 D158 ^ D160 +error(0.002583225587656222053) D150 D162 +error(0.0004184391677443587642) D150 D162 ^ D151 D152 +error(0.0004193576456063421803) D150 D162 ^ D151 D160 +error(0.002145193778452082842) D150 D162 ^ D152 D160 +error(0.01527501698855216437) D150 ^ D152 +error(0.001554399533594142974) D150 ^ D160 +error(0.001697684185300124505) D150 ^ D160 ^ D152 +error(0.01061579557716061696) D151 +error(0.007310830027292446881) D151 D152 +error(0.0001863698305450992791) D151 D152 ^ D141 L0 +error(0.0003683424846873538556) D151 D152 ^ D153 D154 +error(0.001760568521934904483) D151 D152 ^ D154 D162 +error(0.01930074729561103916) D151 D159 +error(0.003198153269174034211) D151 D159 ^ D161 D162 +error(0.002916054377451179642) D151 D160 +error(0.0001533501624704119483) D151 D160 ^ D161 D162 +error(0.001387689226253301144) D151 D163 +error(0.001361654870009728442) D151 D163 ^ D154 D162 +error(0.0002413954180492218829) D151 D163 ^ D162 +error(0.01528555969706266171) D151 ^ D153 L0 +error(0.005197254862923379563) D153 D161 ^ D151 +error(0.01150160957505306711) D152 +error(0.01572797635670877131) D152 D155 +error(0.01776891682066950376) D152 D155 ^ D154 +error(0.02146430780874410832) D152 D160 +error(0.002545513591691210033) D152 D160 ^ D162 +error(0.003087650519477554232) D152 D163 +error(0.002632878264712303681) D152 D163 ^ D154 +error(0.003662385158381735884) D152 D163 ^ D162 +error(0.0007333567923765808025) D152 D163 ^ D162 ^ D154 +error(0.00802087827867440685) D153 D154 +error(0.003050964455461190224) D153 D154 ^ D143 +error(0.01239435349828414516) D153 D154 ^ D151 +error(0.0006140138506500330022) D153 D154 ^ D155 +error(0.0004305156496025841473) D153 D154 ^ D155 ^ D143 +error(0.02222565681719517253) D153 D161 +error(0.006119433420034472125) D153 L0 +error(0.0003720004299357881862) D153 L0 ^ D141 L0 ^ D143 +error(0.0005850028327265820735) D153 L0 ^ D141 L0 ^ D151 +error(0.00101586476739196855) D153 L0 ^ D151 ^ D143 +error(0.01000000000000000021) D154 +error(0.005051470923601393027) D154 D161 +error(0.005406777170627218715) D154 D161 ^ D151 +error(0.0004892394202587999107) D154 D161 ^ D163 +error(0.0003299629392860100241) D154 D161 ^ D163 ^ D151 +error(0.02031504564498634591) D154 D162 +error(0.002916556028322587601) D154 D162 ^ D151 +error(0.00181398596792339069) D154 D162 ^ D163 +error(0.0005613420269502157611) D154 ^ D142 ^ D144 +error(0.0003732069945926920094) D154 ^ D142 ^ D152 +error(0.001306645986214824374) D154 ^ D144 +error(0.01161101870635708119) D154 ^ D155 +error(0.001836549728297205133) D154 ^ D163 +error(0.002565690651523450452) D155 D163 ^ D154 +error(0.01015291549911626241) D155 +error(0.02315372726835283196) D155 D163 +error(0.005000000000000000104) D156 +error(0.01953734547265125604) D156 D159 +error(0.01950573954449300734) D156 D159 ^ D157 L0 +error(0.02047875441702822971) D156 D164 +error(0.003519754113694771851) D156 D164 ^ D165 L0 +error(0.008150765370134861049) D156 D167 +error(0.00537844292380713733) D156 D167 ^ D157 L0 +error(0.002738168297218604354) D156 D167 ^ D165 L0 +error(0.0002965916782324567623) D156 D167 ^ D165 L0 ^ D157 L0 +error(0.001283890363784154698) D156 D168 +error(0.001602423345873141931) D156 D168 ^ D157 D165 +error(0.0002821861797186517155) D156 D168 ^ D157 L0 +error(0.01609503918502741895) D156 ^ D157 L0 +error(0.003723219794832624465) D156 ^ D165 L0 +error(0.003826354170225692609) D157 D165 ^ D156 +error(0.008168559711865796061) D157 D158 +error(0.000592083353901149247) D157 D158 ^ D156 +error(0.0004708525723943131108) D157 D158 ^ D159 D160 +error(0.0001379550994543373604) D157 D158 ^ D159 D168 +error(0.01136592012532810538) D157 D158 ^ D160 +error(0.005662589825470752507) D157 D158 ^ D160 D168 +error(0.001542084858710355199) D157 D158 ^ D168 +error(0.01422768648916782237) D157 D162 +error(0.01064896329602458766) D157 D162 ^ D159 D160 +error(0.01928995727685751949) D157 D165 +error(0.002298697319621939312) D157 D165 ^ D167 D168 +error(0.0005886496968834892913) D157 D165 ^ D168 +error(0.001422053675744177573) D157 D169 +error(0.001457158197496117398) D157 D169 ^ D159 D167 +error(0.0003676716865645205377) D157 D169 ^ D159 D168 +error(9.61822287037517867e-05) D157 D169 ^ D167 D168 +error(0.002175490388390937009) D157 D170 +error(0.002016525830820338656) D157 D170 ^ D159 D160 +error(0.0007539930162785939268) D157 D170 ^ D159 D167 +error(0.002485643595095263919) D157 D170 ^ D159 D168 +error(0.000526472466251045202) D157 D170 ^ D160 D168 +error(0.001673229833584762016) D157 D170 ^ D167 D168 +error(0.01567844516472288036) D157 L0 +error(0.001904610188208808287) D159 D167 ^ D157 L0 +error(0.01057521640164722949) D158 +error(0.002287990695516844801) D158 D165 +error(0.0001413955858408526875) D158 D165 ^ D156 +error(0.001996592167412813371) D158 D165 ^ D168 +error(0.0001145955726632778647) D158 D165 ^ D168 ^ D156 +error(0.02776275525335089242) D158 D166 +error(0.004870918352301477176) D158 D166 ^ D168 +error(0.002583225587656222053) D158 D170 +error(0.0004184391677443587642) D158 D170 ^ D159 D160 +error(0.0004193576456063421803) D158 D170 ^ D159 D168 +error(0.002145193778452082842) D158 D170 ^ D160 D168 +error(0.01527501698855216437) D158 ^ D160 +error(0.001554399533594142974) D158 ^ D168 +error(0.001697684185300124505) D158 ^ D168 ^ D160 +error(0.01061579557716061696) D159 +error(0.007310830027292446881) D159 D160 +error(0.0001863698305450992791) D159 D160 ^ D149 L0 +error(0.0003683424846873538556) D159 D160 ^ D161 D162 +error(0.001760568521934904483) D159 D160 ^ D162 D170 +error(0.01930074729561103916) D159 D167 +error(0.003198153269174034211) D159 D167 ^ D169 D170 +error(0.002916054377451179642) D159 D168 +error(0.0001533501624704119483) D159 D168 ^ D169 D170 +error(0.001387689226253301144) D159 D171 +error(0.001361654870009728442) D159 D171 ^ D162 D170 +error(0.0002413954180492218829) D159 D171 ^ D170 +error(0.01528555969706266171) D159 ^ D161 L0 +error(0.005197254862923379563) D161 D169 ^ D159 +error(0.01150160957505306711) D160 +error(0.01572797635670877131) D160 D163 +error(0.01776891682066950376) D160 D163 ^ D162 +error(0.02146430780874410832) D160 D168 +error(0.002545513591691210033) D160 D168 ^ D170 +error(0.003087650519477554232) D160 D171 +error(0.002632878264712303681) D160 D171 ^ D162 +error(0.003662385158381735884) D160 D171 ^ D170 +error(0.0007333567923765808025) D160 D171 ^ D170 ^ D162 +error(0.00802087827867440685) D161 D162 +error(0.003050964455461190224) D161 D162 ^ D151 +error(0.01239435349828414516) D161 D162 ^ D159 +error(0.0006140138506500330022) D161 D162 ^ D163 +error(0.0004305156496025841473) D161 D162 ^ D163 ^ D151 +error(0.02222565681719517253) D161 D169 +error(0.006119433420034472125) D161 L0 +error(0.0003720004299357881862) D161 L0 ^ D149 L0 ^ D151 +error(0.0005850028327265820735) D161 L0 ^ D149 L0 ^ D159 +error(0.00101586476739196855) D161 L0 ^ D159 ^ D151 +error(0.01000000000000000021) D162 +error(0.005051470923601393027) D162 D169 +error(0.005406777170627218715) D162 D169 ^ D159 +error(0.0004892394202587999107) D162 D169 ^ D171 +error(0.0003299629392860100241) D162 D169 ^ D171 ^ D159 +error(0.02031504564498634591) D162 D170 +error(0.002916556028322587601) D162 D170 ^ D159 +error(0.00181398596792339069) D162 D170 ^ D171 +error(0.0005613420269502157611) D162 ^ D150 ^ D152 +error(0.0003732069945926920094) D162 ^ D150 ^ D160 +error(0.001306645986214824374) D162 ^ D152 +error(0.01161101870635708119) D162 ^ D163 +error(0.001836549728297205133) D162 ^ D171 +error(0.002565690651523450452) D163 D171 ^ D162 +error(0.01015291549911626241) D163 +error(0.02315372726835283196) D163 D171 +error(0.005000000000000000104) D164 +error(0.01953734547265125604) D164 D167 +error(0.01950573954449300734) D164 D167 ^ D165 L0 +error(0.02047875441702822971) D164 D172 +error(0.003519754113694771851) D164 D172 ^ D173 L0 +error(0.008150765370134861049) D164 D175 +error(0.00537844292380713733) D164 D175 ^ D165 L0 +error(0.002738168297218604354) D164 D175 ^ D173 L0 +error(0.0002965916782324567623) D164 D175 ^ D173 L0 ^ D165 L0 +error(0.001283890363784154698) D164 D176 +error(0.001602423345873141931) D164 D176 ^ D165 D173 +error(0.0002821861797186517155) D164 D176 ^ D165 L0 +error(0.01609503918502741895) D164 ^ D165 L0 +error(0.003723219794832624465) D164 ^ D173 L0 +error(0.003826354170225692609) D165 D173 ^ D164 +error(0.008168559711865796061) D165 D166 +error(0.000592083353901149247) D165 D166 ^ D164 +error(0.0004708525723943131108) D165 D166 ^ D167 D168 +error(0.0001379550994543373604) D165 D166 ^ D167 D176 +error(0.01136592012532810538) D165 D166 ^ D168 +error(0.005662589825470752507) D165 D166 ^ D168 D176 +error(0.001542084858710355199) D165 D166 ^ D176 +error(0.01422768648916782237) D165 D170 +error(0.01064896329602458766) D165 D170 ^ D167 D168 +error(0.01928995727685751949) D165 D173 +error(0.002298697319621939312) D165 D173 ^ D175 D176 +error(0.0005886496968834892913) D165 D173 ^ D176 +error(0.001422053675744177573) D165 D177 +error(0.001457158197496117398) D165 D177 ^ D167 D175 +error(0.0003676716865645205377) D165 D177 ^ D167 D176 +error(9.61822287037517867e-05) D165 D177 ^ D175 D176 +error(0.002175490388390937009) D165 D178 +error(0.002016525830820338656) D165 D178 ^ D167 D168 +error(0.0007539930162785939268) D165 D178 ^ D167 D175 +error(0.002485643595095263919) D165 D178 ^ D167 D176 +error(0.000526472466251045202) D165 D178 ^ D168 D176 +error(0.001673229833584762016) D165 D178 ^ D175 D176 +error(0.01567844516472288036) D165 L0 +error(0.001904610188208808287) D167 D175 ^ D165 L0 +error(0.01057521640164722949) D166 +error(0.002287990695516844801) D166 D173 +error(0.0001413955858408526875) D166 D173 ^ D164 +error(0.001996592167412813371) D166 D173 ^ D176 +error(0.0001145955726632778647) D166 D173 ^ D176 ^ D164 +error(0.02776275525335089242) D166 D174 +error(0.004870918352301477176) D166 D174 ^ D176 +error(0.002583225587656222053) D166 D178 +error(0.0004184391677443587642) D166 D178 ^ D167 D168 +error(0.0004193576456063421803) D166 D178 ^ D167 D176 +error(0.002145193778452082842) D166 D178 ^ D168 D176 +error(0.01527501698855216437) D166 ^ D168 +error(0.001554399533594142974) D166 ^ D176 +error(0.001697684185300124505) D166 ^ D176 ^ D168 +error(0.01061579557716061696) D167 +error(0.007310830027292446881) D167 D168 +error(0.0001863698305450992791) D167 D168 ^ D157 L0 +error(0.0003683424846873538556) D167 D168 ^ D169 D170 +error(0.001760568521934904483) D167 D168 ^ D170 D178 +error(0.01930074729561103916) D167 D175 +error(0.003198153269174034211) D167 D175 ^ D177 D178 +error(0.002916054377451179642) D167 D176 +error(0.0001533501624704119483) D167 D176 ^ D177 D178 +error(0.001387689226253301144) D167 D179 +error(0.001361654870009728442) D167 D179 ^ D170 D178 +error(0.0002413954180492218829) D167 D179 ^ D178 +error(0.01528555969706266171) D167 ^ D169 L0 +error(0.005197254862923379563) D169 D177 ^ D167 +error(0.01150160957505306711) D168 +error(0.01572797635670877131) D168 D171 +error(0.01776891682066950376) D168 D171 ^ D170 +error(0.02146430780874410832) D168 D176 +error(0.002545513591691210033) D168 D176 ^ D178 +error(0.003087650519477554232) D168 D179 +error(0.002632878264712303681) D168 D179 ^ D170 +error(0.003662385158381735884) D168 D179 ^ D178 +error(0.0007333567923765808025) D168 D179 ^ D178 ^ D170 +error(0.00802087827867440685) D169 D170 +error(0.003050964455461190224) D169 D170 ^ D159 +error(0.01239435349828414516) D169 D170 ^ D167 +error(0.0006140138506500330022) D169 D170 ^ D171 +error(0.0004305156496025841473) D169 D170 ^ D171 ^ D159 +error(0.02222565681719517253) D169 D177 +error(0.006119433420034472125) D169 L0 +error(0.0003720004299357881862) D169 L0 ^ D157 L0 ^ D159 +error(0.0005850028327265820735) D169 L0 ^ D157 L0 ^ D167 +error(0.00101586476739196855) D169 L0 ^ D167 ^ D159 +error(0.01000000000000000021) D170 +error(0.005051470923601393027) D170 D177 +error(0.005406777170627218715) D170 D177 ^ D167 +error(0.0004892394202587999107) D170 D177 ^ D179 +error(0.0003299629392860100241) D170 D177 ^ D179 ^ D167 +error(0.02031504564498634591) D170 D178 +error(0.002916556028322587601) D170 D178 ^ D167 +error(0.00181398596792339069) D170 D178 ^ D179 +error(0.0005613420269502157611) D170 ^ D158 ^ D160 +error(0.0003732069945926920094) D170 ^ D158 ^ D168 +error(0.001306645986214824374) D170 ^ D160 +error(0.01161101870635708119) D170 ^ D171 +error(0.001836549728297205133) D170 ^ D179 +error(0.002565690651523450452) D171 D179 ^ D170 +error(0.01015291549911626241) D171 +error(0.02315372726835283196) D171 D179 +error(0.03365936253691785562) D172 +error(0.02010410214714222418) D172 D175 +error(0.0190234604251532588) D172 D175 ^ D173 L0 +error(0.02143138686561935416) D172 ^ D173 L0 +error(0.01022177623348968778) D172 ^ D180 L0 +error(0.00677861594534778962) D173 D180 ^ D172 +error(0.009522359134743458783) D173 D174 +error(0.0003492670094291143923) D173 D174 ^ D172 +error(0.0002554643023317740421) D173 D174 ^ D175 +error(0.01589064219798614133) D173 D174 ^ D176 +error(0.001457568594358075792) D173 D174 ^ D176 ^ D175 +error(0.015482159321486548) D173 D178 +error(0.01092490427813720341) D173 D178 ^ D175 D176 +error(0.02218859445179102718) D173 D180 +error(0.0008208686806592055277) D173 D181 +error(0.00159536049570168227) D173 D181 ^ D175 +error(0.005053287777880170924) D173 D183 +error(0.002818235163933761195) D173 D183 ^ D175 +error(0.00171378268757176066) D173 D183 ^ D175 D176 +error(6.724556295367428835e-05) D173 D183 ^ D176 +error(0.01547706128628605418) D173 L0 +error(0.01512568945270722706) D174 +error(0.003197103784083924708) D174 D180 +error(8.5666183839240112e-05) D174 D180 ^ D172 +error(0.0304090741090486949) D174 D182 +error(0.001933612162630197855) D174 D183 +error(7.169847277654958892e-05) D174 D183 ^ D175 +error(0.003298721617916680615) D174 D183 ^ D176 +error(0.0006883172535039014947) D174 D183 ^ D176 ^ D175 +error(0.01809305181581502553) D174 ^ D176 +error(0.03497502591767125829) D175 +error(0.007592311535506690232) D175 D176 +error(0.0001863698305450992791) D175 D176 ^ D165 L0 +error(0.001800030778882632642) D175 D176 ^ D178 D183 +error(0.003006721011505837475) D175 ^ D173 L0 +error(1.720871039848079589e-08) D175 ^ D176 ^ D178 +error(0.02078543807526065518) D175 ^ D177 L0 +error(0.00150518284471025908) D175 ^ D181 L0 +error(0.005923281952602028368) D177 D181 ^ D175 +error(0.00214132859778433729) D175 ^ D183 +error(0.005387458608439880427) D178 D183 ^ D175 +error(0.04053795481934309441) D176 +error(0.01354262268556232635) D176 D179 +error(0.01961609595191814853) D176 D179 ^ D178 +error(0.0006343451440535921061) D176 ^ D178 +error(0.004923506498465779306) D176 ^ D183 +error(0.002224478828704868402) D176 ^ D183 ^ D178 +error(0.008335508530400652372) D177 D178 +error(0.003050964455461190224) D177 D178 ^ D167 +error(0.01166773263329075501) D177 D178 ^ D175 +error(0.001165550038863457597) D177 D178 ^ D179 +error(0.0004305156496025841473) D177 D178 ^ D179 ^ D167 +error(0.02014318064427965405) D177 D181 +error(0.00519958110465497305) D177 L0 +error(0.0003720004299357881862) D177 L0 ^ D165 L0 ^ D167 +error(0.0005850028327265820735) D177 L0 ^ D165 L0 ^ D175 +error(0.00101586476739196855) D177 L0 ^ D175 ^ D167 +error(0.01033111036928135648) D178 +error(0.004425688452246872434) D178 D181 +error(0.006409073989552083878) D178 D181 ^ D175 +error(0.02215206358785344609) D178 D183 +error(0.0005613420269502157611) D178 ^ D166 ^ D168 +error(0.0003732069945926920094) D178 ^ D166 ^ D176 +error(0.001306645986214824374) D178 ^ D168 +error(0.01248596007307432865) D178 ^ D179 +error(0.03552820412760958335) D179 +error(0.0225209549979621948) D180 D182 +error(0.01170410847805658516) D180 D183 +error(0.03132034353483914568) D180 L0 +error(0.01233234332690999122) D181 D183 +error(0.004781035232189033944) D181 D183 ^ D175 +error(0.02324691068341888309) D181 L0 +error(0.01279955237908447091) D182 +error(0.03145544375731301051) D183 +detector(4, 7, 0) D0 +detector(6, 5, 0) D1 +detector(4, 9, 0) D2 +detector(6, 7, 0) D3 +detector(3, 6, 1) D4 +detector(4, 7, 1) D5 +detector(4, 9, 1) D6 +detector(5, 6, 1) D7 +detector(5, 8, 1) D8 +detector(6, 5, 1) D9 +detector(6, 7, 1) D10 +detector(7, 8, 1) D11 +detector(3, 6, 2) D12 +detector(4, 7, 2) D13 +detector(4, 9, 2) D14 +detector(5, 6, 2) D15 +detector(5, 8, 2) D16 +detector(6, 5, 2) D17 +detector(6, 7, 2) D18 +detector(7, 8, 2) D19 +detector(3, 6, 3) D20 +detector(4, 7, 3) D21 +detector(4, 9, 3) D22 +detector(5, 6, 3) D23 +detector(5, 8, 3) D24 +detector(6, 5, 3) D25 +detector(6, 7, 3) D26 +detector(7, 8, 3) D27 +detector(3, 6, 4) D28 +detector(4, 7, 4) D29 +detector(4, 9, 4) D30 +detector(5, 6, 4) D31 +detector(5, 8, 4) D32 +detector(6, 5, 4) D33 +detector(6, 7, 4) D34 +detector(7, 8, 4) D35 +detector(3, 6, 5) D36 +detector(4, 7, 5) D37 +detector(4, 9, 5) D38 +detector(5, 6, 5) D39 +detector(5, 8, 5) D40 +detector(6, 5, 5) D41 +detector(6, 7, 5) D42 +detector(7, 8, 5) D43 +detector(3, 6, 6) D44 +detector(4, 7, 6) D45 +detector(4, 9, 6) D46 +detector(5, 6, 6) D47 +detector(5, 8, 6) D48 +detector(6, 5, 6) D49 +detector(6, 7, 6) D50 +detector(7, 8, 6) D51 +detector(3, 6, 7) D52 +detector(4, 7, 7) D53 +detector(4, 9, 7) D54 +detector(5, 6, 7) D55 +detector(5, 8, 7) D56 +detector(6, 5, 7) D57 +detector(6, 7, 7) D58 +detector(7, 8, 7) D59 +detector(3, 6, 8) D60 +detector(4, 7, 8) D61 +detector(4, 9, 8) D62 +detector(5, 6, 8) D63 +detector(5, 8, 8) D64 +detector(6, 5, 8) D65 +detector(6, 7, 8) D66 +detector(7, 8, 8) D67 +detector(3, 6, 9) D68 +detector(4, 7, 9) D69 +detector(4, 9, 9) D70 +detector(5, 6, 9) D71 +detector(5, 8, 9) D72 +detector(6, 5, 9) D73 +detector(6, 7, 9) D74 +detector(7, 8, 9) D75 +detector(3, 6, 10) D76 +detector(4, 7, 10) D77 +detector(4, 9, 10) D78 +detector(5, 6, 10) D79 +detector(5, 8, 10) D80 +detector(6, 5, 10) D81 +detector(6, 7, 10) D82 +detector(7, 8, 10) D83 +detector(3, 6, 11) D84 +detector(4, 7, 11) D85 +detector(4, 9, 11) D86 +detector(5, 6, 11) D87 +detector(5, 8, 11) D88 +detector(6, 5, 11) D89 +detector(6, 7, 11) D90 +detector(7, 8, 11) D91 +detector(3, 6, 12) D92 +detector(4, 7, 12) D93 +detector(4, 9, 12) D94 +detector(5, 6, 12) D95 +detector(5, 8, 12) D96 +detector(6, 5, 12) D97 +detector(6, 7, 12) D98 +detector(7, 8, 12) D99 +detector(3, 6, 13) D100 +detector(4, 7, 13) D101 +detector(4, 9, 13) D102 +detector(5, 6, 13) D103 +detector(5, 8, 13) D104 +detector(6, 5, 13) D105 +detector(6, 7, 13) D106 +detector(7, 8, 13) D107 +detector(3, 6, 14) D108 +detector(4, 7, 14) D109 +detector(4, 9, 14) D110 +detector(5, 6, 14) D111 +detector(5, 8, 14) D112 +detector(6, 5, 14) D113 +detector(6, 7, 14) D114 +detector(7, 8, 14) D115 +detector(3, 6, 15) D116 +detector(4, 7, 15) D117 +detector(4, 9, 15) D118 +detector(5, 6, 15) D119 +detector(5, 8, 15) D120 +detector(6, 5, 15) D121 +detector(6, 7, 15) D122 +detector(7, 8, 15) D123 +detector(3, 6, 16) D124 +detector(4, 7, 16) D125 +detector(4, 9, 16) D126 +detector(5, 6, 16) D127 +detector(5, 8, 16) D128 +detector(6, 5, 16) D129 +detector(6, 7, 16) D130 +detector(7, 8, 16) D131 +detector(3, 6, 17) D132 +detector(4, 7, 17) D133 +detector(4, 9, 17) D134 +detector(5, 6, 17) D135 +detector(5, 8, 17) D136 +detector(6, 5, 17) D137 +detector(6, 7, 17) D138 +detector(7, 8, 17) D139 +detector(3, 6, 18) D140 +detector(4, 7, 18) D141 +detector(4, 9, 18) D142 +detector(5, 6, 18) D143 +detector(5, 8, 18) D144 +detector(6, 5, 18) D145 +detector(6, 7, 18) D146 +detector(7, 8, 18) D147 +detector(3, 6, 19) D148 +detector(4, 7, 19) D149 +detector(4, 9, 19) D150 +detector(5, 6, 19) D151 +detector(5, 8, 19) D152 +detector(6, 5, 19) D153 +detector(6, 7, 19) D154 +detector(7, 8, 19) D155 +detector(3, 6, 20) D156 +detector(4, 7, 20) D157 +detector(4, 9, 20) D158 +detector(5, 6, 20) D159 +detector(5, 8, 20) D160 +detector(6, 5, 20) D161 +detector(6, 7, 20) D162 +detector(7, 8, 20) D163 +detector(3, 6, 21) D164 +detector(4, 7, 21) D165 +detector(4, 9, 21) D166 +detector(5, 6, 21) D167 +detector(5, 8, 21) D168 +detector(6, 5, 21) D169 +detector(6, 7, 21) D170 +detector(7, 8, 21) D171 +detector(3, 6, 22) D172 +detector(4, 7, 22) D173 +detector(4, 9, 22) D174 +detector(5, 6, 22) D175 +detector(5, 8, 22) D176 +detector(6, 5, 22) D177 +detector(6, 7, 22) D178 +detector(7, 8, 22) D179 +detector(4, 7, 23) D180 +detector(6, 5, 23) D181 +detector(4, 9, 23) D182 +detector(6, 7, 23) D183 diff --git a/shared/package-files/33/332288615a542442c1306223657cfe72a25c1a86204933385049efc483bd6b70/blob b/shared/package-files/33/332288615a542442c1306223657cfe72a25c1a86204933385049efc483bd6b70/blob new file mode 100644 index 0000000000000000000000000000000000000000..3b5591a6a8d13389a15f1925ed47c95ece86e304 --- /dev/null +++ b/shared/package-files/33/332288615a542442c1306223657cfe72a25c1a86204933385049efc483bd6b70/blob @@ -0,0 +1,516 @@ +from abc import ABCMeta, abstractmethod +from typing import Dict as ptDict, Type as ptType +import itertools +import weakref +from functools import cached_property + +import numpy as np + +from numba.core.utils import get_hashable_key + +# Types are added to a global registry (_typecache) in order to assign +# them unique integer codes for fast matching in _dispatcher.c. +# However, we also want types to be disposable, therefore we ensure +# each type is interned as a weak reference, so that it lives only as +# long as necessary to keep a stable type code. +# NOTE: some types can still be made immortal elsewhere (for example +# in _dispatcher.c's internal caches). +_typecodes = itertools.count() + +def _autoincr(): + n = next(_typecodes) + # 4 billion types should be enough, right? + assert n < 2 ** 32, "Limited to 4 billion types" + return n + +_typecache: ptDict[weakref.ref, weakref.ref] = {} + +def _on_type_disposal(wr, _pop=_typecache.pop): + _pop(wr, None) + + +class _TypeMetaclass(ABCMeta): + """ + A metaclass that will intern instances after they are created. + This is done by first creating a new instance (including calling + __init__, which sets up the required attributes for equality + and hashing), then looking it up in the _typecache registry. + """ + + def __init__(cls, name, bases, orig_vars): + # __init__ is hooked to mark whether a Type class being defined is a + # Numba internal type (one which is defined somewhere under the `numba` + # module) or an external type (one which is defined elsewhere, for + # example a user defined type). + super(_TypeMetaclass, cls).__init__(name, bases, orig_vars) + root = (cls.__module__.split('.'))[0] + cls._is_internal = root == "numba" + + def _intern(cls, inst): + # Try to intern the created instance + wr = weakref.ref(inst, _on_type_disposal) + orig = _typecache.get(wr) + orig = orig and orig() + if orig is not None: + return orig + else: + inst._code = _autoincr() + _typecache[wr] = wr + return inst + + def __call__(cls, *args, **kwargs): + """ + Instantiate *cls* (a Type subclass, presumably) and intern it. + If an interned instance already exists, it is returned, otherwise + the new instance is returned. + """ + inst = type.__call__(cls, *args, **kwargs) + return cls._intern(inst) + + +def _type_reconstructor(reconstructor, reconstructor_args, state): + """ + Rebuild function for unpickling types. + """ + obj = reconstructor(*reconstructor_args) + if state: + obj.__dict__.update(state) + return type(obj)._intern(obj) + + +class Type(metaclass=_TypeMetaclass): + """ + The base class for all Numba types. + It is essential that proper equality comparison is implemented. The + default implementation uses the "key" property (overridable in subclasses) + for both comparison and hashing, to ensure sane behaviour. + """ + + mutable = False + # Rather the type is reflected at the python<->nopython boundary + reflected = False + + def __init__(self, name): + self.name = name + + @property + def key(self): + """ + A property used for __eq__, __ne__ and __hash__. Can be overridden + in subclasses. + """ + return self.name + + @property + def mangling_args(self): + """ + Returns `(basename, args)` where `basename` is the name of the type + and `args` is a sequence of parameters of the type. + + Subclass should override to specialize the behavior. + By default, this returns `(self.name, ())`. + """ + return self.name, () + + def __repr__(self): + return self.name + + def __str__(self): + return self.name + + def __hash__(self): + return hash(self.key) + + def __eq__(self, other): + return self.__class__ is other.__class__ and self.key == other.key + + def __ne__(self, other): + return not (self == other) + + def __reduce__(self): + reconstructor, args, state = super(Type, self).__reduce__() + return (_type_reconstructor, (reconstructor, args, state)) + + def unify(self, typingctx, other): + """ + Try to unify this type with the *other*. A third type must + be returned, or None if unification is not possible. + Only override this if the coercion logic cannot be expressed + as simple casting rules. + """ + return None + + def can_convert_to(self, typingctx, other): + """ + Check whether this type can be converted to the *other*. + If successful, must return a string describing the conversion, e.g. + "exact", "promote", "unsafe", "safe"; otherwise None is returned. + """ + return None + + def can_convert_from(self, typingctx, other): + """ + Similar to *can_convert_to*, but in reverse. Only needed if + the type provides conversion from other types. + """ + return None + + def is_precise(self): + """ + Whether this type is precise, i.e. can be part of a successful + type inference. Default implementation returns True. + """ + return True + + def augment(self, other): + """ + Augment this type with the *other*. Return the augmented type, + or None if not supported. + """ + return None + + # User-facing helpers. These are not part of the core Type API but + # are provided so that users can write e.g. `numba.boolean(1.5)` + # (returns True) or `types.int32(types.int32[:])` (returns something + # usable as a function signature). + + def __call__(self, *args): + from numba.core.typing import signature + if len(args) == 1 and not isinstance(args[0], Type): + return self.cast_python_value(args[0]) + return signature(self, # return_type + *args) + + def __getitem__(self, args, /): + """ + Return an array of this type. + """ + from numba.core.types import Array + ndim, layout = self._determine_array_spec(args) + return Array(dtype=self, ndim=ndim, layout=layout) + + def _determine_array_spec(self, args): + # XXX non-contiguous by default, even for 1d arrays, + # doesn't sound very intuitive + def validate_slice(s): + return isinstance(s, slice) and s.start is None and s.stop is None + + if isinstance(args, (tuple, list)) and all(map(validate_slice, args)): + ndim = len(args) + if args[0].step == 1: + layout = 'F' + elif args[-1].step == 1: + layout = 'C' + else: + layout = 'A' + elif validate_slice(args): + ndim = 1 + if args.step == 1: + layout = 'C' + else: + layout = 'A' + else: + # Raise a KeyError to not be handled by collection constructors (e.g. list). + raise KeyError(f"Can only index numba types with slices with no start or stop, got {args}.") + + return ndim, layout + + def cast_python_value(self, args, /): + raise NotImplementedError + + + @property + def is_internal(self): + """ Returns True if this class is an internally defined Numba type by + virtue of the module in which it is instantiated, False else.""" + return self._is_internal + + def dump(self, tab=''): + print(f'{tab}DUMP {type(self).__name__}[code={self._code}, name={self.name}]') + +# XXX we should distinguish between Dummy (no meaningful +# representation, e.g. None or a builtin function) and Opaque (has a +# meaningful representation, e.g. ExternalFunctionPointer) + +class Dummy(Type): + """ + Base class for types that do not really have a representation and are + compatible with a void*. + """ + + +class Hashable(Type): + """ + Base class for hashable types. + """ + + +class Number(Hashable): + """ + Base class for number types. + """ + + def unify(self, typingctx, other): + """ + Unify the two number types using Numpy's rules. + """ + from numba.np import numpy_support + if isinstance(other, Number): + # XXX: this can produce unsafe conversions, + # e.g. would unify {int64, uint64} to float64 + a = numpy_support.as_dtype(self) + b = numpy_support.as_dtype(other) + sel = np.promote_types(a, b) + return numpy_support.from_dtype(sel) + + +class Callable(Type): + """ + Base class for callables. + """ + + @abstractmethod + def get_call_type(self, context, args, kws): + """ + Using the typing *context*, resolve the callable's signature for + the given arguments. A signature object is returned, or None. + """ + + @abstractmethod + def get_call_signatures(self): + """ + Returns a tuple of (list of signatures, parameterized) + """ + + @abstractmethod + def get_impl_key(self, sig): + """ + Returns the impl key for the given signature + """ + + +class DTypeSpec(Type): + """ + Base class for types usable as "dtype" arguments to various Numpy APIs + (e.g. np.empty()). + """ + + @property + @abstractmethod + def dtype(self): + """ + The actual dtype denoted by this dtype spec (a Type instance). + """ + + +class IterableType(Type): + """ + Base class for iterable types. + """ + + @property + @abstractmethod + def iterator_type(self): + """ + The iterator type obtained when calling iter() (explicitly or implicitly). + """ + + +class Sized(Type): + """ + Base class for objects that support len() + """ + + +class ConstSized(Sized): + """ + For types that have a constant size + """ + @abstractmethod + def __len__(self): + pass + + +class IteratorType(IterableType): + """ + Base class for all iterator types. + Derived classes should implement the *yield_type* attribute. + """ + + def __init__(self, name, **kwargs): + super(IteratorType, self).__init__(name, **kwargs) + + @property + @abstractmethod + def yield_type(self): + """ + The type of values yielded by the iterator. + """ + + # This is a property to avoid recursivity (for pickling) + + @property + def iterator_type(self): + return self + + +class Container(Sized, IterableType): + """ + Base class for container types. + """ + + +class Sequence(Container): + """ + Base class for 1d sequence types. Instances should have the *dtype* + attribute. + """ + + +class MutableSequence(Sequence): + """ + Base class for 1d mutable sequence types. Instances should have the + *dtype* attribute. + """ + + mutable = True + +class ArrayCompatible(Type): + """ + Type class for Numpy array-compatible objects (typically, objects + exposing an __array__ method). + Derived classes should implement the *as_array* attribute. + """ + # If overridden by a subclass, it should also implement typing + # for '__array_wrap__' with arguments (input, formal result). + array_priority = 0.0 + + @property + @abstractmethod + def as_array(self): + """ + The equivalent array type, for operations supporting array-compatible + objects (such as ufuncs). + """ + + # For compatibility with types.Array + + @cached_property + def ndim(self): + return self.as_array.ndim + + @cached_property + def layout(self): + return self.as_array.layout + + @cached_property + def dtype(self): + return self.as_array.dtype + + +class Literal(Type): + """Base class for Literal types. + Literal types contain the original Python value in the type. + + A literal type should always be constructed from the `literal(val)` + function. + """ + + # *ctor_map* is a dictionary mapping Python types to Literal subclasses + # for constructing a numba type for a given Python type. + # It is used in `literal(val)` function. + # To add new Literal subclass, register a new mapping to this dict. + ctor_map: ptDict[type, ptType['Literal']] = {} + + # *_literal_type_cache* is used to cache the numba type of the given value. + _literal_type_cache = None + + def __init__(self, value): + if type(self) is Literal: + raise TypeError( + "Cannot be constructed directly. " + "Use `numba.types.literal(value)` instead", + ) + self._literal_init(value) + fmt = "Literal[{}]({})" + super(Literal, self).__init__(fmt.format(type(value).__name__, value)) + + def _literal_init(self, value): + self._literal_value = value + # We want to support constants of non-hashable values, therefore + # fall back on the value's id() if necessary. + self._key = get_hashable_key(value) + + @property + def literal_value(self): + return self._literal_value + + @property + def literal_type(self): + if self._literal_type_cache is None: + from numba.core import typing + ctx = typing.Context() + try: + res = ctx.resolve_value_type(self.literal_value) + except ValueError as e: + + if "Int value is too large" in str(e): + # If a string literal cannot create an IntegerLiteral + # because of overflow we generate this message. + msg = f"Cannot create literal type. {str(e)}" + raise TypeError(msg) + # Not all literal types have a literal_value that can be + # resolved to a type, for example, LiteralStrKeyDict has a + # literal_value that is a python dict for which there's no + # `typeof` support. + msg = "{} has no attribute 'literal_type'".format(self) + raise AttributeError(msg) + self._literal_type_cache = res + + return self._literal_type_cache + + + +class TypeRef(Dummy): + """Reference to a type. + + Used when a type is passed as a value. + """ + def __init__(self, instance_type): + self.instance_type = instance_type + super(TypeRef, self).__init__('typeref[{}]'.format(self.instance_type)) + + @property + def key(self): + return self.instance_type + + +class InitialValue(object): + """ + Used as a mixin for a type will potentially have an initial value that will + be carried in the .initial_value attribute. + """ + def __init__(self, initial_value): + self._initial_value = initial_value + + @property + def initial_value(self): + return self._initial_value + + +class Poison(Type): + """ + This is the "bottom" type in the type system. It won't unify and it's + unliteral version is Poison of itself. It's advisable for debugging purposes + to call the constructor with the type that's being poisoned (for whatever + reason) but this isn't strictly required. + """ + def __init__(self, ty): + self.ty = ty + super(Poison, self).__init__(name="Poison<%s>" % ty) + + def __unliteral__(self): + return Poison(self) + + def unify(self, typingctx, other): + return None diff --git a/shared/package-files/33/3328083ba04a22cc3e487194398ac0684af6f903c1c40ef827e71e91b324c224/blob b/shared/package-files/33/3328083ba04a22cc3e487194398ac0684af6f903c1c40ef827e71e91b324c224/blob new file mode 100644 index 0000000000000000000000000000000000000000..2add648340654ab66e33c3e5775ee3e6a080966b --- /dev/null +++ b/shared/package-files/33/3328083ba04a22cc3e487194398ac0684af6f903c1c40ef827e71e91b324c224/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API at::Tensor scatter_reduce(const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self=true); +TORCH_API at::Tensor & scatter_reduce_out(at::Tensor & out, const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self=true); +TORCH_API at::Tensor & scatter_reduce_outf(const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self, at::Tensor & out); +TORCH_API at::Tensor & scatter_reduce_(at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self=true); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/33/3328cb027cca61175005fa1fd56de4fe17f7d0cbea3a4a8bfff1b6da6439c70c/blob b/shared/package-files/33/3328cb027cca61175005fa1fd56de4fe17f7d0cbea3a4a8bfff1b6da6439c70c/blob new file mode 100644 index 0000000000000000000000000000000000000000..6b98e8d35f1e257f797d51f51b60fd4f11562e06 --- /dev/null +++ b/shared/package-files/33/3328cb027cca61175005fa1fd56de4fe17f7d0cbea3a4a8bfff1b6da6439c70c/blob @@ -0,0 +1,222 @@ +StartFontMetrics 2.0 +Comment Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights reserved. +Comment Creation Date: Fri Dec 1 12:57:42 1989 +Comment UniqueID 26200 +Comment VMusage 39281 49041 +FontName ZapfDingbats +FullName ITC Zapf Dingbats +FamilyName ITC Zapf Dingbats +Weight Medium +ItalicAngle 0 +IsFixedPitch false +FontBBox -1 -143 981 820 +UnderlinePosition -98 +UnderlineThickness 54 +Version 001.004 +Notice Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights reserved.ITC Zapf Dingbats is a registered trademark of International Typeface Corporation. +EncodingScheme FontSpecific +StartCharMetrics 202 +C 32 ; WX 278 ; N space ; B 0 0 0 0 ; +C 33 ; WX 974 ; N a1 ; B 35 72 939 621 ; +C 34 ; WX 961 ; N a2 ; B 35 81 927 611 ; +C 35 ; WX 974 ; N a202 ; B 35 72 939 621 ; +C 36 ; WX 980 ; N a3 ; B 35 0 945 692 ; +C 37 ; WX 719 ; N a4 ; B 34 139 685 566 ; +C 38 ; WX 789 ; N a5 ; B 35 -14 755 705 ; +C 39 ; WX 790 ; N a119 ; B 35 -14 755 705 ; +C 40 ; WX 791 ; N a118 ; B 35 -13 761 705 ; +C 41 ; WX 690 ; N a117 ; B 35 138 655 553 ; +C 42 ; WX 960 ; N a11 ; B 35 123 925 568 ; +C 43 ; WX 939 ; N a12 ; B 35 134 904 559 ; +C 44 ; WX 549 ; N a13 ; B 29 -11 516 705 ; +C 45 ; WX 855 ; N a14 ; B 34 59 820 632 ; +C 46 ; WX 911 ; N a15 ; B 35 50 876 642 ; +C 47 ; WX 933 ; N a16 ; B 35 139 899 550 ; +C 48 ; WX 911 ; N a105 ; B 35 50 876 642 ; +C 49 ; WX 945 ; N a17 ; B 35 139 909 553 ; +C 50 ; WX 974 ; N a18 ; B 35 104 938 587 ; +C 51 ; WX 755 ; N a19 ; B 34 -13 721 705 ; +C 52 ; WX 846 ; N a20 ; B 36 -14 811 705 ; +C 53 ; WX 762 ; N a21 ; B 35 0 727 692 ; +C 54 ; WX 761 ; N a22 ; B 35 0 727 692 ; +C 55 ; WX 571 ; N a23 ; B -1 -68 571 661 ; +C 56 ; WX 677 ; N a24 ; B 36 -13 642 705 ; +C 57 ; WX 763 ; N a25 ; B 35 0 728 692 ; +C 58 ; WX 760 ; N a26 ; B 35 0 726 692 ; +C 59 ; WX 759 ; N a27 ; B 35 0 725 692 ; +C 60 ; WX 754 ; N a28 ; B 35 0 720 692 ; +C 61 ; WX 494 ; N a6 ; B 35 0 460 692 ; +C 62 ; WX 552 ; N a7 ; B 35 0 517 692 ; +C 63 ; WX 537 ; N a8 ; B 35 0 503 692 ; +C 64 ; WX 577 ; N a9 ; B 35 96 542 596 ; +C 65 ; WX 692 ; N a10 ; B 35 -14 657 705 ; +C 66 ; WX 786 ; N a29 ; B 35 -14 751 705 ; +C 67 ; WX 788 ; N a30 ; B 35 -14 752 705 ; +C 68 ; WX 788 ; N a31 ; B 35 -14 753 705 ; +C 69 ; WX 790 ; N a32 ; B 35 -14 756 705 ; +C 70 ; WX 793 ; N a33 ; B 35 -13 759 705 ; +C 71 ; WX 794 ; N a34 ; B 35 -13 759 705 ; +C 72 ; WX 816 ; N a35 ; B 35 -14 782 705 ; +C 73 ; WX 823 ; N a36 ; B 35 -14 787 705 ; +C 74 ; WX 789 ; N a37 ; B 35 -14 754 705 ; +C 75 ; WX 841 ; N a38 ; B 35 -14 807 705 ; +C 76 ; WX 823 ; N a39 ; B 35 -14 789 705 ; +C 77 ; WX 833 ; N a40 ; B 35 -14 798 705 ; +C 78 ; WX 816 ; N a41 ; B 35 -13 782 705 ; +C 79 ; WX 831 ; N a42 ; B 35 -14 796 705 ; +C 80 ; WX 923 ; N a43 ; B 35 -14 888 705 ; +C 81 ; WX 744 ; N a44 ; B 35 0 710 692 ; +C 82 ; WX 723 ; N a45 ; B 35 0 688 692 ; +C 83 ; WX 749 ; N a46 ; B 35 0 714 692 ; +C 84 ; WX 790 ; N a47 ; B 34 -14 756 705 ; +C 85 ; WX 792 ; N a48 ; B 35 -14 758 705 ; +C 86 ; WX 695 ; N a49 ; B 35 -14 661 706 ; +C 87 ; WX 776 ; N a50 ; B 35 -6 741 699 ; +C 88 ; WX 768 ; N a51 ; B 35 -7 734 699 ; +C 89 ; WX 792 ; N a52 ; B 35 -14 757 705 ; +C 90 ; WX 759 ; N a53 ; B 35 0 725 692 ; +C 91 ; WX 707 ; N a54 ; B 35 -13 672 704 ; +C 92 ; WX 708 ; N a55 ; B 35 -14 672 705 ; +C 93 ; WX 682 ; N a56 ; B 35 -14 647 705 ; +C 94 ; WX 701 ; N a57 ; B 35 -14 666 705 ; +C 95 ; WX 826 ; N a58 ; B 35 -14 791 705 ; +C 96 ; WX 815 ; N a59 ; B 35 -14 780 705 ; +C 97 ; WX 789 ; N a60 ; B 35 -14 754 705 ; +C 98 ; WX 789 ; N a61 ; B 35 -14 754 705 ; +C 99 ; WX 707 ; N a62 ; B 34 -14 673 705 ; +C 100 ; WX 687 ; N a63 ; B 36 0 651 692 ; +C 101 ; WX 696 ; N a64 ; B 35 0 661 691 ; +C 102 ; WX 689 ; N a65 ; B 35 0 655 692 ; +C 103 ; WX 786 ; N a66 ; B 34 -14 751 705 ; +C 104 ; WX 787 ; N a67 ; B 35 -14 752 705 ; +C 105 ; WX 713 ; N a68 ; B 35 -14 678 705 ; +C 106 ; WX 791 ; N a69 ; B 35 -14 756 705 ; +C 107 ; WX 785 ; N a70 ; B 36 -14 751 705 ; +C 108 ; WX 791 ; N a71 ; B 35 -14 757 705 ; +C 109 ; WX 873 ; N a72 ; B 35 -14 838 705 ; +C 110 ; WX 761 ; N a73 ; B 35 0 726 692 ; +C 111 ; WX 762 ; N a74 ; B 35 0 727 692 ; +C 112 ; WX 762 ; N a203 ; B 35 0 727 692 ; +C 113 ; WX 759 ; N a75 ; B 35 0 725 692 ; +C 114 ; WX 759 ; N a204 ; B 35 0 725 692 ; +C 115 ; WX 892 ; N a76 ; B 35 0 858 705 ; +C 116 ; WX 892 ; N a77 ; B 35 -14 858 692 ; +C 117 ; WX 788 ; N a78 ; B 35 -14 754 705 ; +C 118 ; WX 784 ; N a79 ; B 35 -14 749 705 ; +C 119 ; WX 438 ; N a81 ; B 35 -14 403 705 ; +C 120 ; WX 138 ; N a82 ; B 35 0 104 692 ; +C 121 ; WX 277 ; N a83 ; B 35 0 242 692 ; +C 122 ; WX 415 ; N a84 ; B 35 0 380 692 ; +C 123 ; WX 392 ; N a97 ; B 35 263 357 705 ; +C 124 ; WX 392 ; N a98 ; B 34 263 357 705 ; +C 125 ; WX 668 ; N a99 ; B 35 263 633 705 ; +C 126 ; WX 668 ; N a100 ; B 36 263 634 705 ; +C 161 ; WX 732 ; N a101 ; B 35 -143 697 806 ; +C 162 ; WX 544 ; N a102 ; B 56 -14 488 706 ; +C 163 ; WX 544 ; N a103 ; B 34 -14 508 705 ; +C 164 ; WX 910 ; N a104 ; B 35 40 875 651 ; +C 165 ; WX 667 ; N a106 ; B 35 -14 633 705 ; +C 166 ; WX 760 ; N a107 ; B 35 -14 726 705 ; +C 167 ; WX 760 ; N a108 ; B 0 121 758 569 ; +C 168 ; WX 776 ; N a112 ; B 35 0 741 705 ; +C 169 ; WX 595 ; N a111 ; B 34 -14 560 705 ; +C 170 ; WX 694 ; N a110 ; B 35 -14 659 705 ; +C 171 ; WX 626 ; N a109 ; B 34 0 591 705 ; +C 172 ; WX 788 ; N a120 ; B 35 -14 754 705 ; +C 173 ; WX 788 ; N a121 ; B 35 -14 754 705 ; +C 174 ; WX 788 ; N a122 ; B 35 -14 754 705 ; +C 175 ; WX 788 ; N a123 ; B 35 -14 754 705 ; +C 176 ; WX 788 ; N a124 ; B 35 -14 754 705 ; +C 177 ; WX 788 ; N a125 ; B 35 -14 754 705 ; +C 178 ; WX 788 ; N a126 ; B 35 -14 754 705 ; +C 179 ; WX 788 ; N a127 ; B 35 -14 754 705 ; +C 180 ; WX 788 ; N a128 ; B 35 -14 754 705 ; +C 181 ; WX 788 ; N a129 ; B 35 -14 754 705 ; +C 182 ; WX 788 ; N a130 ; B 35 -14 754 705 ; +C 183 ; WX 788 ; N a131 ; B 35 -14 754 705 ; +C 184 ; WX 788 ; N a132 ; B 35 -14 754 705 ; +C 185 ; WX 788 ; N a133 ; B 35 -14 754 705 ; +C 186 ; WX 788 ; N a134 ; B 35 -14 754 705 ; +C 187 ; WX 788 ; N a135 ; B 35 -14 754 705 ; +C 188 ; WX 788 ; N a136 ; B 35 -14 754 705 ; +C 189 ; WX 788 ; N a137 ; B 35 -14 754 705 ; +C 190 ; WX 788 ; N a138 ; B 35 -14 754 705 ; +C 191 ; WX 788 ; N a139 ; B 35 -14 754 705 ; +C 192 ; WX 788 ; N a140 ; B 35 -14 754 705 ; +C 193 ; WX 788 ; N a141 ; B 35 -14 754 705 ; +C 194 ; WX 788 ; N a142 ; B 35 -14 754 705 ; +C 195 ; WX 788 ; N a143 ; B 35 -14 754 705 ; +C 196 ; WX 788 ; N a144 ; B 35 -14 754 705 ; +C 197 ; WX 788 ; N a145 ; B 35 -14 754 705 ; +C 198 ; WX 788 ; N a146 ; B 35 -14 754 705 ; +C 199 ; WX 788 ; N a147 ; B 35 -14 754 705 ; +C 200 ; WX 788 ; N a148 ; B 35 -14 754 705 ; +C 201 ; WX 788 ; N a149 ; B 35 -14 754 705 ; +C 202 ; WX 788 ; N a150 ; B 35 -14 754 705 ; +C 203 ; WX 788 ; N a151 ; B 35 -14 754 705 ; +C 204 ; WX 788 ; N a152 ; B 35 -14 754 705 ; +C 205 ; WX 788 ; N a153 ; B 35 -14 754 705 ; +C 206 ; WX 788 ; N a154 ; B 35 -14 754 705 ; +C 207 ; WX 788 ; N a155 ; B 35 -14 754 705 ; +C 208 ; WX 788 ; N a156 ; B 35 -14 754 705 ; +C 209 ; WX 788 ; N a157 ; B 35 -14 754 705 ; +C 210 ; WX 788 ; N a158 ; B 35 -14 754 705 ; +C 211 ; WX 788 ; N a159 ; B 35 -14 754 705 ; +C 212 ; WX 894 ; N a160 ; B 35 58 860 634 ; +C 213 ; WX 838 ; N a161 ; B 35 152 803 540 ; +C 214 ; WX 1016 ; N a163 ; B 34 152 981 540 ; +C 215 ; WX 458 ; N a164 ; B 35 -127 422 820 ; +C 216 ; WX 748 ; N a196 ; B 35 94 698 597 ; +C 217 ; WX 924 ; N a165 ; B 35 140 890 552 ; +C 218 ; WX 748 ; N a192 ; B 35 94 698 597 ; +C 219 ; WX 918 ; N a166 ; B 35 166 884 526 ; +C 220 ; WX 927 ; N a167 ; B 35 32 892 660 ; +C 221 ; WX 928 ; N a168 ; B 35 129 891 562 ; +C 222 ; WX 928 ; N a169 ; B 35 128 893 563 ; +C 223 ; WX 834 ; N a170 ; B 35 155 799 537 ; +C 224 ; WX 873 ; N a171 ; B 35 93 838 599 ; +C 225 ; WX 828 ; N a172 ; B 35 104 791 588 ; +C 226 ; WX 924 ; N a173 ; B 35 98 889 594 ; +C 227 ; WX 924 ; N a162 ; B 35 98 889 594 ; +C 228 ; WX 917 ; N a174 ; B 35 0 882 692 ; +C 229 ; WX 930 ; N a175 ; B 35 84 896 608 ; +C 230 ; WX 931 ; N a176 ; B 35 84 896 608 ; +C 231 ; WX 463 ; N a177 ; B 35 -99 429 791 ; +C 232 ; WX 883 ; N a178 ; B 35 71 848 623 ; +C 233 ; WX 836 ; N a179 ; B 35 44 802 648 ; +C 234 ; WX 836 ; N a193 ; B 35 44 802 648 ; +C 235 ; WX 867 ; N a180 ; B 35 101 832 591 ; +C 236 ; WX 867 ; N a199 ; B 35 101 832 591 ; +C 237 ; WX 696 ; N a181 ; B 35 44 661 648 ; +C 238 ; WX 696 ; N a200 ; B 35 44 661 648 ; +C 239 ; WX 874 ; N a182 ; B 35 77 840 619 ; +C 241 ; WX 874 ; N a201 ; B 35 73 840 615 ; +C 242 ; WX 760 ; N a183 ; B 35 0 725 692 ; +C 243 ; WX 946 ; N a184 ; B 35 160 911 533 ; +C 244 ; WX 771 ; N a197 ; B 34 37 736 655 ; +C 245 ; WX 865 ; N a185 ; B 35 207 830 481 ; +C 246 ; WX 771 ; N a194 ; B 34 37 736 655 ; +C 247 ; WX 888 ; N a198 ; B 34 -19 853 712 ; +C 248 ; WX 967 ; N a186 ; B 35 124 932 568 ; +C 249 ; WX 888 ; N a195 ; B 34 -19 853 712 ; +C 250 ; WX 831 ; N a187 ; B 35 113 796 579 ; +C 251 ; WX 873 ; N a188 ; B 36 118 838 578 ; +C 252 ; WX 927 ; N a189 ; B 35 150 891 542 ; +C 253 ; WX 970 ; N a190 ; B 35 76 931 616 ; +C 254 ; WX 918 ; N a191 ; B 34 99 884 593 ; +C -1 ; WX 410 ; N a86 ; B 35 0 375 692 ; +C -1 ; WX 509 ; N a85 ; B 35 0 475 692 ; +C -1 ; WX 334 ; N a95 ; B 35 0 299 692 ; +C -1 ; WX 509 ; N a205 ; B 35 0 475 692 ; +C -1 ; WX 390 ; N a89 ; B 35 -14 356 705 ; +C -1 ; WX 234 ; N a87 ; B 35 -14 199 705 ; +C -1 ; WX 276 ; N a91 ; B 35 0 242 692 ; +C -1 ; WX 390 ; N a90 ; B 35 -14 355 705 ; +C -1 ; WX 410 ; N a206 ; B 35 0 375 692 ; +C -1 ; WX 317 ; N a94 ; B 35 0 283 692 ; +C -1 ; WX 317 ; N a93 ; B 35 0 283 692 ; +C -1 ; WX 276 ; N a92 ; B 35 0 242 692 ; +C -1 ; WX 334 ; N a96 ; B 35 0 299 692 ; +C -1 ; WX 234 ; N a88 ; B 35 -14 199 705 ; +EndCharMetrics +EndFontMetrics diff --git a/shared/package-files/33/33293b3dd4ae5a2346be22cdad57f7f288da5dd40d34f36ababe8c84cf320264/blob b/shared/package-files/33/33293b3dd4ae5a2346be22cdad57f7f288da5dd40d34f36ababe8c84cf320264/blob new file mode 100644 index 0000000000000000000000000000000000000000..eabea23f7fbae46c2a291dae90c52067dbdc1e85 --- /dev/null +++ b/shared/package-files/33/33293b3dd4ae5a2346be22cdad57f7f288da5dd40d34f36ababe8c84cf320264/blob @@ -0,0 +1,1303 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeMetaFunctions.h + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace at { + +namespace meta { + + + +} // namespace meta +} // namespace at diff --git a/shared/package-files/33/332a9f4d6e7755c6d1ccec4271e9030f60ac334ae014fddfb6a7c54c3d46373d/blob b/shared/package-files/33/332a9f4d6e7755c6d1ccec4271e9030f60ac334ae014fddfb6a7c54c3d46373d/blob new file mode 100644 index 0000000000000000000000000000000000000000..f117751c9295d070d393fcd386a766ed93563650 --- /dev/null +++ b/shared/package-files/33/332a9f4d6e7755c6d1ccec4271e9030f60ac334ae014fddfb6a7c54c3d46373d/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:332a9f4d6e7755c6d1ccec4271e9030f60ac334ae014fddfb6a7c54c3d46373d +size 320624 diff --git a/shared/package-files/33/332cbd2657d64c9dbd27c3b28aafaea6a6a0f957ec3c78378ecbaaec71d4f621/blob b/shared/package-files/33/332cbd2657d64c9dbd27c3b28aafaea6a6a0f957ec3c78378ecbaaec71d4f621/blob new file mode 100644 index 0000000000000000000000000000000000000000..20f65556c733fb41dafe3f93b175dfd31dca7dcb --- /dev/null +++ b/shared/package-files/33/332cbd2657d64c9dbd27c3b28aafaea6a6a0f957ec3c78378ecbaaec71d4f621/blob @@ -0,0 +1,24 @@ +from typing import Any, Tuple, Union + +BASE2_ALPHABET: str +BASE16_ALPHABET: str +BASE56_ALPHABET: str +BASE36_ALPHABET: str +BASE62_ALPHABET: str +BASE64_ALPHABET: Any + +class BaseConverter: + decimal_digits: str = ... + sign: str = ... + digits: str = ... + def __init__(self, digits: str, sign: str = ...) -> None: ... + def encode(self, i: int) -> str: ... + def decode(self, s: str) -> int: ... + def convert(self, number: Union[int, str], from_digits: str, to_digits: str, sign: str) -> Tuple[int, str]: ... + +base2: Any +base16: Any +base36: Any +base56: Any +base62: Any +base64: Any diff --git a/shared/package-files/33/332cea5d4b963f5f8181b6c207327220b892fe389c64ed8b3543148efeef861d/blob b/shared/package-files/33/332cea5d4b963f5f8181b6c207327220b892fe389c64ed8b3543148efeef861d/blob new file mode 100644 index 0000000000000000000000000000000000000000..976a3ba242e3e9f94e4f6fd07de8a29f837e580d --- /dev/null +++ b/shared/package-files/33/332cea5d4b963f5f8181b6c207327220b892fe389c64ed8b3543148efeef861d/blob @@ -0,0 +1,91 @@ +""" +Scope definition and related utilities. + +Those are defined here, instead of in the 'fixtures' module because +their use is spread across many other pytest modules, and centralizing it in 'fixtures' +would cause circular references. + +Also this makes the module light to import, as it should. +""" + +from __future__ import annotations + +from enum import Enum +from functools import total_ordering +from typing import Literal + + +_ScopeName = Literal["session", "package", "module", "class", "function"] + + +@total_ordering +class Scope(Enum): + """ + Represents one of the possible fixture scopes in pytest. + + Scopes are ordered from lower to higher, that is: + + ->>> higher ->>> + + Function < Class < Module < Package < Session + + <<<- lower <<<- + """ + + # Scopes need to be listed from lower to higher. + Function: _ScopeName = "function" + Class: _ScopeName = "class" + Module: _ScopeName = "module" + Package: _ScopeName = "package" + Session: _ScopeName = "session" + + def next_lower(self) -> Scope: + """Return the next lower scope.""" + index = _SCOPE_INDICES[self] + if index == 0: + raise ValueError(f"{self} is the lower-most scope") + return _ALL_SCOPES[index - 1] + + def next_higher(self) -> Scope: + """Return the next higher scope.""" + index = _SCOPE_INDICES[self] + if index == len(_SCOPE_INDICES) - 1: + raise ValueError(f"{self} is the upper-most scope") + return _ALL_SCOPES[index + 1] + + def __lt__(self, other: Scope) -> bool: + self_index = _SCOPE_INDICES[self] + other_index = _SCOPE_INDICES[other] + return self_index < other_index + + @classmethod + def from_user( + cls, scope_name: _ScopeName, descr: str, where: str | None = None + ) -> Scope: + """ + Given a scope name from the user, return the equivalent Scope enum. Should be used + whenever we want to convert a user provided scope name to its enum object. + + If the scope name is invalid, construct a user friendly message and call pytest.fail. + """ + from _pytest.outcomes import fail + + try: + # Holding this reference is necessary for mypy at the moment. + scope = Scope(scope_name) + except ValueError: + fail( + "{} {}got an unexpected scope value '{}'".format( + descr, f"from {where} " if where else "", scope_name + ), + pytrace=False, + ) + return scope + + +_ALL_SCOPES = list(Scope) +_SCOPE_INDICES = {scope: index for index, scope in enumerate(_ALL_SCOPES)} + + +# Ordered list of scopes which can contain many tests (in practice all except Function). +HIGH_SCOPES = [x for x in Scope if x is not Scope.Function] diff --git a/shared/package-files/33/332e5db8799453cbb47dadc745a0693bfb78cb9b190bc01ec503b8981ea82623/blob b/shared/package-files/33/332e5db8799453cbb47dadc745a0693bfb78cb9b190bc01ec503b8981ea82623/blob new file mode 100644 index 0000000000000000000000000000000000000000..404b5a485c15dcd972c9271caf6e4e0871f4d15e --- /dev/null +++ b/shared/package-files/33/332e5db8799453cbb47dadc745a0693bfb78cb9b190bc01ec503b8981ea82623/blob @@ -0,0 +1,27 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeMetaFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace at { +namespace meta { + +struct TORCH_API structured_slow_conv_transpose2d : public at::impl::MetaBase { + + + void meta(const at::Tensor & self, const at::Tensor & weight, at::ArrayRef kernel_size, at::OptionalTensorRef bias, at::ArrayRef stride, at::ArrayRef padding, at::ArrayRef output_padding, at::ArrayRef dilation); +}; + +} // namespace native +} // namespace at diff --git a/shared/package-files/33/333231626133ad5f4d3f3559893f5fcd756b564fbd83564997ad3757ee28159f/blob b/shared/package-files/33/333231626133ad5f4d3f3559893f5fcd756b564fbd83564997ad3757ee28159f/blob new file mode 100644 index 0000000000000000000000000000000000000000..c817e7547dbbccd3e6c165f24cb25583e4e1c406 --- /dev/null +++ b/shared/package-files/33/333231626133ad5f4d3f3559893f5fcd756b564fbd83564997ad3757ee28159f/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _make_per_tensor_quantized_tensor { + using schema = at::Tensor (const at::Tensor &, double, int64_t); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_make_per_tensor_quantized_tensor") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_make_per_tensor_quantized_tensor(Tensor self, float scale, int zero_point) -> Tensor") + static at::Tensor call(const at::Tensor & self, double scale, int64_t zero_point); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, double scale, int64_t zero_point); +}; + +struct TORCH_API _make_per_tensor_quantized_tensor_out { + using schema = at::Tensor & (const at::Tensor &, double, int64_t, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_make_per_tensor_quantized_tensor") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_make_per_tensor_quantized_tensor.out(Tensor self, float scale, int zero_point, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, double scale, int64_t zero_point, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, double scale, int64_t zero_point, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/33/3333f5c213bd28025dfac3d303ed03990166e2773bc2e7615787c4ae2826e114/blob b/shared/package-files/33/3333f5c213bd28025dfac3d303ed03990166e2773bc2e7615787c4ae2826e114/blob new file mode 100644 index 0000000000000000000000000000000000000000..1474453f1644deb4f2c42ebe05c3db4c7693e814 --- /dev/null +++ b/shared/package-files/33/3333f5c213bd28025dfac3d303ed03990166e2773bc2e7615787c4ae2826e114/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor digamma(const at::Tensor & self); +TORCH_API at::Tensor & digamma_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & digamma_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & digamma_(at::Tensor & self); + +} // namespace cpu +} // namespace at diff --git a/shared/package-files/33/33347744575c5b047abf7344e1ae392834abd33659ea190eba92109525d32de4/blob b/shared/package-files/33/33347744575c5b047abf7344e1ae392834abd33659ea190eba92109525d32de4/blob new file mode 100644 index 0000000000000000000000000000000000000000..2fc0daddc1c0ecb26d8337dc11e77cc1ff2fb2dd --- /dev/null +++ b/shared/package-files/33/33347744575c5b047abf7344e1ae392834abd33659ea190eba92109525d32de4/blob @@ -0,0 +1,81 @@ +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd +import scipy.stats + +from . import colors +from ._labels import labels + + +def truncate_text(text, max_len): + if len(text) > max_len: + return text[: int(max_len / 2) - 2] + "..." + text[-int(max_len / 2) + 1 :] + else: + return text + + +def monitoring(ind, shap_values, features, feature_names=None, show=True): + """Create a SHAP monitoring plot. + + (Note this function is preliminary and subject to change!!) + A SHAP monitoring plot is meant to display the behavior of a model + over time. Often the shap_values given to this plot explain the loss + of a model, so changes in a feature's impact on the model's loss over + time can help in monitoring the model's performance. + + Parameters + ---------- + ind : int + Index of the feature to plot. + + shap_values : numpy.array + Matrix of SHAP values (# samples x # features) + + features : numpy.array or pandas.DataFrame + Matrix of feature values (# samples x # features) + + feature_names : list + Names of the features (length # features) + + """ + if isinstance(features, pd.DataFrame): + if feature_names is None: + feature_names = features.columns + features = features.values + + num_features = shap_values.shape[1] + + if feature_names is None: + feature_names = np.array([labels["FEATURE"] % str(i) for i in range(num_features)]) + + plt.figure(figsize=(10, 3)) + ys = shap_values[:, ind] + xs = np.arange(len(ys)) # np.linspace(0, 12*2, len(ys)) + + pvals = [] + inc = 50 + for i in range(inc, len(ys) - inc, inc): + # stat, pval = scipy.stats.mannwhitneyu(v[:i], v[i:], alternative="two-sided") + _, pval = scipy.stats.ttest_ind(ys[:i], ys[i:]) + pvals.append(pval) + min_pval = np.min(pvals) + min_pval_ind = float(np.argmin(pvals) * inc + inc) + + if min_pval < 0.05 / shap_values.shape[1]: + plt.axvline(min_pval_ind, linestyle="dashed", color="#666666", alpha=0.2) + + plt.scatter(xs, ys, s=10, c=features[:, ind], cmap=colors.red_blue) + + plt.xlabel("Sample index") + plt.ylabel(truncate_text(feature_names[ind], 30) + "\nSHAP value", size=13) + plt.gca().xaxis.set_ticks_position("bottom") + plt.gca().yaxis.set_ticks_position("left") + plt.gca().spines["right"].set_visible(False) + plt.gca().spines["top"].set_visible(False) + cb = plt.colorbar() + cb.outline.set_visible(False) # type: ignore + bbox = cb.ax.get_window_extent().transformed(plt.gcf().dpi_scale_trans.inverted()) + cb.ax.set_aspect((bbox.height - 0.7) * 20) + cb.set_label(truncate_text(feature_names[ind], 30), size=13) + if show: + plt.show() diff --git a/shared/package-files/33/3334dd5e9e21c3a272819e5db1b49137efc74076d129087d390b8941855b1ec7/blob b/shared/package-files/33/3334dd5e9e21c3a272819e5db1b49137efc74076d129087d390b8941855b1ec7/blob new file mode 100644 index 0000000000000000000000000000000000000000..5d56d228d7b48282f662d4c1e9ed2052aaf135da --- /dev/null +++ b/shared/package-files/33/3334dd5e9e21c3a272819e5db1b49137efc74076d129087d390b8941855b1ec7/blob @@ -0,0 +1,43 @@ +# This file is part of Patsy +# Copyright (C) 2012 Nathaniel Smith +# See file LICENSE.txt for license information. + +# This file contains compatibility code for supporting old versions of Python +# and numpy. (If we can concentrate it here, hopefully it'll make it easier to +# get rid of weird hacks once we drop support for old versions). + +##### Numpy + +import os + +# To force use of the compat code, set this env var to a non-empty value: +optional_dep_ok = not os.environ.get("PATSY_AVOID_OPTIONAL_DEPENDENCIES") + +##### Python standard library + +# The Python license requires that all derivative works contain a "brief +# summary of the changes made to Python". Both for license compliance, and for +# our own sanity, therefore, please add a note at the top of any snippets you +# add here explaining their provenance, any changes made, and what versions of +# Python require them: + +# OrderedDict is only available in Python 2.7+. compat_ordereddict.py has +# comments at the top. +import collections + +if optional_dep_ok and hasattr(collections, "OrderedDict"): + from collections import OrderedDict +else: + from patsy.compat_ordereddict import OrderedDict + +# 'raise from' available in Python 3+ +import sys +from patsy import PatsyError + + +def call_and_wrap_exc(msg, origin, f, *args, **kwargs): + try: + return f(*args, **kwargs) + except Exception as e: + new_exc = PatsyError("%s: %s: %s" % (msg, e.__class__.__name__, e), origin) + raise new_exc from e diff --git a/shared/package-files/33/3334ebad219393156abc2af6063fdebe71d75fd2d2eb9dde459d5b2e1f039ce1/README.md b/shared/package-files/33/3334ebad219393156abc2af6063fdebe71d75fd2d2eb9dde459d5b2e1f039ce1/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0cdfcb2cbe4905c08d7ba0c969937640ea39f363 --- /dev/null +++ b/shared/package-files/33/3334ebad219393156abc2af6063fdebe71d75fd2d2eb9dde459d5b2e1f039ce1/README.md @@ -0,0 +1,3 @@ +# Molecular retrieval research package + +E022: equal-weight ensemble of 64-peak, 64-peak, 10-peak, 10-peak transformers with fragment/neutral-loss bin embeddings and fine mass-defect Fourier features, trained from random initialization on MassSpecGym v1.5 train fold plus supplied held-out-clean ICEBERG simulations (2,333,477 nonempty spectra). Morgan fingerprint predictions rank supplied molecular candidates by training-frequency-weighted cosine plus a train-fitted mixture of Cauchy precursor-mass error densities; candidate exact masses derive from supplied SMILES and no true query formula is used. All adducts and instrument conditions use the same trained model. Selected by full-validation retrieval Hit@1; validation results do not establish improvement over the external test reference. Run infer.sh INPUT_ROOT OUTPUT_ROOT. Runtime: supplied /opt/glacier/bin/python, one GPU, 4 CPU workers. No external data or cache is needed. diff --git a/shared/package-files/33/3334fb3983c45171d834f06b564c8a11a1b909ab3668e034c6faceee5e184eb4/blob b/shared/package-files/33/3334fb3983c45171d834f06b564c8a11a1b909ab3668e034c6faceee5e184eb4/blob new file mode 100644 index 0000000000000000000000000000000000000000..5dbfcf17dd0e01dc0325dd009340291158906e8d Binary files /dev/null and b/shared/package-files/33/3334fb3983c45171d834f06b564c8a11a1b909ab3668e034c6faceee5e184eb4/blob differ diff --git a/shared/package-files/33/333555ba99cb1c4beec255429fa991ecb43da4b78d896336956c0d948c28a3df/blob b/shared/package-files/33/333555ba99cb1c4beec255429fa991ecb43da4b78d896336956c0d948c28a3df/blob new file mode 100644 index 0000000000000000000000000000000000000000..a0986d1496881a2061ac8306d0a064f4393cd4e9 --- /dev/null +++ b/shared/package-files/33/333555ba99cb1c4beec255429fa991ecb43da4b78d896336956c0d948c28a3df/blob @@ -0,0 +1,76 @@ +import pytest + +from pandas.errors import NullFrequencyError + +import pandas as pd +from pandas import TimedeltaIndex +import pandas._testing as tm + + +class TestTimedeltaIndexShift: + # ------------------------------------------------------------- + # TimedeltaIndex.shift is used by __add__/__sub__ + + def test_tdi_shift_empty(self): + # GH#9903 + idx = TimedeltaIndex([], name="xxx") + tm.assert_index_equal(idx.shift(0, freq="h"), idx) + tm.assert_index_equal(idx.shift(3, freq="h"), idx) + + def test_tdi_shift_hours(self): + # GH#9903 + idx = TimedeltaIndex(["5 hours", "6 hours", "9 hours"], name="xxx") + tm.assert_index_equal(idx.shift(0, freq="h"), idx) + exp = TimedeltaIndex(["8 hours", "9 hours", "12 hours"], name="xxx") + tm.assert_index_equal(idx.shift(3, freq="h"), exp) + exp = TimedeltaIndex(["2 hours", "3 hours", "6 hours"], name="xxx") + tm.assert_index_equal(idx.shift(-3, freq="h"), exp) + + def test_tdi_shift_minutes(self): + # GH#9903 + idx = TimedeltaIndex(["5 hours", "6 hours", "9 hours"], name="xxx") + tm.assert_index_equal(idx.shift(0, freq="min"), idx) + exp = TimedeltaIndex(["05:03:00", "06:03:00", "9:03:00"], name="xxx") + tm.assert_index_equal(idx.shift(3, freq="min"), exp) + exp = TimedeltaIndex(["04:57:00", "05:57:00", "8:57:00"], name="xxx") + tm.assert_index_equal(idx.shift(-3, freq="min"), exp) + + def test_tdi_shift_int(self): + # GH#8083 + tdi = pd.to_timedelta(range(5), unit="d") + trange = tdi._with_freq("infer") + pd.offsets.Hour(1) + result = trange.shift(1) + expected = TimedeltaIndex( + [ + "1 days 01:00:00", + "2 days 01:00:00", + "3 days 01:00:00", + "4 days 01:00:00", + "5 days 01:00:00", + ], + freq="D", + ) + tm.assert_index_equal(result, expected) + + def test_tdi_shift_nonstandard_freq(self): + # GH#8083 + tdi = pd.to_timedelta(range(5), unit="d") + trange = tdi._with_freq("infer") + pd.offsets.Hour(1) + result = trange.shift(3, freq="2D 1s") + expected = TimedeltaIndex( + [ + "6 days 01:00:03", + "7 days 01:00:03", + "8 days 01:00:03", + "9 days 01:00:03", + "10 days 01:00:03", + ], + freq="D", + ) + tm.assert_index_equal(result, expected) + + def test_shift_no_freq(self): + # GH#19147 + tdi = TimedeltaIndex(["1 days 01:00:00", "2 days 01:00:00"], freq=None) + with pytest.raises(NullFrequencyError, match="Cannot shift with no freq"): + tdi.shift(2) diff --git a/shared/package-files/33/3339f39dd38edd0a1c71c20cc9d74eeefd7211c0804be1cb6cb42a026adfcd67/blob b/shared/package-files/33/3339f39dd38edd0a1c71c20cc9d74eeefd7211c0804be1cb6cb42a026adfcd67/blob new file mode 100644 index 0000000000000000000000000000000000000000..4f967c753d20c73bd4d617bd0e015469a955a4c7 --- /dev/null +++ b/shared/package-files/33/3339f39dd38edd0a1c71c20cc9d74eeefd7211c0804be1cb6cb42a026adfcd67/blob @@ -0,0 +1,690 @@ +#cython: boundscheck=False +#cython: wraparound=False +#cython: cdivision=False +""" +Kalman Filter declarations + +Author: Chad Fulton +License: Simplified-BSD +""" + +include "statsmodels/tsa/statespace/_blas_int.pxi" + +# ## Constants + +# ### Filters +cdef int FILTER_CONVENTIONAL # Durbin and Koopman (2012), Chapter 4 +cdef int FILTER_EXACT_INITIAL # ibid., Chapter 5.6 +cdef int FILTER_AUGMENTED # ibid., Chapter 5.7 +cdef int FILTER_SQUARE_ROOT # ibid., Chapter 6.3 +cdef int FILTER_UNIVARIATE # ibid., Chapter 6.4 +cdef int FILTER_COLLAPSED # ibid., Chapter 6.5 +cdef int FILTER_EXTENDED # ibid., Chapter 10.2 +cdef int FILTER_UNSCENTED # ibid., Chapter 10.3 +cdef int FILTER_CONCENTRATED # Harvey (1989), Chapter 3.4 +cdef int FILTER_CHANDRASEKHAR # Herbst (2015) + +# ### Inversion methods +# Methods by which the terms using the inverse of the forecast error +# covariance matrix are solved. +cdef int INVERT_UNIVARIATE +cdef int SOLVE_LU +cdef int INVERT_LU +cdef int SOLVE_CHOLESKY +cdef int INVERT_CHOLESKY + +# ### Numerical Stability methods +# Methods to improve numerical stability +cdef int STABILITY_FORCE_SYMMETRY + +# ### Memory conservation options +cdef int MEMORY_STORE_ALL +cdef int MEMORY_NO_FORECAST_MEAN +cdef int MEMORY_NO_FORECAST_COV +cdef int MEMORY_NO_FORECAST +cdef int MEMORY_NO_PREDICTED_MEAN +cdef int MEMORY_NO_PREDICTED_COV +cdef int MEMORY_NO_PREDICTED +cdef int MEMORY_NO_FILTERED_MEAN +cdef int MEMORY_NO_FILTERED_COV +cdef int MEMORY_NO_FILTERED +cdef int MEMORY_NO_LIKELIHOOD +cdef int MEMORY_NO_GAIN +cdef int MEMORY_NO_SMOOTHING +cdef int MEMORY_NO_STD_FORECAST +cdef int MEMORY_CONSERVE + +# ### Timing options +cdef int TIMING_INIT_FILTERED +cdef int TIMING_INIT_PREDICTED + +# Typical imports + +cimport numpy as np + +from statsmodels.tsa.statespace._representation cimport ( + cStatespace, + dStatespace, + sStatespace, + zStatespace, +) + + +# Single precision +cdef class sKalmanFilter(object): + # Statespace object + cdef readonly sStatespace model + + # ### Filter parameters + cdef readonly int t + cdef public np.float64_t tolerance, tolerance_diffuse + cdef readonly int nobs_diffuse + cdef readonly int nobs_kendog_diffuse_nonsingular + cdef readonly int nobs_kendog_univariate_singular + cdef readonly int converged + cdef readonly int period_converged + cdef readonly int time_invariant + cdef readonly int filter_method + cdef public int inversion_method + cdef public int stability_method + cdef readonly int conserve_memory + cdef public int filter_timing + cdef readonly int loglikelihood_burn + + cdef public int [:] univariate_filter + + # ### Kalman filter properties + cdef readonly np.float32_t [:] loglikelihood, scale + cdef readonly np.float32_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error + cdef readonly np.float32_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf + cdef readonly np.float32_t [::1,:,:] kalman_gain + + # ### Steady State Values + cdef readonly np.float32_t [::1,:] converged_forecast_error_cov + cdef readonly np.float32_t [::1,:] converged_filtered_state_cov + cdef readonly np.float32_t [::1,:] converged_predicted_state_cov + cdef readonly np.float32_t [::1,:] converged_kalman_gain + cdef readonly np.float32_t [::1,:] converged_M + cdef readonly np.float32_t converged_determinant + + # ### Temporary arrays + cdef readonly np.float32_t [::1,:] forecast_error_fac + cdef readonly blas_int [:] forecast_error_ipiv + cdef readonly np.float32_t [::1,:] forecast_error_work + cdef readonly np.float32_t [::1,:] tmp0, tmp00 + cdef readonly np.float32_t [::1,:] tmp2 + cdef readonly np.float32_t [::1,:,:] tmp1, tmp3, tmp4 + cdef readonly np.float32_t [:] tmpK0, tmpK1 + cdef readonly np.float32_t [::1,:] tmpL0, tmpL1 + + cdef readonly np.float32_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ + + + cdef readonly np.float32_t determinant + + # ### Pointers to current-iteration arrays + # cdef np.float32_t * _obs + # cdef np.float32_t * _design + # cdef np.float32_t * _obs_intercept + # cdef np.float32_t * _obs_cov + # cdef np.float32_t * _transition + # cdef np.float32_t * _state_intercept + # cdef np.float32_t * _selection + # cdef np.float32_t * _state_cov + # cdef np.float32_t * _selected_state_cov + # cdef np.float32_t * _initial_state + # cdef np.float32_t * _initial_state_cov + + cdef np.float32_t * _input_state + cdef np.float32_t * _input_state_cov + cdef np.float32_t * _input_diffuse_state_cov + + cdef np.float32_t * _forecast + cdef np.float32_t * _forecast_error + cdef np.float32_t * _standardized_forecast_error + cdef np.float32_t * _forecast_error_cov + cdef np.float32_t * _filtered_state + cdef np.float32_t * _filtered_state_cov + cdef np.float32_t * _predicted_state + cdef np.float32_t * _predicted_state_cov + + cdef np.float32_t * _forecast_error_diffuse_cov + cdef np.float32_t * _predicted_diffuse_state_cov + cdef np.float32_t * _M + cdef np.float32_t * _M_inf + + cdef np.float32_t * _kalman_gain + cdef np.float32_t * _loglikelihood + cdef np.float32_t * _scale + + cdef np.float32_t * _converged_forecast_error_cov + cdef np.float32_t * _converged_filtered_state_cov + cdef np.float32_t * _converged_predicted_state_cov + cdef np.float32_t * _converged_kalman_gain + cdef np.float32_t * _converged_M + + cdef np.float32_t * _forecast_error_fac + cdef blas_int * _forecast_error_ipiv + cdef np.float32_t * _forecast_error_work + + cdef np.float32_t * _tmp0 + cdef np.float32_t * _tmp00 + cdef np.float32_t * _tmp1 + cdef np.float32_t * _tmp2 + cdef np.float32_t * _tmp3 + cdef np.float32_t * _tmp4 + + cdef np.float32_t * _tmpM_inf + cdef np.float32_t * _tmpK0 + cdef np.float32_t * _tmpK1 + cdef np.float32_t * _tmpL0 + cdef np.float32_t * _tmpL1 + + # ### Pointers to current-iteration Kalman filtering functions + cdef int (*forecasting)( + sKalmanFilter, sStatespace + ) + cdef np.float32_t (*inversion)( + sKalmanFilter, sStatespace, np.float32_t + ) except * + cdef int (*updating)( + sKalmanFilter, sStatespace + ) + cdef np.float32_t (*calculate_loglikelihood)( + sKalmanFilter, sStatespace, np.float32_t + ) + cdef np.float32_t (*calculate_scale)( + sKalmanFilter, sStatespace + ) + cdef int (*prediction)( + sKalmanFilter, sStatespace + ) + + # ### Define some constants + cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef + cdef readonly int ldwork + + cdef allocate_arrays(self) + cdef void set_dimensions(self) + cpdef set_filter_method(self, int filter_method, int force_reset=*) + cpdef seek(self, unsigned int t, int reset=*) + + cdef void initialize_statespace_object_pointers(self) except * + cdef void initialize_filter_object_pointers(self) + cdef void initialize_function_pointers(self) except * + cdef void post_convergence(self) + cdef void numerical_stability(self) + cdef int check_diffuse(self) + cdef void check_convergence(self) + cdef void migrate_storage(self) + cdef void _reinitialize_pointers(self) except * + + cdef void _forecasting(self) + cdef np.float32_t _inversion(self) + cdef void _updating(self) + cdef np.float32_t _calculate_loglikelihood(self) + cdef void _prediction(self) + +# Double precision +cdef class dKalmanFilter(object): + # Statespace object + cdef readonly dStatespace model + + # ### Filter parameters + cdef readonly int t + cdef public np.float64_t tolerance, tolerance_diffuse + cdef readonly int nobs_diffuse + cdef readonly int nobs_kendog_diffuse_nonsingular + cdef readonly int nobs_kendog_univariate_singular + cdef readonly int converged + cdef readonly int period_converged + cdef readonly int time_invariant + cdef readonly int filter_method + cdef public int inversion_method + cdef public int stability_method + cdef readonly int conserve_memory + cdef public int filter_timing + cdef readonly int loglikelihood_burn + + cdef public int [:] univariate_filter + + # ### Kalman filter properties + cdef readonly np.float64_t [:] loglikelihood, scale + cdef readonly np.float64_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error + cdef readonly np.float64_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf + cdef readonly np.float64_t [::1,:,:] kalman_gain + + # ### Steady State Values + cdef readonly np.float64_t [::1,:] converged_forecast_error_cov + cdef readonly np.float64_t [::1,:] converged_filtered_state_cov + cdef readonly np.float64_t [::1,:] converged_predicted_state_cov + cdef readonly np.float64_t [::1,:] converged_kalman_gain + cdef readonly np.float64_t [::1,:] converged_M + cdef readonly np.float64_t converged_determinant + + # ### Temporary arrays + cdef readonly np.float64_t [::1,:] forecast_error_fac + cdef readonly blas_int [:] forecast_error_ipiv + cdef readonly np.float64_t [::1,:] forecast_error_work + cdef readonly np.float64_t [::1,:] tmp0, tmp00 + cdef readonly np.float64_t [::1,:] tmp2 + cdef readonly np.float64_t [::1,:,:] tmp1, tmp3, tmp4 + cdef readonly np.float64_t [:] tmpM_inf, tmpK0, tmpK1 + cdef readonly np.float64_t [::1,:] tmpL0, tmpL1 + + cdef readonly np.float64_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ + + cdef readonly np.float64_t determinant + + # ### Pointers to current-iteration arrays + # cdef np.float64_t * _obs + # cdef np.float64_t * _design + # cdef np.float64_t * _obs_intercept + # cdef np.float64_t * _obs_cov + # cdef np.float64_t * _transition + # cdef np.float64_t * _state_intercept + # cdef np.float64_t * _selection + # cdef np.float64_t * _state_cov + # cdef np.float64_t * _selected_state_cov + # cdef np.float64_t * _initial_state + # cdef np.float64_t * _initial_state_cov + + cdef np.float64_t * _input_state + cdef np.float64_t * _input_state_cov + cdef np.float64_t * _input_diffuse_state_cov + + cdef np.float64_t * _forecast + cdef np.float64_t * _forecast_error + cdef np.float64_t * _standardized_forecast_error + cdef np.float64_t * _forecast_error_cov + cdef np.float64_t * _filtered_state + cdef np.float64_t * _filtered_state_cov + cdef np.float64_t * _predicted_state + cdef np.float64_t * _predicted_state_cov + + cdef np.float64_t * _forecast_error_diffuse_cov + cdef np.float64_t * _predicted_diffuse_state_cov + cdef np.float64_t * _M + cdef np.float64_t * _M_inf + + cdef np.float64_t * _kalman_gain + cdef np.float64_t * _loglikelihood + cdef np.float64_t * _scale + + cdef np.float64_t * _converged_forecast_error_cov + cdef np.float64_t * _converged_filtered_state_cov + cdef np.float64_t * _converged_predicted_state_cov + cdef np.float64_t * _converged_kalman_gain + cdef np.float64_t * _converged_M + + cdef np.float64_t * _forecast_error_fac + cdef blas_int * _forecast_error_ipiv + cdef np.float64_t * _forecast_error_work + + cdef np.float64_t * _tmp0 + cdef np.float64_t * _tmp00 + cdef np.float64_t * _tmp1 + cdef np.float64_t * _tmp2 + cdef np.float64_t * _tmp3 + cdef np.float64_t * _tmp4 + + cdef np.float64_t * _tmpM_inf + cdef np.float64_t * _tmpK0 + cdef np.float64_t * _tmpK1 + cdef np.float64_t * _tmpL0 + cdef np.float64_t * _tmpL1 + + # ### Pointers to current-iteration Kalman filtering functions + cdef int (*forecasting)( + dKalmanFilter, dStatespace + ) + cdef np.float64_t (*inversion)( + dKalmanFilter, dStatespace, np.float64_t + ) except * + cdef int (*updating)( + dKalmanFilter, dStatespace + ) + cdef np.float64_t (*calculate_loglikelihood)( + dKalmanFilter, dStatespace, np.float64_t + ) + cdef np.float64_t (*calculate_scale)( + dKalmanFilter, dStatespace + ) + cdef int (*prediction)( + dKalmanFilter, dStatespace + ) + + # ### Define some constants + cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef + cdef readonly int ldwork + + cdef allocate_arrays(self) + cdef void set_dimensions(self) + cpdef set_filter_method(self, int filter_method, int force_reset=*) + cpdef seek(self, unsigned int t, int reset=*) + + cdef void initialize_statespace_object_pointers(self) except * + cdef void initialize_filter_object_pointers(self) + cdef void initialize_function_pointers(self) except * + cdef void post_convergence(self) + cdef void numerical_stability(self) + cdef int check_diffuse(self) + cdef void check_convergence(self) + cdef void migrate_storage(self) + cdef void _reinitialize_pointers(self) except * + + cdef void _forecasting(self) + cdef np.float64_t _inversion(self) + cdef void _updating(self) + cdef np.float64_t _calculate_loglikelihood(self) + cdef void _prediction(self) + +# Single precision complex +cdef class cKalmanFilter(object): + # Statespace object + cdef readonly cStatespace model + + # ### Filter parameters + cdef readonly int t + cdef public np.float64_t tolerance, tolerance_diffuse + cdef readonly int nobs_diffuse + cdef readonly int nobs_kendog_diffuse_nonsingular + cdef readonly int nobs_kendog_univariate_singular + cdef readonly int converged + cdef readonly int period_converged + cdef readonly int time_invariant + cdef readonly int filter_method + cdef public int inversion_method + cdef public int stability_method + cdef readonly int conserve_memory + cdef public int filter_timing + cdef readonly int loglikelihood_burn + + cdef public int [:] univariate_filter + + # ### Kalman filter properties + cdef readonly np.complex64_t [:] loglikelihood, scale + cdef readonly np.complex64_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error + cdef readonly np.complex64_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf + cdef readonly np.complex64_t [::1,:,:] kalman_gain + + # ### Steady State Values + cdef readonly np.complex64_t [::1,:] converged_forecast_error_cov + cdef readonly np.complex64_t [::1,:] converged_filtered_state_cov + cdef readonly np.complex64_t [::1,:] converged_predicted_state_cov + cdef readonly np.complex64_t [::1,:] converged_kalman_gain + cdef readonly np.complex64_t [::1,:] converged_M + cdef readonly np.complex64_t converged_determinant + + # ### Temporary arrays + cdef readonly np.complex64_t [::1,:] forecast_error_fac + cdef readonly blas_int [:] forecast_error_ipiv + cdef readonly np.complex64_t [::1,:] forecast_error_work + cdef readonly np.complex64_t [::1,:] tmp0, tmp00 + cdef readonly np.complex64_t [::1,:] tmp2 + cdef readonly np.complex64_t [::1,:,:] tmp1, tmp3, tmp4 + cdef readonly np.complex64_t [:] tmpM_inf, tmpK0, tmpK1 + cdef readonly np.complex64_t [::1,:] tmpL0, tmpL1 + + cdef readonly np.complex64_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ + + + cdef readonly np.complex64_t determinant + + # ### Pointers to current-iteration arrays + # cdef np.complex64_t * _obs + # cdef np.complex64_t * _design + # cdef np.complex64_t * _obs_intercept + # cdef np.complex64_t * _obs_cov + # cdef np.complex64_t * _transition + # cdef np.complex64_t * _state_intercept + # cdef np.complex64_t * _selection + # cdef np.complex64_t * _state_cov + # cdef np.complex64_t * _selected_state_cov + # cdef np.complex64_t * _initial_state + # cdef np.complex64_t * _initial_state_cov + + cdef np.complex64_t * _input_state + cdef np.complex64_t * _input_state_cov + cdef np.complex64_t * _input_diffuse_state_cov + + cdef np.complex64_t * _forecast + cdef np.complex64_t * _forecast_error + cdef np.complex64_t * _standardized_forecast_error + cdef np.complex64_t * _forecast_error_cov + cdef np.complex64_t * _filtered_state + cdef np.complex64_t * _filtered_state_cov + cdef np.complex64_t * _predicted_state + cdef np.complex64_t * _predicted_state_cov + + cdef np.complex64_t * _forecast_error_diffuse_cov + cdef np.complex64_t * _predicted_diffuse_state_cov + cdef np.complex64_t * _M + cdef np.complex64_t * _M_inf + + cdef np.complex64_t * _kalman_gain + cdef np.complex64_t * _loglikelihood + cdef np.complex64_t * _scale + + cdef np.complex64_t * _converged_forecast_error_cov + cdef np.complex64_t * _converged_filtered_state_cov + cdef np.complex64_t * _converged_predicted_state_cov + cdef np.complex64_t * _converged_kalman_gain + cdef np.complex64_t * _converged_M + + cdef np.complex64_t * _forecast_error_fac + cdef blas_int * _forecast_error_ipiv + cdef np.complex64_t * _forecast_error_work + + cdef np.complex64_t * _tmp0 + cdef np.complex64_t * _tmp00 + cdef np.complex64_t * _tmp1 + cdef np.complex64_t * _tmp2 + cdef np.complex64_t * _tmp3 + cdef np.complex64_t * _tmp4 + + cdef np.complex64_t * _tmpM_inf + cdef np.complex64_t * _tmpK0 + cdef np.complex64_t * _tmpK1 + cdef np.complex64_t * _tmpL0 + cdef np.complex64_t * _tmpL1 + + # ### Pointers to current-iteration Kalman filtering functions + cdef int (*forecasting)( + cKalmanFilter, cStatespace + ) + cdef np.complex64_t (*inversion)( + cKalmanFilter, cStatespace, np.complex64_t + ) except * + cdef int (*updating)( + cKalmanFilter, cStatespace + ) + cdef np.complex64_t (*calculate_loglikelihood)( + cKalmanFilter, cStatespace, np.complex64_t + ) + cdef np.complex64_t (*calculate_scale)( + cKalmanFilter, cStatespace + ) + cdef int (*prediction)( + cKalmanFilter, cStatespace + ) + + # ### Define some constants + cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef + cdef readonly int ldwork + + cdef allocate_arrays(self) + cdef void set_dimensions(self) + cpdef set_filter_method(self, int filter_method, int force_reset=*) + cpdef seek(self, unsigned int t, int reset=*) + + cdef void initialize_statespace_object_pointers(self) except * + cdef void initialize_filter_object_pointers(self) + cdef void initialize_function_pointers(self) except * + cdef void post_convergence(self) + cdef void numerical_stability(self) + cdef int check_diffuse(self) + cdef void check_convergence(self) + cdef void migrate_storage(self) + cdef void _reinitialize_pointers(self) except * + + cdef void _forecasting(self) + cdef np.complex64_t _inversion(self) + cdef void _updating(self) + cdef np.complex64_t _calculate_loglikelihood(self) + cdef void _prediction(self) + +# Double precision complex +cdef class zKalmanFilter(object): + # Statespace object + cdef readonly zStatespace model + + # ### Filter parameters + cdef readonly int t + cdef public np.float64_t tolerance, tolerance_diffuse + cdef readonly int nobs_diffuse + cdef readonly int nobs_kendog_diffuse_nonsingular + cdef readonly int nobs_kendog_univariate_singular + cdef readonly int converged + cdef readonly int period_converged + cdef readonly int time_invariant + cdef readonly int filter_method + cdef public int inversion_method + cdef public int stability_method + cdef readonly int conserve_memory + cdef public int filter_timing + cdef readonly int loglikelihood_burn + + cdef public int [:] univariate_filter + + # ### Kalman filter properties + cdef readonly np.complex128_t [:] loglikelihood, scale + cdef readonly np.complex128_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error + cdef readonly np.complex128_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf + cdef readonly np.complex128_t [::1,:,:] kalman_gain + + # ### Steady State Values + cdef readonly np.complex128_t [::1,:] converged_forecast_error_cov + cdef readonly np.complex128_t [::1,:] converged_filtered_state_cov + cdef readonly np.complex128_t [::1,:] converged_predicted_state_cov + cdef readonly np.complex128_t [::1,:] converged_kalman_gain + cdef readonly np.complex128_t [::1,:] converged_M + cdef readonly np.complex128_t converged_determinant + + # ### Temporary arrays + cdef readonly np.complex128_t [::1,:] forecast_error_fac + cdef readonly blas_int [:] forecast_error_ipiv + cdef readonly np.complex128_t [::1,:] forecast_error_work + cdef readonly np.complex128_t [::1,:] tmp0, tmp00 + cdef readonly np.complex128_t [::1,:] tmp2 + cdef readonly np.complex128_t [::1,:,:] tmp1, tmp3, tmp4 + cdef readonly np.complex128_t [:] tmpM_inf, tmpK0, tmpK1 + cdef readonly np.complex128_t [::1,:] tmpL0, tmpL1 + + cdef readonly np.complex128_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ + + + cdef readonly np.complex128_t determinant + + # ### Pointers to current-iteration arrays + # cdef np.complex128_t * _obs + # cdef np.complex128_t * _design + # cdef np.complex128_t * _obs_intercept + # cdef np.complex128_t * _obs_cov + # cdef np.complex128_t * _transition + # cdef np.complex128_t * _state_intercept + # cdef np.complex128_t * _selection + # cdef np.complex128_t * _state_cov + # cdef np.complex128_t * _selected_state_cov + # cdef np.complex128_t * _initial_state + # cdef np.complex128_t * _initial_state_cov + + cdef np.complex128_t * _input_state + cdef np.complex128_t * _input_state_cov + cdef np.complex128_t * _input_diffuse_state_cov + + cdef np.complex128_t * _forecast + cdef np.complex128_t * _forecast_error + cdef np.complex128_t * _standardized_forecast_error + cdef np.complex128_t * _forecast_error_cov + cdef np.complex128_t * _filtered_state + cdef np.complex128_t * _filtered_state_cov + cdef np.complex128_t * _predicted_state + cdef np.complex128_t * _predicted_state_cov + + cdef np.complex128_t * _forecast_error_diffuse_cov + cdef np.complex128_t * _predicted_diffuse_state_cov + cdef np.complex128_t * _M + cdef np.complex128_t * _M_inf + + cdef np.complex128_t * _kalman_gain + cdef np.complex128_t * _loglikelihood + cdef np.complex128_t * _scale + + cdef np.complex128_t * _converged_forecast_error_cov + cdef np.complex128_t * _converged_filtered_state_cov + cdef np.complex128_t * _converged_predicted_state_cov + cdef np.complex128_t * _converged_kalman_gain + cdef np.complex128_t * _converged_M + + cdef np.complex128_t * _forecast_error_fac + cdef blas_int * _forecast_error_ipiv + cdef np.complex128_t * _forecast_error_work + + cdef np.complex128_t * _tmp0 + cdef np.complex128_t * _tmp00 + cdef np.complex128_t * _tmp1 + cdef np.complex128_t * _tmp2 + cdef np.complex128_t * _tmp3 + cdef np.complex128_t * _tmp4 + + cdef np.complex128_t * _tmpM_inf + cdef np.complex128_t * _tmpK0 + cdef np.complex128_t * _tmpK1 + cdef np.complex128_t * _tmpL0 + cdef np.complex128_t * _tmpL1 + + # ### Pointers to current-iteration Kalman filtering functions + cdef int (*forecasting)( + zKalmanFilter, zStatespace + ) + cdef np.complex128_t (*inversion)( + zKalmanFilter, zStatespace, np.complex128_t + ) except * + cdef int (*updating)( + zKalmanFilter, zStatespace + ) + cdef np.complex128_t (*calculate_loglikelihood)( + zKalmanFilter, zStatespace, np.complex128_t + ) + cdef np.complex128_t (*calculate_scale)( + zKalmanFilter, zStatespace + ) + cdef int (*prediction)( + zKalmanFilter, zStatespace + ) + + # ### Define some constants + cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef + cdef readonly int ldwork + + cdef allocate_arrays(self) + cdef void set_dimensions(self) + cpdef set_filter_method(self, int filter_method, int force_reset=*) + cpdef seek(self, unsigned int t, int reset=*) + + cdef void initialize_statespace_object_pointers(self) except * + cdef void initialize_filter_object_pointers(self) + cdef void initialize_function_pointers(self) except * + cdef void post_convergence(self) + cdef void numerical_stability(self) + cdef int check_diffuse(self) + cdef void check_convergence(self) + cdef void migrate_storage(self) + cdef void _reinitialize_pointers(self) except * + + cdef void _forecasting(self) + cdef np.complex128_t _inversion(self) + cdef void _updating(self) + cdef np.complex128_t _calculate_loglikelihood(self) + cdef void _prediction(self) diff --git a/shared/package-files/33/333dd019f806e7c875bae091f9bf6bfcfbfc2febc0f281f823834de8bea17c2d/blob b/shared/package-files/33/333dd019f806e7c875bae091f9bf6bfcfbfc2febc0f281f823834de8bea17c2d/blob new file mode 100644 index 0000000000000000000000000000000000000000..9c33922b383d62bef5d05ec54cba170b9a767d90 --- /dev/null +++ b/shared/package-files/33/333dd019f806e7c875bae091f9bf6bfcfbfc2febc0f281f823834de8bea17c2d/blob @@ -0,0 +1,6 @@ +from typing import Any + +def __getattr__(name) -> Any: ... + +home: str +pythonrc: str diff --git a/shared/package-files/33/3341413075b40e3eae33a4254813f8c79a78b7c5261c11ef09667a1e846e2cd5/blob b/shared/package-files/33/3341413075b40e3eae33a4254813f8c79a78b7c5261c11ef09667a1e846e2cd5/blob new file mode 100644 index 0000000000000000000000000000000000000000..f5528ebf38085cc860d814bab0e1cdc28c4f9f7b --- /dev/null +++ b/shared/package-files/33/3341413075b40e3eae33a4254813f8c79a78b7c5261c11ef09667a1e846e2cd5/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::smooth_l1_loss.out(Tensor self, Tensor target, int reduction=Mean, float beta=1.0, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & smooth_l1_loss_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & target, int64_t reduction=at::Reduction::Mean, double beta=1.0) { + return at::_ops::smooth_l1_loss_out::call(self, target, reduction, beta, out); +} +// aten::smooth_l1_loss.out(Tensor self, Tensor target, int reduction=Mean, float beta=1.0, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & smooth_l1_loss_outf(const at::Tensor & self, const at::Tensor & target, int64_t reduction, double beta, at::Tensor & out) { + return at::_ops::smooth_l1_loss_out::call(self, target, reduction, beta, out); +} + +// aten::smooth_l1_loss(Tensor self, Tensor target, int reduction=Mean, float beta=1.0) -> Tensor +inline at::Tensor smooth_l1_loss(const at::Tensor & self, const at::Tensor & target, int64_t reduction=at::Reduction::Mean, double beta=1.0) { + return at::_ops::smooth_l1_loss::call(self, target, reduction, beta); +} + +} diff --git a/shared/package-files/33/3342d477dc64280b8dc7afc68ee13945b8b72927a8c79ba88b25e11fc72adb85/blob b/shared/package-files/33/3342d477dc64280b8dc7afc68ee13945b8b72927a8c79ba88b25e11fc72adb85/blob new file mode 100644 index 0000000000000000000000000000000000000000..95c64fdbcf40089c383beba2b75f1ec6d2640a04 --- /dev/null +++ b/shared/package-files/33/3342d477dc64280b8dc7afc68ee13945b8b72927a8c79ba88b25e11fc72adb85/blob @@ -0,0 +1,494 @@ +from statsmodels.compat.python import lrange + +import numpy as np + +from statsmodels.graphics.utils import _import_mpl +from statsmodels.tsa.vector_ar import util + + +class MPLConfigurator: + + def __init__(self): + self._inverse_actions = [] + + def revert(self): + for action in self._inverse_actions: + action() + + def set_fontsize(self, size): + import matplotlib as mpl + + old_size = mpl.rcParams["font.size"] + mpl.rcParams["font.size"] = size + + def revert(): + mpl.rcParams["font.size"] = old_size + + self._inverse_actions.append(revert) + + +# +# Plotting functions +# +def plot_mts(Y, names=None, index=None): + """ + Plot multiple time series + + Parameters + ---------- + Y : ndarray + 2-d array of the time series to plot, of shape (nobs, neqs). + names : sequence of str, optional + Titles to use for each subplot. If None, subplots are not + given a title. + index : array_like, optional + Values to use for the x-axis of each subplot. If None, uses + the default integer index. + + Returns + ------- + Figure + The figure containing the grid of time series plots. + """ + plt = _import_mpl() + + k = Y.shape[1] + rows, cols = k, 1 + + fig = plt.figure(figsize=(10, 10)) + + for j in range(k): + ts = Y[:, j] + + ax = fig.add_subplot(rows, cols, j + 1) + if index is not None: + ax.plot(index, ts) + else: + ax.plot(ts) + + if names is not None: + ax.set_title(names[j]) + + return fig + + +def plot_var_forc( + prior, + forc, + err_upper, + err_lower, + index=None, + names=None, + plot_stderr=True, + legend_options=None, +): + """ + Plot a forecast against the observed data, with optional error bands + + Parameters + ---------- + prior : ndarray + 2-d array of the observed data prior to the forecast, of shape + (nobs, neqs). + forc : ndarray + 2-d array of forecast values, of shape (steps, neqs). + err_upper : ndarray + 2-d array of upper confidence interval bounds for the forecast, + of shape (steps, neqs). + err_lower : ndarray + 2-d array of lower confidence interval bounds for the forecast, + of shape (steps, neqs). + index : array_like, optional + Currently unused. + names : sequence of str, optional + Titles to use for each subplot. If None, subplots are not + given a title. + plot_stderr : bool, optional + If True, plot the confidence interval around the forecast. + legend_options : dict, optional + Keyword arguments passed to ``ax.legend``. If None, uses + ``{"loc": "upper right"}``. + + Returns + ------- + Figure + The figure containing the grid of forecast plots. + """ + plt = _import_mpl() + + n, k = prior.shape + rows, cols = k, 1 + + fig = plt.figure(figsize=(10, 10)) + + prange = np.arange(n) + rng_f = np.arange(n - 1, n + len(forc)) + rng_err = np.arange(n, n + len(forc)) + + for j in range(k): + ax = plt.subplot(rows, cols, j + 1) + + ax.plot(prange, prior[:, j], "k", label="Observed") + ax.plot(rng_f, np.r_[prior[-1:, j], forc[:, j]], "k--", label="Forecast") + + if plot_stderr: + ax.plot(rng_err, err_upper[:, j], "k-.", label="Forc 2 STD err") + ax.plot(rng_err, err_lower[:, j], "k-.") + + if names is not None: + ax.set_title(names[j]) + + if legend_options is None: + legend_options = {"loc": "upper right"} + ax.legend(**legend_options) + return fig + + +def plot_with_error( + y, + error, + x=None, + axes=None, + value_fmt="k", + error_fmt="k--", + alpha=0.05, + stderr_type="asym", +): + """ + Make plot with optional error bars + + Parameters + ---------- + y : array_like + The data to plot. + error : array_like, tuple of array_like, or None + The error used to plot error bars around `y`. If `stderr_type` + is "asym", an array the same shape as `y` combined with `alpha` + to compute the bands. If `stderr_type` is one of "mc", "sz1", + "sz2", "sz3", a 2-tuple of arrays giving the lower and upper + bands directly. If None, no error bars are plotted. + x : array_like, optional + The x-axis values to use. If None, uses a range the same length + as `y`. + axes : AxesSubplot, optional + Matplotlib axes to plot on. If None, uses the current axes. + value_fmt : str, optional + Matplotlib format string used to plot `y`. + error_fmt : str, optional + Matplotlib format string used to plot the error bars. + alpha : float, optional + The significance level to use when `stderr_type` is "asym". + stderr_type : {"asym", "mc", "sz1", "sz2", "sz3"}, optional + The kind of error bars being plotted. + """ + plt = _import_mpl() + + if axes is None: + axes = plt.gca() + + x = x if x is not None else lrange(len(y)) + + def plot_action(y, fmt): + return axes.plot(x, y, fmt) + + plot_action(y, value_fmt) + + # changed this + if error is not None: + if stderr_type == "asym": + q = util.norm_signif_level(alpha) + plot_action(y - q * error, error_fmt) + plot_action(y + q * error, error_fmt) + if stderr_type in ("mc", "sz1", "sz2", "sz3"): + plot_action(error[0], error_fmt) + plot_action(error[1], error_fmt) + + +def plot_full_acorr(acorr, fontsize=8, linewidth=8, xlabel=None, err_bound=None): + """ + Plot the autocorrelations of a multivariate time series in a grid + + Parameters + ---------- + acorr : ndarray + Array of autocorrelations, shape (nlags, k, k). + fontsize : int, optional + Font size used for the plot labels. + linewidth : int, optional + Width of the lines used in the autocorrelation plots. + xlabel : array_like, optional + Labels to use for the x-axis of each subplot. If None, uses a + range the same length as `acorr`. + err_bound : float, optional + If provided, draws horizontal reference lines at +/- `err_bound`. + + Returns + ------- + Figure + The figure containing the grid of autocorrelation plots. + """ + plt = _import_mpl() + + config = MPLConfigurator() + config.set_fontsize(fontsize) + + k = acorr.shape[1] + fig, axes = plt.subplots(k, k, figsize=(10, 10), squeeze=False) + + for i in range(k): + for j in range(k): + ax = axes[i][j] + acorr_plot(acorr[:, i, j], linewidth=linewidth, xlabel=xlabel, ax=ax) + + if err_bound is not None: + ax.axhline(err_bound, color="k", linestyle="--") + ax.axhline(-err_bound, color="k", linestyle="--") + + adjust_subplots() + config.revert() + + return fig + + +def acorr_plot(acorr, linewidth=8, xlabel=None, ax=None): + """ + Plot a single autocorrelation function as a stem plot + + Parameters + ---------- + acorr : array_like + 1-d array of autocorrelations to plot. + linewidth : int, optional + Width of the vertical lines used in the plot. + xlabel : array_like, optional + Positions to use for the x-axis. If None, uses a range the + same length as `acorr`. + ax : AxesSubplot, optional + Matplotlib axes to plot on. If None, uses the current axes. + """ + plt = _import_mpl() + + if ax is None: + ax = plt.gca() + + if xlabel is None: + xlabel = np.arange(len(acorr)) + + ax.vlines(xlabel, [0], acorr, lw=linewidth) + + ax.axhline(0, color="k") + ax.set_ylim([-1, 1]) + + # hack? + ax.set_xlim([-1, xlabel[-1] + 1]) + + +def plot_acorr_with_error(): + """Not implemented.""" + raise NotImplementedError + + +def adjust_subplots(**kwds): + """ + Adjust subplot spacing using defaults suitable for the grid plots + + Parameters + ---------- + **kwds + Keyword arguments passed to ``matplotlib.pyplot.subplots_adjust``, + overriding the defaults. + """ + plt = _import_mpl() + + passed_kwds = { + "bottom": 0.05, + "top": 0.925, + "left": 0.05, + "right": 0.95, + "hspace": 0.2, + } + passed_kwds.update(kwds) + plt.subplots_adjust(**passed_kwds) + + +# +# Multiple impulse response (cum_effects, etc.) cplots +# + + +def irf_grid_plot( + values, + stderr, + impcol, + rescol, + names, + title, + signif=0.05, + hlines=None, + subplot_params=None, + plot_params=None, + figsize=(10, 10), + stderr_type="asym", +): + """ + Reusable function to make flexible grid plots of impulse responses and + cumulative effects + + Parameters + ---------- + values : ndarray + Array of values to plot, shape (T, k, k). + stderr : ndarray, tuple of ndarray, or None + Used to plot error bands around `values`. If `stderr_type` is + "asym", an array of shape (T, k ** 2, k ** 2) giving the + covariance matrix of the vectorized values at each period (as + returned by :meth:`~statsmodels.tsa.vector_ar.irf.IRAnalysis.cov`). + If `stderr_type` is one of "mc", "sz1", "sz2", "sz3", a 2-tuple + of arrays of shape (T, k, k) giving the lower and upper error + bands directly. If None, no error bands are plotted. + impcol : int, str, or None + Column of the impulse variable to plot. If None, plots impulses + from all variables. + rescol : int, str, or None + Column of the response variable to plot. If None, plots responses + of all variables. + names : sequence of str + Names of the variables in the system. + title : str + Title to use for the figure. + signif : float, optional + Significance level used when plotting error bands. + hlines : ndarray, optional + Array of horizontal reference lines to draw on each subplot, + shape (k, k). + subplot_params : dict, optional + May contain a "fontsize" key controlling the subplot title font + size. + plot_params : dict, optional + Additional keyword arguments (currently unused). + figsize : tuple of float, optional + The size of the figure to create. + stderr_type : {"asym", "mc", "sz1", "sz2", "sz3"}, optional + The kind of error bars being plotted. + + Returns + ------- + Figure + The figure containing the grid of impulse response plots. + """ + plt = _import_mpl() + + if subplot_params is None: + subplot_params = {} + if plot_params is None: + plot_params = {} + + nrows, ncols, to_plot = _get_irf_plot_config(names, impcol, rescol) + + fig, axes = plt.subplots( + nrows=nrows, ncols=ncols, sharex=True, squeeze=False, figsize=figsize + ) + + # fill out space + adjust_subplots() + + fig.suptitle(title, fontsize=14) + + subtitle_temp = r"%s$\rightarrow$%s" + + k = len(names) + + rng = lrange(len(values)) + for j, i, ai, aj in to_plot: + ax = axes[ai][aj] + + # HACK? + if stderr is not None: + if stderr_type == "asym": + sig = np.sqrt(stderr[:, j * k + i, j * k + i]) + plot_with_error( + values[:, i, j], + sig, + x=rng, + axes=ax, + alpha=signif, + value_fmt="b", + stderr_type=stderr_type, + ) + if stderr_type in ("mc", "sz1", "sz2", "sz3"): + errs = stderr[0][:, i, j], stderr[1][:, i, j] + plot_with_error( + values[:, i, j], + errs, + x=rng, + axes=ax, + alpha=signif, + value_fmt="b", + stderr_type=stderr_type, + ) + else: + plot_with_error(values[:, i, j], None, x=rng, axes=ax, value_fmt="b") + + ax.axhline(0, color="k") + + if hlines is not None: + ax.axhline(hlines[i, j], color="k") + + sz = subplot_params.get("fontsize", 12) + ax.set_title(subtitle_temp % (names[j], names[i]), fontsize=sz) + + return fig + + +def _get_irf_plot_config(names, impcol, rescol): + """ + Determine the subplot grid layout for `irf_grid_plot` + + Parameters + ---------- + names : sequence of str + Names of the variables in the system. + impcol : int, str, or None + Column of the impulse variable to plot. If None, plots impulses + from all variables. + rescol : int, str, or None + Column of the response variable to plot. If None, plots responses + of all variables. + + Returns + ------- + nrows : int + Number of subplot rows. + ncols : int + Number of subplot columns. + to_plot : list of tuple + Each tuple is ``(j, i, ai, aj)`` giving the impulse index `j`, + response index `i`, and the subplot grid position (`ai`, `aj`) + to plot it at. + """ + nrows = ncols = k = len(names) + if impcol is not None and rescol is not None: + # plot one impulse-response pair + nrows = ncols = 1 + j = util.get_index(names, impcol) + i = util.get_index(names, rescol) + to_plot = [(j, i, 0, 0)] + elif impcol is not None: + # plot impacts of impulse in one variable + ncols = 1 + j = util.get_index(names, impcol) + to_plot = [(j, i, i, 0) for i in range(k)] + elif rescol is not None: + # plot only things having impact on particular variable + ncols = 1 + i = util.get_index(names, rescol) + to_plot = [(j, i, j, 0) for j in range(k)] + else: + # plot everything + to_plot = [(j, i, i, j) for i in range(k) for j in range(k)] + + return nrows, ncols, to_plot + + +# +# Forecast error variance decomposition diff --git a/shared/package-files/33/3343d3b7c20e21c557a903d67b6379d2c9b812ad9ba1d457578564774f1cad79/blob b/shared/package-files/33/3343d3b7c20e21c557a903d67b6379d2c9b812ad9ba1d457578564774f1cad79/blob new file mode 100644 index 0000000000000000000000000000000000000000..e1eaaf7241bc3b4a48234178d18da3aa5736e189 --- /dev/null +++ b/shared/package-files/33/3343d3b7c20e21c557a903d67b6379d2c9b812ad9ba1d457578564774f1cad79/blob @@ -0,0 +1,13 @@ +from sympy.tensor.array.ndim_array import NDimArray + + +class MutableNDimArray(NDimArray): + + def as_immutable(self): + raise NotImplementedError("abstract method") + + def as_mutable(self): + return self + + def _sympy_(self): + return self.as_immutable() diff --git a/shared/package-files/33/3344af465d1c008f91cb7852e15960800d16bacb2f764ad8e12e5327aceddb5a/blob b/shared/package-files/33/3344af465d1c008f91cb7852e15960800d16bacb2f764ad8e12e5327aceddb5a/blob new file mode 100644 index 0000000000000000000000000000000000000000..14cf54a228119ef942dcd443f96aefd63f40e419 --- /dev/null +++ b/shared/package-files/33/3344af465d1c008f91cb7852e15960800d16bacb2f764ad8e12e5327aceddb5a/blob @@ -0,0 +1,1280 @@ +"""CSS selector parser.""" +from __future__ import annotations +import re +from functools import lru_cache +from . import util +from . import css_match as cm +from . import css_types as ct +from .util import SelectorSyntaxError +import warnings +from typing import Match, Any, Iterator, cast + +UNICODE_REPLACEMENT_CHAR = 0xFFFD + +# Simple pseudo classes that take no parameters +PSEUDO_SIMPLE = { + ":any-link", + ":empty", + ":first-child", + ":first-of-type", + ":in-range", + ":out-of-range", + ":last-child", + ":last-of-type", + ":link", + ":only-child", + ":only-of-type", + ":root", + ':checked', + ':default', + ':disabled', + ':enabled', + ':indeterminate', + ':optional', + ':placeholder-shown', + ':read-only', + ':read-write', + ':required', + ':scope', + ':defined' +} + +# Supported, simple pseudo classes that match nothing in the Soup Sieve environment +PSEUDO_SIMPLE_NO_MATCH = { + ':active', + ':current', + ':focus', + ':focus-visible', + ':focus-within', + ':future', + ':host', + ':hover', + ':local-link', + ':past', + ':paused', + ':playing', + ':target', + ':target-within', + ':user-invalid', + ':visited' +} + +# Complex pseudo classes that take selector lists +PSEUDO_COMPLEX = { + ':contains', + ':-soup-contains', + ':-soup-contains-own', + ':has', + ':is', + ':matches', + ':not', + ':where' +} + +PSEUDO_COMPLEX_NO_MATCH = { + ':current', + ':host', + ':host-context' +} + +# Complex pseudo classes that take very specific parameters and are handled special +PSEUDO_SPECIAL = { + ':dir', + ':lang', + ':nth-child', + ':nth-last-child', + ':nth-last-of-type', + ':nth-of-type' +} + +PSEUDO_SUPPORTED = PSEUDO_SIMPLE | PSEUDO_SIMPLE_NO_MATCH | PSEUDO_COMPLEX | PSEUDO_COMPLEX_NO_MATCH | PSEUDO_SPECIAL + +# Sub-patterns parts +# Whitespace +NEWLINE = r'(?:\r\n|(?!\r\n)[\n\f\r])' +WS = fr'(?:[ \t]|{NEWLINE})' +# Comments +COMMENTS = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)' +# Whitespace with comments included +WSC = fr'(?:{WS}|{COMMENTS})' +# CSS escapes +CSS_ESCAPES = fr'(?:\\(?:[a-f0-9]{{1,6}}{WS}?|[^\r\n\f]|$))' +CSS_STRING_ESCAPES = fr'(?:\\(?:[a-f0-9]{{1,6}}{WS}?|[^\r\n\f]|$|{NEWLINE}))' +# CSS Identifier +IDENTIFIER = fr''' +(?:(?:-?(?:[^\x00-\x2f\x30-\x40\x5B-\x5E\x60\x7B-\x9f]|{CSS_ESCAPES})+|--) +(?:[^\x00-\x2c\x2e\x2f\x3A-\x40\x5B-\x5E\x60\x7B-\x9f]|{CSS_ESCAPES})*) +''' +# `nth` content +NTH = fr'(?:[-+])?(?:[0-9]+n?|n)(?:(?<=n){WSC}*(?:[-+]){WSC}*(?:[0-9]+))?' +# Value: quoted string or identifier +VALUE = fr'''(?:"(?:\\(?:.|{NEWLINE})|[^\\"\r\n\f]+)*?"|'(?:\\(?:.|{NEWLINE})|[^\\'\r\n\f]+)*?'|{IDENTIFIER}+)''' +# Attribute value comparison. `!=` is handled special as it is non-standard. +ATTR = fr'(?:{WSC}*(?P[!~^|*$]?=){WSC}*(?P{VALUE})(?:{WSC}*(?P[is]))?)?{WSC}*\]' + +# Selector patterns +# IDs (`#id`) +PAT_ID = fr'\#{IDENTIFIER}' +# Classes (`.class`) +PAT_CLASS = fr'\.{IDENTIFIER}' +# Prefix:Tag (`prefix|tag`) +PAT_TAG = fr'(?P(?:{IDENTIFIER}|\*)?\|)?(?P{IDENTIFIER}|\*)' +# Attributes (`[attr]`, `[attr=value]`, etc.) +PAT_ATTR = fr'\[{WSC}*(?P(?:{IDENTIFIER}|\*)?\|)?(?P{IDENTIFIER}){ATTR}' +# Pseudo class (`:pseudo-class`, `:pseudo-class(`) +PAT_PSEUDO_CLASS = fr'(?P:{IDENTIFIER})(?P\({WSC}*)?' +# Pseudo class special patterns. Matches `:pseudo-class(` for special case pseudo classes. +PAT_PSEUDO_CLASS_SPECIAL = fr'(?P:{IDENTIFIER})(?P\({WSC}*)' +# Custom pseudo class (`:--custom-pseudo`) +PAT_PSEUDO_CLASS_CUSTOM = fr'(?P:(?=--){IDENTIFIER})' +# Closing pseudo group (`)`) +PAT_PSEUDO_CLOSE = fr'{WSC}*\)' +# Pseudo element (`::pseudo-element`) +PAT_PSEUDO_ELEMENT = fr':{PAT_PSEUDO_CLASS}' +# At rule (`@page`, etc.) (not supported) +PAT_AT_RULE = fr'@P{IDENTIFIER}' +# Pseudo class `nth-child` (`:nth-child(an+b [of S]?)`, `:first-child`, etc.) +PAT_PSEUDO_NTH_CHILD = fr''' +(?P{PAT_PSEUDO_CLASS_SPECIAL} +(?P{NTH}|even|odd))(?:{WSC}*\)|(?P{COMMENTS}*{WS}{WSC}*of{COMMENTS}*{WS}{WSC}*)) +''' +# Pseudo class `nth-of-type` (`:nth-of-type(an+b)`, `:first-of-type`, etc.) +PAT_PSEUDO_NTH_TYPE = fr''' +(?P{PAT_PSEUDO_CLASS_SPECIAL} +(?P{NTH}|even|odd)){WSC}*\) +''' +# Pseudo class language (`:lang("*-de", en)`) +PAT_PSEUDO_LANG = fr'{PAT_PSEUDO_CLASS_SPECIAL}(?P{VALUE}(?:{WSC}*,{WSC}*{VALUE})*){WSC}*\)' +# Pseudo class direction (`:dir(ltr)`) +PAT_PSEUDO_DIR = fr'{PAT_PSEUDO_CLASS_SPECIAL}(?Pltr|rtl){WSC}*\)' +# Combining characters (`>`, `~`, ` `, `+`, `,`) +PAT_COMBINE = fr'{WSC}*?(?P[,+>~]|{WS}(?![,+>~])){WSC}*' +# Extra: Contains (`:contains(text)`) +PAT_PSEUDO_CONTAINS = fr'{PAT_PSEUDO_CLASS_SPECIAL}(?P{VALUE}(?:{WSC}*,{WSC}*{VALUE})*){WSC}*\)' + +# Regular expressions +# CSS escape pattern +RE_CSS_ESC = re.compile(fr'(?:(\\[a-f0-9]{{1,6}}{WSC}?)|(\\[^\r\n\f])|(\\$))', re.I) +RE_CSS_STR_ESC = re.compile(fr'(?:(\\[a-f0-9]{{1,6}}{WS}?)|(\\[^\r\n\f])|(\\$)|(\\{NEWLINE}))', re.I) +# Pattern to break up `nth` specifiers +RE_NTH = re.compile(fr'(?P[-+])?(?P[0-9]+n?|n)(?:(?<=n){WSC}*(?P[-+]){WSC}*(?P[0-9]+))?', re.I) +# Pattern to iterate multiple values. +RE_VALUES = re.compile(fr'(?:(?P{VALUE})|(?P{WSC}*,{WSC}*))', re.X) +# Whitespace checks +RE_WS = re.compile(WS) +RE_WS_BEGIN = re.compile(fr'^{WSC}*') +RE_WS_END = re.compile(fr'{WSC}*$') +RE_CUSTOM = re.compile(fr'^{PAT_PSEUDO_CLASS_CUSTOM}$', re.X) + +# Constants +# List split token +COMMA_COMBINATOR = ',' +# Relation token for descendant +WS_COMBINATOR = " " + +# Parse flags +FLG_PSEUDO = 0x01 +FLG_NOT = 0x02 +FLG_RELATIVE = 0x04 +FLG_DEFAULT = 0x08 +FLG_HTML = 0x10 +FLG_INDETERMINATE = 0x20 +FLG_OPEN = 0x40 +FLG_IN_RANGE = 0x80 +FLG_OUT_OF_RANGE = 0x100 +FLG_PLACEHOLDER_SHOWN = 0x200 +FLG_FORGIVE = 0x400 + +# Maximum cached patterns to store +_MAXCACHE = 500 + + +@lru_cache(maxsize=_MAXCACHE) +def _cached_css_compile( + pattern: str, + namespaces: ct.Namespaces | None, + custom: ct.CustomSelectors | None, + flags: int +) -> cm.SoupSieve: + """Cached CSS compile.""" + + custom_selectors = process_custom(custom) + return cm.SoupSieve( + pattern, + CSSParser( + pattern, + custom=custom_selectors, + flags=flags + ).process_selectors(), + namespaces, + custom, + flags + ) + + +def _purge_cache() -> None: + """Purge the cache.""" + + _cached_css_compile.cache_clear() + + +def process_custom(custom: ct.CustomSelectors | None) -> dict[str, str | ct.SelectorList]: + """Process custom.""" + + custom_selectors = {} + if custom is not None: + for key, value in custom.items(): + name = util.lower(key) + if RE_CUSTOM.match(name) is None: + raise SelectorSyntaxError(f"The name '{name}' is not a valid custom pseudo-class name") + if name in custom_selectors: + raise KeyError(f"The custom selector '{name}' has already been registered") + custom_selectors[css_unescape(name)] = value + return custom_selectors + + +def css_unescape(content: str, string: bool = False) -> str: + """ + Unescape CSS value. + + Strings allow for spanning the value on multiple strings by escaping a new line. + """ + + def replace(m: Match[str]) -> str: + """Replace with the appropriate substitute.""" + + if m.group(1): + codepoint = int(m.group(1)[1:], 16) + if codepoint == 0: + codepoint = UNICODE_REPLACEMENT_CHAR + value = chr(codepoint) + elif m.group(2): + value = m.group(2)[1:] + elif m.group(3): + value = '\ufffd' + else: + value = '' + + return value + + return (RE_CSS_ESC if not string else RE_CSS_STR_ESC).sub(replace, content) + + +def escape(ident: str) -> str: + """Escape identifier.""" + + string = [] + length = len(ident) + start_dash = length > 0 and ident[0] == '-' + if length == 1 and start_dash: + # Need to escape identifier that is a single `-` with no other characters + string.append(f'\\{ident}') + else: + for index, c in enumerate(ident): + codepoint = ord(c) + if codepoint == 0x00: + string.append('\ufffd') + elif (0x01 <= codepoint <= 0x1F) or codepoint == 0x7F: + string.append(f'\\{codepoint:x} ') + elif (index == 0 or (start_dash and index == 1)) and (0x30 <= codepoint <= 0x39): + string.append(f'\\{codepoint:x} ') + elif ( + codepoint in (0x2D, 0x5F) or codepoint >= 0x80 or (0x30 <= codepoint <= 0x39) or + (0x30 <= codepoint <= 0x39) or (0x41 <= codepoint <= 0x5A) or (0x61 <= codepoint <= 0x7A) + ): + string.append(c) + else: + string.append(f'\\{c}') + return ''.join(string) + + +class SelectorPattern: + """Selector pattern.""" + + def __init__(self, name: str, pattern: str) -> None: + """Initialize.""" + + self.name = name + self.re_pattern = re.compile(pattern, re.I | re.X | re.U) + + def get_name(self) -> str: + """Get name.""" + + return self.name + + def match(self, selector: str, index: int, flags: int) -> Match[str] | None: + """Match the selector.""" + + return self.re_pattern.match(selector, index) + + +class SpecialPseudoPattern(SelectorPattern): + """Selector pattern.""" + + def __init__(self, patterns: tuple[tuple[str, tuple[str, ...], str, type[SelectorPattern]], ...]) -> None: + """Initialize.""" + + self.patterns = {} + for p in patterns: + name = p[0] + pattern = p[3](name, p[2]) + for pseudo in p[1]: + self.patterns[pseudo] = pattern + + self.matched_name = None # type: SelectorPattern | None + self.re_pseudo_name = re.compile(PAT_PSEUDO_CLASS_SPECIAL, re.I | re.X | re.U) + + def get_name(self) -> str: + """Get name.""" + + return '' if self.matched_name is None else self.matched_name.get_name() + + def match(self, selector: str, index: int, flags: int) -> Match[str] | None: + """Match the selector.""" + + pseudo = None + m = self.re_pseudo_name.match(selector, index) + if m: + name = util.lower(css_unescape(m.group('name'))) + pattern = self.patterns.get(name) + if pattern: + pseudo = pattern.match(selector, index, flags) + if pseudo: + self.matched_name = pattern + + return pseudo + + +class _Selector: + """ + Intermediate selector class. + + This stores selector data for a compound selector as we are acquiring them. + Once we are done collecting the data for a compound selector, we freeze + the data in an object that can be pickled and hashed. + """ + + def __init__(self, **kwargs: Any) -> None: + """Initialize.""" + + self.tag = kwargs.get('tag', None) # type: ct.SelectorTag | None + self.ids = kwargs.get('ids', []) # type: list[str] + self.classes = kwargs.get('classes', []) # type: list[str] + self.attributes = kwargs.get('attributes', []) # type: list[ct.SelectorAttribute] + self.nth = kwargs.get('nth', []) # type: list[ct.SelectorNth] + self.selectors = kwargs.get('selectors', []) # type: list[ct.SelectorList] + self.relations = kwargs.get('relations', []) # type: list[_Selector] + self.rel_type = kwargs.get('rel_type', None) # type: str | None + self.contains = kwargs.get('contains', []) # type: list[ct.SelectorContains] + self.lang = kwargs.get('lang', []) # type: list[ct.SelectorLang] + self.flags = kwargs.get('flags', 0) # type: int + self.no_match = kwargs.get('no_match', False) # type: bool + + def _freeze_relations(self, relations: list[_Selector]) -> ct.SelectorList: + """Freeze relation.""" + + if relations: + sel = relations[0] + sel.relations.extend(relations[1:]) + return ct.SelectorList([sel.freeze()]) + else: + return ct.SelectorList() + + def freeze(self) -> ct.Selector | ct.SelectorNull: + """Freeze self.""" + + if self.no_match: + return ct.SelectorNull() + else: + return ct.Selector( + self.tag, + tuple(self.ids), + tuple(self.classes), + tuple(self.attributes), + tuple(self.nth), + tuple(self.selectors), + self._freeze_relations(self.relations), + self.rel_type, + tuple(self.contains), + tuple(self.lang), + self.flags + ) + + def __str__(self) -> str: # pragma: no cover + """String representation.""" + + return ( + f'_Selector(tag={self.tag!r}, ids={self.ids!r}, classes={self.classes!r}, attributes={self.attributes!r}, ' + f'nth={self.nth!r}, selectors={self.selectors!r}, relations={self.relations!r}, ' + f'rel_type={self.rel_type!r}, contains={self.contains!r}, lang={self.lang!r}, flags={self.flags!r}, ' + f'no_match={self.no_match!r})' + ) + + __repr__ = __str__ + + +class CSSParser: + """Parse CSS selectors.""" + + css_tokens = ( + SelectorPattern("pseudo_close", PAT_PSEUDO_CLOSE), + SpecialPseudoPattern( + ( + ( + "pseudo_contains", + (':contains', ':-soup-contains', ':-soup-contains-own'), + PAT_PSEUDO_CONTAINS, + SelectorPattern + ), + ("pseudo_nth_child", (':nth-child', ':nth-last-child'), PAT_PSEUDO_NTH_CHILD, SelectorPattern), + ("pseudo_nth_type", (':nth-of-type', ':nth-last-of-type'), PAT_PSEUDO_NTH_TYPE, SelectorPattern), + ("pseudo_lang", (':lang',), PAT_PSEUDO_LANG, SelectorPattern), + ("pseudo_dir", (':dir',), PAT_PSEUDO_DIR, SelectorPattern) + ) + ), + SelectorPattern("pseudo_class_custom", PAT_PSEUDO_CLASS_CUSTOM), + SelectorPattern("pseudo_class", PAT_PSEUDO_CLASS), + SelectorPattern("pseudo_element", PAT_PSEUDO_ELEMENT), + SelectorPattern("at_rule", PAT_AT_RULE), + SelectorPattern("id", PAT_ID), + SelectorPattern("class", PAT_CLASS), + SelectorPattern("tag", PAT_TAG), + SelectorPattern("attribute", PAT_ATTR), + SelectorPattern("combine", PAT_COMBINE) + ) + + def __init__( + self, + selector: str, + custom: dict[str, str | ct.SelectorList] | None = None, + flags: int = 0 + ) -> None: + """Initialize.""" + + self.pattern = selector.replace('\x00', '\ufffd') + self.flags = flags + self.debug = self.flags & util.DEBUG + self.custom = {} if custom is None else custom + + def parse_attribute_selector(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """Create attribute selector from the returned regex match.""" + + inverse = False + op = m.group('cmp') + case = util.lower(m.group('case')) if m.group('case') else None + ns = css_unescape(m.group('attr_ns')[:-1]) if m.group('attr_ns') else '' + attr = css_unescape(m.group('attr_name')) + is_type = False + pattern2 = None + value = '' + + if case: + flags = (re.I if case == 'i' else 0) | re.DOTALL + elif util.lower(attr) == 'type': + flags = re.I | re.DOTALL + is_type = True + else: + flags = re.DOTALL + + if op: + if m.group('value').startswith(('"', "'")): + value = css_unescape(m.group('value')[1:-1], True) + else: + value = css_unescape(m.group('value')) + + if not op: + # Attribute name + pattern = None + elif op.startswith('^'): + # Value start with + pattern = re.compile(r'^%s.*' % re.escape(value), flags) + elif op.startswith('$'): + # Value ends with + pattern = re.compile(r'.*?%s$' % re.escape(value), flags) + elif op.startswith('*'): + # Value contains + pattern = re.compile(r'.*?%s.*' % re.escape(value), flags) + elif op.startswith('~'): + # Value contains word within space separated list + # `~=` should match nothing if it is empty or contains whitespace, + # so if either of these cases is present, use `[^\s\S]` which cannot be matched. + value = r'[^\s\S]' if not value or RE_WS.search(value) else re.escape(value) + pattern = re.compile(r'.*?(?:(?<=^)|(?<=[ \t\r\n\f]))%s(?=(?:[ \t\r\n\f]|$)).*' % value, flags) + elif op.startswith('|'): + # Value starts with word in dash separated list + pattern = re.compile(r'^%s(?:-.*)?$' % re.escape(value), flags) + else: + # Value matches + pattern = re.compile(r'^%s$' % re.escape(value), flags) + if op.startswith('!'): + # Equivalent to `:not([attr=value])` + inverse = True + if is_type and pattern: + pattern2 = re.compile(pattern.pattern) + + # Append the attribute selector + sel_attr = ct.SelectorAttribute(attr, ns, pattern, pattern2) + if inverse: + # If we are using `!=`, we need to nest the pattern under a `:not()`. + sub_sel = _Selector() + sub_sel.attributes.append(sel_attr) + not_list = ct.SelectorList([sub_sel.freeze()], True, False) + sel.selectors.append(not_list) + else: + sel.attributes.append(sel_attr) + + has_selector = True + return has_selector + + def parse_tag_pattern(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """Parse tag pattern from regex match.""" + + prefix = css_unescape(m.group('tag_ns')[:-1]) if m.group('tag_ns') else None + tag = css_unescape(m.group('tag_name')) + sel.tag = ct.SelectorTag(tag, prefix) + has_selector = True + return has_selector + + def parse_pseudo_class_custom(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """ + Parse custom pseudo class alias. + + Compile custom selectors as we need them. When compiling a custom selector, + set it to `None` in the dictionary so we can avoid an infinite loop. + """ + + pseudo = util.lower(css_unescape(m.group('name'))) + selector = self.custom.get(pseudo) + if selector is None: + raise SelectorSyntaxError( + f"Undefined custom selector '{pseudo}' found at position {m.end(0)}", + self.pattern, + m.end(0) + ) + + if not isinstance(selector, ct.SelectorList): + del self.custom[pseudo] + selector = CSSParser( + selector, custom=self.custom, flags=self.flags + ).process_selectors(flags=FLG_PSEUDO) + self.custom[pseudo] = selector + + sel.selectors.append(selector) + has_selector = True + return has_selector + + def parse_pseudo_class( + self, + sel: _Selector, + m: Match[str], + has_selector: bool, + iselector: Iterator[tuple[str, Match[str]]], + is_html: bool + ) -> tuple[bool, bool]: + """Parse pseudo class.""" + + complex_pseudo = False + pseudo = util.lower(css_unescape(m.group('name'))) + if m.group('open'): + complex_pseudo = True + if complex_pseudo and pseudo in PSEUDO_COMPLEX: + has_selector = self.parse_pseudo_open(sel, pseudo, has_selector, iselector, m.end(0)) + elif not complex_pseudo and pseudo in PSEUDO_SIMPLE: + if pseudo == ':root': + sel.flags |= ct.SEL_ROOT + elif pseudo == ':defined': + sel.flags |= ct.SEL_DEFINED + is_html = True + elif pseudo == ':scope': + sel.flags |= ct.SEL_SCOPE + elif pseudo == ':empty': + sel.flags |= ct.SEL_EMPTY + elif pseudo in (':link', ':any-link'): + sel.selectors.append(CSS_LINK) + elif pseudo == ':checked': + sel.selectors.append(CSS_CHECKED) + elif pseudo == ':default': + sel.selectors.append(CSS_DEFAULT) + elif pseudo == ':indeterminate': + sel.selectors.append(CSS_INDETERMINATE) + elif pseudo == ":disabled": + sel.selectors.append(CSS_DISABLED) + elif pseudo == ":enabled": + sel.selectors.append(CSS_ENABLED) + elif pseudo == ":required": + sel.selectors.append(CSS_REQUIRED) + elif pseudo == ":optional": + sel.selectors.append(CSS_OPTIONAL) + elif pseudo == ":read-only": + sel.selectors.append(CSS_READ_ONLY) + elif pseudo == ":read-write": + sel.selectors.append(CSS_READ_WRITE) + elif pseudo == ":in-range": + sel.selectors.append(CSS_IN_RANGE) + elif pseudo == ":out-of-range": + sel.selectors.append(CSS_OUT_OF_RANGE) + elif pseudo == ":placeholder-shown": + sel.selectors.append(CSS_PLACEHOLDER_SHOWN) + elif pseudo == ':first-child': + sel.nth.append(ct.SelectorNth(1, False, 0, False, False, ct.SelectorList())) + elif pseudo == ':last-child': + sel.nth.append(ct.SelectorNth(1, False, 0, False, True, ct.SelectorList())) + elif pseudo == ':first-of-type': + sel.nth.append(ct.SelectorNth(1, False, 0, True, False, ct.SelectorList())) + elif pseudo == ':last-of-type': + sel.nth.append(ct.SelectorNth(1, False, 0, True, True, ct.SelectorList())) + elif pseudo == ':only-child': + sel.nth.extend( + [ + ct.SelectorNth(1, False, 0, False, False, ct.SelectorList()), + ct.SelectorNth(1, False, 0, False, True, ct.SelectorList()) + ] + ) + elif pseudo == ':only-of-type': + sel.nth.extend( + [ + ct.SelectorNth(1, False, 0, True, False, ct.SelectorList()), + ct.SelectorNth(1, False, 0, True, True, ct.SelectorList()) + ] + ) + has_selector = True + elif complex_pseudo and pseudo in PSEUDO_COMPLEX_NO_MATCH: + self.parse_selectors(iselector, m.end(0), FLG_PSEUDO | FLG_OPEN) + sel.no_match = True + has_selector = True + elif not complex_pseudo and pseudo in PSEUDO_SIMPLE_NO_MATCH: + sel.no_match = True + has_selector = True + elif pseudo in PSEUDO_SUPPORTED: + raise SelectorSyntaxError( + f"Invalid syntax for pseudo class '{pseudo}'", + self.pattern, + m.start(0) + ) + else: + raise NotImplementedError( + f"'{pseudo}' pseudo-class is not implemented at this time" + ) + + return has_selector, is_html + + def parse_pseudo_nth( + self, + sel: _Selector, + m: Match[str], + has_selector: bool, + iselector: Iterator[tuple[str, Match[str]]] + ) -> bool: + """Parse `nth` pseudo.""" + + mdict = m.groupdict() + if mdict.get('pseudo_nth_child'): + postfix = '_child' + else: + postfix = '_type' + mdict['name'] = util.lower(css_unescape(mdict['name'])) + content = util.lower(mdict.get('nth' + postfix)) + if content == 'even': + # 2n + s1 = 2 + s2 = 0 + var = True + elif content == 'odd': + # 2n+1 + s1 = 2 + s2 = 1 + var = True + else: + nth_parts = cast(Match[str], RE_NTH.match(content)) + _s1 = '-' if nth_parts.group('s1') and nth_parts.group('s1') == '-' else '' + a = nth_parts.group('a') + var = a.endswith('n') + if a.startswith('n'): + _s1 += '1' + elif var: + _s1 += a[:-1] + else: + _s1 += a + _s2 = '-' if nth_parts.group('s2') and nth_parts.group('s2') == '-' else '' + if nth_parts.group('b'): + _s2 += nth_parts.group('b') + else: + _s2 = '0' + s1 = int(_s1, 10) + s2 = int(_s2, 10) + + pseudo_sel = mdict['name'] + if postfix == '_child': + if m.group('of'): + # Parse the rest of `of S`. + nth_sel = self.parse_selectors(iselector, m.end(0), FLG_PSEUDO | FLG_OPEN) + else: + # Use default `*|*` for `of S`. + nth_sel = CSS_NTH_OF_S_DEFAULT + if pseudo_sel == ':nth-child': + sel.nth.append(ct.SelectorNth(s1, var, s2, False, False, nth_sel)) + elif pseudo_sel == ':nth-last-child': + sel.nth.append(ct.SelectorNth(s1, var, s2, False, True, nth_sel)) + else: + if pseudo_sel == ':nth-of-type': + sel.nth.append(ct.SelectorNth(s1, var, s2, True, False, ct.SelectorList())) + elif pseudo_sel == ':nth-last-of-type': + sel.nth.append(ct.SelectorNth(s1, var, s2, True, True, ct.SelectorList())) + has_selector = True + return has_selector + + def parse_pseudo_open( + self, + sel: _Selector, + name: str, + has_selector: bool, + iselector: Iterator[tuple[str, Match[str]]], + index: int + ) -> bool: + """Parse pseudo with opening bracket.""" + + flags = FLG_PSEUDO | FLG_OPEN + if name == ':not': + flags |= FLG_NOT + elif name == ':has': + flags |= FLG_RELATIVE + elif name in (':where', ':is'): + flags |= FLG_FORGIVE + + sel.selectors.append(self.parse_selectors(iselector, index, flags)) + has_selector = True + + return has_selector + + def parse_has_combinator( + self, + sel: _Selector, + m: Match[str], + has_selector: bool, + selectors: list[_Selector], + rel_type: str, + index: int + ) -> tuple[bool, _Selector, str]: + """Parse combinator tokens.""" + + combinator = m.group('relation').strip() + if not combinator: + combinator = WS_COMBINATOR + if combinator == COMMA_COMBINATOR: + sel.rel_type = rel_type + selectors[-1].relations.append(sel) + rel_type = ":" + WS_COMBINATOR + selectors.append(_Selector()) + else: + if has_selector: + # End the current selector and associate the leading combinator with this selector. + sel.rel_type = rel_type + selectors[-1].relations.append(sel) + elif rel_type[1:] != WS_COMBINATOR: + # It's impossible to have two whitespace combinators after each other as the patterns + # will gobble up trailing whitespace. It is also impossible to have a whitespace + # combinator after any other kind for the same reason. But we could have + # multiple non-whitespace combinators. So if the current combinator is not a whitespace, + # then we've hit the multiple combinator case, so we should fail. + raise SelectorSyntaxError( + f'The multiple combinators at position {index}', + self.pattern, + index + ) + + # Set the leading combinator for the next selector. + rel_type = ':' + combinator + + sel = _Selector() + has_selector = False + return has_selector, sel, rel_type + + def parse_combinator( + self, + sel: _Selector, + m: Match[str], + has_selector: bool, + selectors: list[_Selector], + relations: list[_Selector], + is_pseudo: bool, + is_forgive: bool, + index: int + ) -> tuple[bool, _Selector]: + """Parse combinator tokens.""" + + combinator = m.group('relation').strip() + if not combinator: + combinator = WS_COMBINATOR + if not has_selector: + if not is_forgive or combinator != COMMA_COMBINATOR: + raise SelectorSyntaxError( + f"The combinator '{combinator}' at position {index}, must have a selector before it", + self.pattern, + index + ) + + # If we are in a forgiving pseudo class, just make the selector a "no match" + if combinator == COMMA_COMBINATOR: + sel.no_match = True + del relations[:] + selectors.append(sel) + else: + if combinator == COMMA_COMBINATOR: + if not sel.tag and not is_pseudo: + # Implied `*` + sel.tag = ct.SelectorTag('*', None) + sel.relations.extend(relations) + selectors.append(sel) + del relations[:] + else: + sel.relations.extend(relations) + sel.rel_type = combinator + del relations[:] + relations.append(sel) + + sel = _Selector() + has_selector = False + + return has_selector, sel + + def parse_class_id(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """Parse HTML classes and ids.""" + + selector = m.group(0) + if selector.startswith('.'): + sel.classes.append(css_unescape(selector[1:])) + else: + sel.ids.append(css_unescape(selector[1:])) + has_selector = True + return has_selector + + def parse_pseudo_contains(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """Parse contains.""" + + pseudo = util.lower(css_unescape(m.group('name'))) + if pseudo == ":contains": + warnings.warn( # noqa: B028 + "The pseudo class ':contains' is deprecated, ':-soup-contains' should be used moving forward.", + FutureWarning + ) + contains_own = pseudo == ":-soup-contains-own" + values = css_unescape(m.group('values')) + patterns = [] + for token in RE_VALUES.finditer(values): + if token.group('split'): + continue + value = token.group('value') + if value.startswith(("'", '"')): + value = css_unescape(value[1:-1], True) + else: + value = css_unescape(value) + patterns.append(value) + sel.contains.append(ct.SelectorContains(patterns, contains_own)) + has_selector = True + return has_selector + + def parse_pseudo_lang(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """Parse pseudo language.""" + + values = m.group('values') + patterns = [] + for token in RE_VALUES.finditer(values): + if token.group('split'): + continue + value = token.group('value') + if value.startswith(('"', "'")): + value = css_unescape(value[1:-1], True) + else: + value = css_unescape(value) + + patterns.append(value) + + sel.lang.append(ct.SelectorLang(patterns)) + has_selector = True + + return has_selector + + def parse_pseudo_dir(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool: + """Parse pseudo direction.""" + + value = ct.SEL_DIR_LTR if util.lower(m.group('dir')) == 'ltr' else ct.SEL_DIR_RTL + sel.flags |= value + has_selector = True + return has_selector + + def parse_selectors( + self, + iselector: Iterator[tuple[str, Match[str]]], + index: int = 0, + flags: int = 0 + ) -> ct.SelectorList: + """Parse selectors.""" + + # Initialize important variables + sel = _Selector() + selectors = [] + has_selector = False + closed = False + relations = [] # type: list[_Selector] + rel_type = ":" + WS_COMBINATOR + + # Setup various flags + is_open = bool(flags & FLG_OPEN) + is_pseudo = bool(flags & FLG_PSEUDO) + is_relative = bool(flags & FLG_RELATIVE) + is_not = bool(flags & FLG_NOT) + is_html = bool(flags & FLG_HTML) + is_default = bool(flags & FLG_DEFAULT) + is_indeterminate = bool(flags & FLG_INDETERMINATE) + is_in_range = bool(flags & FLG_IN_RANGE) + is_out_of_range = bool(flags & FLG_OUT_OF_RANGE) + is_placeholder_shown = bool(flags & FLG_PLACEHOLDER_SHOWN) + is_forgive = bool(flags & FLG_FORGIVE) + + # Print out useful debug stuff + if self.debug: # pragma: no cover + if is_pseudo: + print(' is_pseudo: True') + if is_open: + print(' is_open: True') + if is_relative: + print(' is_relative: True') + if is_not: + print(' is_not: True') + if is_html: + print(' is_html: True') + if is_default: + print(' is_default: True') + if is_indeterminate: + print(' is_indeterminate: True') + if is_in_range: + print(' is_in_range: True') + if is_out_of_range: + print(' is_out_of_range: True') + if is_placeholder_shown: + print(' is_placeholder_shown: True') + if is_forgive: + print(' is_forgive: True') + + # The algorithm for relative selectors require an initial selector in the selector list + if is_relative: + selectors.append(_Selector()) + + try: + while True: + key, m = next(iselector) + + # Handle parts + if key == "at_rule": + raise NotImplementedError(f"At-rules found at position {m.start(0)}") + elif key == 'pseudo_class_custom': + has_selector = self.parse_pseudo_class_custom(sel, m, has_selector) + elif key == 'pseudo_class': + has_selector, is_html = self.parse_pseudo_class(sel, m, has_selector, iselector, is_html) + elif key == 'pseudo_element': + raise NotImplementedError(f"Pseudo-element found at position {m.start(0)}") + elif key == 'pseudo_contains': + has_selector = self.parse_pseudo_contains(sel, m, has_selector) + elif key in ('pseudo_nth_type', 'pseudo_nth_child'): + has_selector = self.parse_pseudo_nth(sel, m, has_selector, iselector) + elif key == 'pseudo_lang': + has_selector = self.parse_pseudo_lang(sel, m, has_selector) + elif key == 'pseudo_dir': + has_selector = self.parse_pseudo_dir(sel, m, has_selector) + # Currently only supports HTML + is_html = True + elif key == 'pseudo_close': + if not has_selector: + if not is_forgive: + raise SelectorSyntaxError( + f"Expected a selector at position {m.start(0)}", + self.pattern, + m.start(0) + ) + sel.no_match = True + if is_open: + closed = True + break + else: + raise SelectorSyntaxError( + f"Unmatched pseudo-class close at position {m.start(0)}", + self.pattern, + m.start(0) + ) + elif key == 'combine': + if is_relative: + has_selector, sel, rel_type = self.parse_has_combinator( + sel, m, has_selector, selectors, rel_type, index + ) + else: + has_selector, sel = self.parse_combinator( + sel, m, has_selector, selectors, relations, is_pseudo, is_forgive, index + ) + elif key == 'attribute': + has_selector = self.parse_attribute_selector(sel, m, has_selector) + elif key == 'tag': + if has_selector: + raise SelectorSyntaxError( + f"Tag name found at position {m.start(0)} instead of at the start", + self.pattern, + m.start(0) + ) + has_selector = self.parse_tag_pattern(sel, m, has_selector) + elif key in ('class', 'id'): + has_selector = self.parse_class_id(sel, m, has_selector) + + index = m.end(0) + except StopIteration: + pass + + # Handle selectors that are not closed + if is_open and not closed: + raise SelectorSyntaxError( + f"Unclosed pseudo-class at position {index}", + self.pattern, + index + ) + + # Cleanup completed selector piece + if has_selector: + if not sel.tag and not is_pseudo: + # Implied `*` + sel.tag = ct.SelectorTag('*', None) + if is_relative: + sel.rel_type = rel_type + selectors[-1].relations.append(sel) + else: + sel.relations.extend(relations) + del relations[:] + selectors.append(sel) + + # Forgive empty slots in pseudo-classes that have lists (and are forgiving) + elif is_forgive and (not selectors or not relations): + # Handle normal pseudo-classes with empty slots like `:is()` etc. + sel.no_match = True + del relations[:] + selectors.append(sel) + has_selector = True + + if not has_selector: + # We will always need to finish a selector when `:has()` is used as it leads with combining. + # May apply to others as well. + raise SelectorSyntaxError( + f'Expected a selector at position {index}', + self.pattern, + index + ) + + # Some patterns require additional logic, such as default. We try to make these the + # last pattern, and append the appropriate flag to that selector which communicates + # to the matcher what additional logic is required. + if is_default: + selectors[-1].flags = ct.SEL_DEFAULT + if is_indeterminate: + selectors[-1].flags = ct.SEL_INDETERMINATE + if is_in_range: + selectors[-1].flags = ct.SEL_IN_RANGE + if is_out_of_range: + selectors[-1].flags = ct.SEL_OUT_OF_RANGE + if is_placeholder_shown: + selectors[-1].flags = ct.SEL_PLACEHOLDER_SHOWN + + # Return selector list + return ct.SelectorList([s.freeze() for s in selectors], is_not, is_html) + + def selector_iter(self, pattern: str) -> Iterator[tuple[str, Match[str]]]: + """Iterate selector tokens.""" + + # Ignore whitespace and comments at start and end of pattern + m = RE_WS_BEGIN.search(pattern) + index = m.end(0) if m else 0 + m = RE_WS_END.search(pattern) + end = (m.start(0) - 1) if m else (len(pattern) - 1) + + if self.debug: # pragma: no cover + print(f'## PARSING: {pattern!r}') + while index <= end: + m = None + for v in self.css_tokens: + m = v.match(pattern, index, self.flags) + if m: + name = v.get_name() + if self.debug: # pragma: no cover + print(f"TOKEN: '{name}' --> {m.group(0)!r} at position {m.start(0)}") + index = m.end(0) + yield name, m + break + if m is None: + c = pattern[index] + # If the character represents the start of one of the known selector types, + # throw an exception mentioning that the known selector type is in error; + # otherwise, report the invalid character. + if c == '[': + msg = f"Malformed attribute selector at position {index}" + elif c == '.': + msg = f"Malformed class selector at position {index}" + elif c == '#': + msg = f"Malformed id selector at position {index}" + elif c == ':': + msg = f"Malformed pseudo-class selector at position {index}" + else: + msg = f"Invalid character {c!r} position {index}" + raise SelectorSyntaxError(msg, self.pattern, index) + if self.debug: # pragma: no cover + print('## END PARSING') + + def process_selectors(self, index: int = 0, flags: int = 0) -> ct.SelectorList: + """Process selectors.""" + + return self.parse_selectors(self.selector_iter(self.pattern), index, flags) + + +# Precompile CSS selector lists for pseudo-classes (additional logic may be required beyond the pattern) +# A few patterns are order dependent as they use patterns previous compiled. + +# CSS pattern for `:link` and `:any-link` +CSS_LINK = CSSParser( + 'html|*:is(a, area)[href]' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:checked` +CSS_CHECKED = CSSParser( + ''' + html|*:is(input[type=checkbox], input[type=radio])[checked], html|option[selected] + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:default` (must compile CSS_CHECKED first) +CSS_DEFAULT = CSSParser( + ''' + :checked, + + /* + This pattern must be at the end. + Special logic is applied to the last selector. + */ + html|form html|*:is(button, input)[type="submit"] + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_DEFAULT) +# CSS pattern for `:indeterminate` +CSS_INDETERMINATE = CSSParser( + ''' + html|input[type="checkbox"][indeterminate], + html|input[type="radio"]:is(:not([name]), [name=""]):not([checked]), + html|progress:not([value]), + + /* + This pattern must be at the end. + Special logic is applied to the last selector. + */ + html|input[type="radio"][name]:not([name='']):not([checked]) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_INDETERMINATE) +# CSS pattern for `:disabled` +CSS_DISABLED = CSSParser( + ''' + html|*:is(input:not([type=hidden]), button, select, textarea, fieldset, optgroup, option, fieldset)[disabled], + html|optgroup[disabled] > html|option, + html|fieldset[disabled] > html|*:is(input:not([type=hidden]), button, select, textarea, fieldset), + html|fieldset[disabled] > + html|*:not(legend:nth-of-type(1)) html|*:is(input:not([type=hidden]), button, select, textarea, fieldset) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:enabled` +CSS_ENABLED = CSSParser( + ''' + html|*:is(input:not([type=hidden]), button, select, textarea, fieldset, optgroup, option, fieldset):not(:disabled) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:required` +CSS_REQUIRED = CSSParser( + 'html|*:is(input, textarea, select)[required]' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:optional` +CSS_OPTIONAL = CSSParser( + 'html|*:is(input, textarea, select):not([required])' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:placeholder-shown` +CSS_PLACEHOLDER_SHOWN = CSSParser( + ''' + html|input:is( + :not([type]), + [type=""], + [type=text], + [type=search], + [type=url], + [type=tel], + [type=email], + [type=password], + [type=number] + )[placeholder]:not([placeholder='']):is(:not([value]), [value=""]), + html|textarea[placeholder]:not([placeholder='']) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_PLACEHOLDER_SHOWN) +# CSS pattern default for `:nth-child` "of S" feature +CSS_NTH_OF_S_DEFAULT = CSSParser( + '*|*' +).process_selectors(flags=FLG_PSEUDO) +# CSS pattern for `:read-write` (CSS_DISABLED must be compiled first) +CSS_READ_WRITE = CSSParser( + ''' + html|*:is( + textarea, + input:is( + :not([type]), + [type=""], + [type=text], + [type=search], + [type=url], + [type=tel], + [type=email], + [type=number], + [type=password], + [type=date], + [type=datetime-local], + [type=month], + [type=time], + [type=week] + ) + ):not([readonly], :disabled), + html|*:is([contenteditable=""], [contenteditable="true" i]) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:read-only` +CSS_READ_ONLY = CSSParser( + ''' + html|*:not(:read-write) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_HTML) +# CSS pattern for `:in-range` +CSS_IN_RANGE = CSSParser( + ''' + html|input:is( + [type="date"], + [type="month"], + [type="week"], + [type="time"], + [type="datetime-local"], + [type="number"], + [type="range"] + ):is( + [min], + [max] + ) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_IN_RANGE | FLG_HTML) +# CSS pattern for `:out-of-range` +CSS_OUT_OF_RANGE = CSSParser( + ''' + html|input:is( + [type="date"], + [type="month"], + [type="week"], + [type="time"], + [type="datetime-local"], + [type="number"], + [type="range"] + ):is( + [min], + [max] + ) + ''' +).process_selectors(flags=FLG_PSEUDO | FLG_OUT_OF_RANGE | FLG_HTML) diff --git a/shared/package-files/33/33451c69e142a8b3e01ac17c379987c3bb376ecae56c37c9636ba12e8cc9f7b2/blob b/shared/package-files/33/33451c69e142a8b3e01ac17c379987c3bb376ecae56c37c9636ba12e8cc9f7b2/blob new file mode 100644 index 0000000000000000000000000000000000000000..f40d7556dee87d2107f7b18708f03040bc04a3f2 --- /dev/null +++ b/shared/package-files/33/33451c69e142a8b3e01ac17c379987c3bb376ecae56c37c9636ba12e8cc9f7b2/blob @@ -0,0 +1,40 @@ +"""Static type stubs for `_compat.py`.""" + +# https://github.com/scikit-learn/scikit-learn/pull/27910#issuecomment-2568023972 +from __future__ import annotations + +from types import ModuleType + +# TODO import from typing (requires Python >=3.13) +from typing_extensions import TypeIs + +from ._typing import Array, Device + +# pylint: disable=missing-class-docstring,unused-argument + +class Namespace(ModuleType): + def device(self, x: Array, /) -> Device: ... + +def array_namespace( + *xs: Array | complex | None, + api_version: str | None = None, + use_compat: bool | None = None, +) -> Namespace: ... +def device(x: Array, /) -> Device: ... +def is_array_api_obj(x: object, /) -> TypeIs[Array]: ... +def is_array_api_strict_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_cupy_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_dask_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_jax_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_numpy_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_pydata_sparse_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_torch_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ... +def is_cupy_array(x: object, /) -> TypeIs[Array]: ... +def is_dask_array(x: object, /) -> TypeIs[Array]: ... +def is_jax_array(x: object, /) -> TypeIs[Array]: ... +def is_numpy_array(x: object, /) -> TypeIs[Array]: ... +def is_pydata_sparse_array(x: object, /) -> TypeIs[Array]: ... +def is_torch_array(x: object, /) -> TypeIs[Array]: ... +def is_lazy_array(x: object, /) -> TypeIs[Array]: ... +def is_writeable_array(x: object, /) -> TypeIs[Array]: ... +def size(x: Array, /) -> int | None: ... diff --git a/shared/package-files/33/3348b29618eeaad3dc6ceda901574383d9fd7b5113df9f6743db7138412b98ca/blob b/shared/package-files/33/3348b29618eeaad3dc6ceda901574383d9fd7b5113df9f6743db7138412b98ca/blob new file mode 100644 index 0000000000000000000000000000000000000000..3d79bdbfe83209f18b17cc8c7b245f322871d6c0 --- /dev/null +++ b/shared/package-files/33/3348b29618eeaad3dc6ceda901574383d9fd7b5113df9f6743db7138412b98ca/blob @@ -0,0 +1 @@ +from .modules import * # noqa: F403 diff --git a/shared/package-files/33/3348cd5dcc3c57790e839d3009ea86e17335a401228dc8666b1bb0cd3672d511/blob b/shared/package-files/33/3348cd5dcc3c57790e839d3009ea86e17335a401228dc8666b1bb0cd3672d511/blob new file mode 100644 index 0000000000000000000000000000000000000000..fb6909464ae2cba395abcfebcf93fe84f43d59e0 --- /dev/null +++ b/shared/package-files/33/3348cd5dcc3c57790e839d3009ea86e17335a401228dc8666b1bb0cd3672d511/blob @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor conv3d_symint(const at::Tensor & input, const at::Tensor & weight, const c10::optional & bias={}, c10::SymIntArrayRef stride=c10::SymInt(1), c10::SymIntArrayRef padding=c10::SymInt(0), c10::SymIntArrayRef dilation=c10::SymInt(1), c10::SymInt groups=1); +TORCH_API at::Tensor conv3d_padding_symint(const at::Tensor & input, const at::Tensor & weight, const c10::optional & bias={}, c10::SymIntArrayRef stride=c10::SymInt(1), c10::string_view padding="valid", c10::SymIntArrayRef dilation=c10::SymInt(1), c10::SymInt groups=1); +} // namespace native +} // namespace at diff --git a/shared/package-files/33/3349234293250680229ba3ddc3cbb716a508a17cf853046fe264b35cf24f238e/blob b/shared/package-files/33/3349234293250680229ba3ddc3cbb716a508a17cf853046fe264b35cf24f238e/blob new file mode 100644 index 0000000000000000000000000000000000000000..a2a878d54156f7fb54ad31c1c109f7a5be23e0ee --- /dev/null +++ b/shared/package-files/33/3349234293250680229ba3ddc3cbb716a508a17cf853046fe264b35cf24f238e/blob @@ -0,0 +1,189 @@ +""" +Common functionality between the PDF and PS backends. +""" + +from io import BytesIO +import functools +import logging + +from fontTools import subset + +import matplotlib as mpl +from .. import font_manager, ft2font +from .._afm import AFM +from ..backend_bases import RendererBase + + +@functools.lru_cache(50) +def _cached_get_afm_from_fname(fname): + with open(fname, "rb") as fh: + return AFM(fh) + + +def get_glyphs_subset(fontfile, characters): + """ + Subset a TTF font + + Reads the named fontfile and restricts the font to the characters. + + Parameters + ---------- + fontfile : str + Path to the font file + characters : str + Continuous set of characters to include in subset + + Returns + ------- + fontTools.ttLib.ttFont.TTFont + An open font object representing the subset, which needs to + be closed by the caller. + """ + + options = subset.Options(glyph_names=True, recommended_glyphs=True) + + # Prevent subsetting extra tables. + options.drop_tables += [ + 'FFTM', # FontForge Timestamp. + 'PfEd', # FontForge personal table. + 'BDF', # X11 BDF header. + 'meta', # Metadata stores design/supported languages (meaningless for subsets). + 'MERG', # Merge Table. + 'TSIV', # Microsoft Visual TrueType extension. + 'Zapf', # Information about the individual glyphs in the font. + 'bdat', # The bitmap data table. + 'bloc', # The bitmap location table. + 'cidg', # CID to Glyph ID table (Apple Advanced Typography). + 'fdsc', # The font descriptors table. + 'feat', # Feature name table (Apple Advanced Typography). + 'fmtx', # The Font Metrics Table. + 'fond', # Data-fork font information (Apple Advanced Typography). + 'just', # The justification table (Apple Advanced Typography). + 'kerx', # An extended kerning table (Apple Advanced Typography). + 'ltag', # Language Tag. + 'morx', # Extended Glyph Metamorphosis Table. + 'trak', # Tracking table. + 'xref', # The cross-reference table (some Apple font tooling information). + ] + # if fontfile is a ttc, specify font number + if fontfile.endswith(".ttc"): + options.font_number = 0 + + font = subset.load_font(fontfile, options) + subsetter = subset.Subsetter(options=options) + subsetter.populate(text=characters) + subsetter.subset(font) + return font + + +def font_as_file(font): + """ + Convert a TTFont object into a file-like object. + + Parameters + ---------- + font : fontTools.ttLib.ttFont.TTFont + A font object + + Returns + ------- + BytesIO + A file object with the font saved into it + """ + fh = BytesIO() + font.save(fh, reorderTables=False) + return fh + + +class CharacterTracker: + """ + Helper for font subsetting by the pdf and ps backends. + + Maintains a mapping of font paths to the set of character codepoints that + are being used from that font. + """ + + def __init__(self): + self.used = {} + + def track(self, font, s): + """Record that string *s* is being typeset using font *font*.""" + char_to_font = font._get_fontmap(s) + for _c, _f in char_to_font.items(): + self.used.setdefault(_f.fname, set()).add(ord(_c)) + + def track_glyph(self, font, glyph): + """Record that codepoint *glyph* is being typeset using font *font*.""" + self.used.setdefault(font.fname, set()).add(glyph) + + +class RendererPDFPSBase(RendererBase): + # The following attributes must be defined by the subclasses: + # - _afm_font_dir + # - _use_afm_rc_name + + def __init__(self, width, height): + super().__init__() + self.width = width + self.height = height + + def flipy(self): + # docstring inherited + return False # y increases from bottom to top. + + def option_scale_image(self): + # docstring inherited + return True # PDF and PS support arbitrary image scaling. + + def option_image_nocomposite(self): + # docstring inherited + # Decide whether to composite image based on rcParam value. + return not mpl.rcParams["image.composite_image"] + + def get_canvas_width_height(self): + # docstring inherited + return self.width * 72.0, self.height * 72.0 + + def get_text_width_height_descent(self, s, prop, ismath): + # docstring inherited + if ismath == "TeX": + return super().get_text_width_height_descent(s, prop, ismath) + elif ismath: + parse = self._text2path.mathtext_parser.parse(s, 72, prop) + return parse.width, parse.height, parse.depth + elif mpl.rcParams[self._use_afm_rc_name]: + font = self._get_font_afm(prop) + l, b, w, h, d = font.get_str_bbox_and_descent(s) + scale = prop.get_size_in_points() / 1000 + w *= scale + h *= scale + d *= scale + return w, h, d + else: + font = self._get_font_ttf(prop) + font.set_text(s, 0.0, flags=ft2font.LoadFlags.NO_HINTING) + w, h = font.get_width_height() + d = font.get_descent() + scale = 1 / 64 + w *= scale + h *= scale + d *= scale + return w, h, d + + def _get_font_afm(self, prop): + fname = font_manager.findfont( + prop, fontext="afm", directory=self._afm_font_dir) + return _cached_get_afm_from_fname(fname) + + def _get_font_ttf(self, prop): + fnames = font_manager.fontManager._find_fonts_by_props(prop) + try: + font = font_manager.get_font(fnames) + font.clear() + font.set_size(prop.get_size_in_points(), 72) + return font + except RuntimeError: + logging.getLogger(__name__).warning( + "The PostScript/PDF backend does not currently " + "support the selected font (%s).", fnames) + raise diff --git a/shared/package-files/33/334b52745a1434c677fadeed0991dc8144b7ee2058cd9af335a0ee8b8696a11e/blob b/shared/package-files/33/334b52745a1434c677fadeed0991dc8144b7ee2058cd9af335a0ee8b8696a11e/blob new file mode 100644 index 0000000000000000000000000000000000000000..28c4035c3876b48b14186a88c9d77aae85a69207 --- /dev/null +++ b/shared/package-files/33/334b52745a1434c677fadeed0991dc8144b7ee2058cd9af335a0ee8b8696a11e/blob @@ -0,0 +1,733 @@ + YR MON NINO1+2 ANOM NINO3 ANOM NINO4 ANOM NINO3.4 ANOM +1950 1 23.11 -1.42 23.74 -1.91 27.03 -1.12 24.83 -1.72 +1950 2 24.20 -1.71 24.92 -1.45 27.15 -0.92 25.20 -1.53 +1950 3 25.37 -1.00 26.33 -0.80 27.06 -1.11 26.03 -1.20 +1950 4 23.86 -1.71 26.46 -0.97 27.29 -1.10 26.36 -1.30 +1950 5 23.03 -1.39 25.72 -1.38 27.59 -1.10 26.19 -1.58 +1950 6 21.57 -1.50 25.55 -0.92 27.97 -0.70 26.52 -1.01 +1950 7 20.63 -1.34 24.97 -0.68 27.83 -0.78 26.42 -0.69 +1950 8 20.15 -0.86 24.61 -0.45 27.72 -0.78 25.98 -0.77 +1950 9 19.67 -1.10 24.22 -0.72 27.66 -0.85 25.78 -0.92 +1950 10 20.03 -1.04 24.39 -0.56 27.44 -1.07 25.96 -0.68 +1950 11 20.02 -1.72 24.00 -1.05 27.35 -1.11 25.64 -0.96 +1950 12 21.80 -1.11 24.30 -0.91 27.30 -1.05 25.50 -1.07 +1951 1 24.19 -0.35 25.00 -0.65 27.36 -0.79 25.46 -1.09 +1951 2 25.28 -0.64 25.80 -0.57 27.27 -0.80 25.78 -0.96 +1951 3 25.60 -0.78 26.91 -0.22 27.96 -0.21 26.72 -0.51 +1951 4 25.37 -0.20 27.31 -0.11 28.49 0.09 27.24 -0.43 +1951 5 24.79 0.37 27.08 -0.02 29.04 0.35 27.68 -0.09 +1951 6 24.69 1.62 26.57 0.10 28.74 0.07 27.46 -0.07 +1951 7 23.86 1.88 26.54 0.89 28.82 0.21 27.72 0.61 +1951 8 22.32 1.31 25.67 0.62 28.53 0.04 27.36 0.61 +1951 9 21.44 0.67 25.56 0.62 28.62 0.11 27.51 0.81 +1951 10 21.77 0.70 25.85 0.90 28.71 0.20 27.43 0.78 +1951 11 22.33 0.59 26.18 1.13 28.74 0.29 27.48 0.87 +1951 12 22.89 -0.01 25.98 0.77 28.53 0.19 27.12 0.55 +1952 1 24.52 -0.02 25.85 0.20 28.35 0.19 26.85 0.30 +1952 2 26.21 0.29 26.46 0.08 28.08 0.00 26.79 0.06 +1952 3 26.37 0.00 27.18 0.05 28.10 -0.07 27.32 0.09 +1952 4 24.73 -0.84 27.41 -0.02 28.52 0.12 27.88 0.21 +1952 5 23.71 -0.71 26.92 -0.18 28.69 -0.01 27.99 0.21 +1952 6 22.34 -0.73 25.84 -0.63 28.47 -0.20 27.33 -0.20 +1952 7 20.89 -1.09 24.92 -0.73 28.24 -0.37 26.72 -0.38 +1952 8 20.02 -0.99 24.50 -0.56 28.09 -0.40 26.46 -0.29 +1952 9 19.63 -1.14 24.43 -0.51 28.55 0.04 26.54 -0.17 +1952 10 20.40 -0.67 24.52 -0.42 28.25 -0.26 26.54 -0.10 +1952 11 20.77 -0.97 24.36 -0.69 28.28 -0.17 26.36 -0.24 +1952 12 22.39 -0.52 24.88 -0.33 28.30 -0.04 26.53 -0.04 +1953 1 24.15 -0.39 25.77 0.11 28.31 0.15 26.85 0.29 +1953 2 26.34 0.42 26.74 0.36 28.26 0.18 27.19 0.45 +1953 3 27.36 0.98 27.57 0.44 28.10 -0.07 27.68 0.45 +1953 4 27.03 1.46 27.91 0.49 28.53 0.14 28.19 0.53 +1953 5 25.47 1.05 27.39 0.28 28.92 0.23 28.29 0.52 +1953 6 23.49 0.42 26.77 0.30 29.18 0.51 28.02 0.49 +1953 7 22.20 0.23 25.81 0.16 29.02 0.41 27.52 0.42 +1953 8 21.45 0.44 25.20 0.14 28.83 0.34 27.16 0.41 +1953 9 21.25 0.49 25.17 0.24 28.61 0.09 27.13 0.43 +1953 10 20.95 -0.12 25.07 0.13 28.91 0.41 27.02 0.38 +1953 11 21.60 -0.14 25.25 0.19 28.91 0.46 26.96 0.36 +1953 12 22.44 -0.47 25.55 0.34 28.74 0.40 26.99 0.42 +1954 1 23.02 -1.52 25.73 0.07 28.30 0.14 27.03 0.47 +1954 2 25.00 -0.92 26.43 0.05 28.16 0.08 27.22 0.48 +1954 3 25.33 -1.05 26.85 -0.28 27.89 -0.28 27.21 -0.02 +1954 4 22.97 -2.60 25.85 -1.57 28.20 -0.19 26.87 -0.80 +1954 5 21.73 -2.69 25.67 -1.44 28.40 -0.30 27.06 -0.71 +1954 6 20.77 -2.30 25.20 -1.27 28.32 -0.35 26.93 -0.60 +1954 7 19.52 -2.46 24.47 -1.17 28.00 -0.61 26.37 -0.74 +1954 8 19.33 -1.68 23.83 -1.23 27.76 -0.73 25.73 -1.02 +1954 9 18.95 -1.82 23.51 -1.43 27.61 -0.90 25.38 -1.33 +1954 10 19.11 -1.96 23.63 -1.31 27.54 -0.97 25.51 -1.13 +1954 11 20.27 -1.47 23.86 -1.19 27.53 -0.92 25.67 -0.93 +1954 12 21.30 -1.61 23.79 -1.42 27.61 -0.74 25.37 -1.20 +1955 1 23.75 -0.79 24.79 -0.86 27.60 -0.56 25.54 -1.02 +1955 2 24.82 -1.10 25.76 -0.62 27.30 -0.77 25.90 -0.84 +1955 3 25.14 -1.23 26.35 -0.78 27.37 -0.81 26.37 -0.86 +1955 4 24.22 -1.35 26.32 -1.11 27.82 -0.57 26.66 -1.01 +1955 5 22.16 -2.26 25.52 -1.58 28.03 -0.66 26.66 -1.11 +1955 6 21.20 -1.87 25.08 -1.39 28.08 -0.59 26.56 -0.97 +1955 7 20.46 -1.52 24.55 -1.10 28.14 -0.47 26.31 -0.80 +1955 8 19.63 -1.38 23.69 -1.37 27.94 -0.55 25.60 -1.15 +1955 9 19.24 -1.53 23.36 -1.57 27.71 -0.81 25.63 -1.07 +1955 10 19.16 -1.91 22.71 -2.24 27.22 -1.29 24.66 -1.98 +1955 11 19.84 -1.90 22.66 -2.39 26.79 -1.66 24.29 -2.32 +1955 12 21.19 -1.71 23.08 -2.13 27.20 -1.15 24.58 -1.99 +1956 1 23.24 -1.30 24.47 -1.18 27.18 -0.97 25.28 -1.27 +1956 2 24.71 -1.20 25.80 -0.57 27.27 -0.81 26.00 -0.73 +1956 3 25.90 -0.47 26.84 -0.29 27.49 -0.68 26.62 -0.61 +1956 4 24.66 -0.91 27.12 -0.30 27.72 -0.68 26.96 -0.70 +1956 5 23.14 -1.28 26.63 -0.47 28.11 -0.58 27.23 -0.54 +1956 6 22.04 -1.03 25.87 -0.60 28.22 -0.46 26.99 -0.54 +1956 7 21.47 -0.51 24.82 -0.82 28.07 -0.54 26.37 -0.73 +1956 8 20.55 -0.46 24.16 -0.90 27.67 -0.82 25.91 -0.84 +1956 9 19.89 -0.88 23.97 -0.97 27.71 -0.80 25.91 -0.79 +1956 10 19.69 -1.39 24.01 -0.94 27.92 -0.59 25.83 -0.81 +1956 11 20.57 -1.17 23.91 -1.14 28.02 -0.43 25.64 -0.97 +1956 12 21.58 -1.32 24.06 -1.15 28.09 -0.26 25.71 -0.86 +1957 1 23.13 -1.40 25.05 -0.60 28.03 -0.12 26.09 -0.47 +1957 2 26.30 0.38 26.23 -0.15 28.10 0.02 26.58 -0.16 +1957 3 27.63 1.26 27.55 0.42 28.33 0.16 27.65 0.41 +1957 4 27.15 1.59 27.94 0.51 28.86 0.47 28.34 0.68 +1957 5 26.72 2.30 27.81 0.71 29.15 0.46 28.59 0.82 +1957 6 25.04 1.97 27.30 0.84 28.83 0.16 28.28 0.75 +1957 7 23.83 1.85 26.95 1.31 28.73 0.12 28.11 1.00 +1957 8 22.34 1.33 26.14 1.08 28.91 0.41 27.75 1.00 +1957 9 21.80 1.03 25.71 0.77 28.96 0.45 27.54 0.84 +1957 10 21.80 0.73 25.68 0.74 29.12 0.61 27.49 0.85 +1957 11 22.39 0.65 26.23 1.18 29.12 0.67 27.79 1.19 +1957 12 23.69 0.78 26.64 1.43 29.08 0.74 28.08 1.51 +1958 1 24.89 0.35 27.04 1.38 29.26 1.10 28.37 1.81 +1958 2 26.55 0.63 27.57 1.20 29.28 1.21 28.41 1.68 +1958 3 27.09 0.72 27.85 0.72 29.04 0.86 28.34 1.11 +1958 4 26.37 0.80 27.86 0.44 29.04 0.65 28.35 0.69 +1958 5 24.71 0.29 27.39 0.28 29.21 0.52 28.35 0.57 +1958 6 23.23 0.16 26.70 0.23 29.13 0.46 28.05 0.52 +1958 7 22.31 0.33 25.73 0.09 28.89 0.28 27.48 0.37 +1958 8 20.72 -0.29 24.97 -0.08 28.53 0.04 26.90 0.15 +1958 9 20.62 -0.14 24.45 -0.48 28.50 -0.02 26.50 -0.20 +1958 10 21.05 -0.02 24.65 -0.30 28.68 0.17 26.61 -0.03 +1958 11 21.52 -0.22 25.06 0.01 28.79 0.34 26.89 0.29 +1958 12 22.50 -0.40 25.02 -0.19 28.76 0.41 26.77 0.20 +1959 1 23.97 -0.57 25.75 0.10 28.63 0.48 27.14 0.58 +1959 2 25.90 -0.01 26.50 0.13 28.38 0.31 27.25 0.51 +1959 3 26.94 0.56 27.17 0.04 28.48 0.31 27.55 0.32 +1959 4 25.84 0.27 27.56 0.14 28.75 0.36 27.93 0.27 +1959 5 24.23 -0.19 26.94 -0.16 28.85 0.16 27.80 0.03 +1959 6 22.57 -0.50 26.07 -0.39 28.39 -0.28 27.34 -0.19 +1959 7 21.50 -0.47 24.94 -0.71 28.30 -0.31 26.56 -0.55 +1959 8 20.15 -0.86 24.40 -0.66 28.27 -0.22 26.32 -0.43 +1959 9 20.23 -0.54 24.37 -0.57 28.19 -0.32 26.17 -0.53 +1959 10 20.86 -0.21 24.67 -0.28 28.21 -0.30 26.42 -0.22 +1959 11 21.88 0.14 24.74 -0.31 28.12 -0.34 26.32 -0.28 +1959 12 22.55 -0.36 24.94 -0.27 28.07 -0.27 26.44 -0.13 +1960 1 24.40 -0.14 25.34 -0.32 27.77 -0.38 26.25 -0.31 +1960 2 25.59 -0.32 25.87 -0.50 27.49 -0.58 26.27 -0.47 +1960 3 26.01 -0.36 26.75 -0.38 27.77 -0.40 26.97 -0.26 +1960 4 24.66 -0.91 27.03 -0.39 28.08 -0.31 27.51 -0.16 +1960 5 23.53 -0.89 26.66 -0.45 28.52 -0.18 27.62 -0.16 +1960 6 21.83 -1.24 25.95 -0.52 28.35 -0.32 27.24 -0.29 +1960 7 20.73 -1.25 25.38 -0.26 28.31 -0.30 27.07 -0.04 +1960 8 20.10 -0.91 24.95 -0.11 28.19 -0.30 26.85 0.10 +1960 9 20.56 -0.20 24.70 -0.24 28.32 -0.20 26.60 -0.11 +1960 10 20.27 -0.80 24.24 -0.71 28.33 -0.17 26.35 -0.29 +1960 11 20.93 -0.81 24.31 -0.75 28.37 -0.09 26.34 -0.26 +1960 12 22.74 -0.17 24.73 -0.48 28.36 0.02 26.41 -0.16 +1961 1 24.58 0.04 25.19 -0.46 27.94 -0.21 26.38 -0.17 +1961 2 26.66 0.75 26.25 -0.13 27.85 -0.23 26.61 -0.13 +1961 3 25.95 -0.42 26.83 -0.30 27.92 -0.26 27.00 -0.24 +1961 4 25.17 -0.40 27.40 -0.02 27.96 -0.43 27.50 -0.16 +1961 5 23.60 -0.82 27.08 -0.02 28.38 -0.31 27.85 0.08 +1961 6 22.36 -0.71 26.37 -0.10 28.49 -0.18 27.86 0.33 +1961 7 20.52 -1.46 24.95 -0.70 28.33 -0.28 27.16 0.05 +1961 8 19.97 -1.04 24.20 -0.86 28.12 -0.37 26.43 -0.32 +1961 9 19.70 -1.07 23.65 -1.29 28.19 -0.33 25.97 -0.73 +1961 10 20.07 -1.01 23.89 -1.06 28.09 -0.42 25.94 -0.71 +1961 11 21.09 -0.65 24.38 -0.67 28.26 -0.19 26.20 -0.40 +1961 12 22.11 -0.80 24.75 -0.46 28.06 -0.28 26.20 -0.37 +1962 1 24.02 -0.52 25.23 -0.42 27.66 -0.49 26.12 -0.43 +1962 2 25.35 -0.56 26.07 -0.31 27.57 -0.51 26.28 -0.46 +1962 3 24.47 -1.90 26.49 -0.64 27.83 -0.34 26.80 -0.44 +1962 4 23.43 -2.14 26.59 -0.83 28.19 -0.20 27.22 -0.44 +1962 5 23.03 -1.39 26.28 -0.82 28.23 -0.47 27.23 -0.54 +1962 6 21.81 -1.26 25.83 -0.64 28.30 -0.37 27.18 -0.35 +1962 7 20.60 -1.37 25.21 -0.44 28.24 -0.37 26.93 -0.17 +1962 8 20.17 -0.84 24.72 -0.33 28.15 -0.34 26.52 -0.23 +1962 9 20.02 -0.75 24.20 -0.74 28.11 -0.40 26.07 -0.63 +1962 10 20.14 -0.93 24.23 -0.72 28.10 -0.41 26.06 -0.58 +1962 11 20.99 -0.75 24.10 -0.95 28.12 -0.33 25.88 -0.72 +1962 12 21.82 -1.09 24.12 -1.09 27.96 -0.38 25.75 -0.82 +1963 1 23.81 -0.73 24.96 -0.69 27.74 -0.41 25.86 -0.69 +1963 2 25.36 -0.55 25.91 -0.47 27.70 -0.38 26.39 -0.35 +1963 3 26.02 -0.36 27.06 -0.07 28.01 -0.16 27.31 0.08 +1963 4 24.67 -0.90 27.66 0.23 28.28 -0.11 27.87 0.20 +1963 5 23.97 -0.45 27.10 0.00 28.40 -0.30 27.71 -0.06 +1963 6 22.41 -0.66 26.74 0.27 28.38 -0.29 27.69 0.16 +1963 7 21.80 -0.18 26.36 0.71 28.72 0.11 27.91 0.80 +1963 8 21.31 0.30 25.80 0.74 29.01 0.51 27.63 0.88 +1963 9 21.00 0.23 25.41 0.48 29.03 0.52 27.47 0.76 +1963 10 21.13 0.06 25.58 0.63 29.07 0.56 27.56 0.92 +1963 11 21.64 -0.10 25.83 0.78 29.11 0.66 27.61 1.00 +1963 12 22.55 -0.35 26.08 0.87 28.87 0.52 27.71 1.14 +1964 1 24.15 -0.39 26.07 0.42 28.70 0.55 27.43 0.87 +1964 2 25.08 -0.83 26.41 0.04 28.39 0.31 27.27 0.53 +1964 3 25.30 -1.08 26.76 -0.37 28.08 -0.09 27.10 -0.13 +1964 4 24.61 -0.96 26.34 -1.09 28.24 -0.15 27.06 -0.60 +1964 5 21.93 -2.49 25.56 -1.54 28.39 -0.30 26.94 -0.84 +1964 6 21.44 -1.63 25.10 -1.37 28.06 -0.61 26.66 -0.87 +1964 7 20.25 -1.72 24.82 -0.82 27.87 -0.74 26.42 -0.69 +1964 8 19.48 -1.53 23.73 -1.33 27.64 -0.85 25.74 -1.01 +1964 9 19.67 -1.10 23.89 -1.04 27.38 -1.13 25.49 -1.22 +1964 10 19.79 -1.28 23.95 -0.99 27.38 -1.13 25.53 -1.11 +1964 11 20.88 -0.86 24.04 -1.02 27.34 -1.11 25.40 -1.20 +1964 12 21.83 -1.08 23.86 -1.35 27.25 -1.10 25.42 -1.15 +1965 1 24.22 -0.32 24.84 -0.81 27.57 -0.59 25.78 -0.77 +1965 2 26.17 0.26 25.96 -0.41 27.77 -0.31 26.37 -0.37 +1965 3 26.71 0.33 27.07 -0.06 27.93 -0.24 27.12 -0.11 +1965 4 27.01 1.45 27.66 0.23 28.06 -0.33 27.62 -0.05 +1965 5 26.09 1.67 27.68 0.57 28.70 0.01 28.07 0.29 +1965 6 24.60 1.54 27.24 0.78 29.02 0.35 28.19 0.66 +1965 7 23.26 1.29 26.64 0.99 29.08 0.47 28.02 0.91 +1965 8 22.54 1.53 26.25 1.20 29.19 0.70 28.07 1.32 +1965 9 21.26 0.49 26.07 1.13 29.11 0.60 28.03 1.32 +1965 10 21.57 0.50 26.15 1.21 29.30 0.80 28.26 1.62 +1965 11 22.29 0.55 26.50 1.45 29.17 0.72 28.29 1.69 +1965 12 23.35 0.44 26.59 1.38 29.03 0.68 28.07 1.50 +1966 1 25.15 0.62 26.70 1.05 28.87 0.71 27.75 1.19 +1966 2 25.88 -0.03 26.86 0.49 28.85 0.78 27.66 0.92 +1966 3 25.35 -1.02 27.26 0.13 29.18 1.01 28.22 0.99 +1966 4 24.26 -1.31 27.40 -0.03 28.99 0.60 28.24 0.58 +1966 5 22.92 -1.50 26.28 -0.82 29.08 0.39 27.67 -0.10 +1966 6 21.80 -1.27 26.08 -0.39 29.13 0.46 27.77 0.24 +1966 7 20.85 -1.13 25.42 -0.22 29.03 0.42 27.42 0.31 +1966 8 20.17 -0.84 24.51 -0.55 28.76 0.27 26.65 -0.10 +1966 9 20.04 -0.73 24.17 -0.77 28.71 0.20 26.49 -0.22 +1966 10 20.51 -0.56 24.42 -0.53 28.57 0.06 26.40 -0.25 +1966 11 21.03 -0.71 24.26 -0.79 28.65 0.20 26.42 -0.19 +1966 12 22.25 -0.66 24.30 -0.91 28.27 -0.07 26.21 -0.36 +1967 1 23.66 -0.88 25.09 -0.56 27.69 -0.46 26.18 -0.38 +1967 2 25.54 -0.37 26.09 -0.28 27.48 -0.60 26.35 -0.39 +1967 3 25.55 -0.83 26.46 -0.67 27.78 -0.39 26.67 -0.56 +1967 4 24.98 -0.59 26.46 -0.96 28.40 0.01 26.91 -0.76 +1967 5 23.77 -0.65 26.69 -0.41 28.80 0.11 27.49 -0.28 +1967 6 22.04 -1.03 26.40 -0.07 28.69 0.02 27.62 0.09 +1967 7 21.10 -0.88 25.32 -0.32 28.62 0.01 27.17 0.06 +1967 8 19.84 -1.17 24.30 -0.76 28.42 -0.07 26.62 -0.13 +1967 9 19.08 -1.68 23.69 -1.25 28.19 -0.32 26.10 -0.60 +1967 10 19.47 -1.60 23.80 -1.14 28.32 -0.19 26.19 -0.45 +1967 11 20.20 -1.54 24.01 -1.04 28.43 -0.02 26.26 -0.34 +1967 12 21.28 -1.62 24.14 -1.07 28.27 -0.08 26.10 -0.47 +1968 1 23.19 -1.35 24.40 -1.25 27.92 -0.24 25.78 -0.78 +1968 2 24.88 -1.04 25.00 -1.38 27.80 -0.28 25.79 -0.95 +1968 3 25.11 -1.27 25.86 -1.27 27.87 -0.30 26.38 -0.85 +1968 4 23.97 -1.60 26.57 -0.85 28.16 -0.24 27.09 -0.58 +1968 5 22.44 -1.98 26.19 -0.92 28.30 -0.40 27.15 -0.62 +1968 6 21.70 -1.36 26.22 -0.25 28.90 0.23 27.69 0.16 +1968 7 21.25 -0.72 26.00 0.35 28.70 0.09 27.61 0.51 +1968 8 20.97 -0.04 25.28 0.22 28.68 0.19 27.12 0.37 +1968 9 21.23 0.46 24.96 0.02 28.66 0.15 26.90 0.19 +1968 10 21.12 0.05 25.17 0.22 28.77 0.26 26.99 0.34 +1968 11 21.68 -0.06 25.35 0.29 29.17 0.72 27.38 0.78 +1968 12 23.20 0.29 25.79 0.58 29.17 0.83 27.42 0.85 +1969 1 24.67 0.13 26.27 0.62 29.11 0.95 27.55 0.99 +1969 2 25.56 -0.36 26.92 0.54 29.28 1.20 27.95 1.21 +1969 3 27.09 0.72 27.63 0.50 28.99 0.82 28.02 0.79 +1969 4 26.66 1.10 27.94 0.52 29.03 0.64 28.39 0.73 +1969 5 26.07 1.65 27.92 0.81 29.21 0.52 28.50 0.73 +1969 6 24.39 1.32 27.05 0.58 29.09 0.42 27.99 0.46 +1969 7 22.47 0.50 25.84 0.19 28.85 0.24 27.30 0.20 +1969 8 21.06 0.05 25.41 0.35 28.93 0.44 27.16 0.41 +1969 9 20.88 0.12 25.46 0.52 29.14 0.63 27.34 0.63 +1969 10 21.74 0.67 25.69 0.75 29.20 0.69 27.50 0.86 +1969 11 22.47 0.73 25.75 0.70 29.20 0.75 27.35 0.74 +1969 12 23.60 0.69 26.16 0.95 28.87 0.52 27.30 0.73 +1970 1 25.02 0.48 26.38 0.73 28.57 0.42 27.05 0.50 +1970 2 25.76 -0.16 26.52 0.14 28.57 0.50 27.02 0.29 +1970 3 25.53 -0.85 26.97 -0.16 28.52 0.35 27.35 0.12 +1970 4 24.76 -0.81 27.20 -0.23 28.73 0.34 27.96 0.29 +1970 5 22.94 -1.48 26.44 -0.66 28.97 0.28 27.77 0.00 +1970 6 21.27 -1.80 25.30 -1.17 28.75 0.08 27.14 -0.39 +1970 7 19.69 -2.28 24.18 -1.47 28.66 0.05 26.48 -0.63 +1970 8 19.27 -1.74 23.69 -1.37 28.16 -0.34 25.86 -0.89 +1970 9 19.50 -1.26 23.89 -1.05 27.88 -0.64 25.86 -0.84 +1970 10 20.16 -0.91 23.80 -1.14 27.86 -0.65 25.79 -0.85 +1970 11 20.61 -1.13 23.78 -1.28 27.91 -0.54 25.83 -0.77 +1970 12 21.77 -1.13 24.01 -1.20 27.44 -0.91 25.47 -1.10 +1971 1 23.33 -1.21 24.19 -1.47 26.94 -1.21 25.09 -1.46 +1971 2 24.58 -1.34 24.91 -1.47 27.07 -1.00 25.40 -1.34 +1971 3 25.24 -1.13 26.01 -1.11 27.25 -0.92 26.10 -1.13 +1971 4 24.95 -0.62 26.61 -0.81 27.63 -0.76 26.78 -0.89 +1971 5 23.29 -1.13 26.26 -0.85 28.02 -0.67 27.06 -0.71 +1971 6 21.60 -1.47 25.44 -1.03 28.03 -0.64 26.70 -0.83 +1971 7 21.01 -0.96 24.78 -0.86 27.93 -0.68 26.29 -0.82 +1971 8 19.97 -1.04 23.90 -1.16 27.84 -0.66 25.99 -0.76 +1971 9 19.74 -1.03 23.92 -1.02 27.75 -0.77 25.94 -0.76 +1971 10 19.88 -1.19 23.73 -1.21 27.80 -0.71 25.65 -0.99 +1971 11 20.94 -0.80 23.93 -1.12 27.87 -0.58 25.69 -0.91 +1971 12 21.99 -0.92 23.92 -1.29 27.98 -0.36 25.55 -1.02 +1972 1 24.51 -0.03 25.02 -0.63 27.97 -0.19 25.84 -0.72 +1972 2 26.66 0.75 26.04 -0.34 28.15 0.07 26.42 -0.32 +1972 3 27.09 0.72 27.12 -0.01 28.36 0.19 27.21 -0.02 +1972 4 26.25 0.68 27.78 0.35 28.82 0.43 27.93 0.26 +1972 5 25.47 1.05 27.62 0.52 29.21 0.52 28.27 0.49 +1972 6 25.01 1.95 27.37 0.90 29.19 0.52 28.23 0.70 +1972 7 24.11 2.13 27.14 1.49 29.09 0.48 28.18 1.07 +1972 8 23.42 2.41 26.86 1.81 28.92 0.43 28.10 1.35 +1972 9 22.12 1.35 26.48 1.54 29.10 0.58 28.10 1.40 +1972 10 22.58 1.51 26.83 1.89 29.44 0.93 28.46 1.82 +1972 11 23.32 1.58 27.17 2.11 29.48 1.03 28.69 2.09 +1972 12 24.89 1.99 27.60 2.39 29.35 1.00 28.81 2.24 +1973 1 26.03 1.49 27.52 1.86 29.03 0.88 28.44 1.88 +1973 2 26.48 0.56 27.24 0.87 28.77 0.70 28.00 1.26 +1973 3 26.27 -0.10 27.37 0.24 28.52 0.35 27.71 0.48 +1973 4 24.87 -0.70 26.87 -0.55 28.39 0.00 27.39 -0.28 +1973 5 23.44 -0.98 26.06 -1.04 28.51 -0.18 27.13 -0.65 +1973 6 21.76 -1.31 25.34 -1.12 28.23 -0.44 26.74 -0.79 +1973 7 20.84 -1.14 24.31 -1.34 28.01 -0.60 25.95 -1.16 +1973 8 19.47 -1.54 23.69 -1.36 27.65 -0.84 25.46 -1.29 +1973 9 19.49 -1.28 23.56 -1.38 27.53 -0.98 25.32 -1.39 +1973 10 19.80 -1.27 23.49 -1.46 27.32 -1.19 25.03 -1.61 +1973 11 20.71 -1.03 23.35 -1.71 26.97 -1.48 24.50 -2.11 +1973 12 21.74 -1.17 23.40 -1.81 26.69 -1.65 24.43 -2.14 +1974 1 23.29 -1.25 23.93 -1.72 26.50 -1.65 24.52 -2.04 +1974 2 24.87 -1.04 25.11 -1.27 26.87 -1.21 25.12 -1.61 +1974 3 25.69 -0.68 26.28 -0.85 27.21 -0.96 25.91 -1.32 +1974 4 25.28 -0.29 26.84 -0.58 27.46 -0.93 26.63 -1.03 +1974 5 24.35 -0.07 26.56 -0.54 27.94 -0.75 26.84 -0.93 +1974 6 22.48 -0.58 25.91 -0.55 27.97 -0.70 26.71 -0.82 +1974 7 21.58 -0.40 25.30 -0.35 27.83 -0.78 26.48 -0.63 +1974 8 20.73 -0.28 24.82 -0.24 27.97 -0.52 26.37 -0.38 +1974 9 20.15 -0.62 24.38 -0.56 27.91 -0.61 26.23 -0.47 +1974 10 19.88 -1.19 24.14 -0.81 27.74 -0.77 25.92 -0.73 +1974 11 20.68 -1.06 24.07 -0.98 27.72 -0.73 25.63 -0.97 +1974 12 21.41 -1.50 24.31 -0.90 27.61 -0.74 25.70 -0.87 +1975 1 23.55 -0.99 25.34 -0.31 27.86 -0.30 26.18 -0.37 +1975 2 24.95 -0.97 25.74 -0.64 27.96 -0.12 26.22 -0.52 +1975 3 26.06 -0.32 26.49 -0.64 27.76 -0.41 26.44 -0.79 +1975 4 25.53 -0.04 27.08 -0.34 27.83 -0.56 26.99 -0.67 +1975 5 23.71 -0.72 26.27 -0.83 27.95 -0.74 26.97 -0.80 +1975 6 21.84 -1.22 25.29 -1.18 27.71 -0.96 26.29 -1.24 +1975 7 21.05 -0.92 24.72 -0.93 27.57 -1.04 25.98 -1.12 +1975 8 19.97 -1.04 24.15 -0.91 27.29 -1.21 25.47 -1.28 +1975 9 19.14 -1.63 23.67 -1.27 26.91 -1.60 25.20 -1.50 +1975 10 19.17 -1.90 23.40 -1.54 26.76 -1.75 24.87 -1.77 +1975 11 19.44 -2.30 23.73 -1.33 26.80 -1.66 25.10 -1.50 +1975 12 21.05 -1.85 23.39 -1.82 26.84 -1.50 24.76 -1.81 +1976 1 23.51 -1.02 23.91 -1.74 26.92 -1.23 24.72 -1.84 +1976 2 25.36 -0.56 25.31 -1.07 27.19 -0.89 25.58 -1.16 +1976 3 25.88 -0.49 26.46 -0.66 27.56 -0.61 26.61 -0.62 +1976 4 25.72 0.15 26.94 -0.49 27.98 -0.42 26.99 -0.67 +1976 5 25.11 0.69 26.98 -0.12 28.32 -0.37 27.27 -0.50 +1976 6 24.46 1.39 26.95 0.48 28.32 -0.35 27.34 -0.19 +1976 7 23.30 1.33 26.29 0.65 28.42 -0.19 27.26 0.16 +1976 8 21.91 0.90 25.87 0.81 28.34 -0.15 27.09 0.34 +1976 9 21.56 0.79 25.76 0.83 28.50 -0.01 27.12 0.42 +1976 10 21.69 0.62 25.97 1.03 28.82 0.31 27.48 0.84 +1976 11 22.14 0.40 25.93 0.87 28.92 0.47 27.42 0.82 +1976 12 23.29 0.39 25.91 0.70 28.45 0.10 27.17 0.60 +1977 1 24.93 0.39 26.57 0.92 28.38 0.23 27.31 0.76 +1977 2 25.79 -0.13 27.03 0.65 28.11 0.04 27.15 0.41 +1977 3 26.13 -0.24 27.51 0.38 28.28 0.10 27.57 0.34 +1977 4 25.29 -0.28 27.02 -0.41 28.50 0.10 27.61 -0.05 +1977 5 23.88 -0.54 27.04 -0.06 28.78 0.09 27.97 0.19 +1977 6 22.70 -0.37 26.56 0.09 28.97 0.30 27.96 0.43 +1977 7 21.63 -0.34 25.70 0.05 29.13 0.52 27.56 0.45 +1977 8 20.25 -0.76 24.81 -0.25 28.87 0.38 26.93 0.18 +1977 9 19.82 -0.95 24.97 0.04 28.98 0.47 27.21 0.50 +1977 10 20.61 -0.46 25.34 0.39 28.96 0.45 27.37 0.73 +1977 11 21.29 -0.45 25.41 0.35 29.10 0.65 27.28 0.67 +1977 12 22.47 -0.44 25.54 0.33 29.11 0.76 27.37 0.80 +1978 1 24.32 -0.22 25.92 0.27 28.80 0.65 27.32 0.77 +1978 2 25.77 -0.15 26.46 0.09 28.48 0.41 27.17 0.43 +1978 3 25.39 -0.98 26.83 -0.30 28.26 0.09 27.24 0.01 +1978 4 24.73 -0.84 26.66 -0.77 28.28 -0.11 27.26 -0.41 +1978 5 23.15 -1.27 26.13 -0.97 28.72 0.03 27.36 -0.42 +1978 6 21.89 -1.18 25.68 -0.79 28.56 -0.11 27.16 -0.37 +1978 7 21.01 -0.96 25.08 -0.57 28.26 -0.35 26.81 -0.29 +1978 8 19.66 -1.35 24.35 -0.71 28.25 -0.24 26.23 -0.52 +1978 9 19.98 -0.79 24.33 -0.61 28.43 -0.08 26.20 -0.50 +1978 10 20.22 -0.86 24.72 -0.22 28.35 -0.16 26.40 -0.24 +1978 11 21.62 -0.12 24.94 -0.11 28.37 -0.09 26.43 -0.17 +1978 12 22.94 0.03 25.34 0.13 28.27 -0.08 26.48 -0.09 +1979 1 24.71 0.17 25.43 -0.23 28.40 0.25 26.45 -0.11 +1979 2 25.60 -0.32 26.19 -0.19 28.22 0.14 26.60 -0.13 +1979 3 25.93 -0.44 27.25 0.12 28.26 0.09 27.48 0.25 +1979 4 25.58 0.01 27.66 0.23 28.35 -0.05 27.87 0.20 +1979 5 24.52 0.10 27.26 0.16 28.70 0.01 27.74 -0.03 +1979 6 23.28 0.22 26.54 0.08 28.74 0.07 27.55 0.02 +1979 7 21.79 -0.19 25.56 -0.09 28.66 0.05 26.95 -0.15 +1979 8 21.05 0.04 25.29 0.23 28.36 -0.13 26.77 0.02 +1979 9 21.15 0.39 25.58 0.65 28.67 0.16 27.15 0.45 +1979 10 21.43 0.36 25.54 0.60 28.81 0.31 27.01 0.36 +1979 11 21.95 0.21 25.58 0.53 28.87 0.42 27.08 0.48 +1979 12 22.97 0.07 25.68 0.47 28.79 0.45 27.09 0.52 +1980 1 24.35 -0.18 26.12 0.47 28.62 0.47 27.10 0.54 +1980 2 25.73 -0.18 26.52 0.15 28.47 0.39 27.03 0.29 +1980 3 26.46 0.08 27.05 -0.07 28.51 0.34 27.38 0.15 +1980 4 25.71 0.14 27.33 -0.10 28.70 0.30 27.78 0.12 +1980 5 24.46 0.04 27.15 0.05 29.08 0.39 27.99 0.21 +1980 6 22.88 -0.19 26.76 0.29 29.15 0.48 27.99 0.46 +1980 7 21.26 -0.71 25.65 0.00 28.95 0.34 27.35 0.24 +1980 8 20.57 -0.44 24.87 -0.19 28.47 -0.02 26.62 -0.13 +1980 9 20.45 -0.32 24.86 -0.08 28.50 -0.01 26.57 -0.13 +1980 10 20.43 -0.64 24.62 -0.32 28.66 0.15 26.51 -0.13 +1980 11 21.23 -0.51 25.07 0.02 28.58 0.13 26.63 0.03 +1980 12 22.34 -0.56 25.28 0.07 28.44 0.10 26.58 0.01 +1981 1 22.98 -1.56 25.05 -0.61 28.08 -0.08 26.17 -0.39 +1981 2 24.90 -1.01 25.63 -0.75 27.94 -0.14 26.13 -0.60 +1981 3 25.94 -0.43 26.74 -0.39 28.08 -0.09 26.75 -0.48 +1981 4 24.89 -0.68 27.10 -0.32 28.17 -0.22 27.32 -0.34 +1981 5 23.90 -0.52 26.74 -0.37 28.34 -0.35 27.41 -0.36 +1981 6 22.57 -0.50 26.26 -0.20 28.36 -0.31 27.35 -0.18 +1981 7 21.10 -0.87 25.26 -0.39 28.29 -0.32 26.66 -0.44 +1981 8 20.03 -0.98 24.43 -0.63 28.22 -0.28 26.25 -0.50 +1981 9 20.09 -0.68 24.74 -0.20 28.30 -0.22 26.54 -0.17 +1981 10 20.58 -0.49 24.92 -0.03 28.45 -0.06 26.52 -0.12 +1981 11 21.26 -0.48 24.83 -0.22 28.47 0.02 26.41 -0.19 +1981 12 22.60 -0.30 25.23 0.03 28.43 0.09 26.47 -0.10 +1982 1 24.36 -0.18 25.96 0.30 28.19 0.03 26.69 0.14 +1982 2 25.42 -0.49 26.55 0.17 28.04 -0.04 26.71 -0.02 +1982 3 25.40 -0.98 27.06 -0.07 28.37 0.19 27.36 0.13 +1982 4 24.96 -0.61 27.52 0.10 28.78 0.39 27.90 0.24 +1982 5 24.21 -0.21 27.66 0.56 29.21 0.52 28.42 0.65 +1982 6 23.35 0.29 27.31 0.84 29.20 0.53 28.32 0.79 +1982 7 22.50 0.52 26.33 0.68 28.83 0.22 27.65 0.54 +1982 8 21.89 0.88 26.21 1.15 28.81 0.32 27.64 0.89 +1982 9 22.04 1.27 26.82 1.88 28.98 0.47 28.21 1.50 +1982 10 22.88 1.81 27.31 2.37 29.37 0.86 28.68 2.04 +1982 11 24.57 2.83 27.68 2.63 29.18 0.73 28.72 2.11 +1982 12 25.89 2.98 28.23 3.02 29.13 0.79 28.94 2.37 +1983 1 27.25 2.71 28.60 2.95 28.96 0.81 28.93 2.37 +1983 2 28.23 2.32 28.63 2.26 28.80 0.73 28.75 2.01 +1983 3 28.85 2.48 28.91 1.78 28.81 0.64 28.76 1.53 +1983 4 28.82 3.25 29.06 1.63 28.81 0.42 28.74 1.07 +1983 5 28.37 3.95 28.98 1.87 29.21 0.51 28.82 1.05 +1983 6 27.43 4.36 28.19 1.72 28.98 0.31 28.27 0.74 +1983 7 25.73 3.75 26.66 1.01 28.64 0.03 27.18 0.07 +1983 8 23.88 2.87 25.78 0.72 28.35 -0.14 26.51 -0.24 +1983 9 22.26 1.49 25.02 0.09 28.05 -0.46 26.18 -0.52 +1983 10 22.22 1.15 24.48 -0.46 27.92 -0.59 25.75 -0.89 +1983 11 22.21 0.47 24.19 -0.86 27.73 -0.73 25.54 -1.06 +1983 12 23.19 0.29 24.58 -0.63 27.75 -0.59 25.82 -0.75 +1984 1 24.32 -0.21 25.30 -0.35 27.64 -0.51 26.14 -0.42 +1984 2 25.12 -0.79 26.43 0.05 27.60 -0.48 26.72 -0.02 +1984 3 25.75 -0.63 27.14 0.01 27.59 -0.58 27.05 -0.19 +1984 4 25.40 -0.17 27.24 -0.18 27.78 -0.61 27.30 -0.37 +1984 5 23.58 -0.84 26.38 -0.72 28.19 -0.51 27.31 -0.47 +1984 6 22.30 -0.77 25.50 -0.97 28.38 -0.29 26.95 -0.58 +1984 7 21.53 -0.44 25.04 -0.60 28.47 -0.14 26.84 -0.26 +1984 8 20.64 -0.37 24.81 -0.25 28.30 -0.19 26.67 -0.08 +1984 9 20.73 -0.04 24.63 -0.30 28.26 -0.25 26.43 -0.27 +1984 10 20.62 -0.45 24.34 -0.61 28.19 -0.32 26.15 -0.49 +1984 11 21.70 -0.04 24.23 -0.83 27.92 -0.53 25.60 -1.00 +1984 12 22.47 -0.44 24.10 -1.11 27.60 -0.74 25.38 -1.19 +1985 1 23.84 -0.70 24.68 -0.97 27.55 -0.60 25.58 -0.98 +1985 2 24.83 -1.08 25.65 -0.72 27.68 -0.39 26.11 -0.63 +1985 3 25.60 -0.77 26.45 -0.68 27.59 -0.58 26.53 -0.71 +1985 4 24.28 -1.29 26.63 -0.79 27.78 -0.61 26.93 -0.74 +1985 5 22.67 -1.75 26.26 -0.84 27.99 -0.70 27.09 -0.68 +1985 6 21.84 -1.23 25.66 -0.81 28.09 -0.58 26.92 -0.61 +1985 7 20.75 -1.23 24.72 -0.93 28.32 -0.30 26.64 -0.46 +1985 8 19.90 -1.11 24.12 -0.94 28.34 -0.16 26.28 -0.47 +1985 9 19.86 -0.91 24.05 -0.88 28.32 -0.20 26.08 -0.62 +1985 10 20.26 -0.81 24.23 -0.71 28.40 -0.11 26.22 -0.42 +1985 11 20.97 -0.77 24.40 -0.65 28.48 0.03 26.39 -0.22 +1985 12 22.49 -0.41 24.56 -0.65 28.39 0.05 26.19 -0.38 +1986 1 24.31 -0.23 24.99 -0.67 27.96 -0.19 26.04 -0.52 +1986 2 25.90 -0.02 26.04 -0.33 27.95 -0.13 26.26 -0.48 +1986 3 25.78 -0.59 26.92 -0.21 28.11 -0.06 26.99 -0.24 +1986 4 24.86 -0.71 27.30 -0.13 28.23 -0.17 27.65 -0.02 +1986 5 23.35 -1.07 26.78 -0.32 28.53 -0.17 27.58 -0.20 +1986 6 22.03 -1.04 26.27 -0.20 28.76 0.09 27.56 0.03 +1986 7 21.64 -0.33 25.82 0.18 28.75 0.14 27.39 0.28 +1986 8 21.07 0.06 25.38 0.33 28.95 0.46 27.21 0.46 +1986 9 21.13 0.36 25.38 0.44 29.20 0.69 27.35 0.65 +1986 10 21.46 0.39 25.65 0.70 29.27 0.76 27.60 0.95 +1986 11 22.17 0.43 25.94 0.88 29.33 0.88 27.67 1.07 +1986 12 23.53 0.63 26.26 1.05 28.97 0.63 27.75 1.18 +1987 1 25.60 1.07 26.74 1.09 28.81 0.65 27.82 1.27 +1987 2 27.02 1.10 27.60 1.23 28.82 0.74 28.02 1.29 +1987 3 27.89 1.51 28.38 1.26 28.95 0.77 28.49 1.26 +1987 4 26.95 1.38 28.63 1.20 28.97 0.58 28.68 1.02 +1987 5 25.96 1.53 28.30 1.19 29.24 0.55 28.70 0.93 +1987 6 24.04 0.97 27.51 1.04 29.44 0.77 28.67 1.14 +1987 7 23.00 1.03 26.94 1.30 29.37 0.76 28.52 1.42 +1987 8 21.92 0.91 26.59 1.53 29.40 0.91 28.48 1.73 +1987 9 22.00 1.23 26.62 1.68 29.47 0.96 28.42 1.71 +1987 10 22.54 1.47 26.19 1.25 29.67 1.17 28.08 1.43 +1987 11 22.84 1.10 26.21 1.16 29.53 1.08 27.94 1.34 +1987 12 23.51 0.60 26.33 1.12 29.25 0.90 27.60 1.03 +1988 1 24.76 0.22 26.47 0.82 28.97 0.81 27.49 0.94 +1988 2 25.74 -0.18 26.43 0.05 28.54 0.46 27.01 0.28 +1988 3 25.71 -0.66 27.10 -0.03 28.46 0.29 27.45 0.22 +1988 4 24.68 -0.89 27.01 -0.41 28.41 0.02 27.56 -0.10 +1988 5 23.18 -1.24 25.88 -1.22 28.26 -0.43 26.97 -0.80 +1988 6 21.66 -1.41 24.61 -1.86 28.00 -0.67 26.21 -1.32 +1988 7 20.59 -1.38 23.79 -1.85 27.95 -0.67 25.66 -1.45 +1988 8 19.63 -1.38 23.71 -1.35 28.07 -0.43 25.71 -1.04 +1988 9 19.44 -1.32 23.88 -1.06 27.90 -0.61 25.72 -0.99 +1988 10 19.83 -1.24 23.41 -1.53 27.12 -1.39 24.82 -1.82 +1988 11 20.96 -0.78 23.45 -1.61 27.06 -1.39 24.73 -1.87 +1988 12 22.25 -0.66 23.50 -1.71 26.85 -1.49 24.68 -1.89 +1989 1 24.36 -0.18 24.27 -1.38 26.63 -1.52 24.70 -1.86 +1989 2 26.02 0.10 25.49 -0.89 26.75 -1.33 25.34 -1.40 +1989 3 26.21 -0.17 26.23 -0.90 27.25 -0.93 26.12 -1.12 +1989 4 25.54 -0.03 26.85 -0.57 27.71 -0.68 26.83 -0.83 +1989 5 23.36 -1.06 26.58 -0.53 28.24 -0.46 27.18 -0.60 +1989 6 22.14 -0.93 26.42 -0.05 28.12 -0.55 27.23 -0.30 +1989 7 21.27 -0.70 25.32 -0.32 28.23 -0.38 26.80 -0.31 +1989 8 20.86 -0.15 24.73 -0.33 28.10 -0.39 26.43 -0.32 +1989 9 20.17 -0.60 24.67 -0.27 28.37 -0.14 26.46 -0.24 +1989 10 20.52 -0.55 24.61 -0.34 28.27 -0.24 26.31 -0.34 +1989 11 21.44 -0.30 24.56 -0.49 28.10 -0.36 26.29 -0.31 +1989 12 22.61 -0.30 24.92 -0.29 28.51 0.17 26.58 0.01 +1990 1 24.22 -0.32 25.45 -0.20 28.49 0.33 26.63 0.07 +1990 2 26.17 0.26 26.54 0.16 28.58 0.50 27.03 0.29 +1990 3 26.15 -0.22 27.01 -0.12 28.69 0.51 27.39 0.16 +1990 4 25.15 -0.42 27.56 0.14 28.83 0.44 27.94 0.27 +1990 5 24.14 -0.29 27.42 0.32 28.93 0.23 28.08 0.30 +1990 6 22.76 -0.31 26.55 0.08 28.97 0.30 27.63 0.10 +1990 7 21.36 -0.61 25.82 0.18 29.01 0.40 27.42 0.31 +1990 8 20.70 -0.31 25.32 0.26 28.99 0.49 27.16 0.41 +1990 9 20.28 -0.49 25.15 0.21 28.92 0.41 26.96 0.25 +1990 10 20.40 -0.67 24.96 0.02 29.10 0.59 27.01 0.37 +1990 11 21.19 -0.55 25.00 -0.06 29.13 0.68 26.88 0.28 +1990 12 22.29 -0.61 25.23 0.02 29.16 0.81 26.96 0.39 +1991 1 23.99 -0.55 25.84 0.19 28.96 0.81 27.07 0.51 +1991 2 25.59 -0.33 26.50 0.12 28.71 0.63 27.12 0.38 +1991 3 26.31 -0.06 27.12 -0.01 28.58 0.40 27.38 0.15 +1991 4 25.15 -0.42 27.65 0.22 28.94 0.55 28.10 0.44 +1991 5 24.44 0.02 27.64 0.54 29.37 0.68 28.36 0.58 +1991 6 23.28 0.21 27.43 0.96 29.28 0.61 28.41 0.88 +1991 7 22.39 0.42 26.75 1.10 29.27 0.66 28.17 1.07 +1991 8 21.39 0.38 25.71 0.65 29.23 0.74 27.73 0.98 +1991 9 21.22 0.45 25.32 0.39 29.24 0.73 27.42 0.71 +1991 10 21.73 0.66 25.63 0.69 29.44 0.93 27.62 0.98 +1991 11 22.40 0.66 26.10 1.04 29.40 0.95 27.93 1.33 +1991 12 23.75 0.85 26.42 1.21 29.46 1.12 28.32 1.75 +1992 1 25.02 0.48 27.03 1.38 29.03 0.87 28.36 1.81 +1992 2 26.62 0.71 27.61 1.23 29.00 0.92 28.43 1.69 +1992 3 27.72 1.34 28.22 1.09 29.03 0.86 28.66 1.42 +1992 4 27.58 2.01 28.79 1.37 29.16 0.77 29.05 1.39 +1992 5 26.44 2.02 28.49 1.38 29.39 0.70 29.01 1.24 +1992 6 23.86 0.79 27.28 0.82 29.28 0.60 28.35 0.82 +1992 7 21.84 -0.14 25.84 0.19 29.15 0.54 27.56 0.45 +1992 8 20.87 -0.14 25.11 0.06 28.92 0.43 26.96 0.21 +1992 9 20.85 0.08 24.90 -0.03 28.83 0.32 26.66 -0.04 +1992 10 21.15 0.08 24.65 -0.29 28.69 0.18 26.39 -0.25 +1992 11 21.84 0.10 24.77 -0.29 28.67 0.21 26.60 0.00 +1992 12 22.79 -0.12 24.97 -0.24 28.82 0.47 26.72 0.15 +1993 1 24.68 0.15 25.79 0.14 28.71 0.56 26.87 0.31 +1993 2 26.46 0.55 26.94 0.57 28.37 0.29 27.20 0.46 +1993 3 27.07 0.69 27.64 0.51 28.50 0.32 27.71 0.48 +1993 4 26.84 1.28 28.43 1.00 28.78 0.38 28.50 0.83 +1993 5 25.60 1.18 28.33 1.23 29.03 0.34 28.70 0.93 +1993 6 24.11 1.04 27.03 0.56 29.03 0.36 28.08 0.55 +1993 7 22.61 0.64 26.19 0.54 29.01 0.40 27.59 0.49 +1993 8 21.65 0.64 25.52 0.46 28.86 0.37 27.01 0.26 +1993 9 21.11 0.34 25.25 0.31 29.02 0.51 27.14 0.43 +1993 10 21.71 0.64 25.28 0.33 28.84 0.33 27.01 0.36 +1993 11 22.07 0.33 25.20 0.14 28.88 0.43 26.92 0.32 +1993 12 22.86 -0.05 25.30 0.09 28.85 0.50 26.79 0.22 +1994 1 24.56 0.02 25.84 0.18 28.54 0.39 26.74 0.19 +1994 2 25.89 -0.03 26.40 0.02 28.27 0.20 26.97 0.23 +1994 3 25.75 -0.62 26.88 -0.24 28.46 0.28 27.52 0.29 +1994 4 24.49 -1.08 27.15 -0.28 28.82 0.43 28.13 0.46 +1994 5 23.52 -0.90 27.17 0.06 29.20 0.51 28.27 0.50 +1994 6 22.31 -0.76 26.63 0.17 29.27 0.60 28.09 0.56 +1994 7 21.17 -0.80 25.61 -0.04 29.49 0.88 27.68 0.57 +1994 8 20.22 -0.79 24.93 -0.13 29.51 1.02 27.40 0.65 +1994 9 20.65 -0.12 24.97 0.03 29.38 0.87 27.25 0.54 +1994 10 22.04 0.97 25.65 0.70 29.51 1.00 27.53 0.89 +1994 11 22.27 0.53 26.17 1.12 29.60 1.15 27.95 1.35 +1994 12 23.75 0.85 26.23 1.02 29.56 1.22 28.02 1.45 +1995 1 25.48 0.94 26.51 0.86 29.24 1.09 27.74 1.18 +1995 2 26.25 0.33 26.90 0.52 29.16 1.09 27.67 0.94 +1995 3 26.09 -0.28 27.26 0.13 29.23 1.05 27.91 0.68 +1995 4 24.32 -1.25 27.20 -0.23 29.26 0.87 28.17 0.50 +1995 5 23.37 -1.05 26.55 -0.55 29.36 0.67 27.87 0.10 +1995 6 22.43 -0.64 26.30 -0.17 29.21 0.54 27.80 0.27 +1995 7 21.42 -0.55 25.65 0.00 29.03 0.42 27.24 0.14 +1995 8 20.46 -0.55 24.36 -0.70 28.81 0.32 26.42 -0.33 +1995 9 20.50 -0.27 24.05 -0.89 28.59 0.08 26.20 -0.50 +1995 10 20.62 -0.45 24.16 -0.78 28.52 0.01 26.08 -0.57 +1995 11 21.49 -0.25 24.22 -0.84 28.32 -0.13 25.82 -0.78 +1995 12 22.03 -0.87 24.45 -0.76 28.13 -0.22 25.86 -0.71 +1996 1 23.81 -0.73 25.06 -0.59 27.89 -0.27 25.83 -0.73 +1996 2 25.52 -0.40 25.84 -0.54 27.61 -0.46 25.98 -0.76 +1996 3 26.28 -0.09 26.75 -0.38 27.91 -0.27 26.73 -0.50 +1996 4 24.00 -1.57 26.83 -0.59 28.25 -0.15 27.42 -0.25 +1996 5 23.11 -1.31 26.63 -0.47 28.62 -0.07 27.65 -0.12 +1996 6 21.66 -1.41 26.10 -0.37 28.71 0.04 27.49 -0.04 +1996 7 20.72 -1.26 25.29 -0.36 28.65 0.04 27.02 -0.09 +1996 8 20.23 -0.78 24.78 -0.28 28.62 0.12 26.75 0.00 +1996 9 20.43 -0.34 24.53 -0.41 28.57 0.05 26.44 -0.27 +1996 10 20.52 -0.55 24.52 -0.42 28.62 0.11 26.49 -0.15 +1996 11 20.77 -0.97 24.56 -0.49 28.62 0.17 26.43 -0.17 +1996 12 21.68 -1.22 24.31 -0.90 28.52 0.18 26.13 -0.44 +1997 1 23.70 -0.83 24.80 -0.85 28.42 0.26 26.09 -0.47 +1997 2 26.08 0.16 25.78 -0.60 28.53 0.45 26.46 -0.28 +1997 3 27.17 0.80 26.97 -0.16 28.73 0.56 27.13 -0.10 +1997 4 26.74 1.17 27.50 0.07 29.33 0.94 27.97 0.31 +1997 5 26.77 2.35 28.03 0.92 29.51 0.82 28.63 0.85 +1997 6 26.15 3.08 28.23 1.76 29.37 0.70 28.86 1.33 +1997 7 25.59 3.61 27.99 2.34 29.41 0.80 28.86 1.76 +1997 8 24.95 3.94 27.75 2.69 29.31 0.82 28.69 1.94 +1997 9 24.69 3.92 27.82 2.88 29.54 1.03 28.89 2.19 +1997 10 24.64 3.57 28.09 3.15 29.51 1.00 29.14 2.50 +1997 11 25.85 4.11 28.40 3.35 29.45 1.00 29.13 2.52 +1997 12 27.08 4.18 28.53 3.32 29.27 0.93 29.04 2.48 +1998 1 28.12 3.58 28.71 3.06 29.06 0.91 28.98 2.43 +1998 2 28.82 2.90 28.86 2.48 28.90 0.82 28.71 1.97 +1998 3 29.24 2.87 29.10 1.97 28.83 0.66 28.66 1.43 +1998 4 28.45 2.88 29.16 1.74 28.77 0.38 28.64 0.98 +1998 5 27.36 2.94 28.53 1.42 28.87 0.18 28.47 0.70 +1998 6 25.19 2.12 27.04 0.57 28.46 -0.21 27.41 -0.12 +1998 7 23.61 1.64 25.60 -0.05 28.30 -0.31 26.52 -0.59 +1998 8 22.27 1.26 24.78 -0.28 27.99 -0.50 25.91 -0.84 +1998 9 21.31 0.54 24.19 -0.75 27.83 -0.68 25.66 -1.05 +1998 10 21.37 0.30 24.08 -0.86 27.51 -1.00 25.46 -1.19 +1998 11 21.60 -0.14 24.40 -0.66 27.41 -1.04 25.48 -1.12 +1998 12 22.81 -0.10 24.25 -0.96 27.19 -1.16 25.12 -1.45 +1999 1 24.23 -0.31 24.41 -1.24 26.89 -1.26 24.96 -1.59 +1999 2 25.73 -0.19 25.56 -0.82 26.90 -1.18 25.58 -1.16 +1999 3 26.47 0.10 26.81 -0.32 27.14 -1.04 26.43 -0.80 +1999 4 24.53 -1.04 26.90 -0.52 27.66 -0.73 26.92 -0.75 +1999 5 23.64 -0.78 26.55 -0.56 28.14 -0.55 26.99 -0.78 +1999 6 22.09 -0.98 25.89 -0.58 28.05 -0.62 26.66 -0.87 +1999 7 21.36 -0.61 25.03 -0.62 27.89 -0.72 26.28 -0.83 +1999 8 20.67 -0.34 24.36 -0.70 27.77 -0.73 25.82 -0.93 +1999 9 20.08 -0.69 23.91 -1.03 27.96 -0.56 25.77 -0.94 +1999 10 20.46 -0.61 23.77 -1.18 27.93 -0.58 25.62 -1.03 +1999 11 20.62 -1.12 23.72 -1.34 27.54 -0.91 25.20 -1.40 +1999 12 22.42 -0.48 23.76 -1.45 27.30 -1.05 24.97 -1.60 +2000 1 24.01 -0.53 24.12 -1.53 27.17 -0.99 24.88 -1.68 +2000 2 25.38 -0.54 25.35 -1.03 26.88 -1.20 25.23 -1.50 +2000 3 25.67 -0.70 26.78 -0.35 26.95 -1.22 26.27 -0.96 +2000 4 25.53 -0.04 27.46 0.04 27.40 -0.99 26.99 -0.68 +2000 5 24.27 -0.15 26.85 -0.26 27.90 -0.79 27.10 -0.67 +2000 6 22.93 -0.13 26.01 -0.46 28.25 -0.42 26.97 -0.56 +2000 7 21.47 -0.50 25.24 -0.41 28.41 -0.20 26.69 -0.41 +2000 8 20.07 -0.94 24.74 -0.31 28.28 -0.21 26.46 -0.29 +2000 9 20.64 -0.13 24.73 -0.21 28.37 -0.14 26.32 -0.39 +2000 10 20.90 -0.17 24.60 -0.34 28.27 -0.24 26.11 -0.53 +2000 11 20.67 -1.07 24.43 -0.62 28.06 -0.39 26.01 -0.59 +2000 12 22.08 -0.83 24.73 -0.48 27.66 -0.68 25.83 -0.74 +2001 1 24.24 -0.29 25.37 -0.29 27.49 -0.66 25.93 -0.63 +2001 2 26.11 0.20 26.38 0.01 27.38 -0.70 26.24 -0.49 +2001 3 26.89 0.52 27.31 0.18 27.68 -0.50 26.89 -0.35 +2001 4 25.99 0.42 27.52 0.09 28.16 -0.23 27.38 -0.28 +2001 5 23.98 -0.44 27.21 0.11 28.65 -0.04 27.70 -0.08 +2001 6 22.71 -0.36 26.44 -0.03 28.91 0.24 27.60 0.07 +2001 7 21.48 -0.50 25.63 -0.02 29.12 0.51 27.37 0.26 +2001 8 20.24 -0.77 25.03 -0.03 28.98 0.48 26.95 0.20 +2001 9 19.73 -1.04 24.49 -0.45 29.11 0.60 26.74 0.04 +2001 10 20.14 -0.93 24.59 -0.36 29.08 0.58 26.66 0.02 +2001 11 20.68 -1.06 24.53 -0.53 28.93 0.48 26.47 -0.13 +2001 12 21.73 -1.17 24.79 -0.42 28.77 0.42 26.32 -0.25 +2002 1 24.09 -0.45 25.23 -0.42 28.84 0.69 26.49 -0.07 +2002 2 26.23 0.31 26.22 -0.15 28.70 0.63 26.83 0.09 +2002 3 27.39 1.01 27.51 0.38 28.62 0.44 27.48 0.25 +2002 4 26.44 0.87 27.71 0.28 29.14 0.75 28.00 0.34 +2002 5 25.29 0.87 27.68 0.58 29.61 0.92 28.44 0.66 +2002 6 23.28 0.21 27.30 0.83 29.58 0.91 28.48 0.95 +2002 7 21.64 -0.34 26.31 0.67 29.53 0.92 28.03 0.93 +2002 8 21.32 0.31 25.62 0.56 29.41 0.92 27.67 0.92 +2002 9 21.42 0.65 25.69 0.75 29.41 0.90 27.75 1.05 +2002 10 21.85 0.78 25.94 1.00 29.52 1.01 27.95 1.31 +2002 11 22.85 1.11 26.43 1.37 29.66 1.21 28.14 1.54 +2002 12 24.05 1.15 26.62 1.41 29.57 1.23 28.08 1.52 +2003 1 25.01 0.47 26.68 1.02 29.09 0.94 27.68 1.12 +2003 2 26.27 0.35 27.01 0.63 28.94 0.86 27.63 0.89 +2003 3 26.91 0.53 27.48 0.35 28.95 0.78 27.84 0.61 +2003 4 25.41 -0.15 27.22 -0.20 28.94 0.55 27.75 0.08 +2003 5 23.24 -1.18 26.44 -0.66 29.01 0.32 27.42 -0.36 +2003 6 22.15 -0.91 26.20 -0.27 29.17 0.50 27.56 0.03 +2003 7 21.50 -0.48 26.16 0.52 29.19 0.58 27.66 0.55 +2003 8 21.25 0.24 25.65 0.59 29.09 0.59 27.32 0.57 +2003 9 20.75 -0.02 25.20 0.26 29.05 0.54 27.10 0.40 +2003 10 21.70 0.63 25.58 0.63 29.22 0.71 27.33 0.69 +2003 11 22.33 0.59 25.85 0.80 29.08 0.62 27.13 0.53 +2003 12 23.60 0.70 26.07 0.86 28.97 0.63 27.04 0.47 +2004 1 25.09 0.55 26.23 0.58 28.71 0.56 26.90 0.35 +2004 2 26.47 0.55 26.81 0.44 28.61 0.53 27.04 0.31 +2004 3 26.12 -0.26 27.47 0.34 28.53 0.36 27.38 0.15 +2004 4 25.27 -0.30 27.62 0.19 28.82 0.43 27.91 0.24 +2004 5 23.44 -0.98 26.96 -0.14 29.18 0.49 28.02 0.24 +2004 6 22.54 -0.53 26.55 0.08 29.24 0.57 27.93 0.40 +2004 7 21.26 -0.72 25.94 0.30 29.36 0.75 27.86 0.75 +2004 8 20.79 -0.22 25.47 0.41 29.47 0.98 27.67 0.92 +2004 9 20.83 0.06 25.42 0.48 29.54 1.02 27.58 0.88 +2004 10 21.56 0.49 25.64 0.70 29.53 1.03 27.53 0.89 +2004 11 22.88 1.14 25.84 0.79 29.49 1.04 27.37 0.77 +2004 12 23.39 0.49 25.95 0.74 29.41 1.07 27.38 0.81 +2005 1 24.61 0.07 26.10 0.45 29.23 1.08 27.32 0.76 +2005 2 25.09 -0.83 26.38 0.00 28.91 0.83 27.17 0.43 +2005 3 25.23 -1.14 27.12 -0.01 28.89 0.71 27.63 0.40 +2005 4 25.21 -0.36 27.62 0.20 29.03 0.64 28.02 0.36 +2005 5 24.31 -0.11 27.56 0.46 29.24 0.55 28.30 0.52 +2005 6 22.60 -0.47 26.86 0.39 29.20 0.53 27.99 0.46 +2005 7 21.61 -0.37 26.07 0.42 28.93 0.32 27.45 0.34 +2005 8 20.47 -0.54 25.44 0.38 28.78 0.29 27.11 0.36 +2005 9 20.00 -0.77 24.88 -0.05 28.85 0.34 26.79 0.09 +2005 10 19.89 -1.18 24.83 -0.12 28.85 0.34 26.70 0.06 +2005 11 20.61 -1.13 23.92 -1.14 28.65 0.19 26.13 -0.48 +2005 12 22.20 -0.70 24.01 -1.20 28.34 0.00 25.80 -0.77 +2006 1 24.76 0.22 24.66 -0.99 27.91 -0.25 25.68 -0.87 +2006 2 26.52 0.60 26.02 -0.35 27.58 -0.50 26.15 -0.59 +2006 3 26.22 -0.15 26.83 -0.30 27.82 -0.35 26.80 -0.43 +2006 4 24.29 -1.28 27.18 -0.24 28.36 -0.04 27.54 -0.13 +2006 5 23.84 -0.58 27.30 0.19 28.91 0.21 27.91 0.13 +2006 6 22.82 -0.24 26.73 0.27 29.15 0.48 27.82 0.29 +2006 7 22.20 0.22 25.93 0.28 29.14 0.53 27.36 0.25 +2006 8 21.89 0.88 25.68 0.62 29.20 0.71 27.25 0.50 +2006 9 21.93 1.16 25.77 0.83 29.30 0.79 27.32 0.61 +2006 10 22.46 1.39 26.00 1.06 29.43 0.92 27.47 0.83 +2006 11 22.61 0.87 26.39 1.33 29.55 1.09 27.81 1.21 +2006 12 24.15 1.24 26.63 1.42 29.45 1.11 27.86 1.29 +2007 1 25.82 1.28 26.68 1.03 28.98 0.82 27.36 0.81 +2007 2 26.81 0.90 26.56 0.18 28.69 0.61 26.98 0.24 +2007 3 26.41 0.04 26.77 -0.36 28.81 0.64 27.25 0.02 +2007 4 24.96 -0.61 26.93 -0.50 28.88 0.49 27.56 -0.10 +2007 5 23.05 -1.37 26.40 -0.70 28.90 0.21 27.54 -0.23 +2007 6 21.61 -1.46 26.11 -0.35 28.92 0.25 27.54 0.01 +2007 7 21.05 -0.93 25.14 -0.51 28.80 0.19 26.99 -0.12 +2007 8 19.95 -1.06 24.24 -0.82 28.57 0.08 26.41 -0.34 +2007 9 19.85 -0.91 23.84 -1.10 28.21 -0.31 25.86 -0.84 +2007 10 19.31 -1.76 23.85 -1.09 28.09 -0.42 25.73 -0.92 +2007 11 19.82 -1.92 23.76 -1.30 27.90 -0.56 25.47 -1.14 +2007 12 21.15 -1.76 23.91 -1.30 27.70 -0.64 25.40 -1.17 +2008 1 24.24 -0.30 24.42 -1.23 27.18 -0.98 25.06 -1.50 +2008 2 26.39 0.47 25.34 -1.04 26.79 -1.29 25.19 -1.55 +2008 3 26.91 0.53 26.54 -0.59 27.22 -0.95 26.16 -1.07 +2008 4 25.68 0.12 27.36 -0.07 27.53 -0.86 26.97 -0.70 +2008 5 24.43 0.00 27.15 0.05 27.93 -0.76 27.19 -0.58 +2008 6 23.19 0.12 26.49 0.02 28.10 -0.57 27.15 -0.38 +2008 7 23.02 1.05 26.01 0.36 28.18 -0.43 27.00 -0.11 +2008 8 22.14 1.13 25.56 0.51 28.27 -0.22 26.81 0.06 +2008 9 21.60 0.84 25.36 0.42 28.25 -0.27 26.70 0.00 +2008 10 21.39 0.32 25.48 0.53 28.23 -0.28 26.66 0.02 +2008 11 21.54 -0.20 25.25 0.20 28.16 -0.29 26.52 -0.08 +2008 12 22.73 -0.18 24.59 -0.62 27.83 -0.52 25.78 -0.79 +2009 1 24.39 -0.15 25.26 -0.39 27.47 -0.69 25.69 -0.87 +2009 2 25.53 -0.38 26.16 -0.22 27.34 -0.74 26.02 -0.71 +2009 3 25.48 -0.89 26.62 -0.51 27.85 -0.32 26.66 -0.57 +2009 4 25.84 0.27 27.38 -0.04 28.36 -0.03 27.53 -0.13 +2009 5 24.95 0.52 27.57 0.47 29.09 0.40 28.10 0.33 +2009 6 24.09 1.02 27.15 0.68 29.15 0.48 28.06 0.53 +2009 7 23.09 1.12 26.56 0.91 29.13 0.52 27.88 0.78 +2009 8 22.03 1.02 25.90 0.84 29.20 0.71 27.51 0.76 +2009 9 21.48 0.71 25.74 0.80 29.24 0.73 27.48 0.78 +2009 10 21.64 0.57 25.82 0.87 29.68 1.17 27.73 1.09 +2009 11 21.99 0.25 26.13 1.07 29.90 1.44 28.17 1.57 +2009 12 23.21 0.31 26.69 1.48 29.80 1.45 28.51 1.94 +2010 1 24.70 0.17 26.86 1.21 29.58 1.42 28.32 1.76 +2010 2 26.16 0.24 27.37 1.00 29.25 1.18 28.19 1.45 +2010 3 26.54 0.16 28.04 0.91 29.18 1.01 28.46 1.23 +2010 4 26.04 0.47 28.08 0.66 29.28 0.89 28.49 0.82 +2010 5 24.75 0.33 27.34 0.24 29.27 0.57 28.13 0.36 +2010 6 23.26 0.19 26.32 -0.15 28.76 0.09 27.35 -0.18 +2010 7 21.11 -0.87 24.95 -0.70 28.33 -0.28 26.44 -0.67 +2010 8 19.49 -1.52 24.21 -0.85 27.82 -0.68 25.70 -1.05 +2010 9 19.28 -1.49 23.83 -1.11 27.47 -1.05 25.36 -1.34 +2010 10 19.73 -1.34 23.67 -1.28 27.35 -1.16 25.25 -1.40 +2010 11 20.44 -1.30 23.68 -1.37 27.47 -0.99 25.20 -1.41 +2010 12 22.07 -0.83 24.00 -1.21 27.54 -0.81 25.29 -1.28 diff --git a/shared/package-files/33/334bd92019e33c11d5e2f1549cf0482daaa247f7204ae539d24141fafee5d600/blob b/shared/package-files/33/334bd92019e33c11d5e2f1549cf0482daaa247f7204ae539d24141fafee5d600/blob new file mode 100644 index 0000000000000000000000000000000000000000..f8f350719cc740901a29d03e45ae9f3978446f31 --- /dev/null +++ b/shared/package-files/33/334bd92019e33c11d5e2f1549cf0482daaa247f7204ae539d24141fafee5d600/blob @@ -0,0 +1,202 @@ +"""Tests on algebraic numbers. """ + +from sympy.core.containers import Tuple +from sympy.core.numbers import (AlgebraicNumber, I, Rational) +from sympy.core.singleton import S +from sympy.core.symbol import Symbol +from sympy.functions.elementary.miscellaneous import sqrt +from sympy.polys.polytools import Poly +from sympy.polys.numberfields.subfield import to_number_field +from sympy.polys.polyclasses import DMP +from sympy.polys.domains import QQ +from sympy.polys.rootoftools import CRootOf +from sympy.abc import x, y + + +def test_AlgebraicNumber(): + minpoly, root = x**2 - 2, sqrt(2) + + a = AlgebraicNumber(root, gen=x) + + assert a.rep == DMP([QQ(1), QQ(0)], QQ) + assert a.root == root + assert a.alias is None + assert a.minpoly == minpoly + assert a.is_number + + assert a.is_aliased is False + + assert a.coeffs() == [S.One, S.Zero] + assert a.native_coeffs() == [QQ(1), QQ(0)] + + a = AlgebraicNumber(root, gen=x, alias='y') + + assert a.rep == DMP([QQ(1), QQ(0)], QQ) + assert a.root == root + assert a.alias == Symbol('y') + assert a.minpoly == minpoly + assert a.is_number + + assert a.is_aliased is True + + a = AlgebraicNumber(root, gen=x, alias=Symbol('y')) + + assert a.rep == DMP([QQ(1), QQ(0)], QQ) + assert a.root == root + assert a.alias == Symbol('y') + assert a.minpoly == minpoly + assert a.is_number + + assert a.is_aliased is True + + assert AlgebraicNumber(sqrt(2), []).rep == DMP([], QQ) + assert AlgebraicNumber(sqrt(2), ()).rep == DMP([], QQ) + assert AlgebraicNumber(sqrt(2), (0, 0)).rep == DMP([], QQ) + + assert AlgebraicNumber(sqrt(2), [8]).rep == DMP([QQ(8)], QQ) + assert AlgebraicNumber(sqrt(2), [Rational(8, 3)]).rep == DMP([QQ(8, 3)], QQ) + + assert AlgebraicNumber(sqrt(2), [7, 3]).rep == DMP([QQ(7), QQ(3)], QQ) + assert AlgebraicNumber( + sqrt(2), [Rational(7, 9), Rational(3, 2)]).rep == DMP([QQ(7, 9), QQ(3, 2)], QQ) + + assert AlgebraicNumber(sqrt(2), [1, 2, 3]).rep == DMP([QQ(2), QQ(5)], QQ) + + a = AlgebraicNumber(AlgebraicNumber(root, gen=x), [1, 2]) + + assert a.rep == DMP([QQ(1), QQ(2)], QQ) + assert a.root == root + assert a.alias is None + assert a.minpoly == minpoly + assert a.is_number + + assert a.is_aliased is False + + assert a.coeffs() == [S.One, S(2)] + assert a.native_coeffs() == [QQ(1), QQ(2)] + + a = AlgebraicNumber((minpoly, root), [1, 2]) + + assert a.rep == DMP([QQ(1), QQ(2)], QQ) + assert a.root == root + assert a.alias is None + assert a.minpoly == minpoly + assert a.is_number + + assert a.is_aliased is False + + a = AlgebraicNumber((Poly(minpoly), root), [1, 2]) + + assert a.rep == DMP([QQ(1), QQ(2)], QQ) + assert a.root == root + assert a.alias is None + assert a.minpoly == minpoly + assert a.is_number + + assert a.is_aliased is False + + assert AlgebraicNumber( sqrt(3)).rep == DMP([ QQ(1), QQ(0)], QQ) + assert AlgebraicNumber(-sqrt(3)).rep == DMP([ QQ(1), QQ(0)], QQ) + + a = AlgebraicNumber(sqrt(2)) + b = AlgebraicNumber(sqrt(2)) + + assert a == b + + c = AlgebraicNumber(sqrt(2), gen=x) + + assert a == b + assert a == c + + a = AlgebraicNumber(sqrt(2), [1, 2]) + b = AlgebraicNumber(sqrt(2), [1, 3]) + + assert a != b and a != sqrt(2) + 3 + + assert (a == x) is False and (a != x) is True + + a = AlgebraicNumber(sqrt(2), [1, 0]) + b = AlgebraicNumber(sqrt(2), [1, 0], alias=y) + + assert a.as_poly(x) == Poly(x, domain='QQ') + assert b.as_poly() == Poly(y, domain='QQ') + + assert a.as_expr() == sqrt(2) + assert a.as_expr(x) == x + assert b.as_expr() == sqrt(2) + assert b.as_expr(x) == x + + a = AlgebraicNumber(sqrt(2), [2, 3]) + b = AlgebraicNumber(sqrt(2), [2, 3], alias=y) + + p = a.as_poly() + + assert p == Poly(2*p.gen + 3) + + assert a.as_poly(x) == Poly(2*x + 3, domain='QQ') + assert b.as_poly() == Poly(2*y + 3, domain='QQ') + + assert a.as_expr() == 2*sqrt(2) + 3 + assert a.as_expr(x) == 2*x + 3 + assert b.as_expr() == 2*sqrt(2) + 3 + assert b.as_expr(x) == 2*x + 3 + + a = AlgebraicNumber(sqrt(2)) + b = to_number_field(sqrt(2)) + assert a.args == b.args == (sqrt(2), Tuple(1, 0)) + b = AlgebraicNumber(sqrt(2), alias='alpha') + assert b.args == (sqrt(2), Tuple(1, 0), Symbol('alpha')) + + a = AlgebraicNumber(sqrt(2), [1, 2, 3]) + assert a.args == (sqrt(2), Tuple(1, 2, 3)) + + a = AlgebraicNumber(sqrt(2), [1, 2], "alpha") + b = AlgebraicNumber(a) + c = AlgebraicNumber(a, alias="gamma") + assert a == b + assert c.alias.name == "gamma" + + a = AlgebraicNumber(sqrt(2) + sqrt(3), [S(1)/2, 0, S(-9)/2, 0]) + b = AlgebraicNumber(a, [1, 0, 0]) + assert b.root == a.root + assert a.to_root() == sqrt(2) + assert b.to_root() == 2 + + a = AlgebraicNumber(2) + assert a.is_primitive_element is True + + +def test_to_algebraic_integer(): + a = AlgebraicNumber(sqrt(3), gen=x).to_algebraic_integer() + + assert a.minpoly == x**2 - 3 + assert a.root == sqrt(3) + assert a.rep == DMP([QQ(1), QQ(0)], QQ) + + a = AlgebraicNumber(2*sqrt(3), gen=x).to_algebraic_integer() + assert a.minpoly == x**2 - 12 + assert a.root == 2*sqrt(3) + assert a.rep == DMP([QQ(1), QQ(0)], QQ) + + a = AlgebraicNumber(sqrt(3)/2, gen=x).to_algebraic_integer() + + assert a.minpoly == x**2 - 12 + assert a.root == 2*sqrt(3) + assert a.rep == DMP([QQ(1), QQ(0)], QQ) + + a = AlgebraicNumber(sqrt(3)/2, [Rational(7, 19), 3], gen=x).to_algebraic_integer() + + assert a.minpoly == x**2 - 12 + assert a.root == 2*sqrt(3) + assert a.rep == DMP([QQ(7, 19), QQ(3)], QQ) + + +def test_AlgebraicNumber_to_root(): + assert AlgebraicNumber(sqrt(2)).to_root() == sqrt(2) + + zeta5_squared = AlgebraicNumber(CRootOf(x**5 - 1, 4), coeffs=[1, 0, 0]) + assert zeta5_squared.to_root() == CRootOf(x**4 + x**3 + x**2 + x + 1, 1) + + zeta3_squared = AlgebraicNumber(CRootOf(x**3 - 1, 2), coeffs=[1, 0, 0]) + assert zeta3_squared.to_root() == -S(1)/2 - sqrt(3)*I/2 + assert zeta3_squared.to_root(radicals=False) == CRootOf(x**2 + x + 1, 0) diff --git a/shared/package-files/33/334f71e0cc7a85c040c24b6fc2fd7a62f3d19acb838d9103c074f452691c832a/blob b/shared/package-files/33/334f71e0cc7a85c040c24b6fc2fd7a62f3d19acb838d9103c074f452691c832a/blob new file mode 100644 index 0000000000000000000000000000000000000000..d03bda045d31662adc65450b33e9665c54fdb245 Binary files /dev/null and b/shared/package-files/33/334f71e0cc7a85c040c24b6fc2fd7a62f3d19acb838d9103c074f452691c832a/blob differ diff --git a/shared/package-files/33/3352c161f9ce47e35e01d8cdd20fb76753cfd89e71cbc402c338099e1f13c26d/blob b/shared/package-files/33/3352c161f9ce47e35e01d8cdd20fb76753cfd89e71cbc402c338099e1f13c26d/blob new file mode 100644 index 0000000000000000000000000000000000000000..37530952213f8af0b831467f6a5638b54e03bdc3 --- /dev/null +++ b/shared/package-files/33/3352c161f9ce47e35e01d8cdd20fb76753cfd89e71cbc402c338099e1f13c26d/blob @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor _neg_view(const at::Tensor & self); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/33/3353358982c168f4c099f0d278b065bc3af648d7a61dc7708c70c56b2d3fa1a3/blob b/shared/package-files/33/3353358982c168f4c099f0d278b065bc3af648d7a61dc7708c70c56b2d3fa1a3/blob new file mode 100644 index 0000000000000000000000000000000000000000..5e5503a422820191a124fa9a08b6d1319faffd6f --- /dev/null +++ b/shared/package-files/33/3353358982c168f4c099f0d278b065bc3af648d7a61dc7708c70c56b2d3fa1a3/blob @@ -0,0 +1,940 @@ +"""Plotting functions for linear models (broadly construed).""" +import copy +from textwrap import dedent +import warnings +import numpy as np +import pandas as pd +import matplotlib as mpl +import matplotlib.pyplot as plt + +try: + import statsmodels + assert statsmodels + _has_statsmodels = True +except ImportError: + _has_statsmodels = False + +from . import utils +from . import algorithms as algo +from .axisgrid import FacetGrid, _facet_docs + + +__all__ = ["lmplot", "regplot", "residplot"] + + +class _LinearPlotter: + """Base class for plotting relational data in tidy format. + + To get anything useful done you'll have to inherit from this, but setup + code that can be abstracted out should be put here. + + """ + def establish_variables(self, data, **kws): + """Extract variables from data or use directly.""" + self.data = data + + # Validate the inputs + any_strings = any([isinstance(v, str) for v in kws.values()]) + if any_strings and data is None: + raise ValueError("Must pass `data` if using named variables.") + + # Set the variables + for var, val in kws.items(): + if isinstance(val, str): + vector = data[val] + elif isinstance(val, list): + vector = np.asarray(val) + else: + vector = val + if vector is not None and vector.shape != (1,): + vector = np.squeeze(vector) + if np.ndim(vector) > 1: + err = "regplot inputs must be 1d" + raise ValueError(err) + setattr(self, var, vector) + + def dropna(self, *vars): + """Remove observations with missing data.""" + vals = [getattr(self, var) for var in vars] + vals = [v for v in vals if v is not None] + not_na = np.all(np.column_stack([pd.notnull(v) for v in vals]), axis=1) + for var in vars: + val = getattr(self, var) + if val is not None: + setattr(self, var, val[not_na]) + + def plot(self, ax): + raise NotImplementedError + + +class _RegressionPlotter(_LinearPlotter): + """Plotter for numeric independent variables with regression model. + + This does the computations and drawing for the `regplot` function, and + is thus also used indirectly by `lmplot`. + """ + def __init__(self, x, y, data=None, x_estimator=None, x_bins=None, + x_ci="ci", scatter=True, fit_reg=True, ci=95, n_boot=1000, + units=None, seed=None, order=1, logistic=False, lowess=False, + robust=False, logx=False, x_partial=None, y_partial=None, + truncate=False, dropna=True, x_jitter=None, y_jitter=None, + color=None, label=None): + + # Set member attributes + self.x_estimator = x_estimator + self.ci = ci + self.x_ci = ci if x_ci == "ci" else x_ci + self.n_boot = n_boot + self.seed = seed + self.scatter = scatter + self.fit_reg = fit_reg + self.order = order + self.logistic = logistic + self.lowess = lowess + self.robust = robust + self.logx = logx + self.truncate = truncate + self.x_jitter = x_jitter + self.y_jitter = y_jitter + self.color = color + self.label = label + + # Validate the regression options: + if sum((order > 1, logistic, robust, lowess, logx)) > 1: + raise ValueError("Mutually exclusive regression options.") + + # Extract the data vals from the arguments or passed dataframe + self.establish_variables(data, x=x, y=y, units=units, + x_partial=x_partial, y_partial=y_partial) + + # Drop null observations + if dropna: + self.dropna("x", "y", "units", "x_partial", "y_partial") + + # Regress nuisance variables out of the data + if self.x_partial is not None: + self.x = self.regress_out(self.x, self.x_partial) + if self.y_partial is not None: + self.y = self.regress_out(self.y, self.y_partial) + + # Possibly bin the predictor variable, which implies a point estimate + if x_bins is not None: + self.x_estimator = np.mean if x_estimator is None else x_estimator + x_discrete, x_bins = self.bin_predictor(x_bins) + self.x_discrete = x_discrete + else: + self.x_discrete = self.x + + # Disable regression in case of singleton inputs + if len(self.x) <= 1: + self.fit_reg = False + + # Save the range of the x variable for the grid later + if self.fit_reg: + self.x_range = self.x.min(), self.x.max() + + @property + def scatter_data(self): + """Data where each observation is a point.""" + x_j = self.x_jitter + if x_j is None: + x = self.x + else: + x = self.x + np.random.uniform(-x_j, x_j, len(self.x)) + + y_j = self.y_jitter + if y_j is None: + y = self.y + else: + y = self.y + np.random.uniform(-y_j, y_j, len(self.y)) + + return x, y + + @property + def estimate_data(self): + """Data with a point estimate and CI for each discrete x value.""" + x, y = self.x_discrete, self.y + vals = sorted(np.unique(x)) + points, cis = [], [] + + for val in vals: + + # Get the point estimate of the y variable + _y = y[x == val] + est = self.x_estimator(_y) + points.append(est) + + # Compute the confidence interval for this estimate + if self.x_ci is None: + cis.append(None) + else: + units = None + if self.x_ci == "sd": + sd = np.std(_y) + _ci = est - sd, est + sd + else: + if self.units is not None: + units = self.units[x == val] + boots = algo.bootstrap(_y, + func=self.x_estimator, + n_boot=self.n_boot, + units=units, + seed=self.seed) + _ci = utils.ci(boots, self.x_ci) + cis.append(_ci) + + return vals, points, cis + + def _check_statsmodels(self): + """Check whether statsmodels is installed if any boolean options require it.""" + options = "logistic", "robust", "lowess" + err = "`{}=True` requires statsmodels, an optional dependency, to be installed." + for option in options: + if getattr(self, option) and not _has_statsmodels: + raise RuntimeError(err.format(option)) + + def fit_regression(self, ax=None, x_range=None, grid=None): + """Fit the regression model.""" + self._check_statsmodels() + + # Create the grid for the regression + if grid is None: + if self.truncate: + x_min, x_max = self.x_range + else: + if ax is None: + x_min, x_max = x_range + else: + x_min, x_max = ax.get_xlim() + grid = np.linspace(x_min, x_max, 100) + ci = self.ci + + # Fit the regression + if self.order > 1: + yhat, yhat_boots = self.fit_poly(grid, self.order) + elif self.logistic: + from statsmodels.genmod.generalized_linear_model import GLM + from statsmodels.genmod.families import Binomial + yhat, yhat_boots = self.fit_statsmodels(grid, GLM, + family=Binomial()) + elif self.lowess: + ci = None + grid, yhat = self.fit_lowess() + elif self.robust: + from statsmodels.robust.robust_linear_model import RLM + yhat, yhat_boots = self.fit_statsmodels(grid, RLM) + elif self.logx: + yhat, yhat_boots = self.fit_logx(grid) + else: + yhat, yhat_boots = self.fit_fast(grid) + + # Compute the confidence interval at each grid point + if ci is None: + err_bands = None + else: + err_bands = utils.ci(yhat_boots, ci, axis=0) + + return grid, yhat, err_bands + + def fit_fast(self, grid): + """Low-level regression and prediction using linear algebra.""" + def reg_func(_x, _y): + return np.linalg.pinv(_x).dot(_y) + + X, y = np.c_[np.ones(len(self.x)), self.x], self.y + grid = np.c_[np.ones(len(grid)), grid] + yhat = grid.dot(reg_func(X, y)) + if self.ci is None: + return yhat, None + + beta_boots = algo.bootstrap(X, y, + func=reg_func, + n_boot=self.n_boot, + units=self.units, + seed=self.seed).T + yhat_boots = grid.dot(beta_boots).T + return yhat, yhat_boots + + def fit_poly(self, grid, order): + """Regression using numpy polyfit for higher-order trends.""" + def reg_func(_x, _y): + return np.polyval(np.polyfit(_x, _y, order), grid) + + x, y = self.x, self.y + yhat = reg_func(x, y) + if self.ci is None: + return yhat, None + + yhat_boots = algo.bootstrap(x, y, + func=reg_func, + n_boot=self.n_boot, + units=self.units, + seed=self.seed) + return yhat, yhat_boots + + def fit_statsmodels(self, grid, model, **kwargs): + """More general regression function using statsmodels objects.""" + import statsmodels.tools.sm_exceptions as sme + X, y = np.c_[np.ones(len(self.x)), self.x], self.y + grid = np.c_[np.ones(len(grid)), grid] + + def reg_func(_x, _y): + err_classes = (sme.PerfectSeparationError,) + try: + with warnings.catch_warnings(): + if hasattr(sme, "PerfectSeparationWarning"): + # statsmodels>=0.14.0 + warnings.simplefilter("error", sme.PerfectSeparationWarning) + err_classes = (*err_classes, sme.PerfectSeparationWarning) + yhat = model(_y, _x, **kwargs).fit().predict(grid) + except err_classes: + yhat = np.empty(len(grid)) + yhat.fill(np.nan) + return yhat + + yhat = reg_func(X, y) + if self.ci is None: + return yhat, None + + yhat_boots = algo.bootstrap(X, y, + func=reg_func, + n_boot=self.n_boot, + units=self.units, + seed=self.seed) + return yhat, yhat_boots + + def fit_lowess(self): + """Fit a locally-weighted regression, which returns its own grid.""" + from statsmodels.nonparametric.smoothers_lowess import lowess + grid, yhat = lowess(self.y, self.x).T + return grid, yhat + + def fit_logx(self, grid): + """Fit the model in log-space.""" + X, y = np.c_[np.ones(len(self.x)), self.x], self.y + grid = np.c_[np.ones(len(grid)), np.log(grid)] + + def reg_func(_x, _y): + _x = np.c_[_x[:, 0], np.log(_x[:, 1])] + return np.linalg.pinv(_x).dot(_y) + + yhat = grid.dot(reg_func(X, y)) + if self.ci is None: + return yhat, None + + beta_boots = algo.bootstrap(X, y, + func=reg_func, + n_boot=self.n_boot, + units=self.units, + seed=self.seed).T + yhat_boots = grid.dot(beta_boots).T + return yhat, yhat_boots + + def bin_predictor(self, bins): + """Discretize a predictor by assigning value to closest bin.""" + x = np.asarray(self.x) + if np.isscalar(bins): + percentiles = np.linspace(0, 100, bins + 2)[1:-1] + bins = np.percentile(x, percentiles) + else: + bins = np.ravel(bins) + + dist = np.abs(np.subtract.outer(x, bins)) + x_binned = bins[np.argmin(dist, axis=1)].ravel() + + return x_binned, bins + + def regress_out(self, a, b): + """Regress b from a keeping a's original mean.""" + a_mean = a.mean() + a = a - a_mean + b = b - b.mean() + b = np.c_[b] + a_prime = a - b.dot(np.linalg.pinv(b).dot(a)) + return np.asarray(a_prime + a_mean).reshape(a.shape) + + def plot(self, ax, scatter_kws, line_kws): + """Draw the full plot.""" + # Insert the plot label into the correct set of keyword arguments + if self.scatter: + scatter_kws["label"] = self.label + else: + line_kws["label"] = self.label + + # Use the current color cycle state as a default + if self.color is None: + lines, = ax.plot([], []) + color = lines.get_color() + lines.remove() + else: + color = self.color + + # Ensure that color is hex to avoid matplotlib weirdness + color = mpl.colors.rgb2hex(mpl.colors.colorConverter.to_rgb(color)) + + # Let color in keyword arguments override overall plot color + scatter_kws.setdefault("color", color) + line_kws.setdefault("color", color) + + # Draw the constituent plots + if self.scatter: + self.scatterplot(ax, scatter_kws) + + if self.fit_reg: + self.lineplot(ax, line_kws) + + # Label the axes + if hasattr(self.x, "name"): + ax.set_xlabel(self.x.name) + if hasattr(self.y, "name"): + ax.set_ylabel(self.y.name) + + def scatterplot(self, ax, kws): + """Draw the data.""" + # Treat the line-based markers specially, explicitly setting larger + # linewidth than is provided by the seaborn style defaults. + # This would ideally be handled better in matplotlib (i.e., distinguish + # between edgewidth for solid glyphs and linewidth for line glyphs + # but this should do for now. + line_markers = ["1", "2", "3", "4", "+", "x", "|", "_"] + if self.x_estimator is None: + if "marker" in kws and kws["marker"] in line_markers: + lw = mpl.rcParams["lines.linewidth"] + else: + lw = mpl.rcParams["lines.markeredgewidth"] + kws.setdefault("linewidths", lw) + + if not hasattr(kws['color'], 'shape') or kws['color'].shape[1] < 4: + kws.setdefault("alpha", .8) + + x, y = self.scatter_data + ax.scatter(x, y, **kws) + else: + # TODO abstraction + ci_kws = {"color": kws["color"]} + if "alpha" in kws: + ci_kws["alpha"] = kws["alpha"] + ci_kws["linewidth"] = mpl.rcParams["lines.linewidth"] * 1.75 + kws.setdefault("s", 50) + + xs, ys, cis = self.estimate_data + if [ci for ci in cis if ci is not None]: + for x, ci in zip(xs, cis): + ax.plot([x, x], ci, **ci_kws) + ax.scatter(xs, ys, **kws) + + def lineplot(self, ax, kws): + """Draw the model.""" + # Fit the regression model + grid, yhat, err_bands = self.fit_regression(ax) + edges = grid[0], grid[-1] + + # Get set default aesthetics + fill_color = kws["color"] + lw = kws.pop("lw", mpl.rcParams["lines.linewidth"] * 1.5) + kws.setdefault("linewidth", lw) + + # Draw the regression line and confidence interval + line, = ax.plot(grid, yhat, **kws) + if not self.truncate: + line.sticky_edges.x[:] = edges # Prevent mpl from adding margin + if err_bands is not None: + ax.fill_between(grid, *err_bands, facecolor=fill_color, alpha=.15) + + +_regression_docs = dict( + + model_api=dedent("""\ + There are a number of mutually exclusive options for estimating the + regression model. See the :ref:`tutorial ` for more + information.\ + """), + regplot_vs_lmplot=dedent("""\ + The :func:`regplot` and :func:`lmplot` functions are closely related, but + the former is an axes-level function while the latter is a figure-level + function that combines :func:`regplot` and :class:`FacetGrid`.\ + """), + x_estimator=dedent("""\ + x_estimator : callable that maps vector -> scalar, optional + Apply this function to each unique value of ``x`` and plot the + resulting estimate. This is useful when ``x`` is a discrete variable. + If ``x_ci`` is given, this estimate will be bootstrapped and a + confidence interval will be drawn.\ + """), + x_bins=dedent("""\ + x_bins : int or vector, optional + Bin the ``x`` variable into discrete bins and then estimate the central + tendency and a confidence interval. This binning only influences how + the scatterplot is drawn; the regression is still fit to the original + data. This parameter is interpreted either as the number of + evenly-sized (not necessary spaced) bins or the positions of the bin + centers. When this parameter is used, it implies that the default of + ``x_estimator`` is ``numpy.mean``.\ + """), + x_ci=dedent("""\ + x_ci : "ci", "sd", int in [0, 100] or None, optional + Size of the confidence interval used when plotting a central tendency + for discrete values of ``x``. If ``"ci"``, defer to the value of the + ``ci`` parameter. If ``"sd"``, skip bootstrapping and show the + standard deviation of the observations in each bin.\ + """), + scatter=dedent("""\ + scatter : bool, optional + If ``True``, draw a scatterplot with the underlying observations (or + the ``x_estimator`` values).\ + """), + fit_reg=dedent("""\ + fit_reg : bool, optional + If ``True``, estimate and plot a regression model relating the ``x`` + and ``y`` variables.\ + """), + ci=dedent("""\ + ci : int in [0, 100] or None, optional + Size of the confidence interval for the regression estimate. This will + be drawn using translucent bands around the regression line. The + confidence interval is estimated using a bootstrap; for large + datasets, it may be advisable to avoid that computation by setting + this parameter to None.\ + """), + n_boot=dedent("""\ + n_boot : int, optional + Number of bootstrap resamples used to estimate the ``ci``. The default + value attempts to balance time and stability; you may want to increase + this value for "final" versions of plots.\ + """), + units=dedent("""\ + units : variable name in ``data``, optional + If the ``x`` and ``y`` observations are nested within sampling units, + those can be specified here. This will be taken into account when + computing the confidence intervals by performing a multilevel bootstrap + that resamples both units and observations (within unit). This does not + otherwise influence how the regression is estimated or drawn.\ + """), + seed=dedent("""\ + seed : int, numpy.random.Generator, or numpy.random.RandomState, optional + Seed or random number generator for reproducible bootstrapping.\ + """), + order=dedent("""\ + order : int, optional + If ``order`` is greater than 1, use ``numpy.polyfit`` to estimate a + polynomial regression.\ + """), + logistic=dedent("""\ + logistic : bool, optional + If ``True``, assume that ``y`` is a binary variable and use + ``statsmodels`` to estimate a logistic regression model. Note that this + is substantially more computationally intensive than linear regression, + so you may wish to decrease the number of bootstrap resamples + (``n_boot``) or set ``ci`` to None.\ + """), + lowess=dedent("""\ + lowess : bool, optional + If ``True``, use ``statsmodels`` to estimate a nonparametric lowess + model (locally weighted linear regression). Note that confidence + intervals cannot currently be drawn for this kind of model.\ + """), + robust=dedent("""\ + robust : bool, optional + If ``True``, use ``statsmodels`` to estimate a robust regression. This + will de-weight outliers. Note that this is substantially more + computationally intensive than standard linear regression, so you may + wish to decrease the number of bootstrap resamples (``n_boot``) or set + ``ci`` to None.\ + """), + logx=dedent("""\ + logx : bool, optional + If ``True``, estimate a linear regression of the form y ~ log(x), but + plot the scatterplot and regression model in the input space. Note that + ``x`` must be positive for this to work.\ + """), + xy_partial=dedent("""\ + {x,y}_partial : strings in ``data`` or matrices + Confounding variables to regress out of the ``x`` or ``y`` variables + before plotting.\ + """), + truncate=dedent("""\ + truncate : bool, optional + If ``True``, the regression line is bounded by the data limits. If + ``False``, it extends to the ``x`` axis limits. + """), + xy_jitter=dedent("""\ + {x,y}_jitter : floats, optional + Add uniform random noise of this size to either the ``x`` or ``y`` + variables. The noise is added to a copy of the data after fitting the + regression, and only influences the look of the scatterplot. This can + be helpful when plotting variables that take discrete values.\ + """), + scatter_line_kws=dedent("""\ + {scatter,line}_kws : dictionaries + Additional keyword arguments to pass to ``plt.scatter`` and + ``plt.plot``.\ + """), +) +_regression_docs.update(_facet_docs) + + +def lmplot( + data, *, + x=None, y=None, hue=None, col=None, row=None, + palette=None, col_wrap=None, height=5, aspect=1, markers="o", + sharex=None, sharey=None, hue_order=None, col_order=None, row_order=None, + legend=True, legend_out=None, x_estimator=None, x_bins=None, + x_ci="ci", scatter=True, fit_reg=True, ci=95, n_boot=1000, + units=None, seed=None, order=1, logistic=False, lowess=False, + robust=False, logx=False, x_partial=None, y_partial=None, + truncate=True, x_jitter=None, y_jitter=None, scatter_kws=None, + line_kws=None, facet_kws=None, +): + + if facet_kws is None: + facet_kws = {} + + def facet_kw_deprecation(key, val): + msg = ( + f"{key} is deprecated from the `lmplot` function signature. " + "Please update your code to pass it using `facet_kws`." + ) + if val is not None: + warnings.warn(msg, UserWarning) + facet_kws[key] = val + + facet_kw_deprecation("sharex", sharex) + facet_kw_deprecation("sharey", sharey) + facet_kw_deprecation("legend_out", legend_out) + + if data is None: + raise TypeError("Missing required keyword argument `data`.") + + # Reduce the dataframe to only needed columns + need_cols = [x, y, hue, col, row, units, x_partial, y_partial] + cols = np.unique([a for a in need_cols if a is not None]).tolist() + data = data[cols] + + # Initialize the grid + facets = FacetGrid( + data, row=row, col=col, hue=hue, + palette=palette, + row_order=row_order, col_order=col_order, hue_order=hue_order, + height=height, aspect=aspect, col_wrap=col_wrap, + **facet_kws, + ) + + # Add the markers here as FacetGrid has figured out how many levels of the + # hue variable are needed and we don't want to duplicate that process + if facets.hue_names is None: + n_markers = 1 + else: + n_markers = len(facets.hue_names) + if not isinstance(markers, list): + markers = [markers] * n_markers + if len(markers) != n_markers: + raise ValueError("markers must be a singleton or a list of markers " + "for each level of the hue variable") + facets.hue_kws = {"marker": markers} + + def update_datalim(data, x, y, ax, **kws): + xys = data[[x, y]].to_numpy().astype(float) + ax.update_datalim(xys, updatey=False) + ax.autoscale_view(scaley=False) + + facets.map_dataframe(update_datalim, x=x, y=y) + + # Draw the regression plot on each facet + regplot_kws = dict( + x_estimator=x_estimator, x_bins=x_bins, x_ci=x_ci, + scatter=scatter, fit_reg=fit_reg, ci=ci, n_boot=n_boot, units=units, + seed=seed, order=order, logistic=logistic, lowess=lowess, + robust=robust, logx=logx, x_partial=x_partial, y_partial=y_partial, + truncate=truncate, x_jitter=x_jitter, y_jitter=y_jitter, + scatter_kws=scatter_kws, line_kws=line_kws, + ) + facets.map_dataframe(regplot, x=x, y=y, **regplot_kws) + facets.set_axis_labels(x, y) + + # Add a legend + if legend and (hue is not None) and (hue not in [col, row]): + facets.add_legend() + return facets + + +lmplot.__doc__ = dedent("""\ + Plot data and regression model fits across a FacetGrid. + + This function combines :func:`regplot` and :class:`FacetGrid`. It is + intended as a convenient interface to fit regression models across + conditional subsets of a dataset. + + When thinking about how to assign variables to different facets, a general + rule is that it makes sense to use ``hue`` for the most important + comparison, followed by ``col`` and ``row``. However, always think about + your particular dataset and the goals of the visualization you are + creating. + + {model_api} + + The parameters to this function span most of the options in + :class:`FacetGrid`, although there may be occasional cases where you will + want to use that class and :func:`regplot` directly. + + Parameters + ---------- + {data} + x, y : strings, optional + Input variables; these should be column names in ``data``. + hue, col, row : strings + Variables that define subsets of the data, which will be drawn on + separate facets in the grid. See the ``*_order`` parameters to control + the order of levels of this variable. + {palette} + {col_wrap} + {height} + {aspect} + markers : matplotlib marker code or list of marker codes, optional + Markers for the scatterplot. If a list, each marker in the list will be + used for each level of the ``hue`` variable. + {share_xy} + + .. deprecated:: 0.12.0 + Pass using the `facet_kws` dictionary. + + {{hue,col,row}}_order : lists, optional + Order for the levels of the faceting variables. By default, this will + be the order that the levels appear in ``data`` or, if the variables + are pandas categoricals, the category order. + legend : bool, optional + If ``True`` and there is a ``hue`` variable, add a legend. + {legend_out} + + .. deprecated:: 0.12.0 + Pass using the `facet_kws` dictionary. + + {x_estimator} + {x_bins} + {x_ci} + {scatter} + {fit_reg} + {ci} + {n_boot} + {units} + {seed} + {order} + {logistic} + {lowess} + {robust} + {logx} + {xy_partial} + {truncate} + {xy_jitter} + {scatter_line_kws} + facet_kws : dict + Dictionary of keyword arguments for :class:`FacetGrid`. + + See Also + -------- + regplot : Plot data and a conditional model fit. + FacetGrid : Subplot grid for plotting conditional relationships. + pairplot : Combine :func:`regplot` and :class:`PairGrid` (when used with + ``kind="reg"``). + + Notes + ----- + + {regplot_vs_lmplot} + + Examples + -------- + + .. include:: ../docstrings/lmplot.rst + + """).format(**_regression_docs) + + +def regplot( + data=None, *, x=None, y=None, + x_estimator=None, x_bins=None, x_ci="ci", + scatter=True, fit_reg=True, ci=95, n_boot=1000, units=None, + seed=None, order=1, logistic=False, lowess=False, robust=False, + logx=False, x_partial=None, y_partial=None, + truncate=True, dropna=True, x_jitter=None, y_jitter=None, + label=None, color=None, marker="o", + scatter_kws=None, line_kws=None, ax=None +): + + plotter = _RegressionPlotter(x, y, data, x_estimator, x_bins, x_ci, + scatter, fit_reg, ci, n_boot, units, seed, + order, logistic, lowess, robust, logx, + x_partial, y_partial, truncate, dropna, + x_jitter, y_jitter, color, label) + + if ax is None: + ax = plt.gca() + + scatter_kws = {} if scatter_kws is None else copy.copy(scatter_kws) + scatter_kws["marker"] = marker + line_kws = {} if line_kws is None else copy.copy(line_kws) + plotter.plot(ax, scatter_kws, line_kws) + return ax + + +regplot.__doc__ = dedent("""\ + Plot data and a linear regression model fit. + + {model_api} + + Parameters + ---------- + x, y: string, series, or vector array + Input variables. If strings, these should correspond with column names + in ``data``. When pandas objects are used, axes will be labeled with + the series name. + {data} + {x_estimator} + {x_bins} + {x_ci} + {scatter} + {fit_reg} + {ci} + {n_boot} + {units} + {seed} + {order} + {logistic} + {lowess} + {robust} + {logx} + {xy_partial} + {truncate} + {xy_jitter} + label : string + Label to apply to either the scatterplot or regression line (if + ``scatter`` is ``False``) for use in a legend. + color : matplotlib color + Color to apply to all plot elements; will be superseded by colors + passed in ``scatter_kws`` or ``line_kws``. + marker : matplotlib marker code + Marker to use for the scatterplot glyphs. + {scatter_line_kws} + ax : matplotlib Axes, optional + Axes object to draw the plot onto, otherwise uses the current Axes. + + Returns + ------- + ax : matplotlib Axes + The Axes object containing the plot. + + See Also + -------- + lmplot : Combine :func:`regplot` and :class:`FacetGrid` to plot multiple + linear relationships in a dataset. + jointplot : Combine :func:`regplot` and :class:`JointGrid` (when used with + ``kind="reg"``). + pairplot : Combine :func:`regplot` and :class:`PairGrid` (when used with + ``kind="reg"``). + residplot : Plot the residuals of a linear regression model. + + Notes + ----- + + {regplot_vs_lmplot} + + + It's also easy to combine :func:`regplot` and :class:`JointGrid` or + :class:`PairGrid` through the :func:`jointplot` and :func:`pairplot` + functions, although these do not directly accept all of :func:`regplot`'s + parameters. + + Examples + -------- + + .. include:: ../docstrings/regplot.rst + + """).format(**_regression_docs) + + +def residplot( + data=None, *, x=None, y=None, + x_partial=None, y_partial=None, lowess=False, + order=1, robust=False, dropna=True, label=None, color=None, + scatter_kws=None, line_kws=None, ax=None +): + """Plot the residuals of a linear regression. + + This function will regress y on x (possibly as a robust or polynomial + regression) and then draw a scatterplot of the residuals. You can + optionally fit a lowess smoother to the residual plot, which can + help in determining if there is structure to the residuals. + + Parameters + ---------- + data : DataFrame, optional + DataFrame to use if `x` and `y` are column names. + x : vector or string + Data or column name in `data` for the predictor variable. + y : vector or string + Data or column name in `data` for the response variable. + {x, y}_partial : vectors or string(s) , optional + These variables are treated as confounding and are removed from + the `x` or `y` variables before plotting. + lowess : boolean, optional + Fit a lowess smoother to the residual scatterplot. + order : int, optional + Order of the polynomial to fit when calculating the residuals. + robust : boolean, optional + Fit a robust linear regression when calculating the residuals. + dropna : boolean, optional + If True, ignore observations with missing data when fitting and + plotting. + label : string, optional + Label that will be used in any plot legends. + color : matplotlib color, optional + Color to use for all elements of the plot. + {scatter, line}_kws : dictionaries, optional + Additional keyword arguments passed to scatter() and plot() for drawing + the components of the plot. + ax : matplotlib axis, optional + Plot into this axis, otherwise grab the current axis or make a new + one if not existing. + + Returns + ------- + ax: matplotlib axes + Axes with the regression plot. + + See Also + -------- + regplot : Plot a simple linear regression model. + jointplot : Draw a :func:`residplot` with univariate marginal distributions + (when used with ``kind="resid"``). + + Examples + -------- + + .. include:: ../docstrings/residplot.rst + + """ + plotter = _RegressionPlotter(x, y, data, ci=None, + order=order, robust=robust, + x_partial=x_partial, y_partial=y_partial, + dropna=dropna, color=color, label=label) + + if ax is None: + ax = plt.gca() + + # Calculate the residual from a linear regression + _, yhat, _ = plotter.fit_regression(grid=plotter.x) + plotter.y = plotter.y - yhat + + # Set the regression option on the plotter + if lowess: + plotter.lowess = True + else: + plotter.fit_reg = False + + # Plot a horizontal line at 0 + ax.axhline(0, ls=":", c=".2") + + # Draw the scatterplot + scatter_kws = {} if scatter_kws is None else scatter_kws.copy() + line_kws = {} if line_kws is None else line_kws.copy() + plotter.plot(ax, scatter_kws, line_kws) + return ax diff --git a/shared/package-files/33/335449ddfb59e317ccded7a8fd45adfa06bb827e3bc9f24d9b80569a6a8da815/blob b/shared/package-files/33/335449ddfb59e317ccded7a8fd45adfa06bb827e3bc9f24d9b80569a6a8da815/blob new file mode 100644 index 0000000000000000000000000000000000000000..8e20200568ed961849b5510e8626cdbe6e5b9643 --- /dev/null +++ b/shared/package-files/33/335449ddfb59e317ccded7a8fd45adfa06bb827e3bc9f24d9b80569a6a8da815/blob @@ -0,0 +1,759 @@ +__all__ = ['RegularGridInterpolator', 'interpn'] + +import itertools + +import numpy as np + +import scipy.sparse.linalg as ssl + +from ._interpnd import _ndim_coords_from_arrays +from ._cubic import PchipInterpolator +from ._rgi_cython import evaluate_linear_2d, find_indices +from ._bsplines import make_interp_spline +from ._fitpack2 import RectBivariateSpline +from ._ndbspline import make_ndbspl + + +def _check_points(points): + descending_dimensions = [] + grid = [] + for i, p in enumerate(points): + # early make points float + # see https://github.com/scipy/scipy/pull/17230 + p = np.asarray(p, dtype=float) + if not np.all(p[1:] > p[:-1]): + if np.all(p[1:] < p[:-1]): + # input is descending, so make it ascending + descending_dimensions.append(i) + p = np.flip(p) + else: + raise ValueError( + "The points in dimension %d must be strictly " + "ascending or descending" % i) + # see https://github.com/scipy/scipy/issues/17716 + p = np.ascontiguousarray(p) + grid.append(p) + return tuple(grid), tuple(descending_dimensions) + + +def _check_dimensionality(points, values): + if len(points) > values.ndim: + raise ValueError("There are %d point arrays, but values has %d " + "dimensions" % (len(points), values.ndim)) + for i, p in enumerate(points): + if not np.asarray(p).ndim == 1: + raise ValueError("The points in dimension %d must be " + "1-dimensional" % i) + if not values.shape[i] == len(p): + raise ValueError("There are %d points and %d values in " + "dimension %d" % (len(p), values.shape[i], i)) + + +class RegularGridInterpolator: + """ + Interpolator on a regular or rectilinear grid in arbitrary dimensions. + + The data must be defined on a rectilinear grid; that is, a rectangular + grid with even or uneven spacing. Linear, nearest-neighbor, spline + interpolations are supported. After setting up the interpolator object, + the interpolation method may be chosen at each evaluation. + + Parameters + ---------- + points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, ) + The points defining the regular grid in n dimensions. The points in + each dimension (i.e. every elements of the points tuple) must be + strictly ascending or descending. + + values : array_like, shape (m1, ..., mn, ...) + The data on the regular grid in n dimensions. Complex data is + accepted. + + method : str, optional + The method of interpolation to perform. Supported are "linear", + "nearest", "slinear", "cubic", "quintic" and "pchip". This + parameter will become the default for the object's ``__call__`` + method. Default is "linear". + + bounds_error : bool, optional + If True, when interpolated values are requested outside of the + domain of the input data, a ValueError is raised. + If False, then `fill_value` is used. + Default is True. + + fill_value : float or None, optional + The value to use for points outside of the interpolation domain. + If None, values outside the domain are extrapolated. + Default is ``np.nan``. + + solver : callable, optional + Only used for methods "slinear", "cubic" and "quintic". + Sparse linear algebra solver for construction of the NdBSpline instance. + Default is the iterative solver `scipy.sparse.linalg.gcrotmk`. + + .. versionadded:: 1.13 + + solver_args: dict, optional + Additional arguments to pass to `solver`, if any. + + .. versionadded:: 1.13 + + Methods + ------- + __call__ + + Attributes + ---------- + grid : tuple of ndarrays + The points defining the regular grid in n dimensions. + This tuple defines the full grid via + ``np.meshgrid(*grid, indexing='ij')`` + values : ndarray + Data values at the grid. + method : str + Interpolation method. + fill_value : float or ``None`` + Use this value for out-of-bounds arguments to `__call__`. + bounds_error : bool + If ``True``, out-of-bounds argument raise a ``ValueError``. + + Notes + ----- + Contrary to `LinearNDInterpolator` and `NearestNDInterpolator`, this class + avoids expensive triangulation of the input data by taking advantage of the + regular grid structure. + + In other words, this class assumes that the data is defined on a + *rectilinear* grid. + + .. versionadded:: 0.14 + + The 'slinear'(k=1), 'cubic'(k=3), and 'quintic'(k=5) methods are + tensor-product spline interpolators, where `k` is the spline degree, + If any dimension has fewer points than `k` + 1, an error will be raised. + + .. versionadded:: 1.9 + + If the input data is such that dimensions have incommensurate + units and differ by many orders of magnitude, the interpolant may have + numerical artifacts. Consider rescaling the data before interpolating. + + **Choosing a solver for spline methods** + + Spline methods, "slinear", "cubic" and "quintic" involve solving a + large sparse linear system at instantiation time. Depending on data, + the default solver may or may not be adequate. When it is not, you may + need to experiment with an optional `solver` argument, where you may + choose between the direct solver (`scipy.sparse.linalg.spsolve`) or + iterative solvers from `scipy.sparse.linalg`. You may need to supply + additional parameters via the optional `solver_args` parameter (for instance, + you may supply the starting value or target tolerance). See the + `scipy.sparse.linalg` documentation for the full list of available options. + + Alternatively, you may instead use the legacy methods, "slinear_legacy", + "cubic_legacy" and "quintic_legacy". These methods allow faster construction + but evaluations will be much slower. + + Examples + -------- + **Evaluate a function on the points of a 3-D grid** + + As a first example, we evaluate a simple example function on the points of + a 3-D grid: + + >>> from scipy.interpolate import RegularGridInterpolator + >>> import numpy as np + >>> def f(x, y, z): + ... return 2 * x**3 + 3 * y**2 - z + >>> x = np.linspace(1, 4, 11) + >>> y = np.linspace(4, 7, 22) + >>> z = np.linspace(7, 9, 33) + >>> xg, yg ,zg = np.meshgrid(x, y, z, indexing='ij', sparse=True) + >>> data = f(xg, yg, zg) + + ``data`` is now a 3-D array with ``data[i, j, k] = f(x[i], y[j], z[k])``. + Next, define an interpolating function from this data: + + >>> interp = RegularGridInterpolator((x, y, z), data) + + Evaluate the interpolating function at the two points + ``(x,y,z) = (2.1, 6.2, 8.3)`` and ``(3.3, 5.2, 7.1)``: + + >>> pts = np.array([[2.1, 6.2, 8.3], + ... [3.3, 5.2, 7.1]]) + >>> interp(pts) + array([ 125.80469388, 146.30069388]) + + which is indeed a close approximation to + + >>> f(2.1, 6.2, 8.3), f(3.3, 5.2, 7.1) + (125.54200000000002, 145.894) + + **Interpolate and extrapolate a 2D dataset** + + As a second example, we interpolate and extrapolate a 2D data set: + + >>> x, y = np.array([-2, 0, 4]), np.array([-2, 0, 2, 5]) + >>> def ff(x, y): + ... return x**2 + y**2 + + >>> xg, yg = np.meshgrid(x, y, indexing='ij') + >>> data = ff(xg, yg) + >>> interp = RegularGridInterpolator((x, y), data, + ... bounds_error=False, fill_value=None) + + >>> import matplotlib.pyplot as plt + >>> fig = plt.figure() + >>> ax = fig.add_subplot(projection='3d') + >>> ax.scatter(xg.ravel(), yg.ravel(), data.ravel(), + ... s=60, c='k', label='data') + + Evaluate and plot the interpolator on a finer grid + + >>> xx = np.linspace(-4, 9, 31) + >>> yy = np.linspace(-4, 9, 31) + >>> X, Y = np.meshgrid(xx, yy, indexing='ij') + + >>> # interpolator + >>> ax.plot_wireframe(X, Y, interp((X, Y)), rstride=3, cstride=3, + ... alpha=0.4, color='m', label='linear interp') + + >>> # ground truth + >>> ax.plot_wireframe(X, Y, ff(X, Y), rstride=3, cstride=3, + ... alpha=0.4, label='ground truth') + >>> plt.legend() + >>> plt.show() + + Other examples are given + :ref:`in the tutorial `. + + See Also + -------- + NearestNDInterpolator : Nearest neighbor interpolator on *unstructured* + data in N dimensions + + LinearNDInterpolator : Piecewise linear interpolator on *unstructured* data + in N dimensions + + interpn : a convenience function which wraps `RegularGridInterpolator` + + scipy.ndimage.map_coordinates : interpolation on grids with equal spacing + (suitable for e.g., N-D image resampling) + + References + ---------- + .. [1] Python package *regulargrid* by Johannes Buchner, see + https://pypi.python.org/pypi/regulargrid/ + .. [2] Wikipedia, "Trilinear interpolation", + https://en.wikipedia.org/wiki/Trilinear_interpolation + .. [3] Weiser, Alan, and Sergio E. Zarantonello. "A note on piecewise linear + and multilinear table interpolation in many dimensions." MATH. + COMPUT. 50.181 (1988): 189-196. + https://www.ams.org/journals/mcom/1988-50-181/S0025-5718-1988-0917826-0/S0025-5718-1988-0917826-0.pdf + :doi:`10.1090/S0025-5718-1988-0917826-0` + + """ + # this class is based on code originally programmed by Johannes Buchner, + # see https://github.com/JohannesBuchner/regulargrid + + _SPLINE_DEGREE_MAP = {"slinear": 1, "cubic": 3, "quintic": 5, 'pchip': 3, + "slinear_legacy": 1, "cubic_legacy": 3, "quintic_legacy": 5,} + _SPLINE_METHODS_recursive = {"slinear_legacy", "cubic_legacy", + "quintic_legacy", "pchip"} + _SPLINE_METHODS_ndbspl = {"slinear", "cubic", "quintic"} + _SPLINE_METHODS = list(_SPLINE_DEGREE_MAP.keys()) + _ALL_METHODS = ["linear", "nearest"] + _SPLINE_METHODS + + def __init__(self, points, values, method="linear", bounds_error=True, + fill_value=np.nan, *, solver=None, solver_args=None): + if method not in self._ALL_METHODS: + raise ValueError(f"Method '{method}' is not defined") + elif method in self._SPLINE_METHODS: + self._validate_grid_dimensions(points, method) + self.method = method + self._spline = None + self.bounds_error = bounds_error + self.grid, self._descending_dimensions = _check_points(points) + self.values = self._check_values(values) + self._check_dimensionality(self.grid, self.values) + self.fill_value = self._check_fill_value(self.values, fill_value) + if self._descending_dimensions: + self.values = np.flip(values, axis=self._descending_dimensions) + if self.method == "pchip" and np.iscomplexobj(self.values): + msg = ("`PchipInterpolator` only works with real values. If you are trying " + "to use the real components of the passed array, use `np.real` on " + "the array before passing to `RegularGridInterpolator`.") + raise ValueError(msg) + if method in self._SPLINE_METHODS_ndbspl: + if solver_args is None: + solver_args = {} + self._spline = self._construct_spline(method, solver, **solver_args) + else: + if solver is not None or solver_args: + raise ValueError( + f"{method =} does not accept the 'solver' argument. Got " + f" {solver = } and with arguments {solver_args}." + ) + + def _construct_spline(self, method, solver=None, **solver_args): + if solver is None: + solver = ssl.gcrotmk + spl = make_ndbspl( + self.grid, self.values, self._SPLINE_DEGREE_MAP[method], + solver=solver, **solver_args + ) + return spl + + def _check_dimensionality(self, grid, values): + _check_dimensionality(grid, values) + + def _check_points(self, points): + return _check_points(points) + + def _check_values(self, values): + if not hasattr(values, 'ndim'): + # allow reasonable duck-typed values + values = np.asarray(values) + + if hasattr(values, 'dtype') and hasattr(values, 'astype'): + if not np.issubdtype(values.dtype, np.inexact): + values = values.astype(float) + + return values + + def _check_fill_value(self, values, fill_value): + if fill_value is not None: + fill_value_dtype = np.asarray(fill_value).dtype + if (hasattr(values, 'dtype') and not + np.can_cast(fill_value_dtype, values.dtype, + casting='same_kind')): + raise ValueError("fill_value must be either 'None' or " + "of a type compatible with values") + return fill_value + + def __call__(self, xi, method=None, *, nu=None): + """ + Interpolation at coordinates. + + Parameters + ---------- + xi : ndarray of shape (..., ndim) + The coordinates to evaluate the interpolator at. + + method : str, optional + The method of interpolation to perform. Supported are "linear", + "nearest", "slinear", "cubic", "quintic" and "pchip". Default is + the method chosen when the interpolator was created. + + nu : sequence of ints, length ndim, optional + If not None, the orders of the derivatives to evaluate. + Each entry must be non-negative. + Only allowed for methods "slinear", "cubic" and "quintic". + + .. versionadded:: 1.13 + + Returns + ------- + values_x : ndarray, shape xi.shape[:-1] + values.shape[ndim:] + Interpolated values at `xi`. See notes for behaviour when + ``xi.ndim == 1``. + + Notes + ----- + In the case that ``xi.ndim == 1`` a new axis is inserted into + the 0 position of the returned array, values_x, so its shape is + instead ``(1,) + values.shape[ndim:]``. + + Examples + -------- + Here we define a nearest-neighbor interpolator of a simple function + + >>> import numpy as np + >>> x, y = np.array([0, 1, 2]), np.array([1, 3, 7]) + >>> def f(x, y): + ... return x**2 + y**2 + >>> data = f(*np.meshgrid(x, y, indexing='ij', sparse=True)) + >>> from scipy.interpolate import RegularGridInterpolator + >>> interp = RegularGridInterpolator((x, y), data, method='nearest') + + By construction, the interpolator uses the nearest-neighbor + interpolation + + >>> interp([[1.5, 1.3], [0.3, 4.5]]) + array([2., 9.]) + + We can however evaluate the linear interpolant by overriding the + `method` parameter + + >>> interp([[1.5, 1.3], [0.3, 4.5]], method='linear') + array([ 4.7, 24.3]) + """ + _spline = self._spline + method = self.method if method is None else method + is_method_changed = self.method != method + if method not in self._ALL_METHODS: + raise ValueError(f"Method '{method}' is not defined") + if is_method_changed and method in self._SPLINE_METHODS_ndbspl: + _spline = self._construct_spline(method) + + if nu is not None and method not in self._SPLINE_METHODS_ndbspl: + raise ValueError( + f"Can only compute derivatives for methods " + f"{self._SPLINE_METHODS_ndbspl}, got {method =}." + ) + + xi, xi_shape, ndim, nans, out_of_bounds = self._prepare_xi(xi) + + if method == "linear": + indices, norm_distances = self._find_indices(xi.T) + if (ndim == 2 and hasattr(self.values, 'dtype') and + self.values.ndim == 2 and self.values.flags.writeable and + self.values.dtype in (np.float64, np.complex128) and + self.values.dtype.byteorder == '='): + # until cython supports const fused types, the fast path + # cannot support non-writeable values + # a fast path + out = np.empty(indices.shape[1], dtype=self.values.dtype) + result = evaluate_linear_2d(self.values, + indices, + norm_distances, + self.grid, + out) + else: + result = self._evaluate_linear(indices, norm_distances) + elif method == "nearest": + indices, norm_distances = self._find_indices(xi.T) + result = self._evaluate_nearest(indices, norm_distances) + elif method in self._SPLINE_METHODS: + if is_method_changed: + self._validate_grid_dimensions(self.grid, method) + if method in self._SPLINE_METHODS_recursive: + result = self._evaluate_spline(xi, method) + else: + result = _spline(xi, nu=nu) + + if not self.bounds_error and self.fill_value is not None: + result[out_of_bounds] = self.fill_value + + # f(nan) = nan, if any + if np.any(nans): + result[nans] = np.nan + return result.reshape(xi_shape[:-1] + self.values.shape[ndim:]) + + def _prepare_xi(self, xi): + ndim = len(self.grid) + xi = _ndim_coords_from_arrays(xi, ndim=ndim) + if xi.shape[-1] != len(self.grid): + raise ValueError("The requested sample points xi have dimension " + f"{xi.shape[-1]} but this " + f"RegularGridInterpolator has dimension {ndim}") + + xi_shape = xi.shape + xi = xi.reshape(-1, xi_shape[-1]) + xi = np.asarray(xi, dtype=float) + + # find nans in input + nans = np.any(np.isnan(xi), axis=-1) + + if self.bounds_error: + for i, p in enumerate(xi.T): + if not np.logical_and(np.all(self.grid[i][0] <= p), + np.all(p <= self.grid[i][-1])): + raise ValueError("One of the requested xi is out of bounds " + "in dimension %d" % i) + out_of_bounds = None + else: + out_of_bounds = self._find_out_of_bounds(xi.T) + + return xi, xi_shape, ndim, nans, out_of_bounds + + def _evaluate_linear(self, indices, norm_distances): + # slice for broadcasting over trailing dimensions in self.values + vslice = (slice(None),) + (None,)*(self.values.ndim - len(indices)) + + # Compute shifting up front before zipping everything together + shift_norm_distances = [1 - yi for yi in norm_distances] + shift_indices = [i + 1 for i in indices] + + # The formula for linear interpolation in 2d takes the form: + # values = self.values[(i0, i1)] * (1 - y0) * (1 - y1) + \ + # self.values[(i0, i1 + 1)] * (1 - y0) * y1 + \ + # self.values[(i0 + 1, i1)] * y0 * (1 - y1) + \ + # self.values[(i0 + 1, i1 + 1)] * y0 * y1 + # We pair i with 1 - yi (zipped1) and i + 1 with yi (zipped2) + zipped1 = zip(indices, shift_norm_distances) + zipped2 = zip(shift_indices, norm_distances) + + # Take all products of zipped1 and zipped2 and iterate over them + # to get the terms in the above formula. This corresponds to iterating + # over the vertices of a hypercube. + hypercube = itertools.product(*zip(zipped1, zipped2)) + value = np.array([0.]) + for h in hypercube: + edge_indices, weights = zip(*h) + weight = np.array([1.]) + for w in weights: + weight = weight * w + term = np.asarray(self.values[edge_indices]) * weight[vslice] + value = value + term # cannot use += because broadcasting + return value + + def _evaluate_nearest(self, indices, norm_distances): + idx_res = [np.where(yi <= .5, i, i + 1) + for i, yi in zip(indices, norm_distances)] + return self.values[tuple(idx_res)] + + def _validate_grid_dimensions(self, points, method): + k = self._SPLINE_DEGREE_MAP[method] + for i, point in enumerate(points): + ndim = len(np.atleast_1d(point)) + if ndim <= k: + raise ValueError(f"There are {ndim} points in dimension {i}," + f" but method {method} requires at least " + f" {k+1} points per dimension.") + + def _evaluate_spline(self, xi, method): + # ensure xi is 2D list of points to evaluate (`m` is the number of + # points and `n` is the number of interpolation dimensions, + # ``n == len(self.grid)``.) + if xi.ndim == 1: + xi = xi.reshape((1, xi.size)) + m, n = xi.shape + + # Reorder the axes: n-dimensional process iterates over the + # interpolation axes from the last axis downwards: E.g. for a 4D grid + # the order of axes is 3, 2, 1, 0. Each 1D interpolation works along + # the 0th axis of its argument array (for 1D routine it's its ``y`` + # array). Thus permute the interpolation axes of `values` *and keep + # trailing dimensions trailing*. + axes = tuple(range(self.values.ndim)) + axx = axes[:n][::-1] + axes[n:] + values = self.values.transpose(axx) + + if method == 'pchip': + _eval_func = self._do_pchip + else: + _eval_func = self._do_spline_fit + k = self._SPLINE_DEGREE_MAP[method] + + # Non-stationary procedure: difficult to vectorize this part entirely + # into numpy-level operations. Unfortunately this requires explicit + # looping over each point in xi. + + # can at least vectorize the first pass across all points in the + # last variable of xi. + last_dim = n - 1 + first_values = _eval_func(self.grid[last_dim], + values, + xi[:, last_dim], + k) + + # the rest of the dimensions have to be on a per point-in-xi basis + shape = (m, *self.values.shape[n:]) + result = np.empty(shape, dtype=self.values.dtype) + for j in range(m): + # Main process: Apply 1D interpolate in each dimension + # sequentially, starting with the last dimension. + # These are then "folded" into the next dimension in-place. + folded_values = first_values[j, ...] + for i in range(last_dim-1, -1, -1): + # Interpolate for each 1D from the last dimensions. + # This collapses each 1D sequence into a scalar. + folded_values = _eval_func(self.grid[i], + folded_values, + xi[j, i], + k) + result[j, ...] = folded_values + + return result + + @staticmethod + def _do_spline_fit(x, y, pt, k): + local_interp = make_interp_spline(x, y, k=k, axis=0) + values = local_interp(pt) + return values + + @staticmethod + def _do_pchip(x, y, pt, k): + local_interp = PchipInterpolator(x, y, axis=0) + values = local_interp(pt) + return values + + def _find_indices(self, xi): + return find_indices(self.grid, xi) + + def _find_out_of_bounds(self, xi): + # check for out of bounds xi + out_of_bounds = np.zeros((xi.shape[1]), dtype=bool) + # iterate through dimensions + for x, grid in zip(xi, self.grid): + out_of_bounds += x < grid[0] + out_of_bounds += x > grid[-1] + return out_of_bounds + + +def interpn(points, values, xi, method="linear", bounds_error=True, + fill_value=np.nan): + """ + Multidimensional interpolation on regular or rectilinear grids. + + Strictly speaking, not all regular grids are supported - this function + works on *rectilinear* grids, that is, a rectangular grid with even or + uneven spacing. + + Parameters + ---------- + points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, ) + The points defining the regular grid in n dimensions. The points in + each dimension (i.e. every elements of the points tuple) must be + strictly ascending or descending. + + values : array_like, shape (m1, ..., mn, ...) + The data on the regular grid in n dimensions. Complex data is + accepted. + + .. deprecated:: 1.13.0 + Complex data is deprecated with ``method="pchip"`` and will raise an + error in SciPy 1.15.0. This is because ``PchipInterpolator`` only + works with real values. If you are trying to use the real components of + the passed array, use ``np.real`` on ``values``. + + xi : ndarray of shape (..., ndim) + The coordinates to sample the gridded data at + + method : str, optional + The method of interpolation to perform. Supported are "linear", + "nearest", "slinear", "cubic", "quintic", "pchip", and "splinef2d". + "splinef2d" is only supported for 2-dimensional data. + + bounds_error : bool, optional + If True, when interpolated values are requested outside of the + domain of the input data, a ValueError is raised. + If False, then `fill_value` is used. + + fill_value : number, optional + If provided, the value to use for points outside of the + interpolation domain. If None, values outside + the domain are extrapolated. Extrapolation is not supported by method + "splinef2d". + + Returns + ------- + values_x : ndarray, shape xi.shape[:-1] + values.shape[ndim:] + Interpolated values at `xi`. See notes for behaviour when + ``xi.ndim == 1``. + + See Also + -------- + NearestNDInterpolator : Nearest neighbor interpolation on unstructured + data in N dimensions + LinearNDInterpolator : Piecewise linear interpolant on unstructured data + in N dimensions + RegularGridInterpolator : interpolation on a regular or rectilinear grid + in arbitrary dimensions (`interpn` wraps this + class). + RectBivariateSpline : Bivariate spline approximation over a rectangular mesh + scipy.ndimage.map_coordinates : interpolation on grids with equal spacing + (suitable for e.g., N-D image resampling) + + Notes + ----- + + .. versionadded:: 0.14 + + In the case that ``xi.ndim == 1`` a new axis is inserted into + the 0 position of the returned array, values_x, so its shape is + instead ``(1,) + values.shape[ndim:]``. + + If the input data is such that input dimensions have incommensurate + units and differ by many orders of magnitude, the interpolant may have + numerical artifacts. Consider rescaling the data before interpolation. + + Examples + -------- + Evaluate a simple example function on the points of a regular 3-D grid: + + >>> import numpy as np + >>> from scipy.interpolate import interpn + >>> def value_func_3d(x, y, z): + ... return 2 * x + 3 * y - z + >>> x = np.linspace(0, 4, 5) + >>> y = np.linspace(0, 5, 6) + >>> z = np.linspace(0, 6, 7) + >>> points = (x, y, z) + >>> values = value_func_3d(*np.meshgrid(*points, indexing='ij')) + + Evaluate the interpolating function at a point + + >>> point = np.array([2.21, 3.12, 1.15]) + >>> print(interpn(points, values, point)) + [12.63] + + """ + # sanity check 'method' kwarg + if method not in ["linear", "nearest", "cubic", "quintic", "pchip", + "splinef2d", "slinear", + "slinear_legacy", "cubic_legacy", "quintic_legacy"]: + raise ValueError("interpn only understands the methods 'linear', " + "'nearest', 'slinear', 'cubic', 'quintic', 'pchip', " + f"and 'splinef2d'. You provided {method}.") + + if not hasattr(values, 'ndim'): + values = np.asarray(values) + + ndim = values.ndim + if ndim > 2 and method == "splinef2d": + raise ValueError("The method splinef2d can only be used for " + "2-dimensional input data") + if not bounds_error and fill_value is None and method == "splinef2d": + raise ValueError("The method splinef2d does not support extrapolation.") + + # sanity check consistency of input dimensions + if len(points) > ndim: + raise ValueError("There are %d point arrays, but values has %d " + "dimensions" % (len(points), ndim)) + if len(points) != ndim and method == 'splinef2d': + raise ValueError("The method splinef2d can only be used for " + "scalar data with one point per coordinate") + + grid, descending_dimensions = _check_points(points) + _check_dimensionality(grid, values) + + # sanity check requested xi + xi = _ndim_coords_from_arrays(xi, ndim=len(grid)) + if xi.shape[-1] != len(grid): + raise ValueError("The requested sample points xi have dimension " + "%d, but this RegularGridInterpolator has " + "dimension %d" % (xi.shape[-1], len(grid))) + + if bounds_error: + for i, p in enumerate(xi.T): + if not np.logical_and(np.all(grid[i][0] <= p), + np.all(p <= grid[i][-1])): + raise ValueError("One of the requested xi is out of bounds " + "in dimension %d" % i) + + # perform interpolation + if method in RegularGridInterpolator._ALL_METHODS: + interp = RegularGridInterpolator(points, values, method=method, + bounds_error=bounds_error, + fill_value=fill_value) + return interp(xi) + elif method == "splinef2d": + xi_shape = xi.shape + xi = xi.reshape(-1, xi.shape[-1]) + + # RectBivariateSpline doesn't support fill_value; we need to wrap here + idx_valid = np.all((grid[0][0] <= xi[:, 0], xi[:, 0] <= grid[0][-1], + grid[1][0] <= xi[:, 1], xi[:, 1] <= grid[1][-1]), + axis=0) + result = np.empty_like(xi[:, 0]) + + # make a copy of values for RectBivariateSpline + interp = RectBivariateSpline(points[0], points[1], values[:]) + result[idx_valid] = interp.ev(xi[idx_valid, 0], xi[idx_valid, 1]) + result[np.logical_not(idx_valid)] = fill_value + + return result.reshape(xi_shape[:-1]) + else: + raise ValueError(f"unknown {method = }") diff --git a/shared/package-files/33/335515c7106005c298d2bee9bfc0ef384ebf0896afc3439dddf8bc887f803c49/blob b/shared/package-files/33/335515c7106005c298d2bee9bfc0ef384ebf0896afc3439dddf8bc887f803c49/blob new file mode 100644 index 0000000000000000000000000000000000000000..4bd5cdf73a049f6e83dafcc35c60d0a97db4502d --- /dev/null +++ b/shared/package-files/33/335515c7106005c298d2bee9bfc0ef384ebf0896afc3439dddf8bc887f803c49/blob @@ -0,0 +1,3 @@ +from typing import Dict, Any + +LANG_INFO: Dict[str, Any] = ... diff --git a/shared/package-files/33/3357196f3fa52433326a6626880e34964e00c5570aee50e9a0a0a7c6d86f6e4f/blob b/shared/package-files/33/3357196f3fa52433326a6626880e34964e00c5570aee50e9a0a0a7c6d86f6e4f/blob new file mode 100644 index 0000000000000000000000000000000000000000..86b458eb9bcd96b50f128df1978a14f5d1e41835 --- /dev/null +++ b/shared/package-files/33/3357196f3fa52433326a6626880e34964e00c5570aee50e9a0a0a7c6d86f6e4f/blob @@ -0,0 +1,42 @@ +""" Python 'utf-16-be' Codec + + +Written by Marc-Andre Lemburg (mal@lemburg.com). + +(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. + +""" +import codecs + +### Codec APIs + +encode = codecs.utf_16_be_encode + +def decode(input, errors='strict'): + return codecs.utf_16_be_decode(input, errors, True) + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input, final=False): + return codecs.utf_16_be_encode(input, self.errors)[0] + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + _buffer_decode = codecs.utf_16_be_decode + +class StreamWriter(codecs.StreamWriter): + encode = codecs.utf_16_be_encode + +class StreamReader(codecs.StreamReader): + decode = codecs.utf_16_be_decode + +### encodings module API + +def getregentry(): + return codecs.CodecInfo( + name='utf-16-be', + encode=encode, + decode=decode, + incrementalencoder=IncrementalEncoder, + incrementaldecoder=IncrementalDecoder, + streamreader=StreamReader, + streamwriter=StreamWriter, + ) diff --git a/shared/package-files/33/3359968d2ef4a582c525abb9df836d82c95ca58ffc362638751991813ef74d5a/blob b/shared/package-files/33/3359968d2ef4a582c525abb9df836d82c95ca58ffc362638751991813ef74d5a/blob new file mode 100644 index 0000000000000000000000000000000000000000..1abacddfc7e3b7035a9446cd4118097c6accd385 --- /dev/null +++ b/shared/package-files/33/3359968d2ef4a582c525abb9df836d82c95ca58ffc362638751991813ef74d5a/blob @@ -0,0 +1,113 @@ +from __future__ import annotations + +from collections import abc +from typing import TYPE_CHECKING + +from pandas.core.interchange.column import PandasColumn +from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrameXchg +from pandas.core.interchange.utils import maybe_rechunk + +if TYPE_CHECKING: + from collections.abc import ( + Iterable, + Sequence, + ) + + from pandas import ( + DataFrame, + Index, + ) + + +class PandasDataFrameXchg(DataFrameXchg): + """ + A data frame class, with only the methods required by the interchange + protocol defined. + Instances of this (private) class are returned from + ``pd.DataFrame.__dataframe__`` as objects with the methods and + attributes defined on this class. + """ + + def __init__(self, df: DataFrame, allow_copy: bool = True) -> None: + """ + Constructor - an instance of this (private) class is returned from + `pd.DataFrame.__dataframe__`. + """ + self._df = df.rename(columns=str, copy=False) + self._allow_copy = allow_copy + for i, _col in enumerate(self._df.columns): + rechunked = maybe_rechunk(self._df.iloc[:, i], allow_copy=allow_copy) + if rechunked is not None: + self._df.isetitem(i, rechunked) + + def __dataframe__( + self, nan_as_null: bool = False, allow_copy: bool = True + ) -> PandasDataFrameXchg: + # `nan_as_null` can be removed here once it's removed from + # Dataframe.__dataframe__ + return PandasDataFrameXchg(self._df, allow_copy) + + @property + def metadata(self) -> dict[str, Index]: + # `index` isn't a regular column, and the protocol doesn't support row + # labels - so we export it as Pandas-specific metadata here. + return {"pandas.index": self._df.index} + + def num_columns(self) -> int: + return len(self._df.columns) + + def num_rows(self) -> int: + return len(self._df) + + def num_chunks(self) -> int: + return 1 + + def column_names(self) -> Index: + return self._df.columns + + def get_column(self, i: int) -> PandasColumn: + return PandasColumn(self._df.iloc[:, i], allow_copy=self._allow_copy) + + def get_column_by_name(self, name: str) -> PandasColumn: + return PandasColumn(self._df[name], allow_copy=self._allow_copy) + + def get_columns(self) -> list[PandasColumn]: + return [ + PandasColumn(self._df[name], allow_copy=self._allow_copy) + for name in self._df.columns + ] + + def select_columns(self, indices: Sequence[int]) -> PandasDataFrameXchg: + if not isinstance(indices, abc.Sequence): + raise ValueError("`indices` is not a sequence") + if not isinstance(indices, list): + indices = list(indices) + + return PandasDataFrameXchg( + self._df.iloc[:, indices], allow_copy=self._allow_copy + ) + + def select_columns_by_name(self, names: list[str]) -> PandasDataFrameXchg: # type: ignore[override] + if not isinstance(names, abc.Sequence): + raise ValueError("`names` is not a sequence") + if not isinstance(names, list): + names = list(names) + + return PandasDataFrameXchg(self._df.loc[:, names], allow_copy=self._allow_copy) + + def get_chunks(self, n_chunks: int | None = None) -> Iterable[PandasDataFrameXchg]: + """ + Return an iterator yielding the chunks. + """ + if n_chunks and n_chunks > 1: + size = len(self._df) + step = size // n_chunks + if size % n_chunks != 0: + step += 1 + for start in range(0, step * n_chunks, step): + yield PandasDataFrameXchg( + self._df.iloc[start : start + step, :], + allow_copy=self._allow_copy, + ) + else: + yield self diff --git a/shared/package-files/33/335d111c3ea2342e83a5b02c3eb2e423783fad1fdfb3424854a6988135c720d2/blob b/shared/package-files/33/335d111c3ea2342e83a5b02c3eb2e423783fad1fdfb3424854a6988135c720d2/blob new file mode 100644 index 0000000000000000000000000000000000000000..60c92c6fd4556546b4736f2b7d363819a9061cd2 Binary files /dev/null and b/shared/package-files/33/335d111c3ea2342e83a5b02c3eb2e423783fad1fdfb3424854a6988135c720d2/blob differ diff --git a/shared/package-files/33/335d55a6d02ea00f200aaa54dad20546a1b88c5d8b2f599a2b0a5ffd7e920314/blob b/shared/package-files/33/335d55a6d02ea00f200aaa54dad20546a1b88c5d8b2f599a2b0a5ffd7e920314/blob new file mode 100644 index 0000000000000000000000000000000000000000..9970774070aaa1b35496055d72edd58149e29bcf --- /dev/null +++ b/shared/package-files/33/335d55a6d02ea00f200aaa54dad20546a1b88c5d8b2f599a2b0a5ffd7e920314/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:335d55a6d02ea00f200aaa54dad20546a1b88c5d8b2f599a2b0a5ffd7e920314 +size 152878 diff --git a/shared/package-files/33/335fb9da0445995a7f6748e7c997d3503a9bc8c4db9a1693711b7e3fb1fd276f/blob b/shared/package-files/33/335fb9da0445995a7f6748e7c997d3503a9bc8c4db9a1693711b7e3fb1fd276f/blob new file mode 100644 index 0000000000000000000000000000000000000000..0ea262b5c561c75c8ce4e36dad8a53db7df9538a --- /dev/null +++ b/shared/package-files/33/335fb9da0445995a7f6748e7c997d3503a9bc8c4db9a1693711b7e3fb1fd276f/blob @@ -0,0 +1,269 @@ +# This file is part of Patsy +# Copyright (C) 2013 Nathaniel Smith +# See file LICENSE.txt for license information. + +# Missing data detection/handling + +# First, how do we represent missing data? (i.e., which values count as +# "missing"?) In the long run, we want to use numpy's NA support... but that +# doesn't exist yet. Until then, people use various sorts of ad-hoc +# things. Some things that might be considered NA: +# NA (eventually) +# NaN (in float or object arrays) +# None (in object arrays) +# np.ma.masked (in numpy.ma masked arrays) +# Pandas compatibility considerations: +# For numeric arrays, None is unconditionally converted to NaN. +# For object arrays (including string arrays!), None and NaN are preserved, +# but pandas.isnull() returns True for both. +# np.ma compatibility considerations: +# Preserving array subtypes is a huge pain, because it means that we can't +# just call 'asarray' and be done... we already jump through tons of hoops +# to write code that can handle both ndarray's and pandas objects, and +# just thinking about adding another item to this list makes me tired. So +# for now we don't support np.ma missing values. Use pandas! + +# Next, what should be done once we find missing data? R's options: +# -- throw away those rows (from all aligned matrices) +# -- with or without preserving information on which rows were discarded +# -- error out +# -- carry on +# The 'carry on' option requires that we have some way to represent NA in our +# output array. To avoid further solidifying the use of NaN for this purpose, +# we'll leave this option out for now, until real NA support is +# available. Also, we always preserve information on which rows were +# discarded, using the pandas index functionality (currently this is only +# returned to the original caller if they used return_type="dataframe", +# though). + +import numpy as np +from patsy import PatsyError +from patsy.util import safe_isnan, safe_scalar_isnan, no_pickling, assert_no_pickling + +# These are made available in the patsy.* namespace +__all__ = ["NAAction"] + +_valid_NA_types = ["None", "NaN"] +_valid_NA_responses = ["raise", "drop"] + + +def _desc_options(options): + return ", ".join([repr(opt) for opt in options]) + + +class NAAction(object): + """An :class:`NAAction` object defines a strategy for handling missing + data. + + "NA" is short for "Not Available", and is used to refer to any value which + is somehow unmeasured or unavailable. In the long run, it is devoutly + hoped that numpy will gain first-class missing value support. Until then, + we work around this lack as best we're able. + + There are two parts to this: First, we have to determine what counts as + missing data. For numerical data, the default is to treat NaN values + (e.g., ``numpy.nan``) as missing. For categorical data, the default is to + treat NaN values, and also the Python object None, as missing. (This is + consistent with how pandas does things, so if you're already using + None/NaN to mark missing data in your pandas DataFrames, you're good to + go.) + + Second, we have to decide what to do with any missing data when we + encounter it. One option is to simply discard any rows which contain + missing data from our design matrices (``drop``). Another option is to + raise an error (``raise``). A third option would be to simply let the + missing values pass through into the returned design matrices. However, + this last option is not yet implemented, because of the lack of any + standard way to represent missing values in arbitrary numpy matrices; + we're hoping numpy will get this sorted out before we standardize on + anything ourselves. + + You can control how patsy handles missing data through the ``NA_action=`` + argument to functions like :func:`build_design_matrices` and + :func:`dmatrix`. If all you want to do is to choose between ``drop`` and + ``raise`` behaviour, you can pass one of those strings as the + ``NA_action=`` argument directly. If you want more fine-grained control + over how missing values are detected and handled, then you can create an + instance of this class, or your own object that implements the same + interface, and pass that as the ``NA_action=`` argument instead. + """ + + def __init__(self, on_NA="drop", NA_types=["None", "NaN"]): + """The :class:`NAAction` constructor takes the following arguments: + + :arg on_NA: How to handle missing values. The default is ``"drop"``, + which removes all rows from all matrices which contain any missing + values. Also available is ``"raise"``, which raises an exception + when any missing values are encountered. + :arg NA_types: Which rules are used to identify missing values, as a + list of strings. Allowed values are: + + * ``"None"``: treat the ``None`` object as missing in categorical + data. + * ``"NaN"``: treat floating point NaN values as missing in + categorical and numerical data. + + .. versionadded:: 0.2.0 + """ + self.on_NA = on_NA + if self.on_NA not in _valid_NA_responses: + raise ValueError( + "invalid on_NA action %r " + "(should be one of %s)" % (on_NA, _desc_options(_valid_NA_responses)) + ) + if isinstance(NA_types, str): + raise ValueError("NA_types should be a list of strings") + self.NA_types = tuple(NA_types) + for NA_type in self.NA_types: + if NA_type not in _valid_NA_types: + raise ValueError( + "invalid NA_type %r " + "(should be one of %s)" % (NA_type, _desc_options(_valid_NA_types)) + ) + + def is_categorical_NA(self, obj): + """Return True if `obj` is a categorical NA value. + + Note that here `obj` is a single scalar value.""" + if "NaN" in self.NA_types and safe_scalar_isnan(obj): + return True + if "None" in self.NA_types and obj is None: + return True + return False + + def is_numerical_NA(self, arr): + """Returns a 1-d mask array indicating which rows in an array of + numerical values contain at least one NA value. + + Note that here `arr` is a numpy array or pandas DataFrame.""" + mask = np.zeros(arr.shape, dtype=bool) + if "NaN" in self.NA_types: + mask |= np.isnan(arr) + if mask.ndim > 1: + mask = np.any(mask, axis=1) + return mask + + def handle_NA(self, values, is_NAs, origins): + """Takes a set of factor values that may have NAs, and handles them + appropriately. + + :arg values: A list of `ndarray` objects representing the data. + These may be 1- or 2-dimensional, and may be of varying dtype. All + will have the same number of rows (or entries, for 1-d arrays). + :arg is_NAs: A list with the same number of entries as `values`, + containing boolean `ndarray` objects that indicate which rows + contain NAs in the corresponding entry in `values`. + :arg origins: A list with the same number of entries as + `values`, containing information on the origin of each + value. If we encounter a problem with some particular value, we use + the corresponding entry in `origins` as the origin argument when + raising a :class:`PatsyError`. + :returns: A list of new values (which may have a differing number of + rows.) + """ + assert len(values) == len(is_NAs) == len(origins) + if len(values) == 0: + return values + if self.on_NA == "raise": + return self._handle_NA_raise(values, is_NAs, origins) + elif self.on_NA == "drop": + return self._handle_NA_drop(values, is_NAs, origins) + else: # pragma: no cover + assert False + + def _handle_NA_raise(self, values, is_NAs, origins): + for is_NA, origin in zip(is_NAs, origins): + if np.any(is_NA): + raise PatsyError("factor contains missing values", origin) + return values + + def _handle_NA_drop(self, values, is_NAs, origins): + total_mask = np.zeros(is_NAs[0].shape[0], dtype=bool) + for is_NA in is_NAs: + total_mask |= is_NA + good_mask = ~total_mask + # "..." to handle 1- versus 2-dim indexing + return [v[good_mask] if v.ndim == 1 else v[good_mask, ...] for v in values] + + __getstate__ = no_pickling + + +def test_NAAction_basic(): + import pytest + + pytest.raises(ValueError, NAAction, on_NA="pord") + pytest.raises(ValueError, NAAction, NA_types=("NaN", "asdf")) + pytest.raises(ValueError, NAAction, NA_types="NaN") + + assert_no_pickling(NAAction()) + + +def test_NAAction_NA_types_numerical(): + for NA_types in [[], ["NaN"], ["None"], ["NaN", "None"]]: + action = NAAction(NA_types=NA_types) + for extra_shape in [(), (1,), (2,)]: + arr = np.ones((4,) + extra_shape, dtype=float) + nan_rows = [0, 2] + if arr.ndim > 1 and arr.shape[1] > 1: + arr[nan_rows, [0, 1]] = np.nan + else: + arr[nan_rows] = np.nan + exp_NA_mask = np.zeros(4, dtype=bool) + if "NaN" in NA_types: + exp_NA_mask[nan_rows] = True + got_NA_mask = action.is_numerical_NA(arr) + assert np.array_equal(got_NA_mask, exp_NA_mask) + + +def test_NAAction_NA_types_categorical(): + for NA_types in [[], ["NaN"], ["None"], ["NaN", "None"]]: + action = NAAction(NA_types=NA_types) + assert not action.is_categorical_NA("a") + assert not action.is_categorical_NA(1) + assert action.is_categorical_NA(None) == ("None" in NA_types) + assert action.is_categorical_NA(np.nan) == ("NaN" in NA_types) + + +def test_NAAction_drop(): + action = NAAction("drop") + in_values = [ + np.asarray([-1, 2, -1, 4, 5]), + np.asarray([10.0, 20.0, 30.0, 40.0, 50.0]), + np.asarray([[1.0, np.nan], [3.0, 4.0], [10.0, 5.0], [6.0, 7.0], [8.0, np.nan]]), + ] + is_NAs = [ + np.asarray([True, False, True, False, False]), + np.zeros(5, dtype=bool), + np.asarray([True, False, False, False, True]), + ] + out_values = action.handle_NA(in_values, is_NAs, [None] * 3) + assert len(out_values) == 3 + assert np.array_equal(out_values[0], [2, 4]) + assert np.array_equal(out_values[1], [20.0, 40.0]) + assert np.array_equal(out_values[2], [[3.0, 4.0], [6.0, 7.0]]) + + +def test_NAAction_raise(): + action = NAAction(on_NA="raise") + + # no-NA just passes through: + in_arrs = [np.asarray([1.1, 1.2]), np.asarray([1, 2])] + is_NAs = [np.asarray([False, False])] * 2 + got_arrs = action.handle_NA(in_arrs, is_NAs, [None, None]) + assert np.array_equal(got_arrs[0], in_arrs[0]) + assert np.array_equal(got_arrs[1], in_arrs[1]) + + from patsy.origin import Origin + + o1 = Origin("asdf", 0, 1) + o2 = Origin("asdf", 2, 3) + + # NA raises an error with a correct origin + in_idx = np.arange(2) + in_arrs = [np.asarray([1.1, 1.2]), np.asarray([1.0, np.nan])] + is_NAs = [np.asarray([False, False]), np.asarray([False, True])] + try: + action.handle_NA(in_arrs, is_NAs, [o1, o2]) + assert False + except PatsyError as e: + assert e.origin is o2 diff --git a/shared/package-files/33/335fe549be2e3479766a466442580e7f6d529dfbeb590cfaaf26ed0885407584/blob b/shared/package-files/33/335fe549be2e3479766a466442580e7f6d529dfbeb590cfaaf26ed0885407584/blob new file mode 100644 index 0000000000000000000000000000000000000000..792c0840f813de7ff7b54568dc3360328af38270 --- /dev/null +++ b/shared/package-files/33/335fe549be2e3479766a466442580e7f6d529dfbeb590cfaaf26ed0885407584/blob @@ -0,0 +1,6103 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from cpython.pycapsule cimport ( + PyCapsule_CheckExact, + PyCapsule_GetPointer, + PyCapsule_GetName, + PyCapsule_New, + PyCapsule_IsValid +) + +import atexit +from collections.abc import Mapping +import pickle +import re +import sys +import warnings +from cython import sizeof + +# These are imprecise because the type (in pandas 0.x) depends on the presence +# of nulls +cdef dict _pandas_type_map = {} + + +def _get_pandas_type_map(): + global _pandas_type_map + if not _pandas_type_map: + _pandas_type_map.update({ + _Type_NA: np.object_, # NaNs + _Type_BOOL: np.bool_, + _Type_INT8: np.int8, + _Type_INT16: np.int16, + _Type_INT32: np.int32, + _Type_INT64: np.int64, + _Type_UINT8: np.uint8, + _Type_UINT16: np.uint16, + _Type_UINT32: np.uint32, + _Type_UINT64: np.uint64, + _Type_HALF_FLOAT: np.float16, + _Type_FLOAT: np.float32, + _Type_DOUBLE: np.float64, + # Pandas does not support [D]ay, so default to [ms] for date32 + _Type_DATE32: np.dtype('datetime64[ms]'), + _Type_DATE64: np.dtype('datetime64[ms]'), + _Type_TIMESTAMP: { + 's': np.dtype('datetime64[s]'), + 'ms': np.dtype('datetime64[ms]'), + 'us': np.dtype('datetime64[us]'), + 'ns': np.dtype('datetime64[ns]'), + }, + _Type_DURATION: { + 's': np.dtype('timedelta64[s]'), + 'ms': np.dtype('timedelta64[ms]'), + 'us': np.dtype('timedelta64[us]'), + 'ns': np.dtype('timedelta64[ns]'), + }, + _Type_BINARY: np.object_, + _Type_LARGE_BINARY: np.object_, + _Type_BINARY_VIEW: np.object_, + _Type_FIXED_SIZE_BINARY: np.object_, + _Type_STRING: np.object_, + _Type_LARGE_STRING: np.object_, + _Type_STRING_VIEW: np.object_, + _Type_LIST: np.object_, + _Type_MAP: np.object_, + _Type_DECIMAL32: np.object_, + _Type_DECIMAL64: np.object_, + _Type_DECIMAL128: np.object_, + _Type_DECIMAL256: np.object_, + }) + return _pandas_type_map + + +cdef dict _pep3118_type_map = { + _Type_INT8: b'b', + _Type_INT16: b'h', + _Type_INT32: b'i', + _Type_INT64: b'q', + _Type_UINT8: b'B', + _Type_UINT16: b'H', + _Type_UINT32: b'I', + _Type_UINT64: b'Q', + _Type_HALF_FLOAT: b'e', + _Type_FLOAT: b'f', + _Type_DOUBLE: b'd', +} + + +cdef bytes _datatype_to_pep3118(CDataType* type): + """ + Construct a PEP 3118 format string describing the given datatype. + None is returned for unsupported types. + """ + try: + char = _pep3118_type_map[type.id()] + except KeyError: + return None + else: + if char in b'bBhHiIqQ': + # Use "standard" int widths, not native + return b'=' + char + else: + return char + + +cdef void* _as_c_pointer(v, allow_null=False) except *: + """ + Convert a Python object to a raw C pointer. + + Used mainly for the C data interface. + Integers are accepted as well as capsule objects with a NULL name. + (the latter for compatibility with raw pointers exported by reticulate) + """ + cdef void* c_ptr + cdef const char* capsule_name + if isinstance(v, int): + c_ptr = v + elif isinstance(v, float): + warnings.warn( + "Passing a pointer value as a float is unsafe and only " + "supported for compatibility with older versions of the R " + "Arrow library", UserWarning, stacklevel=2) + c_ptr = v + elif PyCapsule_CheckExact(v): + # An R external pointer was how the R bindings passed pointer values to + # Python from versions 7 to 15 (inclusive); however, the reticulate 1.35.0 + # update changed the name of the capsule from NULL to "r_extptr". + # Newer versions of the R package pass a Python integer; however, this + # workaround ensures that old versions of the R package continue to work + # with newer versions of pyarrow. + capsule_name = PyCapsule_GetName(v) + if capsule_name == NULL or capsule_name == b"r_extptr": + c_ptr = PyCapsule_GetPointer(v, capsule_name) + else: + capsule_name_str = capsule_name.decode() + raise ValueError( + f"Can't convert PyCapsule with name '{capsule_name_str}' to pointer address" + ) + else: + raise TypeError(f"Expected a pointer value, got {type(v)!r}") + if not allow_null and c_ptr == NULL: + raise ValueError(f"Null pointer (value before cast = {v!r})") + return c_ptr + + +def _is_primitive(Type type): + # This is simply a redirect, the official API is in pyarrow.types. + return is_primitive(type) + + +def _get_pandas_type(arrow_type, coerce_to_ns=False): + cdef Type type_id = arrow_type.id + cdef dict pandas_type_map = _get_pandas_type_map() + if type_id not in pandas_type_map: + return None + if coerce_to_ns: + # ARROW-3789: Coerce date/timestamp types to datetime64[ns] + if type_id == _Type_DURATION: + return np.dtype('timedelta64[ns]') + return np.dtype('datetime64[ns]') + pandas_type = pandas_type_map[type_id] + if isinstance(pandas_type, dict): + unit = getattr(arrow_type, 'unit', None) + pandas_type = pandas_type.get(unit, None) + return pandas_type + + +def _get_pandas_tz_type(arrow_type, coerce_to_ns=False): + from pyarrow.pandas_compat import make_datetimetz + unit = 'ns' if coerce_to_ns else arrow_type.unit + return make_datetimetz(unit, arrow_type.tz) + + +def _to_pandas_dtype(arrow_type, options=None): + coerce_to_ns = (options and options.get('coerce_temporal_nanoseconds', False)) or ( + _pandas_api.is_v1() and arrow_type.id in + [_Type_DATE32, _Type_DATE64, _Type_TIMESTAMP, _Type_DURATION]) + + if getattr(arrow_type, 'tz', None): + dtype = _get_pandas_tz_type(arrow_type, coerce_to_ns) + else: + dtype = _get_pandas_type(arrow_type, coerce_to_ns) + + if not dtype: + raise NotImplementedError(str(arrow_type)) + + return dtype + + +# Workaround for Cython parsing bug +# https://github.com/cython/cython/issues/2143 +ctypedef CFixedWidthType* _CFixedWidthTypePtr + + +cdef class DataType(_Weakrefable): + """ + Base class of all Arrow data types. + + Each data type is an *instance* of this class. + + Examples + -------- + Instance of int64 type: + + >>> import pyarrow as pa + >>> pa.int64() + DataType(int64) + """ + + def __cinit__(self): + pass + + def __init__(self): + raise TypeError(f"Do not call {self.__class__.__name__}'s constructor directly, use public " + "functions like pyarrow.int64, pyarrow.list_, etc. " + "instead.") + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + assert type != nullptr + self.sp_type = type + self.type = type.get() + self.pep3118_format = _datatype_to_pep3118(self.type) + + cpdef Field field(self, i): + """ + Parameters + ---------- + i : int + + Returns + ------- + pyarrow.Field + """ + if not isinstance(i, int): + raise TypeError(f"Expected int index, got type '{type(i)}'") + cdef int index = _normalize_index(i, self.type.num_fields()) + return pyarrow_wrap_field(self.type.field(index)) + + @property + def id(self): + return self.type.id() + + @property + def bit_width(self): + """ + Bit width for fixed width type. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64() + DataType(int64) + >>> pa.int64().bit_width + 64 + """ + cdef _CFixedWidthTypePtr ty + ty = dynamic_cast[_CFixedWidthTypePtr](self.type) + if ty == nullptr: + raise ValueError("Non-fixed width type") + return ty.bit_width() + + @property + def byte_width(self): + """ + Byte width for fixed width type. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64() + DataType(int64) + >>> pa.int64().byte_width + 8 + """ + cdef _CFixedWidthTypePtr ty + ty = dynamic_cast[_CFixedWidthTypePtr](self.type) + if ty == nullptr: + raise ValueError("Non-fixed width type") + byte_width = ty.byte_width() + if byte_width == 0 and self.bit_width != 0: + raise ValueError("Less than one byte") + return byte_width + + @property + def num_fields(self): + """ + The number of child fields. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64() + DataType(int64) + >>> pa.int64().num_fields + 0 + >>> pa.list_(pa.string()) + ListType(list) + >>> pa.list_(pa.string()).num_fields + 1 + >>> struct = pa.struct({'x': pa.int32(), 'y': pa.string()}) + >>> struct.num_fields + 2 + """ + return self.type.num_fields() + + @property + def num_buffers(self): + """ + Number of data buffers required to construct Array type + excluding children. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64().num_buffers + 2 + >>> pa.string().num_buffers + 3 + """ + return self.type.layout().buffers.size() + + @property + def has_variadic_buffers(self): + """ + If True, the number of expected buffers is only + lower-bounded by num_buffers. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64().has_variadic_buffers + False + >>> pa.string_view().has_variadic_buffers + True + """ + return self.type.layout().variadic_spec.has_value() + + def __str__(self): + return frombytes(self.type.ToString(), safe=True) + + def __hash__(self): + return hash(str(self)) + + def __reduce__(self): + return type_for_alias, (str(self),) + + def __repr__(self): + return f'{self.__class__.__name__}({self})' + + def __eq__(self, other): + try: + return self.equals(other) + except (TypeError, ValueError): + return NotImplemented + + def equals(self, other, *, check_metadata=False): + """ + Return true if type is equivalent to passed value. + + Parameters + ---------- + other : DataType or string convertible to DataType + check_metadata : bool + Whether nested Field metadata equality should be checked as well. + + Returns + ------- + is_equal : bool + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64().equals(pa.string()) + False + >>> pa.int64().equals(pa.int64()) + True + """ + cdef: + DataType other_type + c_bool c_check_metadata + + other_type = ensure_type(other) + c_check_metadata = check_metadata + return self.type.Equals(deref(other_type.type), c_check_metadata) + + def to_pandas_dtype(self): + """ + Return the equivalent NumPy / Pandas dtype. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.int64().to_pandas_dtype() + + """ + return _to_pandas_dtype(self) + + def _export_to_c(self, out_ptr): + """ + Export to a C ArrowSchema struct, given its pointer. + + Be careful: if you don't pass the ArrowSchema struct to a consumer, + its memory will leak. This is a low-level function intended for + expert users. + """ + check_status(ExportType(deref(self.type), + _as_c_pointer(out_ptr))) + + @staticmethod + def _import_from_c(in_ptr): + """ + Import DataType from a C ArrowSchema struct, given its pointer. + + This is a low-level function intended for expert users. + """ + result = GetResultValue(ImportType( + _as_c_pointer(in_ptr))) + return pyarrow_wrap_data_type(result) + + def __arrow_c_schema__(self): + """ + Export to a ArrowSchema PyCapsule + + Unlike _export_to_c, this will not leak memory if the capsule is not used. + """ + cdef ArrowSchema* c_schema + capsule = alloc_c_schema(&c_schema) + + with nogil: + check_status(ExportType(deref(self.type), c_schema)) + + return capsule + + @staticmethod + def _import_from_c_capsule(schema): + """ + Import a DataType from a ArrowSchema PyCapsule + + Parameters + ---------- + schema : PyCapsule + A valid PyCapsule with name 'arrow_schema' containing an + ArrowSchema pointer. + """ + cdef: + ArrowSchema* c_schema + shared_ptr[CDataType] c_type + + if not PyCapsule_IsValid(schema, 'arrow_schema'): + raise TypeError( + "Not an ArrowSchema object" + ) + c_schema = PyCapsule_GetPointer(schema, 'arrow_schema') + + with nogil: + c_type = GetResultValue(ImportType(c_schema)) + + return pyarrow_wrap_data_type(c_type) + + +cdef class DictionaryMemo(_Weakrefable): + """ + Tracking container for dictionary-encoded fields. + """ + + def __cinit__(self): + self.sp_memo.reset(new CDictionaryMemo()) + self.memo = self.sp_memo.get() + + +cdef class DictionaryType(DataType): + """ + Concrete class for dictionary data types. + + Examples + -------- + Create an instance of dictionary type: + + >>> import pyarrow as pa + >>> pa.dictionary(pa.int64(), pa.utf8()) + DictionaryType(dictionary) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.dict_type = type.get() + + def __reduce__(self): + return dictionary, (self.index_type, self.value_type, self.ordered) + + @property + def ordered(self): + """ + Whether the dictionary is ordered, i.e. whether the ordering of values + in the dictionary is important. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.dictionary(pa.int64(), pa.utf8()).ordered + False + """ + return self.dict_type.ordered() + + @property + def index_type(self): + """ + The data type of dictionary indices (a signed integer type). + + Examples + -------- + >>> import pyarrow as pa + >>> pa.dictionary(pa.int16(), pa.utf8()).index_type + DataType(int16) + """ + return pyarrow_wrap_data_type(self.dict_type.index_type()) + + @property + def value_type(self): + """ + The dictionary value type. + + The dictionary values are found in an instance of DictionaryArray. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.dictionary(pa.int16(), pa.utf8()).value_type + DataType(string) + """ + return pyarrow_wrap_data_type(self.dict_type.value_type()) + + +cdef class ListType(DataType): + """ + Concrete class for list data types. + + Examples + -------- + Create an instance of ListType: + + >>> import pyarrow as pa + >>> pa.list_(pa.string()) + ListType(list) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.list_type = type.get() + + def __reduce__(self): + return list_, (self.value_field,) + + @property + def value_field(self): + """ + The field for list values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_(pa.string()).value_field + pyarrow.Field + """ + return pyarrow_wrap_field(self.list_type.value_field()) + + @property + def value_type(self): + """ + The data type of list values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_(pa.string()).value_type + DataType(string) + """ + return pyarrow_wrap_data_type(self.list_type.value_type()) + + +cdef class LargeListType(DataType): + """ + Concrete class for large list data types + (like ListType, but with 64-bit offsets). + + Examples + -------- + Create an instance of LargeListType: + + >>> import pyarrow as pa + >>> pa.large_list(pa.string()) + LargeListType(large_list) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.list_type = type.get() + + def __reduce__(self): + return large_list, (self.value_field,) + + @property + def value_field(self): + return pyarrow_wrap_field(self.list_type.value_field()) + + @property + def value_type(self): + """ + The data type of large list values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.large_list(pa.string()).value_type + DataType(string) + """ + return pyarrow_wrap_data_type(self.list_type.value_type()) + + +cdef class ListViewType(DataType): + """ + Concrete class for list view data types. + + Examples + -------- + Create an instance of ListViewType: + + >>> import pyarrow as pa + >>> pa.list_view(pa.string()) + ListViewType(list_view) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.list_view_type = type.get() + + def __reduce__(self): + return list_view, (self.value_field,) + + @property + def value_field(self): + """ + The field for list view values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_view(pa.string()).value_field + pyarrow.Field + """ + return pyarrow_wrap_field(self.list_view_type.value_field()) + + @property + def value_type(self): + """ + The data type of list view values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_view(pa.string()).value_type + DataType(string) + """ + return pyarrow_wrap_data_type(self.list_view_type.value_type()) + + +cdef class LargeListViewType(DataType): + """ + Concrete class for large list view data types + (like ListViewType, but with 64-bit offsets). + + Examples + -------- + Create an instance of LargeListViewType: + + >>> import pyarrow as pa + >>> pa.large_list_view(pa.string()) + LargeListViewType(large_list_view) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.list_view_type = type.get() + + def __reduce__(self): + return large_list_view, (self.value_field,) + + @property + def value_field(self): + """ + The field for large list view values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.large_list_view(pa.string()).value_field + pyarrow.Field + """ + return pyarrow_wrap_field(self.list_view_type.value_field()) + + @property + def value_type(self): + """ + The data type of large list view values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.large_list_view(pa.string()).value_type + DataType(string) + """ + return pyarrow_wrap_data_type(self.list_view_type.value_type()) + + +cdef class MapType(DataType): + """ + Concrete class for map data types. + + Examples + -------- + Create an instance of MapType: + + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32()) + MapType(map) + >>> pa.map_(pa.string(), pa.int32(), keys_sorted=True) + MapType(map) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.map_type = type.get() + + def __reduce__(self): + return map_, (self.key_field, self.item_field) + + @property + def key_field(self): + """ + The field for keys in the map entries. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32()).key_field + pyarrow.Field + """ + return pyarrow_wrap_field(self.map_type.key_field()) + + @property + def key_type(self): + """ + The data type of keys in the map entries. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32()).key_type + DataType(string) + """ + return pyarrow_wrap_data_type(self.map_type.key_type()) + + @property + def item_field(self): + """ + The field for items in the map entries. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32()).item_field + pyarrow.Field + """ + return pyarrow_wrap_field(self.map_type.item_field()) + + @property + def item_type(self): + """ + The data type of items in the map entries. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32()).item_type + DataType(int32) + """ + return pyarrow_wrap_data_type(self.map_type.item_type()) + + @property + def keys_sorted(self): + """ + Should the entries be sorted according to keys. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32(), keys_sorted=True).keys_sorted + True + """ + return self.map_type.keys_sorted() + + +cdef class FixedSizeListType(DataType): + """ + Concrete class for fixed size list data types. + + Examples + -------- + Create an instance of FixedSizeListType: + + >>> import pyarrow as pa + >>> pa.list_(pa.int32(), 2) + FixedSizeListType(fixed_size_list[2]) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.list_type = type.get() + + def __reduce__(self): + return list_, (self.value_type, self.list_size) + + @property + def value_field(self): + """ + The field for list values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_(pa.int32(), 2).value_field + pyarrow.Field + """ + return pyarrow_wrap_field(self.list_type.value_field()) + + @property + def value_type(self): + """ + The data type of large list values. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_(pa.int32(), 2).value_type + DataType(int32) + """ + return pyarrow_wrap_data_type(self.list_type.value_type()) + + @property + def list_size(self): + """ + The size of the fixed size lists. + + Examples + -------- + >>> import pyarrow as pa + >>> pa.list_(pa.int32(), 2).list_size + 2 + """ + return self.list_type.list_size() + + +cdef class StructType(DataType): + """ + Concrete class for struct data types. + + ``StructType`` supports direct indexing using ``[...]`` (implemented via + ``__getitem__``) to access its fields. + It will return the struct field with the given index or name. + + Examples + -------- + >>> import pyarrow as pa + + Accessing fields using direct indexing: + + >>> struct_type = pa.struct({'x': pa.int32(), 'y': pa.string()}) + >>> struct_type[0] + pyarrow.Field + >>> struct_type['y'] + pyarrow.Field + + Accessing fields using ``field()``: + + >>> struct_type.field(1) + pyarrow.Field + >>> struct_type.field('x') + pyarrow.Field + + # Creating a schema from the struct type's fields: + >>> pa.schema(list(struct_type)) + x: int32 + y: string + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.struct_type = type.get() + + cdef Field field_by_name(self, name): + """ + Return a child field by its name. + + Parameters + ---------- + name : str + The name of the field to look up. + + Returns + ------- + field : Field + The child field with the given name. + + Raises + ------ + KeyError + If the name isn't found, or if several fields have the given + name. + """ + cdef vector[shared_ptr[CField]] fields + + fields = self.struct_type.GetAllFieldsByName(tobytes(name)) + if fields.size() == 0: + raise KeyError(name) + elif fields.size() > 1: + warnings.warn("Struct field name corresponds to more " + "than one field", UserWarning) + raise KeyError(name) + else: + return pyarrow_wrap_field(fields[0]) + + def get_field_index(self, name): + """ + Return index of the unique field with the given name. + + Parameters + ---------- + name : str + The name of the field to look up. + + Returns + ------- + index : int + The index of the field with the given name; -1 if the + name isn't found or there are several fields with the given + name. + + Examples + -------- + >>> import pyarrow as pa + >>> struct_type = pa.struct({'x': pa.int32(), 'y': pa.string()}) + + Index of the field with a name 'y': + + >>> struct_type.get_field_index('y') + 1 + + Index of the field that does not exist: + + >>> struct_type.get_field_index('z') + -1 + """ + return self.struct_type.GetFieldIndex(tobytes(name)) + + cpdef Field field(self, i): + """ + Select a field by its column name or numeric index. + + Parameters + ---------- + i : int or str + + Returns + ------- + pyarrow.Field + + Examples + -------- + + >>> import pyarrow as pa + >>> struct_type = pa.struct({'x': pa.int32(), 'y': pa.string()}) + + Select the second field: + + >>> struct_type.field(1) + pyarrow.Field + + Select the field named 'x': + + >>> struct_type.field('x') + pyarrow.Field + """ + if isinstance(i, (bytes, str)): + return self.field_by_name(i) + elif isinstance(i, int): + return DataType.field(self, i) + else: + raise TypeError('Expected integer or string index') + + def get_all_field_indices(self, name): + """ + Return sorted list of indices for the fields with the given name. + + Parameters + ---------- + name : str + The name of the field to look up. + + Returns + ------- + indices : List[int] + + Examples + -------- + >>> import pyarrow as pa + >>> struct_type = pa.struct({'x': pa.int32(), 'y': pa.string()}) + >>> struct_type.get_all_field_indices('x') + [0] + """ + return self.struct_type.GetAllFieldIndices(tobytes(name)) + + def __len__(self): + """ + Like num_fields(). + """ + return self.type.num_fields() + + def __iter__(self): + """ + Iterate over struct fields, in order. + """ + for i in range(len(self)): + yield self[i] + + def __getitem__(self, i): + """ + Return the struct field with the given index or name. + + Alias of ``field``. + """ + return self.field(i) + + def __reduce__(self): + return struct, (list(self),) + + @property + def names(self): + """ + Lists the field names. + + Examples + -------- + >>> import pyarrow as pa + >>> struct_type = pa.struct([('a', pa.int64()), ('b', pa.float64()), ('c', pa.string())]) + >>> struct_type.names + ['a', 'b', 'c'] + """ + return [f.name for f in self] + + @property + def fields(self): + """ + Lists all fields within the StructType. + + Examples + -------- + >>> import pyarrow as pa + >>> struct_type = pa.struct([('a', pa.int64()), ('b', pa.float64()), ('c', pa.string())]) + >>> struct_type.fields + [pyarrow.Field, pyarrow.Field, pyarrow.Field] + """ + return list(self) + +cdef class UnionType(DataType): + """ + Base class for union data types. + + Examples + -------- + Create an instance of a dense UnionType using ``pa.union``: + + >>> import pyarrow as pa + >>> pa.union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())], + ... mode=pa.lib.UnionMode_DENSE), + (DenseUnionType(dense_union),) + + Create an instance of a dense UnionType using ``pa.dense_union``: + + >>> pa.dense_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + DenseUnionType(dense_union) + + Create an instance of a sparse UnionType using ``pa.union``: + + >>> pa.union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())], + ... mode=pa.lib.UnionMode_SPARSE), + (SparseUnionType(sparse_union),) + + Create an instance of a sparse UnionType using ``pa.sparse_union``: + + >>> pa.sparse_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + SparseUnionType(sparse_union) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + + @property + def mode(self): + """ + The mode of the union ("dense" or "sparse"). + + Examples + -------- + >>> import pyarrow as pa + >>> union = pa.sparse_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + >>> union.mode + 'sparse' + """ + cdef CUnionType* type = self.sp_type.get() + cdef int mode = type.mode() + if mode == _UnionMode_DENSE: + return 'dense' + if mode == _UnionMode_SPARSE: + return 'sparse' + assert 0 + + @property + def type_codes(self): + """ + The type code to indicate each data type in this union. + + Examples + -------- + >>> import pyarrow as pa + >>> union = pa.sparse_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + >>> union.type_codes + [0, 1] + """ + cdef CUnionType* type = self.sp_type.get() + return type.type_codes() + + def __len__(self): + """ + Like num_fields(). + """ + return self.type.num_fields() + + def __iter__(self): + """ + Iterate over union members, in order. + """ + for i in range(len(self)): + yield self[i] + + cpdef Field field(self, i): + """ + Return a child field by its numeric index. + + Parameters + ---------- + i : int + + Returns + ------- + pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> union = pa.sparse_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + >>> union[0] + pyarrow.Field + """ + if isinstance(i, int): + return DataType.field(self, i) + else: + raise TypeError('Expected integer') + + def __getitem__(self, i): + """ + Return a child field by its index. + + Alias of ``field``. + """ + return self.field(i) + + def __reduce__(self): + return union, (list(self), self.mode, self.type_codes) + + +cdef class SparseUnionType(UnionType): + """ + Concrete class for sparse union types. + + Examples + -------- + Create an instance of a sparse UnionType using ``pa.union``: + + >>> import pyarrow as pa + >>> pa.union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())], + ... mode=pa.lib.UnionMode_SPARSE), + (SparseUnionType(sparse_union),) + + Create an instance of a sparse UnionType using ``pa.sparse_union``: + + >>> pa.sparse_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + SparseUnionType(sparse_union) + """ + + +cdef class DenseUnionType(UnionType): + """ + Concrete class for dense union types. + + Examples + -------- + Create an instance of a dense UnionType using ``pa.union``: + + >>> import pyarrow as pa + >>> pa.union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())], + ... mode=pa.lib.UnionMode_DENSE), + (DenseUnionType(dense_union),) + + Create an instance of a dense UnionType using ``pa.dense_union``: + + >>> pa.dense_union([pa.field('a', pa.binary(10)), pa.field('b', pa.string())]) + DenseUnionType(dense_union) + """ + + +cdef class TimestampType(DataType): + """ + Concrete class for timestamp data types. + + Examples + -------- + >>> import pyarrow as pa + + Create an instance of timestamp type: + + >>> pa.timestamp('us') + TimestampType(timestamp[us]) + + Create an instance of timestamp type with timezone: + + >>> pa.timestamp('s', tz='UTC') + TimestampType(timestamp[s, tz=UTC]) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.ts_type = type.get() + + @property + def unit(self): + """ + The timestamp unit ('s', 'ms', 'us' or 'ns'). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.timestamp('us') + >>> t.unit + 'us' + """ + return timeunit_to_string(self.ts_type.unit()) + + @property + def tz(self): + """ + The timestamp time zone, if any, or None. + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.timestamp('s', tz='UTC') + >>> t.tz + 'UTC' + """ + if self.ts_type.timezone().size() > 0: + return frombytes(self.ts_type.timezone()) + else: + return None + + def __reduce__(self): + return timestamp, (self.unit, self.tz) + + +cdef class Time32Type(DataType): + """ + Concrete class for time32 data types. + + Supported time unit resolutions are 's' [second] + and 'ms' [millisecond]. + + Examples + -------- + Create an instance of time32 type: + + >>> import pyarrow as pa + >>> pa.time32('ms') + Time32Type(time32[ms]) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.time_type = type.get() + + @property + def unit(self): + """ + The time unit ('s' or 'ms'). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.time32('ms') + >>> t.unit + 'ms' + """ + return timeunit_to_string(self.time_type.unit()) + + +cdef class Time64Type(DataType): + """ + Concrete class for time64 data types. + + Supported time unit resolutions are 'us' [microsecond] + and 'ns' [nanosecond]. + + Examples + -------- + Create an instance of time64 type: + + >>> import pyarrow as pa + >>> pa.time64('us') + Time64Type(time64[us]) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.time_type = type.get() + + @property + def unit(self): + """ + The time unit ('us' or 'ns'). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.time64('us') + >>> t.unit + 'us' + """ + return timeunit_to_string(self.time_type.unit()) + + +cdef class DurationType(DataType): + """ + Concrete class for duration data types. + + Examples + -------- + Create an instance of duration type: + + >>> import pyarrow as pa + >>> pa.duration('s') + DurationType(duration[s]) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.duration_type = type.get() + + @property + def unit(self): + """ + The duration unit ('s', 'ms', 'us' or 'ns'). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.duration('s') + >>> t.unit + 's' + """ + return timeunit_to_string(self.duration_type.unit()) + + +cdef class FixedSizeBinaryType(DataType): + """ + Concrete class for fixed-size binary data types. + + Examples + -------- + Create an instance of fixed-size binary type: + + >>> import pyarrow as pa + >>> pa.binary(3) + FixedSizeBinaryType(fixed_size_binary[3]) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.fixed_size_binary_type = ( + type.get()) + + def __reduce__(self): + return binary, (self.byte_width,) + + +cdef class Decimal32Type(FixedSizeBinaryType): + """ + Concrete class for decimal32 data types. + + Examples + -------- + Create an instance of decimal32 type: + + >>> import pyarrow as pa + >>> pa.decimal32(5, 2) + Decimal32Type(decimal32(5, 2)) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + FixedSizeBinaryType.init(self, type) + self.decimal32_type = type.get() + + def __reduce__(self): + return decimal32, (self.precision, self.scale) + + @property + def precision(self): + """ + The decimal precision, in number of decimal digits (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal32(5, 2) + >>> t.precision + 5 + """ + return self.decimal32_type.precision() + + @property + def scale(self): + """ + The decimal scale (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal32(5, 2) + >>> t.scale + 2 + """ + return self.decimal32_type.scale() + + +cdef class Decimal64Type(FixedSizeBinaryType): + """ + Concrete class for decimal64 data types. + + Examples + -------- + Create an instance of decimal64 type: + + >>> import pyarrow as pa + >>> pa.decimal64(5, 2) + Decimal64Type(decimal64(5, 2)) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + FixedSizeBinaryType.init(self, type) + self.decimal64_type = type.get() + + def __reduce__(self): + return decimal64, (self.precision, self.scale) + + @property + def precision(self): + """ + The decimal precision, in number of decimal digits (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal64(5, 2) + >>> t.precision + 5 + """ + return self.decimal64_type.precision() + + @property + def scale(self): + """ + The decimal scale (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal64(5, 2) + >>> t.scale + 2 + """ + return self.decimal64_type.scale() + + +cdef class Decimal128Type(FixedSizeBinaryType): + """ + Concrete class for decimal128 data types. + + Examples + -------- + Create an instance of decimal128 type: + + >>> import pyarrow as pa + >>> pa.decimal128(5, 2) + Decimal128Type(decimal128(5, 2)) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + FixedSizeBinaryType.init(self, type) + self.decimal128_type = type.get() + + def __reduce__(self): + return decimal128, (self.precision, self.scale) + + @property + def precision(self): + """ + The decimal precision, in number of decimal digits (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal128(5, 2) + >>> t.precision + 5 + """ + return self.decimal128_type.precision() + + @property + def scale(self): + """ + The decimal scale (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal128(5, 2) + >>> t.scale + 2 + """ + return self.decimal128_type.scale() + + +cdef class Decimal256Type(FixedSizeBinaryType): + """ + Concrete class for decimal256 data types. + + Examples + -------- + Create an instance of decimal256 type: + + >>> import pyarrow as pa + >>> pa.decimal256(76, 38) + Decimal256Type(decimal256(76, 38)) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + FixedSizeBinaryType.init(self, type) + self.decimal256_type = type.get() + + def __reduce__(self): + return decimal256, (self.precision, self.scale) + + @property + def precision(self): + """ + The decimal precision, in number of decimal digits (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal256(76, 38) + >>> t.precision + 76 + """ + return self.decimal256_type.precision() + + @property + def scale(self): + """ + The decimal scale (an integer). + + Examples + -------- + >>> import pyarrow as pa + >>> t = pa.decimal256(76, 38) + >>> t.scale + 38 + """ + return self.decimal256_type.scale() + + +cdef class RunEndEncodedType(DataType): + """ + Concrete class for run-end encoded types. + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.run_end_encoded_type = type.get() + + def __reduce__(self): + return run_end_encoded, (self.run_end_type, self.value_type) + + @property + def run_end_type(self): + return pyarrow_wrap_data_type(self.run_end_encoded_type.run_end_type()) + + @property + def value_type(self): + return pyarrow_wrap_data_type(self.run_end_encoded_type.value_type()) + + +cdef class BaseExtensionType(DataType): + """ + Concrete base class for extension types. + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + DataType.init(self, type) + self.ext_type = type.get() + + def __arrow_ext_class__(self): + """ + The associated array extension class + """ + return ExtensionArray + + def __arrow_ext_scalar_class__(self): + """ + The associated scalar class + """ + return ExtensionScalar + + @property + def extension_name(self): + """ + The extension type name. + """ + return frombytes(self.ext_type.extension_name()) + + @property + def storage_type(self): + """ + The underlying storage type. + """ + return pyarrow_wrap_data_type(self.ext_type.storage_type()) + + @property + def byte_width(self): + """ + The byte width of the extension type. + """ + if self.ext_type.byte_width() == -1: + raise ValueError("Non-fixed width type") + return self.ext_type.byte_width() + + @property + def bit_width(self): + """ + The bit width of the extension type. + """ + if self.ext_type.bit_width() == -1: + raise ValueError("Non-fixed width type") + return self.ext_type.bit_width() + + def wrap_array(self, storage): + """ + Wrap the given storage array as an extension array. + + Parameters + ---------- + storage : Array or ChunkedArray + + Returns + ------- + array : Array or ChunkedArray + Extension array wrapping the storage array + """ + cdef: + shared_ptr[CDataType] c_storage_type + + if isinstance(storage, Array): + c_storage_type = ( storage).ap.type() + elif isinstance(storage, ChunkedArray): + c_storage_type = ( storage).chunked_array.type() + else: + raise TypeError( + f"Expected array or chunked array, got {storage.__class__}") + + if not c_storage_type.get().Equals(deref(self.ext_type) + .storage_type(), False): + raise TypeError( + f"Incompatible storage type for {self}: " + f"expected {self.storage_type}, got {storage.type}") + + if isinstance(storage, Array): + return pyarrow_wrap_array( + self.ext_type.WrapArray( + self.sp_type, ( storage).sp_array)) + else: + return pyarrow_wrap_chunked_array( + self.ext_type.WrapArray( + self.sp_type, ( storage).sp_chunked_array)) + + +cdef class ExtensionType(BaseExtensionType): + """ + Concrete base class for Python-defined extension types. + + Parameters + ---------- + storage_type : DataType + The underlying storage type for the extension type. + extension_name : str + A unique name distinguishing this extension type. The name will be + used when deserializing IPC data. + + Examples + -------- + Define a RationalType extension type subclassing ExtensionType: + + >>> import pyarrow as pa + >>> class RationalType(pa.ExtensionType): + ... def __init__(self, data_type: pa.DataType): + ... if not pa.types.is_integer(data_type): + ... raise TypeError(f"data_type must be an integer type not {data_type}") + ... super().__init__( + ... pa.struct( + ... [ + ... ("numer", data_type), + ... ("denom", data_type), + ... ], + ... ), + ... # N.B. This name does _not_ reference `data_type` so deserialization + ... # will work for _any_ integer `data_type` after registration + ... "my_package.rational", + ... ) + ... def __arrow_ext_serialize__(self) -> bytes: + ... # No parameters are necessary + ... return b"" + ... @classmethod + ... def __arrow_ext_deserialize__(cls, storage_type, serialized): + ... # return an instance of this subclass + ... return RationalType(storage_type[0].type) + + Register the extension type: + + >>> pa.register_extension_type(RationalType(pa.int64())) + + Create an instance of RationalType extension type: + + >>> rational_type = RationalType(pa.int32()) + + Inspect the extension type: + + >>> rational_type.extension_name + 'my_package.rational' + >>> rational_type.storage_type + StructType(struct) + + Wrap an array as an extension array: + + >>> storage_array = pa.array( + ... [ + ... {"numer": 10, "denom": 17}, + ... {"numer": 20, "denom": 13}, + ... ], + ... type=rational_type.storage_type + ... ) + >>> rational_array = rational_type.wrap_array(storage_array) + >>> rational_array + + -- is_valid: all not null + -- child 0 type: int32 + [ + 10, + 20 + ] + -- child 1 type: int32 + [ + 17, + 13 + ] + + Or do the same with creating an ExtensionArray: + + >>> rational_array = pa.ExtensionArray.from_storage(rational_type, storage_array) + >>> rational_array + + -- is_valid: all not null + -- child 0 type: int32 + [ + 10, + 20 + ] + -- child 1 type: int32 + [ + 17, + 13 + ] + + Unregister the extension type: + + >>> pa.unregister_extension_type("my_package.rational") + + Note that even though we registered the concrete type + ``RationalType(pa.int64())``, PyArrow will be able to deserialize + ``RationalType(integer_type)`` for any ``integer_type``, as the deserializer + will reference the name ``my_package.rational`` and the ``@classmethod`` + ``__arrow_ext_deserialize__``. + """ + + def __cinit__(self): + if type(self) is ExtensionType: + raise TypeError("Can only instantiate subclasses of " + "ExtensionType") + + def __init__(self, DataType storage_type, extension_name): + """ + Initialize an extension type instance. + + This should be called at the end of the subclass' + ``__init__`` method. + """ + cdef: + shared_ptr[CExtensionType] cpy_ext_type + c_string c_extension_name + + c_extension_name = tobytes(extension_name) + + assert storage_type is not None + check_status(CPyExtensionType.FromClass( + storage_type.sp_type, c_extension_name, type(self), + &cpy_ext_type)) + self.init( cpy_ext_type) + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + BaseExtensionType.init(self, type) + self.cpy_ext_type = type.get() + # Store weakref and serialized version of self on C++ type instance + check_status(self.cpy_ext_type.SetInstance(self)) + + def __eq__(self, other): + # Default implementation to avoid infinite recursion through + # DataType.__eq__ -> ExtensionType::ExtensionEquals -> DataType.__eq__ + if isinstance(other, ExtensionType): + return (type(self) == type(other) and + self.extension_name == other.extension_name and + self.storage_type == other.storage_type) + else: + return NotImplemented + + def __repr__(self): + return f'{self.__class__.__name__}({repr(self.storage_type)})' + + def __arrow_ext_serialize__(self): + """ + Serialized representation of metadata to reconstruct the type object. + + This method should return a bytes object, and those serialized bytes + are stored in the custom metadata of the Field holding an extension + type in an IPC message. + The bytes are passed to ``__arrow_ext_deserialize`` and should hold + sufficient information to reconstruct the data type instance. + """ + return NotImplementedError + + @classmethod + def __arrow_ext_deserialize__(cls, storage_type, serialized): + """ + Return an extension type instance from the storage type and serialized + metadata. + + This method should return an instance of the ExtensionType subclass + that matches the passed storage type and serialized metadata (the + return value of ``__arrow_ext_serialize__``). + """ + return NotImplementedError + + def __reduce__(self): + return self.__arrow_ext_deserialize__, (self.storage_type, self.__arrow_ext_serialize__()) + + def __arrow_ext_class__(self): + """Return an extension array class to be used for building or + deserializing arrays with this extension type. + + This method should return a subclass of the ExtensionArray class. By + default, if not specialized in the extension implementation, an + extension type array will be a built-in ExtensionArray instance. + """ + return ExtensionArray + + def __arrow_ext_scalar_class__(self): + """Return an extension scalar class for building scalars with this + extension type. + + This method should return subclass of the ExtensionScalar class. By + default, if not specialized in the extension implementation, an + extension type scalar will be a built-in ExtensionScalar instance. + """ + return ExtensionScalar + + +cdef class JsonType(BaseExtensionType): + """ + Concrete class for JSON extension type. + + Examples + -------- + Define the extension type for JSON array + + >>> import pyarrow as pa + >>> json_type = pa.json_(pa.large_utf8()) + + Create an extension array + + >>> arr = [None, '{ "id":30, "values":["a", "b"] }'] + >>> storage = pa.array(arr, pa.large_utf8()) + >>> pa.ExtensionArray.from_storage(json_type, storage) + + [ + null, + "{ "id":30, "values":["a", "b"] }" + ] + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + BaseExtensionType.init(self, type) + self.json_ext_type = type.get() + + def __arrow_ext_class__(self): + return JsonArray + + def __reduce__(self): + return json_, (self.storage_type,) + + def __arrow_ext_scalar_class__(self): + return JsonScalar + + +cdef class UuidType(BaseExtensionType): + """ + Concrete class for UUID extension type. + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + BaseExtensionType.init(self, type) + self.uuid_ext_type = type.get() + + def __arrow_ext_class__(self): + return UuidArray + + def __reduce__(self): + return uuid, () + + def __arrow_ext_scalar_class__(self): + return UuidScalar + + +cdef class FixedShapeTensorType(BaseExtensionType): + """ + Concrete class for fixed shape tensor extension type. + + Examples + -------- + Create an instance of fixed shape tensor extension type: + + >>> import pyarrow as pa + >>> pa.fixed_shape_tensor(pa.int32(), [2, 2]) + FixedShapeTensorType(extension) + + Create an instance of fixed shape tensor extension type with + permutation: + + >>> tensor_type = pa.fixed_shape_tensor(pa.int8(), (2, 2, 3), + ... permutation=[0, 2, 1]) + >>> tensor_type.permutation + [0, 2, 1] + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + BaseExtensionType.init(self, type) + self.tensor_ext_type = type.get() + + @property + def value_type(self): + """ + Data type of an individual tensor. + """ + return pyarrow_wrap_data_type(self.tensor_ext_type.value_type()) + + @property + def shape(self): + """ + Shape of the tensors. + """ + return self.tensor_ext_type.shape() + + @property + def dim_names(self): + """ + Explicit names of the dimensions. + """ + list_of_bytes = self.tensor_ext_type.dim_names() + if len(list_of_bytes) != 0: + return [frombytes(x) for x in list_of_bytes] + else: + return None + + @property + def permutation(self): + """ + Indices of the dimensions ordering. + """ + indices = self.tensor_ext_type.permutation() + if len(indices) != 0: + return indices + else: + return None + + def __arrow_ext_class__(self): + return FixedShapeTensorArray + + def __reduce__(self): + return fixed_shape_tensor, (self.value_type, self.shape, + self.dim_names, self.permutation) + + def __arrow_ext_scalar_class__(self): + return FixedShapeTensorScalar + + +cdef class Bool8Type(BaseExtensionType): + """ + Concrete class for bool8 extension type. + + Bool8 is an alternate representation for boolean + arrays using 8 bits instead of 1 bit per value. The underlying + storage type is int8. + + Examples + -------- + Create an instance of bool8 extension type: + + >>> import pyarrow as pa + >>> pa.bool8() + Bool8Type(extension) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + BaseExtensionType.init(self, type) + self.bool8_ext_type = type.get() + + def __arrow_ext_class__(self): + return Bool8Array + + def __reduce__(self): + return bool8, () + + def __arrow_ext_scalar_class__(self): + return Bool8Scalar + + +cdef class OpaqueType(BaseExtensionType): + """ + Concrete class for opaque extension type. + + Opaque is a placeholder for a type from an external (often non-Arrow) + system that could not be interpreted. + + Examples + -------- + Create an instance of opaque extension type: + + >>> import pyarrow as pa + >>> pa.opaque(pa.int32(), "geometry", "postgis") + OpaqueType(extension) + """ + + cdef void init(self, const shared_ptr[CDataType]& type) except *: + BaseExtensionType.init(self, type) + self.opaque_ext_type = type.get() + + @property + def type_name(self): + """ + The name of the type in the external system. + """ + return frombytes(c_string(self.opaque_ext_type.type_name())) + + @property + def vendor_name(self): + """ + The name of the external system. + """ + return frombytes(c_string(self.opaque_ext_type.vendor_name())) + + def __arrow_ext_class__(self): + return OpaqueArray + + def __reduce__(self): + return opaque, (self.storage_type, self.type_name, self.vendor_name) + + def __arrow_ext_scalar_class__(self): + return OpaqueScalar + + +cdef class UnknownExtensionType(ExtensionType): + """ + A concrete class for Python-defined extension types that refer to + an unknown Python implementation. + + Parameters + ---------- + storage_type : DataType + The storage type for which the extension is built. + serialized : bytes + The serialised output. + """ + + cdef: + bytes serialized + + def __init__(self, DataType storage_type, serialized): + self.serialized = serialized + super().__init__(storage_type, "pyarrow.unknown") + + def __arrow_ext_serialize__(self): + return self.serialized + + @classmethod + def __arrow_ext_deserialize__(cls, storage_type, serialized): + return UnknownExtensionType() + + +_python_extension_types_registry = [] + + +def register_extension_type(ext_type): + """ + Register a Python extension type. + + Registration is based on the extension name (so different registered types + need unique extension names). Registration needs an extension type + instance, but then works for any instance of the same subclass regardless + of parametrization of the type. + + Parameters + ---------- + ext_type : BaseExtensionType instance + The ExtensionType subclass to register. + + Examples + -------- + Define a RationalType extension type subclassing ExtensionType: + + >>> import pyarrow as pa + >>> class RationalType(pa.ExtensionType): + ... def __init__(self, data_type: pa.DataType): + ... if not pa.types.is_integer(data_type): + ... raise TypeError(f"data_type must be an integer type not {data_type}") + ... super().__init__( + ... pa.struct( + ... [ + ... ("numer", data_type), + ... ("denom", data_type), + ... ], + ... ), + ... # N.B. This name does _not_ reference `data_type` so deserialization + ... # will work for _any_ integer `data_type` after registration + ... "my_package.rational", + ... ) + ... def __arrow_ext_serialize__(self) -> bytes: + ... # No parameters are necessary + ... return b"" + ... @classmethod + ... def __arrow_ext_deserialize__(cls, storage_type, serialized): + ... # return an instance of this subclass + ... return RationalType(storage_type[0].type) + + Register the extension type: + + >>> pa.register_extension_type(RationalType(pa.int64())) + + Unregister the extension type: + + >>> pa.unregister_extension_type("my_package.rational") + """ + cdef: + DataType _type = ensure_type(ext_type, allow_none=False) + + if not isinstance(_type, BaseExtensionType): + raise TypeError("Only extension types can be registered") + + # register on the C++ side + check_status( + RegisterPyExtensionType( _type.sp_type)) + + # register on the python side + _python_extension_types_registry.append(_type) + + +def unregister_extension_type(type_name): + """ + Unregister a Python extension type. + + Parameters + ---------- + type_name : str + The name of the ExtensionType subclass to unregister. + + Examples + -------- + Define a RationalType extension type subclassing ExtensionType: + + >>> import pyarrow as pa + >>> class RationalType(pa.ExtensionType): + ... def __init__(self, data_type: pa.DataType): + ... if not pa.types.is_integer(data_type): + ... raise TypeError(f"data_type must be an integer type not {data_type}") + ... super().__init__( + ... pa.struct( + ... [ + ... ("numer", data_type), + ... ("denom", data_type), + ... ], + ... ), + ... # N.B. This name does _not_ reference `data_type` so deserialization + ... # will work for _any_ integer `data_type` after registration + ... "my_package.rational", + ... ) + ... def __arrow_ext_serialize__(self) -> bytes: + ... # No parameters are necessary + ... return b"" + ... @classmethod + ... def __arrow_ext_deserialize__(cls, storage_type, serialized): + ... # return an instance of this subclass + ... return RationalType(storage_type[0].type) + + Register the extension type: + + >>> pa.register_extension_type(RationalType(pa.int64())) + + Unregister the extension type: + + >>> pa.unregister_extension_type("my_package.rational") + """ + cdef: + c_string c_type_name = tobytes(type_name) + check_status(UnregisterPyExtensionType(c_type_name)) + + +cdef class KeyValueMetadata(_Metadata, Mapping): + """ + KeyValueMetadata + + Parameters + ---------- + __arg0__ : dict + A dict of the key-value metadata + **kwargs : optional + additional key-value metadata + """ + + def __init__(self, __arg0__=None, **kwargs): + cdef: + vector[c_string] keys, values + shared_ptr[const CKeyValueMetadata] result + + items = [] + if __arg0__ is not None: + other = (__arg0__.items() if isinstance(__arg0__, Mapping) + else __arg0__) + items.extend((tobytes(k), v) for k, v in other) + + prior_keys = {k for k, v in items} + for k, v in kwargs.items(): + k = tobytes(k) + if k in prior_keys: + raise KeyError("Duplicate key {}, " + "use pass all items as list of tuples if you " + "intend to have duplicate keys") + items.append((k, v)) + + keys.reserve(len(items)) + for key, value in items: + keys.push_back(tobytes(key)) + values.push_back(tobytes(value)) + result.reset(new CKeyValueMetadata(move(keys), move(values))) + self.init(result) + + cdef void init(self, const shared_ptr[const CKeyValueMetadata]& wrapped): + self.wrapped = wrapped + self.metadata = wrapped.get() + + @staticmethod + cdef wrap(const shared_ptr[const CKeyValueMetadata]& sp): + cdef KeyValueMetadata self = KeyValueMetadata.__new__(KeyValueMetadata) + self.init(sp) + return self + + cdef inline shared_ptr[const CKeyValueMetadata] unwrap(self) nogil: + return self.wrapped + + def equals(self, KeyValueMetadata other): + """ + Parameters + ---------- + other : pyarrow.KeyValueMetadata + + Returns + ------- + bool + """ + return self.metadata.Equals(deref(other.wrapped)) + + def __repr__(self): + return str(self) + + def __str__(self): + return frombytes(self.metadata.ToString(), safe=True) + + def __eq__(self, other): + try: + return self.equals(other) + except TypeError: + pass + + if isinstance(other, Mapping): + try: + other = KeyValueMetadata(other) + return self.equals(other) + except TypeError: + pass + + return NotImplemented + + def __len__(self): + return self.metadata.size() + + def __contains__(self, key): + return self.metadata.Contains(tobytes(key)) + + def __getitem__(self, key): + return GetResultValue(self.metadata.Get(tobytes(key))) + + def __iter__(self): + return self.keys() + + def __reduce__(self): + return KeyValueMetadata, (list(self.items()),) + + def key(self, i): + """ + Parameters + ---------- + i : int + + Returns + ------- + byte + """ + return self.metadata.key(i) + + def value(self, i): + """ + Parameters + ---------- + i : int + + Returns + ------- + byte + """ + return self.metadata.value(i) + + def keys(self): + for i in range(self.metadata.size()): + yield self.metadata.key(i) + + def values(self): + for i in range(self.metadata.size()): + yield self.metadata.value(i) + + def items(self): + for i in range(self.metadata.size()): + yield (self.metadata.key(i), self.metadata.value(i)) + + def get_all(self, key): + """ + Parameters + ---------- + key : str + + Returns + ------- + list[byte] + """ + key = tobytes(key) + return [v for k, v in self.items() if k == key] + + def to_dict(self): + """ + Convert KeyValueMetadata to dict. If a key occurs twice, the value for + the first one is returned + """ + cdef object key # to force coercion to Python + result = ordered_dict() + for i in range(self.metadata.size()): + key = self.metadata.key(i) + if key not in result: + result[key] = self.metadata.value(i) + return result + + +cpdef KeyValueMetadata ensure_metadata(object meta, c_bool allow_none=False): + if allow_none and meta is None: + return None + elif isinstance(meta, KeyValueMetadata): + return meta + else: + return KeyValueMetadata(meta) + + +cdef class Field(_Weakrefable): + """ + A named field, with a data type, nullability, and optional metadata. + + Notes + ----- + Do not use this class's constructor directly; use pyarrow.field + + Examples + -------- + Create an instance of pyarrow.Field: + + >>> import pyarrow as pa + >>> pa.field('key', pa.int32()) + pyarrow.Field + >>> pa.field('key', pa.int32(), nullable=False) + pyarrow.Field + >>> field = pa.field('key', pa.int32(), + ... metadata={"key": "Something important"}) + >>> field + pyarrow.Field + >>> field.metadata + {b'key': b'Something important'} + + Use the field to create a struct type: + + >>> pa.struct([field]) + StructType(struct) + """ + + def __cinit__(self): + pass + + def __init__(self): + raise TypeError("Do not call Field's constructor directly, use " + "`pyarrow.field` instead.") + + cdef void init(self, const shared_ptr[CField]& field): + self.sp_field = field + self.field = field.get() + self.type = pyarrow_wrap_data_type(field.get().type()) + + def equals(self, Field other, bint check_metadata=False): + """ + Test if this field is equal to the other + + Parameters + ---------- + other : pyarrow.Field + check_metadata : bool, default False + Whether Field metadata equality should be checked as well. + + Returns + ------- + is_equal : bool + + Examples + -------- + >>> import pyarrow as pa + >>> f1 = pa.field('key', pa.int32()) + >>> f2 = pa.field('key', pa.int32(), nullable=False) + >>> f1.equals(f2) + False + >>> f1.equals(f1) + True + """ + return self.field.Equals(deref(other.field), check_metadata) + + def __eq__(self, other): + try: + return self.equals(other) + except TypeError: + return NotImplemented + + def __reduce__(self): + return field, (self.name, self.type, self.nullable, self.metadata) + + def __str__(self): + return f'pyarrow.Field<{frombytes(self.field.ToString(), safe=True)}>' + + def __repr__(self): + return self.__str__() + + def __hash__(self): + return hash((self.field.name(), self.type, self.field.nullable())) + + @property + def nullable(self): + """ + The field nullability. + + Examples + -------- + >>> import pyarrow as pa + >>> f1 = pa.field('key', pa.int32()) + >>> f2 = pa.field('key', pa.int32(), nullable=False) + >>> f1.nullable + True + >>> f2.nullable + False + """ + return self.field.nullable() + + @property + def name(self): + """ + The field name. + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32()) + >>> field.name + 'key' + """ + return frombytes(self.field.name()) + + @property + def metadata(self): + """ + The field metadata (if any is set). + + Returns + ------- + metadata : dict or None + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32(), + ... metadata={"key": "Something important"}) + >>> field.metadata + {b'key': b'Something important'} + """ + wrapped = pyarrow_wrap_metadata(self.field.metadata()) + if wrapped is not None: + return wrapped.to_dict() + else: + return wrapped + + def with_metadata(self, metadata): + """ + Add metadata as dict of string keys and values to Field + + Parameters + ---------- + metadata : dict + Keys and values must be string-like / coercible to bytes + + Returns + ------- + field : pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32()) + + Create new field by adding metadata to existing one: + + >>> field_new = field.with_metadata({"key": "Something important"}) + >>> field_new + pyarrow.Field + >>> field_new.metadata + {b'key': b'Something important'} + """ + cdef shared_ptr[CField] c_field + + meta = ensure_metadata(metadata, allow_none=False) + with nogil: + c_field = self.field.WithMetadata(meta.unwrap()) + + return pyarrow_wrap_field(c_field) + + def remove_metadata(self): + """ + Create new field without metadata, if any + + Returns + ------- + field : pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32(), + ... metadata={"key": "Something important"}) + >>> field.metadata + {b'key': b'Something important'} + + Create new field by removing the metadata from the existing one: + + >>> field_new = field.remove_metadata() + >>> field_new.metadata + """ + cdef shared_ptr[CField] new_field + with nogil: + new_field = self.field.RemoveMetadata() + return pyarrow_wrap_field(new_field) + + def with_type(self, DataType new_type): + """ + A copy of this field with the replaced type + + Parameters + ---------- + new_type : pyarrow.DataType + + Returns + ------- + field : pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32()) + >>> field + pyarrow.Field + + Create new field by replacing type of an existing one: + + >>> field_new = field.with_type(pa.int64()) + >>> field_new + pyarrow.Field + """ + cdef: + shared_ptr[CField] c_field + shared_ptr[CDataType] c_datatype + + c_datatype = pyarrow_unwrap_data_type(new_type) + with nogil: + c_field = self.field.WithType(c_datatype) + + return pyarrow_wrap_field(c_field) + + def with_name(self, name): + """ + A copy of this field with the replaced name + + Parameters + ---------- + name : str + + Returns + ------- + field : pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32()) + >>> field + pyarrow.Field + + Create new field by replacing the name of an existing one: + + >>> field_new = field.with_name('lock') + >>> field_new + pyarrow.Field + """ + cdef: + shared_ptr[CField] c_field + + c_field = self.field.WithName(tobytes(name)) + + return pyarrow_wrap_field(c_field) + + def with_nullable(self, nullable): + """ + A copy of this field with the replaced nullability + + Parameters + ---------- + nullable : bool + + Returns + ------- + field: pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> field = pa.field('key', pa.int32()) + >>> field + pyarrow.Field + >>> field.nullable + True + + Create new field by replacing the nullability of an existing one: + + >>> field_new = field.with_nullable(False) + >>> field_new + pyarrow.Field + >>> field_new.nullable + False + """ + cdef: + shared_ptr[CField] field + c_bool c_nullable + + c_nullable = bool(nullable) + with nogil: + c_field = self.field.WithNullable(c_nullable) + + return pyarrow_wrap_field(c_field) + + def flatten(self): + """ + Flatten this field. If a struct field, individual child fields + will be returned with their names prefixed by the parent's name. + + Returns + ------- + fields : List[pyarrow.Field] + + Examples + -------- + >>> import pyarrow as pa + >>> f1 = pa.field('bar', pa.float64(), nullable=False) + >>> f2 = pa.field('foo', pa.int32()).with_metadata({"key": "Something important"}) + >>> ff = pa.field('ff', pa.struct([f1, f2]), nullable=False) + + Flatten a struct field: + + >>> ff + pyarrow.Field not null> + >>> ff.flatten() + [pyarrow.Field, pyarrow.Field] + """ + cdef vector[shared_ptr[CField]] flattened + with nogil: + flattened = self.field.Flatten() + return [pyarrow_wrap_field(f) for f in flattened] + + def _export_to_c(self, out_ptr): + """ + Export to a C ArrowSchema struct, given its pointer. + + Be careful: if you don't pass the ArrowSchema struct to a consumer, + its memory will leak. This is a low-level function intended for + expert users. + """ + check_status(ExportField(deref(self.field), + _as_c_pointer(out_ptr))) + + @staticmethod + def _import_from_c(in_ptr): + """ + Import Field from a C ArrowSchema struct, given its pointer. + + This is a low-level function intended for expert users. + """ + cdef void* c_ptr = _as_c_pointer(in_ptr) + with nogil: + result = GetResultValue(ImportField( c_ptr)) + return pyarrow_wrap_field(result) + + def __arrow_c_schema__(self): + """ + Export to a ArrowSchema PyCapsule + + Unlike _export_to_c, this will not leak memory if the capsule is not used. + """ + cdef ArrowSchema* c_schema + capsule = alloc_c_schema(&c_schema) + + with nogil: + check_status(ExportField(deref(self.field), c_schema)) + + return capsule + + @staticmethod + def _import_from_c_capsule(schema): + """ + Import a Field from a ArrowSchema PyCapsule + + Parameters + ---------- + schema : PyCapsule + A valid PyCapsule with name 'arrow_schema' containing an + ArrowSchema pointer. + """ + cdef: + ArrowSchema* c_schema + shared_ptr[CField] c_field + + if not PyCapsule_IsValid(schema, 'arrow_schema'): + raise ValueError( + "Not an ArrowSchema object" + ) + c_schema = PyCapsule_GetPointer(schema, 'arrow_schema') + + with nogil: + c_field = GetResultValue(ImportField(c_schema)) + + return pyarrow_wrap_field(c_field) + + +cdef class Schema(_Weakrefable): + """ + A named collection of types a.k.a schema. A schema defines the + column names and types in a record batch or table data structure. + They also contain metadata about the columns. For example, schemas + converted from Pandas contain metadata about their original Pandas + types so they can be converted back to the same types. + + Warnings + -------- + Do not call this class's constructor directly. Instead use + :func:`pyarrow.schema` factory function which makes a new Arrow + Schema object. + + Examples + -------- + Create a new Arrow Schema object: + + >>> import pyarrow as pa + >>> pa.schema([ + ... ('some_int', pa.int32()), + ... ('some_string', pa.string()) + ... ]) + some_int: int32 + some_string: string + + Create Arrow Schema with metadata: + + >>> pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())], + ... metadata={"n_legs": "Number of legs per animal"}) + n_legs: int64 + animals: string + -- schema metadata -- + n_legs: 'Number of legs per animal' + """ + + def __cinit__(self): + pass + + def __init__(self): + raise TypeError("Do not call Schema's constructor directly, use " + "`pyarrow.schema` instead.") + + def __len__(self): + return self.schema.num_fields() + + def __getitem__(self, key): + # access by integer index + return self._field(key) + + def __iter__(self): + for i in range(len(self)): + yield self[i] + + cdef void init(self, const vector[shared_ptr[CField]]& fields): + self.schema = new CSchema(fields) + self.sp_schema.reset(self.schema) + + cdef void init_schema(self, const shared_ptr[CSchema]& schema): + self.schema = schema.get() + self.sp_schema = schema + + def __reduce__(self): + return schema, (list(self), self.metadata) + + def __hash__(self): + metadata = frozenset(self.metadata.items() if self.metadata else {}) + return hash((tuple(self), metadata)) + + def __sizeof__(self): + size = 0 + if self.metadata: + for key, value in self.metadata.items(): + size += sys.getsizeof(key) + size += sys.getsizeof(value) + + return size + super(Schema, self).__sizeof__() + + @property + def pandas_metadata(self): + """ + Return deserialized-from-JSON pandas metadata field (if it exists) + + Examples + -------- + >>> import pyarrow as pa + >>> import pandas as pd + >>> df = pd.DataFrame({'n_legs': [2, 4, 5, 100], + ... 'animals': ["Flamingo", "Horse", "Brittle stars", "Centipede"]}) + >>> schema = pa.Table.from_pandas(df).schema + + Select pandas metadata field from Arrow Schema: + + >>> schema.pandas_metadata + {'index_columns': [{'kind': 'range', 'name': None, 'start': 0, 'stop': 4, 'step': 1}], ... + """ + metadata = self.metadata + key = b'pandas' + if metadata is None or key not in metadata: + return None + + import json + return json.loads(metadata[key].decode('utf8')) + + @property + def names(self): + """ + The schema's field names. + + Returns + ------- + list of str + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Get the names of the schema's fields: + + >>> schema.names + ['n_legs', 'animals'] + """ + cdef int i + result = [] + for i in range(self.schema.num_fields()): + name = frombytes(self.schema.field(i).get().name()) + result.append(name) + return result + + @property + def types(self): + """ + The schema's field types. + + Returns + ------- + list of DataType + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Get the types of the schema's fields: + + >>> schema.types + [DataType(int64), DataType(string)] + """ + return [field.type for field in self] + + @property + def metadata(self): + """ + The schema's metadata (if any is set). + + Returns + ------- + metadata: dict or None + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())], + ... metadata={"n_legs": "Number of legs per animal"}) + + Get the metadata of the schema's fields: + + >>> schema.metadata + {b'n_legs': b'Number of legs per animal'} + """ + wrapped = pyarrow_wrap_metadata(self.schema.metadata()) + if wrapped is not None: + return wrapped.to_dict() + else: + return wrapped + + def __eq__(self, other): + try: + return self.equals(other) + except TypeError: + return NotImplemented + + def empty_table(self): + """ + Provide an empty table according to the schema. + + Returns + ------- + table: pyarrow.Table + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Create an empty table with schema's fields: + + >>> schema.empty_table() + pyarrow.Table + n_legs: int64 + animals: string + ---- + n_legs: [[]] + animals: [[]] + """ + arrays = [_empty_array(field.type) for field in self] + return Table.from_arrays(arrays, schema=self) + + def equals(self, Schema other not None, bint check_metadata=False): + """ + Test if this schema is equal to the other + + Parameters + ---------- + other : pyarrow.Schema + check_metadata : bool, default False + Key/value metadata must be equal too + + Returns + ------- + is_equal : bool + + Examples + -------- + >>> import pyarrow as pa + >>> schema1 = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())], + ... metadata={"n_legs": "Number of legs per animal"}) + >>> schema2 = pa.schema([ + ... ('some_int', pa.int32()), + ... ('some_string', pa.string()) + ... ]) + + Test two equal schemas: + + >>> schema1.equals(schema1) + True + + Test two unequal schemas: + + >>> schema1.equals(schema2) + False + """ + return self.sp_schema.get().Equals(deref(other.schema), + check_metadata) + + @classmethod + def from_pandas(cls, df, preserve_index=None): + """ + Returns implied schema from dataframe + + Parameters + ---------- + df : pandas.DataFrame + + preserve_index : bool, optional + Whether to store the index as an additional field in the resulting + ``Schema``. The default of None will store the index as a field, + except for RangeIndex which is stored as metadata only. Use + ``preserve_index=True`` to force it to be stored as a field. + + Returns + ------- + pyarrow.Schema + + Examples + -------- + >>> import pandas as pd + >>> import pyarrow as pa + >>> df = pd.DataFrame({ + ... 'int': [1, 2], + ... 'str': ['a', 'b'] + ... }) + + Create an Arrow Schema from the schema of a pandas dataframe: + + >>> pa.Schema.from_pandas(df) + int: int64 + str: string + -- schema metadata -- + pandas: '{"index_columns": [{"kind": "range", "name": null, ... + """ + from pyarrow.pandas_compat import dataframe_to_types + names, types, metadata = dataframe_to_types( + df, + preserve_index=preserve_index + ) + fields = [] + for name, type_ in zip(names, types): + fields.append(field(name, type_)) + return schema(fields, metadata) + + def field(self, i): + """ + Select a field by its column name or numeric index. + + Parameters + ---------- + i : int or string + + Returns + ------- + pyarrow.Field + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Select the second field: + + >>> schema.field(1) + pyarrow.Field + + Select the field of the column named 'n_legs': + + >>> schema.field('n_legs') + pyarrow.Field + """ + if isinstance(i, (bytes, str)): + field_index = self.get_field_index(i) + if field_index < 0: + raise KeyError(f"Column {i} does not exist in schema") + else: + return self._field(field_index) + elif isinstance(i, int): + return self._field(i) + else: + raise TypeError("Index must either be string or integer") + + def _field(self, int i): + """ + Select a field by its numeric index. + + Parameters + ---------- + i : int + + Returns + ------- + pyarrow.Field + """ + cdef int index = _normalize_index(i, self.schema.num_fields()) + return pyarrow_wrap_field(self.schema.field(index)) + + def field_by_name(self, name): + """ + DEPRECATED + + Parameters + ---------- + name : str + + Returns + ------- + field: pyarrow.Field + """ + cdef: + vector[shared_ptr[CField]] results + + warnings.warn( + "The 'field_by_name' method is deprecated, use 'field' instead", + FutureWarning, stacklevel=2) + + results = self.schema.GetAllFieldsByName(tobytes(name)) + if results.size() == 0: + return None + elif results.size() > 1: + warnings.warn("Schema field name corresponds to more " + "than one field", UserWarning) + return None + else: + return pyarrow_wrap_field(results[0]) + + def get_field_index(self, name): + """ + Return index of the unique field with the given name. + + Parameters + ---------- + name : str + The name of the field to look up. + + Returns + ------- + index : int + The index of the field with the given name; -1 if the + name isn't found or there are several fields with the given + name. + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Get the index of the field named 'animals': + + >>> schema.get_field_index("animals") + 1 + + Index in case of several fields with the given name: + + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string()), + ... pa.field('animals', pa.bool_())], + ... metadata={"n_legs": "Number of legs per animal"}) + >>> schema.get_field_index("animals") + -1 + """ + return self.schema.GetFieldIndex(tobytes(name)) + + def get_all_field_indices(self, name): + """ + Return sorted list of indices for the fields with the given name. + + Parameters + ---------- + name : str + The name of the field to look up. + + Returns + ------- + indices : List[int] + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string()), + ... pa.field('animals', pa.bool_())]) + + Get the indexes of the fields named 'animals': + + >>> schema.get_all_field_indices("animals") + [1, 2] + """ + return self.schema.GetAllFieldIndices(tobytes(name)) + + def append(self, Field field): + """ + Append a field at the end of the schema. + + In contrast to Python's ``list.append()`` it does return a new + object, leaving the original Schema unmodified. + + Parameters + ---------- + field : Field + + Returns + ------- + schema: Schema + New object with appended field. + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Append a field 'extra' at the end of the schema: + + >>> schema_new = schema.append(pa.field('extra', pa.bool_())) + >>> schema_new + n_legs: int64 + animals: string + extra: bool + + Original schema is unmodified: + + >>> schema + n_legs: int64 + animals: string + """ + return self.insert(self.schema.num_fields(), field) + + def insert(self, int i, Field field): + """ + Add a field at position i to the schema. + + Parameters + ---------- + i : int + field : Field + + Returns + ------- + schema: Schema + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Insert a new field on the second position: + + >>> schema.insert(1, pa.field('extra', pa.bool_())) + n_legs: int64 + extra: bool + animals: string + """ + cdef: + shared_ptr[CSchema] new_schema + shared_ptr[CField] c_field + + c_field = field.sp_field + + with nogil: + new_schema = GetResultValue(self.schema.AddField(i, c_field)) + + return pyarrow_wrap_schema(new_schema) + + def remove(self, int i): + """ + Remove the field at index i from the schema. + + Parameters + ---------- + i : int + + Returns + ------- + schema: Schema + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Remove the second field of the schema: + + >>> schema.remove(1) + n_legs: int64 + """ + cdef shared_ptr[CSchema] new_schema + + with nogil: + new_schema = GetResultValue(self.schema.RemoveField(i)) + + return pyarrow_wrap_schema(new_schema) + + def set(self, int i, Field field): + """ + Replace a field at position i in the schema. + + Parameters + ---------- + i : int + field : Field + + Returns + ------- + schema: Schema + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Replace the second field of the schema with a new field 'extra': + + >>> schema.set(1, pa.field('replaced', pa.bool_())) + n_legs: int64 + replaced: bool + """ + cdef: + shared_ptr[CSchema] new_schema + shared_ptr[CField] c_field + + c_field = field.sp_field + + with nogil: + new_schema = GetResultValue(self.schema.SetField(i, c_field)) + + return pyarrow_wrap_schema(new_schema) + + def add_metadata(self, metadata): + """ + DEPRECATED + + Parameters + ---------- + metadata : dict + Keys and values must be string-like / coercible to bytes + """ + warnings.warn("The 'add_metadata' method is deprecated, use " + "'with_metadata' instead", FutureWarning, stacklevel=2) + return self.with_metadata(metadata) + + def with_metadata(self, metadata): + """ + Add metadata as dict of string keys and values to Schema + + Parameters + ---------- + metadata : dict + Keys and values must be string-like / coercible to bytes + + Returns + ------- + schema : pyarrow.Schema + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Add metadata to existing schema field: + + >>> schema.with_metadata({"n_legs": "Number of legs per animal"}) + n_legs: int64 + animals: string + -- schema metadata -- + n_legs: 'Number of legs per animal' + """ + cdef shared_ptr[CSchema] c_schema + + meta = ensure_metadata(metadata, allow_none=False) + with nogil: + c_schema = self.schema.WithMetadata(meta.unwrap()) + + return pyarrow_wrap_schema(c_schema) + + def serialize(self, memory_pool=None): + """ + Write Schema to Buffer as encapsulated IPC message + + Parameters + ---------- + memory_pool : MemoryPool, default None + Uses default memory pool if not specified + + Returns + ------- + serialized : Buffer + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())]) + + Write schema to Buffer: + + >>> schema.serialize() + + """ + cdef: + shared_ptr[CBuffer] buffer + CMemoryPool* pool = maybe_unbox_memory_pool(memory_pool) + + with nogil: + buffer = GetResultValue(SerializeSchema(deref(self.schema), + pool)) + return pyarrow_wrap_buffer(buffer) + + def remove_metadata(self): + """ + Create new schema without metadata, if any + + Returns + ------- + schema : pyarrow.Schema + + Examples + -------- + >>> import pyarrow as pa + >>> schema = pa.schema([ + ... pa.field('n_legs', pa.int64()), + ... pa.field('animals', pa.string())], + ... metadata={"n_legs": "Number of legs per animal"}) + >>> schema + n_legs: int64 + animals: string + -- schema metadata -- + n_legs: 'Number of legs per animal' + + Create a new schema with removing the metadata from the original: + + >>> schema.remove_metadata() + n_legs: int64 + animals: string + """ + cdef shared_ptr[CSchema] new_schema + with nogil: + new_schema = self.schema.RemoveMetadata() + return pyarrow_wrap_schema(new_schema) + + def to_string(self, truncate_metadata=True, show_field_metadata=True, + show_schema_metadata=True, element_size_limit=100): + """ + Return human-readable representation of Schema + + Parameters + ---------- + truncate_metadata : boolean, default True + Limit metadata key/value display to a single line of ~80 characters + or less + show_field_metadata : boolean, default True + Display Field-level KeyValueMetadata + show_schema_metadata : boolean, default True + Display Schema-level KeyValueMetadata + element_size_limit : int, default 100 + Maximum number of characters of a single element before it is truncated. + + Returns + ------- + str : the formatted output + """ + cdef: + c_string result + PrettyPrintOptions options = PrettyPrintOptions.Defaults() + + options.indent = 0 + options.truncate_metadata = truncate_metadata + options.show_field_metadata = show_field_metadata + options.show_schema_metadata = show_schema_metadata + options.element_size_limit = element_size_limit + + with nogil: + check_status( + PrettyPrint( + deref(self.schema), + options, + &result + ) + ) + + return frombytes(result, safe=True) + + def _export_to_c(self, out_ptr): + """ + Export to a C ArrowSchema struct, given its pointer. + + Be careful: if you don't pass the ArrowSchema struct to a consumer, + its memory will leak. This is a low-level function intended for + expert users. + """ + check_status(ExportSchema(deref(self.schema), + _as_c_pointer(out_ptr))) + + @staticmethod + def _import_from_c(in_ptr): + """ + Import Schema from a C ArrowSchema struct, given its pointer. + + This is a low-level function intended for expert users. + """ + cdef void* c_ptr = _as_c_pointer(in_ptr) + with nogil: + result = GetResultValue(ImportSchema( c_ptr)) + return pyarrow_wrap_schema(result) + + def __str__(self): + return self.to_string() + + def __repr__(self): + return self.__str__() + + def __arrow_c_schema__(self): + """ + Export to a ArrowSchema PyCapsule + + Unlike _export_to_c, this will not leak memory if the capsule is not used. + """ + cdef ArrowSchema* c_schema + capsule = alloc_c_schema(&c_schema) + + with nogil: + check_status(ExportSchema(deref(self.schema), c_schema)) + + return capsule + + @staticmethod + def _import_from_c_capsule(schema): + """ + Import a Schema from a ArrowSchema PyCapsule + + Parameters + ---------- + schema : PyCapsule + A valid PyCapsule with name 'arrow_schema' containing an + ArrowSchema pointer. + """ + cdef: + ArrowSchema* c_schema + + if not PyCapsule_IsValid(schema, 'arrow_schema'): + raise ValueError( + "Not an ArrowSchema object" + ) + c_schema = PyCapsule_GetPointer(schema, 'arrow_schema') + + with nogil: + result = GetResultValue(ImportSchema(c_schema)) + + return pyarrow_wrap_schema(result) + + +cdef CField.CMergeOptions _parse_field_merge_options(str promote_options) except *: + """ + Returns MergeOptions::Permissive() or MergeOptions::Defaults() based on the value + of `promote_options`. + """ + if promote_options == "permissive": + return CField.CMergeOptions.Permissive() + elif promote_options == "default": + return CField.CMergeOptions.Defaults() + else: + raise ValueError(f"Invalid promote_options: {promote_options}") + + +def unify_schemas(schemas, *, promote_options="default"): + """ + Unify schemas by merging fields by name. + + The resulting schema will contain the union of fields from all schemas. + Fields with the same name will be merged. Note that two fields with + different types will fail merging by default. + + - The unified field will inherit the metadata from the schema where + that field is first defined. + - The first N fields in the schema will be ordered the same as the + N fields in the first schema. + + The resulting schema will inherit its metadata from the first input + schema. + + Parameters + ---------- + schemas : list of Schema + Schemas to merge into a single one. + promote_options : str, default default + Accepts strings "default" and "permissive". + Default: null and only null can be unified with another type. + Permissive: types are promoted to the greater common denominator. + + Returns + ------- + Schema + + Raises + ------ + ArrowInvalid : + If any input schema contains fields with duplicate names. + If Fields of the same name are not mergeable. + """ + cdef: + Schema schema + CField.CMergeOptions c_options + vector[shared_ptr[CSchema]] c_schemas + for schema in schemas: + if not isinstance(schema, Schema): + raise TypeError(f"Expected Schema, got {type(schema)}") + c_schemas.push_back(pyarrow_unwrap_schema(schema)) + + c_options = _parse_field_merge_options(promote_options) + + return pyarrow_wrap_schema( + GetResultValue(UnifySchemas(c_schemas, c_options))) + + +cdef dict _type_cache = {} + + +cdef DataType primitive_type(Type type): + if type in _type_cache: + return _type_cache[type] + + cdef DataType out = DataType.__new__(DataType) + out.init(GetPrimitiveType(type)) + + _type_cache[type] = out + return out + + +# ----------------------------------------------------------- +# Type factory functions + + +def field(name, type=None, nullable=None, metadata=None): + """ + Create a pyarrow.Field instance. + + Parameters + ---------- + name : str or bytes + Name of the field. + Alternatively, you can also pass an object that implements the Arrow + PyCapsule Protocol for schemas (has an ``__arrow_c_schema__`` method). + type : pyarrow.DataType or str + Arrow datatype of the field or a string matching one. + nullable : bool, default True + Whether the field's values are nullable. + metadata : dict, default None + Optional field metadata, the keys and values must be coercible to + bytes. + + Returns + ------- + field : pyarrow.Field + + Examples + -------- + Create an instance of pyarrow.Field: + + >>> import pyarrow as pa + >>> pa.field('key', pa.int32()) + pyarrow.Field + >>> pa.field('key', pa.int32(), nullable=False) + pyarrow.Field + + >>> field = pa.field('key', pa.int32(), + ... metadata={"key": "Something important"}) + >>> field + pyarrow.Field + >>> field.metadata + {b'key': b'Something important'} + + Use the field to create a struct type: + + >>> pa.struct([field]) + StructType(struct) + + A str can also be passed for the type parameter: + + >>> pa.field('key', 'int32') + pyarrow.Field + """ + if hasattr(name, "__arrow_c_schema__"): + if type is not None: + raise ValueError( + "cannot specify 'type' when creating a Field from an ArrowSchema" + ) + field = Field._import_from_c_capsule(name.__arrow_c_schema__()) + if metadata is not None: + field = field.with_metadata(metadata) + if nullable is not None: + field = field.with_nullable(nullable) + return field + + cdef: + Field result = Field.__new__(Field) + DataType _type = ensure_type(type, allow_none=False) + shared_ptr[const CKeyValueMetadata] c_meta + + nullable = True if nullable is None else nullable + + metadata = ensure_metadata(metadata, allow_none=True) + c_meta = pyarrow_unwrap_metadata(metadata) + + if _type.type.id() == _Type_NA and not nullable: + raise ValueError("A null type field may not be non-nullable") + + result.sp_field.reset( + new CField(tobytes(name), _type.sp_type, nullable, c_meta) + ) + result.field = result.sp_field.get() + result.type = _type + + return result + + +cdef set PRIMITIVE_TYPES = set([ + _Type_NA, _Type_BOOL, + _Type_UINT8, _Type_INT8, + _Type_UINT16, _Type_INT16, + _Type_UINT32, _Type_INT32, + _Type_UINT64, _Type_INT64, + _Type_TIMESTAMP, _Type_DATE32, + _Type_TIME32, _Type_TIME64, + _Type_DATE64, + _Type_HALF_FLOAT, + _Type_FLOAT, + _Type_DOUBLE]) + + +def null(): + """ + Create instance of null type. + + Examples + -------- + Create an instance of a null type: + + >>> import pyarrow as pa + >>> pa.null() + DataType(null) + >>> print(pa.null()) + null + + Create a ``Field`` type with a null type and a name: + + >>> pa.field('null_field', pa.null()) + pyarrow.Field + """ + return primitive_type(_Type_NA) + + +def bool_(): + """ + Create instance of boolean type. + + Examples + -------- + Create an instance of a boolean type: + + >>> import pyarrow as pa + >>> pa.bool_() + DataType(bool) + >>> print(pa.bool_()) + bool + + Create a ``Field`` type with a boolean type + and a name: + + >>> pa.field('bool_field', pa.bool_()) + pyarrow.Field + """ + return primitive_type(_Type_BOOL) + + +def uint8(): + """ + Create instance of unsigned int8 type. + + Examples + -------- + Create an instance of unsigned int8 type: + + >>> import pyarrow as pa + >>> pa.uint8() + DataType(uint8) + >>> print(pa.uint8()) + uint8 + + Create an array with unsigned int8 type: + + >>> pa.array([0, 1, 2], type=pa.uint8()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_UINT8) + + +def int8(): + """ + Create instance of signed int8 type. + + Examples + -------- + Create an instance of int8 type: + + >>> import pyarrow as pa + >>> pa.int8() + DataType(int8) + >>> print(pa.int8()) + int8 + + Create an array with int8 type: + + >>> pa.array([0, 1, 2], type=pa.int8()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_INT8) + + +def uint16(): + """ + Create instance of unsigned uint16 type. + + Examples + -------- + Create an instance of unsigned int16 type: + + >>> import pyarrow as pa + >>> pa.uint16() + DataType(uint16) + >>> print(pa.uint16()) + uint16 + + Create an array with unsigned int16 type: + + >>> pa.array([0, 1, 2], type=pa.uint16()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_UINT16) + + +def int16(): + """ + Create instance of signed int16 type. + + Examples + -------- + Create an instance of int16 type: + + >>> import pyarrow as pa + >>> pa.int16() + DataType(int16) + >>> print(pa.int16()) + int16 + + Create an array with int16 type: + + >>> pa.array([0, 1, 2], type=pa.int16()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_INT16) + + +def uint32(): + """ + Create instance of unsigned uint32 type. + + Examples + -------- + Create an instance of unsigned int32 type: + + >>> import pyarrow as pa + >>> pa.uint32() + DataType(uint32) + >>> print(pa.uint32()) + uint32 + + Create an array with unsigned int32 type: + + >>> pa.array([0, 1, 2], type=pa.uint32()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_UINT32) + + +def int32(): + """ + Create instance of signed int32 type. + + Examples + -------- + Create an instance of int32 type: + + >>> import pyarrow as pa + >>> pa.int32() + DataType(int32) + >>> print(pa.int32()) + int32 + + Create an array with int32 type: + + >>> pa.array([0, 1, 2], type=pa.int32()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_INT32) + + +def uint64(): + """ + Create instance of unsigned uint64 type. + + Examples + -------- + Create an instance of unsigned int64 type: + + >>> import pyarrow as pa + >>> pa.uint64() + DataType(uint64) + >>> print(pa.uint64()) + uint64 + + Create an array with unsigned uint64 type: + + >>> pa.array([0, 1, 2], type=pa.uint64()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_UINT64) + + +def int64(): + """ + Create instance of signed int64 type. + + Examples + -------- + Create an instance of int64 type: + + >>> import pyarrow as pa + >>> pa.int64() + DataType(int64) + >>> print(pa.int64()) + int64 + + Create an array with int64 type: + + >>> pa.array([0, 1, 2], type=pa.int64()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_INT64) + + +cdef dict _timestamp_type_cache = {} +cdef dict _time_type_cache = {} +cdef dict _duration_type_cache = {} + + +cdef timeunit_to_string(TimeUnit unit): + if unit == TimeUnit_SECOND: + return 's' + elif unit == TimeUnit_MILLI: + return 'ms' + elif unit == TimeUnit_MICRO: + return 'us' + elif unit == TimeUnit_NANO: + return 'ns' + + +cdef TimeUnit string_to_timeunit(unit) except *: + if unit == 's': + return TimeUnit_SECOND + elif unit == 'ms': + return TimeUnit_MILLI + elif unit == 'us': + return TimeUnit_MICRO + elif unit == 'ns': + return TimeUnit_NANO + else: + raise ValueError(f"Invalid time unit: {unit!r}") + + +def tzinfo_to_string(tz): + """ + Converts a time zone object into a string indicating the name of a time + zone, one of: + * As used in the Olson time zone database (the "tz database" or + "tzdata"), such as "America/New_York" + * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30 + + Parameters + ---------- + tz : datetime.tzinfo + Time zone object + + Returns + ------- + name : str + Time zone name + """ + return frombytes(GetResultValue(TzinfoToString(tz))) + + +def string_to_tzinfo(name): + """ + Convert a time zone name into a time zone object. + + Supported input strings are: + * As used in the Olson time zone database (the "tz database" or + "tzdata"), such as "America/New_York" + * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30 + + Parameters + ---------- + name: str + Time zone name. + + Returns + ------- + tz : datetime.tzinfo + Time zone object + """ + cdef PyObject* tz = GetResultValue(StringToTzinfo(name.encode('utf-8'))) + return PyObject_to_object(tz) + + +def timestamp(unit, tz=None): + """ + Create instance of timestamp type with resolution and optional time zone. + + Parameters + ---------- + unit : str + one of 's' [second], 'ms' [millisecond], 'us' [microsecond], or 'ns' + [nanosecond] + tz : str, default None + Time zone name. None indicates time zone naive + + Examples + -------- + Create an instance of timestamp type: + + >>> import pyarrow as pa + >>> pa.timestamp('us') + TimestampType(timestamp[us]) + >>> pa.timestamp('s', tz='America/New_York') + TimestampType(timestamp[s, tz=America/New_York]) + >>> pa.timestamp('s', tz='+07:30') + TimestampType(timestamp[s, tz=+07:30]) + + Use timestamp type when creating a scalar object: + + >>> from datetime import datetime + >>> pa.scalar(datetime(2012, 1, 1), type=pa.timestamp('s', tz='UTC')) + + >>> pa.scalar(datetime(2012, 1, 1), type=pa.timestamp('us')) + + + Returns + ------- + timestamp_type : TimestampType + """ + cdef: + TimeUnit unit_code + c_string c_timezone + + unit_code = string_to_timeunit(unit) + + cdef TimestampType out = TimestampType.__new__(TimestampType) + + if tz is None: + out.init(ctimestamp(unit_code)) + if unit_code in _timestamp_type_cache: + return _timestamp_type_cache[unit_code] + _timestamp_type_cache[unit_code] = out + else: + if not isinstance(tz, (bytes, str)): + tz = tzinfo_to_string(tz) + + c_timezone = tobytes(tz) + out.init(ctimestamp(unit_code, c_timezone)) + + return out + + +def time32(unit): + """ + Create instance of 32-bit time (time of day) type with unit resolution. + + Parameters + ---------- + unit : str + one of 's' [second], or 'ms' [millisecond] + + Returns + ------- + type : pyarrow.Time32Type + + Examples + -------- + >>> import pyarrow as pa + >>> pa.time32('s') + Time32Type(time32[s]) + >>> pa.time32('ms') + Time32Type(time32[ms]) + """ + cdef: + TimeUnit unit_code + c_string c_timezone + + if unit == 's': + unit_code = TimeUnit_SECOND + elif unit == 'ms': + unit_code = TimeUnit_MILLI + else: + raise ValueError(f"Invalid time unit for time32: {unit!r}") + + if unit_code in _time_type_cache: + return _time_type_cache[unit_code] + + cdef Time32Type out = Time32Type.__new__(Time32Type) + + out.init(ctime32(unit_code)) + _time_type_cache[unit_code] = out + + return out + + +def time64(unit): + """ + Create instance of 64-bit time (time of day) type with unit resolution. + + Parameters + ---------- + unit : str + One of 'us' [microsecond], or 'ns' [nanosecond]. + + Returns + ------- + type : pyarrow.Time64Type + + Examples + -------- + >>> import pyarrow as pa + >>> pa.time64('us') + Time64Type(time64[us]) + >>> pa.time64('ns') + Time64Type(time64[ns]) + """ + cdef: + TimeUnit unit_code + c_string c_timezone + + if unit == 'us': + unit_code = TimeUnit_MICRO + elif unit == 'ns': + unit_code = TimeUnit_NANO + else: + raise ValueError(f"Invalid time unit for time64: {unit!r}") + + if unit_code in _time_type_cache: + return _time_type_cache[unit_code] + + cdef Time64Type out = Time64Type.__new__(Time64Type) + + out.init(ctime64(unit_code)) + _time_type_cache[unit_code] = out + + return out + + +def duration(unit): + """ + Create instance of a duration type with unit resolution. + + Parameters + ---------- + unit : str + One of 's' [second], 'ms' [millisecond], 'us' [microsecond], or + 'ns' [nanosecond]. + + Returns + ------- + type : pyarrow.DurationType + + Examples + -------- + Create an instance of duration type: + + >>> import pyarrow as pa + >>> pa.duration('us') + DurationType(duration[us]) + >>> pa.duration('s') + DurationType(duration[s]) + + Create an array with duration type: + + >>> pa.array([0, 1, 2], type=pa.duration('s')) + + [ + 0, + 1, + 2 + ] + """ + cdef: + TimeUnit unit_code + + unit_code = string_to_timeunit(unit) + + if unit_code in _duration_type_cache: + return _duration_type_cache[unit_code] + + cdef DurationType out = DurationType.__new__(DurationType) + + out.init(cduration(unit_code)) + _duration_type_cache[unit_code] = out + + return out + + +def month_day_nano_interval(): + """ + Create instance of an interval type representing months, days and + nanoseconds between two dates. + + Examples + -------- + Create an instance of an month_day_nano_interval type: + + >>> import pyarrow as pa + >>> pa.month_day_nano_interval() + DataType(month_day_nano_interval) + + Create a scalar with month_day_nano_interval type: + + >>> pa.scalar((1, 15, -30), type=pa.month_day_nano_interval()) + + """ + return primitive_type(_Type_INTERVAL_MONTH_DAY_NANO) + + +def date32(): + """ + Create instance of 32-bit date (days since UNIX epoch 1970-01-01). + + Examples + -------- + Create an instance of 32-bit date type: + + >>> import pyarrow as pa + >>> pa.date32() + DataType(date32[day]) + + Create a scalar with 32-bit date type: + + >>> from datetime import date + >>> pa.scalar(date(2012, 1, 1), type=pa.date32()) + + """ + return primitive_type(_Type_DATE32) + + +def date64(): + """ + Create instance of 64-bit date (milliseconds since UNIX epoch 1970-01-01). + + Examples + -------- + Create an instance of 64-bit date type: + + >>> import pyarrow as pa + >>> pa.date64() + DataType(date64[ms]) + + Create a scalar with 64-bit date type: + + >>> from datetime import datetime + >>> pa.scalar(datetime(2012, 1, 1), type=pa.date64()) + + """ + return primitive_type(_Type_DATE64) + + +def float16(): + """ + Create half-precision floating point type. + + Examples + -------- + Create an instance of float16 type: + + >>> import pyarrow as pa + >>> pa.float16() + DataType(halffloat) + >>> print(pa.float16()) + halffloat + + Create an array with float16 type: + + >>> arr = np.array([1.5, np.nan], dtype=np.float16) + >>> a = pa.array(arr, type=pa.float16()) + >>> a + + [ + 1.5, + nan + ] + + Note that unlike other float types, if you convert this array + to a python list, the types of its elements will be ``np.float16`` + + >>> [type(val) for val in a.to_pylist()] + [, ] + """ + return primitive_type(_Type_HALF_FLOAT) + + +def float32(): + """ + Create single-precision floating point type. + + Examples + -------- + Create an instance of float32 type: + + >>> import pyarrow as pa + >>> pa.float32() + DataType(float) + >>> print(pa.float32()) + float + + Create an array with float32 type: + + >>> pa.array([0.0, 1.0, 2.0], type=pa.float32()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_FLOAT) + + +def float64(): + """ + Create double-precision floating point type. + + Examples + -------- + Create an instance of float64 type: + + >>> import pyarrow as pa + >>> pa.float64() + DataType(double) + >>> print(pa.float64()) + double + + Create an array with float64 type: + + >>> pa.array([0.0, 1.0, 2.0], type=pa.float64()) + + [ + 0, + 1, + 2 + ] + """ + return primitive_type(_Type_DOUBLE) + + +cpdef DataType decimal32(int precision, int scale=0): + """ + Create decimal type with precision and scale and 32-bit width. + + Arrow decimals are fixed-point decimal numbers encoded as a scaled + integer. The precision is the number of significant digits that the + decimal type can represent; the scale is the number of digits after + the decimal point (note the scale can be negative). + + As an example, ``decimal32(7, 3)`` can exactly represent the numbers + 1234.567 and -1234.567 (encoded internally as the 32-bit integers + 1234567 and -1234567, respectively), but neither 12345.67 nor 123.4567. + + ``decimal32(5, -3)`` can exactly represent the number 12345000 + (encoded internally as the 32-bit integer 12345), but neither + 123450000 nor 1234500. + + If you need a precision higher than 9 significant digits, consider + using ``decimal64``, ``decimal128``, or ``decimal256``. + + Parameters + ---------- + precision : int + Must be between 1 and 9 + scale : int + + Returns + ------- + decimal_type : Decimal32Type + + Examples + -------- + Create an instance of decimal type: + + >>> import pyarrow as pa + >>> pa.decimal32(5, 2) + Decimal32Type(decimal32(5, 2)) + + Create an array with decimal type: + + >>> import decimal + >>> a = decimal.Decimal('123.45') + >>> pa.array([a], pa.decimal32(5, 2)) + + [ + 123.45 + ] + """ + cdef shared_ptr[CDataType] decimal_type + if precision < 1 or precision > 9: + raise ValueError("precision should be between 1 and 9") + decimal_type.reset(new CDecimal32Type(precision, scale)) + return pyarrow_wrap_data_type(decimal_type) + + +cpdef DataType decimal64(int precision, int scale=0): + """ + Create decimal type with precision and scale and 64-bit width. + + Arrow decimals are fixed-point decimal numbers encoded as a scaled + integer. The precision is the number of significant digits that the + decimal type can represent; the scale is the number of digits after + the decimal point (note the scale can be negative). + + As an example, ``decimal64(7, 3)`` can exactly represent the numbers + 1234.567 and -1234.567 (encoded internally as the 64-bit integers + 1234567 and -1234567, respectively), but neither 12345.67 nor 123.4567. + + ``decimal64(5, -3)`` can exactly represent the number 12345000 + (encoded internally as the 64-bit integer 12345), but neither + 123450000 nor 1234500. + + If you need a precision higher than 18 significant digits, consider + using ``decimal128``, or ``decimal256``. + + Parameters + ---------- + precision : int + Must be between 1 and 18 + scale : int + + Returns + ------- + decimal_type : Decimal64Type + + Examples + -------- + Create an instance of decimal type: + + >>> import pyarrow as pa + >>> pa.decimal64(5, 2) + Decimal64Type(decimal64(5, 2)) + + Create an array with decimal type: + + >>> import decimal + >>> a = decimal.Decimal('123.45') + >>> pa.array([a], pa.decimal64(5, 2)) + + [ + 123.45 + ] + """ + cdef shared_ptr[CDataType] decimal_type + if precision < 1 or precision > 18: + raise ValueError("precision should be between 1 and 18") + decimal_type.reset(new CDecimal64Type(precision, scale)) + return pyarrow_wrap_data_type(decimal_type) + + +cpdef DataType decimal128(int precision, int scale=0): + """ + Create decimal type with precision and scale and 128-bit width. + + Arrow decimals are fixed-point decimal numbers encoded as a scaled + integer. The precision is the number of significant digits that the + decimal type can represent; the scale is the number of digits after + the decimal point (note the scale can be negative). + + As an example, ``decimal128(7, 3)`` can exactly represent the numbers + 1234.567 and -1234.567 (encoded internally as the 128-bit integers + 1234567 and -1234567, respectively), but neither 12345.67 nor 123.4567. + + ``decimal128(5, -3)`` can exactly represent the number 12345000 + (encoded internally as the 128-bit integer 12345), but neither + 123450000 nor 1234500. + + If you need a precision higher than 38 significant digits, consider + using ``decimal256``. + + Parameters + ---------- + precision : int + Must be between 1 and 38 + scale : int + + Returns + ------- + decimal_type : Decimal128Type + + Examples + -------- + Create an instance of decimal type: + + >>> import pyarrow as pa + >>> pa.decimal128(5, 2) + Decimal128Type(decimal128(5, 2)) + + Create an array with decimal type: + + >>> import decimal + >>> a = decimal.Decimal('123.45') + >>> pa.array([a], pa.decimal128(5, 2)) + + [ + 123.45 + ] + """ + cdef shared_ptr[CDataType] decimal_type + if precision < 1 or precision > 38: + raise ValueError("precision should be between 1 and 38") + decimal_type.reset(new CDecimal128Type(precision, scale)) + return pyarrow_wrap_data_type(decimal_type) + + +cpdef DataType decimal256(int precision, int scale=0): + """ + Create decimal type with precision and scale and 256-bit width. + + Arrow decimals are fixed-point decimal numbers encoded as a scaled + integer. The precision is the number of significant digits that the + decimal type can represent; the scale is the number of digits after + the decimal point (note the scale can be negative). + + For most use cases, the maximum precision offered by ``decimal128`` + is sufficient, and it will result in a more compact and more efficient + encoding. ``decimal256`` is useful if you need a precision higher + than 38 significant digits. + + Parameters + ---------- + precision : int + Must be between 1 and 76 + scale : int + + Returns + ------- + decimal_type : Decimal256Type + """ + cdef shared_ptr[CDataType] decimal_type + if precision < 1 or precision > 76: + raise ValueError("precision should be between 1 and 76") + decimal_type.reset(new CDecimal256Type(precision, scale)) + return pyarrow_wrap_data_type(decimal_type) + + +def string(): + """ + Create UTF8 variable-length string type. + + Examples + -------- + Create an instance of a string type: + + >>> import pyarrow as pa + >>> pa.string() + DataType(string) + + and use the string type to create an array: + + >>> pa.array(['foo', 'bar', 'baz'], type=pa.string()) + + [ + "foo", + "bar", + "baz" + ] + """ + return primitive_type(_Type_STRING) + + +def utf8(): + """ + Alias for string(). + + Examples + -------- + Create an instance of a string type: + + >>> import pyarrow as pa + >>> pa.utf8() + DataType(string) + + and use the string type to create an array: + + >>> pa.array(['foo', 'bar', 'baz'], type=pa.utf8()) + + [ + "foo", + "bar", + "baz" + ] + """ + return string() + + +def binary(int length=-1): + """ + Create variable-length or fixed size binary type. + + Parameters + ---------- + length : int, optional, default -1 + If length == -1 then return a variable length binary type. If length is + greater than or equal to 0 then return a fixed size binary type of + width `length`. + + Examples + -------- + Create an instance of a variable-length binary type: + + >>> import pyarrow as pa + >>> pa.binary() + DataType(binary) + + and use the variable-length binary type to create an array: + + >>> pa.array(['foo', 'bar', 'baz'], type=pa.binary()) + + [ + 666F6F, + 626172, + 62617A + ] + + Create an instance of a fixed-size binary type: + + >>> pa.binary(3) + FixedSizeBinaryType(fixed_size_binary[3]) + + and use the fixed-length binary type to create an array: + + >>> pa.array(['foo', 'bar', 'baz'], type=pa.binary(3)) + + [ + 666F6F, + 626172, + 62617A + ] + """ + if length == -1: + return primitive_type(_Type_BINARY) + + cdef shared_ptr[CDataType] fixed_size_binary_type + fixed_size_binary_type.reset(new CFixedSizeBinaryType(length)) + return pyarrow_wrap_data_type(fixed_size_binary_type) + + +def large_binary(): + """ + Create large variable-length binary type. + + This data type may not be supported by all Arrow implementations. Unless + you need to represent data larger than 2GB, you should prefer binary(). + + Examples + -------- + Create an instance of large variable-length binary type: + + >>> import pyarrow as pa + >>> pa.large_binary() + DataType(large_binary) + + and use the type to create an array: + + >>> pa.array(['foo', 'bar', 'baz'], type=pa.large_binary()) + + [ + 666F6F, + 626172, + 62617A + ] + """ + return primitive_type(_Type_LARGE_BINARY) + + +def large_string(): + """ + Create large UTF8 variable-length string type. + + This data type may not be supported by all Arrow implementations. Unless + you need to represent data larger than 2GB, you should prefer string(). + + Examples + -------- + Create an instance of large UTF8 variable-length binary type: + + >>> import pyarrow as pa + >>> pa.large_string() + DataType(large_string) + + and use the type to create an array: + + >>> pa.array(['foo', 'bar'] * 50, type=pa.large_string()) + + [ + "foo", + "bar", + ... + "foo", + "bar" + ] + """ + return primitive_type(_Type_LARGE_STRING) + + +def large_utf8(): + """ + Alias for large_string(). + + Examples + -------- + Create an instance of large UTF8 variable-length binary type: + + >>> import pyarrow as pa + >>> pa.large_utf8() + DataType(large_string) + + and use the type to create an array: + + >>> pa.array(['foo', 'bar'] * 50, type=pa.large_utf8()) + + [ + "foo", + "bar", + ... + "foo", + "bar" + ] + """ + return large_string() + + +def binary_view(): + """ + Create a variable-length binary view type. + + Examples + -------- + Create an instance of a string type: + + >>> import pyarrow as pa + >>> pa.binary_view() + DataType(binary_view) + """ + return primitive_type(_Type_BINARY_VIEW) + + +def string_view(): + """ + Create UTF8 variable-length string view type. + + Examples + -------- + Create an instance of a string type: + + >>> import pyarrow as pa + >>> pa.string_view() + DataType(string_view) + """ + return primitive_type(_Type_STRING_VIEW) + + +def list_(value_type, int list_size=-1): + """ + Create ListType instance from child data type or field. + + Parameters + ---------- + value_type : DataType or Field + list_size : int, optional, default -1 + If length == -1 then return a variable length list type. If length is + greater than or equal to 0 then return a fixed size list type. + + Returns + ------- + list_type : DataType + + Examples + -------- + Create an instance of ListType: + + >>> import pyarrow as pa + >>> pa.list_(pa.string()) + ListType(list) + >>> pa.list_(pa.int32(), 2) + FixedSizeListType(fixed_size_list[2]) + + Use the ListType to create a scalar: + + >>> pa.scalar(['foo', None], type=pa.list_(pa.string(), 2)) + + + or an array: + + >>> pa.array([[1, 2], [3, 4]], pa.list_(pa.int32(), 2)) + + [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ] + """ + cdef: + Field _field + shared_ptr[CDataType] list_type + + if isinstance(value_type, DataType): + _field = field('item', value_type) + elif isinstance(value_type, Field): + _field = value_type + else: + raise TypeError('List requires DataType or Field') + + if list_size == -1: + list_type.reset(new CListType(_field.sp_field)) + else: + if list_size < 0: + raise ValueError("list_size should be a positive integer") + list_type.reset(new CFixedSizeListType(_field.sp_field, list_size)) + + return pyarrow_wrap_data_type(list_type) + + +cpdef LargeListType large_list(value_type): + """ + Create LargeListType instance from child data type or field. + + This data type may not be supported by all Arrow implementations. + Unless you need to represent data larger than 2**31 elements, you should + prefer list_(). + + Parameters + ---------- + value_type : DataType or Field + + Returns + ------- + list_type : DataType + + Examples + -------- + Create an instance of LargeListType: + + >>> import pyarrow as pa + >>> pa.large_list(pa.int8()) + LargeListType(large_list) + + Use the LargeListType to create an array: + + >>> pa.array([[-1, 3]] * 5, type=pa.large_list(pa.int8())) + + [ + [ + -1, + 3 + ], + [ + -1, + 3 + ], + ... + """ + cdef: + DataType data_type + Field _field + shared_ptr[CDataType] list_type + LargeListType out = LargeListType.__new__(LargeListType) + + if isinstance(value_type, DataType): + _field = field('item', value_type) + elif isinstance(value_type, Field): + _field = value_type + else: + raise TypeError('List requires DataType or Field') + + list_type.reset(new CLargeListType(_field.sp_field)) + out.init(list_type) + return out + + +cpdef ListViewType list_view(value_type): + """ + Create ListViewType instance from child data type or field. + + This data type may not be supported by all Arrow implementations + because it is an alternative to the ListType. + + Parameters + ---------- + value_type : DataType or Field + + Returns + ------- + list_view_type : DataType + + Examples + -------- + Create an instance of ListViewType: + + >>> import pyarrow as pa + >>> pa.list_view(pa.string()) + ListViewType(list_view) + """ + cdef: + Field _field + shared_ptr[CDataType] list_view_type + + if isinstance(value_type, DataType): + _field = field('item', value_type) + elif isinstance(value_type, Field): + _field = value_type + else: + raise TypeError('ListView requires DataType or Field') + + list_view_type = CMakeListViewType(_field.sp_field) + return pyarrow_wrap_data_type(list_view_type) + + +cpdef LargeListViewType large_list_view(value_type): + """ + Create LargeListViewType instance from child data type or field. + + This data type may not be supported by all Arrow implementations + because it is an alternative to the ListType. + + Parameters + ---------- + value_type : DataType or Field + + Returns + ------- + list_view_type : DataType + + Examples + -------- + Create an instance of LargeListViewType: + + >>> import pyarrow as pa + >>> pa.large_list_view(pa.int8()) + LargeListViewType(large_list_view) + """ + cdef: + Field _field + shared_ptr[CDataType] list_view_type + + if isinstance(value_type, DataType): + _field = field('item', value_type) + elif isinstance(value_type, Field): + _field = value_type + else: + raise TypeError('LargeListView requires DataType or Field') + + list_view_type = CMakeLargeListViewType(_field.sp_field) + return pyarrow_wrap_data_type(list_view_type) + + +cpdef MapType map_(key_type, item_type, keys_sorted=False): + """ + Create MapType instance from key and item data types or fields. + + Parameters + ---------- + key_type : DataType or Field + item_type : DataType or Field + keys_sorted : bool + + Returns + ------- + map_type : DataType + + Examples + -------- + Create an instance of MapType: + + >>> import pyarrow as pa + >>> pa.map_(pa.string(), pa.int32()) + MapType(map) + >>> pa.map_(pa.string(), pa.int32(), keys_sorted=True) + MapType(map) + + Use MapType to create an array: + + >>> data = [[{'key': 'a', 'value': 1}, {'key': 'b', 'value': 2}], [{'key': 'c', 'value': 3}]] + >>> pa.array(data, type=pa.map_(pa.string(), pa.int32(), keys_sorted=True)) + + [ + keys: + [ + "a", + "b" + ] + values: + [ + 1, + 2 + ], + keys: + [ + "c" + ] + values: + [ + 3 + ] + ] + """ + cdef: + Field _key_field + Field _item_field + shared_ptr[CDataType] map_type + MapType out = MapType.__new__(MapType) + + if isinstance(key_type, Field): + if key_type.nullable: + raise TypeError('Map key field should be non-nullable') + _key_field = key_type + else: + _key_field = field('key', ensure_type(key_type, allow_none=False), + nullable=False) + + if isinstance(item_type, Field): + _item_field = item_type + else: + _item_field = field('value', ensure_type(item_type, allow_none=False)) + + map_type.reset(new CMapType(_key_field.sp_field, _item_field.sp_field, + keys_sorted)) + out.init(map_type) + return out + + +cpdef DictionaryType dictionary(index_type, value_type, bint ordered=False): + """ + Dictionary (categorical, or simply encoded) type. + + Parameters + ---------- + index_type : DataType + value_type : DataType + ordered : bool + + Returns + ------- + type : DictionaryType + + Examples + -------- + Create an instance of dictionary type: + + >>> import pyarrow as pa + >>> pa.dictionary(pa.int64(), pa.utf8()) + DictionaryType(dictionary) + + Use dictionary type to create an array: + + >>> pa.array(["a", "b", None, "d"], pa.dictionary(pa.int64(), pa.utf8())) + + ... + -- dictionary: + [ + "a", + "b", + "d" + ] + -- indices: + [ + 0, + 1, + null, + 2 + ] + """ + cdef: + DataType _index_type = ensure_type(index_type, allow_none=False) + DataType _value_type = ensure_type(value_type, allow_none=False) + DictionaryType out = DictionaryType.__new__(DictionaryType) + shared_ptr[CDataType] dict_type + + if _index_type.id not in { + Type_INT8, Type_INT16, Type_INT32, Type_INT64, + Type_UINT8, Type_UINT16, Type_UINT32, Type_UINT64, + }: + raise TypeError("The dictionary index type should be integer.") + + dict_type.reset(new CDictionaryType(_index_type.sp_type, + _value_type.sp_type, ordered == 1)) + out.init(dict_type) + return out + + +def struct(fields): + """ + Create StructType instance from fields. + + A struct is a nested type parameterized by an ordered sequence of types + (which can all be distinct), called its fields. + + Parameters + ---------- + fields : iterable of Fields or tuples, or mapping of strings to DataTypes + Each field must have a UTF8-encoded name, and these field names are + part of the type metadata. + + Examples + -------- + Create an instance of StructType from an iterable of tuples: + + >>> import pyarrow as pa + >>> fields = [ + ... ('f1', pa.int32()), + ... ('f2', pa.string()), + ... ] + >>> struct_type = pa.struct(fields) + >>> struct_type + StructType(struct) + + Retrieve a field from a StructType: + + >>> struct_type[0] + pyarrow.Field + >>> struct_type['f1'] + pyarrow.Field + + Create an instance of StructType from an iterable of Fields: + + >>> fields = [ + ... pa.field('f1', pa.int32()), + ... pa.field('f2', pa.string(), nullable=False), + ... ] + >>> pa.struct(fields) + StructType(struct) + + Returns + ------- + type : DataType + """ + cdef: + Field py_field + vector[shared_ptr[CField]] c_fields + cdef shared_ptr[CDataType] struct_type + + if isinstance(fields, Mapping): + fields = fields.items() + + for item in fields: + if isinstance(item, tuple): + py_field = field(*item) + else: + py_field = item + c_fields.push_back(py_field.sp_field) + + struct_type.reset(new CStructType(c_fields)) + return pyarrow_wrap_data_type(struct_type) + + +cdef _extract_union_params(child_fields, type_codes, + vector[shared_ptr[CField]]* c_fields, + vector[int8_t]* c_type_codes): + cdef: + Field child_field + + for child_field in child_fields: + c_fields[0].push_back(child_field.sp_field) + + if type_codes is not None: + if len(type_codes) != (c_fields.size()): + raise ValueError("type_codes should have the same length " + "as fields") + for code in type_codes: + c_type_codes[0].push_back(code) + else: + c_type_codes[0] = range(c_fields.size()) + + +def sparse_union(child_fields, type_codes=None): + """ + Create SparseUnionType from child fields. + + A sparse union is a nested type where each logical value is taken from + a single child. A buffer of 8-bit type ids indicates which child + a given logical value is to be taken from. + + In a sparse union, each child array should have the same length as the + union array, regardless of the actual number of union values that + refer to it. + + Parameters + ---------- + child_fields : sequence of Field values + Each field must have a UTF8-encoded name, and these field names are + part of the type metadata. + type_codes : list of integers, default None + + Returns + ------- + type : SparseUnionType + """ + cdef: + vector[shared_ptr[CField]] c_fields + vector[int8_t] c_type_codes + + _extract_union_params(child_fields, type_codes, + &c_fields, &c_type_codes) + + return pyarrow_wrap_data_type( + CMakeSparseUnionType(move(c_fields), move(c_type_codes))) + + +def dense_union(child_fields, type_codes=None): + """ + Create DenseUnionType from child fields. + + A dense union is a nested type where each logical value is taken from + a single child, at a specific offset. A buffer of 8-bit type ids + indicates which child a given logical value is to be taken from, + and a buffer of 32-bit offsets indicates at which physical position + in the given child array the logical value is to be taken from. + + Unlike a sparse union, a dense union allows encoding only the child array + values which are actually referred to by the union array. This is + counterbalanced by the additional footprint of the offsets buffer, and + the additional indirection cost when looking up values. + + Parameters + ---------- + child_fields : sequence of Field values + Each field must have a UTF8-encoded name, and these field names are + part of the type metadata. + type_codes : list of integers, default None + + Returns + ------- + type : DenseUnionType + """ + cdef: + vector[shared_ptr[CField]] c_fields + vector[int8_t] c_type_codes + + _extract_union_params(child_fields, type_codes, + &c_fields, &c_type_codes) + + return pyarrow_wrap_data_type( + CMakeDenseUnionType(move(c_fields), move(c_type_codes))) + + +def union(child_fields, mode, type_codes=None): + """ + Create UnionType from child fields. + + A union is a nested type where each logical value is taken from a + single child. A buffer of 8-bit type ids indicates which child + a given logical value is to be taken from. + + Unions come in two flavors: sparse and dense + (see also `pyarrow.sparse_union` and `pyarrow.dense_union`). + + Parameters + ---------- + child_fields : sequence of Field values + Each field must have a UTF8-encoded name, and these field names are + part of the type metadata. + mode : str + Must be 'sparse' or 'dense' + type_codes : list of integers, default None + + Returns + ------- + type : UnionType + """ + if isinstance(mode, int): + if mode not in (_UnionMode_SPARSE, _UnionMode_DENSE): + raise ValueError(f"Invalid union mode {mode!r}") + else: + if mode == 'sparse': + mode = _UnionMode_SPARSE + elif mode == 'dense': + mode = _UnionMode_DENSE + else: + raise ValueError(f"Invalid union mode {mode!r}") + + if mode == _UnionMode_SPARSE: + return sparse_union(child_fields, type_codes) + else: + return dense_union(child_fields, type_codes) + + +def run_end_encoded(run_end_type, value_type): + """ + Create RunEndEncodedType from run-end and value types. + + Parameters + ---------- + run_end_type : pyarrow.DataType + The integer type of the run_ends array. Must be 'int16', 'int32', or 'int64'. + value_type : pyarrow.DataType + The type of the values array. + + Returns + ------- + type : RunEndEncodedType + """ + cdef: + DataType _run_end_type = ensure_type(run_end_type, allow_none=False) + DataType _value_type = ensure_type(value_type, allow_none=False) + shared_ptr[CDataType] ree_type + + if not _run_end_type.type.id() in [_Type_INT16, _Type_INT32, _Type_INT64]: + raise ValueError("The run_end_type should be 'int16', 'int32', or 'int64'") + ree_type = CMakeRunEndEncodedType(_run_end_type.sp_type, _value_type.sp_type) + return pyarrow_wrap_data_type(ree_type) + + +def json_(DataType storage_type=utf8()): + """ + Create instance of JSON extension type. + + Parameters + ---------- + storage_type : DataType, default pyarrow.string() + The underlying data type. Can be on of the following types: + string, large_string, string_view. + + Returns + ------- + type : JsonType + + Examples + -------- + Create an instance of JSON extension type: + + >>> import pyarrow as pa + >>> pa.json_(pa.utf8()) + JsonType(extension) + + Use the JSON type to create an array: + + >>> pa.array(['{"a": 1}', '{"b": 2}'], type=pa.json_(pa.utf8())) + + [ + "{"a": 1}", + "{"b": 2}" + ] + """ + + cdef JsonType out = JsonType.__new__(JsonType) + c_json_ext_type = GetResultValue(CJsonType.Make(storage_type.sp_type)) + out.init(c_json_ext_type) + return out + + +def uuid(): + """ + Create UuidType instance. + + Returns + ------- + type : UuidType + """ + + cdef UuidType out = UuidType.__new__(UuidType) + c_uuid_ext_type = GetResultValue(CUuidType.Make()) + out.init(c_uuid_ext_type) + return out + + +def fixed_shape_tensor(DataType value_type, shape, dim_names=None, permutation=None): + """ + Create instance of fixed shape tensor extension type with shape and optional + names of tensor dimensions and indices of the desired logical + ordering of dimensions. + + Parameters + ---------- + value_type : DataType + Data type of individual tensor elements. + shape : tuple or list of integers + The physical shape of the contained tensors. + dim_names : tuple or list of strings, default None + Explicit names to tensor dimensions. + permutation : tuple or list integers, default None + Indices of the desired ordering of the original dimensions. + The indices contain a permutation of the values ``[0, 1, .., N-1]`` where + N is the number of dimensions. The permutation indicates which dimension + of the logical layout corresponds to which dimension of the physical tensor. + For more information on this parameter see + :ref:`fixed_shape_tensor_extension`. + + Examples + -------- + Create an instance of fixed shape tensor extension type: + + >>> import pyarrow as pa + >>> tensor_type = pa.fixed_shape_tensor(pa.int32(), [2, 2]) + >>> tensor_type + FixedShapeTensorType(extension) + + Inspect the data type: + + >>> tensor_type.value_type + DataType(int32) + >>> tensor_type.shape + [2, 2] + + Create a table with fixed shape tensor extension array: + + >>> arr = [[1, 2, 3, 4], [10, 20, 30, 40], [100, 200, 300, 400]] + >>> storage = pa.array(arr, pa.list_(pa.int32(), 4)) + >>> tensor = pa.ExtensionArray.from_storage(tensor_type, storage) + >>> pa.table([tensor], names=["tensor_array"]) + pyarrow.Table + tensor_array: extension + ---- + tensor_array: [[[1,2,3,4],[10,20,30,40],[100,200,300,400]]] + + Create an instance of fixed shape tensor extension type with names + of tensor dimensions: + + >>> tensor_type = pa.fixed_shape_tensor(pa.int8(), (2, 2, 3), + ... dim_names=['C', 'H', 'W']) + >>> tensor_type.dim_names + ['C', 'H', 'W'] + + Create an instance of fixed shape tensor extension type with + permutation: + + >>> tensor_type = pa.fixed_shape_tensor(pa.int8(), (2, 2, 3), + ... permutation=[0, 2, 1]) + >>> tensor_type.permutation + [0, 2, 1] + + Returns + ------- + type : FixedShapeTensorType + """ + + cdef: + vector[int64_t] c_shape + vector[int64_t] c_permutation + vector[c_string] c_dim_names + shared_ptr[CDataType] c_tensor_ext_type + + assert value_type is not None + assert shape is not None + + for i in shape: + c_shape.push_back(i) + + if permutation is not None: + for i in permutation: + c_permutation.push_back(i) + + if dim_names is not None: + for x in dim_names: + c_dim_names.push_back(tobytes(x)) + + cdef FixedShapeTensorType out = FixedShapeTensorType.__new__(FixedShapeTensorType) + + with nogil: + c_tensor_ext_type = GetResultValue(CFixedShapeTensorType.Make( + value_type.sp_type, c_shape, c_permutation, c_dim_names)) + + out.init(c_tensor_ext_type) + + return out + + +def bool8(): + """ + Create instance of bool8 extension type. + + Examples + -------- + Create an instance of bool8 extension type: + + >>> import pyarrow as pa + >>> type = pa.bool8() + >>> type + Bool8Type(extension) + + Inspect the data type: + + >>> type.storage_type + DataType(int8) + + Create a table with a bool8 array: + + >>> arr = [-1, 0, 1, 2, None] + >>> storage = pa.array(arr, pa.int8()) + >>> other = pa.ExtensionArray.from_storage(type, storage) + >>> pa.table([other], names=["unknown_col"]) + pyarrow.Table + unknown_col: extension + ---- + unknown_col: [[-1,0,1,2,null]] + + Returns + ------- + type : Bool8Type + """ + + cdef Bool8Type out = Bool8Type.__new__(Bool8Type) + + c_type = GetResultValue(CBool8Type.Make()) + + out.init(c_type) + + return out + + +def opaque(DataType storage_type, str type_name not None, str vendor_name not None): + """ + Create instance of opaque extension type. + + Parameters + ---------- + storage_type : DataType + The underlying data type. + type_name : str + The name of the type in the external system. + vendor_name : str + The name of the external system. + + Examples + -------- + Create an instance of an opaque extension type: + + >>> import pyarrow as pa + >>> type = pa.opaque(pa.binary(), "other", "jdbc") + >>> type + OpaqueType(extension) + + Inspect the data type: + + >>> type.storage_type + DataType(binary) + >>> type.type_name + 'other' + >>> type.vendor_name + 'jdbc' + + Create a table with an opaque array: + + >>> arr = [None, b"foobar"] + >>> storage = pa.array(arr, pa.binary()) + >>> other = pa.ExtensionArray.from_storage(type, storage) + >>> pa.table([other], names=["unknown_col"]) + pyarrow.Table + unknown_col: extension + ---- + unknown_col: [[null,666F6F626172]] + + Returns + ------- + type : OpaqueType + """ + + cdef: + c_string c_type_name = tobytes(type_name) + c_string c_vendor_name = tobytes(vendor_name) + shared_ptr[COpaqueType] c_opaque_type = make_shared[COpaqueType]( + storage_type.sp_type, c_type_name, c_vendor_name) + shared_ptr[CDataType] c_type = static_pointer_cast[CDataType, COpaqueType](c_opaque_type) + OpaqueType out = OpaqueType.__new__(OpaqueType) + out.init(c_type) + return out + + +cdef dict _type_aliases = { + 'null': null, + 'bool': bool_, + 'boolean': bool_, + 'i1': int8, + 'int8': int8, + 'i2': int16, + 'int16': int16, + 'i4': int32, + 'int32': int32, + 'i8': int64, + 'int64': int64, + 'u1': uint8, + 'uint8': uint8, + 'u2': uint16, + 'uint16': uint16, + 'u4': uint32, + 'uint32': uint32, + 'u8': uint64, + 'uint64': uint64, + 'f2': float16, + 'halffloat': float16, + 'float16': float16, + 'f4': float32, + 'float': float32, + 'float32': float32, + 'f8': float64, + 'double': float64, + 'float64': float64, + 'string': string, + 'str': string, + 'utf8': string, + 'binary': binary, + 'large_string': large_string, + 'large_str': large_string, + 'large_utf8': large_string, + 'large_binary': large_binary, + 'binary_view': binary_view, + 'string_view': string_view, + 'date32': date32, + 'date64': date64, + 'date32[day]': date32, + 'date64[ms]': date64, + 'time32[s]': time32('s'), + 'time32[ms]': time32('ms'), + 'time64[us]': time64('us'), + 'time64[ns]': time64('ns'), + 'timestamp[s]': timestamp('s'), + 'timestamp[ms]': timestamp('ms'), + 'timestamp[us]': timestamp('us'), + 'timestamp[ns]': timestamp('ns'), + 'duration[s]': duration('s'), + 'duration[ms]': duration('ms'), + 'duration[us]': duration('us'), + 'duration[ns]': duration('ns'), + 'month_day_nano_interval': month_day_nano_interval(), +} + + +def type_for_alias(name): + """ + Return DataType given a string alias if one exists. + + Parameters + ---------- + name : str + The alias of the DataType that should be retrieved. + + Returns + ------- + type : DataType + """ + name = name.lower() + try: + alias = _type_aliases[name] + except KeyError: + raise ValueError(f'No type alias for {name}') + + if isinstance(alias, DataType): + return alias + return alias() + + +cpdef DataType ensure_type(object ty, bint allow_none=False): + if allow_none and ty is None: + return None + elif isinstance(ty, DataType): + return ty + elif isinstance(ty, str): + return type_for_alias(ty) + else: + raise TypeError(f'DataType expected, got {type(ty)!r}') + + +def schema(fields, metadata=None): + """ + Construct pyarrow.Schema from collection of fields. + + Parameters + ---------- + fields : iterable of Fields or tuples, or mapping of strings to DataTypes + Can also pass an object that implements the Arrow PyCapsule Protocol + for schemas (has an ``__arrow_c_schema__`` method). + metadata : dict, default None + Keys and values must be coercible to bytes. + + Examples + -------- + Create a Schema from iterable of tuples: + + >>> import pyarrow as pa + >>> pa.schema([ + ... ('some_int', pa.int32()), + ... ('some_string', pa.string()), + ... pa.field('some_required_string', pa.string(), nullable=False) + ... ]) + some_int: int32 + some_string: string + some_required_string: string not null + + Create a Schema from iterable of Fields: + + >>> pa.schema([ + ... pa.field('some_int', pa.int32()), + ... pa.field('some_string', pa.string()) + ... ]) + some_int: int32 + some_string: string + + DataTypes can also be passed as strings. The following is equivalent to the + above example: + + >>> pa.schema([ + ... pa.field('some_int', "int32"), + ... pa.field('some_string', "string") + ... ]) + some_int: int32 + some_string: string + + Or more concisely: + + >>> pa.schema([ + ... ('some_int', "int32"), + ... ('some_string', "string") + ... ]) + some_int: int32 + some_string: string + + Returns + ------- + schema : pyarrow.Schema + """ + cdef: + shared_ptr[const CKeyValueMetadata] c_meta + shared_ptr[CSchema] c_schema + Schema result + Field py_field + vector[shared_ptr[CField]] c_fields + + if hasattr(fields, "__arrow_c_schema__"): + result = Schema._import_from_c_capsule(fields.__arrow_c_schema__()) + if metadata is not None: + result = result.with_metadata(metadata) + return result + + if isinstance(fields, Mapping): + fields = fields.items() + + for item in fields: + if isinstance(item, tuple): + py_field = field(*item) + else: + py_field = item + if py_field is None: + raise TypeError("field or tuple expected, got None") + c_fields.push_back(py_field.sp_field) + + metadata = ensure_metadata(metadata, allow_none=True) + c_meta = pyarrow_unwrap_metadata(metadata) + + c_schema.reset(new CSchema(c_fields, c_meta)) + result = Schema.__new__(Schema) + result.init_schema(c_schema) + + return result + + +def from_numpy_dtype(object dtype): + """ + Convert NumPy dtype to pyarrow.DataType. + + Parameters + ---------- + dtype : the numpy dtype to convert + + + Examples + -------- + Create a pyarrow DataType from NumPy dtype: + + >>> import pyarrow as pa + >>> import numpy as np + >>> pa.from_numpy_dtype(np.dtype('float16')) + DataType(halffloat) + >>> pa.from_numpy_dtype('U') + DataType(string) + >>> pa.from_numpy_dtype(bool) + DataType(bool) + >>> pa.from_numpy_dtype(np.str_) + DataType(string) + """ + dtype = np.dtype(dtype) + return pyarrow_wrap_data_type(GetResultValue(NumPyDtypeToArrow(dtype))) + + +def is_boolean_value(object obj): + """ + Check if the object is a boolean. + + Parameters + ---------- + obj : object + The object to check + """ + return IsPyBool(obj) + + +def is_integer_value(object obj): + """ + Check if the object is an integer. + + Parameters + ---------- + obj : object + The object to check + """ + return IsPyInt(obj) + + +def is_float_value(object obj): + """ + Check if the object is a float. + + Parameters + ---------- + obj : object + The object to check + """ + return IsPyFloat(obj) + + +cdef class _ExtensionRegistryNanny(_Weakrefable): + # Keep the registry alive until we have unregistered PyExtensionType + cdef: + shared_ptr[CExtensionTypeRegistry] registry + + def __cinit__(self): + self.registry = CExtensionTypeRegistry.GetGlobalRegistry() + + def release_registry(self): + self.registry.reset() + + +_registry_nanny = _ExtensionRegistryNanny() + + +# +# PyCapsule export utilities +# + +cdef void pycapsule_schema_deleter(object schema_capsule) noexcept: + cdef ArrowSchema* schema = PyCapsule_GetPointer( + schema_capsule, 'arrow_schema' + ) + if schema.release != NULL: + schema.release(schema) + + free(schema) + +cdef object alloc_c_schema(ArrowSchema** c_schema): + c_schema[0] = malloc(sizeof(ArrowSchema)) + # Ensure the capsule destructor doesn't call a random release pointer + c_schema[0].release = NULL + return PyCapsule_New(c_schema[0], 'arrow_schema', &pycapsule_schema_deleter) + + +cdef void pycapsule_array_deleter(object array_capsule) noexcept: + cdef: + ArrowArray* array + # Do not invoke the deleter on a used/moved capsule + array = cpython.PyCapsule_GetPointer( + array_capsule, 'arrow_array' + ) + if array.release != NULL: + array.release(array) + + free(array) + +cdef object alloc_c_array(ArrowArray** c_array): + c_array[0] = malloc(sizeof(ArrowArray)) + # Ensure the capsule destructor doesn't call a random release pointer + c_array[0].release = NULL + return PyCapsule_New(c_array[0], 'arrow_array', &pycapsule_array_deleter) + + +cdef void pycapsule_stream_deleter(object stream_capsule) noexcept: + cdef: + ArrowArrayStream* stream + # Do not invoke the deleter on a used/moved capsule + stream = PyCapsule_GetPointer( + stream_capsule, 'arrow_array_stream' + ) + if stream.release != NULL: + stream.release(stream) + + free(stream) + +cdef object alloc_c_stream(ArrowArrayStream** c_stream): + c_stream[0] = malloc(sizeof(ArrowArrayStream)) + # Ensure the capsule destructor doesn't call a random release pointer + c_stream[0].release = NULL + return PyCapsule_New(c_stream[0], 'arrow_array_stream', &pycapsule_stream_deleter) + + +cdef void pycapsule_device_array_deleter(object array_capsule) noexcept: + cdef: + ArrowDeviceArray* device_array + # Do not invoke the deleter on a used/moved capsule + device_array = cpython.PyCapsule_GetPointer( + array_capsule, 'arrow_device_array' + ) + if device_array.array.release != NULL: + device_array.array.release(&device_array.array) + + free(device_array) + + +cdef object alloc_c_device_array(ArrowDeviceArray** c_array): + c_array[0] = malloc(sizeof(ArrowDeviceArray)) + # Ensure the capsule destructor doesn't call a random release pointer + c_array[0].array.release = NULL + return PyCapsule_New( + c_array[0], 'arrow_device_array', &pycapsule_device_array_deleter) diff --git a/shared/package-files/33/33604784129b509f04d81d901317d57fc35b00ae1916126d98a45e9416590e1e/blob b/shared/package-files/33/33604784129b509f04d81d901317d57fc35b00ae1916126d98a45e9416590e1e/blob new file mode 100644 index 0000000000000000000000000000000000000000..7f5a53f917a4c349a8bd12c0b38455e11b4dc638 --- /dev/null +++ b/shared/package-files/33/33604784129b509f04d81d901317d57fc35b00ae1916126d98a45e9416590e1e/blob @@ -0,0 +1,414 @@ +from enum import Enum +import importlib + + +class BackendFilter(Enum): + """ + Filter used with :meth:`~matplotlib.backends.registry.BackendRegistry.list_builtin` + + .. versionadded:: 3.9 + """ + INTERACTIVE = 0 + NON_INTERACTIVE = 1 + + +class BackendRegistry: + """ + Registry of backends available within Matplotlib. + + This is the single source of truth for available backends. + + All use of ``BackendRegistry`` should be via the singleton instance + ``backend_registry`` which can be imported from ``matplotlib.backends``. + + Each backend has a name, a module name containing the backend code, and an + optional GUI framework that must be running if the backend is interactive. + There are three sources of backends: built-in (source code is within the + Matplotlib repository), explicit ``module://some.backend`` syntax (backend is + obtained by loading the module), or via an entry point (self-registering + backend in an external package). + + .. versionadded:: 3.9 + """ + # Mapping of built-in backend name to GUI framework, or "headless" for no + # GUI framework. Built-in backends are those which are included in the + # Matplotlib repo. A backend with name 'name' is located in the module + # f"matplotlib.backends.backend_{name.lower()}" + _BUILTIN_BACKEND_TO_GUI_FRAMEWORK = { + "gtk3agg": "gtk3", + "gtk3cairo": "gtk3", + "gtk4agg": "gtk4", + "gtk4cairo": "gtk4", + "macosx": "macosx", + "nbagg": "nbagg", + "notebook": "nbagg", + "qtagg": "qt", + "qtcairo": "qt", + "qt5agg": "qt5", + "qt5cairo": "qt5", + "tkagg": "tk", + "tkcairo": "tk", + "webagg": "webagg", + "wx": "wx", + "wxagg": "wx", + "wxcairo": "wx", + "agg": "headless", + "cairo": "headless", + "pdf": "headless", + "pgf": "headless", + "ps": "headless", + "svg": "headless", + "template": "headless", + } + + # Reverse mapping of gui framework to preferred built-in backend. + _GUI_FRAMEWORK_TO_BACKEND = { + "gtk3": "gtk3agg", + "gtk4": "gtk4agg", + "headless": "agg", + "macosx": "macosx", + "qt": "qtagg", + "qt5": "qt5agg", + "qt6": "qtagg", + "tk": "tkagg", + "wx": "wxagg", + } + + def __init__(self): + # Only load entry points when first needed. + self._loaded_entry_points = False + + # Mapping of non-built-in backend to GUI framework, added dynamically from + # entry points and from matplotlib.use("module://some.backend") format. + # New entries have an "unknown" GUI framework that is determined when first + # needed by calling _get_gui_framework_by_loading. + self._backend_to_gui_framework = {} + + # Mapping of backend name to module name, where different from + # f"matplotlib.backends.backend_{backend_name.lower()}". These are either + # hardcoded for backward compatibility, or loaded from entry points or + # "module://some.backend" syntax. + self._name_to_module = { + "notebook": "nbagg", + } + + def _backend_module_name(self, backend): + if backend.startswith("module://"): + return backend[9:] + + # Return name of module containing the specified backend. + # Does not check if the backend is valid, use is_valid_backend for that. + backend = backend.lower() + + # Check if have specific name to module mapping. + backend = self._name_to_module.get(backend, backend) + + return (backend[9:] if backend.startswith("module://") + else f"matplotlib.backends.backend_{backend}") + + def _clear(self): + # Clear all dynamically-added data, used for testing only. + self.__init__() + + def _ensure_entry_points_loaded(self): + # Load entry points, if they have not already been loaded. + if not self._loaded_entry_points: + entries = self._read_entry_points() + self._validate_and_store_entry_points(entries) + self._loaded_entry_points = True + + def _get_gui_framework_by_loading(self, backend): + # Determine GUI framework for a backend by loading its module and reading the + # FigureCanvas.required_interactive_framework attribute. + # Returns "headless" if there is no GUI framework. + module = self.load_backend_module(backend) + canvas_class = module.FigureCanvas + return canvas_class.required_interactive_framework or "headless" + + def _read_entry_points(self): + # Read entry points of modules that self-advertise as Matplotlib backends. + # Expects entry points like this one from matplotlib-inline (in pyproject.toml + # format): + # [project.entry-points."matplotlib.backend"] + # inline = "matplotlib_inline.backend_inline" + import importlib.metadata as im + + entry_points = im.entry_points(group="matplotlib.backend") + entries = [(entry.name, entry.value) for entry in entry_points] + + # For backward compatibility, if matplotlib-inline and/or ipympl are installed + # but too old to include entry points, create them. Do not import ipympl + # directly as this calls matplotlib.use() whilst in this function. + def backward_compatible_entry_points( + entries, module_name, threshold_version, names, target): + from matplotlib import _parse_to_version_info + try: + module_version = im.version(module_name) + if _parse_to_version_info(module_version) < threshold_version: + for name in names: + entries.append((name, target)) + except im.PackageNotFoundError: + pass + + names = [entry[0] for entry in entries] + if "inline" not in names: + backward_compatible_entry_points( + entries, "matplotlib_inline", (0, 1, 7), ["inline"], + "matplotlib_inline.backend_inline") + if "ipympl" not in names: + backward_compatible_entry_points( + entries, "ipympl", (0, 9, 4), ["ipympl", "widget"], + "ipympl.backend_nbagg") + + return entries + + def _validate_and_store_entry_points(self, entries): + # Validate and store entry points so that they can be used via matplotlib.use() + # in the normal manner. Entry point names cannot be of module:// format, cannot + # shadow a built-in backend name, and there cannot be multiple entry points + # with the same name but different modules. Multiple entry points with the same + # name and value are permitted (it can sometimes happen outside of our control, + # see https://github.com/matplotlib/matplotlib/issues/28367). + for name, module in set(entries): + name = name.lower() + if name.startswith("module://"): + raise RuntimeError( + f"Entry point name '{name}' cannot start with 'module://'") + if name in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK: + raise RuntimeError(f"Entry point name '{name}' is a built-in backend") + if name in self._backend_to_gui_framework: + raise RuntimeError(f"Entry point name '{name}' duplicated") + + self._name_to_module[name] = "module://" + module + # Do not yet know backend GUI framework, determine it only when necessary. + self._backend_to_gui_framework[name] = "unknown" + + def backend_for_gui_framework(self, framework): + """ + Return the name of the backend corresponding to the specified GUI framework. + + Parameters + ---------- + framework : str + GUI framework such as "qt". + + Returns + ------- + str or None + Backend name or None if GUI framework not recognised. + """ + return self._GUI_FRAMEWORK_TO_BACKEND.get(framework.lower()) + + def is_valid_backend(self, backend): + """ + Return True if the backend name is valid, False otherwise. + + A backend name is valid if it is one of the built-in backends or has been + dynamically added via an entry point. Those beginning with ``module://`` are + always considered valid and are added to the current list of all backends + within this function. + + Even if a name is valid, it may not be importable or usable. This can only be + determined by loading and using the backend module. + + Parameters + ---------- + backend : str + Name of backend. + + Returns + ------- + bool + True if backend is valid, False otherwise. + """ + if not backend.startswith("module://"): + backend = backend.lower() + + # For backward compatibility, convert ipympl and matplotlib-inline long + # module:// names to their shortened forms. + backwards_compat = { + "module://ipympl.backend_nbagg": "widget", + "module://matplotlib_inline.backend_inline": "inline", + } + backend = backwards_compat.get(backend, backend) + + if (backend in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK or + backend in self._backend_to_gui_framework): + return True + + if backend.startswith("module://"): + self._backend_to_gui_framework[backend] = "unknown" + return True + + # Only load entry points if really need to and not already done so. + self._ensure_entry_points_loaded() + if backend in self._backend_to_gui_framework: + return True + + return False + + def list_all(self): + """ + Return list of all known backends. + + These include built-in backends and those obtained at runtime either from entry + points or explicit ``module://some.backend`` syntax. + + Entry points will be loaded if they haven't been already. + + Returns + ------- + list of str + Backend names. + """ + self._ensure_entry_points_loaded() + return [*self.list_builtin(), *self._backend_to_gui_framework] + + def list_builtin(self, filter_=None): + """ + Return list of backends that are built into Matplotlib. + + Parameters + ---------- + filter_ : `~.BackendFilter`, optional + Filter to apply to returned backends. For example, to return only + non-interactive backends use `.BackendFilter.NON_INTERACTIVE`. + + Returns + ------- + list of str + Backend names. + """ + if filter_ == BackendFilter.INTERACTIVE: + return [k for k, v in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.items() + if v != "headless"] + elif filter_ == BackendFilter.NON_INTERACTIVE: + return [k for k, v in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.items() + if v == "headless"] + + return [*self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK] + + def list_gui_frameworks(self): + """ + Return list of GUI frameworks used by Matplotlib backends. + + Returns + ------- + list of str + GUI framework names. + """ + return [k for k in self._GUI_FRAMEWORK_TO_BACKEND if k != "headless"] + + def load_backend_module(self, backend): + """ + Load and return the module containing the specified backend. + + Parameters + ---------- + backend : str + Name of backend to load. + + Returns + ------- + Module + Module containing backend. + """ + module_name = self._backend_module_name(backend) + return importlib.import_module(module_name) + + def resolve_backend(self, backend): + """ + Return the backend and GUI framework for the specified backend name. + + If the GUI framework is not yet known then it will be determined by loading the + backend module and checking the ``FigureCanvas.required_interactive_framework`` + attribute. + + This function only loads entry points if they have not already been loaded and + the backend is not built-in and not of ``module://some.backend`` format. + + Parameters + ---------- + backend : str or None + Name of backend, or None to use the default backend. + + Returns + ------- + backend : str + The backend name. + framework : str or None + The GUI framework, which will be None for a backend that is non-interactive. + """ + if isinstance(backend, str): + if not backend.startswith("module://"): + backend = backend.lower() + else: # Might be _auto_backend_sentinel or None + # Use whatever is already running... + from matplotlib import get_backend + backend = get_backend() + + # Is backend already known (built-in or dynamically loaded)? + gui = (self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.get(backend) or + self._backend_to_gui_framework.get(backend)) + + # Is backend "module://something"? + if gui is None and isinstance(backend, str) and backend.startswith("module://"): + gui = "unknown" + + # Is backend a possible entry point? + if gui is None and not self._loaded_entry_points: + self._ensure_entry_points_loaded() + gui = self._backend_to_gui_framework.get(backend) + + # Backend known but not its gui framework. + if gui == "unknown": + gui = self._get_gui_framework_by_loading(backend) + self._backend_to_gui_framework[backend] = gui + + if gui is None: + raise RuntimeError(f"'{backend}' is not a recognised backend name") + + return backend, gui if gui != "headless" else None + + def resolve_gui_or_backend(self, gui_or_backend): + """ + Return the backend and GUI framework for the specified string that may be + either a GUI framework or a backend name, tested in that order. + + This is for use with the IPython %matplotlib magic command which may be a GUI + framework such as ``%matplotlib qt`` or a backend name such as + ``%matplotlib qtagg``. + + This function only loads entry points if they have not already been loaded and + the backend is not built-in and not of ``module://some.backend`` format. + + Parameters + ---------- + gui_or_backend : str or None + Name of GUI framework or backend, or None to use the default backend. + + Returns + ------- + backend : str + The backend name. + framework : str or None + The GUI framework, which will be None for a backend that is non-interactive. + """ + if not gui_or_backend.startswith("module://"): + gui_or_backend = gui_or_backend.lower() + + # First check if it is a gui loop name. + backend = self.backend_for_gui_framework(gui_or_backend) + if backend is not None: + return backend, gui_or_backend if gui_or_backend != "headless" else None + + # Then check if it is a backend name. + try: + return self.resolve_backend(gui_or_backend) + except Exception: # KeyError ? + raise RuntimeError( + f"'{gui_or_backend}' is not a recognised GUI loop or backend name") + + +# Singleton +backend_registry = BackendRegistry() diff --git a/shared/package-files/33/33608e94a85d3ddb541c831a396b65188564e4d1b36a0d4e1047172f4bed4e8e/blob b/shared/package-files/33/33608e94a85d3ddb541c831a396b65188564e4d1b36a0d4e1047172f4bed4e8e/blob new file mode 100644 index 0000000000000000000000000000000000000000..82af5aad02de38e3eeb7cc26f5d0b6b1e3ac946c --- /dev/null +++ b/shared/package-files/33/33608e94a85d3ddb541c831a396b65188564e4d1b36a0d4e1047172f4bed4e8e/blob @@ -0,0 +1,27 @@ +from typing import Any, Container, Iterable, Optional, Text + +from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback +from bleach.sanitizer import ( + ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES, + ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS, + ALLOWED_STYLES as ALLOWED_STYLES, + ALLOWED_TAGS as ALLOWED_TAGS, + Cleaner as Cleaner, +) + +__releasedate__: Text +__version__: Text +VERSION: Any # packaging.version.Version + +def clean( + text: Text, + tags: Container[Text] = ..., + attributes: Any = ..., + styles: Container[Text] = ..., + protocols: Container[Text] = ..., + strip: bool = ..., + strip_comments: bool = ..., +) -> Text: ... +def linkify( + text: Text, callbacks: Iterable[_Callback] = ..., skip_tags: Optional[Container[Text]] = ..., parse_email: bool = ... +) -> Text: ... diff --git a/shared/package-files/33/336152fee45ad772ba030b300474de581db48777c2c0857c72ce230c5a91a45b/blob b/shared/package-files/33/336152fee45ad772ba030b300474de581db48777c2c0857c72ce230c5a91a45b/blob new file mode 100644 index 0000000000000000000000000000000000000000..ed30ca02e9400f60cbad2fa440826a701d48159d --- /dev/null +++ b/shared/package-files/33/336152fee45ad772ba030b300474de581db48777c2c0857c72ce230c5a91a45b/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:336152fee45ad772ba030b300474de581db48777c2c0857c72ce230c5a91a45b +size 210768 diff --git a/shared/package-files/33/3362413bdaf128a2a0728bd5b478c1c99f60577b3d2cef8f4d7e183b2a9a8a1a/blob b/shared/package-files/33/3362413bdaf128a2a0728bd5b478c1c99f60577b3d2cef8f4d7e183b2a9a8a1a/blob new file mode 100644 index 0000000000000000000000000000000000000000..fa6c0437fae5e206a9dc56e9390e40b5278925c6 --- /dev/null +++ b/shared/package-files/33/3362413bdaf128a2a0728bd5b478c1c99f60577b3d2cef8f4d7e183b2a9a8a1a/blob @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API ::std::vector _foreach_tan(at::TensorList self); +TORCH_API void _foreach_tan_(at::TensorList self); + +} // namespace cpu +} // namespace at diff --git a/shared/package-files/33/336a18dca1fc91417a4e80c1f7161bcd667175e63e73ac8af2af0a50531703b5/blob b/shared/package-files/33/336a18dca1fc91417a4e80c1f7161bcd667175e63e73ac8af2af0a50531703b5/blob new file mode 100644 index 0000000000000000000000000000000000000000..20fb32f3e95d5abda39b58269cb4cdf7fb7932a3 --- /dev/null +++ b/shared/package-files/33/336a18dca1fc91417a4e80c1f7161bcd667175e63e73ac8af2af0a50531703b5/blob @@ -0,0 +1,153 @@ +"""Convert SVG Path's elliptical arcs to Bezier curves. + +The code is mostly adapted from Blink's SVGPathNormalizer::DecomposeArcToCubic +https://github.com/chromium/chromium/blob/93831f2/third_party/ +blink/renderer/core/svg/svg_path_parser.cc#L169-L278 +""" + +from fontTools.misc.transform import Identity, Scale +from math import atan2, ceil, cos, fabs, isfinite, pi, radians, sin, sqrt, tan + +TWO_PI = 2 * pi +PI_OVER_TWO = 0.5 * pi + + +def _map_point(matrix, pt): + # apply Transform matrix to a point represented as a complex number + r = matrix.transformPoint((pt.real, pt.imag)) + return r[0] + r[1] * 1j + + +class EllipticalArc(object): + def __init__(self, current_point, rx, ry, rotation, large, sweep, target_point): + self.current_point = current_point + self.rx = rx + self.ry = ry + self.rotation = rotation + self.large = large + self.sweep = sweep + self.target_point = target_point + + # SVG arc's rotation angle is expressed in degrees, whereas Transform.rotate + # uses radians + self.angle = radians(rotation) + + # these derived attributes are computed by the _parametrize method + self.center_point = self.theta1 = self.theta2 = self.theta_arc = None + + def _parametrize(self): + # convert from endopoint to center parametrization: + # https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter + + # If rx = 0 or ry = 0 then this arc is treated as a straight line segment (a + # "lineto") joining the endpoints. + # http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters + rx = fabs(self.rx) + ry = fabs(self.ry) + if not (rx and ry): + return False + + # If the current point and target point for the arc are identical, it should + # be treated as a zero length path. This ensures continuity in animations. + if self.target_point == self.current_point: + return False + + mid_point_distance = (self.current_point - self.target_point) * 0.5 + + point_transform = Identity.rotate(-self.angle) + + transformed_mid_point = _map_point(point_transform, mid_point_distance) + square_rx = rx * rx + square_ry = ry * ry + square_x = transformed_mid_point.real * transformed_mid_point.real + square_y = transformed_mid_point.imag * transformed_mid_point.imag + + # Check if the radii are big enough to draw the arc, scale radii if not. + # http://www.w3.org/TR/SVG/implnote.html#ArcCorrectionOutOfRangeRadii + radii_scale = square_x / square_rx + square_y / square_ry + if radii_scale > 1: + rx *= sqrt(radii_scale) + ry *= sqrt(radii_scale) + self.rx, self.ry = rx, ry + + point_transform = Scale(1 / rx, 1 / ry).rotate(-self.angle) + + point1 = _map_point(point_transform, self.current_point) + point2 = _map_point(point_transform, self.target_point) + delta = point2 - point1 + + d = delta.real * delta.real + delta.imag * delta.imag + scale_factor_squared = max(1 / d - 0.25, 0.0) + + scale_factor = sqrt(scale_factor_squared) + if self.sweep == self.large: + scale_factor = -scale_factor + + delta *= scale_factor + center_point = (point1 + point2) * 0.5 + center_point += complex(-delta.imag, delta.real) + point1 -= center_point + point2 -= center_point + + theta1 = atan2(point1.imag, point1.real) + theta2 = atan2(point2.imag, point2.real) + + theta_arc = theta2 - theta1 + if theta_arc < 0 and self.sweep: + theta_arc += TWO_PI + elif theta_arc > 0 and not self.sweep: + theta_arc -= TWO_PI + + self.theta1 = theta1 + self.theta2 = theta1 + theta_arc + self.theta_arc = theta_arc + self.center_point = center_point + + return True + + def _decompose_to_cubic_curves(self): + if self.center_point is None and not self._parametrize(): + return + + point_transform = Identity.rotate(self.angle).scale(self.rx, self.ry) + + # Some results of atan2 on some platform implementations are not exact + # enough. So that we get more cubic curves than expected here. Adding 0.001f + # reduces the count of sgements to the correct count. + num_segments = int(ceil(fabs(self.theta_arc / (PI_OVER_TWO + 0.001)))) + for i in range(num_segments): + start_theta = self.theta1 + i * self.theta_arc / num_segments + end_theta = self.theta1 + (i + 1) * self.theta_arc / num_segments + + t = (4 / 3) * tan(0.25 * (end_theta - start_theta)) + if not isfinite(t): + return + + sin_start_theta = sin(start_theta) + cos_start_theta = cos(start_theta) + sin_end_theta = sin(end_theta) + cos_end_theta = cos(end_theta) + + point1 = complex( + cos_start_theta - t * sin_start_theta, + sin_start_theta + t * cos_start_theta, + ) + point1 += self.center_point + target_point = complex(cos_end_theta, sin_end_theta) + target_point += self.center_point + point2 = target_point + point2 += complex(t * sin_end_theta, -t * cos_end_theta) + + point1 = _map_point(point_transform, point1) + point2 = _map_point(point_transform, point2) + target_point = _map_point(point_transform, target_point) + + yield point1, point2, target_point + + def draw(self, pen): + for point1, point2, target_point in self._decompose_to_cubic_curves(): + pen.curveTo( + (point1.real, point1.imag), + (point2.real, point2.imag), + (target_point.real, target_point.imag), + ) diff --git a/shared/package-files/33/336c1b9dab51812fbc1c73515a4853342d8991c8ff8cf37a5b1f4c6a6ff88f64/blob b/shared/package-files/33/336c1b9dab51812fbc1c73515a4853342d8991c8ff8cf37a5b1f4c6a6ff88f64/blob new file mode 100644 index 0000000000000000000000000000000000000000..91e13db8b1b8174c52376d5ee2d7a05739ba1aec --- /dev/null +++ b/shared/package-files/33/336c1b9dab51812fbc1c73515a4853342d8991c8ff8cf37a5b1f4c6a6ff88f64/blob @@ -0,0 +1,22 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor soft_margin_loss_backward(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, int64_t reduction); +TORCH_API at::Tensor & soft_margin_loss_backward_out(const at::Tensor & grad_output, const at::Tensor & self, const at::Tensor & target, int64_t reduction, at::Tensor & grad_input); +} // namespace native +} // namespace at diff --git a/shared/package-files/33/336ee1d67ea233bbbab3fbad5e543d1b4fb6a96d94d4d806a6df5e5648deb24f/blob b/shared/package-files/33/336ee1d67ea233bbbab3fbad5e543d1b4fb6a96d94d4d806a6df5e5648deb24f/blob new file mode 100644 index 0000000000000000000000000000000000000000..d7a4d33976301322d231cecfca9aa908a05c67b1 --- /dev/null +++ b/shared/package-files/33/336ee1d67ea233bbbab3fbad5e543d1b4fb6a96d94d4d806a6df5e5648deb24f/blob @@ -0,0 +1,134 @@ +%%% Dynamic factor model (DFM) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This script estimates a dynamic factor model (DFM) using a panel of +% monthly and quarterly series. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%% Clear workspace and set paths. +close all; clear; clc; +addpath('functions'); + + +%% User inputs. +vintage_old = '2016-06-29'; % vintage dataset to use for estimation +vintage_new = '2016-07-29'; % updated vintage dataset +country = 'US'; % United States macroeconomic data +sample_start = datenum('2000-01-01','yyyy-mm-dd'); % estimation sample + +series = 'GDPC1' ; % Nowcasting real GDP (GDPC1) +period = '2016q3'; % Forecasting target quarter + + +%% Load model specification and dataset. +Spec = load_spec('test_spec_blocks.xls'); +datafile_old = fullfile('data', country, [vintage_old '.xls']); +datafile_new = fullfile('data', country, [vintage_new '.xls']); +[X_old, ~] = load_data(datafile_old, Spec, sample_start); +[X_new, Time] = load_data(datafile_new, Spec, sample_start); + +% Basic settings +threshold = 1e-4; % Set to 1e-5 for more robust estimates +format long + +%% Test 1: p=1, k=1, max_iter=2 +Spec.p = 1; +Spec.k = 1; +max_iter = 2; + +% Run DFM model +Res = dfm(X_old, Spec, threshold, max_iter); + +% Update nowcast +Res = update_nowcast(X_old, X_new, Time, Spec, Res, series, period, ... + vintage_old, vintage_new); + + +% Store results +Res = rmfield(Res, {'X_sm', 'Z', 'Vsmooth', 'VVsmooth'}); +Res.news_table = Res.news_table{:,:}; + +k = Spec.k; +p = Spec.p; +kp = k * p; +p5 = max(5, Spec.p); +kp5 = k * p5; +Lambda = [Res.C(1:end, 1:k) ... + Res.C(1:end, kp5 + 1:kp5 + k) ... + Res.C(1:end, 2 * kp5 + 1:2 * kp5 + k)]'; +mask = logical(Spec.Blocks'); +Lambda = Lambda(mask)'; + +f_A1 = Res.A(1:k, 1:kp)'; +f_A2 = Res.A(kp5 + 1:kp5 + k, kp5 + 1:kp5 + kp)'; +f_A3 = Res.A(2 * kp5 + 1:2 * kp5 + k, 2 * kp5 + 1:2 * kp5 + kp)'; +f_A = [f_A1 f_A2 f_A3]; + +f_Q1 = Res.Q(1:k, 1:k); +f_Q2 = Res.Q(kp5 + 1:kp5 + k, kp5 + 1:kp5 + k); +f_Q3 = Res.Q(2 * kp5 + 1:2 * kp5 + k, 2 * kp5 + 1:2 * kp5 + k); +f_Q = [nonzeros(chol(f_Q1))' ... + nonzeros(chol(f_Q2))' ... + nonzeros(chol(f_Q3))']; + +Ad = diag(Res.A); +Qd = diag(Res.Q); + +idio = 3 * kp5 + 1; +params = [Lambda f_A f_Q ... + Ad(idio:idio+6)' Ad(idio+6+5) Qd(idio:idio+6)' Qd(idio+6+5)]'; + +save('test_news_blocks_112.mat','Res','Spec','params'); + +%% Test 2: p=2, k=2, max_iter=2 +Spec.p = 2; +Spec.k = 2; +max_iter = 2; + +% Run DFM model +Res = dfm(X_old, Spec, threshold, max_iter); + +% Update nowcast +Res = update_nowcast(X_old, X_new, Time, Spec, Res, series, period, ... + vintage_old, vintage_new); + + +% Store results +Res = rmfield(Res, {'X_sm', 'Z', 'Vsmooth', 'VVsmooth'}); +Res.news_table = Res.news_table{:,:}; + +k = Spec.k; +p = Spec.p; +kp = k * p; +p5 = max(5, Spec.p); +kp5 = k * p5; +Lambda1 = Res.C(1:end, 1:k); +mask1 = repmat(logical(Spec.Blocks(:, 1)), 1, 2); +Lambda2 = Res.C(1:end, kp5 + 1:kp5 + k); +mask2 = repmat(logical(Spec.Blocks(:, 2)), 1, 2); +Lambda3 = Res.C(1:end, 2 * kp5 + 1:2 * kp5 + k); +mask3 = repmat(logical(Spec.Blocks(:, 3)), 1, 2); +Lambda = [Lambda1 Lambda2 Lambda3]'; +mask = [mask1 mask2 mask3]'; +Lambda = Lambda(mask)'; + +f_A1 = Res.A(1:k, 1:kp)'; +f_A2 = Res.A(kp5 + 1:kp5 + k, kp5 + 1:kp5 + kp)'; +f_A3 = Res.A(2 * kp5 + 1:2 * kp5 + k, 2 * kp5 + 1:2 * kp5 + kp)'; +f_A = [f_A1 f_A2 f_A3]; +f_A = f_A(:)'; + +f_Q1 = Res.Q(1:k, 1:k); +f_Q2 = Res.Q(kp5 + 1:kp5 + k, kp5 + 1:kp5 + k); +f_Q3 = Res.Q(2 * kp5 + 1:2 * kp5 + k, 2 * kp5 + 1:2 * kp5 + k); +f_Q = [nonzeros(chol(f_Q1))' ... + nonzeros(chol(f_Q2))' ... + nonzeros(chol(f_Q3))']; + +Ad = diag(Res.A); +Qd = diag(Res.Q); + +idio = 3 * kp5 + 1; +params = [Lambda f_A f_Q ... + Ad(idio:idio+6)' Ad(idio+6+5) Qd(idio:idio+6)' Qd(idio+6+5)]'; + +save('test_news_blocks_222.mat','Res','Spec','params'); diff --git a/shared/package-files/33/336f2b6994f5aacca9689f32249db20a8dac36934314b7d5ba391d94169d63c6/blob b/shared/package-files/33/336f2b6994f5aacca9689f32249db20a8dac36934314b7d5ba391d94169d63c6/blob new file mode 100644 index 0000000000000000000000000000000000000000..5a2645b9cc27dcee4ceea7e8443dad8e9e0d80c7 --- /dev/null +++ b/shared/package-files/33/336f2b6994f5aacca9689f32249db20a8dac36934314b7d5ba391d94169d63c6/blob @@ -0,0 +1,45 @@ +"Test window, coverage 47%." + +from idlelib import window +import unittest +from test.support import requires +from tkinter import Tk + + +class WindowListTest(unittest.TestCase): + + def test_init(self): + wl = window.WindowList() + self.assertEqual(wl.dict, {}) + self.assertEqual(wl.callbacks, []) + + # Further tests need mock Window. + + +class ListedToplevelTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + window.registry = set() + requires('gui') + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + window.registry = window.WindowList() + cls.root.update_idletasks() +## for id in cls.root.tk.call('after', 'info'): +## cls.root.after_cancel(id) # Need for EditorWindow. + cls.root.destroy() + del cls.root + + def test_init(self): + + win = window.ListedToplevel(self.root) + self.assertIn(win, window.registry) + self.assertEqual(win.focused_widget, win) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/shared/package-files/33/336f57eb67367a4bc7d454efe7acb27b64cb717c9850233901e80041558b15cf/blob b/shared/package-files/33/336f57eb67367a4bc7d454efe7acb27b64cb717c9850233901e80041558b15cf/blob new file mode 100644 index 0000000000000000000000000000000000000000..09d965ef1f32268550bbf35a17f11529545054ed --- /dev/null +++ b/shared/package-files/33/336f57eb67367a4bc7d454efe7acb27b64cb717c9850233901e80041558b15cf/blob @@ -0,0 +1,25 @@ +import pytest + +from pandas import Series +import pandas._testing as tm + + +class TestStrAccessor: + def test_str_attribute(self): + # GH#9068 + methods = ["strip", "rstrip", "lstrip"] + ser = Series([" jack", "jill ", " jesse ", "frank"]) + for method in methods: + expected = Series([getattr(str, method)(x) for x in ser.values]) + tm.assert_series_equal(getattr(Series.str, method)(ser.str), expected) + + # str accessor only valid with string values + ser = Series(range(5)) + with pytest.raises(AttributeError, match="only use .str accessor"): + ser.str.repeat(2) + + def test_str_accessor_updates_on_inplace(self): + ser = Series(list("abc")) + return_value = ser.drop([0], inplace=True) + assert return_value is None + assert len(ser.str.lower()) == 2 diff --git a/shared/package-files/33/336ff4bdb2fdf6ad2de98d262874fe4c9d051ce9d7adfcf45055714311c8a964/blob b/shared/package-files/33/336ff4bdb2fdf6ad2de98d262874fe4c9d051ce9d7adfcf45055714311c8a964/blob new file mode 100644 index 0000000000000000000000000000000000000000..6fdf5cea80946591d2e3c40b31285f3191cacac2 --- /dev/null +++ b/shared/package-files/33/336ff4bdb2fdf6ad2de98d262874fe4c9d051ce9d7adfcf45055714311c8a964/blob @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper + +class BaseDatabaseClient: + executable_name: Any = ... + connection: Any = ... + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def runshell(self) -> None: ... diff --git a/shared/package-files/33/33708544410c5b5fc7d1a25d1700804719deb4e4cb57358d4d9d2e7328418bcb/blob b/shared/package-files/33/33708544410c5b5fc7d1a25d1700804719deb4e4cb57358d4d9d2e7328418bcb/blob new file mode 100644 index 0000000000000000000000000000000000000000..36a013198b665a6b72e2016253093a1e36b33aca --- /dev/null +++ b/shared/package-files/33/33708544410c5b5fc7d1a25d1700804719deb4e4cb57358d4d9d2e7328418bcb/blob @@ -0,0 +1,99 @@ +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser +# +# Copyright (c) 2019 Expat development team +# Licensed under the MIT license: +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. +# +if(NOT _expat_config_included) + # Protect against multiple inclusion + set(_expat_config_included TRUE) + + +include("${CMAKE_CURRENT_LIST_DIR}/expat.cmake") + + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was expat-config.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +#################################################################################### + +# +# Supported components +# +macro(expat_register_component _NAME _AVAILABE) + set(expat_${_NAME}_FOUND ${_AVAILABE}) +endmacro() + +expat_register_component(attr_info OFF) +expat_register_component(dtd ON) +expat_register_component(large_size OFF) +expat_register_component(min_size OFF) +expat_register_component(ns ON) + +if(1024) + expat_register_component(context_bytes ON) +else() + expat_register_component(context_bytes OFF) +endif() + +if("char" STREQUAL "char") + expat_register_component(char ON) + expat_register_component(ushort OFF) + expat_register_component(wchar_t OFF) +elseif("char" STREQUAL "ushort") + expat_register_component(char OFF) + expat_register_component(ushort ON) + expat_register_component(wchar_t OFF) +elseif("char" STREQUAL "wchar_t") + expat_register_component(char OFF) + expat_register_component(ushort OFF) + expat_register_component(wchar_t ON) +endif() + +check_required_components(expat) + + +endif(NOT _expat_config_included) diff --git a/shared/package-files/33/33740ab29ef943b1f55f769e13ff59a90962f5a12434209072d650e6c10abb4d/blob b/shared/package-files/33/33740ab29ef943b1f55f769e13ff59a90962f5a12434209072d650e6c10abb4d/blob new file mode 100644 index 0000000000000000000000000000000000000000..e592a68e53f6215de9e1d1ac61ce062a333283c0 Binary files /dev/null and b/shared/package-files/33/33740ab29ef943b1f55f769e13ff59a90962f5a12434209072d650e6c10abb4d/blob differ diff --git a/shared/package-files/33/3374bcd808d94c88ae043c7e01464d7d33a1ad52204fab443c43d10765d8e604/blob b/shared/package-files/33/3374bcd808d94c88ae043c7e01464d7d33a1ad52204fab443c43d10765d8e604/blob new file mode 100644 index 0000000000000000000000000000000000000000..4042542b65b8e210f83134ee46959c650715a0da --- /dev/null +++ b/shared/package-files/33/3374bcd808d94c88ae043c7e01464d7d33a1ad52204fab443c43d10765d8e604/blob @@ -0,0 +1,295 @@ +import itertools + +from numba.core import types +from numba.core.typeconv.typeconv import TypeManager, TypeCastingRules +from numba.core.typeconv import rules +from numba.core.typeconv import castgraph, Conversion +import unittest + + +class CompatibilityTestMixin(unittest.TestCase): + + def check_number_compatibility(self, check_compatible): + b = types.boolean + i8 = types.int8 + i16 = types.int16 + i32 = types.int32 + i64 = types.int64 + u8 = types.uint8 + u16 = types.uint16 + u32 = types.uint32 + u64 = types.uint64 + f16 = types.float16 + f32 = types.float32 + f64 = types.float64 + c64 = types.complex64 + c128 = types.complex128 + + self.assertEqual(check_compatible(i32, i32), Conversion.exact) + + self.assertEqual(check_compatible(b, i8), Conversion.safe) + self.assertEqual(check_compatible(b, u8), Conversion.safe) + self.assertEqual(check_compatible(i8, b), Conversion.unsafe) + self.assertEqual(check_compatible(u8, b), Conversion.unsafe) + + self.assertEqual(check_compatible(i32, i64), Conversion.promote) + self.assertEqual(check_compatible(i32, u32), Conversion.unsafe) + self.assertEqual(check_compatible(u32, i32), Conversion.unsafe) + self.assertEqual(check_compatible(u32, i64), Conversion.safe) + + self.assertEqual(check_compatible(i16, f16), Conversion.unsafe) + self.assertEqual(check_compatible(i32, f32), Conversion.unsafe) + self.assertEqual(check_compatible(u32, f32), Conversion.unsafe) + self.assertEqual(check_compatible(i32, f64), Conversion.safe) + self.assertEqual(check_compatible(u32, f64), Conversion.safe) + # Note this is inconsistent with i32 -> f32... + self.assertEqual(check_compatible(i64, f64), Conversion.safe) + self.assertEqual(check_compatible(u64, f64), Conversion.safe) + + self.assertEqual(check_compatible(f32, c64), Conversion.safe) + self.assertEqual(check_compatible(f64, c128), Conversion.safe) + self.assertEqual(check_compatible(f64, c64), Conversion.unsafe) + + # Propagated compatibility relationships + self.assertEqual(check_compatible(i16, f64), Conversion.safe) + self.assertEqual(check_compatible(i16, i64), Conversion.promote) + self.assertEqual(check_compatible(i32, c64), Conversion.unsafe) + self.assertEqual(check_compatible(i32, c128), Conversion.safe) + self.assertEqual(check_compatible(i32, u64), Conversion.unsafe) + + for ta, tb in itertools.product(types.number_domain, + types.number_domain): + if ta in types.complex_domain and tb not in types.complex_domain: + continue + self.assertTrue(check_compatible(ta, tb) is not None, + msg="No cast from %s to %s" % (ta, tb)) + + +class TestTypeConv(CompatibilityTestMixin, unittest.TestCase): + + def test_typeconv(self): + tm = TypeManager() + + i32 = types.int32 + i64 = types.int64 + f32 = types.float32 + + tm.set_promote(i32, i64) + tm.set_unsafe_convert(i32, f32) + + sig = (i32, f32) + ovs = [ + (i32, i32), + (f32, f32), + (i64, i64), + ] + + # allow_unsafe = True => a conversion from i32 to f32 is chosen + sel = tm.select_overload(sig, ovs, True, False) + self.assertEqual(sel, 1) + # allow_unsafe = False => no overload available + with self.assertRaises(TypeError): + sel = tm.select_overload(sig, ovs, False, False) + + def test_default_rules(self): + tm = rules.default_type_manager + self.check_number_compatibility(tm.check_compatible) + + def test_overload1(self): + tm = rules.default_type_manager + + i32 = types.int32 + i64 = types.int64 + + sig = (i64, i32, i32) + ovs = [ + (i32, i32, i32), + (i64, i64, i64), + ] + # The first overload is unsafe, the second is safe => the second + # is always chosen, regardless of allow_unsafe. + self.assertEqual(tm.select_overload(sig, ovs, True, False), 1) + self.assertEqual(tm.select_overload(sig, ovs, False, False), 1) + + def test_overload2(self): + tm = rules.default_type_manager + + i16 = types.int16 + i32 = types.int32 + i64 = types.int64 + + sig = (i32, i16, i32) + ovs = [ + # Three promotes + (i64, i64, i64), + # One promotes, two exact types + (i32, i32, i32), + # Two unsafe converts, one exact type + (i16, i16, i16), + ] + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=False, + exact_match_required=False), 1) + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=True, + exact_match_required=False), 1) + + # The same in reverse order + ovs.reverse() + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=False, + exact_match_required=False), 1) + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=True, + exact_match_required=False), 1) + + def test_overload3(self): + # Promotes should be preferred over safe converts + tm = rules.default_type_manager + + i32 = types.int32 + i64 = types.int64 + f64 = types.float64 + + sig = (i32, i32) + ovs = [ + # Two promotes + (i64, i64), + # Two safe converts + (f64, f64), + ] + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=False, + exact_match_required=False), 0) + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=True, + exact_match_required=False), 0) + + # The same in reverse order + ovs.reverse() + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=False, + exact_match_required=False), 1) + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=True, + exact_match_required=False), 1) + + def test_overload4(self): + tm = rules.default_type_manager + + i16 = types.int16 + i32 = types.int32 + i64 = types.int64 + f16 = types.float16 + f32 = types.float32 + + sig = (i16, f16, f16) + ovs = [ + # One unsafe, one promote, one exact + (f16, f32, f16), + # Two unsafe, one exact types + (f32, i32, f16), + ] + + self.assertEqual(tm.select_overload(sig, ovs, allow_unsafe=True, + exact_match_required=False), 0) + + def test_type_casting_rules(self): + tm = TypeManager() + tcr = TypeCastingRules(tm) + + i16 = types.int16 + i32 = types.int32 + i64 = types.int64 + f64 = types.float64 + f32 = types.float32 + f16 = types.float16 + made_up = types.Dummy("made_up") + + tcr.promote_unsafe(i32, i64) + tcr.safe_unsafe(i32, f64) + tcr.promote_unsafe(f32, f64) + tcr.promote_unsafe(f16, f32) + tcr.unsafe_unsafe(i16, f16) + + def base_test(): + # As declared + self.assertEqual(tm.check_compatible(i32, i64), Conversion.promote) + self.assertEqual(tm.check_compatible(i32, f64), Conversion.safe) + self.assertEqual(tm.check_compatible(f16, f32), Conversion.promote) + self.assertEqual(tm.check_compatible(f32, f64), Conversion.promote) + self.assertEqual(tm.check_compatible(i64, i32), Conversion.unsafe) + self.assertEqual(tm.check_compatible(f64, i32), Conversion.unsafe) + self.assertEqual(tm.check_compatible(f64, f32), Conversion.unsafe) + + # Propagated + self.assertEqual(tm.check_compatible(i64, f64), Conversion.unsafe) + self.assertEqual(tm.check_compatible(f64, i64), Conversion.unsafe) + self.assertEqual(tm.check_compatible(i64, f32), Conversion.unsafe) + self.assertEqual(tm.check_compatible(i32, f32), Conversion.unsafe) + self.assertEqual(tm.check_compatible(f32, i32), Conversion.unsafe) + self.assertEqual(tm.check_compatible(i16, f16), Conversion.unsafe) + self.assertEqual(tm.check_compatible(f16, i16), Conversion.unsafe) + + # Test base graph + base_test() + + self.assertIsNone(tm.check_compatible(i64, made_up)) + self.assertIsNone(tm.check_compatible(i32, made_up)) + self.assertIsNone(tm.check_compatible(f32, made_up)) + self.assertIsNone(tm.check_compatible(made_up, f64)) + self.assertIsNone(tm.check_compatible(made_up, i64)) + + # Add new test + tcr.promote(f64, made_up) + tcr.unsafe(made_up, i32) + + # Ensure the graph did not change by adding the new type + base_test() + + # To "made up" type + self.assertEqual(tm.check_compatible(i64, made_up), Conversion.unsafe) + self.assertEqual(tm.check_compatible(i32, made_up), Conversion.safe) + self.assertEqual(tm.check_compatible(f32, made_up), Conversion.promote) + self.assertEqual(tm.check_compatible(made_up, f64), Conversion.unsafe) + self.assertEqual(tm.check_compatible(made_up, i64), Conversion.unsafe) + + def test_castgraph_propagate(self): + saved = [] + + def callback(src, dst, rel): + saved.append((src, dst, rel)) + + tg = castgraph.TypeGraph(callback) + + i32 = types.int32 + i64 = types.int64 + f64 = types.float64 + f32 = types.float32 + + tg.insert_rule(i32, i64, Conversion.promote) + tg.insert_rule(i64, i32, Conversion.unsafe) + + saved.append(None) + + tg.insert_rule(i32, f64, Conversion.safe) + tg.insert_rule(f64, i32, Conversion.unsafe) + + saved.append(None) + + tg.insert_rule(f32, f64, Conversion.promote) + tg.insert_rule(f64, f32, Conversion.unsafe) + + self.assertIn((i32, i64, Conversion.promote), saved[0:2]) + self.assertIn((i64, i32, Conversion.unsafe), saved[0:2]) + self.assertIs(saved[2], None) + + self.assertIn((i32, f64, Conversion.safe), saved[3:7]) + self.assertIn((f64, i32, Conversion.unsafe), saved[3:7]) + self.assertIn((i64, f64, Conversion.unsafe), saved[3:7]) + self.assertIn((i64, f64, Conversion.unsafe), saved[3:7]) + self.assertIs(saved[7], None) + + self.assertIn((f32, f64, Conversion.promote), saved[8:14]) + self.assertIn((f64, f32, Conversion.unsafe), saved[8:14]) + self.assertIn((f32, i32, Conversion.unsafe), saved[8:14]) + self.assertIn((i32, f32, Conversion.unsafe), saved[8:14]) + self.assertIn((f32, i64, Conversion.unsafe), saved[8:14]) + self.assertIn((i64, f32, Conversion.unsafe), saved[8:14]) + self.assertEqual(len(saved[14:]), 0) + + +if __name__ == '__main__': + unittest.main() diff --git a/shared/package-files/33/3374c4cc80d5ea5e82a4ca4f65c015acef98fe961b4510ac6ee3cc180690117b/blob b/shared/package-files/33/3374c4cc80d5ea5e82a4ca4f65c015acef98fe961b4510ac6ee3cc180690117b/blob new file mode 100644 index 0000000000000000000000000000000000000000..cdd2bb42cd9ce2bc25c4d0df395f30e1740afdaa --- /dev/null +++ b/shared/package-files/33/3374c4cc80d5ea5e82a4ca4f65c015acef98fe961b4510ac6ee3cc180690117b/blob @@ -0,0 +1,162 @@ +from sympy.core.numbers import Float +from sympy.core.symbol import Dummy +from sympy.utilities.lambdify import lambdify + +import math + + +def is_valid(x): + """Check if a floating point number is valid""" + if x is None: + return False + if isinstance(x, complex): + return False + return not math.isinf(x) and not math.isnan(x) + + +def rescale(y, W, H, mi, ma): + """Rescale the given array `y` to fit into the integer values + between `0` and `H-1` for the values between ``mi`` and ``ma``. + """ + y_new = [] + + norm = ma - mi + offset = (ma + mi) / 2 + + for x in range(W): + if is_valid(y[x]): + normalized = (y[x] - offset) / norm + if not is_valid(normalized): + y_new.append(None) + else: + rescaled = Float((normalized*H + H/2) * (H-1)/H).round() + rescaled = int(rescaled) + y_new.append(rescaled) + else: + y_new.append(None) + return y_new + + +def linspace(start, stop, num): + return [start + (stop - start) * x / (num-1) for x in range(num)] + + +def textplot_str(expr, a, b, W=55, H=21): + """Generator for the lines of the plot""" + free = expr.free_symbols + if len(free) > 1: + raise ValueError( + "The expression must have a single variable. (Got {})" + .format(free)) + x = free.pop() if free else Dummy() + f = lambdify([x], expr) + a = float(a) + b = float(b) + + # Calculate function values + x = linspace(a, b, W) + y = [] + for val in x: + try: + y.append(f(val)) + # Not sure what exceptions to catch here or why... + except (ValueError, TypeError, ZeroDivisionError): + y.append(None) + + # Normalize height to screen space + y_valid = list(filter(is_valid, y)) + if y_valid: + ma = max(y_valid) + mi = min(y_valid) + if ma == mi: + if ma: + mi, ma = sorted([0, 2*ma]) + else: + mi, ma = -1, 1 + else: + mi, ma = -1, 1 + y_range = ma - mi + precision = math.floor(math.log(y_range, 10)) - 1 + precision *= -1 + mi = round(mi, precision) + ma = round(ma, precision) + y = rescale(y, W, H, mi, ma) + + y_bins = linspace(mi, ma, H) + + # Draw plot + margin = 7 + for h in range(H - 1, -1, -1): + s = [' '] * W + for i in range(W): + if y[i] == h: + if (i == 0 or y[i - 1] == h - 1) and (i == W - 1 or y[i + 1] == h + 1): + s[i] = '/' + elif (i == 0 or y[i - 1] == h + 1) and (i == W - 1 or y[i + 1] == h - 1): + s[i] = '\\' + else: + s[i] = '.' + + if h == 0: + for i in range(W): + s[i] = '_' + + # Print y values + if h in (0, H//2, H - 1): + prefix = ("%g" % y_bins[h]).rjust(margin)[:margin] + else: + prefix = " "*margin + s = "".join(s) + if h == H//2: + s = s.replace(" ", "-") + yield prefix + " |" + s + + # Print x values + bottom = " " * (margin + 2) + bottom += ("%g" % x[0]).ljust(W//2) + if W % 2 == 1: + bottom += ("%g" % x[W//2]).ljust(W//2) + else: + bottom += ("%g" % x[W//2]).ljust(W//2-1) + bottom += "%g" % x[-1] + yield bottom + + +def textplot(expr, a, b, W=55, H=21): + r""" + Print a crude ASCII art plot of the SymPy expression 'expr' (which + should contain a single symbol, e.g. x or something else) over the + interval [a, b]. + + Examples + ======== + + >>> from sympy import Symbol, sin + >>> from sympy.plotting import textplot + >>> t = Symbol('t') + >>> textplot(sin(t)*t, 0, 15) + 14 | ... + | . + | . + | . + | . + | ... + | / . . + | / + | / . + | . . . + 1.5 |----.......-------------------------------------------- + |.... \ . . + | \ / . + | .. / . + | \ / . + | .... + | . + | . . + | + | . . + -11 |_______________________________________________________ + 0 7.5 15 + """ + for line in textplot_str(expr, a, b, W, H): + print(line) diff --git a/shared/package-files/33/33755418e0e1dcc2c495e3e362d8edf5bd3645e313870f975e9b904e4a2180db/blob b/shared/package-files/33/33755418e0e1dcc2c495e3e362d8edf5bd3645e313870f975e9b904e4a2180db/blob new file mode 100644 index 0000000000000000000000000000000000000000..87b56d6c929c3ce3ce153dce7b3c210821d706a0 --- /dev/null +++ b/shared/package-files/33/33755418e0e1dcc2c495e3e362d8edf5bd3645e313870f975e9b904e4a2180db/blob @@ -0,0 +1,22 @@ +""" +Rational number type based on Python integers. + +The PythonRational class from here has been moved to +sympy.external.pythonmpq + +This module is just left here for backwards compatibility. +""" + + +from sympy.core.numbers import Rational +from sympy.core.sympify import _sympy_converter +from sympy.utilities import public +from sympy.external.pythonmpq import PythonMPQ + + +PythonRational = public(PythonMPQ) + + +def sympify_pythonrational(arg): + return Rational(arg.numerator, arg.denominator) +_sympy_converter[PythonRational] = sympify_pythonrational diff --git a/shared/package-files/33/3375f341b7638b593cfe1ca0b7cf29ae2c04309a962918b142c378a832e67de5/blob b/shared/package-files/33/3375f341b7638b593cfe1ca0b7cf29ae2c04309a962918b142c378a832e67de5/blob new file mode 100644 index 0000000000000000000000000000000000000000..642bba7c0102009ece4aa569b85608a10c326b3e --- /dev/null +++ b/shared/package-files/33/3375f341b7638b593cfe1ca0b7cf29ae2c04309a962918b142c378a832e67de5/blob @@ -0,0 +1,45 @@ +from typing import Any, Generator + +class Message: + preamble = ... + epilogue = ... + defects = ... + def __init__(self): ... + def as_string(self, unixfrom=...): ... + def is_multipart(self) -> bool: ... + def set_unixfrom(self, unixfrom) -> None: ... + def get_unixfrom(self): ... + def attach(self, payload) -> None: ... + def get_payload(self, i=..., decode: bool = ...): ... + def set_payload(self, payload, charset=...) -> None: ... + def set_charset(self, charset): ... + def get_charset(self): ... + def __len__(self): ... + def __getitem__(self, name): ... + def __setitem__(self, name, val) -> None: ... + def __delitem__(self, name) -> None: ... + def __contains__(self, name): ... + def has_key(self, name) -> bool: ... + def keys(self): ... + def values(self): ... + def items(self): ... + def get(self, name, failobj=...): ... + def get_all(self, name, failobj=...): ... + def add_header(self, _name, _value, **_params) -> None: ... + def replace_header(self, _name, _value) -> None: ... + def get_content_type(self): ... + def get_content_maintype(self): ... + def get_content_subtype(self): ... + def get_default_type(self): ... + def set_default_type(self, ctype) -> None: ... + def get_params(self, failobj=..., header=..., unquote: bool = ...): ... + def get_param(self, param, failobj=..., header=..., unquote: bool = ...): ... + def set_param(self, param, value, header=..., requote: bool = ..., charset=..., language=...) -> None: ... + def del_param(self, param, header=..., requote: bool = ...): ... + def set_type(self, type, header=..., requote: bool = ...): ... + def get_filename(self, failobj=...): ... + def get_boundary(self, failobj=...): ... + def set_boundary(self, boundary) -> None: ... + def get_content_charset(self, failobj=...): ... + def get_charsets(self, failobj=...): ... + def walk(self) -> Generator[Any, Any, Any]: ... diff --git a/shared/package-files/33/3379d78b244aa905ffe1171a968caaf41b9a0154d1ddc76c05a2abaca2b289fd/blob b/shared/package-files/33/3379d78b244aa905ffe1171a968caaf41b9a0154d1ddc76c05a2abaca2b289fd/blob new file mode 100644 index 0000000000000000000000000000000000000000..0a919d837e1d4e80380f0e7bc1b91d537b5eec8d --- /dev/null +++ b/shared/package-files/33/3379d78b244aa905ffe1171a968caaf41b9a0154d1ddc76c05a2abaca2b289fd/blob @@ -0,0 +1,307 @@ +""" Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.TXT' with gencodec.py. + +"""#" + +import codecs + +### Codec APIs + +class Codec(codecs.Codec): + + def encode(self,input,errors='strict'): + return codecs.charmap_encode(input,errors,encoding_table) + + def decode(self,input,errors='strict'): + return codecs.charmap_decode(input,errors,decoding_table) + +class IncrementalEncoder(codecs.IncrementalEncoder): + def encode(self, input, final=False): + return codecs.charmap_encode(input,self.errors,encoding_table)[0] + +class IncrementalDecoder(codecs.IncrementalDecoder): + def decode(self, input, final=False): + return codecs.charmap_decode(input,self.errors,decoding_table)[0] + +class StreamWriter(Codec,codecs.StreamWriter): + pass + +class StreamReader(Codec,codecs.StreamReader): + pass + +### encodings module API + +def getregentry(): + return codecs.CodecInfo( + name='cp1140', + encode=Codec().encode, + decode=Codec().decode, + incrementalencoder=IncrementalEncoder, + incrementaldecoder=IncrementalDecoder, + streamreader=StreamReader, + streamwriter=StreamWriter, + ) + + +### Decoding Table + +decoding_table = ( + '\x00' # 0x00 -> NULL + '\x01' # 0x01 -> START OF HEADING + '\x02' # 0x02 -> START OF TEXT + '\x03' # 0x03 -> END OF TEXT + '\x9c' # 0x04 -> CONTROL + '\t' # 0x05 -> HORIZONTAL TABULATION + '\x86' # 0x06 -> CONTROL + '\x7f' # 0x07 -> DELETE + '\x97' # 0x08 -> CONTROL + '\x8d' # 0x09 -> CONTROL + '\x8e' # 0x0A -> CONTROL + '\x0b' # 0x0B -> VERTICAL TABULATION + '\x0c' # 0x0C -> FORM FEED + '\r' # 0x0D -> CARRIAGE RETURN + '\x0e' # 0x0E -> SHIFT OUT + '\x0f' # 0x0F -> SHIFT IN + '\x10' # 0x10 -> DATA LINK ESCAPE + '\x11' # 0x11 -> DEVICE CONTROL ONE + '\x12' # 0x12 -> DEVICE CONTROL TWO + '\x13' # 0x13 -> DEVICE CONTROL THREE + '\x9d' # 0x14 -> CONTROL + '\x85' # 0x15 -> CONTROL + '\x08' # 0x16 -> BACKSPACE + '\x87' # 0x17 -> CONTROL + '\x18' # 0x18 -> CANCEL + '\x19' # 0x19 -> END OF MEDIUM + '\x92' # 0x1A -> CONTROL + '\x8f' # 0x1B -> CONTROL + '\x1c' # 0x1C -> FILE SEPARATOR + '\x1d' # 0x1D -> GROUP SEPARATOR + '\x1e' # 0x1E -> RECORD SEPARATOR + '\x1f' # 0x1F -> UNIT SEPARATOR + '\x80' # 0x20 -> CONTROL + '\x81' # 0x21 -> CONTROL + '\x82' # 0x22 -> CONTROL + '\x83' # 0x23 -> CONTROL + '\x84' # 0x24 -> CONTROL + '\n' # 0x25 -> LINE FEED + '\x17' # 0x26 -> END OF TRANSMISSION BLOCK + '\x1b' # 0x27 -> ESCAPE + '\x88' # 0x28 -> CONTROL + '\x89' # 0x29 -> CONTROL + '\x8a' # 0x2A -> CONTROL + '\x8b' # 0x2B -> CONTROL + '\x8c' # 0x2C -> CONTROL + '\x05' # 0x2D -> ENQUIRY + '\x06' # 0x2E -> ACKNOWLEDGE + '\x07' # 0x2F -> BELL + '\x90' # 0x30 -> CONTROL + '\x91' # 0x31 -> CONTROL + '\x16' # 0x32 -> SYNCHRONOUS IDLE + '\x93' # 0x33 -> CONTROL + '\x94' # 0x34 -> CONTROL + '\x95' # 0x35 -> CONTROL + '\x96' # 0x36 -> CONTROL + '\x04' # 0x37 -> END OF TRANSMISSION + '\x98' # 0x38 -> CONTROL + '\x99' # 0x39 -> CONTROL + '\x9a' # 0x3A -> CONTROL + '\x9b' # 0x3B -> CONTROL + '\x14' # 0x3C -> DEVICE CONTROL FOUR + '\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE + '\x9e' # 0x3E -> CONTROL + '\x1a' # 0x3F -> SUBSTITUTE + ' ' # 0x40 -> SPACE + '\xa0' # 0x41 -> NO-BREAK SPACE + '\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX + '\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS + '\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE + '\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE + '\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE + '\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE + '\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA + '\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE + '\xa2' # 0x4A -> CENT SIGN + '.' # 0x4B -> FULL STOP + '<' # 0x4C -> LESS-THAN SIGN + '(' # 0x4D -> LEFT PARENTHESIS + '+' # 0x4E -> PLUS SIGN + '|' # 0x4F -> VERTICAL LINE + '&' # 0x50 -> AMPERSAND + '\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE + '\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX + '\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS + '\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE + '\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE + '\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX + '\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS + '\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE + '\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) + '!' # 0x5A -> EXCLAMATION MARK + '$' # 0x5B -> DOLLAR SIGN + '*' # 0x5C -> ASTERISK + ')' # 0x5D -> RIGHT PARENTHESIS + ';' # 0x5E -> SEMICOLON + '\xac' # 0x5F -> NOT SIGN + '-' # 0x60 -> HYPHEN-MINUS + '/' # 0x61 -> SOLIDUS + '\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX + '\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS + '\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE + '\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE + '\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE + '\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE + '\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA + '\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE + '\xa6' # 0x6A -> BROKEN BAR + ',' # 0x6B -> COMMA + '%' # 0x6C -> PERCENT SIGN + '_' # 0x6D -> LOW LINE + '>' # 0x6E -> GREATER-THAN SIGN + '?' # 0x6F -> QUESTION MARK + '\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE + '\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE + '\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX + '\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS + '\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE + '\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE + '\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX + '\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS + '\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE + '`' # 0x79 -> GRAVE ACCENT + ':' # 0x7A -> COLON + '#' # 0x7B -> NUMBER SIGN + '@' # 0x7C -> COMMERCIAL AT + "'" # 0x7D -> APOSTROPHE + '=' # 0x7E -> EQUALS SIGN + '"' # 0x7F -> QUOTATION MARK + '\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE + 'a' # 0x81 -> LATIN SMALL LETTER A + 'b' # 0x82 -> LATIN SMALL LETTER B + 'c' # 0x83 -> LATIN SMALL LETTER C + 'd' # 0x84 -> LATIN SMALL LETTER D + 'e' # 0x85 -> LATIN SMALL LETTER E + 'f' # 0x86 -> LATIN SMALL LETTER F + 'g' # 0x87 -> LATIN SMALL LETTER G + 'h' # 0x88 -> LATIN SMALL LETTER H + 'i' # 0x89 -> LATIN SMALL LETTER I + '\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + '\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) + '\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE + '\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) + '\xb1' # 0x8F -> PLUS-MINUS SIGN + '\xb0' # 0x90 -> DEGREE SIGN + 'j' # 0x91 -> LATIN SMALL LETTER J + 'k' # 0x92 -> LATIN SMALL LETTER K + 'l' # 0x93 -> LATIN SMALL LETTER L + 'm' # 0x94 -> LATIN SMALL LETTER M + 'n' # 0x95 -> LATIN SMALL LETTER N + 'o' # 0x96 -> LATIN SMALL LETTER O + 'p' # 0x97 -> LATIN SMALL LETTER P + 'q' # 0x98 -> LATIN SMALL LETTER Q + 'r' # 0x99 -> LATIN SMALL LETTER R + '\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR + '\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR + '\xe6' # 0x9C -> LATIN SMALL LIGATURE AE + '\xb8' # 0x9D -> CEDILLA + '\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE + '\u20ac' # 0x9F -> EURO SIGN + '\xb5' # 0xA0 -> MICRO SIGN + '~' # 0xA1 -> TILDE + 's' # 0xA2 -> LATIN SMALL LETTER S + 't' # 0xA3 -> LATIN SMALL LETTER T + 'u' # 0xA4 -> LATIN SMALL LETTER U + 'v' # 0xA5 -> LATIN SMALL LETTER V + 'w' # 0xA6 -> LATIN SMALL LETTER W + 'x' # 0xA7 -> LATIN SMALL LETTER X + 'y' # 0xA8 -> LATIN SMALL LETTER Y + 'z' # 0xA9 -> LATIN SMALL LETTER Z + '\xa1' # 0xAA -> INVERTED EXCLAMATION MARK + '\xbf' # 0xAB -> INVERTED QUESTION MARK + '\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) + '\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE + '\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) + '\xae' # 0xAF -> REGISTERED SIGN + '^' # 0xB0 -> CIRCUMFLEX ACCENT + '\xa3' # 0xB1 -> POUND SIGN + '\xa5' # 0xB2 -> YEN SIGN + '\xb7' # 0xB3 -> MIDDLE DOT + '\xa9' # 0xB4 -> COPYRIGHT SIGN + '\xa7' # 0xB5 -> SECTION SIGN + '\xb6' # 0xB6 -> PILCROW SIGN + '\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER + '\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF + '\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS + '[' # 0xBA -> LEFT SQUARE BRACKET + ']' # 0xBB -> RIGHT SQUARE BRACKET + '\xaf' # 0xBC -> MACRON + '\xa8' # 0xBD -> DIAERESIS + '\xb4' # 0xBE -> ACUTE ACCENT + '\xd7' # 0xBF -> MULTIPLICATION SIGN + '{' # 0xC0 -> LEFT CURLY BRACKET + 'A' # 0xC1 -> LATIN CAPITAL LETTER A + 'B' # 0xC2 -> LATIN CAPITAL LETTER B + 'C' # 0xC3 -> LATIN CAPITAL LETTER C + 'D' # 0xC4 -> LATIN CAPITAL LETTER D + 'E' # 0xC5 -> LATIN CAPITAL LETTER E + 'F' # 0xC6 -> LATIN CAPITAL LETTER F + 'G' # 0xC7 -> LATIN CAPITAL LETTER G + 'H' # 0xC8 -> LATIN CAPITAL LETTER H + 'I' # 0xC9 -> LATIN CAPITAL LETTER I + '\xad' # 0xCA -> SOFT HYPHEN + '\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX + '\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS + '\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE + '\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE + '\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE + '}' # 0xD0 -> RIGHT CURLY BRACKET + 'J' # 0xD1 -> LATIN CAPITAL LETTER J + 'K' # 0xD2 -> LATIN CAPITAL LETTER K + 'L' # 0xD3 -> LATIN CAPITAL LETTER L + 'M' # 0xD4 -> LATIN CAPITAL LETTER M + 'N' # 0xD5 -> LATIN CAPITAL LETTER N + 'O' # 0xD6 -> LATIN CAPITAL LETTER O + 'P' # 0xD7 -> LATIN CAPITAL LETTER P + 'Q' # 0xD8 -> LATIN CAPITAL LETTER Q + 'R' # 0xD9 -> LATIN CAPITAL LETTER R + '\xb9' # 0xDA -> SUPERSCRIPT ONE + '\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX + '\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS + '\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE + '\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE + '\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS + '\\' # 0xE0 -> REVERSE SOLIDUS + '\xf7' # 0xE1 -> DIVISION SIGN + 'S' # 0xE2 -> LATIN CAPITAL LETTER S + 'T' # 0xE3 -> LATIN CAPITAL LETTER T + 'U' # 0xE4 -> LATIN CAPITAL LETTER U + 'V' # 0xE5 -> LATIN CAPITAL LETTER V + 'W' # 0xE6 -> LATIN CAPITAL LETTER W + 'X' # 0xE7 -> LATIN CAPITAL LETTER X + 'Y' # 0xE8 -> LATIN CAPITAL LETTER Y + 'Z' # 0xE9 -> LATIN CAPITAL LETTER Z + '\xb2' # 0xEA -> SUPERSCRIPT TWO + '\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX + '\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS + '\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE + '\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE + '\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE + '0' # 0xF0 -> DIGIT ZERO + '1' # 0xF1 -> DIGIT ONE + '2' # 0xF2 -> DIGIT TWO + '3' # 0xF3 -> DIGIT THREE + '4' # 0xF4 -> DIGIT FOUR + '5' # 0xF5 -> DIGIT FIVE + '6' # 0xF6 -> DIGIT SIX + '7' # 0xF7 -> DIGIT SEVEN + '8' # 0xF8 -> DIGIT EIGHT + '9' # 0xF9 -> DIGIT NINE + '\xb3' # 0xFA -> SUPERSCRIPT THREE + '\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX + '\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS + '\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE + '\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE + '\x9f' # 0xFF -> CONTROL +) + +### Encoding table +encoding_table=codecs.charmap_build(decoding_table) diff --git a/shared/package-files/33/337a6cb8a6ad73778ae86eca55f3e17bb35f20ae095bf6d675c1d389fafd03d4/blob b/shared/package-files/33/337a6cb8a6ad73778ae86eca55f3e17bb35f20ae095bf6d675c1d389fafd03d4/blob new file mode 100644 index 0000000000000000000000000000000000000000..eb9f9390e852de7c696bdcbcb71a18d288a40ab5 --- /dev/null +++ b/shared/package-files/33/337a6cb8a6ad73778ae86eca55f3e17bb35f20ae095bf6d675c1d389fafd03d4/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API adaptive_avg_pool3d_out { + using schema = at::Tensor & (const at::Tensor &, c10::SymIntArrayRef, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::adaptive_avg_pool3d") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "adaptive_avg_pool3d.out(Tensor self, SymInt[3] output_size, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out); +}; + +struct TORCH_API adaptive_avg_pool3d { + using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::adaptive_avg_pool3d") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "adaptive_avg_pool3d(Tensor self, SymInt[3] output_size) -> Tensor") + static at::Tensor call(const at::Tensor & self, c10::SymIntArrayRef output_size); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/33/33807a26d909530e7a50b11646cd64c95114b2ba0dae76f9141abd3a2a00c873/blob b/shared/package-files/33/33807a26d909530e7a50b11646cd64c95114b2ba0dae76f9141abd3a2a00c873/blob new file mode 100644 index 0000000000000000000000000000000000000000..3269ae62a023ff0cf9fdc55122cb6e7c8d2ba319 --- /dev/null +++ b/shared/package-files/33/33807a26d909530e7a50b11646cd64c95114b2ba0dae76f9141abd3a2a00c873/blob @@ -0,0 +1,103 @@ +import networkx as nx +from networkx.utils import pairwise + + +class TestVoronoiCells: + """Unit tests for the Voronoi cells function.""" + + def test_isolates(self): + """Tests that a graph with isolated nodes has all isolates in + one block of the partition. + + """ + G = nx.empty_graph(5) + cells = nx.voronoi_cells(G, {0, 2, 4}) + expected = {0: {0}, 2: {2}, 4: {4}, "unreachable": {1, 3}} + assert expected == cells + + def test_undirected_unweighted(self): + G = nx.cycle_graph(6) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0, 1, 5}, 3: {2, 3, 4}} + assert expected == cells + + def test_directed_unweighted(self): + # This is the singly-linked directed cycle graph on six nodes. + G = nx.DiGraph(pairwise(range(6), cyclic=True)) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0, 1, 2}, 3: {3, 4, 5}} + assert expected == cells + + def test_directed_inward(self): + """Tests that reversing the graph gives the "inward" Voronoi + partition. + + """ + # This is the singly-linked reverse directed cycle graph on six nodes. + G = nx.DiGraph(pairwise(range(6), cyclic=True)) + G = G.reverse(copy=False) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0, 4, 5}, 3: {1, 2, 3}} + assert expected == cells + + def test_undirected_weighted(self): + edges = [(0, 1, 10), (1, 2, 1), (2, 3, 1)] + G = nx.Graph() + G.add_weighted_edges_from(edges) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0}, 3: {1, 2, 3}} + assert expected == cells + + def test_directed_weighted(self): + edges = [(0, 1, 10), (1, 2, 1), (2, 3, 1), (3, 2, 1), (2, 1, 1)] + G = nx.DiGraph() + G.add_weighted_edges_from(edges) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0}, 3: {1, 2, 3}} + assert expected == cells + + def test_multigraph_unweighted(self): + """Tests that the Voronoi cells for a multigraph are the same as + for a simple graph. + + """ + edges = [(0, 1), (1, 2), (2, 3)] + G = nx.MultiGraph(2 * edges) + H = nx.Graph(G) + G_cells = nx.voronoi_cells(G, {0, 3}) + H_cells = nx.voronoi_cells(H, {0, 3}) + assert G_cells == H_cells + + def test_multidigraph_unweighted(self): + # This is the twice-singly-linked directed cycle graph on six nodes. + edges = list(pairwise(range(6), cyclic=True)) + G = nx.MultiDiGraph(2 * edges) + H = nx.DiGraph(G) + G_cells = nx.voronoi_cells(G, {0, 3}) + H_cells = nx.voronoi_cells(H, {0, 3}) + assert G_cells == H_cells + + def test_multigraph_weighted(self): + edges = [(0, 1, 10), (0, 1, 10), (1, 2, 1), (1, 2, 100), (2, 3, 1), (2, 3, 100)] + G = nx.MultiGraph() + G.add_weighted_edges_from(edges) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0}, 3: {1, 2, 3}} + assert expected == cells + + def test_multidigraph_weighted(self): + edges = [ + (0, 1, 10), + (0, 1, 10), + (1, 2, 1), + (2, 3, 1), + (3, 2, 10), + (3, 2, 1), + (2, 1, 10), + (2, 1, 1), + ] + G = nx.MultiDiGraph() + G.add_weighted_edges_from(edges) + cells = nx.voronoi_cells(G, {0, 3}) + expected = {0: {0}, 3: {1, 2, 3}} + assert expected == cells diff --git a/shared/package-files/33/3380b234b890a10e6886800c1f91c44bd461da5a6bc80335b682fe6f54c95e3d/blob b/shared/package-files/33/3380b234b890a10e6886800c1f91c44bd461da5a6bc80335b682fe6f54c95e3d/blob new file mode 100644 index 0000000000000000000000000000000000000000..ba8a4f1d0ee7adb668c6b0ac49b2360d3c0dc356 --- /dev/null +++ b/shared/package-files/33/3380b234b890a10e6886800c1f91c44bd461da5a6bc80335b682fe6f54c95e3d/blob @@ -0,0 +1,31 @@ +from pandas.core.indexers.utils import ( + check_array_indexer, + check_key_length, + check_setitem_lengths, + disallow_ndim_indexing, + is_empty_indexer, + is_list_like_indexer, + is_scalar_indexer, + is_valid_positional_slice, + length_of_indexer, + maybe_convert_indices, + unpack_1tuple, + unpack_tuple_and_ellipses, + validate_indices, +) + +__all__ = [ + "is_valid_positional_slice", + "is_list_like_indexer", + "is_scalar_indexer", + "is_empty_indexer", + "check_setitem_lengths", + "validate_indices", + "maybe_convert_indices", + "length_of_indexer", + "disallow_ndim_indexing", + "unpack_1tuple", + "check_key_length", + "check_array_indexer", + "unpack_tuple_and_ellipses", +] diff --git a/shared/package-files/33/3383fdde3d766473dd41a90762e719761abcfeee1b20e1fe5037a5c98b757396/blob b/shared/package-files/33/3383fdde3d766473dd41a90762e719761abcfeee1b20e1fe5037a5c98b757396/blob new file mode 100644 index 0000000000000000000000000000000000000000..6915203566469cfaf7170d87894ce03cc8348dd5 --- /dev/null +++ b/shared/package-files/33/3383fdde3d766473dd41a90762e719761abcfeee1b20e1fe5037a5c98b757396/blob @@ -0,0 +1,52 @@ +import multiprocessing.pool +import multiprocessing.util as util + +from .queue import SimpleQueue + + +def clean_worker(*args, **kwargs): + import gc + + multiprocessing.pool.worker(*args, **kwargs) + # Regular multiprocessing workers don't fully clean up after themselves, + # so we have to explicitly trigger garbage collection to make sure that all + # destructors are called... + gc.collect() + + +class Pool(multiprocessing.pool.Pool): + """Pool implementation which uses our version of SimpleQueue. + + This lets us pass tensors in shared memory across processes instead of + serializing the underlying data. + """ + + def _setup_queues(self): + self._inqueue = SimpleQueue() + self._outqueue = SimpleQueue() + self._quick_put = self._inqueue._writer.send + self._quick_get = self._outqueue._reader.recv + + def _repopulate_pool(self): + """Increase the number of pool processes to the specified number. + + Bring the number of pool processes up to the specified number, for use after + reaping workers which have exited. + """ + for i in range(self._processes - len(self._pool)): + # changed worker -> clean_worker + args = ( + self._inqueue, + self._outqueue, + self._initializer, + self._initargs, + self._maxtasksperchild, + ) + if hasattr(self, "_wrap_exception"): + args += (self._wrap_exception,) + w = self.Process(target=clean_worker, args=args) + self._pool.append(w) + w.name = w.name.replace("Process", "PoolWorker") + w.daemon = True + w.start() + util.debug("added worker") diff --git a/shared/package-files/33/33846b3e701436825087285e86619583c7cda17610c974be1ed59c785af2744d/blob b/shared/package-files/33/33846b3e701436825087285e86619583c7cda17610c974be1ed59c785af2744d/blob new file mode 100644 index 0000000000000000000000000000000000000000..c01b4245ff9e39259c1d1e3fc4d0aeb35fbc19ab --- /dev/null +++ b/shared/package-files/33/33846b3e701436825087285e86619583c7cda17610c974be1ed59c785af2744d/blob @@ -0,0 +1,338 @@ +""" +Penalty classes for Generalized Additive Models + +Author: Luca Puggini +Author: Josef Perktold + +""" + +import numpy as np +from scipy.linalg import block_diag + +from statsmodels.base._penalties import Penalty +from statsmodels.tools.sm_exceptions import ModelWarning + + +class UnivariateGamPenalty(Penalty): + """ + Penalty for smooth term in Generalized Additive Models + + Parameters + ---------- + univariate_smoother : instance + instance of univariate smoother or spline class + alpha : float, optional + default penalty weight, alpha can be provided to each method + weights : array_like, optional + Not used and not verified, might be removed. + + Attributes + ---------- + univariate_smoother : instance + instance of univariate smoother or spline class + alpha : float + default penalty weight, alpha can be provided to each method + weights : array_like + Not used and not verified, might be removed. + nobs : int + The number of samples used during the estimation. + n_columns : int + Number of columns in smoother basis. + """ + + def __init__(self, univariate_smoother, alpha=1, weights=1): + self.weights = weights + self.alpha = alpha + self.univariate_smoother = univariate_smoother + self.nobs = self.univariate_smoother.nobs + self.n_columns = self.univariate_smoother.dim_basis + + def func(self, params, alpha=None): + """ + Evaluate penalization at params + + Parameters + ---------- + params : ndarray + coefficients for the spline basis in the regression model + alpha : float, optional + default penalty weight + + Returns + ------- + func : float + value of the penalty evaluated at params + """ + if alpha is None: + alpha = self.alpha + + f = params.dot(self.univariate_smoother.cov_der2.dot(params)) + return alpha * f / self.nobs + + def deriv(self, params, alpha=None): + """ + Evaluate derivative of penalty with respect to params + + Parameters + ---------- + params : ndarray + coefficients for the spline basis in the regression model + alpha : float, optional + default penalty weight + + Returns + ------- + deriv : ndarray + derivative, gradient of the penalty with respect to params + """ + if alpha is None: + alpha = self.alpha + + d = 2 * alpha * np.dot(self.univariate_smoother.cov_der2, params) + d /= self.nobs + return d + + def deriv2(self, params, alpha=None): + """ + Evaluate second derivative of penalty with respect to params + + Parameters + ---------- + params : ndarray + coefficients for the spline basis in the regression model + alpha : float, optional + default penalty weight + + Returns + ------- + deriv2 : ndarray, 2-Dim + second derivative, hessian of the penalty with respect to params + """ + if alpha is None: + alpha = self.alpha + + d2 = 2 * alpha * self.univariate_smoother.cov_der2 + d2 /= self.nobs + return d2 + + def penalty_matrix(self, alpha=None): + """ + Penalty matrix for the smooth term of a GAM + + Parameters + ---------- + alpha : float, optional + penalty weight + + Returns + ------- + penalty_matrix : ndarray + square penalty matrix for quadratic penalization. The number + of rows and columns are equal to the number of columns in the + smooth terms, i.e., the number of parameters for this smooth + term in the regression model + """ + if alpha is None: + alpha = self.alpha + + return alpha * self.univariate_smoother.cov_der2 + + +class MultivariateGamPenalty(Penalty): + """ + Penalty for Generalized Additive Models + + Parameters + ---------- + multivariate_smoother : instance + instance of additive smoother or spline class + alpha : list of float + default penalty weight, list with length equal to the number of smooth + terms. ``alpha`` can also be provided to each method. + weights : array_like, optional + currently not used + is a list of doubles of the same length as alpha or a list + of ndarrays where each component has the length equal to the number + of columns in that component + start_idx : int, optional + number of parameters that come before the smooth terms. If the model + has a linear component, then the parameters for the smooth components + start at ``start_index``. + + Attributes + ---------- + multivariate_smoother : instance + instance of additive smoother or spline class + alpha : list of float + default penalty weight, list with length equal to the number of smooth + terms + weights : array_like + currently not used + start_idx : int + number of parameters that come before the smooth terms + nobs : int + The number of samples used during the estimation. + dim_basis : int + number of columns of additive smoother. Number of columns + in all smoothers. + k_variables : int + number of smooth terms + k_params : int + total number of parameters in the regression model + """ + + def __init__(self, multivariate_smoother, alpha, weights=None, start_idx=0): + + if len(multivariate_smoother.smoothers) != len(alpha): + msg = ( + "all the input values should be of the same length." + f" len(smoothers)={len(multivariate_smoother.smoothers):d}, len(alphas)={len(alpha):d}" + ) + raise ValueError(msg) + + self.multivariate_smoother = multivariate_smoother + self.dim_basis = self.multivariate_smoother.dim_basis + self.k_variables = self.multivariate_smoother.k_variables + self.nobs = self.multivariate_smoother.nobs + self.alpha = alpha + self.start_idx = start_idx + self.k_params = start_idx + self.dim_basis + + # TODO: Review this, + if weights is None: + # weights should have total length as params + # but it can also be scalar in individual component + self.weights = [1.0 for _ in range(self.k_variables)] + else: + import warnings + + warnings.warn("weights is currently ignored", ModelWarning, stacklevel=2) + self.weights = weights + + self.mask = [ + np.zeros(self.k_params, dtype=bool) for _ in range(self.k_variables) + ] + param_count = start_idx + for i, smoother in enumerate(self.multivariate_smoother.smoothers): + # the mask[i] contains a vector of length k_columns. The index + # corresponding to the i-th input variable are set to True. + self.mask[i][param_count : param_count + smoother.dim_basis] = True + param_count += smoother.dim_basis + + self.gp = [] + for i in range(self.k_variables): + gp = UnivariateGamPenalty( + self.multivariate_smoother.smoothers[i], + weights=self.weights[i], + alpha=self.alpha[i], + ) + self.gp.append(gp) + + def func(self, params, alpha=None): + """ + Evaluate penalization at params + + Parameters + ---------- + params : ndarray + coefficients in the regression model + alpha : list of float, optional + penalty weights + + Returns + ------- + func : float + value of the penalty evaluated at params + """ + if alpha is None: + alpha = [None] * self.k_variables + + cost = 0 + for i in range(self.k_variables): + params_i = params[self.mask[i]] + cost += self.gp[i].func(params_i, alpha=alpha[i]) + + return cost + + def deriv(self, params, alpha=None): + """ + Evaluate derivative of penalty with respect to params + + Parameters + ---------- + params : ndarray + coefficients in the regression model + alpha : list of float, optional + penalty weights + + Returns + ------- + deriv : ndarray + derivative, gradient of the penalty with respect to params + """ + if alpha is None: + alpha = [None] * self.k_variables + + grad = [np.zeros(self.start_idx)] + for i in range(self.k_variables): + params_i = params[self.mask[i]] + grad.append(self.gp[i].deriv(params_i, alpha=alpha[i])) + + return np.concatenate(grad) + + def deriv2(self, params, alpha=None): + """ + Evaluate second derivative of penalty with respect to params + + Parameters + ---------- + params : ndarray + coefficients in the regression model + alpha : list of float, optional + penalty weights + + Returns + ------- + deriv2 : ndarray, 2-Dim + second derivative, hessian of the penalty with respect to params + """ + if alpha is None: + alpha = [None] * self.k_variables + + deriv2 = [np.zeros((self.start_idx, self.start_idx))] + for i in range(self.k_variables): + params_i = params[self.mask[i]] + deriv2.append(self.gp[i].deriv2(params_i, alpha=alpha[i])) + + return block_diag(*deriv2) + + def penalty_matrix(self, alpha=None): + """ + Penalty matrix for generalized additive model + + Parameters + ---------- + alpha : list of float, optional + penalty weights + + Returns + ------- + penalty_matrix : ndarray + block diagonal, square penalty matrix for quadratic penalization. + The number of rows and columns are equal to the number of + parameters in the regression model ``k_params``. + + Notes + ----- + statsmodels does not support backwards compatibility when keywords are + used as positional arguments. The order of keywords might change. + We might need to add a ``params`` keyword if the need arises. + """ + if alpha is None: + alpha = self.alpha + + s_all = [np.zeros((self.start_idx, self.start_idx))] + for i in range(self.k_variables): + s_all.append(self.gp[i].penalty_matrix(alpha=alpha[i])) + + return block_diag(*s_all) diff --git a/shared/package-files/33/3386c0928c55014831a9a8b94b4fe20874b911c3513c15fff7395d56a14b57dd/blob b/shared/package-files/33/3386c0928c55014831a9a8b94b4fe20874b911c3513c15fff7395d56a14b57dd/blob new file mode 100644 index 0000000000000000000000000000000000000000..31d1e26ffb99763af367d07c30fd77770103dc79 --- /dev/null +++ b/shared/package-files/33/3386c0928c55014831a9a8b94b4fe20874b911c3513c15fff7395d56a14b57dd/blob @@ -0,0 +1,20 @@ +from ctypes import c_int, c_char_p, POINTER +from llvmlite.binding import ffi + + +def link_modules(dst, src): + with ffi.OutputString() as outerr: + err = ffi.lib.LLVMPY_LinkModules(dst, src, outerr) + # The underlying module was destroyed + src.detach() + if err: + raise RuntimeError(str(outerr)) + + +ffi.lib.LLVMPY_LinkModules.argtypes = [ + ffi.LLVMModuleRef, + ffi.LLVMModuleRef, + POINTER(c_char_p), +] + +ffi.lib.LLVMPY_LinkModules.restype = c_int diff --git a/shared/package-files/33/3386fdffb3cab0eef80e1b08045a13001e48f7d857ae5049723c60856848f2f7/blob b/shared/package-files/33/3386fdffb3cab0eef80e1b08045a13001e48f7d857ae5049723c60856848f2f7/blob new file mode 100644 index 0000000000000000000000000000000000000000..e60507e0b65aad77537fb38f1ba5dfec13095a53 --- /dev/null +++ b/shared/package-files/33/3386fdffb3cab0eef80e1b08045a13001e48f7d857ae5049723c60856848f2f7/blob @@ -0,0 +1,17 @@ +from abc import abstractmethod +from distutils.cmd import Command +from typing import ClassVar, List, Optional, Tuple + +DEFAULT_PYPIRC: str + +class PyPIRCCommand(Command): + DEFAULT_REPOSITORY: ClassVar[str] + DEFAULT_REALM: ClassVar[str] + repository: None + realm: None + user_options: ClassVar[List[Tuple[str, Optional[str], str]]] + boolean_options: ClassVar[List[str]] + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + @abstractmethod + def run(self) -> None: ... diff --git a/shared/package-files/33/3389135aa69241a57500c8722d2be6c2804917b5fd89cac82dbbd0270a7de348/blob b/shared/package-files/33/3389135aa69241a57500c8722d2be6c2804917b5fd89cac82dbbd0270a7de348/blob new file mode 100644 index 0000000000000000000000000000000000000000..1ab8353464ddb93947f871f07cfd12540373269c Binary files /dev/null and b/shared/package-files/33/3389135aa69241a57500c8722d2be6c2804917b5fd89cac82dbbd0270a7de348/blob differ diff --git a/shared/package-files/33/338aeb61daafcccf87d2a49db0ee7d3be964639ecda3823a10d488f4c926f8be/blob b/shared/package-files/33/338aeb61daafcccf87d2a49db0ee7d3be964639ecda3823a10d488f4c926f8be/blob new file mode 100644 index 0000000000000000000000000000000000000000..0a7675c2860154b74817d55e3ecc269052e0c8f1 --- /dev/null +++ b/shared/package-files/33/338aeb61daafcccf87d2a49db0ee7d3be964639ecda3823a10d488f4c926f8be/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor kron(const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & kron_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other); +TORCH_API at::Tensor & kron_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/33/338ec0f8a15aae073d3f16547aed33a9a66c21aa405785e126a8ff3f6207b3d8/blob b/shared/package-files/33/338ec0f8a15aae073d3f16547aed33a9a66c21aa405785e126a8ff3f6207b3d8/blob new file mode 100644 index 0000000000000000000000000000000000000000..7b0f527e73eb61fe4a9fa7d7d86ea467f9ae8a9e --- /dev/null +++ b/shared/package-files/33/338ec0f8a15aae073d3f16547aed33a9a66c21aa405785e126a8ff3f6207b3d8/blob @@ -0,0 +1,82 @@ +from dataclasses import dataclass +from typing import Callable, Dict + +import torch +import torchaudio + +from ._vggish_impl import _SAMPLE_RATE, VGGish as _VGGish, VGGishInputProcessor as _VGGishInputProcessor + + +def _get_state_dict(): + path = torchaudio.utils.download_asset("models/vggish.pt") + return torch.load(path) + + +@dataclass +class VGGishBundle: + """VGGish :cite:`45611` inference pipeline ported from + `torchvggish `__ + and `tensorflow-models `__. + + Example: + >>> import torchaudio + >>> from torchaudio.prototype.pipelines import VGGISH + >>> + >>> input_sr = VGGISH.sample_rate + >>> input_proc = VGGISH.get_input_processor() + >>> model = VGGISH.get_model() + >>> + >>> waveform, sr = torchaudio.load( + >>> "Chopin_Ballade_-1_In_G_Minor,_Op._23.mp3", + >>> ) + >>> waveform = waveform.squeeze(0) + >>> waveform = torchaudio.functional.resample(waveform, sr, input_sr) + >>> mono_output = model(input_proc(waveform)) + """ + + class VGGish(_VGGish): + __doc__ = _VGGish.__doc__ + + class VGGishInputProcessor(_VGGishInputProcessor): + __doc__ = _VGGishInputProcessor.__doc__ + + _state_dict_func: Callable[[], Dict] + + @property + def sample_rate(self) -> int: + """Sample rate of input waveform expected by input processor and model. + + :type: int + """ + return _SAMPLE_RATE + + def get_model(self) -> VGGish: + """Constructs pre-trained VGGish model. Downloads and caches weights as necessary. + + Returns: + VGGish: VGGish model with pre-trained weights loaded. + """ + model = self.VGGish() + state_dict = self._state_dict_func() + model.load_state_dict(state_dict) + model.eval() + return model + + def get_input_processor(self) -> VGGishInputProcessor: + """Constructs input processor for VGGish. + + Returns: + VGGishInputProcessor: input processor for VGGish. + """ + return self.VGGishInputProcessor() + + +VGGISH = VGGishBundle(_get_state_dict) +VGGISH.__doc__ = """Pre-trained VGGish :cite:`45611` inference pipeline ported from + `torchvggish `__ + and `tensorflow-models `__. + + Per the `documentation `__ + for the original model, the model is "trained on a large YouTube dataset (a preliminary version of + what later became YouTube-8M)". + """ diff --git a/shared/package-files/33/3391fd30bf227db58c7df708d66c9fee23f8f6f20c0e7fa098b137093cc40463/blob b/shared/package-files/33/3391fd30bf227db58c7df708d66c9fee23f8f6f20c0e7fa098b137093cc40463/blob new file mode 100644 index 0000000000000000000000000000000000000000..c9314e25018d1bb94b19f189b4ad40d84ae4f25f Binary files /dev/null and b/shared/package-files/33/3391fd30bf227db58c7df708d66c9fee23f8f6f20c0e7fa098b137093cc40463/blob differ diff --git a/shared/package-files/33/3393c9a147fe79d24935d0361fbdec3994efa8aaf7dd6858500a30fcb05aa003/blob b/shared/package-files/33/3393c9a147fe79d24935d0361fbdec3994efa8aaf7dd6858500a30fcb05aa003/blob new file mode 100644 index 0000000000000000000000000000000000000000..c28c651297d572452582d0f37ded4f3a36cf6e41 --- /dev/null +++ b/shared/package-files/33/3393c9a147fe79d24935d0361fbdec3994efa8aaf7dd6858500a30fcb05aa003/blob @@ -0,0 +1,756 @@ +import itertools +import math +import re +import sys +import unittest +import warnings + +import numpy as np + +from numba import njit, types +from numba.tests.support import TestCase +from numba.np import numpy_support +from numba.core.utils import PYVERSION + + +def sin(x): + return math.sin(x) + + +def cos(x): + return math.cos(x) + + +def tan(x): + return math.tan(x) + + +def sinh(x): + return math.sinh(x) + + +def cosh(x): + return math.cosh(x) + + +def tanh(x): + return math.tanh(x) + + +def asin(x): + return math.asin(x) + + +def acos(x): + return math.acos(x) + + +def atan(x): + return math.atan(x) + + +def atan2(y, x): + return math.atan2(y, x) + + +def asinh(x): + return math.asinh(x) + + +def acosh(x): + return math.acosh(x) + + +def atanh(x): + return math.atanh(x) + + +def sqrt(x): + return math.sqrt(x) + + +def npy_sqrt(x): + return np.sqrt(x) + + +def exp(x): + return math.exp(x) + +def exp2(x): + return math.exp2(x) + +def expm1(x): + return math.expm1(x) + + +def log(x): + return math.log(x) + + +def log1p(x): + return math.log1p(x) + + +def log10(x): + return math.log10(x) + + +def log2(x): + return math.log2(x) + + +def floor(x): + return math.floor(x) + + +def ceil(x): + return math.ceil(x) + + +def trunc(x): + return math.trunc(x) + + +def isnan(x): + return math.isnan(x) + + +def isinf(x): + return math.isinf(x) + + +def isfinite(x): + return math.isfinite(x) + + +def hypot(x, y): + return math.hypot(x, y) + + +def nextafter(x, y): + return math.nextafter(x, y) + + +def degrees(x): + return math.degrees(x) + + +def radians(x): + return math.radians(x) + + +def erf(x): + return math.erf(x) + + +def erfc(x): + return math.erfc(x) + + +def gamma(x): + return math.gamma(x) + + +def lgamma(x): + return math.lgamma(x) + + +def pow(x, y): + return math.pow(x, y) + +def gcd(x, y): + return math.gcd(x, y) + +def copysign(x, y): + return math.copysign(x, y) + + +def frexp(x): + return math.frexp(x) + + +def ldexp(x, e): + return math.ldexp(x, e) + + +def frexp_ldexp_roundtrip(x): + m, e = math.frexp(x) + return math.ldexp(m, e) + + +def np_ldexp(x, e): + return np.ldexp(x, e) + + +# IEEE-754 double corners, named for readability in TestFrexpLdexp. +DBL_TRUE_MIN = 5e-324 # smallest positive subnormal +DBL_MIN = 2.2250738585072014e-308 # smallest positive normal +DBL_MAX = 1.7976931348623157e308 + + +def get_constants(): + return math.pi, math.e + + +class TestMathLib(TestCase): + + def test_constants(self): + cfunc = njit(get_constants) + self.assertPreciseEqual(cfunc(), cfunc.py_func()) + + def run_unary(self, pyfunc, x_types, x_values, prec='exact', **kwargs): + cfunc = njit(pyfunc) + for tx, vx in zip(x_types, x_values): + got = cfunc(vx) + expected = pyfunc(vx) + actual_prec = 'single' if tx is types.float32 else prec + msg = 'for input %r' % (vx,) + self.assertPreciseEqual(got, expected, prec=actual_prec, msg=msg, + **kwargs) + + def run_binary(self, pyfunc, x_types, x_values, y_values, prec='exact'): + cfunc = njit(pyfunc) + for ty, x, y in zip(x_types, x_values, y_values): + got = cfunc(x, y) + expected = pyfunc(x, y) + actual_prec = 'single' if ty is types.float32 else prec + msg = 'for inputs (%r, %r)' % (x, y) + self.assertPreciseEqual(got, expected, prec=actual_prec, msg=msg) + + def check_predicate_func(self, pyfunc): + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float32, types.float32, + types.float64, types.float64, types.float64] + x_values = [0, 0, 0, 0, 0, 0, + float('inf'), 0.0, float('nan'), + float('inf'), 0.0, float('nan')] + self.run_unary(pyfunc, x_types, x_values) + + def test_sin(self): + pyfunc = sin + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + @unittest.skipIf(sys.platform == 'win32', + "not exactly equal on win32 (issue #597)") + def test_cos(self): + pyfunc = cos + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + def test_tan(self): + pyfunc = tan + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + def test_sqrt(self): + pyfunc = sqrt + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [2, 1, 2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + def test_npy_sqrt(self): + pyfunc = npy_sqrt + x_values = [2, 1, 2, 2, 1, 2, .1, .2] + # XXX poor precision for int16 inputs + x_types = [types.int16, types.uint16] + self.run_unary(pyfunc, x_types, x_values, prec='single') + x_types = [types.int32, types.int64, + types.uint32, types.uint64, + types.float32, types.float64] + self.run_unary(pyfunc, x_types, x_values) + + def test_exp(self): + pyfunc = exp + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + @unittest.skipUnless(PYVERSION >= (3, 11), "needs Python 3.11+") + def test_exp2(self): + pyfunc = exp2 + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + def test_expm1(self): + pyfunc = expm1 + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + def test_log(self): + pyfunc = log + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 10, 100, 1000, 100000, 1000000, 0.1, 1.1] + self.run_unary(pyfunc, x_types, x_values) + + def test_log1p(self): + pyfunc = log1p + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 10, 100, 1000, 100000, 1000000, 0.1, 1.1] + self.run_unary(pyfunc, x_types, x_values) + + def test_log10(self): + pyfunc = log10 + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 10, 100, 1000, 100000, 1000000, 0.1, 1.1] + self.run_unary(pyfunc, x_types, x_values) + + def test_log2(self): + pyfunc = log2 + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 10, 100, 1000, 100000, 1000000, 0.1, 1.1] + self.run_unary(pyfunc, x_types, x_values) + + def test_asin(self): + pyfunc = asin + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_acos(self): + pyfunc = acos + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_atan(self): + pyfunc = atan + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + self.run_unary(pyfunc, x_types, x_values) + + def test_atan2(self): + pyfunc = atan2 + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + y_values = [x * 2 for x in x_values] + self.run_binary(pyfunc, x_types, x_values, y_values) + + def test_asinh(self): + pyfunc = asinh + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values, prec='double') + + def test_acosh(self): + pyfunc = acosh + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_atanh(self): + pyfunc = atanh + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [0, 0, 0, 0, 0, 0, 0.1, 0.1] + self.run_unary(pyfunc, x_types, x_values, prec='double') + + def test_sinh(self): + pyfunc = sinh + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_cosh(self): + pyfunc = cosh + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_tanh(self): + pyfunc = tanh + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [0, 0, 0, 0, 0, 0, 0.1, 0.1] + self.run_unary(pyfunc, x_types, x_values) + + def test_floor(self): + pyfunc = floor + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [0, 0, 0, 0, 0, 0, 0.1, 1.9] + self.run_unary(pyfunc, x_types, x_values) + + def test_ceil(self): + pyfunc = ceil + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [0, 0, 0, 0, 0, 0, 0.1, 1.9] + self.run_unary(pyfunc, x_types, x_values) + + def test_trunc(self): + pyfunc = trunc + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [0, 0, 0, 0, 0, 0, 0.1, 1.9] + self.run_unary(pyfunc, x_types, x_values) + + def test_isnan(self): + self.check_predicate_func(isnan) + + def test_isinf(self): + self.check_predicate_func(isinf) + + def test_isfinite(self): + self.check_predicate_func(isfinite) + + def test_hypot(self): + pyfunc = hypot + x_types = [types.int64, types.uint64, + types.float32, types.float64] + x_values = [1, 2, 3, 4, 5, 6, .21, .34] + y_values = [x + 2 for x in x_values] + # Issue #563: precision issues with math.hypot() under Windows. + prec = 'single' + self.run_binary(pyfunc, x_types, x_values, y_values, prec) + # Check that values that overflow in naive implementations do not + # in the numba impl + + def naive_hypot(x, y): + return math.sqrt(x * x + y * y) + + cfunc = njit(pyfunc) + for fltty in (types.float32, types.float64): + dt = numpy_support.as_dtype(fltty).type + val = dt(np.finfo(dt).max / 30.) + nb_ans = cfunc(val, val) + self.assertPreciseEqual(nb_ans, pyfunc(val, val), prec='single') + self.assertTrue(np.isfinite(nb_ans)) + + with warnings.catch_warnings(): + warnings.simplefilter("error", RuntimeWarning) + self.assertRaisesRegex(RuntimeWarning, + 'overflow encountered in .*scalar', + naive_hypot, val, val) + + def test_nextafter(self): + pyfunc = nextafter + x_types = [types.float32, types.float64, + types.int32, types.int64, + types.uint32, types.uint64] + x_values = [0.0, .21, .34, 1005382.042, -25.328] + y1_values = [x + 2 for x in x_values] + y2_values = [x - 2 for x in x_values] + + self.run_binary(pyfunc, x_types, x_values, y1_values) + self.run_binary(pyfunc, x_types, x_values, y2_values) + + # Test using pos/neg inf + self.run_binary(pyfunc, x_types, [0.0, -.5, .5], [math.inf]*3) + self.run_binary(pyfunc, x_types, [0.0, -.5, .5], [-math.inf]*3) + + # if both args to nextafter are equal, then it is returned unchanged. + self.run_binary(pyfunc, x_types, x_values, x_values) + + def test_degrees(self): + pyfunc = degrees + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_radians(self): + pyfunc = radians + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [1, 1, 1, 1, 1, 1, 1., 1.] + self.run_unary(pyfunc, x_types, x_values) + + def test_erf(self): + pyfunc = erf + x_values = [1., 1., -1., -0.0, 0.0, 0.5, 5, float('inf')] + x_types = [types.float32, types.float64] * (len(x_values) // 2) + self.run_unary(pyfunc, x_types, x_values, prec='double', ulps=2) + + def test_erfc(self): + pyfunc = erfc + x_values = [1., 1., -1., -0.0, 0.0, 0.5, 5, float('inf')] + x_types = [types.float32, types.float64] * (len(x_values) // 2) + self.run_unary(pyfunc, x_types, x_values, prec='double', ulps=4) + + def test_gamma(self): + pyfunc = gamma + x_values = [1., -0.9, -0.5, 0.5] + x_types = [types.float32, types.float64] * (len(x_values) // 2) + self.run_unary(pyfunc, x_types, x_values, prec='double', ulps=3) + x_values = [-0.1, 0.1, 2.5, 10.1, 50., float('inf')] + x_types = [types.float64] * len(x_values) + self.run_unary(pyfunc, x_types, x_values, prec='double', ulps=8) + + def test_lgamma(self): + pyfunc = lgamma + x_values = [1., -0.9, -0.1, 0.1, 200., 1e10, 1e30, float('inf')] + x_types = [types.float32, types.float64] * (len(x_values) // 2) + self.run_unary(pyfunc, x_types, x_values, prec='double') + + def test_pow(self): + pyfunc = pow + x_types = [types.int16, types.int32, types.int64, + types.uint16, types.uint32, types.uint64, + types.float32, types.float64] + x_values = [-2, -1, -2, 2, 1, 2, .1, .2] + y_values = [x * 2 for x in x_values] + self.run_binary(pyfunc, x_types, x_values, y_values) + + def test_gcd(self): + from itertools import product, repeat, chain + pyfunc = gcd + signed_args = product( + sorted(types.signed_domain), *repeat((-2, -1, 0, 1, 2, 7, 10), 2) + ) + unsigned_args = product( + sorted(types.unsigned_domain), *repeat((0, 1, 2, 7, 9, 16), 2) + ) + x_types, x_values, y_values = zip(*chain(signed_args, unsigned_args)) + self.run_binary(pyfunc, x_types, x_values, y_values) + + def test_copysign(self): + pyfunc = copysign + value_types = [types.float32, types.float64] + values = [-2, -1, -0.0, 0.0, 1, 2, float('-inf'), float('inf'), + float('nan')] + x_types, x_values, y_values = list(zip( + *itertools.product(value_types, values, values))) + self.run_binary(pyfunc, x_types, x_values, y_values) + + def test_frexp(self): + pyfunc = frexp + x_types = [types.float32, types.float64] + x_values = [-2.5, -0.0, 0.0, 3.5, + float('-inf'), float('inf'), float('nan')] + self.run_unary(pyfunc, x_types, x_values, prec='exact') + + def test_ldexp(self): + pyfunc = ldexp + cfunc = njit(pyfunc) + for fltty in (types.float32, types.float64): + for args in [(2.5, -2), (2.5, 1), (0.0, 0), (0.0, 1), + (-0.0, 0), (-0.0, 1), + (float('inf'), 0), (float('-inf'), 0), + (float('nan'), 0)]: + msg = 'for input %r' % (args,) + self.assertPreciseEqual(cfunc(*args), pyfunc(*args)) + + +class TestFrexpLdexp(TestCase): + def test_frexp_wide_range(self): + pyfunc = frexp + cfunc = njit(pyfunc) + x_values = [1.0, -1.0, 0.5, -0.5, 2.5, -2.5, math.pi, + 123456789.0, 1e300, -1e300, 1e-300, + DBL_MIN, -DBL_MIN, DBL_TRUE_MIN, -DBL_TRUE_MIN, + DBL_MAX, -DBL_MAX, + 0.0, -0.0, float('inf'), float('-inf'), float('nan')] + for x in x_values: + self.assertPreciseEqual(cfunc(x), pyfunc(x), + msg='for input %r' % (x,)) + + def test_frexp_exponent_over_full_double_range(self): + # Walk every exponent a double can produce, subnormals included. + cfunc = njit(frexp) + for e in range(-1073, 1025): + x = math.ldexp(0.75, e) + if x == 0.0 or math.isinf(x): + continue + self.assertEqual(cfunc(x)[1], math.frexp(x)[1], + msg='for exponent %d' % (e,)) + + def test_frexp_float32(self): + # Exercises the float32 helper, numba_frexpf. + cfunc = njit(frexp) + for v in [1.0, -1.0, 2.5, -2.5, 0.5, 1e30, -1e30, 1e-30, + 0.0, -0.0, float('inf'), float('-inf'), float('nan')]: + x = np.float32(v) + got_m, got_e = cfunc(x) + expected_m, expected_e = math.frexp(float(x)) + self.assertPreciseEqual(got_m, np.float32(expected_m), + msg='mantissa for input %r' % (v,)) + self.assertEqual(got_e, expected_e, + msg='exponent for input %r' % (v,)) + + def test_ldexp_normal_range(self): + pyfunc = ldexp + cfunc = njit(pyfunc) + x_values = [1.0, -1.0, 0.5, -0.5, 2.5, -2.5, math.pi, -math.pi, + 0.7071067811865476, 1.9999999999999998, 1e100, 1e-100] + exponents = [-200, -64, -53, -10, -3, -1, 0, 1, 3, 10, 53, 64, 200] + for x in x_values: + for n in exponents: + self.assertPreciseEqual(cfunc(x, n), pyfunc(x, n), + msg='for input (%r, %r)' % (x, n)) + + def test_ldexp_special_values(self): + pyfunc = ldexp + cfunc = njit(pyfunc) + for x in [0.0, -0.0, float('inf'), float('-inf'), float('nan')]: + for n in [-1000, -1, 0, 1, 1000]: + self.assertPreciseEqual(cfunc(x, n), pyfunc(x, n), + msg='for input (%r, %r)' % (x, n)) + + def test_ldexp_overflows_to_inf(self): + # Numba saturates like C's ldexp; CPython raises OverflowError. + # Pin that intentional divergence. + cfunc = njit(ldexp) + for x in [1.0, -1.0, DBL_MAX, -DBL_MAX]: + for n in [1200, 2000, 2100, 2101, 100000, 2 ** 31 - 1]: + self.assertPreciseEqual(cfunc(x, n), + math.copysign(float('inf'), x), + msg='for input (%r, %r)' % (x, n)) + with self.assertRaises(OverflowError): + math.ldexp(x, n) + + def test_ldexp_underflows_to_signed_zero(self): + cfunc = njit(ldexp) + for x in [1.0, -1.0, DBL_MIN, -DBL_MIN, DBL_TRUE_MIN, -DBL_TRUE_MIN]: + for n in [-1200, -2000, -2100, -2101, -100000, -(2 ** 31)]: + self.assertPreciseEqual(cfunc(x, n), math.copysign(0.0, x), + msg='for input (%r, %r)' % (x, n)) + + def test_ldexp_huge_exponent_saturates(self): + # An exponent large enough to cross the entire double range must + # saturate rather than return a finite, wrong value. + cfunc = njit(ldexp) + self.assertPreciseEqual(cfunc(DBL_TRUE_MIN, 2100), float('inf')) + self.assertPreciseEqual(cfunc(-DBL_TRUE_MIN, 2100), float('-inf')) + self.assertPreciseEqual(cfunc(DBL_MAX, -2100), 0.0) + self.assertPreciseEqual(cfunc(-DBL_MAX, -2100), -0.0) + + def test_ldexp_frexp_roundtrip(self): + # A corrupted exponent on either side breaks the identity. + pyfunc = frexp_ldexp_roundtrip + cfunc = njit(pyfunc) + x_values = [1.0, -1.0, 2.5, -2.5, math.pi, 1e300, -1e300, 1e-300, + DBL_MIN, DBL_MAX, DBL_TRUE_MIN, 3 * DBL_TRUE_MIN, + 11 * DBL_TRUE_MIN, 0.0, -0.0, + float('inf'), float('-inf'), float('nan')] + for x in x_values: + self.assertPreciseEqual(cfunc(x), x, msg='for input %r' % (x,)) + + def test_ldexp_subnormal_results_are_correctly_rounded(self): + # Results landing in the subnormal range must be rounded once, + # the way math.ldexp rounds them. Scaling by repeated halving + # rounds again at every step once the value is subnormal, so + # these inputs detect the accumulated double-rounding error. + cfunc = njit(ldexp) + cases = [(4.359607055276148e-151, -574), + (-6.853580717782567e-197, -423), + (7.162365283163292e-228, -319), + (1.5259499737847772e-83, -796), + (6.458979912260433e-06, -1048)] + for x, n in cases: + self.assertPreciseEqual(cfunc(x, n), math.ldexp(x, n), + msg='for input (%r, %r)' % (x, n)) + + def test_ldexp_float32(self): + cfunc = njit(ldexp) + for v in [1.0, -1.0, 2.5, -2.5, 0.5, 1e20, 1e-20]: + for n in [-40, -10, -1, 0, 1, 10, 40]: + x = np.float32(v) + self.assertPreciseEqual( + cfunc(x, n), np.float32(math.ldexp(float(x), n)), + msg='for input (%r, %r)' % (v, n)) + + def test_ldexp_declaration_has_signext_exponent(self): + # See issue #8489. The declaration is target-independent, so + # this checks the signext on any host. Both lowerings + # (math.ldexp, np.ldexp) times both helper symbols; the + # trailing \( in the pattern below keeps numba_ldexp from + # matching numba_ldexpf. + cases = [(ldexp, 2.5, 'numba_ldexp'), + (ldexp, np.float32(2.5), 'numba_ldexpf'), + (np_ldexp, 2.5, 'numba_ldexp'), + (np_ldexp, np.float32(2.5), 'numba_ldexpf')] + # np.int32, not a plain int: on Windows with NumPy < 2.0 the + # np.ldexp ufunc has no int64 exponent loop, and ufunc typing + # requires a safe cast, so int64 resolves to no loop at all. + # See the IS_WIN32 remap in numba/np/ufunc_db.py. + for pyfunc, x, symbol in cases: + cfunc = njit(pyfunc) + cfunc(x, np.int32(3)) + llvm_ir = '\n'.join(cfunc.inspect_llvm().values()) + match = re.search( + r'declare[^@\n]*@%s\(([^)]*)\)' % (symbol,), llvm_ir) + self.assertIsNotNone( + match, + msg='no %s declaration for %r' % (symbol, pyfunc)) + params = [p.strip() for p in match.group(1).split(',')] + self.assertEqual(len(params), 2, msg=match.group(0)) + self.assertIn('signext', params[1], msg=match.group(0)) + + def test_np_ldexp_matches_numpy(self): + # np.ldexp goes through a separate copy of the extern call, in + # numba/np/math/mathimpl.py. Cover it so the two cannot drift. + cfunc = njit(np_ldexp) + + # np.int32 exponents: see + # test_ldexp_declaration_has_signext_exponent. + for v in [1.0, -1.0, 2.5, -2.5, math.pi, 1e100, 1e-100]: + for n in [-200, -53, -10, -1, 0, 1, 10, 53, 200]: + self.assertPreciseEqual(cfunc(v, np.int32(n)), + float(np.ldexp(v, n)), + msg='for input (%r, %r)' % (v, n)) + + # Subnormal results must be correctly rounded here too. + for v, n in [(4.359607055276148e-151, -574), + (-6.853580717782567e-197, -423), + (7.162365283163292e-228, -319), + (1.5259499737847772e-83, -796), + (6.458979912260433e-06, -1048)]: + self.assertPreciseEqual(cfunc(v, np.int32(n)), + float(np.ldexp(v, n)), + msg='for input (%r, %r)' % (v, n)) + + +if __name__ == '__main__': + unittest.main() diff --git a/shared/package-files/33/339426e6e4552e419463e21ff8e348709f2f0b3021da1e895a0769ac70498571/blob b/shared/package-files/33/339426e6e4552e419463e21ff8e348709f2f0b3021da1e895a0769ac70498571/blob new file mode 100644 index 0000000000000000000000000000000000000000..a55bf82b98247acc529c2bd7d3d521e331b537f9 --- /dev/null +++ b/shared/package-files/33/339426e6e4552e419463e21ff8e348709f2f0b3021da1e895a0769ac70498571/blob @@ -0,0 +1,230 @@ +groups,endog,exog_fe_0,exog_fe_1,exog_re_0 +0.000,0.896,-1.659,0.537,1.000 +1.000,-1.499,-0.203,-0.225,1.000 +2.000,-3.643,-0.615,-1.157,1.000 +2.000,0.699,0.441,0.143,1.000 +3.000,2.919,-1.589,0.708,1.000 +3.000,0.916,-0.396,0.729,1.000 +4.000,-0.242,-1.445,0.732,1.000 +5.000,1.059,-1.102,0.009,1.000 +5.000,-3.304,0.785,-2.154,1.000 +5.000,-5.862,3.576,0.770,1.000 +6.000,0.222,-0.489,0.753,1.000 +7.000,-2.700,0.679,-0.605,1.000 +7.000,0.351,-0.309,0.357,1.000 +7.000,2.115,0.202,0.752,1.000 +7.000,0.962,0.995,-0.275,1.000 +8.000,-1.274,-0.089,0.455,1.000 +8.000,-2.722,0.424,-0.704,1.000 +8.000,-0.580,0.171,0.188,1.000 +8.000,-2.023,0.806,-0.704,1.000 +9.000,0.330,-1.884,-0.250,1.000 +9.000,-0.750,0.241,-0.030,1.000 +10.000,-0.380,0.185,1.472,1.000 +10.000,0.113,-0.028,0.557,1.000 +11.000,4.264,0.023,0.414,1.000 +12.000,1.558,0.368,0.341,1.000 +12.000,-3.011,1.417,-0.091,1.000 +12.000,1.173,-0.464,-0.015,1.000 +13.000,1.898,0.680,1.220,1.000 +13.000,-2.742,0.991,-0.618,1.000 +13.000,0.632,0.194,-0.752,1.000 +13.000,-1.512,0.368,0.247,1.000 +14.000,-1.465,-0.268,0.043,1.000 +14.000,2.018,-1.565,0.311,1.000 +15.000,0.986,0.398,-0.094,1.000 +15.000,0.778,0.378,1.167,1.000 +16.000,-1.643,0.469,1.175,1.000 +16.000,0.047,0.121,0.920,1.000 +16.000,-0.174,-0.546,-0.092,1.000 +16.000,1.584,-1.750,-1.095,1.000 +17.000,2.642,-1.545,-0.046,1.000 +17.000,4.356,-1.481,1.012,1.000 +17.000,4.753,0.816,-0.030,1.000 +17.000,1.643,0.651,-0.104,1.000 +18.000,2.506,-2.309,-0.814,1.000 +18.000,-2.066,1.571,-1.079,1.000 +18.000,-2.262,-1.279,0.181,1.000 +19.000,-1.682,0.128,0.839,1.000 +19.000,1.634,-1.319,-0.425,1.000 +19.000,-3.570,1.727,-1.531,1.000 +20.000,-0.385,-0.173,-0.767,1.000 +20.000,1.443,-1.916,1.464,1.000 +20.000,-2.247,-1.168,-1.333,1.000 +21.000,1.245,1.483,0.413,1.000 +21.000,-0.081,-0.610,0.718,1.000 +21.000,0.294,0.146,0.042,1.000 +21.000,2.983,-0.463,-0.352,1.000 +22.000,0.548,-1.322,0.716,1.000 +22.000,-2.133,1.215,0.020,1.000 +22.000,0.268,0.133,0.181,1.000 +23.000,-0.098,1.765,0.948,1.000 +23.000,-1.042,2.070,-0.115,1.000 +24.000,-0.899,-1.315,-0.318,1.000 +24.000,2.123,-0.119,1.215,1.000 +24.000,4.608,-0.597,1.929,1.000 +24.000,-0.514,1.038,-0.758,1.000 +25.000,-2.524,0.862,-1.144,1.000 +25.000,3.373,-0.401,1.374,1.000 +25.000,-0.960,0.043,-0.829,1.000 +25.000,-2.333,2.060,0.044,1.000 +26.000,0.546,0.243,-0.203,1.000 +27.000,1.103,-0.957,1.450,1.000 +28.000,1.061,-0.221,1.518,1.000 +29.000,3.441,-0.162,1.235,1.000 +29.000,-1.087,-0.302,-1.481,1.000 +29.000,3.334,-1.092,-0.339,1.000 +30.000,5.416,0.069,0.124,1.000 +30.000,4.293,-0.233,-1.247,1.000 +31.000,0.660,1.083,-0.361,1.000 +32.000,0.434,0.123,1.387,1.000 +33.000,0.432,0.771,0.253,1.000 +34.000,1.816,-0.892,1.608,1.000 +35.000,-1.419,1.386,-0.805,1.000 +35.000,0.716,0.551,-0.136,1.000 +36.000,-0.680,0.932,0.340,1.000 +37.000,-0.221,-0.724,-0.907,1.000 +38.000,1.402,0.112,3.245,1.000 +38.000,-2.095,0.810,-1.237,1.000 +38.000,-1.490,-0.060,-1.298,1.000 +39.000,2.287,-0.688,1.280,1.000 +39.000,-2.591,-0.499,-1.673,1.000 +40.000,1.140,-1.291,0.599,1.000 +41.000,-5.446,0.511,-1.338,1.000 +41.000,2.751,-1.685,0.481,1.000 +41.000,-1.602,1.219,-0.333,1.000 +42.000,5.675,-0.676,1.235,1.000 +43.000,1.229,-0.846,0.070,1.000 +43.000,-0.651,0.381,0.359,1.000 +43.000,-1.527,-0.316,-0.275,1.000 +44.000,-1.291,1.864,-0.548,1.000 +44.000,-1.953,0.944,1.798,1.000 +45.000,1.646,-0.602,1.462,1.000 +45.000,-3.746,-0.749,-2.052,1.000 +45.000,-5.442,2.733,0.193,1.000 +45.000,2.974,-1.392,2.903,1.000 +46.000,-0.325,-0.544,0.486,1.000 +46.000,4.702,-2.130,0.525,1.000 +46.000,-1.292,0.896,-0.585,1.000 +47.000,-2.663,1.043,-0.138,1.000 +47.000,-1.549,-1.495,-0.105,1.000 +48.000,0.411,0.288,0.703,1.000 +48.000,-6.470,1.120,0.653,1.000 +48.000,5.630,-2.713,1.562,1.000 +49.000,2.308,-2.690,0.866,1.000 +49.000,-2.982,0.096,0.306,1.000 +49.000,-0.079,-1.311,0.038,1.000 +49.000,-1.818,0.610,-0.358,1.000 +50.000,1.608,-1.717,-0.034,1.000 +51.000,-0.825,-0.267,0.487,1.000 +51.000,0.579,-0.213,-0.075,1.000 +51.000,-5.529,1.209,-1.972,1.000 +51.000,-3.270,2.479,0.672,1.000 +52.000,2.812,0.297,0.309,1.000 +52.000,-0.419,0.905,-1.172,1.000 +53.000,-1.949,-0.344,0.397,1.000 +54.000,2.353,0.924,0.468,1.000 +54.000,1.791,-2.778,-0.178,1.000 +54.000,4.525,-0.217,0.070,1.000 +55.000,0.980,-0.066,0.581,1.000 +55.000,3.972,-1.004,-0.100,1.000 +56.000,0.664,-0.769,-0.828,1.000 +56.000,-2.819,0.316,-1.447,1.000 +56.000,-1.988,0.041,-1.980,1.000 +56.000,-2.958,-0.464,-1.141,1.000 +57.000,-0.356,0.216,2.159,1.000 +57.000,0.259,0.219,-0.244,1.000 +58.000,1.200,0.331,-0.887,1.000 +58.000,7.956,-1.618,1.002,1.000 +58.000,-0.523,0.728,1.085,1.000 +59.000,2.565,-0.210,0.142,1.000 +59.000,-0.574,-0.775,-0.315,1.000 +59.000,-0.214,-1.694,-0.918,1.000 +60.000,1.968,-0.424,1.760,1.000 +60.000,3.931,-0.354,1.994,1.000 +61.000,-3.132,0.925,-0.764,1.000 +62.000,-0.298,-1.081,-0.132,1.000 +62.000,2.318,1.789,0.407,1.000 +62.000,1.677,-0.163,0.103,1.000 +62.000,-1.831,-0.046,-0.662,1.000 +63.000,-1.954,-0.928,-0.260,1.000 +63.000,-0.339,-1.324,-0.620,1.000 +63.000,-5.099,0.818,-0.744,1.000 +63.000,-5.013,0.016,-1.138,1.000 +64.000,-2.670,0.984,0.731,1.000 +65.000,2.345,1.160,-0.184,1.000 +65.000,0.710,1.722,0.206,1.000 +65.000,-3.464,2.988,0.018,1.000 +66.000,-3.057,2.216,0.315,1.000 +66.000,-1.738,0.384,-0.117,1.000 +67.000,1.764,0.228,-0.203,1.000 +67.000,-2.503,-0.455,-1.452,1.000 +67.000,-4.189,-0.153,0.219,1.000 +68.000,-1.165,0.070,0.059,1.000 +68.000,3.491,-0.239,0.239,1.000 +68.000,-1.288,-0.615,-0.062,1.000 +68.000,-0.837,0.493,-0.186,1.000 +69.000,1.221,-0.101,-0.573,1.000 +69.000,0.947,1.015,0.334,1.000 +69.000,2.886,0.287,1.636,1.000 +69.000,-0.707,0.012,-1.563,1.000 +70.000,-0.378,1.317,0.627,1.000 +71.000,-0.778,-0.461,0.564,1.000 +71.000,3.638,-0.855,-0.315,1.000 +71.000,2.361,-0.541,1.132,1.000 +72.000,-0.072,1.684,-0.807,1.000 +72.000,2.311,1.657,-0.254,1.000 +72.000,1.366,0.624,-1.171,1.000 +72.000,-0.266,-0.498,1.167,1.000 +73.000,2.208,-0.356,0.669,1.000 +74.000,0.589,1.113,-0.049,1.000 +75.000,1.824,0.016,0.798,1.000 +75.000,-1.998,1.758,1.491,1.000 +76.000,1.101,-1.502,0.166,1.000 +77.000,-0.902,-0.150,0.016,1.000 +77.000,-0.681,-0.017,1.283,1.000 +77.000,0.457,-1.734,-0.794,1.000 +77.000,-0.948,-0.110,-1.428,1.000 +78.000,-1.267,0.264,0.015,1.000 +78.000,-1.259,0.593,-3.032,1.000 +78.000,-0.704,-0.606,-0.331,1.000 +79.000,1.007,-0.791,0.357,1.000 +79.000,1.739,0.841,-0.429,1.000 +79.000,0.691,0.701,1.153,1.000 +80.000,-0.275,-1.660,-0.263,1.000 +80.000,-3.283,1.375,2.109,1.000 +81.000,-1.913,0.428,-0.707,1.000 +82.000,-0.322,0.457,0.423,1.000 +82.000,-0.780,-0.572,-2.861,1.000 +82.000,-2.724,-0.350,0.290,1.000 +82.000,1.602,-0.136,2.437,1.000 +83.000,-3.147,1.116,-1.956,1.000 +84.000,1.396,0.455,-0.582,1.000 +84.000,1.654,0.853,0.383,1.000 +84.000,1.438,1.338,1.451,1.000 +85.000,-1.257,0.335,-1.031,1.000 +85.000,-0.524,-0.736,-1.034,1.000 +86.000,7.604,-1.610,0.960,1.000 +87.000,-2.649,0.589,-0.687,1.000 +87.000,-0.415,-0.634,-2.428,1.000 +87.000,-1.182,-0.618,-0.847,1.000 +88.000,4.074,-1.670,0.072,1.000 +88.000,-1.084,-1.018,-0.150,1.000 +89.000,3.981,-0.789,0.976,1.000 +89.000,-5.208,2.187,-0.973,1.000 +90.000,-0.824,0.118,-1.090,1.000 +90.000,0.797,-1.498,1.407,1.000 +91.000,4.016,-1.043,0.911,1.000 +91.000,-1.655,0.638,-0.149,1.000 +91.000,3.831,-0.871,1.270,1.000 +91.000,3.299,0.221,0.765,1.000 +92.000,0.307,-1.345,-0.100,1.000 +93.000,1.757,0.144,0.624,1.000 +93.000,0.946,-2.669,-0.322,1.000 +94.000,4.008,-0.818,1.751,1.000 +95.000,-3.451,-0.114,0.345,1.000 +96.000,0.941,-0.258,0.887,1.000 +97.000,1.638,-0.639,-0.620,1.000 +98.000,-1.325,0.379,-0.282,1.000 +99.000,-1.543,-0.330,1.297,1.000 +99.000,0.157,-0.484,1.422,1.000 diff --git a/shared/package-files/33/33943f56f5b3fbb2c0368a8aee5f32cac95fd7c8cda2e1b681a5fb41956d689d/blob b/shared/package-files/33/33943f56f5b3fbb2c0368a8aee5f32cac95fd7c8cda2e1b681a5fb41956d689d/blob new file mode 100644 index 0000000000000000000000000000000000000000..86555d6c19916c8ae1f6a796fb009a6b803b2159 --- /dev/null +++ b/shared/package-files/33/33943f56f5b3fbb2c0368a8aee5f32cac95fd7c8cda2e1b681a5fb41956d689d/blob @@ -0,0 +1,3508 @@ +# +# Created by: Pearu Peterson, September 2002 +# + +from functools import reduce +import random + +from numpy.testing import (assert_equal, assert_array_almost_equal, assert_, + assert_allclose, assert_almost_equal, + assert_array_equal) +import pytest +from pytest import raises as assert_raises + +import numpy as np +from numpy import (eye, ones, zeros, zeros_like, triu, tril, tril_indices, + triu_indices) + +from numpy.random import rand, randint, seed + +from scipy.linalg import (_flapack as flapack, lapack, inv, svd, cholesky, + solve, ldl, norm, block_diag, qr, eigh, qz) + +from scipy.linalg.lapack import _compute_lwork +from scipy.stats import ortho_group, unitary_group + +import scipy.sparse as sps +try: + from scipy.__config__ import CONFIG +except ImportError: + CONFIG = None + +try: + from scipy.linalg import _clapack as clapack +except ImportError: + clapack = None +from scipy.linalg.lapack import get_lapack_funcs +from scipy.linalg.blas import get_blas_funcs + +REAL_DTYPES = [np.float32, np.float64] +COMPLEX_DTYPES = [np.complex64, np.complex128] +DTYPES = REAL_DTYPES + COMPLEX_DTYPES + +blas_provider = blas_version = None +if CONFIG is not None: + blas_provider = CONFIG['Build Dependencies']['blas']['name'] + blas_version = CONFIG['Build Dependencies']['blas']['version'] + + +def generate_random_dtype_array(shape, dtype, rng): + # generates a random matrix of desired data type of shape + if dtype in COMPLEX_DTYPES: + return (rng.rand(*shape) + + rng.rand(*shape)*1.0j).astype(dtype) + return rng.rand(*shape).astype(dtype) + + +def test_lapack_documented(): + """Test that all entries are in the doc.""" + if lapack.__doc__ is None: # just in case there is a python -OO + pytest.skip('lapack.__doc__ is None') + names = set(lapack.__doc__.split()) + ignore_list = { + "absolute_import", + "clapack", + "division", + "find_best_lapack_type", + "flapack", + "print_function", + "HAS_ILP64", + "np", + } + missing = list() + for name in dir(lapack): + if (not name.startswith('_') and name not in ignore_list and + name not in names): + missing.append(name) + assert missing == [], 'Name(s) missing from lapack.__doc__ or ignore_list' + + +class TestFlapackSimple: + + def test_gebal(self): + a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + a1 = [[1, 0, 0, 3e-4], + [4, 0, 0, 2e-3], + [7, 1, 0, 0], + [0, 1, 0, 0]] + for p in 'sdzc': + f = getattr(flapack, p+'gebal', None) + if f is None: + continue + ba, lo, hi, pivscale, info = f(a) + assert_(not info, repr(info)) + assert_array_almost_equal(ba, a) + assert_equal((lo, hi), (0, len(a[0])-1)) + assert_array_almost_equal(pivscale, np.ones(len(a))) + + ba, lo, hi, pivscale, info = f(a1, permute=1, scale=1) + assert_(not info, repr(info)) + # print(a1) + # print(ba, lo, hi, pivscale) + + def test_gehrd(self): + a = [[-149, -50, -154], + [537, 180, 546], + [-27, -9, -25]] + for p in 'd': + f = getattr(flapack, p+'gehrd', None) + if f is None: + continue + ht, tau, info = f(a) + assert_(not info, repr(info)) + + def test_trsyl(self): + a = np.array([[1, 2], [0, 4]]) + b = np.array([[5, 6], [0, 8]]) + c = np.array([[9, 10], [11, 12]]) + trans = 'T' + + # Test single and double implementations, including most + # of the options + for dtype in 'fdFD': + a1, b1, c1 = a.astype(dtype), b.astype(dtype), c.astype(dtype) + trsyl, = get_lapack_funcs(('trsyl',), (a1,)) + if dtype.isupper(): # is complex dtype + a1[0] += 1j + trans = 'C' + + x, scale, info = trsyl(a1, b1, c1) + assert_array_almost_equal(np.dot(a1, x) + np.dot(x, b1), + scale * c1) + + x, scale, info = trsyl(a1, b1, c1, trana=trans, tranb=trans) + assert_array_almost_equal( + np.dot(a1.conjugate().T, x) + np.dot(x, b1.conjugate().T), + scale * c1, decimal=4) + + x, scale, info = trsyl(a1, b1, c1, isgn=-1) + assert_array_almost_equal(np.dot(a1, x) - np.dot(x, b1), + scale * c1, decimal=4) + + def test_lange(self): + a = np.array([ + [-149, -50, -154], + [537, 180, 546], + [-27, -9, -25]]) + + for dtype in 'fdFD': + for norm_str in 'Mm1OoIiFfEe': + a1 = a.astype(dtype) + if dtype.isupper(): + # is complex dtype + a1[0, 0] += 1j + + lange, = get_lapack_funcs(('lange',), (a1,)) + value = lange(norm_str, a1) + + if norm_str in 'FfEe': + if dtype in 'Ff': + decimal = 3 + else: + decimal = 7 + ref = np.sqrt(np.sum(np.square(np.abs(a1)))) + assert_almost_equal(value, ref, decimal) + else: + if norm_str in 'Mm': + ref = np.max(np.abs(a1)) + elif norm_str in '1Oo': + ref = np.max(np.sum(np.abs(a1), axis=0)) + elif norm_str in 'Ii': + ref = np.max(np.sum(np.abs(a1), axis=1)) + + assert_equal(value, ref) + + +class TestLapack: + + def test_flapack(self): + if hasattr(flapack, 'empty_module'): + # flapack module is empty + pass + + def test_clapack(self): + if hasattr(clapack, 'empty_module'): + # clapack module is empty + pass + + +class TestLeastSquaresSolvers: + + def test_gels(self): + seed(1234) + # Test fat/tall matrix argument handling - gh-issue #8329 + for ind, dtype in enumerate(DTYPES): + m = 10 + n = 20 + nrhs = 1 + a1 = rand(m, n).astype(dtype) + b1 = rand(n).astype(dtype) + gls, glslw = get_lapack_funcs(('gels', 'gels_lwork'), dtype=dtype) + + # Request of sizes + lwork = _compute_lwork(glslw, m, n, nrhs) + _, _, info = gls(a1, b1, lwork=lwork) + assert_(info >= 0) + _, _, info = gls(a1, b1, trans='TTCC'[ind], lwork=lwork) + assert_(info >= 0) + + for dtype in REAL_DTYPES: + a1 = np.array([[1.0, 2.0], + [4.0, 5.0], + [7.0, 8.0]], dtype=dtype) + b1 = np.array([16.0, 17.0, 20.0], dtype=dtype) + gels, gels_lwork, geqrf = get_lapack_funcs( + ('gels', 'gels_lwork', 'geqrf'), (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + lwork = _compute_lwork(gels_lwork, m, n, nrhs) + + lqr, x, info = gels(a1, b1, lwork=lwork) + assert_allclose(x[:-1], np.array([-14.333333333333323, + 14.999999999999991], + dtype=dtype), + rtol=25*np.finfo(dtype).eps) + lqr_truth, _, _, _ = geqrf(a1) + assert_array_equal(lqr, lqr_truth) + + for dtype in COMPLEX_DTYPES: + a1 = np.array([[1.0+4.0j, 2.0], + [4.0+0.5j, 5.0-3.0j], + [7.0-2.0j, 8.0+0.7j]], dtype=dtype) + b1 = np.array([16.0, 17.0+2.0j, 20.0-4.0j], dtype=dtype) + gels, gels_lwork, geqrf = get_lapack_funcs( + ('gels', 'gels_lwork', 'geqrf'), (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + lwork = _compute_lwork(gels_lwork, m, n, nrhs) + + lqr, x, info = gels(a1, b1, lwork=lwork) + assert_allclose(x[:-1], + np.array([1.161753632288328-1.901075709391912j, + 1.735882340522193+1.521240901196909j], + dtype=dtype), rtol=25*np.finfo(dtype).eps) + lqr_truth, _, _, _ = geqrf(a1) + assert_array_equal(lqr, lqr_truth) + + def test_gelsd(self): + for dtype in REAL_DTYPES: + a1 = np.array([[1.0, 2.0], + [4.0, 5.0], + [7.0, 8.0]], dtype=dtype) + b1 = np.array([16.0, 17.0, 20.0], dtype=dtype) + gelsd, gelsd_lwork = get_lapack_funcs(('gelsd', 'gelsd_lwork'), + (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + work, iwork, info = gelsd_lwork(m, n, nrhs, -1) + lwork = int(np.real(work)) + iwork_size = iwork + + x, s, rank, info = gelsd(a1, b1, lwork, iwork_size, + -1, False, False) + assert_allclose(x[:-1], np.array([-14.333333333333323, + 14.999999999999991], + dtype=dtype), + rtol=25*np.finfo(dtype).eps) + assert_allclose(s, np.array([12.596017180511966, + 0.583396253199685], dtype=dtype), + rtol=25*np.finfo(dtype).eps) + + for dtype in COMPLEX_DTYPES: + a1 = np.array([[1.0+4.0j, 2.0], + [4.0+0.5j, 5.0-3.0j], + [7.0-2.0j, 8.0+0.7j]], dtype=dtype) + b1 = np.array([16.0, 17.0+2.0j, 20.0-4.0j], dtype=dtype) + gelsd, gelsd_lwork = get_lapack_funcs(('gelsd', 'gelsd_lwork'), + (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + work, rwork, iwork, info = gelsd_lwork(m, n, nrhs, -1) + lwork = int(np.real(work)) + rwork_size = int(rwork) + iwork_size = iwork + + x, s, rank, info = gelsd(a1, b1, lwork, rwork_size, iwork_size, + -1, False, False) + assert_allclose(x[:-1], + np.array([1.161753632288328-1.901075709391912j, + 1.735882340522193+1.521240901196909j], + dtype=dtype), rtol=25*np.finfo(dtype).eps) + assert_allclose(s, + np.array([13.035514762572043, 4.337666985231382], + dtype=dtype), rtol=25*np.finfo(dtype).eps) + + def test_gelss(self): + + for dtype in REAL_DTYPES: + a1 = np.array([[1.0, 2.0], + [4.0, 5.0], + [7.0, 8.0]], dtype=dtype) + b1 = np.array([16.0, 17.0, 20.0], dtype=dtype) + gelss, gelss_lwork = get_lapack_funcs(('gelss', 'gelss_lwork'), + (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + work, info = gelss_lwork(m, n, nrhs, -1) + lwork = int(np.real(work)) + + v, x, s, rank, work, info = gelss(a1, b1, -1, lwork, False, False) + assert_allclose(x[:-1], np.array([-14.333333333333323, + 14.999999999999991], + dtype=dtype), + rtol=25*np.finfo(dtype).eps) + assert_allclose(s, np.array([12.596017180511966, + 0.583396253199685], dtype=dtype), + rtol=25*np.finfo(dtype).eps) + + for dtype in COMPLEX_DTYPES: + a1 = np.array([[1.0+4.0j, 2.0], + [4.0+0.5j, 5.0-3.0j], + [7.0-2.0j, 8.0+0.7j]], dtype=dtype) + b1 = np.array([16.0, 17.0+2.0j, 20.0-4.0j], dtype=dtype) + gelss, gelss_lwork = get_lapack_funcs(('gelss', 'gelss_lwork'), + (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + work, info = gelss_lwork(m, n, nrhs, -1) + lwork = int(np.real(work)) + + v, x, s, rank, work, info = gelss(a1, b1, -1, lwork, False, False) + assert_allclose(x[:-1], + np.array([1.161753632288328-1.901075709391912j, + 1.735882340522193+1.521240901196909j], + dtype=dtype), + rtol=25*np.finfo(dtype).eps) + assert_allclose(s, np.array([13.035514762572043, + 4.337666985231382], dtype=dtype), + rtol=25*np.finfo(dtype).eps) + + def test_gelsy(self): + + for dtype in REAL_DTYPES: + a1 = np.array([[1.0, 2.0], + [4.0, 5.0], + [7.0, 8.0]], dtype=dtype) + b1 = np.array([16.0, 17.0, 20.0], dtype=dtype) + gelsy, gelsy_lwork = get_lapack_funcs(('gelsy', 'gelss_lwork'), + (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + work, info = gelsy_lwork(m, n, nrhs, 10*np.finfo(dtype).eps) + lwork = int(np.real(work)) + + jptv = np.zeros((a1.shape[1], 1), dtype=np.int32) + v, x, j, rank, info = gelsy(a1, b1, jptv, np.finfo(dtype).eps, + lwork, False, False) + assert_allclose(x[:-1], np.array([-14.333333333333323, + 14.999999999999991], + dtype=dtype), + rtol=25*np.finfo(dtype).eps) + + for dtype in COMPLEX_DTYPES: + a1 = np.array([[1.0+4.0j, 2.0], + [4.0+0.5j, 5.0-3.0j], + [7.0-2.0j, 8.0+0.7j]], dtype=dtype) + b1 = np.array([16.0, 17.0+2.0j, 20.0-4.0j], dtype=dtype) + gelsy, gelsy_lwork = get_lapack_funcs(('gelsy', 'gelss_lwork'), + (a1, b1)) + + m, n = a1.shape + if len(b1.shape) == 2: + nrhs = b1.shape[1] + else: + nrhs = 1 + + # Request of sizes + work, info = gelsy_lwork(m, n, nrhs, 10*np.finfo(dtype).eps) + lwork = int(np.real(work)) + + jptv = np.zeros((a1.shape[1], 1), dtype=np.int32) + v, x, j, rank, info = gelsy(a1, b1, jptv, np.finfo(dtype).eps, + lwork, False, False) + assert_allclose(x[:-1], + np.array([1.161753632288328-1.901075709391912j, + 1.735882340522193+1.521240901196909j], + dtype=dtype), + rtol=25*np.finfo(dtype).eps) + + +@pytest.mark.parametrize('dtype', DTYPES) +@pytest.mark.parametrize('shape', [(3, 4), (5, 2), (2**18, 2**18)]) +def test_geqrf_lwork(dtype, shape): + geqrf_lwork = get_lapack_funcs(('geqrf_lwork'), dtype=dtype) + m, n = shape + lwork, info = geqrf_lwork(m=m, n=n) + assert_equal(info, 0) + + +class TestRegression: + + def test_ticket_1645(self): + # Check that RQ routines have correct lwork + for dtype in DTYPES: + a = np.zeros((300, 2), dtype=dtype) + + gerqf, = get_lapack_funcs(['gerqf'], [a]) + assert_raises(Exception, gerqf, a, lwork=2) + rq, tau, work, info = gerqf(a) + + if dtype in REAL_DTYPES: + orgrq, = get_lapack_funcs(['orgrq'], [a]) + assert_raises(Exception, orgrq, rq[-2:], tau, lwork=1) + orgrq(rq[-2:], tau, lwork=2) + elif dtype in COMPLEX_DTYPES: + ungrq, = get_lapack_funcs(['ungrq'], [a]) + assert_raises(Exception, ungrq, rq[-2:], tau, lwork=1) + ungrq(rq[-2:], tau, lwork=2) + + +class TestDpotr: + def test_gh_2691(self): + # 'lower' argument of dportf/dpotri + for lower in [True, False]: + for clean in [True, False]: + np.random.seed(42) + x = np.random.normal(size=(3, 3)) + a = x.dot(x.T) + + dpotrf, dpotri = get_lapack_funcs(("potrf", "potri"), (a, )) + + c, info = dpotrf(a, lower, clean=clean) + dpt = dpotri(c, lower)[0] + + if lower: + assert_allclose(np.tril(dpt), np.tril(inv(a))) + else: + assert_allclose(np.triu(dpt), np.triu(inv(a))) + + +class TestDlasd4: + def test_sing_val_update(self): + + sigmas = np.array([4., 3., 2., 0]) + m_vec = np.array([3.12, 5.7, -4.8, -2.2]) + + M = np.hstack((np.vstack((np.diag(sigmas[0:-1]), + np.zeros((1, len(m_vec) - 1)))), + m_vec[:, np.newaxis])) + SM = svd(M, full_matrices=False, compute_uv=False, overwrite_a=False, + check_finite=False) + + it_len = len(sigmas) + sgm = np.concatenate((sigmas[::-1], [sigmas[0] + it_len*norm(m_vec)])) + mvc = np.concatenate((m_vec[::-1], (0,))) + + lasd4 = get_lapack_funcs('lasd4', (sigmas,)) + + roots = [] + for i in range(0, it_len): + res = lasd4(i, sgm, mvc) + roots.append(res[1]) + + assert_((res[3] <= 0), "LAPACK root finding dlasd4 failed to find \ + the singular value %i" % i) + roots = np.array(roots)[::-1] + + assert_((not np.any(np.isnan(roots)), "There are NaN roots")) + assert_allclose(SM, roots, atol=100*np.finfo(np.float64).eps, + rtol=100*np.finfo(np.float64).eps) + + +class TestTbtrs: + + @pytest.mark.parametrize('dtype', DTYPES) + def test_nag_example_f07vef_f07vsf(self, dtype): + """Test real (f07vef) and complex (f07vsf) examples from NAG + + Examples available from: + * https://www.nag.com/numeric/fl/nagdoc_latest/html/f07/f07vef.html + * https://www.nag.com/numeric/fl/nagdoc_latest/html/f07/f07vsf.html + + """ + if dtype in REAL_DTYPES: + ab = np.array([[-4.16, 4.78, 6.32, 0.16], + [-2.25, 5.86, -4.82, 0]], + dtype=dtype) + b = np.array([[-16.64, -4.16], + [-13.78, -16.59], + [13.10, -4.94], + [-14.14, -9.96]], + dtype=dtype) + x_out = np.array([[4, 1], + [-1, -3], + [3, 2], + [2, -2]], + dtype=dtype) + elif dtype in COMPLEX_DTYPES: + ab = np.array([[-1.94+4.43j, 4.12-4.27j, 0.43-2.66j, 0.44+0.1j], + [-3.39+3.44j, -1.84+5.52j, 1.74 - 0.04j, 0], + [1.62+3.68j, -2.77-1.93j, 0, 0]], + dtype=dtype) + b = np.array([[-8.86 - 3.88j, -24.09 - 5.27j], + [-15.57 - 23.41j, -57.97 + 8.14j], + [-7.63 + 22.78j, 19.09 - 29.51j], + [-14.74 - 2.40j, 19.17 + 21.33j]], + dtype=dtype) + x_out = np.array([[2j, 1 + 5j], + [1 - 3j, -7 - 2j], + [-4.001887 - 4.988417j, 3.026830 + 4.003182j], + [1.996158 - 1.045105j, -6.103357 - 8.986653j]], + dtype=dtype) + else: + raise ValueError(f"Datatype {dtype} not understood.") + + tbtrs = get_lapack_funcs(('tbtrs'), dtype=dtype) + x, info = tbtrs(ab=ab, b=b, uplo='L') + assert_equal(info, 0) + assert_allclose(x, x_out, rtol=0, atol=1e-5) + + @pytest.mark.parametrize('dtype,trans', + [(dtype, trans) + for dtype in DTYPES for trans in ['N', 'T', 'C'] + if not (trans == 'C' and dtype in REAL_DTYPES)]) + @pytest.mark.parametrize('uplo', ['U', 'L']) + @pytest.mark.parametrize('diag', ['N', 'U']) + def test_random_matrices(self, dtype, trans, uplo, diag): + rng = np.random.RandomState(1724) + + # n, nrhs, kd are used to specify A and b. + # A is of shape n x n with kd super/sub-diagonals + # b is of shape n x nrhs matrix + n, nrhs, kd = 4, 3, 2 + tbtrs = get_lapack_funcs('tbtrs', dtype=dtype) + + is_upper = (uplo == 'U') + ku = kd * is_upper + kl = kd - ku + + # Construct the diagonal and kd super/sub diagonals of A with + # the corresponding offsets. + band_offsets = range(ku, -kl - 1, -1) + band_widths = [n - abs(x) for x in band_offsets] + bands = [generate_random_dtype_array((width,), dtype, rng) + for width in band_widths] + + if diag == 'U': # A must be unit triangular + bands[ku] = np.ones(n, dtype=dtype) + + # Construct the diagonal banded matrix A from the bands and offsets. + a = sps.diags(bands, band_offsets, format='dia') + + # Convert A into banded storage form + ab = np.zeros((kd + 1, n), dtype) + for row, k in enumerate(band_offsets): + ab[row, max(k, 0):min(n+k, n)] = a.diagonal(k) + + # The RHS values. + b = generate_random_dtype_array((n, nrhs), dtype, rng) + + x, info = tbtrs(ab=ab, b=b, uplo=uplo, trans=trans, diag=diag) + assert_equal(info, 0) + + if trans == 'N': + assert_allclose(a @ x, b, rtol=5e-5) + elif trans == 'T': + assert_allclose(a.T @ x, b, rtol=5e-5) + elif trans == 'C': + assert_allclose(a.T.conjugate() @ x, b, rtol=5e-5) + else: + raise ValueError('Invalid trans argument') + + @pytest.mark.parametrize('uplo,trans,diag', + [['U', 'N', 'Invalid'], + ['U', 'Invalid', 'N'], + ['Invalid', 'N', 'N']]) + def test_invalid_argument_raises_exception(self, uplo, trans, diag): + """Test if invalid values of uplo, trans and diag raise exceptions""" + # Argument checks occur independently of used datatype. + # This mean we must not parameterize all available datatypes. + tbtrs = get_lapack_funcs('tbtrs', dtype=np.float64) + ab = rand(4, 2) + b = rand(2, 4) + assert_raises(Exception, tbtrs, ab, b, uplo, trans, diag) + + def test_zero_element_in_diagonal(self): + """Test if a matrix with a zero diagonal element is singular + + If the i-th diagonal of A is zero, ?tbtrs should return `i` in `info` + indicating the provided matrix is singular. + + Note that ?tbtrs requires the matrix A to be stored in banded form. + In this form the diagonal corresponds to the last row.""" + ab = np.ones((3, 4), dtype=float) + b = np.ones(4, dtype=float) + tbtrs = get_lapack_funcs('tbtrs', dtype=float) + + ab[-1, 3] = 0 + _, info = tbtrs(ab=ab, b=b, uplo='U') + assert_equal(info, 4) + + @pytest.mark.parametrize('ldab,n,ldb,nrhs', [ + (5, 5, 0, 5), + (5, 5, 3, 5) + ]) + def test_invalid_matrix_shapes(self, ldab, n, ldb, nrhs): + """Test ?tbtrs fails correctly if shapes are invalid.""" + ab = np.ones((ldab, n), dtype=float) + b = np.ones((ldb, nrhs), dtype=float) + tbtrs = get_lapack_funcs('tbtrs', dtype=float) + assert_raises(Exception, tbtrs, ab, b) + + + +@pytest.mark.parametrize('dtype', DTYPES) +@pytest.mark.parametrize('norm', ['I', '1', 'O']) +@pytest.mark.parametrize('uplo', ['U', 'L']) +@pytest.mark.parametrize('diag', ['N', 'U']) +@pytest.mark.parametrize('n', [3, 10]) +def test_trcon(dtype, norm, uplo, diag, n): + # Simple way to get deterministic (unlike `hash`) integer seed based on arguments + random.seed(f"{dtype}{norm}{uplo}{diag}{n}") + rng = np.random.default_rng(random.randint(0, 9999999999999)) + + A = rng.random(size=(n, n)) + rng.random(size=(n, n))*1j + # make the condition numbers more interesting + offset = rng.permuted(np.logspace(0, rng.integers(0, 10), n)) + A += offset + A = A.real if np.issubdtype(dtype, np.floating) else A + A = np.triu(A) if uplo == 'U' else np.tril(A) + if diag == 'U': + A /= np.diag(A)[:, np.newaxis] + A = A.astype(dtype) + + trcon = get_lapack_funcs('trcon', (A,)) + res, _ = trcon(A, norm=norm, uplo=uplo, diag=diag) + + if norm == 'I': + norm_A = np.linalg.norm(A, ord=np.inf) + norm_inv_A = np.linalg.norm(np.linalg.inv(A), ord=np.inf) + ref = 1 / (norm_A * norm_inv_A) + else: + anorm = np.abs(A).sum(axis=0).max() + gecon, getrf = get_lapack_funcs(('gecon', 'getrf'), (A,)) + lu, ipvt, info = getrf(A) + ref, _ = gecon(lu, anorm, norm=norm) + + # This is an estimate of reciprocal condition number; we just need order of + # magnitude. In testing, we observed that much smaller rtol is OK in almost + # all cases... but sometimes it isn't. + rtol = 1 # np.finfo(dtype).eps**0.75 + assert_allclose(res, ref, rtol=rtol) + + +def test_lartg(): + for dtype in 'fdFD': + lartg = get_lapack_funcs('lartg', dtype=dtype) + + f = np.array(3, dtype) + g = np.array(4, dtype) + + if np.iscomplexobj(g): + g *= 1j + + cs, sn, r = lartg(f, g) + + assert_allclose(cs, 3.0/5.0) + assert_allclose(r, 5.0) + + if np.iscomplexobj(g): + assert_allclose(sn, -4.0j/5.0) + assert_(isinstance(r, complex)) + assert_(isinstance(cs, float)) + else: + assert_allclose(sn, 4.0/5.0) + + +def test_rot(): + # srot, drot from blas and crot and zrot from lapack. + + for dtype in 'fdFD': + c = 0.6 + s = 0.8 + + u = np.full(4, 3, dtype) + v = np.full(4, 4, dtype) + atol = 10**-(np.finfo(dtype).precision-1) + + if dtype in 'fd': + rot = get_blas_funcs('rot', dtype=dtype) + f = 4 + else: + rot = get_lapack_funcs('rot', dtype=dtype) + s *= -1j + v *= 1j + f = 4j + + assert_allclose(rot(u, v, c, s), [[5, 5, 5, 5], + [0, 0, 0, 0]], atol=atol) + assert_allclose(rot(u, v, c, s, n=2), [[5, 5, 3, 3], + [0, 0, f, f]], atol=atol) + assert_allclose(rot(u, v, c, s, offx=2, offy=2), + [[3, 3, 5, 5], [f, f, 0, 0]], atol=atol) + assert_allclose(rot(u, v, c, s, incx=2, offy=2, n=2), + [[5, 3, 5, 3], [f, f, 0, 0]], atol=atol) + assert_allclose(rot(u, v, c, s, offx=2, incy=2, n=2), + [[3, 3, 5, 5], [0, f, 0, f]], atol=atol) + assert_allclose(rot(u, v, c, s, offx=2, incx=2, offy=2, incy=2, n=1), + [[3, 3, 5, 3], [f, f, 0, f]], atol=atol) + assert_allclose(rot(u, v, c, s, incx=-2, incy=-2, n=2), + [[5, 3, 5, 3], [0, f, 0, f]], atol=atol) + + a, b = rot(u, v, c, s, overwrite_x=1, overwrite_y=1) + assert_(a is u) + assert_(b is v) + assert_allclose(a, [5, 5, 5, 5], atol=atol) + assert_allclose(b, [0, 0, 0, 0], atol=atol) + + +def test_larfg_larf(): + np.random.seed(1234) + a0 = np.random.random((4, 4)) + a0 = a0.T.dot(a0) + + a0j = np.random.random((4, 4)) + 1j*np.random.random((4, 4)) + a0j = a0j.T.conj().dot(a0j) + + # our test here will be to do one step of reducing a hermetian matrix to + # tridiagonal form using householder transforms. + + for dtype in 'fdFD': + larfg, larf = get_lapack_funcs(['larfg', 'larf'], dtype=dtype) + + if dtype in 'FD': + a = a0j.copy() + else: + a = a0.copy() + + # generate a householder transform to clear a[2:,0] + alpha, x, tau = larfg(a.shape[0]-1, a[1, 0], a[2:, 0]) + + # create expected output + expected = np.zeros_like(a[:, 0]) + expected[0] = a[0, 0] + expected[1] = alpha + + # assemble householder vector + v = np.zeros_like(a[1:, 0]) + v[0] = 1.0 + v[1:] = x + + # apply transform from the left + a[1:, :] = larf(v, tau.conjugate(), a[1:, :], np.zeros(a.shape[1])) + + # apply transform from the right + a[:, 1:] = larf(v, tau, a[:, 1:], np.zeros(a.shape[0]), side='R') + + assert_allclose(a[:, 0], expected, atol=1e-5) + assert_allclose(a[0, :], expected, atol=1e-5) + + +def test_sgesdd_lwork_bug_workaround(): + # Test that SGESDD lwork is sufficiently large for LAPACK. + # + # This checks that _compute_lwork() correctly works around a bug in + # LAPACK versions older than 3.10.1. + + sgesdd_lwork = get_lapack_funcs('gesdd_lwork', dtype=np.float32, + ilp64='preferred') + n = 9537 + lwork = _compute_lwork(sgesdd_lwork, n, n, + compute_uv=True, full_matrices=True) + # If we called the Fortran function SGESDD directly with IWORK=-1, the + # LAPACK bug would result in lwork being 272929856, which was too small. + # (The result was returned in a single precision float, which does not + # have sufficient precision to represent the exact integer value that it + # computed internally.) The work-around implemented in _compute_lwork() + # will convert that to 272929888. If we are using LAPACK 3.10.1 or later + # (such as in OpenBLAS 0.3.21 or later), the work-around will return + # 272929920, because it does not know which version of LAPACK is being + # used, so it always applies the correction to whatever it is given. We + # will accept either 272929888 or 272929920. + # Note that the acceptable values are a LAPACK implementation detail. + # If a future version of LAPACK changes how SGESDD works, and therefore + # changes the required LWORK size, the acceptable values might have to + # be updated. + assert lwork == 272929888 or lwork == 272929920 + + +class TestSytrd: + @pytest.mark.parametrize('dtype', REAL_DTYPES) + def test_sytrd_with_zero_dim_array(self, dtype): + # Assert that a 0x0 matrix raises an error + A = np.zeros((0, 0), dtype=dtype) + sytrd = get_lapack_funcs('sytrd', (A,)) + assert_raises(ValueError, sytrd, A) + + @pytest.mark.parametrize('dtype', REAL_DTYPES) + @pytest.mark.parametrize('n', (1, 3)) + def test_sytrd(self, dtype, n): + A = np.zeros((n, n), dtype=dtype) + + sytrd, sytrd_lwork = \ + get_lapack_funcs(('sytrd', 'sytrd_lwork'), (A,)) + + # some upper triangular array + A[np.triu_indices_from(A)] = \ + np.arange(1, n*(n+1)//2+1, dtype=dtype) + + # query lwork + lwork, info = sytrd_lwork(n) + assert_equal(info, 0) + + # check lower=1 behavior (shouldn't do much since the matrix is + # upper triangular) + data, d, e, tau, info = sytrd(A, lower=1, lwork=lwork) + assert_equal(info, 0) + + assert_allclose(data, A, atol=5*np.finfo(dtype).eps, rtol=1.0) + assert_allclose(d, np.diag(A)) + assert_allclose(e, 0.0) + assert_allclose(tau, 0.0) + + # and now for the proper test (lower=0 is the default) + data, d, e, tau, info = sytrd(A, lwork=lwork) + assert_equal(info, 0) + + # assert Q^T*A*Q = tridiag(e, d, e) + + # build tridiagonal matrix + T = np.zeros_like(A, dtype=dtype) + k = np.arange(A.shape[0]) + T[k, k] = d + k2 = np.arange(A.shape[0]-1) + T[k2+1, k2] = e + T[k2, k2+1] = e + + # build Q + Q = np.eye(n, n, dtype=dtype) + for i in range(n-1): + v = np.zeros(n, dtype=dtype) + v[:i] = data[:i, i+1] + v[i] = 1.0 + H = np.eye(n, n, dtype=dtype) - tau[i] * np.outer(v, v) + Q = np.dot(H, Q) + + # Make matrix fully symmetric + i_lower = np.tril_indices(n, -1) + A[i_lower] = A.T[i_lower] + + QTAQ = np.dot(Q.T, np.dot(A, Q)) + + # disable rtol here since some values in QTAQ and T are very close + # to 0. + assert_allclose(QTAQ, T, atol=5*np.finfo(dtype).eps, rtol=1.0) + + +class TestHetrd: + @pytest.mark.parametrize('complex_dtype', COMPLEX_DTYPES) + def test_hetrd_with_zero_dim_array(self, complex_dtype): + # Assert that a 0x0 matrix raises an error + A = np.zeros((0, 0), dtype=complex_dtype) + hetrd = get_lapack_funcs('hetrd', (A,)) + assert_raises(ValueError, hetrd, A) + + @pytest.mark.parametrize('real_dtype,complex_dtype', + zip(REAL_DTYPES, COMPLEX_DTYPES)) + @pytest.mark.parametrize('n', (1, 3)) + def test_hetrd(self, n, real_dtype, complex_dtype): + A = np.zeros((n, n), dtype=complex_dtype) + hetrd, hetrd_lwork = \ + get_lapack_funcs(('hetrd', 'hetrd_lwork'), (A,)) + + # some upper triangular array + A[np.triu_indices_from(A)] = ( + np.arange(1, n*(n+1)//2+1, dtype=real_dtype) + + 1j * np.arange(1, n*(n+1)//2+1, dtype=real_dtype) + ) + np.fill_diagonal(A, np.real(np.diag(A))) + + # test query lwork + for x in [0, 1]: + _, info = hetrd_lwork(n, lower=x) + assert_equal(info, 0) + # lwork returns complex which segfaults hetrd call (gh-10388) + # use the safe and recommended option + lwork = _compute_lwork(hetrd_lwork, n) + + # check lower=1 behavior (shouldn't do much since the matrix is + # upper triangular) + data, d, e, tau, info = hetrd(A, lower=1, lwork=lwork) + assert_equal(info, 0) + + assert_allclose(data, A, atol=5*np.finfo(real_dtype).eps, rtol=1.0) + + assert_allclose(d, np.real(np.diag(A))) + assert_allclose(e, 0.0) + assert_allclose(tau, 0.0) + + # and now for the proper test (lower=0 is the default) + data, d, e, tau, info = hetrd(A, lwork=lwork) + assert_equal(info, 0) + + # assert Q^T*A*Q = tridiag(e, d, e) + + # build tridiagonal matrix + T = np.zeros_like(A, dtype=real_dtype) + k = np.arange(A.shape[0], dtype=int) + T[k, k] = d + k2 = np.arange(A.shape[0]-1, dtype=int) + T[k2+1, k2] = e + T[k2, k2+1] = e + + # build Q + Q = np.eye(n, n, dtype=complex_dtype) + for i in range(n-1): + v = np.zeros(n, dtype=complex_dtype) + v[:i] = data[:i, i+1] + v[i] = 1.0 + H = np.eye(n, n, dtype=complex_dtype) \ + - tau[i] * np.outer(v, np.conj(v)) + Q = np.dot(H, Q) + + # Make matrix fully Hermitian + i_lower = np.tril_indices(n, -1) + A[i_lower] = np.conj(A.T[i_lower]) + + QHAQ = np.dot(np.conj(Q.T), np.dot(A, Q)) + + # disable rtol here since some values in QTAQ and T are very close + # to 0. + assert_allclose( + QHAQ, T, atol=10*np.finfo(real_dtype).eps, rtol=1.0 + ) + + +def test_gglse(): + # Example data taken from NAG manual + for ind, dtype in enumerate(DTYPES): + # DTYPES = gglse + func, func_lwork = get_lapack_funcs(('gglse', 'gglse_lwork'), + dtype=dtype) + lwork = _compute_lwork(func_lwork, m=6, n=4, p=2) + # For gglse + if ind < 2: + a = np.array([[-0.57, -1.28, -0.39, 0.25], + [-1.93, 1.08, -0.31, -2.14], + [2.30, 0.24, 0.40, -0.35], + [-1.93, 0.64, -0.66, 0.08], + [0.15, 0.30, 0.15, -2.13], + [-0.02, 1.03, -1.43, 0.50]], dtype=dtype) + c = np.array([-1.50, -2.14, 1.23, -0.54, -1.68, 0.82], dtype=dtype) + d = np.array([0., 0.], dtype=dtype) + # For gglse + else: + a = np.array([[0.96-0.81j, -0.03+0.96j, -0.91+2.06j, -0.05+0.41j], + [-0.98+1.98j, -1.20+0.19j, -0.66+0.42j, -0.81+0.56j], + [0.62-0.46j, 1.01+0.02j, 0.63-0.17j, -1.11+0.60j], + [0.37+0.38j, 0.19-0.54j, -0.98-0.36j, 0.22-0.20j], + [0.83+0.51j, 0.20+0.01j, -0.17-0.46j, 1.47+1.59j], + [1.08-0.28j, 0.20-0.12j, -0.07+1.23j, 0.26+0.26j]]) + c = np.array([[-2.54+0.09j], + [1.65-2.26j], + [-2.11-3.96j], + [1.82+3.30j], + [-6.41+3.77j], + [2.07+0.66j]]) + d = np.zeros(2, dtype=dtype) + + b = np.array([[1., 0., -1., 0.], [0., 1., 0., -1.]], dtype=dtype) + + _, _, _, result, _ = func(a, b, c, d, lwork=lwork) + if ind < 2: + expected = np.array([0.48904455, + 0.99754786, + 0.48904455, + 0.99754786]) + else: + expected = np.array([1.08742917-1.96205783j, + -0.74093902+3.72973919j, + 1.08742917-1.96205759j, + -0.74093896+3.72973895j]) + assert_array_almost_equal(result, expected, decimal=4) + + +def test_sycon_hecon(): + seed(1234) + for ind, dtype in enumerate(DTYPES+COMPLEX_DTYPES): + # DTYPES + COMPLEX DTYPES = sycon + hecon + n = 10 + # For sycon + if ind < 4: + func_lwork = get_lapack_funcs('sytrf_lwork', dtype=dtype) + funcon, functrf = get_lapack_funcs(('sycon', 'sytrf'), dtype=dtype) + A = (rand(n, n)).astype(dtype) + # For hecon + else: + func_lwork = get_lapack_funcs('hetrf_lwork', dtype=dtype) + funcon, functrf = get_lapack_funcs(('hecon', 'hetrf'), dtype=dtype) + A = (rand(n, n) + rand(n, n)*1j).astype(dtype) + + # Since sycon only refers to upper/lower part, conj() is safe here. + A = (A + A.conj().T)/2 + 2*np.eye(n, dtype=dtype) + + anorm = norm(A, 1) + lwork = _compute_lwork(func_lwork, n) + ldu, ipiv, _ = functrf(A, lwork=lwork, lower=1) + rcond, _ = funcon(a=ldu, ipiv=ipiv, anorm=anorm, lower=1) + # The error is at most 1-fold + assert_(abs(1/rcond - np.linalg.cond(A, p=1))*rcond < 1) + + +def test_sygst(): + seed(1234) + for ind, dtype in enumerate(REAL_DTYPES): + # DTYPES = sygst + n = 10 + + potrf, sygst, syevd, sygvd = get_lapack_funcs(('potrf', 'sygst', + 'syevd', 'sygvd'), + dtype=dtype) + + A = rand(n, n).astype(dtype) + A = (A + A.T)/2 + # B must be positive definite + B = rand(n, n).astype(dtype) + B = (B + B.T)/2 + 2 * np.eye(n, dtype=dtype) + + # Perform eig (sygvd) + eig_gvd, _, info = sygvd(A, B) + assert_(info == 0) + + # Convert to std problem potrf + b, info = potrf(B) + assert_(info == 0) + a, info = sygst(A, b) + assert_(info == 0) + + eig, _, info = syevd(a) + assert_(info == 0) + assert_allclose(eig, eig_gvd, rtol=1.2e-4) + + +def test_hegst(): + seed(1234) + for ind, dtype in enumerate(COMPLEX_DTYPES): + # DTYPES = hegst + n = 10 + + potrf, hegst, heevd, hegvd = get_lapack_funcs(('potrf', 'hegst', + 'heevd', 'hegvd'), + dtype=dtype) + + A = rand(n, n).astype(dtype) + 1j * rand(n, n).astype(dtype) + A = (A + A.conj().T)/2 + # B must be positive definite + B = rand(n, n).astype(dtype) + 1j * rand(n, n).astype(dtype) + B = (B + B.conj().T)/2 + 2 * np.eye(n, dtype=dtype) + + # Perform eig (hegvd) + eig_gvd, _, info = hegvd(A, B) + assert_(info == 0) + + # Convert to std problem potrf + b, info = potrf(B) + assert_(info == 0) + a, info = hegst(A, b) + assert_(info == 0) + + eig, _, info = heevd(a) + assert_(info == 0) + assert_allclose(eig, eig_gvd, rtol=1e-4) + + +def test_tzrzf(): + """ + This test performs an RZ decomposition in which an m x n upper trapezoidal + array M (m <= n) is factorized as M = [R 0] * Z where R is upper triangular + and Z is unitary. + """ + rng = np.random.RandomState(1234) + m, n = 10, 15 + for ind, dtype in enumerate(DTYPES): + tzrzf, tzrzf_lw = get_lapack_funcs(('tzrzf', 'tzrzf_lwork'), + dtype=dtype) + lwork = _compute_lwork(tzrzf_lw, m, n) + + if ind < 2: + A = triu(rng.rand(m, n).astype(dtype)) + else: + A = triu((rng.rand(m, n) + rng.rand(m, n)*1j).astype(dtype)) + + # assert wrong shape arg, f2py returns generic error + assert_raises(Exception, tzrzf, A.T) + rz, tau, info = tzrzf(A, lwork=lwork) + # Check success + assert_(info == 0) + + # Get Z manually for comparison + R = np.hstack((rz[:, :m], np.zeros((m, n-m), dtype=dtype))) + V = np.hstack((np.eye(m, dtype=dtype), rz[:, m:])) + Id = np.eye(n, dtype=dtype) + ref = [Id-tau[x]*V[[x], :].T.dot(V[[x], :].conj()) for x in range(m)] + Z = reduce(np.dot, ref) + assert_allclose(R.dot(Z) - A, zeros_like(A, dtype=dtype), + atol=10*np.spacing(dtype(1.0).real), rtol=0.) + + +def test_tfsm(): + """ + Test for solving a linear system with the coefficient matrix is a + triangular array stored in Full Packed (RFP) format. + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A = triu(rng.rand(n, n) + rng.rand(n, n)*1j + eye(n)).astype(dtype) + trans = 'C' + else: + A = triu(rng.rand(n, n) + eye(n)).astype(dtype) + trans = 'T' + + trttf, tfttr, tfsm = get_lapack_funcs(('trttf', 'tfttr', 'tfsm'), + dtype=dtype) + + Afp, _ = trttf(A) + B = rng.rand(n, 2).astype(dtype) + soln = tfsm(-1, Afp, B) + assert_array_almost_equal(soln, solve(-A, B), + decimal=4 if ind % 2 == 0 else 6) + + soln = tfsm(-1, Afp, B, trans=trans) + assert_array_almost_equal(soln, solve(-A.conj().T, B), + decimal=4 if ind % 2 == 0 else 6) + + # Make A, unit diagonal + A[np.arange(n), np.arange(n)] = dtype(1.) + soln = tfsm(-1, Afp, B, trans=trans, diag='U') + assert_array_almost_equal(soln, solve(-A.conj().T, B), + decimal=4 if ind % 2 == 0 else 6) + + # Change side + B2 = rng.rand(3, n).astype(dtype) + soln = tfsm(-1, Afp, B2, trans=trans, diag='U', side='R') + assert_array_almost_equal(soln, solve(-A, B2.T).conj().T, + decimal=4 if ind % 2 == 0 else 6) + + +def test_ormrz_unmrz(): + """ + This test performs a matrix multiplication with an arbitrary m x n matrix C + and a unitary matrix Q without explicitly forming the array. The array data + is encoded in the rectangular part of A which is obtained from ?TZRZF. Q + size is inferred by m, n, side keywords. + """ + rng = np.random.RandomState(1234) + qm, qn, cn = 10, 15, 15 + for ind, dtype in enumerate(DTYPES): + tzrzf, tzrzf_lw = get_lapack_funcs(('tzrzf', 'tzrzf_lwork'), + dtype=dtype) + lwork_rz = _compute_lwork(tzrzf_lw, qm, qn) + + if ind < 2: + A = triu(rng.rand(qm, qn).astype(dtype)) + C = rng.rand(cn, cn).astype(dtype) + orun_mrz, orun_mrz_lw = get_lapack_funcs(('ormrz', 'ormrz_lwork'), + dtype=dtype) + else: + A = triu((rng.rand(qm, qn) + rng.rand(qm, qn)*1j).astype(dtype)) + C = (rng.rand(cn, cn) + rand(cn, cn)*1j).astype(dtype) + orun_mrz, orun_mrz_lw = get_lapack_funcs(('unmrz', 'unmrz_lwork'), + dtype=dtype) + + lwork_mrz = _compute_lwork(orun_mrz_lw, cn, cn) + rz, tau, info = tzrzf(A, lwork=lwork_rz) + + # Get Q manually for comparison + V = np.hstack((np.eye(qm, dtype=dtype), rz[:, qm:])) + Id = np.eye(qn, dtype=dtype) + ref = [Id-tau[x]*V[[x], :].T.dot(V[[x], :].conj()) for x in range(qm)] + Q = reduce(np.dot, ref) + + # Now that we have Q, we can test whether lapack results agree with + # each case of CQ, CQ^H, QC, and QC^H + trans = 'T' if ind < 2 else 'C' + tol = 10*np.spacing(dtype(1.0).real) + + cq, info = orun_mrz(rz, tau, C, lwork=lwork_mrz) + assert_(info == 0) + assert_allclose(cq - Q.dot(C), zeros_like(C), atol=tol, rtol=0.) + + cq, info = orun_mrz(rz, tau, C, trans=trans, lwork=lwork_mrz) + assert_(info == 0) + assert_allclose(cq - Q.conj().T.dot(C), zeros_like(C), atol=tol, + rtol=0.) + + cq, info = orun_mrz(rz, tau, C, side='R', lwork=lwork_mrz) + assert_(info == 0) + assert_allclose(cq - C.dot(Q), zeros_like(C), atol=tol, rtol=0.) + + cq, info = orun_mrz(rz, tau, C, side='R', trans=trans, lwork=lwork_mrz) + assert_(info == 0) + assert_allclose(cq - C.dot(Q.conj().T), zeros_like(C), atol=tol, + rtol=0.) + + +def test_tfttr_trttf(): + """ + Test conversion routines between the Rectangular Full Packed (RFP) format + and Standard Triangular Array (TR) + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A_full = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + transr = 'C' + else: + A_full = (rng.rand(n, n)).astype(dtype) + transr = 'T' + + trttf, tfttr = get_lapack_funcs(('trttf', 'tfttr'), dtype=dtype) + A_tf_U, info = trttf(A_full) + assert_(info == 0) + A_tf_L, info = trttf(A_full, uplo='L') + assert_(info == 0) + A_tf_U_T, info = trttf(A_full, transr=transr, uplo='U') + assert_(info == 0) + A_tf_L_T, info = trttf(A_full, transr=transr, uplo='L') + assert_(info == 0) + + # Create the RFP array manually (n is even!) + A_tf_U_m = zeros((n+1, n//2), dtype=dtype) + A_tf_U_m[:-1, :] = triu(A_full)[:, n//2:] + A_tf_U_m[n//2+1:, :] += triu(A_full)[:n//2, :n//2].conj().T + + A_tf_L_m = zeros((n+1, n//2), dtype=dtype) + A_tf_L_m[1:, :] = tril(A_full)[:, :n//2] + A_tf_L_m[:n//2, :] += tril(A_full)[n//2:, n//2:].conj().T + + assert_array_almost_equal(A_tf_U, A_tf_U_m.reshape(-1, order='F')) + assert_array_almost_equal(A_tf_U_T, + A_tf_U_m.conj().T.reshape(-1, order='F')) + + assert_array_almost_equal(A_tf_L, A_tf_L_m.reshape(-1, order='F')) + assert_array_almost_equal(A_tf_L_T, + A_tf_L_m.conj().T.reshape(-1, order='F')) + + # Get the original array from RFP + A_tr_U, info = tfttr(n, A_tf_U) + assert_(info == 0) + A_tr_L, info = tfttr(n, A_tf_L, uplo='L') + assert_(info == 0) + A_tr_U_T, info = tfttr(n, A_tf_U_T, transr=transr, uplo='U') + assert_(info == 0) + A_tr_L_T, info = tfttr(n, A_tf_L_T, transr=transr, uplo='L') + assert_(info == 0) + + assert_array_almost_equal(A_tr_U, triu(A_full)) + assert_array_almost_equal(A_tr_U_T, triu(A_full)) + assert_array_almost_equal(A_tr_L, tril(A_full)) + assert_array_almost_equal(A_tr_L_T, tril(A_full)) + + +def test_tpttr_trttp(): + """ + Test conversion routines between the Rectangular Full Packed (RFP) format + and Standard Triangular Array (TR) + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A_full = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + else: + A_full = (rng.rand(n, n)).astype(dtype) + + trttp, tpttr = get_lapack_funcs(('trttp', 'tpttr'), dtype=dtype) + A_tp_U, info = trttp(A_full) + assert_(info == 0) + A_tp_L, info = trttp(A_full, uplo='L') + assert_(info == 0) + + # Create the TP array manually + inds = tril_indices(n) + A_tp_U_m = zeros(n*(n+1)//2, dtype=dtype) + A_tp_U_m[:] = (triu(A_full).T)[inds] + + inds = triu_indices(n) + A_tp_L_m = zeros(n*(n+1)//2, dtype=dtype) + A_tp_L_m[:] = (tril(A_full).T)[inds] + + assert_array_almost_equal(A_tp_U, A_tp_U_m) + assert_array_almost_equal(A_tp_L, A_tp_L_m) + + # Get the original array from TP + A_tr_U, info = tpttr(n, A_tp_U) + assert_(info == 0) + A_tr_L, info = tpttr(n, A_tp_L, uplo='L') + assert_(info == 0) + + assert_array_almost_equal(A_tr_U, triu(A_full)) + assert_array_almost_equal(A_tr_L, tril(A_full)) + + +def test_pftrf(): + """ + Test Cholesky factorization of a positive definite Rectangular Full + Packed (RFP) format array + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + A = A + A.conj().T + n*eye(n) + else: + A = (rng.rand(n, n)).astype(dtype) + A = A + A.T + n*eye(n) + + pftrf, trttf, tfttr = get_lapack_funcs(('pftrf', 'trttf', 'tfttr'), + dtype=dtype) + + # Get the original array from TP + Afp, info = trttf(A) + Achol_rfp, info = pftrf(n, Afp) + assert_(info == 0) + A_chol_r, _ = tfttr(n, Achol_rfp) + Achol = cholesky(A) + assert_array_almost_equal(A_chol_r, Achol) + + +def test_pftri(): + """ + Test Cholesky factorization of a positive definite Rectangular Full + Packed (RFP) format array to find its inverse + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + A = A + A.conj().T + n*eye(n) + else: + A = (rng.rand(n, n)).astype(dtype) + A = A + A.T + n*eye(n) + + pftri, pftrf, trttf, tfttr = get_lapack_funcs(('pftri', + 'pftrf', + 'trttf', + 'tfttr'), + dtype=dtype) + + # Get the original array from TP + Afp, info = trttf(A) + A_chol_rfp, info = pftrf(n, Afp) + A_inv_rfp, info = pftri(n, A_chol_rfp) + assert_(info == 0) + A_inv_r, _ = tfttr(n, A_inv_rfp) + Ainv = inv(A) + assert_array_almost_equal(A_inv_r, triu(Ainv), + decimal=4 if ind % 2 == 0 else 6) + + +def test_pftrs(): + """ + Test Cholesky factorization of a positive definite Rectangular Full + Packed (RFP) format array and solve a linear system + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + A = A + A.conj().T + n*eye(n) + else: + A = (rng.rand(n, n)).astype(dtype) + A = A + A.T + n*eye(n) + + B = ones((n, 3), dtype=dtype) + Bf1 = ones((n+2, 3), dtype=dtype) + Bf2 = ones((n-2, 3), dtype=dtype) + pftrs, pftrf, trttf, tfttr = get_lapack_funcs(('pftrs', + 'pftrf', + 'trttf', + 'tfttr'), + dtype=dtype) + + # Get the original array from TP + Afp, info = trttf(A) + A_chol_rfp, info = pftrf(n, Afp) + # larger B arrays shouldn't segfault + soln, info = pftrs(n, A_chol_rfp, Bf1) + assert_(info == 0) + assert_raises(Exception, pftrs, n, A_chol_rfp, Bf2) + soln, info = pftrs(n, A_chol_rfp, B) + assert_(info == 0) + assert_array_almost_equal(solve(A, B), soln, + decimal=4 if ind % 2 == 0 else 6) + + +def test_sfrk_hfrk(): + """ + Test for performing a symmetric rank-k operation for matrix in RFP format. + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + if ind > 1: + A = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + A = A + A.conj().T + n*eye(n) + else: + A = (rng.rand(n, n)).astype(dtype) + A = A + A.T + n*eye(n) + + prefix = 's'if ind < 2 else 'h' + trttf, tfttr, shfrk = get_lapack_funcs(('trttf', 'tfttr', f'{prefix}frk'), + dtype=dtype) + + Afp, _ = trttf(A) + C = rng.rand(n, 2).astype(dtype) + Afp_out = shfrk(n, 2, -1, C, 2, Afp) + A_out, _ = tfttr(n, Afp_out) + assert_array_almost_equal(A_out, triu(-C.dot(C.conj().T) + 2*A), + decimal=4 if ind % 2 == 0 else 6) + + +def test_syconv(): + """ + Test for going back and forth between the returned format of he/sytrf to + L and D factors/permutations. + """ + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 10 + + if ind > 1: + A = (rng.randint(-30, 30, (n, n)) + + rng.randint(-30, 30, (n, n))*1j).astype(dtype) + + A = A + A.conj().T + else: + A = rng.randint(-30, 30, (n, n)).astype(dtype) + A = A + A.T + n*eye(n) + + tol = 100*np.spacing(dtype(1.0).real) + syconv, trf, trf_lwork = get_lapack_funcs(('syconv', 'sytrf', + 'sytrf_lwork'), dtype=dtype) + lw = _compute_lwork(trf_lwork, n, lower=1) + L, D, perm = ldl(A, lower=1, hermitian=False) + lw = _compute_lwork(trf_lwork, n, lower=1) + ldu, ipiv, info = trf(A, lower=1, lwork=lw) + a, e, info = syconv(ldu, ipiv, lower=1) + assert_allclose(tril(a, -1,), tril(L[perm, :], -1), atol=tol, rtol=0.) + + # Test also upper + U, D, perm = ldl(A, lower=0, hermitian=False) + ldu, ipiv, info = trf(A, lower=0) + a, e, info = syconv(ldu, ipiv, lower=0) + assert_allclose(triu(a, 1), triu(U[perm, :], 1), atol=tol, rtol=0.) + + +class TestBlockedQR: + """ + Tests for the blocked QR factorization, namely through geqrt, gemqrt, tpqrt + and tpmqr. + """ + + def test_geqrt_gemqrt(self): + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + + if ind > 1: + A = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + else: + A = (rng.rand(n, n)).astype(dtype) + + tol = 100*np.spacing(dtype(1.0).real) + geqrt, gemqrt = get_lapack_funcs(('geqrt', 'gemqrt'), dtype=dtype) + + a, t, info = geqrt(n, A) + assert info == 0 + + # Extract elementary reflectors from lower triangle, adding the + # main diagonal of ones. + v = np.tril(a, -1) + np.eye(n, dtype=dtype) + # Generate the block Householder transform I - VTV^H + Q = np.eye(n, dtype=dtype) - v @ t @ v.T.conj() + R = np.triu(a) + + # Test columns of Q are orthogonal + assert_allclose(Q.T.conj() @ Q, np.eye(n, dtype=dtype), atol=tol, + rtol=0.) + assert_allclose(Q @ R, A, atol=tol, rtol=0.) + + if ind > 1: + C = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + transpose = 'C' + else: + C = (rng.rand(n, n)).astype(dtype) + transpose = 'T' + + for side in ('L', 'R'): + for trans in ('N', transpose): + c, info = gemqrt(a, t, C, side=side, trans=trans) + assert info == 0 + + if trans == transpose: + q = Q.T.conj() + else: + q = Q + + if side == 'L': + qC = q @ C + else: + qC = C @ q + + assert_allclose(c, qC, atol=tol, rtol=0.) + + # Test default arguments + if (side, trans) == ('L', 'N'): + c_default, info = gemqrt(a, t, C) + assert info == 0 + assert_equal(c_default, c) + + # Test invalid side/trans + assert_raises(Exception, gemqrt, a, t, C, side='A') + assert_raises(Exception, gemqrt, a, t, C, trans='A') + + def test_tpqrt_tpmqrt(self): + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + n = 20 + + if ind > 1: + A = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + B = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + else: + A = (rng.rand(n, n)).astype(dtype) + B = (rng.rand(n, n)).astype(dtype) + + tol = 100*np.spacing(dtype(1.0).real) + tpqrt, tpmqrt = get_lapack_funcs(('tpqrt', 'tpmqrt'), dtype=dtype) + + # Test for the range of pentagonal B, from square to upper + # triangular + for l in (0, n // 2, n): + a, b, t, info = tpqrt(l, n, A, B) + assert info == 0 + + # Check that lower triangular part of A has not been modified + assert_equal(np.tril(a, -1), np.tril(A, -1)) + # Check that elements not part of the pentagonal portion of B + # have not been modified. + assert_equal(np.tril(b, l - n - 1), np.tril(B, l - n - 1)) + + # Extract pentagonal portion of B + B_pent, b_pent = np.triu(B, l - n), np.triu(b, l - n) + + # Generate elementary reflectors + v = np.concatenate((np.eye(n, dtype=dtype), b_pent)) + # Generate the block Householder transform I - VTV^H + Q = np.eye(2 * n, dtype=dtype) - v @ t @ v.T.conj() + R = np.concatenate((np.triu(a), np.zeros_like(a))) + + # Test columns of Q are orthogonal + assert_allclose(Q.T.conj() @ Q, np.eye(2 * n, dtype=dtype), + atol=tol, rtol=0.) + assert_allclose(Q @ R, np.concatenate((np.triu(A), B_pent)), + atol=tol, rtol=0.) + + if ind > 1: + C = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + D = (rng.rand(n, n) + rng.rand(n, n)*1j).astype(dtype) + transpose = 'C' + else: + C = (rng.rand(n, n)).astype(dtype) + D = (rng.rand(n, n)).astype(dtype) + transpose = 'T' + + for side in ('L', 'R'): + for trans in ('N', transpose): + c, d, info = tpmqrt(l, b, t, C, D, side=side, + trans=trans) + assert info == 0 + + if trans == transpose: + q = Q.T.conj() + else: + q = Q + + if side == 'L': + cd = np.concatenate((c, d), axis=0) + CD = np.concatenate((C, D), axis=0) + qCD = q @ CD + else: + cd = np.concatenate((c, d), axis=1) + CD = np.concatenate((C, D), axis=1) + qCD = CD @ q + + assert_allclose(cd, qCD, atol=tol, rtol=0.) + + if (side, trans) == ('L', 'N'): + c_default, d_default, info = tpmqrt(l, b, t, C, D) + assert info == 0 + assert_equal(c_default, c) + assert_equal(d_default, d) + + # Test invalid side/trans + assert_raises(Exception, tpmqrt, l, b, t, C, D, side='A') + assert_raises(Exception, tpmqrt, l, b, t, C, D, trans='A') + + +def test_pstrf(): + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + # DTYPES = pstrf + n = 10 + r = 2 + pstrf = get_lapack_funcs('pstrf', dtype=dtype) + + # Create positive semidefinite A + if ind > 1: + A = rng.rand(n, n-r).astype(dtype) + 1j * rng.rand(n, n-r).astype(dtype) + A = A @ A.conj().T + else: + A = rng.rand(n, n-r).astype(dtype) + A = A @ A.T + + c, piv, r_c, info = pstrf(A) + U = triu(c) + U[r_c - n:, r_c - n:] = 0. + + assert_equal(info, 1) + # python-dbg 3.5.2 runs cause trouble with the following assertion. + # assert_equal(r_c, n - r) + single_atol = 1000 * np.finfo(np.float32).eps + double_atol = 1000 * np.finfo(np.float64).eps + atol = single_atol if ind in [0, 2] else double_atol + assert_allclose(A[piv-1][:, piv-1], U.conj().T @ U, rtol=0., atol=atol) + + c, piv, r_c, info = pstrf(A, lower=1) + L = tril(c) + L[r_c - n:, r_c - n:] = 0. + + assert_equal(info, 1) + # assert_equal(r_c, n - r) + single_atol = 1000 * np.finfo(np.float32).eps + double_atol = 1000 * np.finfo(np.float64).eps + atol = single_atol if ind in [0, 2] else double_atol + assert_allclose(A[piv-1][:, piv-1], L @ L.conj().T, rtol=0., atol=atol) + + +def test_pstf2(): + rng = np.random.RandomState(1234) + for ind, dtype in enumerate(DTYPES): + # DTYPES = pstf2 + n = 10 + r = 2 + pstf2 = get_lapack_funcs('pstf2', dtype=dtype) + + # Create positive semidefinite A + if ind > 1: + A = rng.rand(n, n-r).astype(dtype) + 1j * rng.rand(n, n-r).astype(dtype) + A = A @ A.conj().T + else: + A = rng.rand(n, n-r).astype(dtype) + A = A @ A.T + + c, piv, r_c, info = pstf2(A) + U = triu(c) + U[r_c - n:, r_c - n:] = 0. + + assert_equal(info, 1) + # python-dbg 3.5.2 runs cause trouble with the commented assertions. + # assert_equal(r_c, n - r) + single_atol = 1000 * np.finfo(np.float32).eps + double_atol = 1000 * np.finfo(np.float64).eps + atol = single_atol if ind in [0, 2] else double_atol + assert_allclose(A[piv-1][:, piv-1], U.conj().T @ U, rtol=0., atol=atol) + + c, piv, r_c, info = pstf2(A, lower=1) + L = tril(c) + L[r_c - n:, r_c - n:] = 0. + + assert_equal(info, 1) + # assert_equal(r_c, n - r) + single_atol = 1000 * np.finfo(np.float32).eps + double_atol = 1000 * np.finfo(np.float64).eps + atol = single_atol if ind in [0, 2] else double_atol + assert_allclose(A[piv-1][:, piv-1], L @ L.conj().T, rtol=0., atol=atol) + + +def test_geequ(): + desired_real = np.array([[0.6250, 1.0000, 0.0393, -0.4269], + [1.0000, -0.5619, -1.0000, -1.0000], + [0.5874, -1.0000, -0.0596, -0.5341], + [-1.0000, -0.5946, -0.0294, 0.9957]]) + + desired_cplx = np.array([[-0.2816+0.5359*1j, + 0.0812+0.9188*1j, + -0.7439-0.2561*1j], + [-0.3562-0.2954*1j, + 0.9566-0.0434*1j, + -0.0174+0.1555*1j], + [0.8607+0.1393*1j, + -0.2759+0.7241*1j, + -0.1642-0.1365*1j]]) + + for ind, dtype in enumerate(DTYPES): + if ind < 2: + # Use examples from the NAG documentation + A = np.array([[1.80e+10, 2.88e+10, 2.05e+00, -8.90e+09], + [5.25e+00, -2.95e+00, -9.50e-09, -3.80e+00], + [1.58e+00, -2.69e+00, -2.90e-10, -1.04e+00], + [-1.11e+00, -6.60e-01, -5.90e-11, 8.00e-01]]) + A = A.astype(dtype) + else: + A = np.array([[-1.34e+00, 0.28e+10, -6.39e+00], + [-1.70e+00, 3.31e+10, -0.15e+00], + [2.41e-10, -0.56e+00, -0.83e-10]], dtype=dtype) + A += np.array([[2.55e+00, 3.17e+10, -2.20e+00], + [-1.41e+00, -0.15e+10, 1.34e+00], + [0.39e-10, 1.47e+00, -0.69e-10]])*1j + + A = A.astype(dtype) + + geequ = get_lapack_funcs('geequ', dtype=dtype) + r, c, rowcnd, colcnd, amax, info = geequ(A) + + if ind < 2: + assert_allclose(desired_real.astype(dtype), r[:, None]*A*c, + rtol=0, atol=1e-4) + else: + assert_allclose(desired_cplx.astype(dtype), r[:, None]*A*c, + rtol=0, atol=1e-4) + + +def test_syequb(): + desired_log2s = np.array([0, 0, 0, 0, 0, 0, -1, -1, -2, -3]) + + for ind, dtype in enumerate(DTYPES): + A = np.eye(10, dtype=dtype) + alpha = dtype(1. if ind < 2 else 1.j) + d = np.array([alpha * 2.**x for x in range(-5, 5)], dtype=dtype) + A += np.rot90(np.diag(d)) + + syequb = get_lapack_funcs('syequb', dtype=dtype) + s, scond, amax, info = syequb(A) + + assert_equal(np.log2(s).astype(int), desired_log2s) + + +@pytest.mark.skipif(True, + reason="Failing on some OpenBLAS version, see gh-12276") +def test_heequb(): + # zheequb has a bug for versions =< LAPACK 3.9.0 + # See Reference-LAPACK gh-61 and gh-408 + # Hence the zheequb test is customized accordingly to avoid + # work scaling. + A = np.diag([2]*5 + [1002]*5) + np.diag(np.ones(9), k=1)*1j + s, scond, amax, info = lapack.zheequb(A) + assert_equal(info, 0) + assert_allclose(np.log2(s), [0., -1.]*2 + [0.] + [-4]*5) + + A = np.diag(2**np.abs(np.arange(-5, 6)) + 0j) + A[5, 5] = 1024 + A[5, 0] = 16j + s, scond, amax, info = lapack.cheequb(A.astype(np.complex64), lower=1) + assert_equal(info, 0) + assert_allclose(np.log2(s), [-2, -1, -1, 0, 0, -5, 0, -1, -1, -2, -2]) + + +def test_getc2_gesc2(): + rng = np.random.RandomState(42) + n = 10 + desired_real = rng.rand(n) + desired_cplx = rng.rand(n) + rng.rand(n)*1j + + for ind, dtype in enumerate(DTYPES): + if ind < 2: + A = rng.rand(n, n) + A = A.astype(dtype) + b = A @ desired_real + b = b.astype(dtype) + else: + A = rng.rand(n, n) + rng.rand(n, n)*1j + A = A.astype(dtype) + b = A @ desired_cplx + b = b.astype(dtype) + + getc2 = get_lapack_funcs('getc2', dtype=dtype) + gesc2 = get_lapack_funcs('gesc2', dtype=dtype) + lu, ipiv, jpiv, info = getc2(A, overwrite_a=0) + x, scale = gesc2(lu, b, ipiv, jpiv, overwrite_rhs=0) + + if ind < 2: + assert_array_almost_equal(desired_real.astype(dtype), + x/scale, decimal=4) + else: + assert_array_almost_equal(desired_cplx.astype(dtype), + x/scale, decimal=4) + + +@pytest.mark.parametrize('size', [(6, 5), (5, 5)]) +@pytest.mark.parametrize('dtype', REAL_DTYPES) +@pytest.mark.parametrize('joba', range(6)) # 'C', 'E', 'F', 'G', 'A', 'R' +@pytest.mark.parametrize('jobu', range(4)) # 'U', 'F', 'W', 'N' +@pytest.mark.parametrize('jobv', range(4)) # 'V', 'J', 'W', 'N' +@pytest.mark.parametrize('jobr', [0, 1]) +@pytest.mark.parametrize('jobp', [0, 1]) +def test_gejsv_general(size, dtype, joba, jobu, jobv, jobr, jobp, jobt=0): + """Test the lapack routine ?gejsv. + + This function tests that a singular value decomposition can be performed + on the random M-by-N matrix A. The test performs the SVD using ?gejsv + then performs the following checks: + + * ?gejsv exist successfully (info == 0) + * The returned singular values are correct + * `A` can be reconstructed from `u`, `SIGMA`, `v` + * Ensure that u.T @ u is the identity matrix + * Ensure that v.T @ v is the identity matrix + * The reported matrix rank + * The reported number of singular values + * If denormalized floats are required + + Notes + ----- + joba specifies several choices effecting the calculation's accuracy + Although all arguments are tested, the tests only check that the correct + solution is returned - NOT that the prescribed actions are performed + internally. + + jobt is, as of v3.9.0, still experimental and removed to cut down number of + test cases. However keyword itself is tested externally. + """ + rng = np.random.RandomState(42) + + # Define some constants for later use: + m, n = size + atol = 100 * np.finfo(dtype).eps + A = generate_random_dtype_array(size, dtype, rng) + gejsv = get_lapack_funcs('gejsv', dtype=dtype) + + # Set up checks for invalid job? combinations + # if an invalid combination occurs we set the appropriate + # exit status. + lsvec = jobu < 2 # Calculate left singular vectors + rsvec = jobv < 2 # Calculate right singular vectors + l2tran = (jobt == 1) and (m == n) + is_complex = np.iscomplexobj(A) + + invalid_real_jobv = (jobv == 1) and (not lsvec) and (not is_complex) + invalid_cplx_jobu = (jobu == 2) and not (rsvec and l2tran) and is_complex + invalid_cplx_jobv = (jobv == 2) and not (lsvec and l2tran) and is_complex + + # Set the exit status to the expected value. + # Here we only check for invalid combinations, not individual + # parameters. + if invalid_cplx_jobu: + exit_status = -2 + elif invalid_real_jobv or invalid_cplx_jobv: + exit_status = -3 + else: + exit_status = 0 + + if (jobu > 1) and (jobv == 1): + assert_raises(Exception, gejsv, A, joba, jobu, jobv, jobr, jobt, jobp) + else: + sva, u, v, work, iwork, info = gejsv(A, + joba=joba, + jobu=jobu, + jobv=jobv, + jobr=jobr, + jobt=jobt, + jobp=jobp) + + # Check that ?gejsv exited successfully/as expected + assert_equal(info, exit_status) + + # If exit_status is non-zero the combination of jobs is invalid. + # We test this above but no calculations are performed. + if not exit_status: + + # Check the returned singular values + sigma = (work[0] / work[1]) * sva[:n] + assert_allclose(sigma, svd(A, compute_uv=False), atol=atol) + + if jobu == 1: + # If JOBU = 'F', then u contains the M-by-M matrix of + # the left singular vectors, including an ONB of the orthogonal + # complement of the Range(A) + # However, to recalculate A we are concerned about the + # first n singular values and so can ignore the latter. + # TODO: Add a test for ONB? + u = u[:, :n] + + if lsvec and rsvec: + assert_allclose(u @ np.diag(sigma) @ v.conj().T, A, atol=atol) + if lsvec: + assert_allclose(u.conj().T @ u, np.identity(n), atol=atol) + if rsvec: + assert_allclose(v.conj().T @ v, np.identity(n), atol=atol) + + assert_equal(iwork[0], np.linalg.matrix_rank(A)) + assert_equal(iwork[1], np.count_nonzero(sigma)) + # iwork[2] is non-zero if requested accuracy is not warranted for + # the data. This should never occur for these tests. + assert_equal(iwork[2], 0) + + +@pytest.mark.parametrize('dtype', REAL_DTYPES) +def test_gejsv_edge_arguments(dtype): + """Test edge arguments return expected status""" + gejsv = get_lapack_funcs('gejsv', dtype=dtype) + + # scalar A + sva, u, v, work, iwork, info = gejsv(1.) + assert_equal(info, 0) + assert_equal(u.shape, (1, 1)) + assert_equal(v.shape, (1, 1)) + assert_equal(sva, np.array([1.], dtype=dtype)) + + # 1d A + A = np.ones((1,), dtype=dtype) + sva, u, v, work, iwork, info = gejsv(A) + assert_equal(info, 0) + assert_equal(u.shape, (1, 1)) + assert_equal(v.shape, (1, 1)) + assert_equal(sva, np.array([1.], dtype=dtype)) + + # 2d empty A + A = np.ones((1, 0), dtype=dtype) + sva, u, v, work, iwork, info = gejsv(A) + assert_equal(info, 0) + assert_equal(u.shape, (1, 0)) + assert_equal(v.shape, (1, 0)) + assert_equal(sva, np.array([], dtype=dtype)) + + # make sure "overwrite_a" is respected - user reported in gh-13191 + A = np.sin(np.arange(100).reshape(10, 10)).astype(dtype) + A = np.asfortranarray(A + A.T) # make it symmetric and column major + Ac = A.copy('A') + _ = gejsv(A) + assert_allclose(A, Ac) + + +@pytest.mark.parametrize(('kwargs'), + ({'joba': 9}, + {'jobu': 9}, + {'jobv': 9}, + {'jobr': 9}, + {'jobt': 9}, + {'jobp': 9}) + ) +def test_gejsv_invalid_job_arguments(kwargs): + """Test invalid job arguments raise an Exception""" + A = np.ones((2, 2), dtype=float) + gejsv = get_lapack_funcs('gejsv', dtype=float) + assert_raises(Exception, gejsv, A, **kwargs) + + +@pytest.mark.parametrize("A,sva_expect,u_expect,v_expect", + [(np.array([[2.27, -1.54, 1.15, -1.94], + [0.28, -1.67, 0.94, -0.78], + [-0.48, -3.09, 0.99, -0.21], + [1.07, 1.22, 0.79, 0.63], + [-2.35, 2.93, -1.45, 2.30], + [0.62, -7.39, 1.03, -2.57]]), + np.array([9.9966, 3.6831, 1.3569, 0.5000]), + np.array([[0.2774, -0.6003, -0.1277, 0.1323], + [0.2020, -0.0301, 0.2805, 0.7034], + [0.2918, 0.3348, 0.6453, 0.1906], + [-0.0938, -0.3699, 0.6781, -0.5399], + [-0.4213, 0.5266, 0.0413, -0.0575], + [0.7816, 0.3353, -0.1645, -0.3957]]), + np.array([[0.1921, -0.8030, 0.0041, -0.5642], + [-0.8794, -0.3926, -0.0752, 0.2587], + [0.2140, -0.2980, 0.7827, 0.5027], + [-0.3795, 0.3351, 0.6178, -0.6017]]))]) +def test_gejsv_NAG(A, sva_expect, u_expect, v_expect): + """ + This test implements the example found in the NAG manual, f08khf. + An example was not found for the complex case. + """ + # NAG manual provides accuracy up to 4 decimals + atol = 1e-4 + gejsv = get_lapack_funcs('gejsv', dtype=A.dtype) + + sva, u, v, work, iwork, info = gejsv(A) + + assert_allclose(sva_expect, sva, atol=atol) + assert_allclose(u_expect, u, atol=atol) + assert_allclose(v_expect, v, atol=atol) + + +@pytest.mark.parametrize("dtype", DTYPES) +def test_gttrf_gttrs(dtype): + # The test uses ?gttrf and ?gttrs to solve a random system for each dtype, + # tests that the output of ?gttrf define LU matrices, that input + # parameters are unmodified, transposal options function correctly, that + # incompatible matrix shapes raise an error, and singular matrices return + # non zero info. + + rng = np.random.RandomState(42) + n = 10 + atol = 100 * np.finfo(dtype).eps + + # create the matrix in accordance with the data type + du = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + d = generate_random_dtype_array((n,), dtype=dtype, rng=rng) + dl = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + + diag_cpy = [dl.copy(), d.copy(), du.copy()] + + A = np.diag(d) + np.diag(dl, -1) + np.diag(du, 1) + x = np.random.rand(n) + b = A @ x + + gttrf, gttrs = get_lapack_funcs(('gttrf', 'gttrs'), dtype=dtype) + + _dl, _d, _du, du2, ipiv, info = gttrf(dl, d, du) + # test to assure that the inputs of ?gttrf are unmodified + assert_array_equal(dl, diag_cpy[0]) + assert_array_equal(d, diag_cpy[1]) + assert_array_equal(du, diag_cpy[2]) + + # generate L and U factors from ?gttrf return values + # L/U are lower/upper triangular by construction (initially and at end) + U = np.diag(_d, 0) + np.diag(_du, 1) + np.diag(du2, 2) + L = np.eye(n, dtype=dtype) + + for i, m in enumerate(_dl): + # L is given in a factored form. + # See + # www.hpcavf.uclan.ac.uk/softwaredoc/sgi_scsl_html/sgi_html/ch03.html + piv = ipiv[i] - 1 + # right multiply by permutation matrix + L[:, [i, piv]] = L[:, [piv, i]] + # right multiply by Li, rank-one modification of identity + L[:, i] += L[:, i+1]*m + + # one last permutation + i, piv = -1, ipiv[-1] - 1 + # right multiply by final permutation matrix + L[:, [i, piv]] = L[:, [piv, i]] + + # check that the outputs of ?gttrf define an LU decomposition of A + assert_allclose(A, L @ U, atol=atol) + + b_cpy = b.copy() + x_gttrs, info = gttrs(_dl, _d, _du, du2, ipiv, b) + # test that the inputs of ?gttrs are unmodified + assert_array_equal(b, b_cpy) + # test that the result of ?gttrs matches the expected input + assert_allclose(x, x_gttrs, atol=atol) + + # test that ?gttrf and ?gttrs work with transposal options + if dtype in REAL_DTYPES: + trans = "T" + b_trans = A.T @ x + else: + trans = "C" + b_trans = A.conj().T @ x + + x_gttrs, info = gttrs(_dl, _d, _du, du2, ipiv, b_trans, trans=trans) + assert_allclose(x, x_gttrs, atol=atol) + + # test that ValueError is raised with incompatible matrix shapes + with assert_raises(ValueError): + gttrf(dl[:-1], d, du) + with assert_raises(ValueError): + gttrf(dl, d[:-1], du) + with assert_raises(ValueError): + gttrf(dl, d, du[:-1]) + + # test that matrix of size n=2 raises exception + with assert_raises(ValueError): + gttrf(dl[0], d[:1], du[0]) + + # test that singular (row of all zeroes) matrix fails via info + du[0] = 0 + d[0] = 0 + __dl, __d, __du, _du2, _ipiv, _info = gttrf(dl, d, du) + np.testing.assert_(__d[info - 1] == 0, (f"?gttrf: _d[info-1] is {__d[info - 1]}," + " not the illegal value :0.")) + + +@pytest.mark.parametrize("du, d, dl, du_exp, d_exp, du2_exp, ipiv_exp, b, x", + [(np.array([2.1, -1.0, 1.9, 8.0]), + np.array([3.0, 2.3, -5.0, -.9, 7.1]), + np.array([3.4, 3.6, 7.0, -6.0]), + np.array([2.3, -5, -.9, 7.1]), + np.array([3.4, 3.6, 7, -6, -1.015373]), + np.array([-1, 1.9, 8]), + np.array([2, 3, 4, 5, 5]), + np.array([[2.7, 6.6], + [-0.5, 10.8], + [2.6, -3.2], + [0.6, -11.2], + [2.7, 19.1] + ]), + np.array([[-4, 5], + [7, -4], + [3, -3], + [-4, -2], + [-3, 1]])), + ( + np.array([2 - 1j, 2 + 1j, -1 + 1j, 1 - 1j]), + np.array([-1.3 + 1.3j, -1.3 + 1.3j, + -1.3 + 3.3j, - .3 + 4.3j, + -3.3 + 1.3j]), + np.array([1 - 2j, 1 + 1j, 2 - 3j, 1 + 1j]), + # du exp + np.array([-1.3 + 1.3j, -1.3 + 3.3j, + -0.3 + 4.3j, -3.3 + 1.3j]), + np.array([1 - 2j, 1 + 1j, 2 - 3j, 1 + 1j, + -1.3399 + 0.2875j]), + np.array([2 + 1j, -1 + 1j, 1 - 1j]), + np.array([2, 3, 4, 5, 5]), + np.array([[2.4 - 5j, 2.7 + 6.9j], + [3.4 + 18.2j, - 6.9 - 5.3j], + [-14.7 + 9.7j, - 6 - .6j], + [31.9 - 7.7j, -3.9 + 9.3j], + [-1 + 1.6j, -3 + 12.2j]]), + np.array([[1 + 1j, 2 - 1j], + [3 - 1j, 1 + 2j], + [4 + 5j, -1 + 1j], + [-1 - 2j, 2 + 1j], + [1 - 1j, 2 - 2j]]) + )]) +def test_gttrf_gttrs_NAG_f07cdf_f07cef_f07crf_f07csf(du, d, dl, du_exp, d_exp, + du2_exp, ipiv_exp, b, x): + # test to assure that wrapper is consistent with NAG Library Manual Mark 26 + # example problems: f07cdf and f07cef (real) + # examples: f07crf and f07csf (complex) + # (Links may expire, so search for "NAG Library Manual Mark 26" online) + + gttrf, gttrs = get_lapack_funcs(('gttrf', "gttrs"), (du[0], du[0])) + + _dl, _d, _du, du2, ipiv, info = gttrf(dl, d, du) + assert_allclose(du2, du2_exp) + assert_allclose(_du, du_exp) + assert_allclose(_d, d_exp, atol=1e-4) # NAG examples provide 4 decimals. + assert_allclose(ipiv, ipiv_exp) + + x_gttrs, info = gttrs(_dl, _d, _du, du2, ipiv, b) + + assert_allclose(x_gttrs, x) + + +@pytest.mark.parametrize('dtype', DTYPES) +@pytest.mark.parametrize('norm', ['1', 'I', 'O']) +@pytest.mark.parametrize('n', [3, 10]) +def test_gtcon(dtype, norm, n): + rng = np.random.default_rng(23498324) + + d = rng.random(n) + rng.random(n)*1j + dl = rng.random(n - 1) + rng.random(n - 1)*1j + du = rng.random(n - 1) + rng.random(n - 1)*1j + A = np.diag(d) + np.diag(dl, -1) + np.diag(du, 1) + if np.issubdtype(dtype, np.floating): + A, d, dl, du = A.real, d.real, dl.real, du.real + A, d, dl, du = A.astype(dtype), d.astype(dtype), dl.astype(dtype), du.astype(dtype) + + anorm = np.abs(A).sum(axis=0).max() + + gttrf, gtcon = get_lapack_funcs(('gttrf', 'gtcon'), (A,)) + dl, d, du, du2, ipiv, info = gttrf(dl, d, du) + res, _ = gtcon(dl, d, du, du2, ipiv, anorm, norm=norm) + + gecon, getrf = get_lapack_funcs(('gecon', 'getrf'), (A,)) + lu, ipvt, info = getrf(A) + ref, _ = gecon(lu, anorm, norm=norm) + + rtol = np.finfo(dtype).eps**0.75 + assert_allclose(res, ref, rtol=rtol) + + +@pytest.mark.parametrize('dtype', DTYPES) +@pytest.mark.parametrize('shape', [(3, 7), (7, 3), (2**18, 2**18)]) +def test_geqrfp_lwork(dtype, shape): + geqrfp_lwork = get_lapack_funcs(('geqrfp_lwork'), dtype=dtype) + m, n = shape + lwork, info = geqrfp_lwork(m=m, n=n) + assert_equal(info, 0) + + +@pytest.mark.parametrize("ddtype,dtype", + zip(REAL_DTYPES + REAL_DTYPES, DTYPES)) +def test_pttrf_pttrs(ddtype, dtype): + rng = np.random.RandomState(42) + # set test tolerance appropriate for dtype + atol = 100*np.finfo(dtype).eps + # n is the length diagonal of A + n = 10 + # create diagonals according to size and dtype + + # diagonal d should always be real. + # add 4 to d so it will be dominant for all dtypes + d = generate_random_dtype_array((n,), ddtype, rng) + 4 + # diagonal e may be real or complex. + e = generate_random_dtype_array((n-1,), dtype, rng) + + # assemble diagonals together into matrix + A = np.diag(d) + np.diag(e, -1) + np.diag(np.conj(e), 1) + # store a copy of diagonals to later verify + diag_cpy = [d.copy(), e.copy()] + + pttrf = get_lapack_funcs('pttrf', dtype=dtype) + + _d, _e, info = pttrf(d, e) + # test to assure that the inputs of ?pttrf are unmodified + assert_array_equal(d, diag_cpy[0]) + assert_array_equal(e, diag_cpy[1]) + assert_equal(info, 0, err_msg=f"pttrf: info = {info}, should be 0") + + # test that the factors from pttrf can be recombined to make A + L = np.diag(_e, -1) + np.diag(np.ones(n)) + D = np.diag(_d) + + assert_allclose(A, L@D@L.conjugate().T, atol=atol) + + # generate random solution x + x = generate_random_dtype_array((n,), dtype, rng) + # determine accompanying b to get soln x + b = A@x + + # determine _x from pttrs + pttrs = get_lapack_funcs('pttrs', dtype=dtype) + _x, info = pttrs(_d, _e.conj(), b) + assert_equal(info, 0, err_msg=f"pttrs: info = {info}, should be 0") + + # test that _x from pttrs matches the expected x + assert_allclose(x, _x, atol=atol) + + +@pytest.mark.parametrize("ddtype,dtype", + zip(REAL_DTYPES + REAL_DTYPES, DTYPES)) +def test_pttrf_pttrs_errors_incompatible_shape(ddtype, dtype): + n = 10 + rng = np.random.RandomState(1234) + pttrf = get_lapack_funcs('pttrf', dtype=dtype) + d = generate_random_dtype_array((n,), ddtype, rng) + 2 + e = generate_random_dtype_array((n-1,), dtype, rng) + # test that ValueError is raised with incompatible matrix shapes + assert_raises(ValueError, pttrf, d[:-1], e) + assert_raises(ValueError, pttrf, d, e[:-1]) + + +@pytest.mark.parametrize("ddtype,dtype", + zip(REAL_DTYPES + REAL_DTYPES, DTYPES)) +def test_pttrf_pttrs_errors_singular_nonSPD(ddtype, dtype): + n = 10 + rng = np.random.RandomState(42) + pttrf = get_lapack_funcs('pttrf', dtype=dtype) + d = generate_random_dtype_array((n,), ddtype, rng) + 2 + e = generate_random_dtype_array((n-1,), dtype, rng) + # test that singular (row of all zeroes) matrix fails via info + d[0] = 0 + e[0] = 0 + _d, _e, info = pttrf(d, e) + assert_equal(_d[info - 1], 0, + f"?pttrf: _d[info-1] is {_d[info - 1]}, not the illegal value :0.") + + # test with non-spd matrix + d = generate_random_dtype_array((n,), ddtype, rng) + _d, _e, info = pttrf(d, e) + assert_(info != 0, "?pttrf should fail with non-spd matrix, but didn't") + + +@pytest.mark.parametrize(("d, e, d_expect, e_expect, b, x_expect"), [ + (np.array([4, 10, 29, 25, 5]), + np.array([-2, -6, 15, 8]), + np.array([4, 9, 25, 16, 1]), + np.array([-.5, -.6667, .6, .5]), + np.array([[6, 10], [9, 4], [2, 9], [14, 65], + [7, 23]]), + np.array([[2.5, 2], [2, -1], [1, -3], [-1, 6], + [3, -5]]) + ), ( + np.array([16, 41, 46, 21]), + np.array([16 + 16j, 18 - 9j, 1 - 4j]), + np.array([16, 9, 1, 4]), + np.array([1+1j, 2-1j, 1-4j]), + np.array([[64+16j, -16-32j], [93+62j, 61-66j], + [78-80j, 71-74j], [14-27j, 35+15j]]), + np.array([[2+1j, -3-2j], [1+1j, 1+1j], [1-2j, 1-2j], + [1-1j, 2+1j]]) + )]) +def test_pttrf_pttrs_NAG(d, e, d_expect, e_expect, b, x_expect): + # test to assure that wrapper is consistent with NAG Manual Mark 26 + # example problems: f07jdf and f07jef (real) + # examples: f07jrf and f07csf (complex) + # NAG examples provide 4 decimals. + # (Links expire, so please search for "NAG Library Manual Mark 26" online) + + atol = 1e-4 + pttrf = get_lapack_funcs('pttrf', dtype=e[0]) + _d, _e, info = pttrf(d, e) + assert_allclose(_d, d_expect, atol=atol) + assert_allclose(_e, e_expect, atol=atol) + + pttrs = get_lapack_funcs('pttrs', dtype=e[0]) + _x, info = pttrs(_d, _e.conj(), b) + assert_allclose(_x, x_expect, atol=atol) + + # also test option `lower` + if e.dtype in COMPLEX_DTYPES: + _x, info = pttrs(_d, _e, b, lower=1) + assert_allclose(_x, x_expect, atol=atol) + + +def pteqr_get_d_e_A_z(dtype, realtype, n, compute_z): + # used by ?pteqr tests to build parameters + # returns tuple of (d, e, A, z) + rng = np.random.RandomState(42) + if compute_z == 1: + # build Hermitian A from Q**T * tri * Q = A by creating Q and tri + A_eig = generate_random_dtype_array((n, n), dtype, rng) + A_eig = A_eig + np.diag(np.zeros(n) + 4*n) + A_eig = (A_eig + A_eig.conj().T) / 2 + # obtain right eigenvectors (orthogonal) + vr = eigh(A_eig)[1] + # create tridiagonal matrix + d = generate_random_dtype_array((n,), realtype, rng) + 4 + e = generate_random_dtype_array((n-1,), realtype, rng) + tri = np.diag(d) + np.diag(e, 1) + np.diag(e, -1) + # Build A using these factors that sytrd would: (Q**T * tri * Q = A) + A = vr @ tri @ vr.conj().T + # vr is orthogonal + z = vr + + else: + # d and e are always real per lapack docs. + d = generate_random_dtype_array((n,), realtype, rng) + e = generate_random_dtype_array((n-1,), realtype, rng) + + # make SPD + d = d + 4 + A = np.diag(d) + np.diag(e, 1) + np.diag(e, -1) + z = np.diag(d) + np.diag(e, -1) + np.diag(e, 1) + return (d, e, A, z) + + +@pytest.mark.parametrize("dtype,realtype", + zip(DTYPES, REAL_DTYPES + REAL_DTYPES)) +@pytest.mark.parametrize("compute_z", range(3)) +def test_pteqr(dtype, realtype, compute_z): + ''' + Tests the ?pteqr lapack routine for all dtypes and compute_z parameters. + It generates random SPD matrix diagonals d and e, and then confirms + correct eigenvalues with scipy.linalg.eig. With applicable compute_z=2 it + tests that z can reform A. + ''' + seed(42) + atol = 1000*np.finfo(dtype).eps + pteqr = get_lapack_funcs(('pteqr'), dtype=dtype) + + n = 10 + + d, e, A, z = pteqr_get_d_e_A_z(dtype, realtype, n, compute_z) + + d_pteqr, e_pteqr, z_pteqr, info = pteqr(d=d, e=e, z=z, compute_z=compute_z) + assert_equal(info, 0, f"info = {info}, should be 0.") + + # compare the routine's eigenvalues with scipy.linalg.eig's. + assert_allclose(np.sort(eigh(A)[0]), np.sort(d_pteqr), atol=atol) + + if compute_z: + # verify z_pteqr as orthogonal + assert_allclose(z_pteqr @ np.conj(z_pteqr).T, np.identity(n), + atol=atol) + # verify that z_pteqr recombines to A + assert_allclose(z_pteqr @ np.diag(d_pteqr) @ np.conj(z_pteqr).T, + A, atol=atol) + + +@pytest.mark.parametrize("dtype,realtype", + zip(DTYPES, REAL_DTYPES + REAL_DTYPES)) +@pytest.mark.parametrize("compute_z", range(3)) +def test_pteqr_error_non_spd(dtype, realtype, compute_z): + seed(42) + pteqr = get_lapack_funcs(('pteqr'), dtype=dtype) + + n = 10 + d, e, A, z = pteqr_get_d_e_A_z(dtype, realtype, n, compute_z) + + # test with non-spd matrix + d_pteqr, e_pteqr, z_pteqr, info = pteqr(d - 4, e, z=z, compute_z=compute_z) + assert info > 0 + + +@pytest.mark.parametrize("dtype,realtype", + zip(DTYPES, REAL_DTYPES + REAL_DTYPES)) +@pytest.mark.parametrize("compute_z", range(3)) +def test_pteqr_raise_error_wrong_shape(dtype, realtype, compute_z): + seed(42) + pteqr = get_lapack_funcs(('pteqr'), dtype=dtype) + n = 10 + d, e, A, z = pteqr_get_d_e_A_z(dtype, realtype, n, compute_z) + # test with incorrect/incompatible array sizes + assert_raises(ValueError, pteqr, d[:-1], e, z=z, compute_z=compute_z) + assert_raises(ValueError, pteqr, d, e[:-1], z=z, compute_z=compute_z) + if compute_z: + assert_raises(ValueError, pteqr, d, e, z=z[:-1], compute_z=compute_z) + + +@pytest.mark.parametrize("dtype,realtype", + zip(DTYPES, REAL_DTYPES + REAL_DTYPES)) +@pytest.mark.parametrize("compute_z", range(3)) +def test_pteqr_error_singular(dtype, realtype, compute_z): + seed(42) + pteqr = get_lapack_funcs(('pteqr'), dtype=dtype) + n = 10 + d, e, A, z = pteqr_get_d_e_A_z(dtype, realtype, n, compute_z) + # test with singular matrix + d[0] = 0 + e[0] = 0 + d_pteqr, e_pteqr, z_pteqr, info = pteqr(d, e, z=z, compute_z=compute_z) + assert info > 0 + + +@pytest.mark.parametrize("compute_z,d,e,d_expect,z_expect", + [(2, # "I" + np.array([4.16, 5.25, 1.09, .62]), + np.array([3.17, -.97, .55]), + np.array([8.0023, 1.9926, 1.0014, 0.1237]), + np.array([[0.6326, 0.6245, -0.4191, 0.1847], + [0.7668, -0.4270, 0.4176, -0.2352], + [-0.1082, 0.6071, 0.4594, -0.6393], + [-0.0081, 0.2432, 0.6625, 0.7084]])), + ]) +def test_pteqr_NAG_f08jgf(compute_z, d, e, d_expect, z_expect): + ''' + Implements real (f08jgf) example from NAG Manual Mark 26. + Tests for correct outputs. + ''' + # the NAG manual has 4 decimals accuracy + atol = 1e-4 + pteqr = get_lapack_funcs(('pteqr'), dtype=d.dtype) + + z = np.diag(d) + np.diag(e, 1) + np.diag(e, -1) + _d, _e, _z, info = pteqr(d=d, e=e, z=z, compute_z=compute_z) + assert_allclose(_d, d_expect, atol=atol) + assert_allclose(np.abs(_z), np.abs(z_expect), atol=atol) + + +@pytest.mark.parametrize('dtype', DTYPES) +@pytest.mark.parametrize('matrix_size', [(3, 4), (7, 6), (6, 6)]) +def test_geqrfp(dtype, matrix_size): + # Tests for all dytpes, tall, wide, and square matrices. + # Using the routine with random matrix A, Q and R are obtained and then + # tested such that R is upper triangular and non-negative on the diagonal, + # and Q is an orthogonal matrix. Verifies that A=Q@R. It also + # tests against a matrix that for which the linalg.qr method returns + # negative diagonals, and for error messaging. + + # set test tolerance appropriate for dtype + rng = np.random.RandomState(42) + rtol = 250*np.finfo(dtype).eps + atol = 100*np.finfo(dtype).eps + # get appropriate ?geqrfp for dtype + geqrfp = get_lapack_funcs(('geqrfp'), dtype=dtype) + gqr = get_lapack_funcs(("orgqr"), dtype=dtype) + + m, n = matrix_size + + # create random matrix of dimensions m x n + A = generate_random_dtype_array((m, n), dtype=dtype, rng=rng) + # create qr matrix using geqrfp + qr_A, tau, info = geqrfp(A) + + # obtain r from the upper triangular area + r = np.triu(qr_A) + + # obtain q from the orgqr lapack routine + # based on linalg.qr's extraction strategy of q with orgqr + + if m > n: + # this adds an extra column to the end of qr_A + # let qqr be an empty m x m matrix + qqr = np.zeros((m, m), dtype=dtype) + # set first n columns of qqr to qr_A + qqr[:, :n] = qr_A + # determine q from this qqr + # note that m is a sufficient for lwork based on LAPACK documentation + q = gqr(qqr, tau=tau, lwork=m)[0] + else: + q = gqr(qr_A[:, :m], tau=tau, lwork=m)[0] + + # test that q and r still make A + assert_allclose(q@r, A, rtol=rtol) + # ensure that q is orthogonal (that q @ transposed q is the identity) + assert_allclose(np.eye(q.shape[0]), q@(q.conj().T), rtol=rtol, + atol=atol) + # ensure r is upper tri by comparing original r to r as upper triangular + assert_allclose(r, np.triu(r), rtol=rtol) + # make sure diagonals of r are positive for this random solution + assert_(np.all(np.diag(r) > np.zeros(len(np.diag(r))))) + # ensure that info is zero for this success + assert_(info == 0) + + # test that this routine gives r diagonals that are positive for a + # matrix that returns negatives in the diagonal with scipy.linalg.rq + A_negative = generate_random_dtype_array((n, m), dtype=dtype, rng=rng) * -1 + r_rq_neg, q_rq_neg = qr(A_negative) + rq_A_neg, tau_neg, info_neg = geqrfp(A_negative) + # assert that any of the entries on the diagonal from linalg.qr + # are negative and that all of geqrfp are positive. + assert_(np.any(np.diag(r_rq_neg) < 0) and + np.all(np.diag(r) > 0)) + + +def test_geqrfp_errors_with_empty_array(): + # check that empty array raises good error message + A_empty = np.array([]) + geqrfp = get_lapack_funcs('geqrfp', dtype=A_empty.dtype) + assert_raises(Exception, geqrfp, A_empty) + + +@pytest.mark.parametrize("driver", ['ev', 'evd', 'evr', 'evx']) +@pytest.mark.parametrize("pfx", ['sy', 'he']) +def test_standard_eigh_lworks(pfx, driver): + n = 1200 # Some sufficiently big arbitrary number + dtype = REAL_DTYPES if pfx == 'sy' else COMPLEX_DTYPES + sc_dlw = get_lapack_funcs(pfx+driver+'_lwork', dtype=dtype[0]) + dz_dlw = get_lapack_funcs(pfx+driver+'_lwork', dtype=dtype[1]) + try: + _compute_lwork(sc_dlw, n, lower=1) + _compute_lwork(dz_dlw, n, lower=1) + except Exception as e: + pytest.fail(f"{pfx+driver}_lwork raised unexpected exception: {e}") + + +@pytest.mark.parametrize("driver", ['gv', 'gvx']) +@pytest.mark.parametrize("pfx", ['sy', 'he']) +def test_generalized_eigh_lworks(pfx, driver): + n = 1200 # Some sufficiently big arbitrary number + dtype = REAL_DTYPES if pfx == 'sy' else COMPLEX_DTYPES + sc_dlw = get_lapack_funcs(pfx+driver+'_lwork', dtype=dtype[0]) + dz_dlw = get_lapack_funcs(pfx+driver+'_lwork', dtype=dtype[1]) + # Shouldn't raise any exceptions + try: + _compute_lwork(sc_dlw, n, uplo="L") + _compute_lwork(dz_dlw, n, uplo="L") + except Exception as e: + pytest.fail(f"{pfx+driver}_lwork raised unexpected exception: {e}") + + +@pytest.mark.parametrize("dtype_", DTYPES) +@pytest.mark.parametrize("m", [1, 10, 100, 1000]) +def test_orcsd_uncsd_lwork(dtype_, m): + seed(1234) + p = randint(0, m) + q = m - p + pfx = 'or' if dtype_ in REAL_DTYPES else 'un' + dlw = pfx + 'csd_lwork' + lw = get_lapack_funcs(dlw, dtype=dtype_) + lwval = _compute_lwork(lw, m, p, q) + lwval = lwval if pfx == 'un' else (lwval,) + assert all([x > 0 for x in lwval]) + + +@pytest.mark.parametrize("dtype_", DTYPES) +def test_orcsd_uncsd(dtype_): + m, p, q = 250, 80, 170 + + pfx = 'or' if dtype_ in REAL_DTYPES else 'un' + X = ortho_group.rvs(m) if pfx == 'or' else unitary_group.rvs(m) + + drv, dlw = get_lapack_funcs((pfx + 'csd', pfx + 'csd_lwork'), dtype=dtype_) + lwval = _compute_lwork(dlw, m, p, q) + lwvals = {'lwork': lwval} if pfx == 'or' else dict(zip(['lwork', + 'lrwork'], lwval)) + + cs11, cs12, cs21, cs22, theta, u1, u2, v1t, v2t, info =\ + drv(X[:p, :q], X[:p, q:], X[p:, :q], X[p:, q:], **lwvals) + + assert info == 0 + + U = block_diag(u1, u2) + VH = block_diag(v1t, v2t) + r = min(min(p, q), min(m-p, m-q)) + n11 = min(p, q) - r + n12 = min(p, m-q) - r + n21 = min(m-p, q) - r + n22 = min(m-p, m-q) - r + + S = np.zeros((m, m), dtype=dtype_) + one = dtype_(1.) + for i in range(n11): + S[i, i] = one + for i in range(n22): + S[p+i, q+i] = one + for i in range(n12): + S[i+n11+r, i+n11+r+n21+n22+r] = -one + for i in range(n21): + S[p+n22+r+i, n11+r+i] = one + + for i in range(r): + S[i+n11, i+n11] = np.cos(theta[i]) + S[p+n22+i, i+r+n21+n22] = np.cos(theta[i]) + + S[i+n11, i+n11+n21+n22+r] = -np.sin(theta[i]) + S[p+n22+i, i+n11] = np.sin(theta[i]) + + Xc = U @ S @ VH + assert_allclose(X, Xc, rtol=0., atol=1e4*np.finfo(dtype_).eps) + + +@pytest.mark.parametrize("dtype", DTYPES) +@pytest.mark.parametrize("trans_bool", [False, True]) +@pytest.mark.parametrize("fact", ["F", "N"]) +def test_gtsvx(dtype, trans_bool, fact): + """ + These tests uses ?gtsvx to solve a random Ax=b system for each dtype. + It tests that the outputs define an LU matrix, that inputs are unmodified, + transposal options, incompatible shapes, singular matrices, and + singular factorizations. It parametrizes DTYPES and the 'fact' value along + with the fact related inputs. + """ + rng = np.random.RandomState(42) + # set test tolerance appropriate for dtype + atol = 100 * np.finfo(dtype).eps + # obtain routine + gtsvx, gttrf = get_lapack_funcs(('gtsvx', 'gttrf'), dtype=dtype) + # Generate random tridiagonal matrix A + n = 10 + dl = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + d = generate_random_dtype_array((n,), dtype=dtype, rng=rng) + du = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + A = np.diag(dl, -1) + np.diag(d) + np.diag(du, 1) + # generate random solution x + x = generate_random_dtype_array((n, 2), dtype=dtype, rng=rng) + # create b from x for equation Ax=b + trans = ("T" if dtype in REAL_DTYPES else "C") if trans_bool else "N" + b = (A.conj().T if trans_bool else A) @ x + + # store a copy of the inputs to check they haven't been modified later + inputs_cpy = [dl.copy(), d.copy(), du.copy(), b.copy()] + + # set these to None if fact = 'N', or the output of gttrf is fact = 'F' + dlf_, df_, duf_, du2f_, ipiv_, info_ = \ + gttrf(dl, d, du) if fact == 'F' else [None]*6 + + gtsvx_out = gtsvx(dl, d, du, b, fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + dlf, df, duf, du2f, ipiv, x_soln, rcond, ferr, berr, info = gtsvx_out + assert_(info == 0, f"?gtsvx info = {info}, should be zero") + + # assure that inputs are unmodified + assert_array_equal(dl, inputs_cpy[0]) + assert_array_equal(d, inputs_cpy[1]) + assert_array_equal(du, inputs_cpy[2]) + assert_array_equal(b, inputs_cpy[3]) + + # test that x_soln matches the expected x + assert_allclose(x, x_soln, atol=atol) + + # assert that the outputs are of correct type or shape + # rcond should be a scalar + assert_(hasattr(rcond, "__len__") is not True, + f"rcond should be scalar but is {rcond}") + # ferr should be length of # of cols in x + assert_(ferr.shape[0] == b.shape[1], (f"ferr.shape is {ferr.shape[0]} but should" + f" be {b.shape[1]}")) + # berr should be length of # of cols in x + assert_(berr.shape[0] == b.shape[1], (f"berr.shape is {berr.shape[0]} but should" + f" be {b.shape[1]}")) + + +@pytest.mark.parametrize("dtype", DTYPES) +@pytest.mark.parametrize("trans_bool", [0, 1]) +@pytest.mark.parametrize("fact", ["F", "N"]) +def test_gtsvx_error_singular(dtype, trans_bool, fact): + rng = np.random.RandomState(42) + # obtain routine + gtsvx, gttrf = get_lapack_funcs(('gtsvx', 'gttrf'), dtype=dtype) + # Generate random tridiagonal matrix A + n = 10 + dl = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + d = generate_random_dtype_array((n,), dtype=dtype, rng=rng) + du = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + A = np.diag(dl, -1) + np.diag(d) + np.diag(du, 1) + # generate random solution x + x = generate_random_dtype_array((n, 2), dtype=dtype, rng=rng) + # create b from x for equation Ax=b + trans = "T" if dtype in REAL_DTYPES else "C" + b = (A.conj().T if trans_bool else A) @ x + + # set these to None if fact = 'N', or the output of gttrf is fact = 'F' + dlf_, df_, duf_, du2f_, ipiv_, info_ = \ + gttrf(dl, d, du) if fact == 'F' else [None]*6 + + gtsvx_out = gtsvx(dl, d, du, b, fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + dlf, df, duf, du2f, ipiv, x_soln, rcond, ferr, berr, info = gtsvx_out + # test with singular matrix + # no need to test inputs with fact "F" since ?gttrf already does. + if fact == "N": + # Construct a singular example manually + d[-1] = 0 + dl[-1] = 0 + # solve using routine + gtsvx_out = gtsvx(dl, d, du, b) + dlf, df, duf, du2f, ipiv, x_soln, rcond, ferr, berr, info = gtsvx_out + # test for the singular matrix. + assert info > 0, "info should be > 0 for singular matrix" + + elif fact == 'F': + # assuming that a singular factorization is input + df_[-1] = 0 + duf_[-1] = 0 + du2f_[-1] = 0 + + gtsvx_out = gtsvx(dl, d, du, b, fact=fact, dlf=dlf_, df=df_, duf=duf_, + du2=du2f_, ipiv=ipiv_) + dlf, df, duf, du2f, ipiv, x_soln, rcond, ferr, berr, info = gtsvx_out + # info should not be zero and should provide index of illegal value + assert info > 0, "info should be > 0 for singular matrix" + + +@pytest.mark.parametrize("dtype", DTYPES*2) +@pytest.mark.parametrize("trans_bool", [False, True]) +@pytest.mark.parametrize("fact", ["F", "N"]) +def test_gtsvx_error_incompatible_size(dtype, trans_bool, fact): + rng = np.random.RandomState(42) + # obtain routine + gtsvx, gttrf = get_lapack_funcs(('gtsvx', 'gttrf'), dtype=dtype) + # Generate random tridiagonal matrix A + n = 10 + dl = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + d = generate_random_dtype_array((n,), dtype=dtype, rng=rng) + du = generate_random_dtype_array((n-1,), dtype=dtype, rng=rng) + A = np.diag(dl, -1) + np.diag(d) + np.diag(du, 1) + # generate random solution x + x = generate_random_dtype_array((n, 2), dtype=dtype, rng=rng) + # create b from x for equation Ax=b + trans = "T" if dtype in REAL_DTYPES else "C" + b = (A.conj().T if trans_bool else A) @ x + + # set these to None if fact = 'N', or the output of gttrf is fact = 'F' + dlf_, df_, duf_, du2f_, ipiv_, info_ = \ + gttrf(dl, d, du) if fact == 'F' else [None]*6 + + if fact == "N": + assert_raises(ValueError, gtsvx, dl[:-1], d, du, b, + fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + assert_raises(ValueError, gtsvx, dl, d[:-1], du, b, + fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + assert_raises(ValueError, gtsvx, dl, d, du[:-1], b, + fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + assert_raises(Exception, gtsvx, dl, d, du, b[:-1], + fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + else: + assert_raises(ValueError, gtsvx, dl, d, du, b, + fact=fact, trans=trans, dlf=dlf_[:-1], df=df_, + duf=duf_, du2=du2f_, ipiv=ipiv_) + assert_raises(ValueError, gtsvx, dl, d, du, b, + fact=fact, trans=trans, dlf=dlf_, df=df_[:-1], + duf=duf_, du2=du2f_, ipiv=ipiv_) + assert_raises(ValueError, gtsvx, dl, d, du, b, + fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_[:-1], du2=du2f_, ipiv=ipiv_) + assert_raises(ValueError, gtsvx, dl, d, du, b, + fact=fact, trans=trans, dlf=dlf_, df=df_, + duf=duf_, du2=du2f_[:-1], ipiv=ipiv_) + + +@pytest.mark.parametrize("du,d,dl,b,x", + [(np.array([2.1, -1.0, 1.9, 8.0]), + np.array([3.0, 2.3, -5.0, -0.9, 7.1]), + np.array([3.4, 3.6, 7.0, -6.0]), + np.array([[2.7, 6.6], [-.5, 10.8], [2.6, -3.2], + [.6, -11.2], [2.7, 19.1]]), + np.array([[-4, 5], [7, -4], [3, -3], [-4, -2], + [-3, 1]])), + (np.array([2 - 1j, 2 + 1j, -1 + 1j, 1 - 1j]), + np.array([-1.3 + 1.3j, -1.3 + 1.3j, -1.3 + 3.3j, + -.3 + 4.3j, -3.3 + 1.3j]), + np.array([1 - 2j, 1 + 1j, 2 - 3j, 1 + 1j]), + np.array([[2.4 - 5j, 2.7 + 6.9j], + [3.4 + 18.2j, -6.9 - 5.3j], + [-14.7 + 9.7j, -6 - .6j], + [31.9 - 7.7j, -3.9 + 9.3j], + [-1 + 1.6j, -3 + 12.2j]]), + np.array([[1 + 1j, 2 - 1j], [3 - 1j, 1 + 2j], + [4 + 5j, -1 + 1j], [-1 - 2j, 2 + 1j], + [1 - 1j, 2 - 2j]]))]) +def test_gtsvx_NAG(du, d, dl, b, x): + # Test to ensure wrapper is consistent with NAG Manual Mark 26 + # example problems: real (f07cbf) and complex (f07cpf) + gtsvx = get_lapack_funcs('gtsvx', dtype=d.dtype) + + gtsvx_out = gtsvx(dl, d, du, b) + dlf, df, duf, du2f, ipiv, x_soln, rcond, ferr, berr, info = gtsvx_out + + assert_array_almost_equal(x, x_soln) + + +@pytest.mark.parametrize("dtype,realtype", zip(DTYPES, REAL_DTYPES + + REAL_DTYPES)) +@pytest.mark.parametrize("fact,df_de_lambda", + [("F", + lambda d, e: get_lapack_funcs('pttrf', + dtype=e.dtype)(d, e)), + ("N", lambda d, e: (None, None, None))]) +def test_ptsvx(dtype, realtype, fact, df_de_lambda): + ''' + This tests the ?ptsvx lapack routine wrapper to solve a random system + Ax = b for all dtypes and input variations. Tests for: unmodified + input parameters, fact options, incompatible matrix shapes raise an error, + and singular matrices return info of illegal value. + ''' + rng = np.random.RandomState(42) + # set test tolerance appropriate for dtype + atol = 100 * np.finfo(dtype).eps + ptsvx = get_lapack_funcs('ptsvx', dtype=dtype) + n = 5 + # create diagonals according to size and dtype + d = generate_random_dtype_array((n,), realtype, rng) + 4 + e = generate_random_dtype_array((n-1,), dtype, rng) + A = np.diag(d) + np.diag(e, -1) + np.diag(np.conj(e), 1) + x_soln = generate_random_dtype_array((n, 2), dtype=dtype, rng=rng) + b = A @ x_soln + + # use lambda to determine what df, ef are + df, ef, info = df_de_lambda(d, e) + + # create copy to later test that they are unmodified + diag_cpy = [d.copy(), e.copy(), b.copy()] + + # solve using routine + df, ef, x, rcond, ferr, berr, info = ptsvx(d, e, b, fact=fact, + df=df, ef=ef) + # d, e, and b should be unmodified + assert_array_equal(d, diag_cpy[0]) + assert_array_equal(e, diag_cpy[1]) + assert_array_equal(b, diag_cpy[2]) + assert_(info == 0, f"info should be 0 but is {info}.") + assert_array_almost_equal(x_soln, x) + + # test that the factors from ptsvx can be recombined to make A + L = np.diag(ef, -1) + np.diag(np.ones(n)) + D = np.diag(df) + assert_allclose(A, L@D@(np.conj(L).T), atol=atol) + + # assert that the outputs are of correct type or shape + # rcond should be a scalar + assert not hasattr(rcond, "__len__"), \ + f"rcond should be scalar but is {rcond}" + # ferr should be length of # of cols in x + assert_(ferr.shape == (2,), (f"ferr.shape is {ferr.shape} but should be " + "({x_soln.shape[1]},)")) + # berr should be length of # of cols in x + assert_(berr.shape == (2,), (f"berr.shape is {berr.shape} but should be " + "({x_soln.shape[1]},)")) + + +@pytest.mark.parametrize("dtype,realtype", zip(DTYPES, REAL_DTYPES + + REAL_DTYPES)) +@pytest.mark.parametrize("fact,df_de_lambda", + [("F", + lambda d, e: get_lapack_funcs('pttrf', + dtype=e.dtype)(d, e)), + ("N", lambda d, e: (None, None, None))]) +def test_ptsvx_error_raise_errors(dtype, realtype, fact, df_de_lambda): + rng = np.random.RandomState(42) + ptsvx = get_lapack_funcs('ptsvx', dtype=dtype) + n = 5 + # create diagonals according to size and dtype + d = generate_random_dtype_array((n,), realtype, rng) + 4 + e = generate_random_dtype_array((n-1,), dtype, rng) + A = np.diag(d) + np.diag(e, -1) + np.diag(np.conj(e), 1) + x_soln = generate_random_dtype_array((n, 2), dtype=dtype, rng=rng) + b = A @ x_soln + + # use lambda to determine what df, ef are + df, ef, info = df_de_lambda(d, e) + + # test with malformatted array sizes + assert_raises(ValueError, ptsvx, d[:-1], e, b, fact=fact, df=df, ef=ef) + assert_raises(ValueError, ptsvx, d, e[:-1], b, fact=fact, df=df, ef=ef) + assert_raises(Exception, ptsvx, d, e, b[:-1], fact=fact, df=df, ef=ef) + + +@pytest.mark.parametrize("dtype,realtype", zip(DTYPES, REAL_DTYPES + + REAL_DTYPES)) +@pytest.mark.parametrize("fact,df_de_lambda", + [("F", + lambda d, e: get_lapack_funcs('pttrf', + dtype=e.dtype)(d, e)), + ("N", lambda d, e: (None, None, None))]) +def test_ptsvx_non_SPD_singular(dtype, realtype, fact, df_de_lambda): + rng = np.random.RandomState(42) + ptsvx = get_lapack_funcs('ptsvx', dtype=dtype) + n = 5 + # create diagonals according to size and dtype + d = generate_random_dtype_array((n,), realtype, rng) + 4 + e = generate_random_dtype_array((n-1,), dtype, rng) + A = np.diag(d) + np.diag(e, -1) + np.diag(np.conj(e), 1) + x_soln = generate_random_dtype_array((n, 2), dtype=dtype, rng=rng) + b = A @ x_soln + + # use lambda to determine what df, ef are + df, ef, info = df_de_lambda(d, e) + + if fact == "N": + d[3] = 0 + # obtain new df, ef + df, ef, info = df_de_lambda(d, e) + # solve using routine + df, ef, x, rcond, ferr, berr, info = ptsvx(d, e, b) + # test for the singular matrix. + assert info > 0 and info <= n + + # non SPD matrix + d = generate_random_dtype_array((n,), realtype, rng) + df, ef, x, rcond, ferr, berr, info = ptsvx(d, e, b) + assert info > 0 and info <= n + else: + # assuming that someone is using a singular factorization + df, ef, info = df_de_lambda(d, e) + df[0] = 0 + ef[0] = 0 + df, ef, x, rcond, ferr, berr, info = ptsvx(d, e, b, fact=fact, + df=df, ef=ef) + assert info > 0 + + +@pytest.mark.parametrize('d,e,b,x', + [(np.array([4, 10, 29, 25, 5]), + np.array([-2, -6, 15, 8]), + np.array([[6, 10], [9, 4], [2, 9], [14, 65], + [7, 23]]), + np.array([[2.5, 2], [2, -1], [1, -3], + [-1, 6], [3, -5]])), + (np.array([16, 41, 46, 21]), + np.array([16 + 16j, 18 - 9j, 1 - 4j]), + np.array([[64 + 16j, -16 - 32j], + [93 + 62j, 61 - 66j], + [78 - 80j, 71 - 74j], + [14 - 27j, 35 + 15j]]), + np.array([[2 + 1j, -3 - 2j], + [1 + 1j, 1 + 1j], + [1 - 2j, 1 - 2j], + [1 - 1j, 2 + 1j]]))]) +def test_ptsvx_NAG(d, e, b, x): + # test to assure that wrapper is consistent with NAG Manual Mark 26 + # example problems: f07jbf, f07jpf + # (Links expire, so please search for "NAG Library Manual Mark 26" online) + + # obtain routine with correct type based on e.dtype + ptsvx = get_lapack_funcs('ptsvx', dtype=e.dtype) + # solve using routine + df, ef, x_ptsvx, rcond, ferr, berr, info = ptsvx(d, e, b) + # determine ptsvx's solution and x are the same. + assert_array_almost_equal(x, x_ptsvx) + + +@pytest.mark.parametrize('lower', [False, True]) +@pytest.mark.parametrize('dtype', DTYPES) +def test_pptrs_pptri_pptrf_ppsv_ppcon(dtype, lower): + rng = np.random.RandomState(1234) + atol = np.finfo(dtype).eps*100 + # Manual conversion to/from packed format is feasible here. + n, nrhs = 10, 4 + a = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + b = generate_random_dtype_array([n, nrhs], dtype=dtype, rng=rng) + + a = a.conj().T + a + np.eye(n, dtype=dtype) * dtype(5.) + if lower: + inds = ([x for y in range(n) for x in range(y, n)], + [y for y in range(n) for x in range(y, n)]) + else: + inds = ([x for y in range(1, n+1) for x in range(y)], + [y-1 for y in range(1, n+1) for x in range(y)]) + ap = a[inds] + ppsv, pptrf, pptrs, pptri, ppcon = get_lapack_funcs( + ('ppsv', 'pptrf', 'pptrs', 'pptri', 'ppcon'), + dtype=dtype, + ilp64="preferred") + + ul, info = pptrf(n, ap, lower=lower) + assert_equal(info, 0) + aul = cholesky(a, lower=lower)[inds] + assert_allclose(ul, aul, rtol=0, atol=atol) + + uli, info = pptri(n, ul, lower=lower) + assert_equal(info, 0) + auli = inv(a)[inds] + assert_allclose(uli, auli, rtol=0, atol=atol) + + x, info = pptrs(n, ul, b, lower=lower) + assert_equal(info, 0) + bx = solve(a, b) + assert_allclose(x, bx, rtol=0, atol=atol) + + xv, info = ppsv(n, ap, b, lower=lower) + assert_equal(info, 0) + assert_allclose(xv, bx, rtol=0, atol=atol) + + anorm = np.linalg.norm(a, 1) + rcond, info = ppcon(n, ap, anorm=anorm, lower=lower) + assert_equal(info, 0) + assert_(abs(1/rcond - np.linalg.cond(a, p=1))*rcond < 1) + + +@pytest.mark.parametrize('dtype', DTYPES) +def test_gees_trexc(dtype): + rng = np.random.RandomState(1234) + atol = np.finfo(dtype).eps*100 + + n = 10 + a = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + + gees, trexc = get_lapack_funcs(('gees', 'trexc'), dtype=dtype) + + result = gees(lambda x: None, a, overwrite_a=False) + assert_equal(result[-1], 0) + + t = result[0] + z = result[-3] + + d2 = t[6, 6] + + if dtype in COMPLEX_DTYPES: + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(z @ t @ z.conj().T, a, rtol=0, atol=atol) + + result = trexc(t, z, 7, 1) + assert_equal(result[-1], 0) + + t = result[0] + z = result[-2] + + if dtype in COMPLEX_DTYPES: + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(z @ t @ z.conj().T, a, rtol=0, atol=atol) + + assert_allclose(t[0, 0], d2, rtol=0, atol=atol) + + +@pytest.mark.parametrize( + "t, expect, ifst, ilst", + [(np.array([[0.80, -0.11, 0.01, 0.03], + [0.00, -0.10, 0.25, 0.35], + [0.00, -0.65, -0.10, 0.20], + [0.00, 0.00, 0.00, -0.10]]), + np.array([[-0.1000, -0.6463, 0.0874, 0.2010], + [0.2514, -0.1000, 0.0927, 0.3505], + [0.0000, 0.0000, 0.8000, -0.0117], + [0.0000, 0.0000, 0.0000, -0.1000]]), + 2, 1), + (np.array([[-6.00 - 7.00j, 0.36 - 0.36j, -0.19 + 0.48j, 0.88 - 0.25j], + [0.00 + 0.00j, -5.00 + 2.00j, -0.03 - 0.72j, -0.23 + 0.13j], + [0.00 + 0.00j, 0.00 + 0.00j, 8.00 - 1.00j, 0.94 + 0.53j], + [0.00 + 0.00j, 0.00 + 0.00j, 0.00 + 0.00j, 3.00 - 4.00j]]), + np.array([[-5.0000 + 2.0000j, -0.1574 + 0.7143j, + 0.1781 - 0.1913j, 0.3950 + 0.3861j], + [0.0000 + 0.0000j, 8.0000 - 1.0000j, + 1.0742 + 0.1447j, 0.2515 - 0.3397j], + [0.0000 + 0.0000j, 0.0000 + 0.0000j, + 3.0000 - 4.0000j, 0.2264 + 0.8962j], + [0.0000 + 0.0000j, 0.0000 + 0.0000j, + 0.0000 + 0.0000j, -6.0000 - 7.0000j]]), + 1, 4)]) +def test_trexc_NAG(t, ifst, ilst, expect): + """ + This test implements the example found in the NAG manual, + f08qfc, f08qtc, f08qgc, f08quc. + """ + # NAG manual provides accuracy up to 4 decimals + atol = 1e-4 + trexc = get_lapack_funcs('trexc', dtype=t.dtype) + + result = trexc(t, t, ifst, ilst, wantq=0) + assert_equal(result[-1], 0) + + t = result[0] + assert_allclose(expect, t, atol=atol) + + +@pytest.mark.parametrize('dtype', DTYPES) +def test_gges_tgexc(dtype): + rng = np.random.RandomState(1234) + atol = np.finfo(dtype).eps*100 + + n = 10 + a = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + b = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + + gges, tgexc = get_lapack_funcs(('gges', 'tgexc'), dtype=dtype) + + result = gges(lambda x: None, a, b, overwrite_a=False, overwrite_b=False) + assert_equal(result[-1], 0) + + s = result[0] + t = result[1] + q = result[-4] + z = result[-3] + + d1 = s[0, 0] / t[0, 0] + d2 = s[6, 6] / t[6, 6] + + if dtype in COMPLEX_DTYPES: + assert_allclose(s, np.triu(s), rtol=0, atol=atol) + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(q @ s @ z.conj().T, a, rtol=0, atol=atol) + assert_allclose(q @ t @ z.conj().T, b, rtol=0, atol=atol) + + result = tgexc(s, t, q, z, 7, 1) + assert_equal(result[-1], 0) + + s = result[0] + t = result[1] + q = result[2] + z = result[3] + + if dtype in COMPLEX_DTYPES: + assert_allclose(s, np.triu(s), rtol=0, atol=atol) + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(q @ s @ z.conj().T, a, rtol=0, atol=atol) + assert_allclose(q @ t @ z.conj().T, b, rtol=0, atol=atol) + + assert_allclose(s[0, 0] / t[0, 0], d2, rtol=0, atol=atol) + assert_allclose(s[1, 1] / t[1, 1], d1, rtol=0, atol=atol) + + +@pytest.mark.parametrize('dtype', DTYPES) +def test_gees_trsen(dtype): + rng = np.random.RandomState(1234) + atol = np.finfo(dtype).eps*100 + + n = 10 + a = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + + gees, trsen, trsen_lwork = get_lapack_funcs( + ('gees', 'trsen', 'trsen_lwork'), dtype=dtype) + + result = gees(lambda x: None, a, overwrite_a=False) + assert_equal(result[-1], 0) + + t = result[0] + z = result[-3] + + d2 = t[6, 6] + + if dtype in COMPLEX_DTYPES: + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(z @ t @ z.conj().T, a, rtol=0, atol=atol) + + select = np.zeros(n) + select[6] = 1 + + lwork = _compute_lwork(trsen_lwork, select, t) + + if dtype in COMPLEX_DTYPES: + result = trsen(select, t, z, lwork=lwork) + else: + result = trsen(select, t, z, lwork=lwork, liwork=lwork[1]) + assert_equal(result[-1], 0) + + t = result[0] + z = result[1] + + if dtype in COMPLEX_DTYPES: + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(z @ t @ z.conj().T, a, rtol=0, atol=atol) + + assert_allclose(t[0, 0], d2, rtol=0, atol=atol) + + +@pytest.mark.parametrize( + "t, q, expect, select, expect_s, expect_sep", + [(np.array([[0.7995, -0.1144, 0.0060, 0.0336], + [0.0000, -0.0994, 0.2478, 0.3474], + [0.0000, -0.6483, -0.0994, 0.2026], + [0.0000, 0.0000, 0.0000, -0.1007]]), + np.array([[0.6551, 0.1037, 0.3450, 0.6641], + [0.5236, -0.5807, -0.6141, -0.1068], + [-0.5362, -0.3073, -0.2935, 0.7293], + [0.0956, 0.7467, -0.6463, 0.1249]]), + np.array([[0.3500, 0.4500, -0.1400, -0.1700], + [0.0900, 0.0700, -0.5399, 0.3500], + [-0.4400, -0.3300, -0.0300, 0.1700], + [0.2500, -0.3200, -0.1300, 0.1100]]), + np.array([1, 0, 0, 1]), + 1.75e+00, 3.22e+00), + (np.array([[-6.0004 - 6.9999j, 0.3637 - 0.3656j, + -0.1880 + 0.4787j, 0.8785 - 0.2539j], + [0.0000 + 0.0000j, -5.0000 + 2.0060j, + -0.0307 - 0.7217j, -0.2290 + 0.1313j], + [0.0000 + 0.0000j, 0.0000 + 0.0000j, + 7.9982 - 0.9964j, 0.9357 + 0.5359j], + [0.0000 + 0.0000j, 0.0000 + 0.0000j, + 0.0000 + 0.0000j, 3.0023 - 3.9998j]]), + np.array([[-0.8347 - 0.1364j, -0.0628 + 0.3806j, + 0.2765 - 0.0846j, 0.0633 - 0.2199j], + [0.0664 - 0.2968j, 0.2365 + 0.5240j, + -0.5877 - 0.4208j, 0.0835 + 0.2183j], + [-0.0362 - 0.3215j, 0.3143 - 0.5473j, + 0.0576 - 0.5736j, 0.0057 - 0.4058j], + [0.0086 + 0.2958j, -0.3416 - 0.0757j, + -0.1900 - 0.1600j, 0.8327 - 0.1868j]]), + np.array([[-3.9702 - 5.0406j, -4.1108 + 3.7002j, + -0.3403 + 1.0098j, 1.2899 - 0.8590j], + [0.3397 - 1.5006j, 1.5201 - 0.4301j, + 1.8797 - 5.3804j, 3.3606 + 0.6498j], + [3.3101 - 3.8506j, 2.4996 + 3.4504j, + 0.8802 - 1.0802j, 0.6401 - 1.4800j], + [-1.0999 + 0.8199j, 1.8103 - 1.5905j, + 3.2502 + 1.3297j, 1.5701 - 3.4397j]]), + np.array([1, 0, 0, 1]), + 1.02e+00, 1.82e-01)]) +def test_trsen_NAG(t, q, select, expect, expect_s, expect_sep): + """ + This test implements the example found in the NAG manual, + f08qgc, f08quc. + """ + # NAG manual provides accuracy up to 4 and 2 decimals + atol = 1e-4 + atol2 = 1e-2 + trsen, trsen_lwork = get_lapack_funcs( + ('trsen', 'trsen_lwork'), dtype=t.dtype) + + lwork = _compute_lwork(trsen_lwork, select, t) + + if t.dtype in COMPLEX_DTYPES: + result = trsen(select, t, q, lwork=lwork) + else: + result = trsen(select, t, q, lwork=lwork, liwork=lwork[1]) + assert_equal(result[-1], 0) + + t = result[0] + q = result[1] + if t.dtype in COMPLEX_DTYPES: + s = result[4] + sep = result[5] + else: + s = result[5] + sep = result[6] + + assert_allclose(expect, q @ t @ q.conj().T, atol=atol) + assert_allclose(expect_s, 1 / s, atol=atol2) + assert_allclose(expect_sep, 1 / sep, atol=atol2) + + +@pytest.mark.parametrize('dtype', DTYPES) +def test_gges_tgsen(dtype): + rng = np.random.RandomState(1234) + atol = np.finfo(dtype).eps*100 + + n = 10 + a = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + b = generate_random_dtype_array([n, n], dtype=dtype, rng=rng) + + gges, tgsen, tgsen_lwork = get_lapack_funcs( + ('gges', 'tgsen', 'tgsen_lwork'), dtype=dtype) + + result = gges(lambda x: None, a, b, overwrite_a=False, overwrite_b=False) + assert_equal(result[-1], 0) + + s = result[0] + t = result[1] + q = result[-4] + z = result[-3] + + d1 = s[0, 0] / t[0, 0] + d2 = s[6, 6] / t[6, 6] + + if dtype in COMPLEX_DTYPES: + assert_allclose(s, np.triu(s), rtol=0, atol=atol) + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(q @ s @ z.conj().T, a, rtol=0, atol=atol) + assert_allclose(q @ t @ z.conj().T, b, rtol=0, atol=atol) + + select = np.zeros(n) + select[6] = 1 + + lwork = _compute_lwork(tgsen_lwork, select, s, t) + + # off-by-one error in LAPACK, see gh-issue #13397 + lwork = (lwork[0]+1, lwork[1]) + + result = tgsen(select, s, t, q, z, lwork=lwork) + assert_equal(result[-1], 0) + + s = result[0] + t = result[1] + q = result[-7] + z = result[-6] + + if dtype in COMPLEX_DTYPES: + assert_allclose(s, np.triu(s), rtol=0, atol=atol) + assert_allclose(t, np.triu(t), rtol=0, atol=atol) + + assert_allclose(q @ s @ z.conj().T, a, rtol=0, atol=atol) + assert_allclose(q @ t @ z.conj().T, b, rtol=0, atol=atol) + + assert_allclose(s[0, 0] / t[0, 0], d2, rtol=0, atol=atol) + assert_allclose(s[1, 1] / t[1, 1], d1, rtol=0, atol=atol) + + +@pytest.mark.parametrize( + "a, b, c, d, e, f, rans, lans", + [(np.array([[4.0, 1.0, 1.0, 2.0], + [0.0, 3.0, 4.0, 1.0], + [0.0, 1.0, 3.0, 1.0], + [0.0, 0.0, 0.0, 6.0]]), + np.array([[1.0, 1.0, 1.0, 1.0], + [0.0, 3.0, 4.0, 1.0], + [0.0, 1.0, 3.0, 1.0], + [0.0, 0.0, 0.0, 4.0]]), + np.array([[-4.0, 7.0, 1.0, 12.0], + [-9.0, 2.0, -2.0, -2.0], + [-4.0, 2.0, -2.0, 8.0], + [-7.0, 7.0, -6.0, 19.0]]), + np.array([[2.0, 1.0, 1.0, 3.0], + [0.0, 1.0, 2.0, 1.0], + [0.0, 0.0, 1.0, 1.0], + [0.0, 0.0, 0.0, 2.0]]), + np.array([[1.0, 1.0, 1.0, 2.0], + [0.0, 1.0, 4.0, 1.0], + [0.0, 0.0, 1.0, 1.0], + [0.0, 0.0, 0.0, 1.0]]), + np.array([[-7.0, 5.0, 0.0, 7.0], + [-5.0, 1.0, -8.0, 0.0], + [-1.0, 2.0, -3.0, 5.0], + [-3.0, 2.0, 0.0, 5.0]]), + np.array([[1.0, 1.0, 1.0, 1.0], + [-1.0, 2.0, -1.0, -1.0], + [-1.0, 1.0, 3.0, 1.0], + [-1.0, 1.0, -1.0, 4.0]]), + np.array([[4.0, -1.0, 1.0, -1.0], + [1.0, 3.0, -1.0, 1.0], + [-1.0, 1.0, 2.0, -1.0], + [1.0, -1.0, 1.0, 1.0]]))]) +@pytest.mark.parametrize('dtype', REAL_DTYPES) +def test_tgsyl_NAG(a, b, c, d, e, f, rans, lans, dtype): + atol = 1e-4 + + tgsyl = get_lapack_funcs(('tgsyl'), dtype=dtype) + rout, lout, scale, dif, info = tgsyl(a, b, c, d, e, f) + + assert_equal(info, 0) + assert_allclose(scale, 1.0, rtol=0, atol=np.finfo(dtype).eps*100, + err_msg="SCALE must be 1.0") + assert_allclose(dif, 0.0, rtol=0, atol=np.finfo(dtype).eps*100, + err_msg="DIF must be nearly 0") + assert_allclose(rout, rans, atol=atol, + err_msg="Solution for R is incorrect") + assert_allclose(lout, lans, atol=atol, + err_msg="Solution for L is incorrect") + + +@pytest.mark.parametrize('dtype', REAL_DTYPES) +@pytest.mark.parametrize('trans', ('N', 'T')) +@pytest.mark.parametrize('ijob', [0, 1, 2, 3, 4]) +def test_tgsyl(dtype, trans, ijob): + + atol = 1e-3 if dtype == np.float32 else 1e-10 + rng = np.random.default_rng(1685779866898198) + m, n = 10, 15 + + a, d, *_ = qz(rng.uniform(-10, 10, [m, m]).astype(dtype), + rng.uniform(-10, 10, [m, m]).astype(dtype), + output='real') + + b, e, *_ = qz(rng.uniform(-10, 10, [n, n]).astype(dtype), + rng.uniform(-10, 10, [n, n]).astype(dtype), + output='real') + + c = rng.uniform(-2, 2, [m, n]).astype(dtype) + f = rng.uniform(-2, 2, [m, n]).astype(dtype) + + tgsyl = get_lapack_funcs(('tgsyl'), dtype=dtype) + rout, lout, scale, dif, info = tgsyl(a, b, c, d, e, f, + trans=trans, ijob=ijob) + + assert info == 0, "INFO is non-zero" + assert scale >= 0.0, "SCALE must be non-negative" + if ijob == 0: + assert_allclose(dif, 0.0, rtol=0, atol=np.finfo(dtype).eps*100, + err_msg="DIF must be 0 for ijob =0") + else: + assert dif >= 0.0, "DIF must be non-negative" + + # Only DIF is calculated for ijob = 3/4 + if ijob <= 2: + if trans == 'N': + lhs1 = a @ rout - lout @ b + rhs1 = scale*c + lhs2 = d @ rout - lout @ e + rhs2 = scale*f + elif trans == 'T': + lhs1 = np.transpose(a) @ rout + np.transpose(d) @ lout + rhs1 = scale*c + lhs2 = rout @ np.transpose(b) + lout @ np.transpose(e) + rhs2 = -1.0*scale*f + + assert_allclose(lhs1, rhs1, atol=atol, rtol=0., + err_msg='lhs1 and rhs1 do not match') + assert_allclose(lhs2, rhs2, atol=atol, rtol=0., + err_msg='lhs2 and rhs2 do not match') + + +@pytest.mark.parametrize('mtype', ['sy', 'he']) # matrix type +@pytest.mark.parametrize('dtype', DTYPES) +@pytest.mark.parametrize('lower', (0, 1)) +def test_sy_hetrs(mtype, dtype, lower): + if mtype == 'he' and dtype in REAL_DTYPES: + pytest.skip("hetrs not for real dtypes.") + rng = np.random.default_rng(1723059677121834) + n, nrhs = 20, 5 + if dtype in COMPLEX_DTYPES: + A = (rng.uniform(size=(n, n)) + rng.uniform(size=(n, n))*1j).astype(dtype) + else: + A = rng.uniform(size=(n, n)).astype(dtype) + + A = A + A.T if mtype == 'sy' else A + A.conj().T + b = rng.uniform(size=(n, nrhs)).astype(dtype) + names = f'{mtype}trf', f'{mtype}trf_lwork', f'{mtype}trs' + trf, trf_lwork, trs = get_lapack_funcs(names, dtype=dtype) + lwork = trf_lwork(n, lower=lower) + ldu, ipiv, info = trf(A, lwork=lwork) + assert info == 0 + x, info = trs(a=ldu, ipiv=ipiv, b=b) + assert info == 0 + eps = np.finfo(dtype).eps + assert_allclose(A@x, b, atol=100*n*eps) + + +@pytest.mark.parametrize('norm', list('Mm1OoIiFfEe')) +@pytest.mark.parametrize('uplo, m, n', [('U', 5, 10), ('U', 10, 10), + ('L', 10, 5), ('L', 10, 10)]) +@pytest.mark.parametrize('diag', ['N', 'U']) +@pytest.mark.parametrize('dtype', DTYPES) +def test_lantr(norm, uplo, m, n, diag, dtype): + rng = np.random.default_rng(98426598246982456) + A = rng.random(size=(m, n)).astype(dtype) + lantr, lange = get_lapack_funcs(('lantr', 'lange'), (A,)) + res = lantr(norm, A, uplo=uplo, diag=diag) + + # now modify the matrix according to assumptions made by `lantr` + A = np.triu(A) if uplo == 'U' else np.tril(A) + if diag == 'U': + i = np.arange(min(m, n)) + A[i, i] = 1 + ref = lange(norm, A) + + assert_allclose(res, ref, rtol=2e-6) diff --git a/shared/package-files/33/339775a722d56e07e26739aa840bf09603eef0c1cebb971bd26727b279f8cf75/blob b/shared/package-files/33/339775a722d56e07e26739aa840bf09603eef0c1cebb971bd26727b279f8cf75/blob new file mode 100644 index 0000000000000000000000000000000000000000..dd8f86055da1d8420130e9caeb2ab59c27d2a385 --- /dev/null +++ b/shared/package-files/33/339775a722d56e07e26739aa840bf09603eef0c1cebb971bd26727b279f8cf75/blob @@ -0,0 +1,981 @@ +# mypy: ignore-errors + +from torch.fx.experimental.proxy_tensor import is_sym_node, py_sym_types +from torch.fx.experimental.sym_node import magic_methods, method_to_operator +from torch.fx.experimental.symbolic_shapes import ( + hint_int, free_symbols, is_symbol_binding_fx_node, find_symbol_binding_fx_nodes +) +from torch.fx.experimental._backward_state import BackwardState +import torch +import torch.fx as fx +import operator +import math +import torch.utils._pytree as pytree +import copy +import os +import itertools +import sympy +from collections import defaultdict +from torch.fx.passes import graph_drawer +from typing import List, Optional, Set, Tuple, Union +from .compile_utils import fx_graph_cse, get_aten_target +from . import config +import functools + + +AOT_PARTITIONER_DEBUG = config.debug_partitioner + + +def must_recompute(node): + return node.meta.get("recompute", False) + +def has_recomputable_ops(fx_g): + found = False + for node in fx_g.graph.nodes: + if must_recompute(node): + return True + return False + +def has_recomputable_rng_ops(fx_g): + for node in fx_g.graph.nodes: + if must_recompute(node) and hasattr(node.target, "tags") and torch.Tag.nondeterministic_seeded in node.target.tags: + return True + return False + +def sym_node_size(node): + if isinstance(node.meta["val"], (torch.SymInt, torch.SymBool)): + return 1 + assert isinstance(node.meta["val"], torch.SymFloat) + return 4 + +class InvalidNodeBase: + def __repr__(self): + return "Invalid Node" + + +InvalidNode = InvalidNodeBase() + + +def _extract_graph_with_inputs_outputs(joint_graph, inputs, outputs): + """ + Given a graph, extracts out a subgraph that takes the specified nodes as + inputs and returns the specified outputs. + + This includes specifying non-placeholder nodes as inputs. + + The general strategy is to initialize all inputs with proxies as we + encounter them, and trace through the graph, only keeping values which take + in valid proxies. Then, all dead code is eliminated. + """ + new_graph = fx.Graph() + env = {} + + # Add new placeholder nodes in the order specified by the inputs + for node in inputs: + new_node = new_graph.placeholder(node.name) + # Can't use node_copy here as we may be turning previous call_function into placeholders + new_node.meta = node.meta + env[node] = new_node + + for node in joint_graph.nodes: + if node in inputs: + continue + elif node.op == 'placeholder': + env[node] = InvalidNode + elif node.op == 'call_function': + all_args = pytree.arg_tree_leaves(*node.args, **node.kwargs) + all_args = [isinstance(env[x], InvalidNodeBase) for x in all_args if isinstance(x, fx.Node)] + if any(all_args): + env[node] = InvalidNode + continue + env[node] = new_graph.node_copy(node, lambda x: env[x]) + elif node.op == 'get_attr': + env[node] = new_graph.node_copy(node, lambda x: env[x]) + elif node.op == 'output': + pass + output_values = [] + for x in outputs: + if isinstance(x, fx.Node): + if x not in env: + raise RuntimeError(f"Node {x} couldn't be found in env") + assert not isinstance(env[x], InvalidNodeBase), f"Node {x} was invalid, but is output" + output_values.append(env[x]) + else: + output_values.append(x) + new_graph.output(output_values) + + new_graph.eliminate_dead_code() + new_graph.lint() + return new_graph + + +def _is_primal(node): + return ( + node.op == "placeholder" + and "tangents" not in node.target + and not _is_bwd_seed_offset(node) + and not _is_fwd_seed_offset(node) + ) + +def _is_tangent(node): + return node.op == "placeholder" and "tangents" in node.target + +def _is_bwd_seed_offset(node): + return node.op == "placeholder" and ("bwd_seed" in node.target or "bwd_base_offset" in node.target) + +def _is_fwd_seed_offset(node): + return node.op == "placeholder" and ("fwd_seed" in node.target or "fwd_base_offset" in node.target) + +def _is_backward_state(node): + return node.op == "placeholder" and isinstance(node.meta.get("val"), BackwardState) + + +def _extract_fwd_bwd_outputs(joint_module: fx.GraphModule, *, num_fwd_outputs): + outputs = pytree.arg_tree_leaves(*(node.args for node in joint_module.graph.nodes if node.op == 'output')) + fwd_outputs = outputs[:num_fwd_outputs] + bwd_outputs = outputs[num_fwd_outputs:] + return fwd_outputs, bwd_outputs + + +def _remove_by_name(saved_values, name): + for saved_value in saved_values: + if saved_value.name == name: + saved_values.remove(saved_value) + break + +def _placeholders(nodes): + # Avoid making an entire pass over the graph if we only care about the input placeholders + result = [] + for node in nodes: + if node.op == 'placeholder': + result.append(node) + else: + break # placeholders are all at the start of graph + return result + + +def _extract_fwd_bwd_modules(joint_module: fx.GraphModule, saved_values, saved_sym_nodes, *, num_fwd_outputs): + fwd_outputs, bwd_outputs = _extract_fwd_bwd_outputs(joint_module, num_fwd_outputs=num_fwd_outputs) + placeholders = _placeholders(joint_module.graph.nodes) + primal_inputs = [*filter(_is_primal, placeholders)] + tangent_inputs = [*filter(_is_tangent, placeholders)] + fwd_seed_offset_inputs = [*filter(_is_fwd_seed_offset, placeholders)] + bwd_seed_offset_inputs = [*filter(_is_bwd_seed_offset, placeholders)] + backward_state_inputs = [*filter(_is_backward_state, placeholders)] + + bwd_graph = _extract_graph_with_inputs_outputs( + joint_module.graph, + saved_sym_nodes + saved_values + tangent_inputs + bwd_seed_offset_inputs, + bwd_outputs + ) + + for node in _placeholders(bwd_graph.nodes): + assert node.op == 'placeholder' + # This is to filter out saved values that don't actually end up being used by the backwards pass + if not node.users: + _remove_by_name(saved_values, node.name) + _remove_by_name(saved_sym_nodes, node.name) + elif _is_backward_state(node): + # BackwardState is saved directly + _remove_by_name(saved_values, node.name) + assert backward_state_inputs + + + # Now that we have the finalized list of saved values, we need to ensure + # we propagate all symbols which are referenced by backwards inputs. + # These are not directly used in the graph but are required for downstream + # sizevar assignment + saved_symbols: Set[sympy.Symbol] = set() + saved_sym_nodes_binding = [] + saved_sym_nodes_derived = [] + + # Some symbols may already be bound in the directly saved_sym_nodes, + # keep track of them so we don't re-bind them + for node in saved_sym_nodes: + symbol = is_symbol_binding_fx_node(node) + if symbol: + saved_symbols.add(symbol) + saved_sym_nodes_binding.append(node) + else: + saved_sym_nodes_derived.append(node) + + # Now go through all of the prospective backward inputs and track any + # other symbols we need to bind + symbol_bindings = find_symbol_binding_fx_nodes(joint_module.graph) + for node in itertools.chain(saved_sym_nodes_derived, saved_values, tangent_inputs): + if "val" not in node.meta: + continue + new_symbols = free_symbols(node.meta["val"]) - saved_symbols + # NB: Deterministic order please! + for s in sorted(new_symbols, key=lambda s: s.name): + # NB: For well formed graphs, the symbol should always be present, + # but we also have ways to produce ill-formed graphs, e.g., direct + # make_fx usages, so don't choke in this case + if s not in symbol_bindings: + continue + saved_sym_nodes_binding.append(symbol_bindings[s]) + saved_symbols |= new_symbols + + + # Update saved_sym_nodes that are now reordered to have all bindings at + # front. This can also be used later on to figure out the position of saved + # sym nodes in the output of fwd graph. + saved_sym_nodes.clear() + saved_sym_nodes.extend(saved_sym_nodes_binding + saved_sym_nodes_derived) + + # Now, we re-generate the fwd/bwd graphs. + # NB: This might increase compilation time, but I doubt it matters + fwd_graph = _extract_graph_with_inputs_outputs( + joint_module.graph, + primal_inputs + fwd_seed_offset_inputs, + fwd_outputs + saved_values + saved_sym_nodes + ) + bwd_graph = _extract_graph_with_inputs_outputs( + joint_module.graph, + saved_sym_nodes + saved_values + tangent_inputs + bwd_seed_offset_inputs + backward_state_inputs, + bwd_outputs + ) + + fwd_module = fx._lazy_graph_module._make_graph_module(joint_module, fwd_graph) + bwd_module = fx._lazy_graph_module._make_graph_module(joint_module, bwd_graph) + return fwd_module, bwd_module + + +def default_partition( + joint_module: fx.GraphModule, _joint_inputs, *, num_fwd_outputs +) -> Tuple[fx.GraphModule, fx.GraphModule]: + """ + Partitions the :attr:`joint_module` in a manner that closely resembles the + behavior observed in the original ``.forward()`` and ``.backward()`` of the + callable, i.e., the resulting forward graph contains those operators that + are executed in the original ``.forward()`` callable passed to + :func:`aot_function`. + + The default partitioner collects the operators that are between the forward + inputs and the forward outputs. This helps in finding the tensors which have + to be stashed for the backward pass. These stashed tensors become the output + of the generated forward graph. The remaining operators are then placed in + the backward graph. + + .. warning:: + This API is experimental and likely to change. + + Args: + joint_module(fx.GraphModule): The joint forward and backward graph. This + is the result of AOT Autograd tracing. + + Returns: + Returns the generated forward and backward Fx graph modules. + """ + if has_recomputable_ops(joint_module): + return min_cut_rematerialization_partition(joint_module, _joint_inputs, num_fwd_outputs=num_fwd_outputs) + primal_inputs = list(filter(_is_primal, joint_module.graph.nodes)) + fwd_seed_offset_inputs = list(filter(_is_fwd_seed_offset, joint_module.graph.nodes)) + inputs = primal_inputs + fwd_seed_offset_inputs + fwd_outputs, bwd_outputs = _extract_fwd_bwd_outputs(joint_module, num_fwd_outputs=num_fwd_outputs) + forward_only_graph = _extract_graph_with_inputs_outputs(joint_module.graph, inputs, fwd_outputs) + forward_node_names = {node.name for node in forward_only_graph.nodes if node.op != 'output'} + saved_values = [] + saved_sym_nodes = [] + + for node in joint_module.graph.nodes: + if node.name not in forward_node_names: + continue + if is_sym_node(node): + # Symints must be kept separate from tensors so that PythonFunction only calls + # save_for_backward on tensors and stashes symints in autograd .ctx + saved_sym_nodes.append(node) + elif ( + 'tensor_meta' not in node.meta + and node.op == 'call_function' + ): + # Since we can't save tuple of tensor values, we need to flatten out what we're saving + users = node.users + assert all(user.target == operator.getitem for user in users) + saved_values.extend(users) + else: + backward_usages = [n for n in node.users if n.name not in forward_node_names] + if 'tensor_meta' in node.meta and all(is_sym_node(n) for n in backward_usages): + # If we have a tensor in the forward, where only its sizes/strides are needed in the backward, + # and not the actual tensor data, + # then it will be a lot cheaper to save only the sizes/strides, and not the actual tensor. + # + # Note that saving the tensor could also cause compilation problems: + # If the user mutated an input in the forward and uses its sizes/strides in the backward, + # then we would be obligated to clone the input before saving it to appease autograd. + # (This is how we originally found this bug). + saved_sym_nodes.extend(backward_usages) + else: + saved_values.append(node) + saved_values = list(dict.fromkeys(saved_values).keys()) + saved_sym_nodes = list(dict.fromkeys(saved_sym_nodes).keys()) + + return _extract_fwd_bwd_modules(joint_module, saved_values, saved_sym_nodes=saved_sym_nodes, num_fwd_outputs=num_fwd_outputs) + + +def _prod(x): + s = 1 + for i in x: + s *= i + return s + +def _tensor_nbytes(numel, dtype): + return numel * dtype.itemsize + +def _size_of(node: fx.Node) -> int: + if 'val' in node.meta: + val = node.meta['val'] + if isinstance(val, py_sym_types): + if isinstance(val, torch.SymInt): + return 1 + else: + return 999999 + # NB: The fallback values here are meaningless, maybe we should respect + # torch._inductor.config.unbacked_symint_fallback (but this is a + # layering violation) + elif isinstance(val, (list, tuple)): + return sum(_tensor_nbytes(hint_int(n.numel(), fallback=4098), n.dtype) for n in val if isinstance(n, torch.Tensor)) + elif isinstance(val, torch.Tensor): + return _tensor_nbytes(hint_int(val.numel(), fallback=4098), val.dtype) + + raise RuntimeError(f"Unknown metadata type {type(val)}") + + # Only needed since we don't always trace with fake tensors. + if 'tensor_meta' in node.meta: + metadata = node.meta['tensor_meta'] + # TODO: What is to_size_hint suppose to be? + numel = _prod(map(to_size_hint, metadata.shape)) # noqa: F821 + dtype = metadata.dtype + else: + return 0 + + return _tensor_nbytes(numel, dtype) + + +# Used for some investigative purposes +def _count_ops(graph): + from collections import defaultdict + cnt = defaultdict(int) + for node in graph.nodes: + if node.op == 'call_function': + cnt[node.target.__name__] += 1 + print(sorted(cnt.items(), key=lambda x: x[1], reverse=True)) + + +@functools.lru_cache(None) +def pointwise_ops(): + ops = [] + for attr_name in dir(torch.ops.aten): + opoverloadpacket = getattr(torch.ops.aten, attr_name) + if not isinstance(opoverloadpacket, torch._ops.OpOverloadPacket): + continue + + for overload in opoverloadpacket.overloads(): + op_overload = getattr(opoverloadpacket, overload) + if torch.Tag.pointwise in op_overload.tags: + # currently aot autograd uses packet not overload + ops.append(opoverloadpacket) + break + + return ops + +def get_depth(node, depth_map): + if node in depth_map: + return depth_map[node] + + # Base case + if node.op == "placeholder": + depth_map[node] = 0 + return depth_map[node] + + # Handle output node + if node.op == "output": + args = node.args[0] + for arg in args: + if isinstance(arg, torch.fx.node.Node): + get_depth(arg, depth_map) + return + + # Get the depth of args and set the depth of this node + arg_depths = [get_depth(arg, depth_map) for arg in node.all_input_nodes if isinstance(arg, torch.fx.node.Node)] + # factory ops like full, rand might not have any input args + if len(arg_depths) == 0: + arg_depths = [0] + depth_map[node] = max(arg_depths) + 1 + return depth_map[node] + + +def sort_depths(args, depth_map): + arg_depths = {arg: depth_map[arg] for arg in args if isinstance(arg, torch.fx.node.Node)} + return sorted(arg_depths.items(), key=lambda x: x[1], reverse=True) + + +def reordering_to_mimic_autograd_engine(gm): + """ + This pass finds the first bwd node in the graph (by looking at users of + tangents) and then reorders the graph by walking from this node to all the + way to the end of the graph. At each op in this traveral, we insert this op + in a new graph and try to bring only the relevant subgraph from the other + non-bwd edges relevant for this op. This closely mimics the behavior of + autograd engine. + + Why is this pass required in the first place? + + This is an artifact of how partitioners work today. The starting point of + partitioner is a joint graph, which is fwd and then bwd graph. In the case + of checkpointing, we keep portions of fwd graph in their original place in + the joint graph, while obtaining a bwd graph. As a result, the resulting bwd + graph has copies of recomputed fwd subgraphs followed by the original bwd + graph. If we run this naively, this leads to bad memory footprint, because + the fwd subgraphs are live for way longer duration than necessary. This pass + reorders the operations such that we prioritize the ops for the original bwd + graph while only realizing those ops from the fwd graph that are necessary + at any given point in the graph. + """ + + new_graph = fx.Graph() + env = {} + + # Add new placeholder nodes in the order specified by the inputs + for node in gm.graph.nodes: + if node.op == "placeholder": + new_node = new_graph.placeholder(node.name) + # Can't use node_copy here as we may be turning previous call_function into placeholders + new_node.meta = node.meta + env[node] = new_node + + + order = {} + for idx, node in enumerate(gm.graph.nodes): + order[node] = idx + + # Populate depth for the nodes. Depth is the distance from the inputs. + depths = {} + output_node = next(node for node in gm.graph.nodes if node.op == "output") + get_depth(output_node, depths) + + def insert_node_in_graph(node): + if node in env: + return env[node] + + # Bias traversal towards the nodes that have higher depth - prioritizes + # critical path first. + for arg, _ in sort_depths(node.all_input_nodes, depths): + env[arg] = insert_node_in_graph(arg) + env[node] = new_graph.node_copy(node, lambda x: env[x]) + return env[node] + + # Find first bwd node in the graph + tangent_inputs = list(filter(_is_tangent, gm.graph.nodes)) + first_node_in_bwd = None + minimum_order = math.inf + for tangent in tangent_inputs: + for user in tangent.users: + if order[user] < minimum_order: + minimum_order = order[user] + first_node_in_bwd = user + assert first_node_in_bwd is not None + + # Build the graph op-by-op by starting from the node all the way to the end + for node in list(gm.graph.nodes)[order[first_node_in_bwd]:]: + insert_node_in_graph(node) + + # The output node is already built by the traversal. + new_gm = torch.fx.GraphModule(gm, new_graph) + return new_gm + + +def functionalize_rng_ops(joint_module, fw_module, bw_module, num_sym_nodes): + # During user-driven activation checkpointing, we have to ensure that a rng + # op in fwd yields the same output as the recomputed rng op in the bwd. To + # do this, we use functionalize wrappers to wrap the random ops and share + # rng state between the fwd and bwd graphs. + + # There are 3 main steps to do this + # Step 1 - Construct a mapping of rng node between the fwd and its counterpart in bwd. + # Step 2 - Modify the fwd pass such that + # 1) Replace rand with run_and_save_rng_state wrapper + # 2) Replace the users of the original op with the output[1] of this op. + # 3) Collect all the rng_state - output[0] of each op, and make them + # output nodes. Special care needs to be taken here because fwd outputs + # has symints at the very end. + # Step 3 - Modify the bwd pass such that + # 1) Add the input nodes just before the tangents for the stashed rng states + # 2) Replace rand with run_with_save_rng_state wrappers + # 3) Use the stashed states as inputs to these ops + + # Unique id to generate name + uid = itertools.count() + + def get_rng_ops(gmod): + random_nodes = {} + for node in gmod.graph.nodes: + if ( + node.op == "call_function" + and hasattr(node.target, "tags") + and torch.Tag.nondeterministic_seeded in node.target.tags + ): + random_nodes[node.name] = node + return random_nodes + + def get_device(node): + """ + Check the example value of the node outputs to find the device type. + """ + if "val" not in node.meta: + return None + + candidates = node.meta["val"] + if not isinstance(candidates, tuple): + candidates = (candidates,) + + for candidate in candidates: + if isinstance(candidate, torch.Tensor): + if candidate.device.type == "cuda": + return "cuda" + + return "cpu" + + def get_sample_rng_state(device): + if device == "cuda": + return torch.cuda.get_rng_state() + return torch.get_rng_state() + + # Step 1 - Construct a mapping of rng node between the fwd and its counterpart in bwd. + joint_graph_rng_ops = get_rng_ops(joint_module) + fw_graph_rng_ops = get_rng_ops(fw_module) + bw_graph_rng_ops = get_rng_ops(bw_module) + recomputable_rng_ops_map = dict() + for node in joint_module.graph.nodes: + if ( + must_recompute(node) + and hasattr(node.target, "tags") + and torch.Tag.nondeterministic_seeded in node.target.tags + ): + base_node = joint_graph_rng_ops[node.name] + fw_node = fw_graph_rng_ops[node.name] + bw_node = bw_graph_rng_ops[node.name] + recomputable_rng_ops_map[base_node] = {"fwd": fw_node, "bwd": bw_node} + + run_and_save_rng = torch._prims.rng_prims.run_and_save_rng_state + run_with_rng_state = torch._prims.rng_prims.run_with_rng_state + + for node in bw_module.graph.nodes: + if node.op == "placeholder" and "tangent" in node.name: + bw_tangent_start_node = node + break + + + fw_rng_state_outputs = [] + for base_node, node_pair in recomputable_rng_ops_map.items(): + # Step 2 - Modify the fwd pass such that + fw_node = node_pair["fwd"] + bw_node = node_pair["bwd"] + fw_graph = fw_module.graph + with fw_graph.inserting_before(fw_node): + functional_fw_node = fw_graph.create_node( + "call_function", + run_and_save_rng, + args=(fw_node.target, *fw_node.args), + kwargs=fw_node.kwargs + ) + state = fw_graph.create_node("call_function", operator.getitem, args=(functional_fw_node, 0), kwargs={}) + rng_output = fw_graph.create_node("call_function", operator.getitem, args=(functional_fw_node, 1,), kwargs={}) + fw_node.replace_all_uses_with(rng_output) + fw_graph.erase_node(fw_node) + fw_rng_state_outputs.append(state) + + + # Step 3 - Modify the bwd pass such that + bw_graph = bw_module.graph + with bw_graph.inserting_before(bw_tangent_start_node): + state_name = f"rng_state_output_{next(uid)}" + bw_rng_state_node = bw_graph.placeholder(state_name) + bw_rng_state_node.meta["val"] = get_sample_rng_state(get_device(fw_node)) + + with bw_graph.inserting_before(bw_node): + rng_output = bw_graph.create_node( + "call_function", + run_with_rng_state, + args=(bw_rng_state_node, bw_node.target, *bw_node.args), + kwargs=bw_node.kwargs + ) + + bw_node.replace_all_uses_with(rng_output) + bw_graph.erase_node(bw_node) + + + # Add the rng states in the output of the fwd graph. AOT Autograd assumes + # that symints are at the end of forward graph outputs. So, insert the new + # rng states accordingly. + fw_output_node = next(node for node in fw_module.graph.nodes if node.op == "output") + fw_outputs = fw_output_node.args[0] + sym_node_start_idx = len(fw_outputs) - num_sym_nodes + outputs = fw_outputs[:sym_node_start_idx] + fw_rng_state_outputs + fw_outputs[sym_node_start_idx:] + fw_module.graph.output(outputs) + fw_module.graph.erase_node(fw_output_node) + fw_module.recompile() + bw_module.recompile() + return fw_module, bw_module + + +def cleanup_recompute_tags(joint_module): + """ + If there are two consecutive checkpointed blocks with no operator in + between, we would still want to stash the tensor at the boundary of + checkpointed blocks. The following pass makes the last output node + non-recomputable to allow for that. + """ + for node in joint_module.graph.nodes: + if must_recompute(node): + for user in node.users: + if must_recompute(user) and user.meta["recompute"] > node.meta["recompute"]: + node.meta["recompute"] = 0 + return joint_module + + +def min_cut_rematerialization_partition( + joint_module: fx.GraphModule, _joint_inputs, compiler="inductor", recomputable_ops=None, + *, num_fwd_outputs +) -> Tuple[fx.GraphModule, fx.GraphModule]: + """ + Partitions the joint graph such that the backward recomputes the forward. + Recomputing helps in trading off memory bandwidth with computation. + + To create the fwd and bwd graph, we copy the joint graph, manually set the + outputs to just original forward or backward outputs. And then we run the + resulting graphs through dead code elimination. + + .. warning:: + This API is experimental and likely to change. + + Args: + joint_module(fx.GraphModule): The joint forward and backward graph. This + is the result of AOT Autograd tracing. + _joint_inputs: The inputs to the joint graph. This is unused. + compiler: This option determines the default set of recomputable ops. + Currently, there are two options: ``nvfuser`` and ``inductor``. + recomputable_ops: This is an optional set of recomputable ops. If this + is not None, then this set of ops will be used instead of the + default set of ops. + num_fwd_outputs: The number of outputs from the forward graph. + + Returns: + Returns the generated forward and backward Fx graph modules. + """ + try: + import networkx as nx + except ImportError as e: + raise RuntimeError("Need networkx installed to perform smart recomputation " + "heuristics") from e + + joint_module.graph.eliminate_dead_code() + joint_module.recompile() + + fx_g = joint_module.graph + + # add the CSE pass + if config.cse: + cse_graph = fx_graph_cse(fx_g) + joint_module.graph = cse_graph + full_bw_graph = joint_module.graph + + graph_has_recomputable_ops = has_recomputable_ops(joint_module) + graph_has_recomputable_rng_ops = has_recomputable_rng_ops(joint_module) + if graph_has_recomputable_ops: + joint_module = cleanup_recompute_tags(joint_module) + + name_to_node = {} + for node in joint_module.graph.nodes: + name_to_node[node.name] = node + + def classify_nodes(joint_module): + required_bw_nodes = set() + for node in joint_module.graph.nodes: + if node.op == 'placeholder' and "tangents" in node.target: + required_bw_nodes.add(node) + if node in required_bw_nodes: + for user in node.users: + required_bw_nodes.add(user) + + primal_inputs = list(filter(_is_primal, joint_module.graph.nodes)) + fwd_seed_offset_inputs = list(filter(_is_fwd_seed_offset, joint_module.graph.nodes)) + inputs = primal_inputs + fwd_seed_offset_inputs + fwd_outputs, bwd_outputs = _extract_fwd_bwd_outputs(joint_module, num_fwd_outputs=num_fwd_outputs) + required_bw_nodes.update(o for o in bwd_outputs if o is not None) + forward_only_graph = _extract_graph_with_inputs_outputs(joint_module.graph, inputs, fwd_outputs) + required_fw_nodes = {name_to_node[node.name] for node in forward_only_graph.nodes + if node.op != 'output'} + unclaimed_nodes = {node for node in joint_module.graph.nodes + if node not in required_fw_nodes and node not in required_bw_nodes} + return fwd_outputs, required_fw_nodes, required_bw_nodes, unclaimed_nodes, inputs + + orig_fw_outputs, required_fw_nodes, required_bw_nodes, unclaimed_nodes, inputs = classify_nodes(joint_module) + + # networkx blows up on graphs with no required backward nodes + # Since there's nothing to partition anyway, and the default partitioner can "handle" + # this case, send our graph over to the default partitioner. + if len(required_bw_nodes) == 0: + return default_partition(joint_module, _joint_inputs, num_fwd_outputs=num_fwd_outputs) + + for node in reversed(joint_module.graph.nodes): + if node not in required_fw_nodes: + node.dist_from_bw = 0 + else: + node.dist_from_bw = int(1e9) + for user in node.users: + node.dist_from_bw = min(node.dist_from_bw, user.dist_from_bw + 1) + + aten = torch.ops.aten + prims = torch.ops.prims + + # compiler == "nvfuser" is the default set of recomputable ops + default_recomputable_ops = [aten.add, aten.sub, aten.div, aten.atan2, aten.mul, aten.max, aten.min, aten.pow, aten.remainder, aten.fmod, aten.__and__, aten.__or__, aten.__xor__, aten.__lshift__, aten.__rshift__, aten.eq, aten.ne, aten.ge, aten.gt, aten.le, aten.lt, aten.abs, aten.bitwise_not, aten.ceil, aten.floor, aten.frac, aten.neg, aten.relu, aten.round, aten.silu, aten.trunc, aten.log, aten.log10, aten.log1p, aten.log2, aten.lgamma, aten.exp, aten.expm1, aten.erf, aten.erfc, aten.cos, aten.acos, aten.cosh, aten.sin, aten.asin, aten.sinh, aten.tan, aten.atan, aten.tanh, aten.atanh, aten.sqrt, aten.rsqrt, aten.reciprocal, aten.sigmoid, aten.softplus, aten.threshold, aten.threshold_backward, aten.clamp, aten.where, aten.lerp, aten.addcmul, aten.gelu, aten.gelu_backward, aten.sum, aten.mean, aten._grad_sum_to_size, aten.sum_to_size, aten.amax, aten.to, aten.type_as, operator.getitem, aten.squeeze, aten.unsqueeze, aten.rsub, aten._to_copy] # noqa: E501,B950 + view_ops = [aten.squeeze, aten.unsqueeze, aten.alias] + if compiler == "inductor": + default_recomputable_ops += [prims.div, prims.convert_element_type, aten.clone, aten._to_copy, aten.full_like, prims.var, prims.sum, aten.var, aten.std, prims.broadcast_in_dim, aten.select, aten.permute, aten._unsafe_view, aten.view, aten.expand, aten.slice, aten.reshape, aten.broadcast_tensors, aten.scalar_tensor, aten.ones, aten.new_zeros, aten.lift_fresh_copy, aten.arange, aten.triu, aten.var_mean, aten.isinf, aten.any, aten.full, aten.as_strided, aten.zeros, aten.argmax, aten.maximum] # noqa: E501,B950 + view_ops += [aten.view, aten.slice, aten.permute, aten.t, prims.broadcast_in_dim, aten.expand, aten.as_strided] + # Natalia said that we should allow recomputing indexing :) + default_recomputable_ops += [aten.index] + default_recomputable_ops += view_ops + + default_recomputable_ops += pointwise_ops() + + default_recomputable_ops += [ + aten.zeros_like, + ] + + default_recomputable_ops += [ + method_to_operator(m) + for m in magic_methods + ] + + recomputable_ops = set(recomputable_ops) if recomputable_ops is not None else set(default_recomputable_ops) + + random_ops = [aten.native_dropout, aten.rand_like, aten.randn_like] + compute_intensive_ops = [aten.mm, aten.convolution, aten.convolution_backward, aten.bmm, aten.addmm, aten.upsample_bilinear2d, aten._softmax, aten._softmax_backward_data, aten.native_layer_norm, aten.native_layer_norm_backward, aten.native_batch_norm, aten.native_batch_norm_backward, aten._native_batch_norm_legit] # noqa: E501,B950 + + fusible_ops = recomputable_ops | set(random_ops) + if AOT_PARTITIONER_DEBUG: + joint_module_ops = { + str(node.target._overloadpacket) + for node in joint_module.graph.nodes + if node.op == "call_function" and hasattr(node.target, "_overloadpacket") + } + ops_ignored = joint_module_ops - {str(i) for i in recomputable_ops} + print("Ops banned from rematerialization: ", ops_ignored) + print() + + def is_materialized_backwards(node): + cur_nodes = {node} + while len(cur_nodes) > 0: + cur = cur_nodes.pop() + for user in cur.users: + if user not in required_fw_nodes and not is_fusible(cur, user): + return True + if user not in required_fw_nodes and get_aten_target(user) in view_ops: + cur_nodes.add(user) + + return False + + def ban_recomputation(node): + if "recompute" in node.meta: + return node.meta["recompute"] == 0 + elif config.aggressive_recomputation: + ignored_ops = random_ops + compute_intensive_ops + return (node.op == 'call_function' and get_aten_target(node) in ignored_ops) + else: + if node.op != 'call_function': + return False + if get_aten_target(node) not in recomputable_ops: + return True + if node.target == operator.getitem: + return False + if node.target in [aten.lift_fresh_copy.default, aten.lift_fresh.default]: + return False + + # If a node *must* be materialized in the backwards pass, then we + # should never recompute it. This is a pretty subtle point. In + # general, the assumption we make is that recomputing a node in the + # backwards pass is "free". However, if a node must be materialized + # in the backwards pass, then recomputing it is never free. + if is_materialized_backwards(node): + return True + + # Arbitrary hack that sometimes seems to help things. The above + # modification appears to have made this heuristic a lot less critical + # for performance. + # TODO: Investigate why this hack helps. + # TODO: Investigate the interaction with compiler assisted + # activation checkpointing. Removing the heuristic improves both + # memory footprint and speedup. + if not graph_has_recomputable_ops: + if compiler == "inductor" and node.dist_from_bw > config.max_dist_from_bw: + return True + # If the output of an op is 4x smaller (arbitrary choice), + # then we don't allow recomputation. + input_tensors_size = sum(_size_of(i) for i in node.args if isinstance(i, fx.Node)) + output_size = _size_of(node) + return (output_size * 4 < input_tensors_size) + + def is_fusible(a, b): + # We can perform "memory fusion" into a cat, but cat cannot be a + # producer to a fusion + if get_aten_target(b) == aten.cat: + return True + return get_aten_target(a) in fusible_ops and get_aten_target(b) in fusible_ops + + def is_materialized(node): + if node.op == 'placeholder': + return True + + return not all(is_fusible(node, user) for user in node.users) + + def get_node_weight(node) -> int: + mem_sz = _size_of(node) + + # Heuristic to bias towards nodes closer to the backwards pass + # Complete guess about current value + mem_sz = int(mem_sz * (1.1 ** max(min(node.dist_from_bw, 100), 1))) + # mem_sz = int(mem_sz + node.dist_from_bw) + + if is_materialized(node): + return mem_sz + else: + return mem_sz * 2 + + nx_graph = nx.DiGraph() + for node in full_bw_graph.nodes: + if node.op == 'output': + continue + + if node in required_bw_nodes: + if node not in inputs: + nx_graph.add_edge(node.name + "_in", "sink", capacity=math.inf) + continue + # If someone saves a input for backward as-is and backward + # returns that tensor as-is as a grad input, then the node x would + # be both a required_bw_node and an input. In this case we + # (1) connect x_in to to the source, (2) x_out to the sink, and + # (3) assign the proper weight to the x_in-x_out edge, so that + # x would be part of cut nodes. A case where this happens is if + # NestedTensor saves a offset tensor as part of the singleton int + # in sizes. + nx_graph.add_edge(node.name + "_out", "sink", capacity=math.inf) + + if _is_primal(node) or _is_fwd_seed_offset(node): + nx_graph.add_edge("source", node.name + "_in", capacity=math.inf) + + # If a node can't be recomputed (too expensive or involves randomness), + # we prevent it from being recomputed by adding an inf edge to the source + # We only need to ban nodes in the fw pass, as those are the only ones that would be recomputed. + if ban_recomputation(node) and node in required_fw_nodes: + nx_graph.add_edge("source", node.name + "_in", capacity=math.inf) + + # Checks if a node is actually a tuple. Can be simplified to just an isinstance check if we always use faketensors. + is_non_tensor_node = (('val' not in node.meta and 'tensor_meta' not in node.meta) or + ('val' in node.meta and not isinstance(node.meta['val'], torch.Tensor))) + + if is_sym_node(node): + weight = sym_node_size(node) + elif is_non_tensor_node: + weight = 0 if isinstance(node.meta.get("val"), BackwardState) else math.inf + else: + weight = get_node_weight(node) + + # Creates the weights on the "node" edge + nx_graph.add_edge(node.name + "_in", node.name + "_out", capacity=weight) + for user in node.users: + nx_graph.add_edge(node.name + "_out", user.name + "_in", capacity=math.inf) + + try: + cut_value, partition = nx.minimum_cut(nx_graph, "source", "sink") + except Exception: + print('Failed to compute min-cut on following graph:') + print('\n'.join(nx.readwrite.edgelist.generate_edgelist(nx_graph))) + raise + + reachable, non_reachable = partition + cutset = set() + for u, nbrs in ((n, nx_graph[n]) for n in reachable): + cutset.update((u, v) for v in nbrs if v in non_reachable) + + cut_nodes = set() + for node_in, node_out in cutset: + assert node_in[:-3] == node_out[:-4] + node_name = node_in[:-3] + cut_nodes.add(node_name) + + # To make this stuff deterministic + node_idx = {node: idx for idx, node in enumerate(joint_module.graph.nodes)} + saved_values = sorted((name_to_node[node] for node in cut_nodes), key=lambda x: node_idx[x]) + # save_for_backward on tensors and stashes symints in autograd .ctx + saved_sym_nodes = list(filter(is_sym_node, saved_values)) + saved_values = list(filter(lambda n: not is_sym_node(n), saved_values)) + # NB: saved_sym_nodes will be mutated to reflect the actual saved symbols + fw_module, bw_module = _extract_fwd_bwd_modules( + joint_module, saved_values, saved_sym_nodes=saved_sym_nodes, num_fwd_outputs=num_fwd_outputs) + + if graph_has_recomputable_ops: + if graph_has_recomputable_rng_ops: + fw_module, bw_module = functionalize_rng_ops( + joint_module, fw_module, bw_module, len(saved_sym_nodes) + ) + bw_module = reordering_to_mimic_autograd_engine(bw_module) + + if AOT_PARTITIONER_DEBUG: + print("Theoretical Activations Stored: ", sum([_size_of(i) for i in saved_values]) / 1e9) + fw_module_nodes = {node.name for node in fw_module.graph.nodes if node.op == 'call_function'} + bw_module_nodes = {node.name for node in bw_module.graph.nodes if node.op == 'call_function'} + remat_nodes = fw_module_nodes & bw_module_nodes + + counts = defaultdict(int) + for node in fw_module.graph.nodes: + if node.name in remat_nodes and hasattr(node.target, '_overloadpacket'): + counts[str(node.target._overloadpacket)] += 1 + print(f"# remat/fw/bw: {len(remat_nodes)}/{len(fw_module_nodes)}/{len(bw_module_nodes)}") + print("Count of Ops Rematerialized: ", sorted(counts.items(), key=lambda x: x[1], reverse=True)) + return fw_module, bw_module + + +def draw_graph( + traced: torch.fx.GraphModule, + fname: str, + figname: str = "fx_graph", + clear_meta: bool = True, + prog: Union[str, List[str]] = None, + parse_stack_trace: bool = False, + dot_graph_shape: Optional[str] = None, +) -> None: + if clear_meta: + new_graph = copy.deepcopy(traced.graph) + traced = fx.GraphModule(traced, new_graph) + for node in traced.graph.nodes: + node.meta = {} + base, ext = os.path.splitext(fname) + if not ext: + ext = ".svg" + print(f"Writing FX graph to file: {base}{ext}") + g = graph_drawer.FxGraphDrawer( + traced, + figname, + parse_stack_trace=parse_stack_trace, + dot_graph_shape=dot_graph_shape, + ) + x = g.get_main_dot_graph() + write_method = getattr(x, "write_" + ext.lstrip(".")) + fname = f"{base}{ext}" + if prog is None: + write_method(fname) + else: + write_method(fname, prog=prog) + + +def draw_joint_graph( + graph: torch.fx.GraphModule, + joint_inputs, + file_name: str = "full_graph.png", + dot_graph_shape: Optional[str] = None, +): + draw_graph(graph, file_name, dot_graph_shape=dot_graph_shape) + return default_partition(graph, joint_inputs) diff --git a/shared/package-files/33/33984413a0b0295265261ba1fb25c75d99f8d03b51c3a121b371a7b806fba64e/blob b/shared/package-files/33/33984413a0b0295265261ba1fb25c75d99f8d03b51c3a121b371a7b806fba64e/blob new file mode 100644 index 0000000000000000000000000000000000000000..c776c84deedabf62573fdee3f6b0bea1089d0092 Binary files /dev/null and b/shared/package-files/33/33984413a0b0295265261ba1fb25c75d99f8d03b51c3a121b371a7b806fba64e/blob differ diff --git a/shared/package-files/33/3398b5ab6ce4a28c36a35aec9fba77d89c36da09d87120d0a3f5d79fbfc6bf41/blob b/shared/package-files/33/3398b5ab6ce4a28c36a35aec9fba77d89c36da09d87120d0a3f5d79fbfc6bf41/blob new file mode 100644 index 0000000000000000000000000000000000000000..b9976aa6623adbc1fe8316ca42bf0ad97207df68 --- /dev/null +++ b/shared/package-files/33/3398b5ab6ce4a28c36a35aec9fba77d89c36da09d87120d0a3f5d79fbfc6bf41/blob @@ -0,0 +1,1918 @@ +import functools +import itertools +import sys +import warnings +import threading +import operator + +import numpy as np + +import unittest +from numba import guvectorize, njit, typeof, vectorize +from numba.core import types +from numba.np.numpy_support import from_dtype +from numba.core.errors import LoweringError, TypingError +from numba.tests.support import TestCase, MemoryLeakMixin +from numba.core.typing.npydecl import supported_ufuncs +from numba.np import numpy_support +from numba.core.registry import cpu_target +from numba.core.base import BaseContext +from numba.np import ufunc_db + +is32bits = tuple.__itemsize__ == 4 +iswindows = sys.platform.startswith('win32') + + +def _unimplemented(func): + """An 'expectedFailure' like decorator that only expects compilation errors + caused by unimplemented functions that fail in no-python mode""" + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + func(*args, **kwargs) + except TypingError: + raise unittest._ExpectedFailure(sys.exc_info()) + raise unittest._UnexpectedSuccess + + +def _make_ufunc_usecase(ufunc): + ldict = {} + arg_str = ','.join(['a{0}'.format(i) for i in range(ufunc.nargs)]) + func_str = 'def fn({0}):\n np.{1}({0})'.format(arg_str, ufunc.__name__) + exec(func_str, globals(), ldict) + fn = ldict['fn'] + fn.__name__ = '{0}_usecase'.format(ufunc.__name__) + return fn + + +def _make_unary_ufunc_op_usecase(ufunc_op): + ldict = {} + exec("def fn(x):\n return {0}(x)".format(ufunc_op), globals(), ldict) + fn = ldict["fn"] + fn.__name__ = "usecase_{0}".format(hash(ufunc_op)) + return fn + + +def _make_binary_ufunc_op_usecase(ufunc_op): + ldict = {} + exec("def fn(x,y):\n return x{0}y".format(ufunc_op), globals(), ldict) + fn = ldict["fn"] + fn.__name__ = "usecase_{0}".format(hash(ufunc_op)) + return fn + + +def _make_inplace_ufunc_op_usecase(ufunc_op): + """Generates a function to be compiled that performs an inplace operation + + ufunc_op can be a string like '+=' or a function like operator.iadd + """ + if isinstance(ufunc_op, str): + ldict = {} + exec("def fn(x,y):\n x{0}y".format(ufunc_op), globals(), ldict) + fn = ldict["fn"] + fn.__name__ = "usecase_{0}".format(hash(ufunc_op)) + else: + def inplace_op(x, y): + ufunc_op(x, y) + fn = inplace_op + return fn + + +def _as_dtype_value(tyargs, args): + """Convert python values into numpy scalar objects. + """ + return [np.dtype(str(ty)).type(val) for ty, val in zip(tyargs, args)] + + +class BaseUFuncTest(MemoryLeakMixin): + + def setUp(self): + super(BaseUFuncTest, self).setUp() + self.inputs = [ + (np.uint32(0), types.uint32), + (np.uint32(1), types.uint32), + (np.int32(-1), types.int32), + (np.int32(0), types.int32), + (np.int32(1), types.int32), + (np.uint64(0), types.uint64), + (np.uint64(1), types.uint64), + (np.int64(-1), types.int64), + (np.int64(0), types.int64), + (np.int64(1), types.int64), + + (np.float32(-0.5), types.float32), + (np.float32(0.0), types.float32), + (np.float32(0.5), types.float32), + + (np.float64(-0.5), types.float64), + (np.float64(0.0), types.float64), + (np.float64(0.5), types.float64), + + (np.array([0,1], dtype='u4'), types.Array(types.uint32, 1, 'C')), + (np.array([0,1], dtype='u8'), types.Array(types.uint64, 1, 'C')), + (np.array([-1,0,1], dtype='i4'), types.Array(types.int32, 1, 'C')), + (np.array([-1,0,1], dtype='i8'), types.Array(types.int64, 1, 'C')), + (np.array([-0.5, 0.0, 0.5], dtype='f4'), + types.Array(types.float32, 1, 'C')), + (np.array([-0.5, 0.0, 0.5], dtype='f8'), + types.Array(types.float64, 1, 'C')), + + (np.array([0,1], dtype=np.int8), types.Array(types.int8, 1, 'C')), + (np.array([0,1], dtype=np.int16), types.Array(types.int16, 1, 'C')), + (np.array([0,1], dtype=np.uint8), types.Array(types.uint8, 1, 'C')), + (np.array([0,1], dtype=np.uint16), + types.Array(types.uint16, 1, 'C')), + ] + + @functools.lru_cache(maxsize=None) + def _compile(self, pyfunc, args, nrt=False): + # NOTE: to test the implementation of Numpy ufuncs, we disable + # rewriting of array expressions. + return njit(args, _nrt=nrt, no_rewrites=True)(pyfunc) + + def _determine_output_type(self, input_type, int_output_type=None, + float_output_type=None): + ty = input_type + if isinstance(ty, types.Array): + ndim = ty.ndim + ty = ty.dtype + else: + ndim = 1 + + if ty in types.signed_domain: + if int_output_type: + output_type = types.Array(int_output_type, ndim, 'C') + else: + output_type = types.Array(ty, ndim, 'C') + elif ty in types.unsigned_domain: + if int_output_type: + output_type = types.Array(int_output_type, ndim, 'C') + else: + output_type = types.Array(ty, ndim, 'C') + else: + if float_output_type: + output_type = types.Array(float_output_type, ndim, 'C') + else: + output_type = types.Array(ty, ndim, 'C') + return output_type + + +class BasicUFuncTest(BaseUFuncTest): + def _make_ufunc_usecase(self, ufunc): + return _make_ufunc_usecase(ufunc) + + def basic_ufunc_test(self, ufunc, skip_inputs=None, additional_inputs=None, + int_output_type=None, float_output_type=None, + kinds='ifc', positive_only=False): + + # Necessary to avoid some Numpy warnings being silenced, despite + # the simplefilter() call below. + if skip_inputs is None: + skip_inputs = [] + if additional_inputs is None: + additional_inputs = [] + self.reset_module_warnings(__name__) + + pyfunc = self._make_ufunc_usecase(ufunc) + + inputs = list(self.inputs) + additional_inputs + + for input_tuple in inputs: + input_operand = input_tuple[0] + input_type = input_tuple[1] + + is_tuple = isinstance(input_operand, tuple) + if is_tuple: + args = input_operand + else: + args = (input_operand,) * ufunc.nin + + if input_type in skip_inputs: + continue + if positive_only and np.any(args[0] < 0): + continue + + # Some ufuncs don't allow all kinds of arguments + if (args[0].dtype.kind not in kinds): + continue + + output_type = self._determine_output_type( + input_type, int_output_type, float_output_type) + + input_types = (input_type,) * ufunc.nin + output_types = (output_type,) * ufunc.nout + argtys = input_types + output_types + cfunc = self._compile(pyfunc, argtys) + + if isinstance(args[0], np.ndarray): + results = [ + np.zeros(args[0].shape, + dtype=out_ty.dtype.name) + for out_ty in output_types + ] + expected = [ + np.zeros(args[0].shape, dtype=out_ty.dtype.name) + for out_ty in output_types + ] + else: + results = [ + np.zeros(1, dtype=out_ty.dtype.name) + for out_ty in output_types + ] + expected = [ + np.zeros(1, dtype=out_ty.dtype.name) + for out_ty in output_types + ] + + invalid_flag = False + with warnings.catch_warnings(record=True) as warnlist: + warnings.simplefilter('always') + pyfunc(*args, *expected) + + warnmsg = "invalid value encountered" + for thiswarn in warnlist: + + if (issubclass(thiswarn.category, RuntimeWarning) + and str(thiswarn.message).startswith(warnmsg)): + invalid_flag = True + + cfunc(*args, *results) + + for expected_i, result_i in zip(expected, results): + msg = '\n'.join(["ufunc '{0}' failed", + "inputs ({1}):", "{2}", + "got({3})", "{4}", + "expected ({5}):", "{6}" + ]).format(ufunc.__name__, + input_type, input_operand, + output_type, result_i, + expected_i.dtype, expected_i) + try: + np.testing.assert_array_almost_equal( + expected_i, result_i, + decimal=5, + err_msg=msg) + except AssertionError: + if invalid_flag: + # Allow output to mismatch for invalid input + print("Output mismatch for invalid input", + input_tuple, result_i, expected_i) + else: + raise + + def signed_unsigned_cmp_test(self, comparison_ufunc): + self.basic_ufunc_test(comparison_ufunc) + + if numpy_support.numpy_version < (1, 25): + return + + # Test additional implementations that specifically handle signed / + # unsigned comparisons added in NumPy 1.25: + # https://github.com/numpy/numpy/pull/23713 + additional_inputs = ( + (np.int64(-1), np.uint64(0)), + (np.int64(-1), np.uint64(1)), + (np.int64(0), np.uint64(0)), + (np.int64(0), np.uint64(1)), + (np.int64(1), np.uint64(0)), + (np.int64(1), np.uint64(1)), + + (np.uint64(0), np.int64(-1)), + (np.uint64(0), np.int64(0)), + (np.uint64(0), np.int64(1)), + (np.uint64(1), np.int64(-1)), + (np.uint64(1), np.int64(0)), + (np.uint64(1), np.int64(1)), + + (np.array([-1, -1, 0, 0, 1, 1], dtype=np.int64), + np.array([0, 1, 0, 1, 0, 1], dtype=np.uint64)), + + (np.array([0, 1, 0, 1, 0, 1], dtype=np.uint64), + np.array([-1, -1, 0, 0, 1, 1], dtype=np.int64)) + ) + + pyfunc = self._make_ufunc_usecase(comparison_ufunc) + + for a, b in additional_inputs: + input_types = (typeof(a), typeof(b)) + output_type = types.Array(types.bool_, 1, 'C') + argtys = input_types + (output_type,) + cfunc = self._compile(pyfunc, argtys) + + if isinstance(a, np.ndarray): + result = np.zeros(a.shape, dtype=np.bool_) + else: + result = np.zeros(1, dtype=np.bool_) + + expected = np.zeros_like(result) + + pyfunc(a, b, expected) + cfunc(a, b, result) + np.testing.assert_equal(expected, result) + + +class TestUFuncs(BasicUFuncTest, TestCase): + def basic_int_ufunc_test(self, name=None): + skip_inputs = [ + types.float32, + types.float64, + types.Array(types.float32, 1, 'C'), + types.Array(types.float64, 1, 'C'), + ] + self.basic_ufunc_test(name, skip_inputs=skip_inputs) + + ############################################################################ + # Math operations + + def test_add_ufunc(self): + self.basic_ufunc_test(np.add) + + def test_subtract_ufunc(self): + self.basic_ufunc_test(np.subtract) + + def test_multiply_ufunc(self): + self.basic_ufunc_test(np.multiply) + + def test_divide_ufunc(self): + # Bear in mind that in python3 divide IS true_divide + # so the out type for int types will be a double + int_out_type = None + int_out_type = types.float64 + + self.basic_ufunc_test(np.divide, + int_output_type=int_out_type) + + def test_logaddexp_ufunc(self): + self.basic_ufunc_test(np.logaddexp, kinds='f') + + def test_logaddexp2_ufunc(self): + self.basic_ufunc_test(np.logaddexp2, kinds='f') + + def test_true_divide_ufunc(self): + self.basic_ufunc_test(np.true_divide, + int_output_type=types.float64) + + def test_floor_divide_ufunc(self): + self.basic_ufunc_test(np.floor_divide) + + def test_negative_ufunc(self): + # NumPy ufunc has bug with uint32 as input and int64 as output, + # so skip uint32 input. + skip_inputs = [types.Array(types.uint32, 1, 'C'), types.uint32] + self.basic_ufunc_test(np.negative, int_output_type=types.int64, + skip_inputs=skip_inputs) + + def test_positive_ufunc(self): + self.basic_ufunc_test(np.positive) + + def test_power_ufunc(self): + self.basic_ufunc_test(np.power, positive_only=True) + + def test_float_power_ufunc(self): + self.basic_ufunc_test(np.float_power, kinds="fc") + + def test_gcd_ufunc(self): + self.basic_ufunc_test(np.gcd, kinds="iu") + + def test_lcm_ufunc(self): + self.basic_ufunc_test(np.lcm, kinds="iu") + + def test_remainder_ufunc(self): + self.basic_ufunc_test(np.remainder) + + def test_mod_ufunc(self): + additional_inputs = [ + ((np.uint64(np.iinfo(np.uint64).max), np.uint64(16)), types.uint64) + ] + self.basic_ufunc_test(np.mod, kinds='ifcu', + additional_inputs=additional_inputs) + + def test_fmod_ufunc(self): + self.basic_ufunc_test(np.fmod) + + def test_abs_ufunc(self, ufunc=np.abs): + additional_inputs = [ + (np.uint32(np.iinfo(np.uint32).max), types.uint32), + (np.uint64(np.iinfo(np.uint64).max), types.uint64), + (np.float32(np.finfo(np.float32).min), types.float32), + (np.float64(np.finfo(np.float64).min), types.float64), + ] + self.basic_ufunc_test(ufunc, + additional_inputs=additional_inputs) + + def test_absolute_ufunc(self): + self.test_abs_ufunc(ufunc=np.absolute) + + def test_fabs_ufunc(self): + self.basic_ufunc_test(np.fabs, kinds='f') + + def test_rint_ufunc(self): + self.basic_ufunc_test(np.rint, kinds='cf') + + def test_sign_ufunc(self): + self.basic_ufunc_test(np.sign) + + def test_conj_ufunc(self): + self.basic_ufunc_test(np.conj) + + def test_exp_ufunc(self): + self.basic_ufunc_test(np.exp, kinds='cf') + + def test_exp2_ufunc(self): + self.basic_ufunc_test(np.exp2, kinds='cf') + + def test_log_ufunc(self): + self.basic_ufunc_test(np.log, kinds='cf') + + def test_log2_ufunc(self): + self.basic_ufunc_test(np.log2, kinds='cf') + + def test_log10_ufunc(self): + self.basic_ufunc_test(np.log10, kinds='cf') + + def test_expm1_ufunc(self): + self.basic_ufunc_test(np.expm1, kinds='cf') + + def test_log1p_ufunc(self): + self.basic_ufunc_test(np.log1p, kinds='cf') + + def test_sqrt_ufunc(self): + self.basic_ufunc_test(np.sqrt, kinds='cf') + + def test_square_ufunc(self): + self.basic_ufunc_test(np.square) + + def test_cbrt_ufunc(self): + self.basic_ufunc_test(np.cbrt, kinds='f') + + def test_reciprocal_ufunc(self): + # reciprocal for integers doesn't make much sense and is problematic + # in the case of division by zero, as an inf will overflow float to + # int conversions, which is undefined behavior. + to_skip = [types.Array(types.uint32, 1, 'C'), types.uint32, + types.Array(types.int32, 1, 'C'), types.int32, + types.Array(types.uint64, 1, 'C'), types.uint64, + types.Array(types.int64, 1, 'C'), types.int64] + self.basic_ufunc_test(np.reciprocal, skip_inputs=to_skip) + + def test_conjugate_ufunc(self): + self.basic_ufunc_test(np.conjugate) + + ############################################################################ + # Trigonometric Functions + + def test_sin_ufunc(self): + self.basic_ufunc_test(np.sin, kinds='cf') + + def test_cos_ufunc(self): + self.basic_ufunc_test(np.cos, kinds='cf') + + def test_tan_ufunc(self): + self.basic_ufunc_test(np.tan, kinds='cf') + + def test_arcsin_ufunc(self): + self.basic_ufunc_test(np.arcsin, kinds='cf') + + def test_arccos_ufunc(self): + self.basic_ufunc_test(np.arccos, kinds='cf') + + def test_arctan_ufunc(self): + self.basic_ufunc_test(np.arctan, kinds='cf') + + def test_arctan2_ufunc(self): + self.basic_ufunc_test(np.arctan2, kinds='cf') + + def test_hypot_ufunc(self): + self.basic_ufunc_test(np.hypot, kinds='f') + + def test_sinh_ufunc(self): + self.basic_ufunc_test(np.sinh, kinds='cf') + + def test_cosh_ufunc(self): + self.basic_ufunc_test(np.cosh, kinds='cf') + + def test_tanh_ufunc(self): + self.basic_ufunc_test(np.tanh, kinds='cf') + + def test_arcsinh_ufunc(self): + self.basic_ufunc_test(np.arcsinh, kinds='cf') + + def test_arccosh_ufunc(self): + self.basic_ufunc_test(np.arccosh, kinds='cf') + + def test_arctanh_ufunc(self): + # arctanh is only valid is only finite in the range ]-1, 1[ + # This means that for any of the integer types it will produce + # conversion from infinity/-infinity to integer. That's undefined + # behavior in C, so the results may vary from implementation to + # implementation. This means that the result from the compiler + # used to compile NumPy may differ from the result generated by + # llvm. Skipping the integer types in this test avoids failed + # tests because of this. + to_skip = [types.Array(types.uint32, 1, 'C'), types.uint32, + types.Array(types.int32, 1, 'C'), types.int32, + types.Array(types.uint64, 1, 'C'), types.uint64, + types.Array(types.int64, 1, 'C'), types.int64] + + self.basic_ufunc_test(np.arctanh, skip_inputs=to_skip, kinds='cf') + + def test_deg2rad_ufunc(self): + self.basic_ufunc_test(np.deg2rad, kinds='f') + + def test_rad2deg_ufunc(self): + self.basic_ufunc_test(np.rad2deg, kinds='f') + + def test_degrees_ufunc(self): + self.basic_ufunc_test(np.degrees, kinds='f') + + def test_radians_ufunc(self): + self.basic_ufunc_test(np.radians, kinds='f') + + ############################################################################ + # Bit-twiddling Functions + + def test_bitwise_and_ufunc(self): + self.basic_int_ufunc_test(np.bitwise_and) + + def test_bitwise_or_ufunc(self): + self.basic_int_ufunc_test(np.bitwise_or) + + def test_bitwise_xor_ufunc(self): + self.basic_int_ufunc_test(np.bitwise_xor) + + def test_invert_ufunc(self): + self.basic_int_ufunc_test(np.invert) + + def test_bitwise_not_ufunc(self): + self.basic_int_ufunc_test(np.bitwise_not) + + # Note: there is no entry for left_shift and right_shift as this harness + # is not valid for them. This is so because left_shift and right + # shift implementation in NumPy has undefined behavior (in C-parlance) + # when the second argument is a negative (or bigger than the number + # of bits) value. + # Also, right_shift for negative first arguments also relies on + # implementation defined behavior, although numba warantees "sane" + # behavior (arithmetic shifts on signed integers, logic shifts on + # unsigned integers). + + ############################################################################ + # Comparison functions + def test_greater_ufunc(self): + self.signed_unsigned_cmp_test(np.greater) + + def test_greater_equal_ufunc(self): + self.signed_unsigned_cmp_test(np.greater_equal) + + def test_less_ufunc(self): + self.signed_unsigned_cmp_test(np.less) + + def test_less_equal_ufunc(self): + self.signed_unsigned_cmp_test(np.less_equal) + + def test_not_equal_ufunc(self): + self.signed_unsigned_cmp_test(np.not_equal) + + def test_equal_ufunc(self): + self.signed_unsigned_cmp_test(np.equal) + + def test_logical_and_ufunc(self): + self.basic_ufunc_test(np.logical_and) + + def test_logical_or_ufunc(self): + self.basic_ufunc_test(np.logical_or) + + def test_logical_xor_ufunc(self): + self.basic_ufunc_test(np.logical_xor) + + def test_logical_not_ufunc(self): + self.basic_ufunc_test(np.logical_not) + + def test_maximum_ufunc(self): + self.basic_ufunc_test(np.maximum) + + def test_minimum_ufunc(self): + self.basic_ufunc_test(np.minimum) + + def test_fmax_ufunc(self): + self.basic_ufunc_test(np.fmax) + + def test_fmin_ufunc(self): + self.basic_ufunc_test(np.fmin) + + ############################################################################ + # Floating functions + + def bool_additional_inputs(self): + return [ + (np.array([True, False], dtype=np.bool_), + types.Array(types.bool_, 1, 'C')), + ] + + def test_isfinite_ufunc(self): + self.basic_ufunc_test( + np.isfinite, kinds='ifcb', + additional_inputs=self.bool_additional_inputs(), + ) + + def test_isinf_ufunc(self): + self.basic_ufunc_test( + np.isinf, kinds='ifcb', + additional_inputs=self.bool_additional_inputs(), + ) + + def test_isnan_ufunc(self): + self.basic_ufunc_test( + np.isnan, kinds='ifcb', + additional_inputs=self.bool_additional_inputs(), + ) + + def test_signbit_ufunc(self): + self.basic_ufunc_test(np.signbit) + + def test_copysign_ufunc(self): + self.basic_ufunc_test(np.copysign, kinds='f') + + def test_nextafter_ufunc(self): + self.basic_ufunc_test(np.nextafter, kinds='f') + + @_unimplemented + def test_modf_ufunc(self): + self.basic_ufunc_test(np.modf, kinds='f') + + # Note: there is no entry for ldexp as this harness isn't valid for this + # ufunc. this is so because ldexp requires heterogeneous inputs. + # However, this ufunc is tested by the TestLoopTypes test classes. + + @_unimplemented + def test_frexp_ufunc(self): + self.basic_ufunc_test(np.frexp, kinds='f') + + def test_floor_ufunc(self): + self.basic_ufunc_test(np.floor, kinds='f') + + def test_ceil_ufunc(self): + self.basic_ufunc_test(np.ceil, kinds='f') + + def test_trunc_ufunc(self): + self.basic_ufunc_test(np.trunc, kinds='f') + + def test_spacing_ufunc(self): + # additional input to check inf behaviour as Numba uses a different alg + # to NumPy + additional = [(np.array([np.inf, -np.inf], dtype=np.float64), + types.Array(types.float64, 1, 'C')),] + self.basic_ufunc_test(np.spacing, kinds='f', + additional_inputs=additional) + + ############################################################################ + # Other tests + + def binary_ufunc_mixed_types_test(self, ufunc): + ufunc_name = ufunc.__name__ + ufunc = _make_ufunc_usecase(ufunc) + inputs1 = [ + (1, types.uint64), + (-1, types.int64), + (0.5, types.float64), + + (np.array([0, 1], dtype='u8'), types.Array(types.uint64, 1, 'C')), + (np.array([-1, 1], dtype='i8'), types.Array(types.int64, 1, 'C')), + (np.array([-0.5, 0.5], dtype='f8'), + types.Array(types.float64, 1, 'C'))] + + inputs2 = inputs1 + + output_types = [types.Array(types.int64, 1, 'C'), + types.Array(types.float64, 1, 'C')] + + pyfunc = ufunc + + for vals in itertools.product(inputs1, inputs2, output_types): + input1, input2, output_type = vals + + input1_operand = input1[0] + input1_type = input1[1] + + input2_operand = input2[0] + input2_type = input2[1] + + # Skip division by unsigned int because of NumPy bugs + if ufunc_name == 'divide' and ( + input2_type == types.Array(types.uint32, 1, 'C') or + input2_type == types.Array(types.uint64, 1, 'C')): + continue + + # Skip some subtraction tests because of NumPy bugs + if (ufunc_name == 'subtract' + and input1_type == types.Array(types.uint32, 1, 'C') + and input2_type == types.uint32 + and types.Array(types.int64, 1, 'C')): + continue + if (ufunc_name == 'subtract' + and input1_type == types.Array(types.uint32, 1, 'C') + and input2_type == types.uint64 + and types.Array(types.int64, 1, 'C')): + continue + + if ((isinstance(input1_type, types.Array) or + isinstance(input2_type, types.Array)) and + not isinstance(output_type, types.Array)): + continue + + args = (input1_type, input2_type, output_type) + cfunc = self._compile(pyfunc, args) + + if isinstance(input1_operand, np.ndarray): + result = np.zeros(input1_operand.size, + dtype=output_type.dtype.name) + expected = np.zeros(input1_operand.size, + dtype=output_type.dtype.name) + elif isinstance(input2_operand, np.ndarray): + result = np.zeros(input2_operand.size, + dtype=output_type.dtype.name) + expected = np.zeros(input2_operand.size, + dtype=output_type.dtype.name) + else: + result = np.zeros(1, dtype=output_type.dtype.name) + expected = np.zeros(1, dtype=output_type.dtype.name) + + cfunc(input1_operand, input2_operand, result) + pyfunc(input1_operand, input2_operand, expected) + + scalar_type = getattr(output_type, 'dtype', output_type) + prec = ('single' + if scalar_type in (types.float32, types.complex64) + else 'double') + self.assertPreciseEqual(expected, result, prec=prec) + + def test_broadcasting(self): + + # Test unary ufunc + pyfunc = _make_ufunc_usecase(np.negative) + + input_operands = [ + np.arange(3, dtype='u8'), + np.arange(3, dtype='u8').reshape(3,1), + np.arange(3, dtype='u8').reshape(1,3), + np.arange(3, dtype='u8').reshape(3,1), + np.arange(3, dtype='u8').reshape(1,3), + np.arange(3 * 3, dtype='u8').reshape(3,3)] + + output_operands = [ + np.zeros(3 * 3, dtype='i8').reshape(3,3), + np.zeros(3 * 3, dtype='i8').reshape(3,3), + np.zeros(3 * 3, dtype='i8').reshape(3,3), + np.zeros(3 * 3 * 3, dtype='i8').reshape(3,3,3), + np.zeros(3 * 3 * 3, dtype='i8').reshape(3,3,3), + np.zeros(3 * 3 * 3, dtype='i8').reshape(3,3,3)] + + for x, result in zip(input_operands, output_operands): + + input_type = types.Array(types.uint64, x.ndim, 'C') + output_type = types.Array(types.int64, result.ndim, 'C') + args = (input_type, output_type) + + cfunc = self._compile(pyfunc, args) + + expected = np.zeros(result.shape, dtype=result.dtype) + np.negative(x, expected) + + cfunc(x, result) + + self.assertPreciseEqual(result, expected) + + # Test binary ufunc + pyfunc = _make_ufunc_usecase(np.add) + + input1_operands = [ + np.arange(3, dtype='u8'), + np.arange(3 * 3, dtype='u8').reshape(3,3), + np.arange(3 * 3 * 3, dtype='u8').reshape(3,3,3), + np.arange(3, dtype='u8').reshape(3,1), + np.arange(3, dtype='u8').reshape(1,3), + np.arange(3, dtype='u8').reshape(3,1,1), + np.arange(3 * 3, dtype='u8').reshape(3,3,1), + np.arange(3 * 3, dtype='u8').reshape(3,1,3), + np.arange(3 * 3, dtype='u8').reshape(1,3,3)] + + input2_operands = input1_operands + + for x, y in itertools.product(input1_operands, input2_operands): + + input1_type = types.Array(types.uint64, x.ndim, 'C') + input2_type = types.Array(types.uint64, y.ndim, 'C') + output_type = types.Array(types.uint64, max(x.ndim, y.ndim), 'C') + args = (input1_type, input2_type, output_type) + + cfunc = self._compile(pyfunc, args) + + expected = np.add(x, y) + result = np.zeros(expected.shape, dtype='u8') + + cfunc(x, y, result) + self.assertPreciseEqual(result, expected) + + def test_implicit_output_npm(self): + # Test for Issue #1078 (https://github.com/numba/numba/issues/1078) - + # ensures that the output of a ufunc is an array. + arr_ty = types.Array(types.uint64, 1, 'C') + sig = (arr_ty, arr_ty) + + @njit((arr_ty, arr_ty)) + def myadd(a0, a1): + return np.add(a0, a1) + + self.assertEqual(myadd.overloads[sig].signature.return_type, arr_ty) + + def test_broadcast_implicit_output_npm_nrt(self): + def pyfunc(a0, a1): + return np.add(a0, a1) + + input1_operands = [ + np.arange(3, dtype='u8'), + np.arange(3 * 3, dtype='u8').reshape(3,3), + np.arange(3 * 3 * 3, dtype='u8').reshape(3,3,3), + np.arange(3, dtype='u8').reshape(3,1), + np.arange(3, dtype='u8').reshape(1,3), + np.arange(3, dtype='u8').reshape(3,1,1), + np.arange(3 * 3, dtype='u8').reshape(3,3,1), + np.arange(3 * 3, dtype='u8').reshape(3,1,3), + np.arange(3 * 3, dtype='u8').reshape(1,3,3)] + + input2_operands = input1_operands + + for x, y in itertools.product(input1_operands, input2_operands): + + input1_type = types.Array(types.uint64, x.ndim, 'C') + input2_type = types.Array(types.uint64, y.ndim, 'C') + args = (input1_type, input2_type) + + cfunc = self._compile(pyfunc, args, nrt=True) + + expected = np.add(x, y) + result = cfunc(x, y) + np.testing.assert_array_equal(expected, result) + + def test_implicit_output_layout_binary(self): + def pyfunc(a0, a1): + return np.add(a0, a1) + + # C layout + X = np.linspace(0, 1, 20).reshape(4, 5) + # F layout + Y = np.array(X, order='F') + # A layout + Z = X.reshape(5, 4).T[0] + + Xty = typeof(X) + assert X.flags.c_contiguous and Xty.layout == 'C' + Yty = typeof(Y) + assert Y.flags.f_contiguous and Yty.layout == 'F' + Zty = typeof(Z) + assert Zty.layout == 'A' + assert not Z.flags.c_contiguous + assert not Z.flags.f_contiguous + + testcases = list(itertools.permutations([X, Y, Z], 2)) + testcases += [(X, X)] + testcases += [(Y, Y)] + testcases += [(Z, Z)] + + for arg0, arg1 in testcases: + args = (typeof(arg0), typeof(arg1)) + cfunc = self._compile(pyfunc, args, nrt=True) + expected = pyfunc(arg0, arg1) + result = cfunc(arg0, arg1) + + self.assertEqual(expected.flags.c_contiguous, + result.flags.c_contiguous) + self.assertEqual(expected.flags.f_contiguous, + result.flags.f_contiguous) + np.testing.assert_array_equal(expected, result) + + def test_implicit_output_layout_unary(self): + def pyfunc(a0): + return np.sqrt(a0) + + # C layout + X = np.linspace(0, 1, 20).reshape(4, 5) + # F layout + Y = np.array(X, order='F') + # A layout + Z = X.reshape(5, 4).T[0] + + Xty = typeof(X) + assert X.flags.c_contiguous and Xty.layout == 'C' + Yty = typeof(Y) + assert Y.flags.f_contiguous and Yty.layout == 'F' + Zty = typeof(Z) + assert Zty.layout == 'A' + assert not Z.flags.c_contiguous + assert not Z.flags.f_contiguous + + for arg0 in [X, Y, Z]: + args = (typeof(arg0),) + cfunc = self._compile(pyfunc, args, nrt=True) + expected = pyfunc(arg0) + result = cfunc(arg0) + + self.assertEqual(expected.flags.c_contiguous, + result.flags.c_contiguous) + self.assertEqual(expected.flags.f_contiguous, + result.flags.f_contiguous) + np.testing.assert_array_equal(expected, result) + + +class TestArrayOperators(BaseUFuncTest, TestCase): + + def _check_results(self, expected, got): + self.assertEqual(expected.dtype.kind, got.dtype.kind) + np.testing.assert_array_almost_equal(expected, got) + + def unary_op_test(self, operator, nrt=True, + skip_inputs=None, additional_inputs=None, + int_output_type=None, float_output_type=None): + if skip_inputs is None: + skip_inputs = [] + if additional_inputs is None: + additional_inputs = [] + operator_func = _make_unary_ufunc_op_usecase(operator) + inputs = list(self.inputs) + inputs.extend(additional_inputs) + pyfunc = operator_func + for input_tuple in inputs: + input_operand, input_type = input_tuple + + if ((input_type in skip_inputs) or + (not isinstance(input_type, types.Array))): + continue + + cfunc = self._compile(pyfunc, (input_type,), nrt=nrt) + expected = pyfunc(input_operand) + got = cfunc(input_operand) + self._check_results(expected, got) + + def binary_op_test(self, operator, nrt=True, + skip_inputs=None, additional_inputs=None, + int_output_type=None, float_output_type=None, + positive_rhs=False): + if skip_inputs is None: + skip_inputs = [] + if additional_inputs is None: + additional_inputs = [] + operator_func = _make_binary_ufunc_op_usecase(operator) + inputs = list(self.inputs) + inputs.extend(additional_inputs) + pyfunc = operator_func + # when generating arbitrary sequences, we use a fixed seed + # for deterministic testing + random_state = np.random.RandomState(1) + for input_tuple in inputs: + input_operand1, input_type = input_tuple + input_dtype = numpy_support.as_dtype( + getattr(input_type, "dtype", input_type)) + input_type1 = input_type + + if input_type in skip_inputs: + continue + + if positive_rhs: + zero = np.zeros(1, dtype=input_dtype)[0] + # If we only use two scalars, the code generator will not + # select the ufunctionalized operator, so we mix it up. + if isinstance(input_type, types.Array): + input_operand0 = input_operand1 + input_type0 = input_type + if positive_rhs and np.any(input_operand1 < zero): + continue + else: + input_operand0 = (random_state.uniform(0, 100, 10)).astype( + input_dtype) + input_type0 = typeof(input_operand0) + if positive_rhs and input_operand1 < zero: + continue + + args = (input_type0, input_type1) + cfunc = self._compile(pyfunc, args, nrt=nrt) + expected = pyfunc(input_operand0, input_operand1) + got = cfunc(input_operand0, input_operand1) + self._check_results(expected, got) + + def bitwise_additional_inputs(self): + # For bitwise operators, we want to check the results for boolean + # arrays (see #1813). + return [ + (True, types.boolean), + (False, types.boolean), + (np.array([True, False]), types.Array(types.boolean, 1, 'C')), + ] + + def binary_int_op_test(self, *args, **kws): + skip_inputs = kws.setdefault('skip_inputs', []) + skip_inputs += [ + types.float32, types.float64, + types.Array(types.float32, 1, 'C'), + types.Array(types.float64, 1, 'C'), + ] + return self.binary_op_test(*args, **kws) + + def binary_bitwise_op_test(self, *args, **kws): + additional_inputs = kws.setdefault('additional_inputs', []) + additional_inputs += self.bitwise_additional_inputs() + return self.binary_int_op_test(*args, **kws) + + def inplace_op_test(self, operator, lhs_values, rhs_values, + lhs_dtypes, rhs_dtypes, precise=True): + operator_func = _make_inplace_ufunc_op_usecase(operator) + pyfunc = operator_func + + if precise: + assertion = self.assertPreciseEqual + else: + assertion = np.testing.assert_allclose + + # The left operand can only be an array, while the right operand + # can be either an array or a scalar + lhs_inputs = [np.array(lhs_values, dtype=dtype) + for dtype in lhs_dtypes] + + rhs_arrays = [np.array(rhs_values, dtype=dtype) + for dtype in rhs_dtypes] + rhs_scalars = [dtype(v) for v in rhs_values for dtype in rhs_dtypes] + rhs_inputs = rhs_arrays + rhs_scalars + + for lhs, rhs in itertools.product(lhs_inputs, rhs_inputs): + lhs_type = typeof(lhs) + rhs_type = typeof(rhs) + args = (lhs_type, rhs_type) + cfunc = self._compile(pyfunc, args) + expected = lhs.copy() + pyfunc(expected, rhs) + got = lhs.copy() + cfunc(got, rhs) + assertion(got, expected) + + def inplace_float_op_test(self, operator, lhs_values, rhs_values, + precise=True): + # Also accept integer inputs for the right operand (they should + # be converted to float). + return self.inplace_op_test(operator, lhs_values, rhs_values, + (np.float32, np.float64), + (np.float32, np.float64, np.int64), + precise=precise) + + def inplace_int_op_test(self, operator, lhs_values, rhs_values): + self.inplace_op_test(operator, lhs_values, rhs_values, + (np.int16, np.int32, np.int64), + (np.int16, np.uint32)) + + def inplace_bitwise_op_test(self, operator, lhs_values, rhs_values): + self.inplace_int_op_test(operator, lhs_values, rhs_values) + self.inplace_op_test(operator, lhs_values, rhs_values, + (np.bool_,), (np.bool_, np.bool_)) + + # ____________________________________________________________ + # Unary operators + + def test_unary_positive_array_op(self): + self.unary_op_test('+') + + def test_unary_negative_array_op(self): + self.unary_op_test('-') + + def test_unary_invert_array_op(self): + self.unary_op_test('~', + skip_inputs=[types.float32, types.float64, + types.Array(types.float32, 1, 'C'), + types.Array(types.float64, 1, 'C')], + additional_inputs=self.bitwise_additional_inputs()) + + # ____________________________________________________________ + # Inplace operators + + def test_inplace_add(self): + self.inplace_float_op_test('+=', [-1, 1.5, 3], [-5, 0, 2.5]) + self.inplace_float_op_test(operator.iadd, [-1, 1.5, 3], [-5, 0, 2.5]) + + def test_inplace_sub(self): + self.inplace_float_op_test('-=', [-1, 1.5, 3], [-5, 0, 2.5]) + self.inplace_float_op_test(operator.isub, [-1, 1.5, 3], [-5, 0, 2.5]) + + def test_inplace_mul(self): + self.inplace_float_op_test('*=', [-1, 1.5, 3], [-5, 0, 2.5]) + self.inplace_float_op_test(operator.imul, [-1, 1.5, 3], [-5, 0, 2.5]) + + def test_inplace_floordiv(self): + self.inplace_float_op_test('//=', [-1, 1.5, 3], [-5, 1.25, 2.5]) + self.inplace_float_op_test(operator.ifloordiv, [-1, 1.5, 3], + [-5, 1.25, 2.5]) + + def test_inplace_div(self): + self.inplace_float_op_test('/=', [-1, 1.5, 3], [-5, 0, 2.5]) + self.inplace_float_op_test(operator.itruediv, [-1, 1.5, 3], + [-5, 1.25, 2.5]) + + def test_inplace_remainder(self): + self.inplace_float_op_test('%=', [-1, 1.5, 3], [-5, 2, 2.5]) + self.inplace_float_op_test(operator.imod, [-1, 1.5, 3], [-5, 2, 2.5]) + + def test_inplace_pow(self): + self.inplace_float_op_test('**=', [-1, 1.5, 3], [-5, 2, 2.5], + precise=False) + self.inplace_float_op_test(operator.ipow, [-1, 1.5, 3], [-5, 2, 2.5], + precise=False) + + def test_inplace_and(self): + self.inplace_bitwise_op_test('&=', [0, 1, 2, 3, 51], + [0, 13, 16, 42, 255]) + self.inplace_bitwise_op_test(operator.iand, [0, 1, 2, 3, 51], + [0, 13, 16, 42, 255]) + + def test_inplace_or(self): + self.inplace_bitwise_op_test('|=', [0, 1, 2, 3, 51], + [0, 13, 16, 42, 255]) + self.inplace_bitwise_op_test(operator.ior, [0, 1, 2, 3, 51], + [0, 13, 16, 42, 255]) + + def test_inplace_xor(self): + self.inplace_bitwise_op_test('^=', [0, 1, 2, 3, 51], + [0, 13, 16, 42, 255]) + self.inplace_bitwise_op_test(operator.ixor, [0, 1, 2, 3, 51], + [0, 13, 16, 42, 255]) + + def test_inplace_lshift(self): + self.inplace_int_op_test('<<=', [0, 5, -10, -51], [0, 1, 4, 14]) + self.inplace_int_op_test(operator.ilshift, [0, 5, -10, -51], + [0, 1, 4, 14]) + + def test_inplace_rshift(self): + self.inplace_int_op_test('>>=', [0, 5, -10, -51], [0, 1, 4, 14]) + self.inplace_int_op_test(operator.irshift, [0, 5, -10, -51], + [0, 1, 4, 14]) + + def test_unary_positive_array_op_2(self): + ''' + Verify that the unary positive operator copies values, and doesn't + just alias to the input array (mirrors normal Numpy/Python + interaction behavior). + ''' + # Test originally from @gmarkall + def f(a1): + a2 = +a1 + a1[0] = 3 + a2[1] = 4 + return a2 + + a1 = np.zeros(10) + a2 = f(a1) + self.assertTrue(a1[0] != a2[0] and a1[1] != a2[1]) + a3 = np.zeros(10) + a4 = njit(f)(a3) + self.assertTrue(a3[0] != a4[0] and a3[1] != a4[1]) + np.testing.assert_array_equal(a1, a3) + np.testing.assert_array_equal(a2, a4) + + # ____________________________________________________________ + # Binary operators + + def test_add_array_op(self): + self.binary_op_test('+') + + def test_subtract_array_op(self): + self.binary_op_test('-') + + def test_multiply_array_op(self): + self.binary_op_test('*') + + def test_divide_array_op(self): + int_out_type = None + int_out_type = types.float64 + self.binary_op_test('/', int_output_type=int_out_type) + + def test_floor_divide_array_op(self): + # Avoid floating-point zeros as x // 0.0 can have varying results + # depending on the algorithm (which changed across Numpy versions) + self.inputs = [ + (np.uint32(1), types.uint32), + (np.int32(-2), types.int32), + (np.int32(0), types.int32), + (np.uint64(4), types.uint64), + (np.int64(-5), types.int64), + (np.int64(0), types.int64), + + (np.float32(-0.5), types.float32), + (np.float32(1.5), types.float32), + + (np.float64(-2.5), types.float64), + (np.float64(3.5), types.float64), + + (np.array([1,2], dtype='u4'), types.Array(types.uint32, 1, 'C')), + (np.array([3,4], dtype='u8'), types.Array(types.uint64, 1, 'C')), + (np.array([-1,1,5], dtype='i4'), types.Array(types.int32, 1, 'C')), + (np.array([-1,1,6], dtype='i8'), types.Array(types.int64, 1, 'C')), + (np.array([-0.5, 1.5], dtype='f4'), + types.Array(types.float32, 1, 'C')), + (np.array([-2.5, 3.5], dtype='f8'), + types.Array(types.float64, 1, 'C')), + ] + self.binary_op_test('//') + + def test_remainder_array_op(self): + self.binary_op_test('%') + + def test_power_array_op(self): + self.binary_op_test('**', positive_rhs=True) + + def test_left_shift_array_op(self): + self.binary_int_op_test('<<', positive_rhs=True) + + def test_right_shift_array_op(self): + self.binary_int_op_test('>>', positive_rhs=True) + + def test_bitwise_and_array_op(self): + self.binary_bitwise_op_test('&') + + def test_bitwise_or_array_op(self): + self.binary_bitwise_op_test('|') + + def test_bitwise_xor_array_op(self): + self.binary_bitwise_op_test('^') + + def test_equal_array_op(self): + self.binary_op_test('==') + + def test_greater_array_op(self): + self.binary_op_test('>') + + def test_greater_equal_array_op(self): + self.binary_op_test('>=') + + def test_less_array_op(self): + self.binary_op_test('<') + + def test_less_equal_array_op(self): + self.binary_op_test('<=') + + def test_not_equal_array_op(self): + self.binary_op_test('!=') + + +class TestScalarUFuncs(TestCase): + """check the machinery of ufuncs works when the result is an scalar. + These are not exhaustive because: + - the machinery to support this case is the same for all the functions of a + given arity. + - the result of the inner function itself is already tested in TestUFuncs + """ + + def run_ufunc(self, pyfunc, arg_types, arg_values): + for tyargs, args in zip(arg_types, arg_values): + cfunc = njit(tyargs)(pyfunc) + got = cfunc(*args) + expected = pyfunc(*_as_dtype_value(tyargs, args)) + + msg = 'for args {0} typed {1}'.format(args, tyargs) + + # note: due to semantics of ufuncs, thing like adding a int32 to a + # uint64 results in doubles (as neither int32 can be cast safely + # to uint64 nor vice-versa, falling back to using the float version. + # Modify in those cases the expected value (the numpy version does + # not use typed integers as inputs so its result is an integer) + special = set([ + (types.int32, types.uint64), + (types.uint64, types.int32), + (types.int64, types.uint64), + (types.uint64, types.int64) + ]) + if tyargs in special: + expected = float(expected) + else: + # The numba version of scalar ufuncs return an actual value that + # gets converted to a Python type, instead of using NumPy + # scalars. although in python 2 NumPy scalars are considered + # and instance of the appropriate python type, in python 3 that + # is no longer the case. This is why the expected result is + # casted to the appropriate Python type (which is actually the + # expected behavior of the ufunc translation) + if np.issubdtype(expected.dtype, np.inexact): + expected = float(expected) + elif np.issubdtype(expected.dtype, np.integer): + expected = int(expected) + elif np.issubdtype(expected.dtype, np.bool_): + expected = bool(expected) + + alltypes = tyargs + (cfunc.overloads[tyargs].signature.return_type,) + + # select the appropriate precision for comparison: note that an + # argument typed at a lower precision can introduce precision + # problems. For this reason the argument types must be taken into + # account. + if any([t == types.float32 for t in alltypes]): + prec = 'single' + elif any([t == types.float64 for t in alltypes]): + prec = 'double' + else: + prec = 'exact' + + self.assertPreciseEqual(got, expected, msg=msg, prec=prec) + + def test_scalar_unary_ufunc(self): + def _func(x): + return np.sqrt(x) + + vals = [(2,), (2,), (1,), (2,), (.1,), (.2,)] + tys = [(types.int32,), (types.uint32,), + (types.int64,), (types.uint64,), + (types.float32,), (types.float64,)] + self.run_ufunc(_func, tys, vals) + + def test_scalar_binary_uniform_ufunc(self): + def _func(x,y): + return np.add(x,y) + + vals = [2, 2, 1, 2, .1, .2] + tys = [types.int32, types.uint32, + types.int64, types.uint64, types.float32, types.float64] + self.run_ufunc(_func, zip(tys, tys), zip(vals, vals)) + + def test_scalar_binary_mixed_ufunc(self): + def _func(x,y): + return np.add(x,y) + + vals = [2, 2, 1, 2, .1, .2] + tys = [types.int32, types.uint32, + types.int64, types.uint64, + types.float32, types.float64] + self.run_ufunc(_func, itertools.product(tys, tys), + itertools.product(vals, vals)) + + +class TestUfuncIssues(TestCase): + + def test_issue_651(self): + # Exercise the code path to make sure this does not fail + @vectorize(["(float64,float64)"]) + def foo(x1, x2): + return np.add(x1, x2) + np.add(x1, x2) + + a = np.arange(10, dtype='f8') + b = np.arange(10, dtype='f8') + self.assertPreciseEqual(foo(a, b), (a + b) + (a + b)) + + def test_issue_2006(self): + """ + should return float32, not float64. + """ + def foo(x, y): + return np.power(x, y) + pyfunc = foo + cfunc = njit(pyfunc) + + def check(x, y): + got = cfunc(x, y) + np.testing.assert_array_almost_equal(got, pyfunc(x, y)) + # Check the power operation conserved the input's dtype + # (this is different from Numpy, whose behaviour depends on + # the *values* of the arguments -- see PyArray_CanCastArrayTo). + self.assertEqual(got.dtype, x.dtype) + + xs = [np.float32([1, 2, 3]), np.complex64([1j, 2, 3 - 3j])] + for x in xs: + check(x, 3) + check(x, np.uint64(3)) + check(x, np.int64([2, 2, 3])) + + +class _LoopTypesTester(TestCase): + """Test code generation for the different loop types defined by ufunc. + + This test relies on class variables to configure the test. Subclasses + of this class can just override some of these variables to check other + ufuncs in a different compilation context. The variables supported are: + + _funcs: the ufuncs to test + _skip_types: letter types that force skipping the loop when testing + if present in the NumPy ufunc signature. + _supported_types: only test loops where all the types in the loop + signature are in this collection. If unset, all. + + Note that both, _skip_types and _supported_types must be met for a loop + to be tested. + + The NumPy ufunc signature has a form like 'ff->f' (for a binary ufunc + loop taking 2 floats and resulting in a float). In a NumPy ufunc object + you can get a list of supported signatures by accessing the attribute + 'types'. + """ + _skip_types = 'OegG' + + # Allowed deviation between Numpy and Numba results + _ulps = {('arccos', 'F'): 2, + ('arcsin', 'D'): 4, + ('arcsin', 'F'): 4, + ('log10', 'D'): 5, + ('tanh', 'F'): 2, + ('cbrt', 'd'): 2, + ('logaddexp2', 'd'): 2, + } + + def _arg_for_type(self, a_letter_type, index=0): + """return a suitable array argument for testing the letter type""" + # Note all possible arrays must have the same size, since they + # may be used as inputs to the same func. + if a_letter_type in 'bhilq': + # an integral + return np.array([1, 4, 0, -2], dtype=a_letter_type) + if a_letter_type in 'BHILQ': + return np.array([1, 2, 4, 0], dtype=a_letter_type) + elif a_letter_type in '?': + # a boolean + return np.array([True, False, False, True], dtype=a_letter_type) + elif a_letter_type[0] == 'm': + # timedelta64 + if len(a_letter_type) == 1: + a_letter_type = 'm8[D]' + return np.array([2, -3, 'NaT', 0], dtype=a_letter_type) + elif a_letter_type[0] == 'M': + # datetime64 + if len(a_letter_type) == 1: + a_letter_type = 'M8[D]' + return np.array(['Nat', 1, 25, 0], dtype=a_letter_type) + elif a_letter_type in 'fd': + # floating point + return np.array([1.5, -3.5, 0.0, float('nan')], + dtype=a_letter_type) + elif a_letter_type in 'FD': + # complex + if sys.platform != 'win32': + # Other platforms have better handling of negative zeros, + # test them + negzero = -(0.0 + 1.0j) + else: + negzero = 0.0 - 1.0j + return np.array([negzero, 1.5 + 1.5j, 1j * float('nan'), 0j], + dtype=a_letter_type) + else: + raise RuntimeError("type %r not understood" % (a_letter_type,)) + + def _check_loop(self, fn, ufunc, loop): + # the letter types for the args + letter_types = loop[:ufunc.nin] + loop[-ufunc.nout:] + + # ignore the loops containing an object argument. They will always + # fail in no python mode. Usually the last loop in ufuncs is an all + # object fallback + supported_types = getattr(self, '_supported_types', []) + if (supported_types and + any(l not in supported_types for l in letter_types)): + return + skip_types = getattr(self, '_skip_types', []) + if any(l in skip_types for l in letter_types): + return + # if the test case requires some types to be present, skip loops + # not involving any of those types. + required_types = getattr(self, '_required_types', []) + if required_types and not any(l in letter_types + for l in required_types): + return + + self._check_ufunc_with_dtypes(fn, ufunc, letter_types) + + def _check_ufunc_with_dtypes(self, fn, ufunc, dtypes): + # Arrays created with datetime and timedelta types (e.g. with np.array) + # will have units, so in order to ensure that the dtypes of arguments + # match the dtypes in the signature, we add units to unitless datetime + # and timedelta types. This corresponds with the addition of units in + # _arg_for_type() above. + dtypes_with_units = [] + for t in dtypes: + if t in ('m', 'M'): + t = t + '8[D]' + dtypes_with_units.append(t) + + arg_dty = [np.dtype(t) for t in dtypes_with_units] + arg_nbty = tuple([types.Array(from_dtype(t), 1, 'C') for t in arg_dty]) + cfunc = njit(arg_nbty)(fn) + + # Ensure a good mix of input values + c_args = [self._arg_for_type(t, index=index).repeat(2) + for index, t in enumerate(dtypes)] + for arr in c_args: + self.random.shuffle(arr) + py_args = [a.copy() for a in c_args] + + cfunc(*c_args) + fn(*py_args) + + # Check each array (including inputs, to ensure they weren't + # mutated). + for dtype, py_arg, c_arg in zip(arg_dty, py_args, c_args): + py_arg, c_arg = self._fixup_results(dtype, py_arg, c_arg) + typechar = c_arg.dtype.char + ulps = self._ulps.get((ufunc.__name__, typechar), 1) + prec = 'single' if typechar in 'fF' else 'exact' + prec = 'double' if typechar in 'dD' else prec + msg = '\n'.join(["ufunc '{0}' arrays differ ({1}):", + "args: {2}", "expected {3}", "got {4}"]) + msg = msg.format(ufunc.__name__, c_args, prec, py_arg, c_arg) + self.assertPreciseEqual(py_arg, c_arg, prec=prec, msg=msg, + ulps=ulps) + + def _fixup_results(self, dtype, py_arg, c_arg): + return py_arg, c_arg + + @classmethod + def _check_ufunc_loops(cls, ufunc): + for loop in ufunc.types: + cls._inject_test(ufunc, loop) + + @classmethod + def _inject_test(cls, ufunc, loop): + def test_template(self): + fn = _make_ufunc_usecase(ufunc) + self._check_loop(fn, ufunc, loop) + setattr(cls, "test_{0}_{1}".format(ufunc.__name__, + loop.replace('->', '_')), + test_template) + + @classmethod + def autogenerate(cls): + for ufunc in cls._ufuncs: + cls._check_ufunc_loops(ufunc) + + +class TestLoopTypesInt(_LoopTypesTester): + _ufuncs = supported_ufuncs[:] + # reciprocal and power need a special test due to issue #757 + _ufuncs.remove(np.power) + _ufuncs.remove(np.reciprocal) + _ufuncs.remove(np.left_shift) # has its own test class + _ufuncs.remove(np.right_shift) # has its own test class + # special test for bool subtract/negative + _ufuncs.remove(np.subtract) + _ufuncs.remove(np.negative) + _required_types = '?bBhHiIlLqQ' + _skip_types = 'fdFDmMO' + _LoopTypesTester._skip_types + + +TestLoopTypesInt.autogenerate() + + +class TestLoopTypesSubtractAndNegative(_LoopTypesTester): + _ufuncs = [np.subtract, np.negative] + _required_types = '?bBhHiIlLqQfdFD' + _skip_types = 'mMO' + _LoopTypesTester._skip_types + '?' + + +TestLoopTypesSubtractAndNegative.autogenerate() + + +class TestLoopTypesReciprocal(_LoopTypesTester): + _ufuncs = [np.reciprocal] # issue #757 + _required_types = 'bBhHiIlLqQfdFD' + _skip_types = 'mMO' + _LoopTypesTester._skip_types + + def _arg_for_type(self, a_letter_type, index=0): + res = super(self.__class__, self)._arg_for_type(a_letter_type, + index=index) + if a_letter_type in 'bBhHiIlLqQ': + # For integer reciprocal, avoid 0 as argument, as it triggers + # undefined behavior that may differ in results from Numba + # to the compiler used to compile NumPy. + res[res == 0] = 42 + return res + + +TestLoopTypesReciprocal.autogenerate() + + +class TestLoopTypesPower(_LoopTypesTester): + _ufuncs = [np.power] # issue #757 + _required_types = 'bBhHiIlLqQfdFD' + _skip_types = 'mMO' + _LoopTypesTester._skip_types + + def _arg_for_type(self, a_letter_type, index=0): + res = super(self.__class__, self)._arg_for_type(a_letter_type, + index=index) + if a_letter_type in 'bBhHiIlLqQ' and index == 1: + # For integer power, avoid a negative exponent, as it triggers + # undefined behavior that may differ in results from Numba + # to the compiler used to compile NumPy + res[res < 0] = 3 + return res + + +TestLoopTypesPower.autogenerate() + + +class TestLoopTypesIntLeftShift(_LoopTypesTester): + _ufuncs = [np.left_shift] + _required_types = 'bBhHiIlLqQ' + _skip_types = 'fdFDmMO' + _LoopTypesTester._skip_types + + def _arg_for_type(self, a_letter_type, index=0): + res = super(self.__class__, self)._arg_for_type(a_letter_type, + index=index) + # Shifting by a negative amount (argument with index 1) is undefined + # behavior in C. It is also undefined behavior in numba. In the same + # sense, it is also undefined behavior when the shift amount is larger + # than the number of bits in the shifted integer. + # To avoid problems in the test, the values are clamped (clipped) so + # that 0 <= shift_amount < bitcount(shifted_integer) + if index == 1: + bit_count = res.dtype.itemsize * 8 + res = np.clip(res, 0, bit_count - 1) + return res + + +TestLoopTypesIntLeftShift.autogenerate() + + +class TestLoopTypesIntRightShift(_LoopTypesTester): + _ufuncs = [np.right_shift] + _required_types = 'bBhHiIlLqQ' + _skip_types = 'fdFDmMO' + _LoopTypesTester._skip_types + + def _arg_for_type(self, a_letter_type, index=0): + res = super(self.__class__, self)._arg_for_type(a_letter_type, + index=index) + # Shifting by a negative amount (argument with index 1) is undefined + # behavior in C. It is also undefined behavior in numba. In the same + # sense, it is also undefined behavior when the shift amount is larger + # than the number of bits in the shifted integer. + # To avoid problems in the test, the values are clamped (clipped) so + # that 0 <= shift_amount < bitcount(shifted_integer) + if index == 1: + bit_count = res.dtype.itemsize * 8 + res = np.clip(res, 0, bit_count - 1) + + # Right shift has "implementation defined behavior" when the number + # shifted is negative (in C). In numba, right shift for signed integers + # is "arithmetic" while for unsigned integers is "logical". + # This test compares against the NumPy implementation, that relies + # on "implementation defined behavior", so the test could be a false + # failure if the compiler used to compile NumPy doesn't follow the same + # policy. + # Hint: do not rely on right shifting negative numbers in NumPy. + if index == 0: + res = np.abs(res) + return res + + +TestLoopTypesIntRightShift.autogenerate() + + +class TestLoopTypesFloorDivide(_LoopTypesTester): + _ufuncs = [np.floor_divide, np.remainder, np.divmod] + _required_types = 'bBhHiIlLqQfdFD' + _skip_types = 'mMO' + _LoopTypesTester._skip_types + + def _fixup_results(self, dtype, py_arg, c_arg): + if dtype.kind == 'f': + # Discrepancies on floating-point floor division and remainder: + # Numpy may return nan where Numba returns inf, e.g. 1. // 0. + pred = (np.isinf(c_arg) & np.isnan(py_arg)) + # Numpy and Numba may differ in signed zeros, e.g. -0. // -1. + pred |= (py_arg == 0.0) & (c_arg == 0.0) + c_arg[pred] = py_arg[pred] + return py_arg, c_arg + + +TestLoopTypesFloorDivide.autogenerate() + + +class TestLoopTypesFloat(_LoopTypesTester): + _ufuncs = supported_ufuncs[:] + if iswindows: + _ufuncs.remove(np.signbit) # TODO: fix issue #758 + _ufuncs.remove(np.floor_divide) # has its own test class + _ufuncs.remove(np.remainder) # has its own test class + _ufuncs.remove(np.divmod) # has its own test class + _ufuncs.remove(np.mod) # same as np.remainder + _required_types = 'fd' + _skip_types = 'FDmMO' + _LoopTypesTester._skip_types + + +TestLoopTypesFloat.autogenerate() + + +class TestLoopTypesComplex(_LoopTypesTester): + _ufuncs = supported_ufuncs[:] + + # Test complex types + # Every loop containing a complex argument must be tested + _required_types = 'FD' + _skip_types = 'mMO' + _LoopTypesTester._skip_types + + +TestLoopTypesComplex.autogenerate() + + +class TestLoopTypesDatetime(_LoopTypesTester): + _ufuncs = supported_ufuncs[:] + + _ufuncs.remove(np.divmod) # not implemented yet + + # NOTE: the full list of ufuncs supporting datetime64 and timedelta64 + # types in Numpy is: + # ['absolute', 'add', 'divide', 'equal', 'floor_divide', 'fmax', 'fmin', + # 'greater', 'greater_equal', 'less', 'less_equal', 'maximum', + # 'minimum', 'multiply', 'negative', 'not_equal', 'sign', 'subtract', + # 'true_divide'] + + # Test datetime64 and timedelta64 types. + _required_types = 'mM' + + # Test various units combinations (TestLoopTypes is only able to test + # homogeneous units). + + def test_add(self): + ufunc = np.add + fn = _make_ufunc_usecase(ufunc) + # heterogeneous inputs + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'm8[m]', 'm8[s]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'm8[s]', 'm8[s]']) + # heterogeneous inputs, scaled output + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'm8[m]', 'm8[ms]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'm8[s]', 'm8[ms]']) + # Cannot upscale result (Numpy would accept this) + with self.assertRaises(LoweringError): + self._check_ufunc_with_dtypes(fn, ufunc, + ['m8[m]', 'm8[s]', 'm8[m]']) + + def test_subtract(self): + ufunc = np.subtract + fn = _make_ufunc_usecase(ufunc) + # heterogeneous inputs + self._check_ufunc_with_dtypes(fn, ufunc, ['M8[s]', 'M8[m]', 'm8[s]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['M8[m]', 'M8[s]', 'm8[s]']) + # heterogeneous inputs, scaled output + self._check_ufunc_with_dtypes(fn, ufunc, ['M8[s]', 'M8[m]', 'm8[ms]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['M8[m]', 'M8[s]', 'm8[ms]']) + # Cannot upscale result (Numpy would accept this) + with self.assertRaises(LoweringError): + self._check_ufunc_with_dtypes(fn, ufunc, + ['M8[m]', 'M8[s]', 'm8[m]']) + + def test_multiply(self): + ufunc = np.multiply + fn = _make_ufunc_usecase(ufunc) + # scaled output + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'q', 'm8[us]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['q', 'm8[s]', 'm8[us]']) + # Cannot upscale result (Numpy would accept this) + with self.assertRaises(LoweringError): + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'q', 'm8[m]']) + + def test_true_divide(self): + ufunc = np.true_divide + fn = _make_ufunc_usecase(ufunc) + # heterogeneous inputs + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'm8[s]', 'd']) + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'm8[m]', 'd']) + # scaled output + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'q', 'm8[s]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'd', 'm8[s]']) + # Cannot upscale result (Numpy would accept this) + with self.assertRaises(LoweringError): + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'q', 'm8[m]']) + + def test_floor_divide(self): + ufunc = np.floor_divide + fn = _make_ufunc_usecase(ufunc) + # scaled output + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'q', 'm8[s]']) + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'd', 'm8[s]']) + # Cannot upscale result (Numpy would accept this) + with self.assertRaises(LoweringError): + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'q', 'm8[m]']) + + def _check_comparison(self, ufunc): + fn = _make_ufunc_usecase(ufunc) + # timedelta + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[m]', 'm8[s]', '?']) + self._check_ufunc_with_dtypes(fn, ufunc, ['m8[s]', 'm8[m]', '?']) + # datetime + self._check_ufunc_with_dtypes(fn, ufunc, ['M8[m]', 'M8[s]', '?']) + self._check_ufunc_with_dtypes(fn, ufunc, ['M8[s]', 'M8[m]', '?']) + + def test_comparisons(self): + for ufunc in [np.equal, np.not_equal, np.less, np.less_equal, + np.greater, np.greater_equal]: + self._check_comparison(ufunc) + + +TestLoopTypesDatetime.autogenerate() + + +class TestUFuncBadArgs(TestCase): + def test_missing_args(self): + def func(x): + """error: np.add requires two args""" + result = np.add(x) + return result + + with self.assertRaises(TypingError): + njit([types.float64(types.float64)])(func) + + def test_too_many_args(self): + def func(x, out, out2): + """error: too many args""" + result = np.add(x, x, out, out2) + return result + + array_type = types.Array(types.float64, 1, 'C') + sig = array_type(array_type, array_type, array_type) + + with self.assertRaises(TypingError): + njit(sig)(func) + + def test_no_scalar_result_by_reference(self): + def func(x): + """error: scalar as a return value is not supported""" + y = 0 + np.add(x, x, y) + + with self.assertRaises(TypingError): + njit([types.float64(types.float64)])(func) + + +class TestUFuncCompilationThreadSafety(TestCase): + + def test_lock(self): + """ + Test that (lazy) compiling from several threads at once doesn't + produce errors (see issue #2403). + """ + errors = [] + + @vectorize + def foo(x): + return x + 1 + + def wrapper(): + try: + a = np.ones((10,), dtype=np.float64) + expected = np.ones((10,), dtype=np.float64) + 1. + np.testing.assert_array_equal(foo(a), expected) + except Exception as e: + errors.append(e) + + threads = [threading.Thread(target=wrapper) for i in range(16)] + for t in threads: + t.start() + for t in threads: + t.join() + self.assertFalse(errors) + + +class TestUfuncOnContext(TestCase): + def test_cpu_get_ufunc_info(self): + # The CPU context defines get_ufunc_info that is the same as + # ufunc_db.get_ufunc_info. + targetctx = cpu_target.target_context + # Check: get_ufunc_info returns a dict + add_info = targetctx.get_ufunc_info(np.add) + self.assertIsInstance(add_info, dict) + # Check: it is the same as ufunc_db.get_ufunc_info + expected = ufunc_db.get_ufunc_info(np.add) + self.assertEqual(add_info, expected) + # Check: KeyError raised on bad key + badkey = object() + with self.assertRaises(KeyError) as raises: + ufunc_db.get_ufunc_info(badkey) + self.assertEqual(raises.exception.args, (badkey,)) + + def test_base_get_ufunc_info(self): + # The BaseContext always raises NotImplementedError + targetctx = BaseContext(cpu_target.typing_context, 'cpu') + with self.assertRaises(NotImplementedError) as raises: + targetctx.get_ufunc_info(np.add) + self.assertRegex( + str(raises.exception), + r" does not support ufunc", + ) + + +class TestUfuncWriteInput(TestCase): + def test_write_input_arg(self): + @guvectorize(["void(float64[:], uint8[:])"], "(n)->(n)") + def func(x, out): + + for i in range(x.size): + # set every fourth element to 1 + if i % 4 == 0: + out[i] = 1 + + x = np.random.rand(10, 5) + out = np.zeros_like(x, dtype=np.int8) + + func(x, out) + np.testing.assert_array_equal( + np.array([True, False, False, False, True], dtype=np.bool_), + out.any(axis=0)) + + +if __name__ == '__main__': + unittest.main() diff --git a/shared/package-files/33/339e07a06cc19898f2372f2d6774b6f473e3e73e08900f602594ba6dc06f3efc/blob b/shared/package-files/33/339e07a06cc19898f2372f2d6774b6f473e3e73e08900f602594ba6dc06f3efc/blob new file mode 100644 index 0000000000000000000000000000000000000000..f85c7d11c55a65cccaf4da98a4e7b102f1aaaa4c --- /dev/null +++ b/shared/package-files/33/339e07a06cc19898f2372f2d6774b6f473e3e73e08900f602594ba6dc06f3efc/blob @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API void _foreach_pow_out(at::TensorList out, at::TensorList self, at::TensorList exponent); +TORCH_API void _foreach_pow_outf(at::TensorList self, at::TensorList exponent, at::TensorList out); +TORCH_API void _foreach_pow_out(at::TensorList out, at::TensorList self, const at::Scalar & exponent); +TORCH_API void _foreach_pow_outf(at::TensorList self, const at::Scalar & exponent, at::TensorList out); +TORCH_API void _foreach_pow_out(at::TensorList out, at::TensorList self, at::ArrayRef exponent); +TORCH_API void _foreach_pow_outf(at::TensorList self, at::ArrayRef exponent, at::TensorList out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/33/33a4c5f70a5b832c1042fb5e841a212d312bd9ff1eedcc3dd3d3d9dd7b24dcde/blob b/shared/package-files/33/33a4c5f70a5b832c1042fb5e841a212d312bd9ff1eedcc3dd3d3d9dd7b24dcde/blob new file mode 100644 index 0000000000000000000000000000000000000000..f1d7204611ed8b8afcebac694988ff4546bf891a --- /dev/null +++ b/shared/package-files/33/33a4c5f70a5b832c1042fb5e841a212d312bd9ff1eedcc3dd3d3d9dd7b24dcde/blob @@ -0,0 +1,116 @@ +Metadata-Version: 2.1 +Name: beautifulsoup4 +Version: 4.12.2 +Summary: Screen-scraping library +Project-URL: Download, https://www.crummy.com/software/BeautifulSoup/bs4/download/ +Project-URL: Homepage, https://www.crummy.com/software/BeautifulSoup/bs4/ +Author-email: Leonard Richardson +License-Expression: MIT +License-File: AUTHORS +License-File: LICENSE +Keywords: HTML,XML,parse,soup +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Text Processing :: Markup :: HTML +Classifier: Topic :: Text Processing :: Markup :: SGML +Classifier: Topic :: Text Processing :: Markup :: XML +Requires-Python: >=3.6.0 +Requires-Dist: soupsieve>1.2 +Provides-Extra: html5lib +Requires-Dist: html5lib; extra == 'html5lib' +Provides-Extra: lxml +Requires-Dist: lxml; extra == 'lxml' +Description-Content-Type: text/markdown + +Beautiful Soup is a library that makes it easy to scrape information +from web pages. It sits atop an HTML or XML parser, providing Pythonic +idioms for iterating, searching, and modifying the parse tree. + +# Quick start + +``` +>>> from bs4 import BeautifulSoup +>>> soup = BeautifulSoup("

SomebadHTML") +>>> print(soup.prettify()) + + +

+ Some + + bad + + HTML + + +

+ + +>>> soup.find(text="bad") +'bad' +>>> soup.i +HTML +# +>>> soup = BeautifulSoup("SomebadXML", "xml") +# +>>> print(soup.prettify()) + + + Some + + bad + + XML + + +``` + +To go beyond the basics, [comprehensive documentation is available](https://www.crummy.com/software/BeautifulSoup/bs4/doc/). + +# Links + +* [Homepage](https://www.crummy.com/software/BeautifulSoup/bs4/) +* [Documentation](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) +* [Discussion group](https://groups.google.com/group/beautifulsoup/) +* [Development](https://code.launchpad.net/beautifulsoup/) +* [Bug tracker](https://bugs.launchpad.net/beautifulsoup/) +* [Complete changelog](https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/CHANGELOG) + +# Note on Python 2 sunsetting + +Beautiful Soup's support for Python 2 was discontinued on December 31, +2020: one year after the sunset date for Python 2 itself. From this +point onward, new Beautiful Soup development will exclusively target +Python 3. The final release of Beautiful Soup 4 to support Python 2 +was 4.9.3. + +# Supporting the project + +If you use Beautiful Soup as part of your professional work, please consider a +[Tidelift subscription](https://tidelift.com/subscription/pkg/pypi-beautifulsoup4?utm_source=pypi-beautifulsoup4&utm_medium=referral&utm_campaign=readme). +This will support many of the free software projects your organization +depends on, not just Beautiful Soup. + +If you use Beautiful Soup for personal projects, the best way to say +thank you is to read +[Tool Safety](https://www.crummy.com/software/BeautifulSoup/zine/), a zine I +wrote about what Beautiful Soup has taught me about software +development. + +# Building the documentation + +The bs4/doc/ directory contains full documentation in Sphinx +format. Run `make html` in that directory to create HTML +documentation. + +# Running the unit tests + +Beautiful Soup supports unit test discovery using Pytest: + +``` +$ pytest +``` + diff --git a/shared/package-files/33/33a7424b977be741737fd197ef1c8d91af92676c091422faeb2e63fa6a07870a/blob b/shared/package-files/33/33a7424b977be741737fd197ef1c8d91af92676c091422faeb2e63fa6a07870a/blob new file mode 100644 index 0000000000000000000000000000000000000000..245594bfdc9e72ff5cb3a4799e9055c7cd6b5a3e --- /dev/null +++ b/shared/package-files/33/33a7424b977be741737fd197ef1c8d91af92676c091422faeb2e63fa6a07870a/blob @@ -0,0 +1,7 @@ +""" +Test files dedicated to individual (stand-alone) DataFrame methods + +Ideally these files/tests should correspond 1-to-1 with tests.series.methods + +These may also present opportunities for sharing/de-duplicating test code. +""" diff --git a/shared/package-files/33/33a8073afc6c632b6de1e28eb68ae0ed31dece856252766ac6a917a95203edff/blob b/shared/package-files/33/33a8073afc6c632b6de1e28eb68ae0ed31dece856252766ac6a917a95203edff/blob new file mode 100644 index 0000000000000000000000000000000000000000..af170f669105354c5f0217119ba6ebad9eb52d7c Binary files /dev/null and b/shared/package-files/33/33a8073afc6c632b6de1e28eb68ae0ed31dece856252766ac6a917a95203edff/blob differ diff --git a/shared/package-files/33/33ac546de38905af7117c80f2e1486ec020c0db2b87bd0756af84cd9e5cb5d75/blob b/shared/package-files/33/33ac546de38905af7117c80f2e1486ec020c0db2b87bd0756af84cd9e5cb5d75/blob new file mode 100644 index 0000000000000000000000000000000000000000..c0a2fc47c0069bed4e15beec249162a556f7dc3d --- /dev/null +++ b/shared/package-files/33/33ac546de38905af7117c80f2e1486ec020c0db2b87bd0756af84cd9e5cb5d75/blob @@ -0,0 +1,121 @@ +#pragma once + +#include +#include +#include + +__device__ __forceinline__ unsigned int ACTIVE_MASK() +{ +#if !defined(USE_ROCM) + return __activemask(); +#else +// will be ignored anyway + return 0xffffffff; +#endif +} + +__device__ __forceinline__ void WARP_SYNC(unsigned mask = 0xffffffff) { +#if !defined(USE_ROCM) + return __syncwarp(mask); +#endif +} + +#if defined(USE_ROCM) +__device__ __forceinline__ unsigned long long int WARP_BALLOT(int predicate) +{ +return __ballot(predicate); +} +#else +__device__ __forceinline__ unsigned int WARP_BALLOT(int predicate, unsigned int mask = 0xffffffff) +{ +#if !defined(USE_ROCM) + return __ballot_sync(mask, predicate); +#else + return __ballot(predicate); +#endif +} +#endif + +template +__device__ __forceinline__ T WARP_SHFL_XOR(T value, int laneMask, int width = warpSize, unsigned int mask = 0xffffffff) +{ +#if !defined(USE_ROCM) + return __shfl_xor_sync(mask, value, laneMask, width); +#else + return __shfl_xor(value, laneMask, width); +#endif +} + +template +__device__ __forceinline__ T WARP_SHFL(T value, int srcLane, int width = warpSize, unsigned int mask = 0xffffffff) +{ +#if !defined(USE_ROCM) + return __shfl_sync(mask, value, srcLane, width); +#else + return __shfl(value, srcLane, width); +#endif +} + +template +__device__ __forceinline__ T WARP_SHFL_UP(T value, unsigned int delta, int width = warpSize, unsigned int mask = 0xffffffff) +{ +#if !defined(USE_ROCM) + return __shfl_up_sync(mask, value, delta, width); +#else + return __shfl_up(value, delta, width); +#endif +} + +template +__device__ __forceinline__ T WARP_SHFL_DOWN(T value, unsigned int delta, int width = warpSize, unsigned int mask = 0xffffffff) +{ +#if !defined(USE_ROCM) + return __shfl_down_sync(mask, value, delta, width); +#else + return __shfl_down(value, delta, width); +#endif +} + +#if defined(USE_ROCM) +template<> +__device__ __forceinline__ int64_t WARP_SHFL_DOWN(int64_t value, unsigned int delta, int width , unsigned int mask) +{ + //(HIP doesn't support int64_t). Trick from https://devblogs.nvidia.com/faster-parallel-reductions-kepler/ + int2 a = *reinterpret_cast(&value); + a.x = __shfl_down(a.x, delta); + a.y = __shfl_down(a.y, delta); + return *reinterpret_cast(&a); +} +#endif + +template<> +__device__ __forceinline__ c10::Half WARP_SHFL_DOWN(c10::Half value, unsigned int delta, int width, unsigned int mask) +{ + return c10::Half(WARP_SHFL_DOWN(value.x, delta, width, mask), c10::Half::from_bits_t{}); +} + +template +__device__ __forceinline__ c10::complex WARP_SHFL_DOWN(c10::complex value, unsigned int delta, int width = warpSize, unsigned int mask = 0xffffffff) +{ +#if !defined(USE_ROCM) + return c10::complex( + __shfl_down_sync(mask, value.real_, delta, width), + __shfl_down_sync(mask, value.imag_, delta, width)); +#else + return c10::complex( + __shfl_down(value.real_, delta, width), + __shfl_down(value.imag_, delta, width)); +#endif +} + +/** + * For CC 3.5+, perform a load using __ldg + */ +template +__device__ __forceinline__ T doLdg(const T* p) { +#if __CUDA_ARCH__ >= 350 && !defined(USE_ROCM) + return __ldg(p); +#else + return *p; +#endif +} diff --git a/shared/package-files/33/33acda08d1ad11a762760d2dc2948b50c660c1c048f02f48d75377acdded6bca/blob b/shared/package-files/33/33acda08d1ad11a762760d2dc2948b50c660c1c048f02f48d75377acdded6bca/blob new file mode 100644 index 0000000000000000000000000000000000000000..a5beb0ed6e3181a7e8d9042a6910221b23989e02 --- /dev/null +++ b/shared/package-files/33/33acda08d1ad11a762760d2dc2948b50c660c1c048f02f48d75377acdded6bca/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API linalg_solve { + using schema = at::Tensor (const at::Tensor &, const at::Tensor &, bool); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::linalg_solve") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "linalg_solve(Tensor A, Tensor B, *, bool left=True) -> Tensor") + static at::Tensor call(const at::Tensor & A, const at::Tensor & B, bool left); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & A, const at::Tensor & B, bool left); +}; + +struct TORCH_API linalg_solve_out { + using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, bool, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::linalg_solve") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "linalg_solve.out(Tensor A, Tensor B, *, bool left=True, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & A, const at::Tensor & B, bool left, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & A, const at::Tensor & B, bool left, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/33/33aeeb6f840b33de7ae4d6ba08766729e96310eb5ca3355c85a44fd35d4e1bfd/blob b/shared/package-files/33/33aeeb6f840b33de7ae4d6ba08766729e96310eb5ca3355c85a44fd35d4e1bfd/blob new file mode 100644 index 0000000000000000000000000000000000000000..6f8b98dbad5b6b00b7d5090fa250adf02c0230ab --- /dev/null +++ b/shared/package-files/33/33aeeb6f840b33de7ae4d6ba08766729e96310eb5ca3355c85a44fd35d4e1bfd/blob @@ -0,0 +1,13 @@ +All of the people who have made at least one contribution to conda-content-trust. +Authors are sorted alphabetically. + +* Bianca Henderson +* Cheng H. Lee +* Conda Bot +* Daniel Holth +* Jannis Leidel +* Ken Odegard +* Mike Sarahan +* Sebastien Awwad +* dependabot[bot] +* pre-commit-ci[bot] diff --git a/shared/package-files/33/33af48e8c163687295a74dee653d92fe90c3ebf850e2357c04963c394ff59010/blob b/shared/package-files/33/33af48e8c163687295a74dee653d92fe90c3ebf850e2357c04963c394ff59010/blob new file mode 100644 index 0000000000000000000000000000000000000000..5646fa0d8641bd5abc6e9ff49b1ad333ca64228d --- /dev/null +++ b/shared/package-files/33/33af48e8c163687295a74dee653d92fe90c3ebf850e2357c04963c394ff59010/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor arccosh(const at::Tensor & self); +TORCH_API at::Tensor & arccosh_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & arccosh_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & arccosh_(at::Tensor & self); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/33/33b19575df80c4e87aa06c3acdf38d1004cb32cc402185b6cbd9113979e7f998/blob b/shared/package-files/33/33b19575df80c4e87aa06c3acdf38d1004cb32cc402185b6cbd9113979e7f998/blob new file mode 100644 index 0000000000000000000000000000000000000000..d8f44b47c51b06b6752e0aea050037d089be010f --- /dev/null +++ b/shared/package-files/33/33b19575df80c4e87aa06c3acdf38d1004cb32cc402185b6cbd9113979e7f998/blob @@ -0,0 +1 @@ +from pyexpat.model import * diff --git a/shared/package-files/33/33b1c5130ef2f4aa62eeda4bc8c0d99730e46c38cec7150eb5bb4ae66c1a4cf3/blob b/shared/package-files/33/33b1c5130ef2f4aa62eeda4bc8c0d99730e46c38cec7150eb5bb4ae66c1a4cf3/blob new file mode 100644 index 0000000000000000000000000000000000000000..c68267f83f28a86be58cbae16fc92eee9b4d3ccc --- /dev/null +++ b/shared/package-files/33/33b1c5130ef2f4aa62eeda4bc8c0d99730e46c38cec7150eb5bb4ae66c1a4cf3/blob @@ -0,0 +1,152 @@ +from collections.abc import Callable +from typing import Any, TypeAlias, type_check_only + +from typing_extensions import ( + Concatenate, + Generic, + Never, + ParamSpec, + Self, + TypeVar, + override, +) + +from numba.core import serialize +from numba.core.compiler import CompileResult +from numba.core.types import Type +from numba.core.typing.templates import Signature +from numba.np import npyimpl + +from .ufunc_base import ( + UfuncBase, + UfuncLowererBase, + _AccumulateT_co, + _IdentityT_co, + _OuterT_co, + _ReduceAtT_co, + _ReduceT_co, +) + +### + +_T = TypeVar("_T") +_T1 = TypeVar("_T1") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") +_Tss = ParamSpec("_Tss") +_CallT_co = TypeVar( + "_CallT_co", + bound=Callable[Concatenate[Never, ...], object], + default=Callable[Concatenate[Any, ...], Any], + covariant=True, +) +_AtT_co = TypeVar( + "_AtT_co", + bound=Callable[[Never, Never, Never], None], + default=Callable[[Any, Any, Any | None], None], + covariant=True, +) +_GUFuncT = TypeVar("_GUFuncT", bound=GUFunc) +_GUFuncT_co = TypeVar("_GUFuncT_co", bound=GUFunc, covariant=True) + +_ToSignature: TypeAlias = Signature | tuple[Type | Signature, ...] | str + +@type_check_only +class GUFuncKernel(npyimpl._Kernel, Generic[_GUFuncT_co]): + __name__: str + + dufunc: _GUFuncT_co # not a typo + + inner_sig: Signature | None + cres: CompileResult | None + +### + +def make_gufunc_kernel(_dufunc: _GUFuncT) -> type[GUFuncKernel[_GUFuncT]]: ... + +class GUFuncLowerer( + UfuncLowererBase[_GUFuncT_co, GUFuncKernel[_GUFuncT_co]], + Generic[_GUFuncT_co], +): + def __init__(self, gufunc: _GUFuncT_co) -> None: ... + +class GUFunc( + serialize.ReduceMixin, + UfuncBase[ + _AtT_co, + _ReduceT_co, + _ReduceAtT_co, + _AccumulateT_co, + _OuterT_co, + _IdentityT_co, + str, + ], + Generic[ + _CallT_co, + _AtT_co, + _ReduceT_co, + _ReduceAtT_co, + _AccumulateT_co, + _OuterT_co, + _IdentityT_co, + ], +): + __name__: str + __doc__: str | None + + def __init__( + self, + py_func: Callable[..., object], + signature: str, + identity: _IdentityT_co | None = None, + cache: bool | None = None, + is_dynamic: bool = False, + targetoptions: dict[str, Any] | None = None, + writable_args: tuple[int | str, ...] = ..., + ) -> None: ... + def __call__( + self: GUFunc[Callable[Concatenate[_T1, _Tss], _T]], + arg0: _T1, + /, + *args: _Tss.args, + **kws: _Tss.kwargs, + ) -> _T: ... + + # + def add(self, fty: _ToSignature) -> None: ... + def expected_ndims(self) -> tuple[tuple[int, ...], tuple[int, ...]]: ... + def build_ufunc(self) -> Self: ... + @override + def match_signature( # pyrefly:ignore[bad-override-mutable-attribute] + self, ewise_types: tuple[Type, ...], sig: Signature + ) -> bool: ... + + # + @property + def is_dynamic(self) -> bool: ... + + # `ReduceMixin` methods + @override + def _reduce_states(self) -> dict[str, Any]: ... + @classmethod + @override + def _rebuild( # type: ignore[override] # pyrefly:ignore[bad-override] + cls, + py_func: Callable[..., object], + signature: str, + identity: _T, + cache: bool, + is_dynamic: bool, + targetoptions: dict[str, Any] | None, + writable_args: tuple[int | str, ...], + typesigs: list[Signature], + frozen: bool, + ) -> GUFunc[ + _CallT_co, + _AtT_co, + _ReduceT_co, + _ReduceAtT_co, + _AccumulateT_co, + _OuterT_co, + _T, + ]: ... diff --git a/shared/package-files/33/33b2e4cc2a8e13fdab2c42e4e5f39c041964bb8ff51016dfa659a88475220458/blob b/shared/package-files/33/33b2e4cc2a8e13fdab2c42e4e5f39c041964bb8ff51016dfa659a88475220458/blob new file mode 100644 index 0000000000000000000000000000000000000000..c1b79d201b9a2bd732fbc48574ff519be4fb6461 --- /dev/null +++ b/shared/package-files/33/33b2e4cc2a8e13fdab2c42e4e5f39c041964bb8ff51016dfa659a88475220458/blob @@ -0,0 +1,26 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + + +} diff --git a/shared/package-files/33/33b4a16a7ac94f1f9b00fef8d2c477b3b050ca961f9a1db79f5b51605282e14b/blob b/shared/package-files/33/33b4a16a7ac94f1f9b00fef8d2c477b3b050ca961f9a1db79f5b51605282e14b/blob new file mode 100644 index 0000000000000000000000000000000000000000..9f67f59ff659765b4686b503d3d67880834a7521 --- /dev/null +++ b/shared/package-files/33/33b4a16a7ac94f1f9b00fef8d2c477b3b050ca961f9a1db79f5b51605282e14b/blob @@ -0,0 +1,279 @@ +"""Functions for computing measures of structural holes.""" + +import networkx as nx + +__all__ = ["constraint", "local_constraint", "effective_size"] + + +@nx._dispatch +def mutual_weight(G, u, v, weight=None): + """Returns the sum of the weights of the edge from `u` to `v` and + the edge from `v` to `u` in `G`. + + `weight` is the edge data key that represents the edge weight. If + the specified key is `None` or is not in the edge data for an edge, + that edge is assumed to have weight 1. + + Pre-conditions: `u` and `v` must both be in `G`. + + """ + try: + a_uv = G[u][v].get(weight, 1) + except KeyError: + a_uv = 0 + try: + a_vu = G[v][u].get(weight, 1) + except KeyError: + a_vu = 0 + return a_uv + a_vu + + +def normalized_mutual_weight(G, u, v, norm=sum, weight=None): + """Returns normalized mutual weight of the edges from `u` to `v` + with respect to the mutual weights of the neighbors of `u` in `G`. + + `norm` specifies how the normalization factor is computed. It must + be a function that takes a single argument and returns a number. + The argument will be an iterable of mutual weights + of pairs ``(u, w)``, where ``w`` ranges over each (in- and + out-)neighbor of ``u``. Commons values for `normalization` are + ``sum`` and ``max``. + + `weight` can be ``None`` or a string, if None, all edge weights + are considered equal. Otherwise holds the name of the edge + attribute used as weight. + + """ + scale = norm(mutual_weight(G, u, w, weight) for w in set(nx.all_neighbors(G, u))) + return 0 if scale == 0 else mutual_weight(G, u, v, weight) / scale + + +def effective_size(G, nodes=None, weight=None): + r"""Returns the effective size of all nodes in the graph ``G``. + + The *effective size* of a node's ego network is based on the concept + of redundancy. A person's ego network has redundancy to the extent + that her contacts are connected to each other as well. The + nonredundant part of a person's relationships it's the effective + size of her ego network [1]_. Formally, the effective size of a + node $u$, denoted $e(u)$, is defined by + + .. math:: + + e(u) = \sum_{v \in N(u) \setminus \{u\}} + \left(1 - \sum_{w \in N(v)} p_{uw} m_{vw}\right) + + where $N(u)$ is the set of neighbors of $u$ and $p_{uw}$ is the + normalized mutual weight of the (directed or undirected) edges + joining $u$ and $v$, for each vertex $u$ and $v$ [1]_. And $m_{vw}$ + is the mutual weight of $v$ and $w$ divided by $v$ highest mutual + weight with any of its neighbors. The *mutual weight* of $u$ and $v$ + is the sum of the weights of edges joining them (edge weights are + assumed to be one if the graph is unweighted). + + For the case of unweighted and undirected graphs, Borgatti proposed + a simplified formula to compute effective size [2]_ + + .. math:: + + e(u) = n - \frac{2t}{n} + + where `t` is the number of ties in the ego network (not including + ties to ego) and `n` is the number of nodes (excluding ego). + + Parameters + ---------- + G : NetworkX graph + The graph containing ``v``. Directed graphs are treated like + undirected graphs when computing neighbors of ``v``. + + nodes : container, optional + Container of nodes in the graph ``G`` to compute the effective size. + If None, the effective size of every node is computed. + + weight : None or string, optional + If None, all edge weights are considered equal. + Otherwise holds the name of the edge attribute used as weight. + + Returns + ------- + dict + Dictionary with nodes as keys and the effective size of the node as values. + + Notes + ----- + Burt also defined the related concept of *efficiency* of a node's ego + network, which is its effective size divided by the degree of that + node [1]_. So you can easily compute efficiency: + + >>> G = nx.DiGraph() + >>> G.add_edges_from([(0, 1), (0, 2), (1, 0), (2, 1)]) + >>> esize = nx.effective_size(G) + >>> efficiency = {n: v / G.degree(n) for n, v in esize.items()} + + See also + -------- + constraint + + References + ---------- + .. [1] Burt, Ronald S. + *Structural Holes: The Social Structure of Competition.* + Cambridge: Harvard University Press, 1995. + + .. [2] Borgatti, S. + "Structural Holes: Unpacking Burt's Redundancy Measures" + CONNECTIONS 20(1):35-38. + http://www.analytictech.com/connections/v20(1)/holes.htm + + """ + + def redundancy(G, u, v, weight=None): + nmw = normalized_mutual_weight + r = sum( + nmw(G, u, w, weight=weight) * nmw(G, v, w, norm=max, weight=weight) + for w in set(nx.all_neighbors(G, u)) + ) + return 1 - r + + effective_size = {} + if nodes is None: + nodes = G + # Use Borgatti's simplified formula for unweighted and undirected graphs + if not G.is_directed() and weight is None: + for v in nodes: + # Effective size is not defined for isolated nodes + if len(G[v]) == 0: + effective_size[v] = float("nan") + continue + E = nx.ego_graph(G, v, center=False, undirected=True) + effective_size[v] = len(E) - (2 * E.size()) / len(E) + else: + for v in nodes: + # Effective size is not defined for isolated nodes + if len(G[v]) == 0: + effective_size[v] = float("nan") + continue + effective_size[v] = sum( + redundancy(G, v, u, weight) for u in set(nx.all_neighbors(G, v)) + ) + return effective_size + + +def constraint(G, nodes=None, weight=None): + r"""Returns the constraint on all nodes in the graph ``G``. + + The *constraint* is a measure of the extent to which a node *v* is + invested in those nodes that are themselves invested in the + neighbors of *v*. Formally, the *constraint on v*, denoted `c(v)`, + is defined by + + .. math:: + + c(v) = \sum_{w \in N(v) \setminus \{v\}} \ell(v, w) + + where $N(v)$ is the subset of the neighbors of `v` that are either + predecessors or successors of `v` and $\ell(v, w)$ is the local + constraint on `v` with respect to `w` [1]_. For the definition of local + constraint, see :func:`local_constraint`. + + Parameters + ---------- + G : NetworkX graph + The graph containing ``v``. This can be either directed or undirected. + + nodes : container, optional + Container of nodes in the graph ``G`` to compute the constraint. If + None, the constraint of every node is computed. + + weight : None or string, optional + If None, all edge weights are considered equal. + Otherwise holds the name of the edge attribute used as weight. + + Returns + ------- + dict + Dictionary with nodes as keys and the constraint on the node as values. + + See also + -------- + local_constraint + + References + ---------- + .. [1] Burt, Ronald S. + "Structural holes and good ideas". + American Journal of Sociology (110): 349–399. + + """ + if nodes is None: + nodes = G + constraint = {} + for v in nodes: + # Constraint is not defined for isolated nodes + if len(G[v]) == 0: + constraint[v] = float("nan") + continue + constraint[v] = sum( + local_constraint(G, v, n, weight) for n in set(nx.all_neighbors(G, v)) + ) + return constraint + + +def local_constraint(G, u, v, weight=None): + r"""Returns the local constraint on the node ``u`` with respect to + the node ``v`` in the graph ``G``. + + Formally, the *local constraint on u with respect to v*, denoted + $\ell(v)$, is defined by + + .. math:: + + \ell(u, v) = \left(p_{uv} + \sum_{w \in N(v)} p_{uw} p_{wv}\right)^2, + + where $N(v)$ is the set of neighbors of $v$ and $p_{uv}$ is the + normalized mutual weight of the (directed or undirected) edges + joining $u$ and $v$, for each vertex $u$ and $v$ [1]_. The *mutual + weight* of $u$ and $v$ is the sum of the weights of edges joining + them (edge weights are assumed to be one if the graph is + unweighted). + + Parameters + ---------- + G : NetworkX graph + The graph containing ``u`` and ``v``. This can be either + directed or undirected. + + u : node + A node in the graph ``G``. + + v : node + A node in the graph ``G``. + + weight : None or string, optional + If None, all edge weights are considered equal. + Otherwise holds the name of the edge attribute used as weight. + + Returns + ------- + float + The constraint of the node ``v`` in the graph ``G``. + + See also + -------- + constraint + + References + ---------- + .. [1] Burt, Ronald S. + "Structural holes and good ideas". + American Journal of Sociology (110): 349–399. + + """ + nmw = normalized_mutual_weight + direct = nmw(G, u, v, weight=weight) + indirect = sum( + nmw(G, u, w, weight=weight) * nmw(G, w, v, weight=weight) + for w in set(nx.all_neighbors(G, u)) + ) + return (direct + indirect) ** 2 diff --git a/shared/package-files/33/33b534704145fbc979307687fcd638ff0d03ed1d2a9c35d429d5cb364d727fcf/blob b/shared/package-files/33/33b534704145fbc979307687fcd638ff0d03ed1d2a9c35d429d5cb364d727fcf/blob new file mode 100644 index 0000000000000000000000000000000000000000..00ee1cf75f0bf9d2d4357eed26def19470dc8f38 --- /dev/null +++ b/shared/package-files/33/33b534704145fbc979307687fcd638ff0d03ed1d2a9c35d429d5cb364d727fcf/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API ::std::tuple linalg_eigh(const at::Tensor & self, c10::string_view UPLO="L"); +TORCH_API ::std::tuple linalg_eigh_out(at::Tensor & eigvals, at::Tensor & eigvecs, const at::Tensor & self, c10::string_view UPLO="L"); +TORCH_API ::std::tuple linalg_eigh_outf(const at::Tensor & self, c10::string_view UPLO, at::Tensor & eigvals, at::Tensor & eigvecs); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/33/33b5ed26037f1b355f4d37fdc48ce2b78bdff74c286a56610afd518525197912/blob b/shared/package-files/33/33b5ed26037f1b355f4d37fdc48ce2b78bdff74c286a56610afd518525197912/blob new file mode 100644 index 0000000000000000000000000000000000000000..214dddd4edc49f704c46ce6699c0dcfd4e41b3a7 --- /dev/null +++ b/shared/package-files/33/33b5ed26037f1b355f4d37fdc48ce2b78bdff74c286a56610afd518525197912/blob @@ -0,0 +1,70 @@ +clear +insheet using results_realgdpar_stata.csv +keep value + +gen lgdp = log(value) +gen dlgdp = lgdp - lgdp[_n-1] +gen quarter = _n +tsset quarter + +// Estimate an ARMA(3,0) +arima dlgdp if ~missing(dlgdp), arima(3,0,0) noconstant +matrix b = e(b) +matrix b = (b[1,1..3],1,1,1,b[1,4]^2) + +// Estimate via a state-space model +constraint 1 [dlgdp]u1 = 1 +constraint 2 [u2]L.u1 = 1 +constraint 3 [u3]L.u2 = 1 + +sspace (u1 L.u1 L.u2 L.u3, state noconstant) /// + (u2 L.u1, state noconstant noerror) /// + (u3 L.u2, state noconstant noerror) /// + (dlgdp u1, noconstant noerror) if ~missing(dlgdp), /// + constraints(1/3) covstate(diagonal) from(b) + +// Estimate an ARMA(12,0) +arima dlgdp if ~missing(dlgdp), arima(12,0,0) noconstant +matrix b = e(b) +matrix b = (b[1,1..12],1,1,1, 1,1,1, 1,1,1, 1,1,1,b[1,13]^2) + +// Estimate via a state-space model +constraint 1 [dlgdp]u1 = 1 +constraint 2 [u2]L.u1 = 1 +constraint 3 [u3]L.u2 = 1 +constraint 4 [u4]L.u3 = 1 +constraint 5 [u5]L.u4 = 1 +constraint 6 [u6]L.u5 = 1 +constraint 7 [u7]L.u6 = 1 +constraint 8 [u8]L.u7 = 1 +constraint 9 [u9]L.u8 = 1 +constraint 10 [u10]L.u9 = 1 +constraint 11 [u11]L.u10 = 1 +constraint 12 [u12]L.u11 = 1 + +sspace (u1 L.u1 L.u2 L.u3 L.u4 L.u5 L.u6 L.u7 L.u8 L.u9 L.u10 L.u11 L.u12, state noconstant) /// + (u2 L.u1, state noconstant noerror) /// + (u3 L.u2, state noconstant noerror) /// + (u4 L.u3, state noconstant noerror) /// + (u5 L.u4, state noconstant noerror) /// + (u6 L.u5, state noconstant noerror) /// + (u7 L.u6, state noconstant noerror) /// + (u8 L.u7, state noconstant noerror) /// + (u9 L.u8, state noconstant noerror) /// + (u10 L.u9, state noconstant noerror) /// + (u11 L.u10, state noconstant noerror) /// + (u12 L.u11, state noconstant noerror) /// + (dlgdp u1, noconstant noerror) if ~missing(dlgdp), /// + constraints(1/12) covstate(diagonal) from (b) + +// Save the estimated states +predict est_u1-est_u12, states equation(u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11 u12) + +// Save the filtered states +predict u1-u12, states equation(u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11 u12) smethod(filter) + +// Save the standardized residuals +predict rstd, rstandard + +// Output +outsheet value u1-u12 est_u1-est_u12 rstd using results_realgdpar_stata.csv, comma replace diff --git a/shared/package-files/33/33b8b851998e03b691ce8a0dd7f1da9aa55defc920b59e97c80dddc5597a9db5/blob b/shared/package-files/33/33b8b851998e03b691ce8a0dd7f1da9aa55defc920b59e97c80dddc5597a9db5/blob new file mode 100644 index 0000000000000000000000000000000000000000..71d55eadc11c93a0cffaa78494f1598dc950f780 --- /dev/null +++ b/shared/package-files/33/33b8b851998e03b691ce8a0dd7f1da9aa55defc920b59e97c80dddc5597a9db5/blob @@ -0,0 +1,172 @@ +import ast +import itertools +import types +from collections import OrderedDict, Counter, defaultdict +from types import FrameType, TracebackType +from typing import ( + Iterator, List, Tuple, Iterable, Callable, Union, + TypeVar, Mapping, +) + +T = TypeVar('T') +R = TypeVar('R') + + +def truncate(seq, max_length: int, middle): + if len(seq) > max_length: + right = (max_length - len(middle)) // 2 + left = max_length - len(middle) - right + seq = seq[:left] + middle + seq[-right:] + return seq + + +def unique_in_order(it: Iterable[T]) -> List[T]: + return list(OrderedDict.fromkeys(it)) + + +def line_range(node: ast.AST) -> Tuple[int, int]: + """ + Returns a pair of numbers representing a half open range + (i.e. suitable as arguments to the `range()` builtin) + of line numbers of the given AST nodes. + """ + try: + return ( + node.first_token.start[0], + node.last_token.end[0] + 1, + ) + except AttributeError: + return ( + node.lineno, + getattr(node, "end_lineno", node.lineno) + 1, + ) + + +def highlight_unique(lst: List[T]) -> Iterator[Tuple[T, bool]]: + counts = Counter(lst) + + for is_common, group in itertools.groupby(lst, key=lambda x: counts[x] > 3): + if is_common: + group = list(group) + highlighted = [False] * len(group) + + def highlight_index(f): + try: + i = f() + except ValueError: + return None + highlighted[i] = True + return i + + for item in set(group): + first = highlight_index(lambda: group.index(item)) + if first is not None: + highlight_index(lambda: group.index(item, first + 1)) + highlight_index(lambda: -1 - group[::-1].index(item)) + else: + highlighted = itertools.repeat(True) + + yield from zip(group, highlighted) + + +def identity(x: T) -> T: + return x + + +def collapse_repeated(lst, *, collapser, mapper=identity, key=identity): + keyed = list(map(key, lst)) + for is_highlighted, group in itertools.groupby( + zip(lst, highlight_unique(keyed)), + key=lambda t: t[1][1], + ): + original_group, highlighted_group = zip(*group) + if is_highlighted: + yield from map(mapper, original_group) + else: + keyed_group, _ = zip(*highlighted_group) + yield collapser(list(original_group), list(keyed_group)) + + +def is_frame(frame_or_tb: Union[FrameType, TracebackType]) -> bool: + assert_(isinstance(frame_or_tb, (types.FrameType, types.TracebackType))) + return isinstance(frame_or_tb, (types.FrameType,)) + + +def iter_stack(frame_or_tb: Union[FrameType, TracebackType]) -> Iterator[Union[FrameType, TracebackType]]: + while frame_or_tb: + yield frame_or_tb + if is_frame(frame_or_tb): + frame_or_tb = frame_or_tb.f_back + else: + frame_or_tb = frame_or_tb.tb_next + + +def frame_and_lineno(frame_or_tb: Union[FrameType, TracebackType]) -> Tuple[FrameType, int]: + if is_frame(frame_or_tb): + return frame_or_tb, frame_or_tb.f_lineno + else: + return frame_or_tb.tb_frame, frame_or_tb.tb_lineno + + +def group_by_key_func(iterable: Iterable[T], key_func: Callable[[T], R]) -> Mapping[R, List[T]]: + # noinspection PyUnresolvedReferences + """ + Create a dictionary from an iterable such that the keys are the result of evaluating a key function on elements + of the iterable and the values are lists of elements all of which correspond to the key. + + >>> def si(d): return sorted(d.items()) + >>> si(group_by_key_func("a bb ccc d ee fff".split(), len)) + [(1, ['a', 'd']), (2, ['bb', 'ee']), (3, ['ccc', 'fff'])] + >>> si(group_by_key_func([-1, 0, 1, 3, 6, 8, 9, 2], lambda x: x % 2)) + [(0, [0, 6, 8, 2]), (1, [-1, 1, 3, 9])] + """ + result = defaultdict(list) + for item in iterable: + result[key_func(item)].append(item) + return result + + +class cached_property(object): + """ + A property that is only computed once per instance and then replaces itself + with an ordinary attribute. Deleting the attribute resets the property. + + Based on https://github.com/pydanny/cached-property/blob/master/cached_property.py + """ + + def __init__(self, func): + self.__doc__ = func.__doc__ + self.func = func + + def cached_property_wrapper(self, obj, _cls): + if obj is None: + return self + + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + __get__ = cached_property_wrapper + + +def _pygmented_with_ranges(formatter, code, ranges): + import pygments + from pygments.lexers import get_lexer_by_name + + class MyLexer(type(get_lexer_by_name("python3"))): + def get_tokens(self, text): + length = 0 + for ttype, value in super().get_tokens(text): + if any(start <= length < end for start, end in ranges): + ttype = ttype.ExecutingNode + length += len(value) + yield ttype, value + + lexer = MyLexer(stripnl=False) + return pygments.highlight(code, lexer, formatter).splitlines() + + +def assert_(condition, error=""): + if not condition: + if isinstance(error, str): + error = AssertionError(error) + raise error diff --git a/shared/package-files/33/33b8d33788102115a9900ad0475ddb23b58de96716f8069bc4a82b38746f7de4/blob b/shared/package-files/33/33b8d33788102115a9900ad0475ddb23b58de96716f8069bc4a82b38746f7de4/blob new file mode 100644 index 0000000000000000000000000000000000000000..fcc7000c215f8a7605a2a59b5767b27b2fcd969d --- /dev/null +++ b/shared/package-files/33/33b8d33788102115a9900ad0475ddb23b58de96716f8069bc4a82b38746f7de4/blob @@ -0,0 +1,19 @@ +# This file is not meant for public use and will be removed in SciPy v2.0.0. +# Use the `scipy.fftpack` namespace for importing the functions +# included below. + +from scipy._lib.deprecation import _sub_module_deprecation + +__all__ = [ # noqa: F822 + 'fftshift', 'ifftshift', 'fftfreq', 'rfftfreq', 'next_fast_len' +] + + +def __dir__(): + return __all__ + + +def __getattr__(name): + return _sub_module_deprecation(sub_package="fftpack", module="helper", + private_modules=["_helper"], all=__all__, + attribute=name) diff --git a/shared/package-files/33/33b9313dd9efcd1d65c564b3a3067361ebe03de97b3727c5e8bdbbf062b116c9/blob b/shared/package-files/33/33b9313dd9efcd1d65c564b3a3067361ebe03de97b3727c5e8bdbbf062b116c9/blob new file mode 100644 index 0000000000000000000000000000000000000000..c3476cfbc1ec210307330e7a349b85f9f8ccf3d0 --- /dev/null +++ b/shared/package-files/33/33b9313dd9efcd1d65c564b3a3067361ebe03de97b3727c5e8bdbbf062b116c9/blob @@ -0,0 +1,43 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace at { +namespace native { +struct TORCH_API structured_ufunc_add_CPU : public at::meta::structured_add_Tensor { +void impl(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, const at::Tensor & out); +}; +struct TORCH_API structured_ufunc_add_CUDA : public at::meta::structured_add_Tensor { +void impl(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, const at::Tensor & out); +}; +TORCH_API at::Tensor NestedTensor_add_Tensor(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & NestedTensor_add__Tensor(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor add_sparse(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & add_out_sparse_cpu(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out); +TORCH_API at::Tensor & add_sparse_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & add_out_sparse_cuda(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out); +TORCH_API at::Tensor add_sparse_csr(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & add_out_sparse_compressed_cpu(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out); +TORCH_API at::Tensor & add_sparse_csr_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & add_out_sparse_compressed_cuda(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out); +TORCH_API at::Tensor mkldnn_add(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & mkldnn_add_out(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out); +TORCH_API at::Tensor & mkldnn_add_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor add_zerotensor(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor add(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1); +TORCH_API at::Tensor & add_Scalar_out(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out); +TORCH_API at::Tensor & add_(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1); +} // namespace native +} // namespace at diff --git a/shared/package-files/33/33b99bf55ddfe4952eb7cc9ff147cbdeb1b85cfafe2ebebdd831a3935391f5de/blob b/shared/package-files/33/33b99bf55ddfe4952eb7cc9ff147cbdeb1b85cfafe2ebebdd831a3935391f5de/blob new file mode 100644 index 0000000000000000000000000000000000000000..51e147387fa218e3269958debaae49027f390e43 --- /dev/null +++ b/shared/package-files/33/33b99bf55ddfe4952eb7cc9ff147cbdeb1b85cfafe2ebebdd831a3935391f5de/blob @@ -0,0 +1 @@ +from email.mime.text import * diff --git a/shared/package-files/33/33ba4d691a4e44278747073f1eb3e3540c6a24bf31c857ba1ecec3092987f1ef/blob b/shared/package-files/33/33ba4d691a4e44278747073f1eb3e3540c6a24bf31c857ba1ecec3092987f1ef/blob new file mode 100644 index 0000000000000000000000000000000000000000..df9b86ee1d32b675faa21b5c081d961d165f7afc --- /dev/null +++ b/shared/package-files/33/33ba4d691a4e44278747073f1eb3e3540c6a24bf31c857ba1ecec3092987f1ef/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33ba4d691a4e44278747073f1eb3e3540c6a24bf31c857ba1ecec3092987f1ef +size 127136 diff --git a/shared/package-files/33/33bac34d3d7d2b1a6e4fdd7ec4142b60a5fd9f75edefe3e55b18311dec5bd324/blob b/shared/package-files/33/33bac34d3d7d2b1a6e4fdd7ec4142b60a5fd9f75edefe3e55b18311dec5bd324/blob new file mode 100644 index 0000000000000000000000000000000000000000..c0b2e1a0c1e471b062623f236811c9caa9fbbc8d --- /dev/null +++ b/shared/package-files/33/33bac34d3d7d2b1a6e4fdd7ec4142b60a5fd9f75edefe3e55b18311dec5bd324/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API quantize_per_tensor_dynamic { + using schema = at::Tensor (const at::Tensor &, at::ScalarType, bool); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::quantize_per_tensor_dynamic") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "quantize_per_tensor_dynamic(Tensor self, ScalarType dtype, bool reduce_range) -> Tensor") + static at::Tensor call(const at::Tensor & self, at::ScalarType dtype, bool reduce_range); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::ScalarType dtype, bool reduce_range); +}; + +struct TORCH_API quantize_per_tensor_dynamic_out { + using schema = at::Tensor & (const at::Tensor &, at::ScalarType, bool, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::quantize_per_tensor_dynamic") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "quantize_per_tensor_dynamic.out(Tensor self, ScalarType dtype, bool reduce_range, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::ScalarType dtype, bool reduce_range, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::ScalarType dtype, bool reduce_range, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/33/33be7b7e8fa4fd19b1760e1a8ed8a668bdab852c91b692dd41424bcb725a9fca/blob b/shared/package-files/33/33be7b7e8fa4fd19b1760e1a8ed8a668bdab852c91b692dd41424bcb725a9fca/blob new file mode 100644 index 0000000000000000000000000000000000000000..7ec568c1136eb8ec86aa05cf7abacfb54c3e5ead --- /dev/null +++ b/shared/package-files/33/33be7b7e8fa4fd19b1760e1a8ed8a668bdab852c91b692dd41424bcb725a9fca/blob @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Seth Michael Larson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/shared/package-files/33/33c21552f0cae8e6b588bc942fbaca4525079f0570c6541cfba6130458fee33e/blob b/shared/package-files/33/33c21552f0cae8e6b588bc942fbaca4525079f0570c6541cfba6130458fee33e/blob new file mode 100644 index 0000000000000000000000000000000000000000..567d20779158cf2ecd6ba26885c85801be37f56e --- /dev/null +++ b/shared/package-files/33/33c21552f0cae8e6b588bc942fbaca4525079f0570c6541cfba6130458fee33e/blob @@ -0,0 +1,21 @@ +#pragma once + +// @generated by torchgen/gen.py from NativeFunction.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace at { +namespace native { +TORCH_API at::Tensor max_pool3d(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride={}, at::IntArrayRef padding=0, at::IntArrayRef dilation=1, bool ceil_mode=false); +} // namespace native +} // namespace at diff --git a/shared/package-files/33/33c2db3f3248bbd8e5f8a37698e1c14de9d2a89a4fe2bb3c7fb7f4775096af51/blob b/shared/package-files/33/33c2db3f3248bbd8e5f8a37698e1c14de9d2a89a4fe2bb3c7fb7f4775096af51/blob new file mode 100644 index 0000000000000000000000000000000000000000..884f739e27813a38e8364469bb9659c09ea410b3 --- /dev/null +++ b/shared/package-files/33/33c2db3f3248bbd8e5f8a37698e1c14de9d2a89a4fe2bb3c7fb7f4775096af51/blob @@ -0,0 +1,42 @@ +from typing import TypeVar, Union, Tuple, Optional +from .. import Tensor + +# Create some useful type aliases + +# Template for arguments which can be supplied as a tuple, or which can be a scalar which PyTorch will internally +# broadcast to a tuple. +# Comes in several variants: A tuple of unknown size, and a fixed-size tuple for 1d, 2d, or 3d operations. +T = TypeVar('T') +_scalar_or_tuple_any_t = Union[T, Tuple[T, ...]] +_scalar_or_tuple_1_t = Union[T, Tuple[T]] +_scalar_or_tuple_2_t = Union[T, Tuple[T, T]] +_scalar_or_tuple_3_t = Union[T, Tuple[T, T, T]] +_scalar_or_tuple_4_t = Union[T, Tuple[T, T, T, T]] +_scalar_or_tuple_5_t = Union[T, Tuple[T, T, T, T, T]] +_scalar_or_tuple_6_t = Union[T, Tuple[T, T, T, T, T, T]] + +# For arguments which represent size parameters (eg, kernel size, padding) +_size_any_t = _scalar_or_tuple_any_t[int] +_size_1_t = _scalar_or_tuple_1_t[int] +_size_2_t = _scalar_or_tuple_2_t[int] +_size_3_t = _scalar_or_tuple_3_t[int] +_size_4_t = _scalar_or_tuple_4_t[int] +_size_5_t = _scalar_or_tuple_5_t[int] +_size_6_t = _scalar_or_tuple_6_t[int] + +# For arguments which represent optional size parameters (eg, adaptive pool parameters) +_size_any_opt_t = _scalar_or_tuple_any_t[Optional[int]] +_size_2_opt_t = _scalar_or_tuple_2_t[Optional[int]] +_size_3_opt_t = _scalar_or_tuple_3_t[Optional[int]] + +# For arguments that represent a ratio to adjust each dimension of an input with (eg, upsampling parameters) +_ratio_2_t = _scalar_or_tuple_2_t[float] +_ratio_3_t = _scalar_or_tuple_3_t[float] +_ratio_any_t = _scalar_or_tuple_any_t[float] + +_tensor_list_t = _scalar_or_tuple_any_t[Tensor] + +# For the return value of max pooling operations that may or may not return indices. +# With the proposed 'Literal' feature to Python typing, it might be possible to +# eventually eliminate this. +_maybe_indices_t = _scalar_or_tuple_2_t[Tensor] diff --git a/shared/package-files/33/33c6072a006ba4e9513d7b7fd3d08b1c745ca1079b6d796c36b2a5ae8e4ae02b/blob b/shared/package-files/33/33c6072a006ba4e9513d7b7fd3d08b1c745ca1079b6d796c36b2a5ae8e4ae02b/blob new file mode 100644 index 0000000000000000000000000000000000000000..b7edcaf38f42902061c0cf53d14afdaa712aabc0 --- /dev/null +++ b/shared/package-files/33/33c6072a006ba4e9513d7b7fd3d08b1c745ca1079b6d796c36b2a5ae8e4ae02b/blob @@ -0,0 +1,20 @@ +# Encoding file: iso8859-13, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0201D00A200A300A4201E00A600A700D800A9015600AB00AC00AD00AE00C6 +00B000B100B200B3201C00B500B600B700F800B9015700BB00BC00BD00BE00E6 +0104012E0100010600C400C501180112010C00C90179011601220136012A013B +01600143014500D3014C00D500D600D701720141015A016A00DC017B017D00DF +0105012F0101010700E400E501190113010D00E9017A011701230137012B013C +01610144014600F3014D00F500F600F701730142015B016B00FC017C017E2019 diff --git a/shared/package-files/33/33c6c4471664084bae63a40669ed01fc0895dce9f3858f7c85a64b121adeb925/blob b/shared/package-files/33/33c6c4471664084bae63a40669ed01fc0895dce9f3858f7c85a64b121adeb925/blob new file mode 100644 index 0000000000000000000000000000000000000000..c11ead7086ad24eeb1d095134ba1ce1e5242e42d --- /dev/null +++ b/shared/package-files/33/33c6c4471664084bae63a40669ed01fc0895dce9f3858f7c85a64b121adeb925/blob @@ -0,0 +1,447 @@ +clear +tempname filename +local filename = "M:\josef_new\stata_work\results_glm_poisson_weights.py" + +insheet using M:\josef_new\eclipse_ws\statsmodels\statsmodels_py34_pr\statsmodels\datasets\cpunish\cpunish.csv +generate LN_VC100k96 = log(vc100k96) +generate var10 = 1 in 1 +replace var10 = 1 in 2 +replace var10 = 1 in 3 +replace var10 = 2 in 4 +replace var10 = 2 in 5 +replace var10 = 2 in 6 +replace var10 = 3 in 7 +replace var10 = 3 in 8 +replace var10 = 3 in 9 +replace var10 = 1 in 10 +replace var10 = 1 in 11 +replace var10 = 1 in 12 +replace var10 = 2 in 13 +replace var10 = 2 in 14 +replace var10 = 2 in 15 +replace var10 = 3 in 16 +replace var10 = 3 in 17 +label variable var10 "fweight" +rename var10 fweight +label variable LN_VC100k96 "LN_VC100k96" + +/* for checkin Poisson produces the same, poisson does not allow aweights */ +/*poisson executions income perpoverty perblack LN_VC100k96 south degree */ + + +glm executions income perpoverty perblack LN_VC100k96 south degree, family(poisson) + +/* copied from glm_logit_constrained.do */ +/*glm grade gpa tuce psi, family(binomial) constraints(2) */ + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +predict predict_hat, hat + +predict score_factor, score +predict resid_anscombe, anscombe +predict resid_deviance, deviance +predict resid_response, response +predict resid_pearson, pearson +predict resid_working, working + +local pred predict_mu predict_linpred_std predict_hat +local res score_factor resid_response resid_anscombe resid_deviance resid_pearson resid_working +mkmat `res', matrix(resids) +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted resids, saving(`filename') format("%16.0g") resname("poisson_none_nonrobust") replace +/*------------------*/ + +drop `pred' `res' + + +glm executions income perpoverty perblack LN_VC100k96 south degree [fweight=fweight], family(poisson) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +predict predict_hat, hat + +predict score_factor, score +predict resid_anscombe, anscombe +predict resid_deviance, deviance +predict resid_response, response +predict resid_pearson, pearson +predict resid_working, working + +local pred predict_mu predict_linpred_std predict_hat +local res score_factor resid_response resid_anscombe resid_deviance resid_pearson resid_working +mkmat `res', matrix(resids) +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted resids, saving(`filename') format("%16.0g") resname("poisson_fweight_nonrobust") append + +/*------------------*/ + +drop `pred' `res' + +glm executions income perpoverty perblack LN_VC100k96 south degree [aweight=fweight], family(poisson) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +predict predict_hat, hat + +predict score_factor, score +predict resid_anscombe, anscombe +predict resid_deviance, deviance +predict resid_response, response +predict resid_pearson, pearson +predict resid_working, working + +local pred predict_mu predict_linpred_std predict_hat +local res score_factor resid_response resid_anscombe resid_deviance resid_pearson resid_working +mkmat `res', matrix(resids) +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted resids, saving(`filename') format("%16.0g") resname("poisson_aweight_nonrobust") append +/*------------------*/ + + +drop `pred' `res' + +glm executions income perpoverty perblack LN_VC100k96 south degree [pweight=fweight], family(poisson) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) + +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat not allowed after robust, pweights implies HC1 + +predict score_factor, score +predict resid_anscombe, anscombe +predict resid_deviance, deviance +predict resid_response, response +predict resid_pearson, pearson +predict resid_working, working + +local pred predict_mu predict_linpred_std //predict_hat +local res score_factor resid_response resid_anscombe resid_deviance resid_pearson resid_working +mkmat `res', matrix(resids) +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted resids, saving(`filename') format("%16.0g") resname("poisson_pweight_nonrobust") append +/*------------------*/ + +/*******************************************************************/ +/*********** next with robust = HC1, do not save resid and similar */ + +drop `pred' `res' +glm executions income perpoverty perblack LN_VC100k96 south degree, family(poisson) vce(robust) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_none_hc1") append +/*------------------*/ + +drop `pred' + +glm executions income perpoverty perblack LN_VC100k96 south degree [fweight=fweight], family(poisson) vce(robust) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_fweight_hc1") append +/*------------------*/ + +drop `pred' + +glm executions income perpoverty perblack LN_VC100k96 south degree [aweight=fweight], family(poisson) vce(robust) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_aweight_hc1") append +/*------------------*/ + + +drop `pred' + +glm executions income perpoverty perblack LN_VC100k96 south degree [pweight=fweight], family(poisson) vce(robust) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_pweight_hc1") append +/*------------------*/ + + + + +/*****************************************************************/ +/*************************** with cluster robust standard errors */ +gen id = (_n - mod(_n, 2)) / 2 + +drop `pred' +glm executions income perpoverty perblack LN_VC100k96 south degree, family(poisson) vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_none_clu1") append +/*------------------*/ + +drop `pred' + +glm executions income perpoverty perblack LN_VC100k96 south degree [fweight=fweight], family(poisson) vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_fweight_clu1") append +/*------------------*/ + +drop `pred' + +glm executions income perpoverty perblack LN_VC100k96 south degree [aweight=fweight], family(poisson) vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_aweight_clu1") append +/*------------------*/ + + +drop `pred' + +glm executions income perpoverty perblack LN_VC100k96 south degree [pweight=fweight], family(poisson) vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, mu +predict predict_linpred_std, stdp +//predict predict_hat, hat + +local pred predict_mu predict_linpred_std //predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("poisson_pweight_clu1") append +/*------------------*/ + + + +/*****************************************************************/ +/* +gen idn = _n +glm executions income perpoverty perblack LN_VC100k96 south degree, family(poisson) vce(cluster idn) +*/ + +/* +glm grade gpa tuce psi, family(binomial) constraints(2) vce(robust) +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +estmat2nparray params_table cov infocrit, saving(`filename') format("%16.0g") resname("constraint2_robust") append +/*------------------*/ + + +capture drop fittedvalues fittedvalues_se +predict fittedvalues, xb +predict fittedvalues_se, stdp +outsheet fittedvalues fittedvalues_se using theil_predict.csv, comma replace +/*------------------*/ + +glm executions income perpoverty perblack LN_VC100k96 south degree [aweight=fweight], family(poisson) +predict resid_deviance_aw, deviance + + +*/ + +/*------------------*/ + +drop `pred' + +regress executions income perpoverty perblack LN_VC100k96 south degree [aweight=fweight], vce(robust) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, xb +predict predict_std, stdp +//predict predict_stf, stdf +//predict predict_str, stdr +//predict predict_hat, hat + +local pred predict_mu predict_std //predict_stf predict_str predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("wls_aweight_robust") append +/*------------------*/ + +drop `pred' + +regress executions income perpoverty perblack LN_VC100k96 south degree [aweight=fweight], vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, xb +predict predict_std, stdp +//predict predict_stf, stdf +//predict predict_str, stdr +//predict predict_hat, hat + +local pred predict_mu predict_std //predict_stf predict_str predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("wls_aweight_clu1") append +/*------------------*/ + + +drop `pred' + +regress executions income perpoverty perblack LN_VC100k96 south degree [fweight=fweight], vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, xb +predict predict_std, stdp +//predict predict_stf, stdf +//predict predict_str, stdr +//predict predict_hat, hat + +local pred predict_mu predict_std //predict_stf predict_str predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("wls_fweight_clu1") append +/*------------------*/ + +drop `pred' + +regress executions income perpoverty perblack LN_VC100k96 south degree [pweight=fweight], vce(cluster id) + +/* boiler plate, add matrices if needed */ +tempname cov +tempname params_table +matrix cov = e(V) +matrix params_table = r(table)' +estat ic +matrix infocrit = r(S) +predict predict_mu, xb +predict predict_std, stdp +//predict predict_stf, stdf +//predict predict_str, stdr +//predict predict_hat, hat + +local pred predict_mu predict_std //predict_stf predict_str predict_hat +mkmat `pred', matrix(predicted) +estmat2nparray params_table cov infocrit predicted, saving(`filename') format("%16.0g") resname("wls_pweight_clu1") append +/*------------------*/ + +drop `pred' diff --git a/shared/package-files/33/33c88db77b21c0b213cbf2c544db2a0505c23204bad032d0819d3ac09b91bcd7/blob b/shared/package-files/33/33c88db77b21c0b213cbf2c544db2a0505c23204bad032d0819d3ac09b91bcd7/blob new file mode 100644 index 0000000000000000000000000000000000000000..302b238af6ff5d3b7c9a008a35bfc57b7d5fc780 --- /dev/null +++ b/shared/package-files/33/33c88db77b21c0b213cbf2c544db2a0505c23204bad032d0819d3ac09b91bcd7/blob @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor cdist(const at::Tensor & x1, const at::Tensor & x2, double p=2, c10::optional compute_mode=c10::nullopt); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/33/33cbd6ae945ba04969370ab35604e9363c87256393493382b5118a89d59386d6/blob b/shared/package-files/33/33cbd6ae945ba04969370ab35604e9363c87256393493382b5118a89d59386d6/blob new file mode 100644 index 0000000000000000000000000000000000000000..6df4cf0dadbf96e017651f1c81384927b007ad96 Binary files /dev/null and b/shared/package-files/33/33cbd6ae945ba04969370ab35604e9363c87256393493382b5118a89d59386d6/blob differ diff --git a/shared/package-files/33/33d0fec1b11c7512f13f1c7e6700a1a8a5f1f5323584be4614b8a97d86d11d76/blob b/shared/package-files/33/33d0fec1b11c7512f13f1c7e6700a1a8a5f1f5323584be4614b8a97d86d11d76/blob new file mode 100644 index 0000000000000000000000000000000000000000..697a66dc3ee91a22ae2503852db04dbba2fc74d4 --- /dev/null +++ b/shared/package-files/33/33d0fec1b11c7512f13f1c7e6700a1a8a5f1f5323584be4614b8a97d86d11d76/blob @@ -0,0 +1,10 @@ +#ifndef THCP_H +#define THCP_H + +#include +#include +#include +#include +#include + +#endif diff --git a/shared/package-files/33/33d1f3f8b0878376a965596fa5de1c42dc01f45c3240f088b588591a4d938138/blob b/shared/package-files/33/33d1f3f8b0878376a965596fa5de1c42dc01f45c3240f088b588591a4d938138/blob new file mode 100644 index 0000000000000000000000000000000000000000..c2e61f280bf5922e911cdbc180a3503d75d8a06f --- /dev/null +++ b/shared/package-files/33/33d1f3f8b0878376a965596fa5de1c42dc01f45c3240f088b588591a4d938138/blob @@ -0,0 +1,139 @@ +#include +#include +#include + +#ifdef USE_FBGEMM +#include +#endif + +namespace at::native { + +void check_arguments( + const Tensor& weight, + const Tensor& indices, + const Tensor& offsets, + const int64_t mode, + const c10::optional& per_sample_weights, + bool include_last_offset); + +void make_bag_size_out( + Tensor& bag_size_out, + const Tensor& offsets, + const Tensor& indices, + const int64_t mode, + const bool include_last_offset, + const bool requires_grad); + +void make_max_indices_out( + Tensor& max_indices_out, + const Tensor& weight, + const Tensor& indices, + const Tensor& offsets, + const Tensor& bag_size, + const int64_t mode, + bool include_last_offset); + +void make_offset2bag_out( + Tensor& offset2bag, + Tensor& output, + const Tensor& weight, + const Tensor& indices, + const Tensor& offsets, + const int64_t mode, + const c10::optional& per_sample_weights, + const int64_t padding_idx = -1); + +#ifdef USE_FBGEMM + +template +struct _CallbackAndBlockSize { + using TCallback = typename fbgemm::EmbeddingSpMDMKernelSignature::Type; + + int64_t blockSize = -1; + TCallback callback = nullptr; + + static TCallback generateCallback(int64_t block_size) { + return fbgemm::GenerateEmbeddingSpMDM( + block_size, + has_weight, + /* normalize_by_lengths */false, + /* prefetch */16, + /* is_weight_positional */false, + /* use_offsets */true); + } + + _CallbackAndBlockSize() = default; + + explicit _CallbackAndBlockSize(c10::optional maybe_block_size) + : blockSize(maybe_block_size.value_or(-1)) + , callback(maybe_block_size.has_value() ? generateCallback(maybe_block_size.value()) : nullptr) + {} +}; + +template +struct _EmbeddingBagKernelCacheImpl : private StorageMixins... { + + _EmbeddingBagKernelCacheImpl() = default; + // use each of the mixins to store corresponding kernel and block size + explicit _EmbeddingBagKernelCacheImpl(c10::optional maybe_block_size) + : StorageMixins(maybe_block_size)... + {} + + // this method is thread safe (call sites may call from different threads) + template + typename _CallbackAndBlockSize::TCallback + getCallback(int64_t block_size) const { + // if the cache doesn't store the kernel for the incoming block size + // (so it is different from the one stored in corresponding mixin) + // regenerate the kernel (not writing it into the cache so we avoid locks) + if (block_size != _CallbackAndBlockSize::blockSize) { + return _CallbackAndBlockSize::generateCallback(block_size); + } + // else retrieve the cached kernel from the corresponding mixin + return _CallbackAndBlockSize::callback; + } +}; + +// instantiate the cache with the list of storage mixins +// for each of the 8 _EmbeddingBagKernelCache* usages in the EmbeddingBag.cpp impl file +using _EmbeddingBagKernelCache = _EmbeddingBagKernelCacheImpl< + _CallbackAndBlockSize, + _CallbackAndBlockSize, + _CallbackAndBlockSize, + _CallbackAndBlockSize, + _CallbackAndBlockSize, + _CallbackAndBlockSize, + _CallbackAndBlockSize, + _CallbackAndBlockSize>; +#else +struct _EmbeddingBagKernelCache { + explicit _EmbeddingBagKernelCache(c10::optional /* maybe_block_size */) {} +}; +#endif + +void _embedding_bag_cpu_impl_out(Tensor& output, Tensor& offset2bag, + Tensor& bag_size, Tensor* max_indices, + const Tensor &weight, const Tensor &indices, + const Tensor &offsets, const int64_t mode = 0, + const c10::optional& per_sample_weights = c10::nullopt, + bool include_last_offset = false, + int64_t padding_idx = -1, + _EmbeddingBagKernelCache* fbgemm_kernel_cache = nullptr); + +void _embedding_bag_cpu_out( + at::Tensor& output, + at::Tensor& offset2bag, + at::Tensor& bag_size, + at::Tensor* p_max_indices, + const at::Tensor& weight, + const at::Tensor& indices, + const at::Tensor& offsets, + const bool scale_grad_by_freq, + const int64_t mode, + const bool sparse, + const c10::optional& per_sample_weights, + const bool include_last_offset, + const c10::optional& padding_idx, + _EmbeddingBagKernelCache* fbgemm_kernel_cache = nullptr); + +} // namespace at::native diff --git a/shared/package-files/33/33d39e477f65dfe0c625206bf382159a760ca4cb3fdf155f0a049247cbbb9be9/blob b/shared/package-files/33/33d39e477f65dfe0c625206bf382159a760ca4cb3fdf155f0a049247cbbb9be9/blob new file mode 100644 index 0000000000000000000000000000000000000000..1e38baf4fc4093879b850f03d746ae5e67b477ee --- /dev/null +++ b/shared/package-files/33/33d39e477f65dfe0c625206bf382159a760ca4cb3fdf155f0a049247cbbb9be9/blob @@ -0,0 +1,34 @@ +from io import StringIO + +import pytest + +from pandas import read_sas +import pandas._testing as tm + + +class TestSas: + def test_sas_buffer_format(self): + # see gh-14947 + b = StringIO("") + + msg = ( + "If this is a buffer object rather than a string " + "name, you must specify a format string" + ) + with pytest.raises(ValueError, match=msg): + read_sas(b) + + def test_sas_read_no_format_or_extension(self): + # see gh-24548 + msg = "unable to infer format of SAS file.+" + with tm.ensure_clean("test_file_no_extension") as path: + with pytest.raises(ValueError, match=msg): + read_sas(path) + + +def test_sas_archive(datapath): + fname_uncompressed = datapath("io", "sas", "data", "airline.sas7bdat") + df_uncompressed = read_sas(fname_uncompressed) + fname_compressed = datapath("io", "sas", "data", "airline.sas7bdat.gz") + df_compressed = read_sas(fname_compressed, format="sas7bdat") + tm.assert_frame_equal(df_uncompressed, df_compressed) diff --git a/shared/package-files/33/33d3edc009158d1bf1353165440929e8403935776c16bfaa775f97466f8a8ac3/blob b/shared/package-files/33/33d3edc009158d1bf1353165440929e8403935776c16bfaa775f97466f8a8ac3/blob new file mode 100644 index 0000000000000000000000000000000000000000..a7976fbe3ed924efda902f221899e35147e6c5ec --- /dev/null +++ b/shared/package-files/33/33d3edc009158d1bf1353165440929e8403935776c16bfaa775f97466f8a8ac3/blob @@ -0,0 +1,788 @@ +"""distutils.msvc9compiler + +Contains MSVCCompiler, an implementation of the abstract CCompiler class +for the Microsoft Visual Studio 2008. + +The module is compatible with VS 2005 and VS 2008. You can find legacy support +for older versions of VS in distutils.msvccompiler. +""" + +# Written by Perry Stoll +# hacked by Robin Becker and Thomas Heller to do a better job of +# finding DevStudio (through the registry) +# ported to VS2005 and VS 2008 by Christian Heimes + +import os +import subprocess +import sys +import re + +from distutils.errors import DistutilsExecError, DistutilsPlatformError, \ + CompileError, LibError, LinkError +from distutils.ccompiler import CCompiler, gen_lib_options +from distutils import log +from distutils.util import get_platform + +import winreg + +RegOpenKeyEx = winreg.OpenKeyEx +RegEnumKey = winreg.EnumKey +RegEnumValue = winreg.EnumValue +RegError = winreg.error + +HKEYS = (winreg.HKEY_USERS, + winreg.HKEY_CURRENT_USER, + winreg.HKEY_LOCAL_MACHINE, + winreg.HKEY_CLASSES_ROOT) + +NATIVE_WIN64 = (sys.platform == 'win32' and sys.maxsize > 2**32) +if NATIVE_WIN64: + # Visual C++ is a 32-bit application, so we need to look in + # the corresponding registry branch, if we're running a + # 64-bit Python on Win64 + VS_BASE = r"Software\Wow6432Node\Microsoft\VisualStudio\%0.1f" + WINSDK_BASE = r"Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows" + NET_BASE = r"Software\Wow6432Node\Microsoft\.NETFramework" +else: + VS_BASE = r"Software\Microsoft\VisualStudio\%0.1f" + WINSDK_BASE = r"Software\Microsoft\Microsoft SDKs\Windows" + NET_BASE = r"Software\Microsoft\.NETFramework" + +# A map keyed by get_platform() return values to values accepted by +# 'vcvarsall.bat'. Note a cross-compile may combine these (eg, 'x86_amd64' is +# the param to cross-compile on x86 targeting amd64.) +PLAT_TO_VCVARS = { + 'win32' : 'x86', + 'win-amd64' : 'amd64', +} + +class Reg: + """Helper class to read values from the registry + """ + + def get_value(cls, path, key): + for base in HKEYS: + d = cls.read_values(base, path) + if d and key in d: + return d[key] + raise KeyError(key) + get_value = classmethod(get_value) + + def read_keys(cls, base, key): + """Return list of registry keys.""" + try: + handle = RegOpenKeyEx(base, key) + except RegError: + return None + L = [] + i = 0 + while True: + try: + k = RegEnumKey(handle, i) + except RegError: + break + L.append(k) + i += 1 + return L + read_keys = classmethod(read_keys) + + def read_values(cls, base, key): + """Return dict of registry keys and values. + + All names are converted to lowercase. + """ + try: + handle = RegOpenKeyEx(base, key) + except RegError: + return None + d = {} + i = 0 + while True: + try: + name, value, type = RegEnumValue(handle, i) + except RegError: + break + name = name.lower() + d[cls.convert_mbcs(name)] = cls.convert_mbcs(value) + i += 1 + return d + read_values = classmethod(read_values) + + def convert_mbcs(s): + dec = getattr(s, "decode", None) + if dec is not None: + try: + s = dec("mbcs") + except UnicodeError: + pass + return s + convert_mbcs = staticmethod(convert_mbcs) + +class MacroExpander: + + def __init__(self, version): + self.macros = {} + self.vsbase = VS_BASE % version + self.load_macros(version) + + def set_macro(self, macro, path, key): + self.macros["$(%s)" % macro] = Reg.get_value(path, key) + + def load_macros(self, version): + self.set_macro("VCInstallDir", self.vsbase + r"\Setup\VC", "productdir") + self.set_macro("VSInstallDir", self.vsbase + r"\Setup\VS", "productdir") + self.set_macro("FrameworkDir", NET_BASE, "installroot") + try: + if version >= 8.0: + self.set_macro("FrameworkSDKDir", NET_BASE, + "sdkinstallrootv2.0") + else: + raise KeyError("sdkinstallrootv2.0") + except KeyError: + raise DistutilsPlatformError( + """Python was built with Visual Studio 2008; +extensions must be built with a compiler than can generate compatible binaries. +Visual Studio 2008 was not found on this system. If you have Cygwin installed, +you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""") + + if version >= 9.0: + self.set_macro("FrameworkVersion", self.vsbase, "clr version") + self.set_macro("WindowsSdkDir", WINSDK_BASE, "currentinstallfolder") + else: + p = r"Software\Microsoft\NET Framework Setup\Product" + for base in HKEYS: + try: + h = RegOpenKeyEx(base, p) + except RegError: + continue + key = RegEnumKey(h, 0) + d = Reg.get_value(base, r"%s\%s" % (p, key)) + self.macros["$(FrameworkVersion)"] = d["version"] + + def sub(self, s): + for k, v in self.macros.items(): + s = s.replace(k, v) + return s + +def get_build_version(): + """Return the version of MSVC that was used to build Python. + + For Python 2.3 and up, the version number is included in + sys.version. For earlier versions, assume the compiler is MSVC 6. + """ + prefix = "MSC v." + i = sys.version.find(prefix) + if i == -1: + return 6 + i = i + len(prefix) + s, rest = sys.version[i:].split(" ", 1) + majorVersion = int(s[:-2]) - 6 + if majorVersion >= 13: + # v13 was skipped and should be v14 + majorVersion += 1 + minorVersion = int(s[2:3]) / 10.0 + # I don't think paths are affected by minor version in version 6 + if majorVersion == 6: + minorVersion = 0 + if majorVersion >= 6: + return majorVersion + minorVersion + # else we don't know what version of the compiler this is + return None + +def normalize_and_reduce_paths(paths): + """Return a list of normalized paths with duplicates removed. + + The current order of paths is maintained. + """ + # Paths are normalized so things like: /a and /a/ aren't both preserved. + reduced_paths = [] + for p in paths: + np = os.path.normpath(p) + # XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set. + if np not in reduced_paths: + reduced_paths.append(np) + return reduced_paths + +def removeDuplicates(variable): + """Remove duplicate values of an environment variable. + """ + oldList = variable.split(os.pathsep) + newList = [] + for i in oldList: + if i not in newList: + newList.append(i) + newVariable = os.pathsep.join(newList) + return newVariable + +def find_vcvarsall(version): + """Find the vcvarsall.bat file + + At first it tries to find the productdir of VS 2008 in the registry. If + that fails it falls back to the VS90COMNTOOLS env var. + """ + vsbase = VS_BASE % version + try: + productdir = Reg.get_value(r"%s\Setup\VC" % vsbase, + "productdir") + except KeyError: + log.debug("Unable to find productdir in registry") + productdir = None + + if not productdir or not os.path.isdir(productdir): + toolskey = "VS%0.f0COMNTOOLS" % version + toolsdir = os.environ.get(toolskey, None) + + if toolsdir and os.path.isdir(toolsdir): + productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC") + productdir = os.path.abspath(productdir) + if not os.path.isdir(productdir): + log.debug("%s is not a valid directory" % productdir) + return None + else: + log.debug("Env var %s is not set or invalid" % toolskey) + if not productdir: + log.debug("No productdir found") + return None + vcvarsall = os.path.join(productdir, "vcvarsall.bat") + if os.path.isfile(vcvarsall): + return vcvarsall + log.debug("Unable to find vcvarsall.bat") + return None + +def query_vcvarsall(version, arch="x86"): + """Launch vcvarsall.bat and read the settings from its environment + """ + vcvarsall = find_vcvarsall(version) + interesting = {"include", "lib", "libpath", "path"} + result = {} + + if vcvarsall is None: + raise DistutilsPlatformError("Unable to find vcvarsall.bat") + log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version) + popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + try: + stdout, stderr = popen.communicate() + if popen.wait() != 0: + raise DistutilsPlatformError(stderr.decode("mbcs")) + + stdout = stdout.decode("mbcs") + for line in stdout.split("\n"): + line = Reg.convert_mbcs(line) + if '=' not in line: + continue + line = line.strip() + key, value = line.split('=', 1) + key = key.lower() + if key in interesting: + if value.endswith(os.pathsep): + value = value[:-1] + result[key] = removeDuplicates(value) + + finally: + popen.stdout.close() + popen.stderr.close() + + if len(result) != len(interesting): + raise ValueError(str(list(result.keys()))) + + return result + +# More globals +VERSION = get_build_version() +if VERSION < 8.0: + raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION) +# MACROS = MacroExpander(VERSION) + +class MSVCCompiler(CCompiler) : + """Concrete class that implements an interface to Microsoft Visual C++, + as defined by the CCompiler abstract class.""" + + compiler_type = 'msvc' + + # Just set this so CCompiler's constructor doesn't barf. We currently + # don't use the 'set_executables()' bureaucracy provided by CCompiler, + # as it really isn't necessary for this sort of single-compiler class. + # Would be nice to have a consistent interface with UnixCCompiler, + # though, so it's worth thinking about. + executables = {} + + # Private class data (need to distinguish C from C++ source for compiler) + _c_extensions = ['.c'] + _cpp_extensions = ['.cc', '.cpp', '.cxx'] + _rc_extensions = ['.rc'] + _mc_extensions = ['.mc'] + + # Needed for the filename generation methods provided by the + # base class, CCompiler. + src_extensions = (_c_extensions + _cpp_extensions + + _rc_extensions + _mc_extensions) + res_extension = '.res' + obj_extension = '.obj' + static_lib_extension = '.lib' + shared_lib_extension = '.dll' + static_lib_format = shared_lib_format = '%s%s' + exe_extension = '.exe' + + def __init__(self, verbose=0, dry_run=0, force=0): + CCompiler.__init__ (self, verbose, dry_run, force) + self.__version = VERSION + self.__root = r"Software\Microsoft\VisualStudio" + # self.__macros = MACROS + self.__paths = [] + # target platform (.plat_name is consistent with 'bdist') + self.plat_name = None + self.__arch = None # deprecated name + self.initialized = False + + def initialize(self, plat_name=None): + # multi-init means we would need to check platform same each time... + assert not self.initialized, "don't init multiple times" + if plat_name is None: + plat_name = get_platform() + # sanity check for platforms to prevent obscure errors later. + ok_plats = 'win32', 'win-amd64' + if plat_name not in ok_plats: + raise DistutilsPlatformError("--plat-name must be one of %s" % + (ok_plats,)) + + if "DISTUTILS_USE_SDK" in os.environ and "MSSdk" in os.environ and self.find_exe("cl.exe"): + # Assume that the SDK set up everything alright; don't try to be + # smarter + self.cc = "cl.exe" + self.linker = "link.exe" + self.lib = "lib.exe" + self.rc = "rc.exe" + self.mc = "mc.exe" + else: + # On x86, 'vcvars32.bat amd64' creates an env that doesn't work; + # to cross compile, you use 'x86_amd64'. + # On AMD64, 'vcvars32.bat amd64' is a native build env; to cross + # compile use 'x86' (ie, it runs the x86 compiler directly) + if plat_name == get_platform() or plat_name == 'win32': + # native build or cross-compile to win32 + plat_spec = PLAT_TO_VCVARS[plat_name] + else: + # cross compile from win32 -> some 64bit + plat_spec = PLAT_TO_VCVARS[get_platform()] + '_' + \ + PLAT_TO_VCVARS[plat_name] + + vc_env = query_vcvarsall(VERSION, plat_spec) + + self.__paths = vc_env['path'].split(os.pathsep) + os.environ['lib'] = vc_env['lib'] + os.environ['include'] = vc_env['include'] + + if len(self.__paths) == 0: + raise DistutilsPlatformError("Python was built with %s, " + "and extensions need to be built with the same " + "version of the compiler, but it isn't installed." + % self.__product) + + self.cc = self.find_exe("cl.exe") + self.linker = self.find_exe("link.exe") + self.lib = self.find_exe("lib.exe") + self.rc = self.find_exe("rc.exe") # resource compiler + self.mc = self.find_exe("mc.exe") # message compiler + #self.set_path_env_var('lib') + #self.set_path_env_var('include') + + # extend the MSVC path with the current path + try: + for p in os.environ['path'].split(';'): + self.__paths.append(p) + except KeyError: + pass + self.__paths = normalize_and_reduce_paths(self.__paths) + os.environ['path'] = ";".join(self.__paths) + + self.preprocess_options = None + if self.__arch == "x86": + self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', + '/DNDEBUG'] + self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', + '/Z7', '/D_DEBUG'] + else: + # Win64 + self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' , + '/DNDEBUG'] + self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-', + '/Z7', '/D_DEBUG'] + + self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO'] + if self.__version >= 7: + self.ldflags_shared_debug = [ + '/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG' + ] + self.ldflags_static = [ '/nologo'] + + self.initialized = True + + # -- Worker methods ------------------------------------------------ + + def object_filenames(self, + source_filenames, + strip_dir=0, + output_dir=''): + # Copied from ccompiler.py, extended to return .res as 'object'-file + # for .rc input file + if output_dir is None: output_dir = '' + obj_names = [] + for src_name in source_filenames: + (base, ext) = os.path.splitext (src_name) + base = os.path.splitdrive(base)[1] # Chop off the drive + base = base[os.path.isabs(base):] # If abs, chop off leading / + if ext not in self.src_extensions: + # Better to raise an exception instead of silently continuing + # and later complain about sources and targets having + # different lengths + raise CompileError ("Don't know how to compile %s" % src_name) + if strip_dir: + base = os.path.basename (base) + if ext in self._rc_extensions: + obj_names.append (os.path.join (output_dir, + base + self.res_extension)) + elif ext in self._mc_extensions: + obj_names.append (os.path.join (output_dir, + base + self.res_extension)) + else: + obj_names.append (os.path.join (output_dir, + base + self.obj_extension)) + return obj_names + + + def compile(self, sources, + output_dir=None, macros=None, include_dirs=None, debug=0, + extra_preargs=None, extra_postargs=None, depends=None): + + if not self.initialized: + self.initialize() + compile_info = self._setup_compile(output_dir, macros, include_dirs, + sources, depends, extra_postargs) + macros, objects, extra_postargs, pp_opts, build = compile_info + + compile_opts = extra_preargs or [] + compile_opts.append ('/c') + if debug: + compile_opts.extend(self.compile_options_debug) + else: + compile_opts.extend(self.compile_options) + + for obj in objects: + try: + src, ext = build[obj] + except KeyError: + continue + if debug: + # pass the full pathname to MSVC in debug mode, + # this allows the debugger to find the source file + # without asking the user to browse for it + src = os.path.abspath(src) + + if ext in self._c_extensions: + input_opt = "/Tc" + src + elif ext in self._cpp_extensions: + input_opt = "/Tp" + src + elif ext in self._rc_extensions: + # compile .RC to .RES file + input_opt = src + output_opt = "/fo" + obj + try: + self.spawn([self.rc] + pp_opts + + [output_opt] + [input_opt]) + except DistutilsExecError as msg: + raise CompileError(msg) + continue + elif ext in self._mc_extensions: + # Compile .MC to .RC file to .RES file. + # * '-h dir' specifies the directory for the + # generated include file + # * '-r dir' specifies the target directory of the + # generated RC file and the binary message resource + # it includes + # + # For now (since there are no options to change this), + # we use the source-directory for the include file and + # the build directory for the RC file and message + # resources. This works at least for win32all. + h_dir = os.path.dirname(src) + rc_dir = os.path.dirname(obj) + try: + # first compile .MC to .RC and .H file + self.spawn([self.mc] + + ['-h', h_dir, '-r', rc_dir] + [src]) + base, _ = os.path.splitext (os.path.basename (src)) + rc_file = os.path.join (rc_dir, base + '.rc') + # then compile .RC to .RES file + self.spawn([self.rc] + + ["/fo" + obj] + [rc_file]) + + except DistutilsExecError as msg: + raise CompileError(msg) + continue + else: + # how to handle this file? + raise CompileError("Don't know how to compile %s to %s" + % (src, obj)) + + output_opt = "/Fo" + obj + try: + self.spawn([self.cc] + compile_opts + pp_opts + + [input_opt, output_opt] + + extra_postargs) + except DistutilsExecError as msg: + raise CompileError(msg) + + return objects + + + def create_static_lib(self, + objects, + output_libname, + output_dir=None, + debug=0, + target_lang=None): + + if not self.initialized: + self.initialize() + (objects, output_dir) = self._fix_object_args(objects, output_dir) + output_filename = self.library_filename(output_libname, + output_dir=output_dir) + + if self._need_link(objects, output_filename): + lib_args = objects + ['/OUT:' + output_filename] + if debug: + pass # XXX what goes here? + try: + self.spawn([self.lib] + lib_args) + except DistutilsExecError as msg: + raise LibError(msg) + else: + log.debug("skipping %s (up-to-date)", output_filename) + + + def link(self, + target_desc, + objects, + output_filename, + output_dir=None, + libraries=None, + library_dirs=None, + runtime_library_dirs=None, + export_symbols=None, + debug=0, + extra_preargs=None, + extra_postargs=None, + build_temp=None, + target_lang=None): + + if not self.initialized: + self.initialize() + (objects, output_dir) = self._fix_object_args(objects, output_dir) + fixed_args = self._fix_lib_args(libraries, library_dirs, + runtime_library_dirs) + (libraries, library_dirs, runtime_library_dirs) = fixed_args + + if runtime_library_dirs: + self.warn ("I don't know what to do with 'runtime_library_dirs': " + + str (runtime_library_dirs)) + + lib_opts = gen_lib_options(self, + library_dirs, runtime_library_dirs, + libraries) + if output_dir is not None: + output_filename = os.path.join(output_dir, output_filename) + + if self._need_link(objects, output_filename): + if target_desc == CCompiler.EXECUTABLE: + if debug: + ldflags = self.ldflags_shared_debug[1:] + else: + ldflags = self.ldflags_shared[1:] + else: + if debug: + ldflags = self.ldflags_shared_debug + else: + ldflags = self.ldflags_shared + + export_opts = [] + for sym in (export_symbols or []): + export_opts.append("/EXPORT:" + sym) + + ld_args = (ldflags + lib_opts + export_opts + + objects + ['/OUT:' + output_filename]) + + # The MSVC linker generates .lib and .exp files, which cannot be + # suppressed by any linker switches. The .lib files may even be + # needed! Make sure they are generated in the temporary build + # directory. Since they have different names for debug and release + # builds, they can go into the same directory. + build_temp = os.path.dirname(objects[0]) + if export_symbols is not None: + (dll_name, dll_ext) = os.path.splitext( + os.path.basename(output_filename)) + implib_file = os.path.join( + build_temp, + self.library_filename(dll_name)) + ld_args.append ('/IMPLIB:' + implib_file) + + self.manifest_setup_ldargs(output_filename, build_temp, ld_args) + + if extra_preargs: + ld_args[:0] = extra_preargs + if extra_postargs: + ld_args.extend(extra_postargs) + + self.mkpath(os.path.dirname(output_filename)) + try: + self.spawn([self.linker] + ld_args) + except DistutilsExecError as msg: + raise LinkError(msg) + + # embed the manifest + # XXX - this is somewhat fragile - if mt.exe fails, distutils + # will still consider the DLL up-to-date, but it will not have a + # manifest. Maybe we should link to a temp file? OTOH, that + # implies a build environment error that shouldn't go undetected. + mfinfo = self.manifest_get_embed_info(target_desc, ld_args) + if mfinfo is not None: + mffilename, mfid = mfinfo + out_arg = '-outputresource:%s;%s' % (output_filename, mfid) + try: + self.spawn(['mt.exe', '-nologo', '-manifest', + mffilename, out_arg]) + except DistutilsExecError as msg: + raise LinkError(msg) + else: + log.debug("skipping %s (up-to-date)", output_filename) + + def manifest_setup_ldargs(self, output_filename, build_temp, ld_args): + # If we need a manifest at all, an embedded manifest is recommended. + # See MSDN article titled + # "How to: Embed a Manifest Inside a C/C++ Application" + # (currently at http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx) + # Ask the linker to generate the manifest in the temp dir, so + # we can check it, and possibly embed it, later. + temp_manifest = os.path.join( + build_temp, + os.path.basename(output_filename) + ".manifest") + ld_args.append('/MANIFESTFILE:' + temp_manifest) + + def manifest_get_embed_info(self, target_desc, ld_args): + # If a manifest should be embedded, return a tuple of + # (manifest_filename, resource_id). Returns None if no manifest + # should be embedded. See http://bugs.python.org/issue7833 for why + # we want to avoid any manifest for extension modules if we can. + for arg in ld_args: + if arg.startswith("/MANIFESTFILE:"): + temp_manifest = arg.split(":", 1)[1] + break + else: + # no /MANIFESTFILE so nothing to do. + return None + if target_desc == CCompiler.EXECUTABLE: + # by default, executables always get the manifest with the + # CRT referenced. + mfid = 1 + else: + # Extension modules try and avoid any manifest if possible. + mfid = 2 + temp_manifest = self._remove_visual_c_ref(temp_manifest) + if temp_manifest is None: + return None + return temp_manifest, mfid + + def _remove_visual_c_ref(self, manifest_file): + try: + # Remove references to the Visual C runtime, so they will + # fall through to the Visual C dependency of Python.exe. + # This way, when installed for a restricted user (e.g. + # runtimes are not in WinSxS folder, but in Python's own + # folder), the runtimes do not need to be in every folder + # with .pyd's. + # Returns either the filename of the modified manifest or + # None if no manifest should be embedded. + manifest_f = open(manifest_file) + try: + manifest_buf = manifest_f.read() + finally: + manifest_f.close() + pattern = re.compile( + r"""|)""", + re.DOTALL) + manifest_buf = re.sub(pattern, "", manifest_buf) + pattern = r"\s*" + manifest_buf = re.sub(pattern, "", manifest_buf) + # Now see if any other assemblies are referenced - if not, we + # don't want a manifest embedded. + pattern = re.compile( + r"""|)""", re.DOTALL) + if re.search(pattern, manifest_buf) is None: + return None + + manifest_f = open(manifest_file, 'w') + try: + manifest_f.write(manifest_buf) + return manifest_file + finally: + manifest_f.close() + except OSError: + pass + + # -- Miscellaneous methods ----------------------------------------- + # These are all used by the 'gen_lib_options() function, in + # ccompiler.py. + + def library_dir_option(self, dir): + return "/LIBPATH:" + dir + + def runtime_library_dir_option(self, dir): + raise DistutilsPlatformError( + "don't know how to set runtime library search path for MSVC++") + + def library_option(self, lib): + return self.library_filename(lib) + + + def find_library_file(self, dirs, lib, debug=0): + # Prefer a debugging library if found (and requested), but deal + # with it if we don't have one. + if debug: + try_names = [lib + "_d", lib] + else: + try_names = [lib] + for dir in dirs: + for name in try_names: + libfile = os.path.join(dir, self.library_filename (name)) + if os.path.exists(libfile): + return libfile + else: + # Oops, didn't find it in *any* of 'dirs' + return None + + # Helper methods for using the MSVC registry settings + + def find_exe(self, exe): + """Return path to an MSVC executable program. + + Tries to find the program in several places: first, one of the + MSVC program search paths from the registry; next, the directories + in the PATH environment variable. If any of those work, return an + absolute path that is known to exist. If none of them work, just + return the original program name, 'exe'. + """ + for p in self.__paths: + fn = os.path.join(os.path.abspath(p), exe) + if os.path.isfile(fn): + return fn + + # didn't find it; try existing path + for p in os.environ['Path'].split(';'): + fn = os.path.join(os.path.abspath(p),exe) + if os.path.isfile(fn): + return fn + + return exe diff --git a/shared/package-files/33/33d569c599044397f4ee75e13b3c373cb452fb876e8f7e8bf8ec4485d537bf47/blob b/shared/package-files/33/33d569c599044397f4ee75e13b3c373cb452fb876e8f7e8bf8ec4485d537bf47/blob new file mode 100644 index 0000000000000000000000000000000000000000..06732bdfd6966a803cba19dadb075f677d667fca --- /dev/null +++ b/shared/package-files/33/33d569c599044397f4ee75e13b3c373cb452fb876e8f7e8bf8ec4485d537bf47/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33d569c599044397f4ee75e13b3c373cb452fb876e8f7e8bf8ec4485d537bf47 +size 197208 diff --git a/shared/package-files/33/33d641c50fd82487bf95614bcabd0092f824232d1c875ae19d99bb24d213d8b1/blob b/shared/package-files/33/33d641c50fd82487bf95614bcabd0092f824232d1c875ae19d99bb24d213d8b1/blob new file mode 100644 index 0000000000000000000000000000000000000000..4ccb4d312203eea488ae786fca81ed56c1ae7768 --- /dev/null +++ b/shared/package-files/33/33d641c50fd82487bf95614bcabd0092f824232d1c875ae19d99bb24d213d8b1/blob @@ -0,0 +1,90 @@ +from datetime import datetime as _datetime +from email.errors import MessageDefect +from email.policy import Policy +from typing import Any, Dict, Mapping, Optional, Tuple, Union + +class BaseHeader(str): + @property + def name(self) -> str: ... + @property + def defects(self) -> Tuple[MessageDefect, ...]: ... + @property + def max_count(self) -> Optional[int]: ... + def __new__(cls, name: str, value: Any) -> BaseHeader: ... + def init(self, *args: Any, **kw: Any) -> None: ... + def fold(self, *, policy: Policy) -> str: ... + +class UnstructuredHeader: + @classmethod + def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ... + +class UniqueUnstructuredHeader(UnstructuredHeader): ... + +class DateHeader: + datetime: _datetime + @classmethod + def parse(cls, string: Union[str, _datetime], kwds: Dict[str, Any]) -> None: ... + +class UniqueDateHeader(DateHeader): ... + +class AddressHeader: + groups: Tuple[Group, ...] + addresses: Tuple[Address, ...] + @classmethod + def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ... + +class UniqueAddressHeader(AddressHeader): ... + +class SingleAddressHeader(AddressHeader): + @property + def address(self) -> Address: ... + +class UniqueSingleAddressHeader(SingleAddressHeader): ... + +class MIMEVersionHeader: + version: Optional[str] + major: Optional[int] + minor: Optional[int] + @classmethod + def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ... + +class ParameterizedMIMEHeader: + params: Mapping[str, Any] + @classmethod + def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ... + +class ContentTypeHeader(ParameterizedMIMEHeader): + content_type: str + maintype: str + subtype: str + +class ContentDispositionHeader(ParameterizedMIMEHeader): + content_disposition: str + +class ContentTransferEncodingHeader: + cte: str + @classmethod + def parse(cls, string: str, kwds: Dict[str, Any]) -> None: ... + +class HeaderRegistry: + def __init__(self, base_class: BaseHeader = ..., default_class: BaseHeader = ..., use_default_map: bool = ...) -> None: ... + def map_to_type(self, name: str, cls: BaseHeader) -> None: ... + def __getitem__(self, name: str) -> BaseHeader: ... + def __call__(self, name: str, value: Any) -> BaseHeader: ... + +class Address: + display_name: str + username: str + domain: str + @property + def addr_spec(self) -> str: ... + def __init__( + self, display_name: str = ..., username: Optional[str] = ..., domain: Optional[str] = ..., addr_spec: Optional[str] = ... + ) -> None: ... + def __str__(self) -> str: ... + +class Group: + display_name: Optional[str] + addresses: Tuple[Address, ...] + def __init__(self, display_name: Optional[str] = ..., addresses: Optional[Tuple[Address, ...]] = ...) -> None: ... + def __str__(self) -> str: ... diff --git a/shared/package-files/33/33d79491545c4d9257a52756a935379a68f1225907ef342e08bc6114f5588e26/blob b/shared/package-files/33/33d79491545c4d9257a52756a935379a68f1225907ef342e08bc6114f5588e26/blob new file mode 100644 index 0000000000000000000000000000000000000000..a864dbf45bf4bdbaf593fd443bc18291d3273b09 --- /dev/null +++ b/shared/package-files/33/33d79491545c4d9257a52756a935379a68f1225907ef342e08bc6114f5588e26/blob @@ -0,0 +1,367 @@ +#pragma once + +#include + +#include +#include +#include + +namespace torch { +namespace aot_inductor { + +// Can't use c10::ArrayRef because it's not truly header-only and +// pulls in other c10 headers. This is (sadly) copy-pasted and +// adapted. +template +class MiniArrayRef final { + public: + using iterator = T*; + using const_iterator = const T*; + using size_type = size_t; + using value_type = T; + + using reverse_iterator = std::reverse_iterator; + + private: + /// The start of the array, in an external buffer. + T* Data; + + /// The number of elements. + size_type Length; + + public: + /// @name Constructors + /// @{ + + /// Construct an empty MiniArrayRef. + /* implicit */ constexpr MiniArrayRef() : Data(nullptr), Length(0) {} + + /// Construct an MiniArrayRef from a single element. + // TODO Make this explicit + constexpr MiniArrayRef(const T& OneElt) : Data(&OneElt), Length(1) {} + + /// Construct an MiniArrayRef from a pointer and length. + constexpr MiniArrayRef(T* data, size_t length) : Data(data), Length(length) {} + + /// Construct an MiniArrayRef from a range. + constexpr MiniArrayRef(T* begin, T* end) : Data(begin), Length(end - begin) {} + + template < + typename Container, + typename = std::enable_if_t().data())>, + T*>::value>> + /* implicit */ MiniArrayRef(Container& container) + : Data(container.data()), Length(container.size()) {} + + /// Construct an MiniArrayRef from a std::vector. + // The enable_if stuff here makes sure that this isn't used for + // std::vector, because MiniArrayRef can't work on a std::vector + // bitfield. + template + /* implicit */ MiniArrayRef(const std::vector& Vec) + : Data(Vec.data()), Length(Vec.size()) { + static_assert( + !std::is_same::value, + "MiniArrayRef cannot be constructed from a std::vector bitfield."); + } + + /// Construct an MiniArrayRef from a std::array + template + /* implicit */ constexpr MiniArrayRef(std::array& Arr) + : Data(Arr.data()), Length(N) {} + + /// Construct an MiniArrayRef from a C array. + template + /* implicit */ constexpr MiniArrayRef(T (&Arr)[N]) : Data(Arr), Length(N) {} + + /// Construct an MiniArrayRef from a std::initializer_list. + /* implicit */ constexpr MiniArrayRef(const std::initializer_list& Vec) + : Data( + std::begin(Vec) == std::end(Vec) ? static_cast(nullptr) + : std::begin(Vec)), + Length(Vec.size()) {} + + /// @} + /// @name Simple Operations + /// @{ + + constexpr iterator begin() const { + return Data; + } + constexpr iterator end() const { + return Data + Length; + } + + // These are actually the same as iterator, since MiniArrayRef only + // gives you const iterators. + constexpr const_iterator cbegin() const { + return Data; + } + constexpr const_iterator cend() const { + return Data + Length; + } + + constexpr reverse_iterator rbegin() const { + return reverse_iterator(end()); + } + constexpr reverse_iterator rend() const { + return reverse_iterator(begin()); + } + + /// empty - Check if the array is empty. + constexpr bool empty() const { + return Length == 0; + } + + constexpr T* data() const { + return Data; + } + + /// size - Get the array size. + constexpr size_t size() const { + return Length; + } + + /// equals - Check for element-wise equality. + constexpr bool equals(MiniArrayRef RHS) const { + return Length == RHS.Length && std::equal(begin(), end(), RHS.begin()); + } + + /// @} + /// @name Operator Overloads + /// @{ + constexpr const T& operator[](size_t Index) const { + return Data[Index]; + } + + /// Disallow accidental assignment from a temporary. + /// + /// The declaration here is extra complicated so that "arrayRef = {}" + /// continues to select the move assignment operator. + template + typename std::enable_if::value, MiniArrayRef>::type& + operator=(U&& Temporary) = delete; + + /// Disallow accidental assignment from a temporary. + /// + /// The declaration here is extra complicated so that "arrayRef = {}" + /// continues to select the move assignment operator. + template + typename std::enable_if::value, MiniArrayRef>::type& + operator=(std::initializer_list) = delete; +}; + +using MiniIntArrayRef = MiniArrayRef; + +inline bool is_contiguous_strides_for_shape( + int64_t ndim, + const int64_t* strides_ptr, + const int64_t* sizes_ptr) { + int64_t z = 1; + for (int64_t d = ndim - 1; d >= 0; d--) { + const auto& size_d = sizes_ptr[d]; + if (size_d != 1) { + if (strides_ptr[d] == z) { + z *= size_d; + } else { + return false; + } + } + } + return true; +} + +// Shim for AOTI generated code to pretend a raw array works like an +// AtenTensorHandle. +template +class ArrayRefTensor { + public: + ArrayRefTensor() = default; + + explicit ArrayRefTensor( + MiniArrayRef arr, + MiniArrayRef sizes, + MiniArrayRef strides, + int32_t device_type, + int32_t device_idx) + : arrayRef_(arr), + sizes_(sizes), + strides_(strides), + device_type_(device_type), + device_idx_(device_idx), + numel_(arr.size()) { + assert(sizes.size() == strides.size()); + assert(is_contiguous_strides_for_shape( + sizes.size(), strides.data(), sizes.data())); + } + + AtenTensorHandle expensiveCopyToTensor() const { + AtenTensorHandle result; + AOTI_TORCH_ERROR_CODE_CHECK(aoti_torch_empty_strided( + sizes_.size(), + sizes_.data(), + strides_.data(), + aoti_torch_dtype>(), + device_type_, + device_idx_, + &result)); + void* dataPtr; + AOTI_TORCH_ERROR_CODE_CHECK(aoti_torch_get_data_ptr(result, &dataPtr)); + std::memcpy(dataPtr, data(), numel() * sizeof(T)); + return result; + } + + // We need to look the same as RAIIAtenTensorHandle, which returns + // an owning AtenTensorHandle from release(). So, we allocate one! + AtenTensorHandle release() { + return expensiveCopyToTensor(); + } + + // We don't need to free any memory. + void reset() {} + + auto sizes() const { + return sizes_; + } + + auto strides() const { + return strides_; + } + + auto device_type() const { + return device_type_; + } + + auto device_idx() const { + return device_idx_; + } + + T* data() const { + return arrayRef_.data(); + } + + auto numel() const { + return numel_; + } + + void set_arrayref(MiniArrayRef new_arrayref) { + arrayRef_ = new_arrayref; + } + + private: + MiniArrayRef arrayRef_; + // We expect generated code to have statically available sizes & + // strides for us. + MiniArrayRef sizes_; + MiniArrayRef strides_; + int32_t device_type_ = 0; + int32_t device_idx_ = 0; + int32_t numel_ = 0; +}; + +inline AtenTensorHandle reinterpret_tensor_wrapper( + AtenTensorHandle self, + int64_t ndim, + const int64_t* sizes_ptr, + const int64_t* strides_ptr, + int64_t storage_offset) { + AtenTensorHandle result; + AOTI_TORCH_ERROR_CODE_CHECK(aoti_torch__reinterpret_tensor( + self, ndim, sizes_ptr, strides_ptr, storage_offset, &result)); + return result; +} + +template +inline ArrayRefTensor reinterpret_tensor_wrapper( + const ArrayRefTensor& self, + int64_t ndim, + const int64_t* sizes_ptr, + const int64_t* strides_ptr, + int64_t storage_offset) { + // REVIEW: we should add a way to build the DSO in debug mode during + // tests so we can have checks like this! + assert(is_contiguous_strides_for_shape(ndim, strides_ptr, sizes_ptr)); + return ArrayRefTensor( + MiniArrayRef( + self.data() + storage_offset, self.numel() - storage_offset), + MiniArrayRef(sizes_ptr, ndim), + MiniArrayRef(strides_ptr, ndim), + self.device_type(), + self.device_idx()); +} + +inline void* get_data_ptr_wrapper(AtenTensorHandle tensor) { + void* result; + AOTI_TORCH_ERROR_CODE_CHECK(aoti_torch_get_data_ptr(tensor, &result)); + return result; +} + +template +inline T* get_data_ptr_wrapper(ArrayRefTensor& tensor) { + return tensor.data(); +} + +template +inline T* get_data_ptr_wrapper(const MiniArrayRef& arr) { + return arr.data(); +} + +inline AtenTensorHandle unwrap_raii_handle_if_needed( + const RAIIAtenTensorHandle& handle) { + return handle.get(); +} + +template +inline const ArrayRefTensor& unwrap_raii_handle_if_needed( + const ArrayRefTensor& tensor) { + return tensor; +} + +template +inline ArrayRefTensor& unwrap_raii_handle_if_needed( + ArrayRefTensor& tensor) { + return tensor; +} + +inline RAIIAtenTensorHandle wrap_with_raii_handle_if_needed( + AtenTensorHandle handle) { + return RAIIAtenTensorHandle(handle); +} + +template +inline const ArrayRefTensor& wrap_with_raii_handle_if_needed( + const ArrayRefTensor& tensor) { + return tensor; +} + +template +inline ArrayRefTensor& wrap_with_raii_handle_if_needed( + ArrayRefTensor& tensor) { + return tensor; +} + +template +inline RAIIAtenTensorHandle expensive_copy_to_tensor_if_needed( + const ArrayRefTensor& tensor) { + return tensor.expensiveCopyToTensor(); +} + +inline AtenTensorHandle expensive_copy_to_tensor_if_needed( + AtenTensorHandle handle) { + return handle; +} + +template +const T& convert_arrayref_tensor_to_tensor(const T& t) { + return t; +} + +template +RAIIAtenTensorHandle convert_arrayref_tensor_to_tensor( + const ArrayRefTensor& art) { + return art.expensiveCopyToTensor(); +} + +} // namespace aot_inductor +} // namespace torch diff --git a/shared/package-files/33/33d99f8f9a6825ef997b06f2dd2095162ba877a48ea4b3b86fc462fc0f8ca7c1/blob b/shared/package-files/33/33d99f8f9a6825ef997b06f2dd2095162ba877a48ea4b3b86fc462fc0f8ca7c1/blob new file mode 100644 index 0000000000000000000000000000000000000000..d30703ae48b2ca53de43771d3183d6bf922eda16 --- /dev/null +++ b/shared/package-files/33/33d99f8f9a6825ef997b06f2dd2095162ba877a48ea4b3b86fc462fc0f8ca7c1/blob @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cuda { + +TORCH_API ::std::tuple _flash_attention_backward(const at::Tensor & grad_out, const at::Tensor & query, const at::Tensor & key, const at::Tensor & value, const at::Tensor & out, const at::Tensor & logsumexp, const at::Tensor & cum_seq_q, const at::Tensor & cum_seq_k, int64_t max_q, int64_t max_k, double dropout_p, bool is_causal, const at::Tensor & philox_seed, const at::Tensor & philox_offset, c10::optional scale=c10::nullopt); +TORCH_API ::std::tuple _flash_attention_backward_symint(const at::Tensor & grad_out, const at::Tensor & query, const at::Tensor & key, const at::Tensor & value, const at::Tensor & out, const at::Tensor & logsumexp, const at::Tensor & cum_seq_q, const at::Tensor & cum_seq_k, c10::SymInt max_q, c10::SymInt max_k, double dropout_p, bool is_causal, const at::Tensor & philox_seed, const at::Tensor & philox_offset, c10::optional scale=c10::nullopt); + +} // namespace cuda +} // namespace at diff --git a/shared/package-files/33/33dbcdd5a21e13c8205ac956dadf982eba311dd56cd3e02987afecaf0011d995/blob b/shared/package-files/33/33dbcdd5a21e13c8205ac956dadf982eba311dd56cd3e02987afecaf0011d995/blob new file mode 100644 index 0000000000000000000000000000000000000000..4a0b82a7fa315eb6e8bba6fea18731d1c7bc590b --- /dev/null +++ b/shared/package-files/33/33dbcdd5a21e13c8205ac956dadf982eba311dd56cd3e02987afecaf0011d995/blob @@ -0,0 +1,28 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API expand { + using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef, bool); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::expand") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "expand(Tensor(a) self, SymInt[] size, *, bool implicit=False) -> Tensor(a)") + static at::Tensor call(const at::Tensor & self, c10::SymIntArrayRef size, bool implicit); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef size, bool implicit); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/33/33e131a273dcc7a5bef33fd32d368fd7a0c9b5e95255e40764a3b569639b4ae0/blob b/shared/package-files/33/33e131a273dcc7a5bef33fd32d368fd7a0c9b5e95255e40764a3b569639b4ae0/blob new file mode 100644 index 0000000000000000000000000000000000000000..8dc80c5cc0e0eadbe792e114d48593d95df17907 --- /dev/null +++ b/shared/package-files/33/33e131a273dcc7a5bef33fd32d368fd7a0c9b5e95255e40764a3b569639b4ae0/blob @@ -0,0 +1,106 @@ +import numpy as np +import pytest + +from pandas import DataFrame +import pandas._testing as tm +from pandas.tests.copy_view.util import get_array + + +def test_assigning_to_same_variable_removes_references(using_copy_on_write): + df = DataFrame({"a": [1, 2, 3]}) + df = df.reset_index() + if using_copy_on_write: + assert df._mgr._has_no_reference(1) + arr = get_array(df, "a") + df.iloc[0, 1] = 100 # Write into a + + assert np.shares_memory(arr, get_array(df, "a")) + + +def test_setitem_dont_track_unnecessary_references(using_copy_on_write): + df = DataFrame({"a": [1, 2, 3], "b": 1, "c": 1}) + + df["b"] = 100 + arr = get_array(df, "a") + # We split the block in setitem, if we are not careful the new blocks will + # reference each other triggering a copy + df.iloc[0, 0] = 100 + assert np.shares_memory(arr, get_array(df, "a")) + + +def test_setitem_with_view_copies(using_copy_on_write, warn_copy_on_write): + df = DataFrame({"a": [1, 2, 3], "b": 1, "c": 1}) + view = df[:] + expected = df.copy() + + df["b"] = 100 + arr = get_array(df, "a") + with tm.assert_cow_warning(warn_copy_on_write): + df.iloc[0, 0] = 100 # Check that we correctly track reference + if using_copy_on_write: + assert not np.shares_memory(arr, get_array(df, "a")) + tm.assert_frame_equal(view, expected) + + +def test_setitem_with_view_invalidated_does_not_copy( + using_copy_on_write, warn_copy_on_write, request +): + df = DataFrame({"a": [1, 2, 3], "b": 1, "c": 1}) + view = df[:] + + df["b"] = 100 + arr = get_array(df, "a") + view = None # noqa: F841 + # TODO(CoW-warn) false positive? -> block gets split because of `df["b"] = 100` + # which introduces additional refs, even when those of `view` go out of scopes + with tm.assert_cow_warning(warn_copy_on_write): + df.iloc[0, 0] = 100 + if using_copy_on_write: + # Setitem split the block. Since the old block shared data with view + # all the new blocks are referencing view and each other. When view + # goes out of scope, they don't share data with any other block, + # so we should not trigger a copy + mark = pytest.mark.xfail( + reason="blk.delete does not track references correctly" + ) + request.applymarker(mark) + assert np.shares_memory(arr, get_array(df, "a")) + + +def test_out_of_scope(using_copy_on_write): + def func(): + df = DataFrame({"a": [1, 2], "b": 1.5, "c": 1}) + # create some subset + result = df[["a", "b"]] + return result + + result = func() + if using_copy_on_write: + assert not result._mgr.blocks[0].refs.has_reference() + assert not result._mgr.blocks[1].refs.has_reference() + + +def test_delete(using_copy_on_write): + df = DataFrame( + np.random.default_rng(2).standard_normal((4, 3)), columns=["a", "b", "c"] + ) + del df["b"] + if using_copy_on_write: + assert not df._mgr.blocks[0].refs.has_reference() + assert not df._mgr.blocks[1].refs.has_reference() + + df = df[["a"]] + if using_copy_on_write: + assert not df._mgr.blocks[0].refs.has_reference() + + +def test_delete_reference(using_copy_on_write): + df = DataFrame( + np.random.default_rng(2).standard_normal((4, 3)), columns=["a", "b", "c"] + ) + x = df[:] + del df["b"] + if using_copy_on_write: + assert df._mgr.blocks[0].refs.has_reference() + assert df._mgr.blocks[1].refs.has_reference() + assert x._mgr.blocks[0].refs.has_reference() diff --git a/shared/package-files/33/33e2b5f49cd41015e17907674bd9b5c45b0c5d5e0f668974816dca056eee0442/blob b/shared/package-files/33/33e2b5f49cd41015e17907674bd9b5c45b0c5d5e0f668974816dca056eee0442/blob new file mode 100644 index 0000000000000000000000000000000000000000..48e31231906f286a2a8b49c0db26863e1c8912d3 --- /dev/null +++ b/shared/package-files/33/33e2b5f49cd41015e17907674bd9b5c45b0c5d5e0f668974816dca056eee0442/blob @@ -0,0 +1,325 @@ +""" +Test for async helpers. + +Should only trigger on python 3.5+ or will have syntax errors. +""" +from itertools import chain, repeat +from textwrap import dedent, indent +from typing import TYPE_CHECKING +from unittest import TestCase + +import pytest + +from IPython.core.async_helpers import _should_be_async +from IPython.testing.decorators import skip_without + +if TYPE_CHECKING: + from IPython import get_ipython + + ip = get_ipython() + + +def iprc(x): + return ip.run_cell(dedent(x)).raise_error() + + +def iprc_nr(x): + return ip.run_cell(dedent(x)) + + +class AsyncTest(TestCase): + def test_should_be_async(self): + self.assertFalse(_should_be_async("False")) + self.assertTrue(_should_be_async("await bar()")) + self.assertTrue(_should_be_async("x = await bar()")) + self.assertFalse( + _should_be_async( + dedent( + """ + async def awaitable(): + pass + """ + ) + ) + ) + + def _get_top_level_cases(self): + # These are test cases that should be valid in a function + # but invalid outside of a function. + test_cases = [] + test_cases.append(('basic', "{val}")) + + # Note, in all conditional cases, I use True instead of + # False so that the peephole optimizer won't optimize away + # the return, so CPython will see this as a syntax error: + # + # while True: + # break + # return + # + # But not this: + # + # while False: + # return + # + # See https://bugs.python.org/issue1875 + + test_cases.append(('if', dedent(""" + if True: + {val} + """))) + + test_cases.append(('while', dedent(""" + while True: + {val} + break + """))) + + test_cases.append(('try', dedent(""" + try: + {val} + except: + pass + """))) + + test_cases.append(('except', dedent(""" + try: + pass + except: + {val} + """))) + + test_cases.append(('finally', dedent(""" + try: + pass + except: + pass + finally: + {val} + """))) + + test_cases.append(('for', dedent(""" + for _ in range(4): + {val} + """))) + + + test_cases.append(('nested', dedent(""" + if True: + while True: + {val} + break + """))) + + test_cases.append(('deep-nested', dedent(""" + if True: + while True: + break + for x in range(3): + if True: + while True: + for x in range(3): + {val} + """))) + + return test_cases + + def _get_ry_syntax_errors(self): + # This is a mix of tests that should be a syntax error if + # return or yield whether or not they are in a function + + test_cases = [] + + test_cases.append(('class', dedent(""" + class V: + {val} + """))) + + test_cases.append(('nested-class', dedent(""" + class V: + class C: + {val} + """))) + + return test_cases + + + def test_top_level_return_error(self): + tl_err_test_cases = self._get_top_level_cases() + tl_err_test_cases.extend(self._get_ry_syntax_errors()) + + vals = ('return', 'yield', 'yield from (_ for _ in range(3))', + dedent(''' + def f(): + pass + return + '''), + ) + + for test_name, test_case in tl_err_test_cases: + # This example should work if 'pass' is used as the value + with self.subTest((test_name, 'pass')): + iprc(test_case.format(val='pass')) + + # It should fail with all the values + for val in vals: + with self.subTest((test_name, val)): + msg = "Syntax error not raised for %s, %s" % (test_name, val) + with self.assertRaises(SyntaxError, msg=msg): + iprc(test_case.format(val=val)) + + def test_in_func_no_error(self): + # Test that the implementation of top-level return/yield + # detection isn't *too* aggressive, and works inside a function + func_contexts = [] + + func_contexts.append(('func', False, dedent(""" + def f():"""))) + + func_contexts.append(('method', False, dedent(""" + class MyClass: + def __init__(self): + """))) + + func_contexts.append(('async-func', True, dedent(""" + async def f():"""))) + + func_contexts.append(('async-method', True, dedent(""" + class MyClass: + async def f(self):"""))) + + func_contexts.append(('closure', False, dedent(""" + def f(): + def g(): + """))) + + def nest_case(context, case): + # Detect indentation + lines = context.strip().splitlines() + prefix_len = 0 + for c in lines[-1]: + if c != ' ': + break + prefix_len += 1 + + indented_case = indent(case, ' ' * (prefix_len + 4)) + return context + '\n' + indented_case + + # Gather and run the tests + + # yield is allowed in async functions, starting in Python 3.6, + # and yield from is not allowed in any version + vals = ('return', 'yield', 'yield from (_ for _ in range(3))') + + success_tests = zip(self._get_top_level_cases(), repeat(False)) + failure_tests = zip(self._get_ry_syntax_errors(), repeat(True)) + + tests = chain(success_tests, failure_tests) + + for context_name, async_func, context in func_contexts: + for (test_name, test_case), should_fail in tests: + nested_case = nest_case(context, test_case) + + for val in vals: + test_id = (context_name, test_name, val) + cell = nested_case.format(val=val) + + with self.subTest(test_id): + if should_fail: + msg = ("SyntaxError not raised for %s" % + str(test_id)) + with self.assertRaises(SyntaxError, msg=msg): + iprc(cell) + + print(cell) + else: + iprc(cell) + + def test_nonlocal(self): + # fails if outer scope is not a function scope or if var not defined + with self.assertRaises(SyntaxError): + iprc("nonlocal x") + iprc(""" + x = 1 + def f(): + nonlocal x + x = 10000 + yield x + """) + iprc(""" + def f(): + def g(): + nonlocal x + x = 10000 + yield x + """) + + # works if outer scope is a function scope and var exists + iprc(""" + def f(): + x = 20 + def g(): + nonlocal x + x = 10000 + yield x + """) + + + def test_execute(self): + iprc(""" + import asyncio + await asyncio.sleep(0.001) + """ + ) + + def test_autoawait(self): + iprc("%autoawait False") + iprc("%autoawait True") + iprc(""" + from asyncio import sleep + await sleep(0.1) + """ + ) + + def test_memory_error(self): + """ + The pgen parser in 3.8 or before use to raise MemoryError on too many + nested parens anymore""" + + iprc("(" * 200 + ")" * 200) + + @pytest.mark.xfail(reason="fail on curio 1.6 and before on Python 3.12") + @pytest.mark.skip( + reason="skip_without(curio) fails on 3.12 for now even with other skip so must uncond skip" + ) + # @skip_without("curio") + def test_autoawait_curio(self): + iprc("%autoawait curio") + + @skip_without('trio') + def test_autoawait_trio(self): + iprc("%autoawait trio") + + @skip_without('trio') + def test_autoawait_trio_wrong_sleep(self): + iprc("%autoawait trio") + res = iprc_nr(""" + import asyncio + await asyncio.sleep(0) + """) + with self.assertRaises(TypeError): + res.raise_error() + + @skip_without('trio') + def test_autoawait_asyncio_wrong_sleep(self): + iprc("%autoawait asyncio") + res = iprc_nr(""" + import trio + await trio.sleep(0) + """) + with self.assertRaises(RuntimeError): + res.raise_error() + + + def tearDown(self): + ip.loop_runner = "asyncio" diff --git a/shared/package-files/33/33e2facd36b62b0a347b1dc3c6c2e830541e06291b2140121a2864cb91050749/blob b/shared/package-files/33/33e2facd36b62b0a347b1dc3c6c2e830541e06291b2140121a2864cb91050749/blob new file mode 100644 index 0000000000000000000000000000000000000000..c9a2fcca5f2fb9bbb2118b5b833be61670ee6d3d --- /dev/null +++ b/shared/package-files/33/33e2facd36b62b0a347b1dc3c6c2e830541e06291b2140121a2864cb91050749/blob @@ -0,0 +1,419 @@ +from __future__ import annotations + +import csv +import inspect +import os +import re +from dataclasses import dataclass +from functools import lru_cache + +from typing import Dict, List, Set, Tuple, TYPE_CHECKING, Union + +from torch._inductor import config +from torch._inductor.utils import get_benchmark_name + +# Prevent circular import +if TYPE_CHECKING: + from torch._inductor.scheduler import ( + BaseSchedulerNode, + ExternKernelSchedulerNode, + NopKernelSchedulerNode, + SchedulerNode, + ) + +# counter for tracking how many kernels have been generated +generated_kernel_count = 0 +generated_cpp_vec_kernel_count = 0 +num_bytes_accessed = 0 +nodes_num_elem: List[ + Tuple[ + Union[NopKernelSchedulerNode, SchedulerNode, ExternKernelSchedulerNode], + int, + ] +] = [] +node_runtimes: List[Tuple[BaseSchedulerNode, float]] = [] + +# counters for tracking fusions +ir_nodes_pre_fusion = 0 + +# counters for tracking to_dtype inserted +cpp_to_dtype_count = 0 + +# counters for tracking cpp_wrapper disabled +disable_cpp_wrapper = 0 + + +# reset all counters +def reset(): + global generated_kernel_count + global generated_cpp_vec_kernel_count + global num_bytes_accessed, nodes_num_elem + global ir_nodes_pre_fusion + global cpp_to_dtype_count + global disable_cpp_wrapper + + generated_kernel_count = 0 + generated_cpp_vec_kernel_count = 0 + num_bytes_accessed = 0 + nodes_num_elem.clear() + node_runtimes.clear() + ir_nodes_pre_fusion = 0 + cpp_to_dtype_count = 0 + disable_cpp_wrapper = 0 + + +@dataclass +class CachedMetricsDeltas: + """ + The subset of metrics we want update across cache hits, e.g., the + FxGraphCache. + """ + + generated_kernel_count: int + generated_cpp_vec_kernel_count: int + ir_nodes_pre_fusion: int + cpp_to_dtype_count: int + + +class CachedMetricsHelper: + """ + A helper class to help calculate and apply counter deltas for those + metrics we want to save with cache entries (e.g., FxGraphCache) and + apply on a cache hit. + """ + + def __init__(self): + global generated_kernel_count + global generated_cpp_vec_kernel_count + global ir_nodes_pre_fusion + global cpp_to_dtype_count + + self.generated_kernel_count = generated_kernel_count + self.generated_cpp_vec_kernel_count = generated_cpp_vec_kernel_count + self.ir_nodes_pre_fusion = ir_nodes_pre_fusion + self.cpp_to_dtype_count = cpp_to_dtype_count + + def get_deltas(self) -> CachedMetricsDeltas: + global generated_kernel_count + global generated_cpp_vec_kernel_count + global ir_nodes_pre_fusion + global cpp_to_dtype_count + + return CachedMetricsDeltas( + generated_kernel_count - self.generated_kernel_count, + generated_cpp_vec_kernel_count - self.generated_cpp_vec_kernel_count, + ir_nodes_pre_fusion - self.ir_nodes_pre_fusion, + cpp_to_dtype_count - self.cpp_to_dtype_count, + ) + + @staticmethod + def apply_deltas(delta: CachedMetricsDeltas): + global generated_kernel_count + global generated_cpp_vec_kernel_count + global ir_nodes_pre_fusion + global cpp_to_dtype_count + + generated_kernel_count += delta.generated_kernel_count + generated_cpp_vec_kernel_count += delta.generated_cpp_vec_kernel_count + ir_nodes_pre_fusion += delta.ir_nodes_pre_fusion + cpp_to_dtype_count += delta.cpp_to_dtype_count + + +REGISTERED_METRIC_TABLES: Dict[str, MetricTable] = {} + + +@dataclass +class MetricTable: + table_name: str + column_names: List[str] + + num_rows_added: int = 0 + + def add_row(self, row_fn): + if self.table_name not in enabled_metric_tables(): + return + + row_dict = row_fn() + assert len(self.column_names) == len( + row_dict + ), f"{len(self.column_names)} v.s. {len(row_dict)}" + assert set(self.column_names) == set( + row_dict.keys() + ), f"{set(self.column_names)} v.s. {set(row_dict.keys())}" + + row = [ + get_benchmark_name(), + ] + row += [row_dict[column_name] for column_name in self.column_names] + self._write_row(row) + + def output_filename(self): + return f"metric_table_{self.table_name}.csv" + + def write_header(self): + filename = self.output_filename() + with open(filename, "w") as fd: + writer = csv.writer(fd, lineterminator="\n") + writer.writerow(["model_name"] + self.column_names) + + def _write_row(self, row): + filename = self.output_filename() + if self.num_rows_added == 0 and not os.path.exists(filename): + self.write_header() + + self.num_rows_added += 1 + + for idx, orig_val in enumerate(row): + if isinstance(orig_val, float): + new_val = f"{orig_val:.6f}" + elif orig_val is None: + new_val = "" + else: + new_val = orig_val + row[idx] = new_val + + with open(filename, "a") as fd: + writer = csv.writer(fd, lineterminator="\n") + writer.writerow(row) + + @staticmethod + def register_table(name, column_names): + table = MetricTable(name, column_names) + REGISTERED_METRIC_TABLES[name] = table + + +MetricTable.register_table( + "slow_fusion", + [ + "kernel1_path", + "kernel1_latency", + "kernel2_path", + "kernel2_latency", + "fused_kernel_path", + "fused_kernel_latency", + "slow_down_ratio", + ], +) + +# track the fusion statistics for each graph +MetricTable.register_table( + "graph_stats", + [ + "graph_id", + "num_nodes_before_fusion", + "num_nodes_after_fusion", + ], +) + +# track the perf difference between persistent reduction and non-persistent +# reductions +MetricTable.register_table( + "persistent_red_perf", + [ + "kernel1_name", + "kernel2_name", + "kernel1_latency", + "kernel2_latency", + "size_hints", + "reduction_hint", + "speedup", + ], +) + +# Log metadata for pointwise/reduction kernels. E.g., model name, kernel path, numel, rnumel, reduction hint +MetricTable.register_table( + "kernel_metadata", + [ + "kernel_name", + "kernel_path", + "kernel_category", # pointwise/reduction/foreach etc. + "size_hints", + "reduction_hint", + "line_of_code", + "num_load", + "num_store", + "num_for_loop", + "num_atomic_add", + "num_args", + # xyz numel can be different to size_hints since size_hints are rounded + # up to the nearest power of 2. + # Inductor kernel will burn in the xyz numel in kernel code for static + # shape kernels. + # Logging them will be helpful to find unaligned shape for reduction + "xnumel", + "ynumel", + "rnumel", + "kernel_args_num_gb", + ], +) + + +def _parse_kernel_fn_code(kernel_module_code): + """ + The kernel_module_code is the python module that contains kernel function code. + kernel function is the proper triton kernel function annotated with + @triton.jit + """ + from .codecache import PyCodeCache + from .wrapper_benchmark import get_triton_kernel + + mod = PyCodeCache.load(kernel_module_code) + kernel = get_triton_kernel(mod) + # kernel is a CachingAutotune; kernel.fn is the JITFunction; + # kernel.fn.fn is the function being decorate by triton.jit + return inspect.getsource(kernel.fn.fn) + + +def _parse_kernel_line_of_code(proper_kernel_fn_code): + """ + Return the line of code for the kernel excluding the decorators. + """ + return len(proper_kernel_fn_code.splitlines()) + + +def _parse_size_hints(kernel_module_code, kernel_category): + if kernel_category == "foreach": + # foreach kernel does not have size_hints + return None + m = re.search(r"size_hints=(\[[0-9, ]*\]),", kernel_module_code) + assert m, "size_hints missing!" + return m.group(1) + + +def _parse_reduction_hint(kernel_category, kernel_module_code): + if kernel_category not in ("reduction", "persistent_reduction"): + return None + m = re.search(r"reduction_hint=ReductionHint\.(\w*),", kernel_module_code) + assert m, "reduction_hint not found in kernel source code!" + return m.group(1) + + +def _count_pattern(proper_kernel_fn_code, pattern): + return proper_kernel_fn_code.count(pattern) + + +def _count_args(proper_kernel_fn_code): + def_line = proper_kernel_fn_code.splitlines()[0] + assert def_line.startswith("def ") + start_idx = def_line.index("(") + end_idx = def_line.index("):") + decl_csv = def_line[start_idx + 1 : end_idx] + comps = decl_csv.split(",") + return len(comps) + + +def _parse_proper_kernel_fn_code(kernel_fn_code): + """ + Skip decorators. + """ + start_pos = kernel_fn_code.index("def ") + return kernel_fn_code[start_pos:] + + +def _parse_numel(proper_kernel_fn_code, numel_arg_name): + m = re.search(f"{numel_arg_name} = ([\\d]+)", proper_kernel_fn_code) + if m: + return int(m.group(1)) + else: + return None + + +def _parse_kernel_args_num_gb(kernel_fn_code, kernel_category): + """ + inductor meta looks like: + inductor_meta={... 'mutated_arg_names': [], 'no_x_dim': False, 'kernel_num_gb': 2.0}, + """ + m = re.search(r".kernel_num_gb.:\s*([0-9.]+)", kernel_fn_code) + if m: + return float(m.group(1)) + else: + """ + There are a few cases that kernel_num_gdb field can be missing: + 1. the field will be missing if config.benchmark_kernel and + config.profile_bandwidth are false + 2. even if config.benchmark_kernel or config.profile_bandwidth is true. + foreach kernel does not have kernel_num_gb field in the metadata + """ + return None + + +def log_kernel_metadata(kernel_name, kernel_path, kernel_module_code): + """ + An utility to log kernel metadata. We may parse metadata from kernel source code here. + + It's fine to parse the generated kernel code here since the logging is + disabled by default. It would hurt compilation time. + """ + from .wrapper_benchmark import get_kernel_category_by_source_code + + kernel_category = get_kernel_category_by_source_code(kernel_module_code) + reduction_hint = _parse_reduction_hint(kernel_category, kernel_module_code) + size_hints = _parse_size_hints(kernel_module_code, kernel_category) + kernel_fn_code = _parse_kernel_fn_code(kernel_module_code) + + proper_kernel_fn_code = _parse_proper_kernel_fn_code(kernel_fn_code) + + # the line of code excluding the decortors + kernel_line_of_code = _parse_kernel_line_of_code(proper_kernel_fn_code) + + get_metric_table("kernel_metadata").add_row( + lambda: { + "kernel_name": kernel_name, + "kernel_path": kernel_path, + "kernel_category": kernel_category, + "size_hints": size_hints, + "reduction_hint": reduction_hint, + "line_of_code": kernel_line_of_code, + "num_load": _count_pattern(proper_kernel_fn_code, "tl.load"), + "num_store": _count_pattern(proper_kernel_fn_code, "tl.store"), + "num_for_loop": _count_pattern(proper_kernel_fn_code, "for "), + "num_atomic_add": _count_pattern(proper_kernel_fn_code, "tl.atomic_add"), + "num_args": _count_args(proper_kernel_fn_code), + "xnumel": _parse_numel(proper_kernel_fn_code, "xnumel"), + "ynumel": _parse_numel(proper_kernel_fn_code, "ynumel"), + "rnumel": _parse_numel(proper_kernel_fn_code, "rnumel"), + "kernel_args_num_gb": _parse_kernel_args_num_gb( + kernel_fn_code, kernel_category + ), + } + ) + + +def purge_old_log_files(): + """ + Purge the old log file at the beginning when the benchmark script runs. + Should do it in the parent process rather than the child processes running + each individual model. + """ + for name, table in REGISTERED_METRIC_TABLES.items(): + if name in enabled_metric_tables(): + filename = table.output_filename() + if os.path.exists(filename): + os.unlink(filename) + + table.write_header() + + +@lru_cache +def enabled_metric_tables() -> Set[str]: + config_str = config.enabled_metric_tables + + enabled = set() + for name in config_str.split(","): + name = name.strip() + if not name: + continue + assert ( + name in REGISTERED_METRIC_TABLES + ), f"Metric table name {name} is not registered" + enabled.add(name) + return enabled + + +def is_metric_table_enabled(name): + return name in enabled_metric_tables() + + +def get_metric_table(name): + assert name in REGISTERED_METRIC_TABLES, f"Metric table {name} is not defined" + return REGISTERED_METRIC_TABLES[name] diff --git a/shared/package-files/33/33e412b364b1445858c0654c257152d8a4d68205322882cb4b7b3fb02dbfa49e/blob b/shared/package-files/33/33e412b364b1445858c0654c257152d8a4d68205322882cb4b7b3fb02dbfa49e/blob new file mode 100644 index 0000000000000000000000000000000000000000..86e69da0fe82f3e354c34d186d04b41ca64fd350 --- /dev/null +++ b/shared/package-files/33/33e412b364b1445858c0654c257152d8a4d68205322882cb4b7b3fb02dbfa49e/blob @@ -0,0 +1,30 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace cpu { + +TORCH_API at::Tensor clamp(const at::Tensor & self, const c10::optional & min, const c10::optional & max=c10::nullopt); +TORCH_API at::Tensor & clamp_out(at::Tensor & out, const at::Tensor & self, const c10::optional & min, const c10::optional & max=c10::nullopt); +TORCH_API at::Tensor & clamp_outf(const at::Tensor & self, const c10::optional & min, const c10::optional & max, at::Tensor & out); +TORCH_API at::Tensor & clamp_(at::Tensor & self, const c10::optional & min, const c10::optional & max=c10::nullopt); +TORCH_API at::Tensor clamp(const at::Tensor & self, const c10::optional & min={}, const c10::optional & max={}); +TORCH_API at::Tensor & clamp_out(at::Tensor & out, const at::Tensor & self, const c10::optional & min={}, const c10::optional & max={}); +TORCH_API at::Tensor & clamp_outf(const at::Tensor & self, const c10::optional & min, const c10::optional & max, at::Tensor & out); +TORCH_API at::Tensor & clamp_(at::Tensor & self, const c10::optional & min={}, const c10::optional & max={}); + +} // namespace cpu +} // namespace at diff --git a/shared/package-files/33/33e64cb7e0d1520c9979dfc8d608a4c446d260424bc22ee6c298ddfbf885282f/blob b/shared/package-files/33/33e64cb7e0d1520c9979dfc8d608a4c446d260424bc22ee6c298ddfbf885282f/blob new file mode 100644 index 0000000000000000000000000000000000000000..0615c221a5386514eeec83278d6f5857acc1e1b8 --- /dev/null +++ b/shared/package-files/33/33e64cb7e0d1520c9979dfc8d608a4c446d260424bc22ee6c298ddfbf885282f/blob @@ -0,0 +1,306 @@ +from .basic import Basic +from .sorting import ordered +from .sympify import sympify +from sympy.utilities.iterables import iterable + + + +def iterargs(expr): + """Yield the args of a Basic object in a breadth-first traversal. + Depth-traversal stops if `arg.args` is either empty or is not + an iterable. + + Examples + ======== + + >>> from sympy import Integral, Function + >>> from sympy.abc import x + >>> f = Function('f') + >>> from sympy.core.traversal import iterargs + >>> list(iterargs(Integral(f(x), (f(x), 1)))) + [Integral(f(x), (f(x), 1)), f(x), (f(x), 1), x, f(x), 1, x] + + See Also + ======== + iterfreeargs, preorder_traversal + """ + args = [expr] + for i in args: + yield i + try: + args.extend(i.args) + except TypeError: + pass # for cases like f being an arg + + +def iterfreeargs(expr, _first=True): + """Yield the args of a Basic object in a breadth-first traversal. + Depth-traversal stops if `arg.args` is either empty or is not + an iterable. The bound objects of an expression will be returned + as canonical variables. + + Examples + ======== + + >>> from sympy import Integral, Function + >>> from sympy.abc import x + >>> f = Function('f') + >>> from sympy.core.traversal import iterfreeargs + >>> list(iterfreeargs(Integral(f(x), (f(x), 1)))) + [Integral(f(x), (f(x), 1)), 1] + + See Also + ======== + iterargs, preorder_traversal + """ + args = [expr] + for i in args: + yield i + if _first and hasattr(i, 'bound_symbols'): + void = i.canonical_variables.values() + for i in iterfreeargs(i.as_dummy(), _first=False): + if not i.has(*void): + yield i + try: + args.extend(i.args) + except TypeError: + pass # for cases like f being an arg + + +class preorder_traversal: + """ + Do a pre-order traversal of a tree. + + This iterator recursively yields nodes that it has visited in a pre-order + fashion. That is, it yields the current node then descends through the + tree breadth-first to yield all of a node's children's pre-order + traversal. + + + For an expression, the order of the traversal depends on the order of + .args, which in many cases can be arbitrary. + + Parameters + ========== + node : SymPy expression + The expression to traverse. + keys : (default None) sort key(s) + The key(s) used to sort args of Basic objects. When None, args of Basic + objects are processed in arbitrary order. If key is defined, it will + be passed along to ordered() as the only key(s) to use to sort the + arguments; if ``key`` is simply True then the default keys of ordered + will be used. + + Yields + ====== + subtree : SymPy expression + All of the subtrees in the tree. + + Examples + ======== + + >>> from sympy import preorder_traversal, symbols + >>> x, y, z = symbols('x y z') + + The nodes are returned in the order that they are encountered unless key + is given; simply passing key=True will guarantee that the traversal is + unique. + + >>> list(preorder_traversal((x + y)*z, keys=None)) # doctest: +SKIP + [z*(x + y), z, x + y, y, x] + >>> list(preorder_traversal((x + y)*z, keys=True)) + [z*(x + y), z, x + y, x, y] + + """ + def __init__(self, node, keys=None): + self._skip_flag = False + self._pt = self._preorder_traversal(node, keys) + + def _preorder_traversal(self, node, keys): + yield node + if self._skip_flag: + self._skip_flag = False + return + if isinstance(node, Basic): + if not keys and hasattr(node, '_argset'): + # LatticeOp keeps args as a set. We should use this if we + # don't care about the order, to prevent unnecessary sorting. + args = node._argset + else: + args = node.args + if keys: + if keys != True: + args = ordered(args, keys, default=False) + else: + args = ordered(args) + for arg in args: + yield from self._preorder_traversal(arg, keys) + elif iterable(node): + for item in node: + yield from self._preorder_traversal(item, keys) + + def skip(self): + """ + Skip yielding current node's (last yielded node's) subtrees. + + Examples + ======== + + >>> from sympy import preorder_traversal, symbols + >>> x, y, z = symbols('x y z') + >>> pt = preorder_traversal((x + y*z)*z) + >>> for i in pt: + ... print(i) + ... if i == x + y*z: + ... pt.skip() + z*(x + y*z) + z + x + y*z + """ + self._skip_flag = True + + def __next__(self): + return next(self._pt) + + def __iter__(self): + return self + + +def use(expr, func, level=0, args=(), kwargs={}): + """ + Use ``func`` to transform ``expr`` at the given level. + + Examples + ======== + + >>> from sympy import use, expand + >>> from sympy.abc import x, y + + >>> f = (x + y)**2*x + 1 + + >>> use(f, expand, level=2) + x*(x**2 + 2*x*y + y**2) + 1 + >>> expand(f) + x**3 + 2*x**2*y + x*y**2 + 1 + + """ + def _use(expr, level): + if not level: + return func(expr, *args, **kwargs) + else: + if expr.is_Atom: + return expr + else: + level -= 1 + _args = [_use(arg, level) for arg in expr.args] + return expr.__class__(*_args) + + return _use(sympify(expr), level) + + +def walk(e, *target): + """Iterate through the args that are the given types (target) and + return a list of the args that were traversed; arguments + that are not of the specified types are not traversed. + + Examples + ======== + + >>> from sympy.core.traversal import walk + >>> from sympy import Min, Max + >>> from sympy.abc import x, y, z + >>> list(walk(Min(x, Max(y, Min(1, z))), Min)) + [Min(x, Max(y, Min(1, z)))] + >>> list(walk(Min(x, Max(y, Min(1, z))), Min, Max)) + [Min(x, Max(y, Min(1, z))), Max(y, Min(1, z)), Min(1, z)] + + See Also + ======== + + bottom_up + """ + if isinstance(e, target): + yield e + for i in e.args: + yield from walk(i, *target) + + +def bottom_up(rv, F, atoms=False, nonbasic=False): + """Apply ``F`` to all expressions in an expression tree from the + bottom up. If ``atoms`` is True, apply ``F`` even if there are no args; + if ``nonbasic`` is True, try to apply ``F`` to non-Basic objects. + """ + args = getattr(rv, 'args', None) + if args is not None: + if args: + args = tuple([bottom_up(a, F, atoms, nonbasic) for a in args]) + if args != rv.args: + rv = rv.func(*args) + rv = F(rv) + elif atoms: + rv = F(rv) + else: + if nonbasic: + try: + rv = F(rv) + except TypeError: + pass + + return rv + + +def postorder_traversal(node, keys=None): + """ + Do a postorder traversal of a tree. + + This generator recursively yields nodes that it has visited in a postorder + fashion. That is, it descends through the tree depth-first to yield all of + a node's children's postorder traversal before yielding the node itself. + + Parameters + ========== + + node : SymPy expression + The expression to traverse. + keys : (default None) sort key(s) + The key(s) used to sort args of Basic objects. When None, args of Basic + objects are processed in arbitrary order. If key is defined, it will + be passed along to ordered() as the only key(s) to use to sort the + arguments; if ``key`` is simply True then the default keys of + ``ordered`` will be used (node count and default_sort_key). + + Yields + ====== + subtree : SymPy expression + All of the subtrees in the tree. + + Examples + ======== + + >>> from sympy import postorder_traversal + >>> from sympy.abc import w, x, y, z + + The nodes are returned in the order that they are encountered unless key + is given; simply passing key=True will guarantee that the traversal is + unique. + + >>> list(postorder_traversal(w + (x + y)*z)) # doctest: +SKIP + [z, y, x, x + y, z*(x + y), w, w + z*(x + y)] + >>> list(postorder_traversal(w + (x + y)*z, keys=True)) + [w, z, x, y, x + y, z*(x + y), w + z*(x + y)] + + + """ + if isinstance(node, Basic): + args = node.args + if keys: + if keys != True: + args = ordered(args, keys, default=False) + else: + args = ordered(args) + for arg in args: + yield from postorder_traversal(arg, keys) + elif iterable(node): + for item in node: + yield from postorder_traversal(item, keys) + yield node diff --git a/shared/package-files/33/33e6a36056667d40e26f195c14371567470f53324c3fec43aec29e09d7d2a60b/blob b/shared/package-files/33/33e6a36056667d40e26f195c14371567470f53324c3fec43aec29e09d7d2a60b/blob new file mode 100644 index 0000000000000000000000000000000000000000..4a42af586a4a9e55567977bd012969b420fb4a2f --- /dev/null +++ b/shared/package-files/33/33e6a36056667d40e26f195c14371567470f53324c3fec43aec29e09d7d2a60b/blob @@ -0,0 +1,47 @@ +Guido van Rossum, as well as being the creator of the Python language, is the +original creator of IDLE. Other contributors prior to Version 0.8 include +Mark Hammond, Jeremy Hylton, Tim Peters, and Moshe Zadka. + +Until Python 2.3, IDLE's development was carried out in the SF IDLEfork project. The +objective was to develop a version of IDLE which had an execution environment +which could be initialized prior to each run of user code. +IDLefork was merged into the Python code base in 2003. + +The IDLEfork project was initiated by David Scherer, with some help from Peter +Schneider-Kamp and Nicholas Riley. David wrote the first version of the RPC +code and designed a fast turn-around environment for VPython. Guido developed +the RPC code and Remote Debugger currently integrated in IDLE. Bruce Sherwood +contributed considerable time testing and suggesting improvements. + +Besides David and Guido, the main developers who were active on IDLEfork +are Stephen M. Gava, who implemented the configuration GUI, the new +configuration system, and the About dialog, and Kurt B. Kaiser, who completed +the integration of the RPC and remote debugger, implemented the threaded +subprocess, and made a number of usability enhancements. + +Other contributors include Raymond Hettinger, Tony Lownds (Mac integration), +Neal Norwitz (code check and clean-up), Ronald Oussoren (Mac integration), +Noam Raphael (Code Context, Call Tips, many other patches), and Chui Tey (RPC +integration, debugger integration and persistent breakpoints). + +Scott David Daniels, Tal Einat, Hernan Foffani, Christos Georgiou, +Jim Jewett, Martin v. Löwis, Jason Orendorff, Guilherme Polo, Josh Robb, +Nigel Rowe, Bruce Sherwood, Jeff Shute, and Weeble have submitted useful +patches. Thanks, guys! + +Major contributors since 2005: + +- 2005: Tal Einat +- 2010: Terry Jan Reedy (current maintainer) +- 2013: Roger Serwys +- 2014: Saimadhav Heblikar +- 2015: Mark Roseman +- 2017: Louie Lu, Cheryl Sabella, and Serhiy Storchaka + +For additional details refer to NEWS.txt and Changelog. + +Please contact the IDLE maintainer (kbk@shore.net) to have yourself included +here if you are one of those we missed! + + + diff --git a/shared/package-files/33/33e72112fe1bb674ad113fbac434c6f4b3d164d97dd57a4caa95ad6e88828fd3/blob b/shared/package-files/33/33e72112fe1bb674ad113fbac434c6f4b3d164d97dd57a4caa95ad6e88828fd3/blob new file mode 100644 index 0000000000000000000000000000000000000000..a4080f54e05d4b36f33cc8c839f791053189fc65 --- /dev/null +++ b/shared/package-files/33/33e72112fe1bb674ad113fbac434c6f4b3d164d97dd57a4caa95ad6e88828fd3/blob @@ -0,0 +1,24 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor _upsample_nearest_exact2d(const at::Tensor & input, at::OptionalIntArrayRef output_size, c10::optional> scale_factors); +TORCH_API at::Tensor _upsample_nearest_exact2d_symint(const at::Tensor & input, at::OptionalSymIntArrayRef output_size, c10::optional> scale_factors); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/33/33eea45d86d97f7de97c190cf7cc94941f43fdf17e6bd4c7498d21bc172e6c9b/blob b/shared/package-files/33/33eea45d86d97f7de97c190cf7cc94941f43fdf17e6bd4c7498d21bc172e6c9b/blob new file mode 100644 index 0000000000000000000000000000000000000000..9f452a1cc72137beedbbdc0273b7ce87addb4740 --- /dev/null +++ b/shared/package-files/33/33eea45d86d97f7de97c190cf7cc94941f43fdf17e6bd4c7498d21bc172e6c9b/blob @@ -0,0 +1,414 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#if !defined(__s390x__) && !defined(__powerpc__) +#include +#endif + +#ifndef AT_PER_OPERATOR_HEADERS +#include +#else +#include +#endif + + +#include + +/* Convolution prepacked parameters serialization. + * + * Version 1 + * + * - Fields: + * 1. weight + * 2. bias + * 3. stride x kSpatialDim + * 4. padding x kSpatialDim + * 5. dilation x kSpatialDim + * 6. groups + * + * Version 2 + * + * - Fields: + * 0. version (string) + * 1. list of non-optional tensors + * 0: packed parameters (int16_t) + * - kSpatialDim + * - stride x kSpatialDim + * - padding x kSpatialDim + * - dilation x kSpatialDim + * - output_padding x kSpatialDim + * - groups + * - transpose (0 or 1) + * 1: weight + * 2. list of optional tensors + * 0: bias + * + * Version 3 + * + * - Fields: + * 0. version (int64_t) + * 1. list of int64_t configuration values + * - kSpatialDim + * - stride x kSpatialDim + * - padding x kSpatialDim + * - dilation x kSpatialDim + * - output_padding x kSpatialDim + * - groups + * - flags (bitmask) + * - (1 << 0) transpose (1 = yes) + * 2. list of optional tensors + * 0: None (helps with type inference) + * 1: weight (this must be present) + * 2: bias + */ + +using ConvParamsSerializationTypeV2 = std::tuple< + // version, for versions 2 and up + std::string, + // non-optional tensors + std::vector, + // optional tensors + std::vector>>; + +using ConvParamsSerializationTypeV3 = std::tuple< + // version, int for versions 3 and up + int64_t, + // configuration values + std::vector, + // optional tensors + std::vector>>; + +// Parses any historical conv packed params format into +// the current format. +template +ConvParamsSerializationTypeV3 parse_conv_serialized_state(c10::IValue v) { + + // determine the version based on IValue contents + int version = -1; + if (v.isTuple()) { + const auto& elements = v.toTupleRef().elements(); + if (!elements.empty()) { + auto firstElement = elements[0]; + if (firstElement.isTensor()) { + version = 1; + } else if (firstElement.isString()) { + const std::string& version_str = firstElement.toStringRef(); + // note: not parsing the string to automatically handle bad + // inputs + if (version_str == "2") { + version = 2; + } + } else if (firstElement.isInt()) { + auto raw_version = firstElement.toInt(); + if (raw_version == 3) { + version = 3; + } + } + } + } + TORCH_INTERNAL_ASSERT(version != -1, "Unable to parse serialization version"); + + if (version == 1) { + // version 1 - convert to version 3 manually + + const auto& elements = v.toTupleRef().elements(); + + at::Tensor weight = elements[0].toTensor(); + c10::optional bias = elements[1].toOptional(); + torch::List stride_x_kSpatialDim = elements[2].toTensorList(); + torch::List padding_x_kSpatialDim = elements[3].toTensorList(); + torch::List dilation_x_kSpatialDim = elements[4].toTensorList(); + at::Tensor groups = elements[5].toTensor(); + + std::vector config_vals; + config_vals.reserve( + stride_x_kSpatialDim.size() + padding_x_kSpatialDim.size() + + dilation_x_kSpatialDim.size() + kSpatialDim + 3); + config_vals.push_back(kSpatialDim); + for (const auto i : c10::irange(stride_x_kSpatialDim.size())) { + auto stride = stride_x_kSpatialDim.get(i); + config_vals.push_back(stride[0].item()); + } + for (const auto i : c10::irange(padding_x_kSpatialDim.size())) { + auto padding = padding_x_kSpatialDim.get(i); + config_vals.push_back(padding[0].item()); + } + for (const auto i : c10::irange(dilation_x_kSpatialDim.size())) { + auto dilation = dilation_x_kSpatialDim.get(i); + config_vals.push_back(dilation[0].item()); + } + // output_padding does not exist in v1, so we fill in a default value + for (C10_UNUSED const auto i : c10::irange(kSpatialDim)) { + config_vals.push_back(0); + } + config_vals.push_back(groups[0].item()); + // transpose does not exist in v1, so we fill in a default value + config_vals.push_back(0); + + std::vector> tensors; + tensors.emplace_back(); + tensors.emplace_back(weight); + tensors.emplace_back(bias); + + int64_t version = 3; + return std::tie(version, config_vals, tensors); + } else if (version == 2) { + // version 2 + const auto& elements = v.toTupleRef().elements(); + std::vector non_optional = elements[1].toTensorList().vec(); + std::vector> optional; + + if (elements[2].isTensorList()) { + for (const auto& elem : elements[2].toTensorList()) { + optional.emplace_back(static_cast(elem)); + } + } else { + for (const auto& elem : elements[2].toList()) { + optional.emplace_back(static_cast(elem).toOptional()); + } + } + // create default optional value for bias + if (optional.empty()) { + optional.emplace_back(); + } + + auto config_a = non_optional[0].accessor(); + std::vector config_vals; + config_vals.reserve(config_a.size(0)); + for (const auto i : c10::irange(config_a.size(0))) { + config_vals.emplace_back(config_a[i]); + } + + auto weight = non_optional[1]; + auto bias = optional[0]; + + std::vector> tensors; + tensors.emplace_back(); + tensors.emplace_back(weight); + tensors.emplace_back(bias); + + int64_t version = 3; + return std::tie(version, config_vals, tensors); + } else if (version == 3) { + return v.to(); + } else { + TORCH_INTERNAL_ASSERT(false, "Unexpected serialized qconv version: ", + version); + } +} + +#define QCONV_SERIALIZATION_VERSION 2 + +#if QCONV_SERIALIZATION_VERSION == 2 +using ConvParamsSerializationType = ConvParamsSerializationTypeV2; + +template +ConvParamsSerializationTypeV2 serialize_conv( + const c10::intrusive_ptr>& params) { + + std::string version = "2"; + std::vector non_optional; + std::vector> optional; + + // create a packed int8_t tensor for conv params + std::vector params_vec; + params_vec.push_back(kSpatialDim); + auto stride = params->stride().vec(); + params_vec.insert(params_vec.end(), stride.begin(), stride.end()); + auto padding = params->padding().vec(); + params_vec.insert(params_vec.end(), padding.begin(), padding.end()); + auto dilation = params->dilation().vec(); + params_vec.insert(params_vec.end(), dilation.begin(), dilation.end()); + auto output_padding = params->output_padding().vec(); + params_vec.insert(params_vec.end(), output_padding.begin(), + output_padding.end()); + params_vec.push_back(params->groups()); + params_vec.push_back(params->transpose()); + int64_t vec_size = params_vec.size(); + at::Tensor params_tensor = at::from_blob( + params_vec.data(), {vec_size}, + at::TensorOptions().dtype(at::kShort)) + // clone to retain ownership of the data + .clone(); + + auto [weight, bias] = params->unpack(); + + non_optional.emplace_back(std::move(params_tensor)); + non_optional.emplace_back(std::move(weight)); + optional.emplace_back(std::move(bias)); + + return std::tie(version, non_optional, optional); +} + +#elif QCONV_SERIALIZATION_VERSION == 3 +using ConvParamsSerializationType = ConvParamsSerializationTypeV3; + +template +ConvParamsSerializationTypeV3 serialize_conv( + const c10::intrusive_ptr>& params) { + std::vector config_vals; + config_vals.push_back(kSpatialDim); + auto stride = params->stride().vec(); + config_vals.insert(config_vals.end(), stride.begin(), stride.end()); + auto padding = params->padding().vec(); + config_vals.insert(config_vals.end(), padding.begin(), padding.end()); + auto dilation = params->dilation().vec(); + config_vals.insert(config_vals.end(), dilation.begin(), dilation.end()); + auto output_padding = params->output_padding().vec(); + config_vals.insert(config_vals.end(), output_padding.begin(), + output_padding.end()); + config_vals.push_back(params->groups()); + config_vals.push_back(params->transpose()); + + auto [weight, bias] = params->unpack(); + + std::vector> tensors; + tensors.emplace_back(); + tensors.emplace_back(weight); + tensors.emplace_back(bias); + + int64_t version = 3; + return std::tie(version, config_vals, tensors); +} + +#else +#error "Invalid qconv serialization version." +#endif + +template +c10::intrusive_ptr> deserialize_conv( + ConvParamsSerializationTypeV3 state) { + auto [version, config_vals, tensors] = state; + TORCH_INTERNAL_ASSERT(version == 3, "Unexpected serialized qconv version: ", version); + + TORCH_CHECK(tensors.size() == 3, "Wrong number of tensors", tensors.size()); + c10::optional weight = tensors[1]; + c10::optional bias = tensors[2]; + TORCH_INTERNAL_ASSERT(weight, "Weight should always be present in serialized qconv."); + + torch::List stride, padding, output_padding, dilation; + // skip kSpatialDim + int idx = 1; + for (C10_UNUSED const auto i : c10::irange(kSpatialDim)) { + stride.emplace_back(config_vals.at(idx)); + idx++; + } + for (C10_UNUSED const auto i : c10::irange(kSpatialDim)) { + padding.emplace_back(config_vals.at(idx)); + idx++; + } + for (C10_UNUSED const auto i : c10::irange(kSpatialDim)) { + dilation.emplace_back(config_vals.at(idx)); + idx++; + } + for (C10_UNUSED const auto i : c10::irange(kSpatialDim)) { + TORCH_INTERNAL_ASSERT(idx < static_cast(config_vals.size()), + "Unexpected index = ", idx, " for config_vals of size ", + config_vals.size()); + output_padding.emplace_back(config_vals.at(idx)); + idx++; + } + int64_t groups = config_vals.at(idx); + idx++; + int64_t flags = config_vals.at(idx); + idx++; + TORCH_INTERNAL_ASSERT(idx == static_cast(config_vals.size()), + "Unexpected length of config_vals, expected ", + idx, + " got ", + config_vals.size()); + + bool transpose = flags & (1 << 0); + + int64_t other_flags = flags & ~(1 << 0); + TORCH_INTERNAL_ASSERT(other_flags == 0, "Unexpected flags set in ", flags, "."); + + auto& ctx = at::globalContext(); + +#ifdef USE_FBGEMM + if (ctx.qEngine() == at::QEngine::X86) { +#if AT_MKLDNN_ENABLED() + bool use_onednn = onednn_utils::should_use_onednn_quant( + weight.value(), transpose, groups, output_padding); + if (use_onednn) { + return PackedConvWeightsOnednn::prepack( + weight.value(), + bias, + stride, + padding, + output_padding, + dilation, + groups, + transpose + ); + } +#endif + return PackedConvWeight::prepack( + weight.value(), + bias, + stride, + padding, + output_padding, + dilation, + groups, + transpose + ); + } // x86 +#endif + +#ifdef USE_FBGEMM + if (ctx.qEngine() == at::QEngine::FBGEMM) { + return PackedConvWeight::prepack( + weight.value(), + bias, + stride, + padding, + output_padding, + dilation, + groups, + transpose + ); + } +#endif // USE_FBGEMM +#ifdef USE_PYTORCH_QNNPACK + if (ctx.qEngine() == at::QEngine::QNNPACK) { + TORCH_CHECK( + kSpatialDim == 2, + "prepack/__setstate__: QNNPACK only supports Conv2d " + "now."); + return PackedConvWeightsQnnp::prepack( + weight.value(), + bias, + stride, + padding, + output_padding, + dilation, + groups, + transpose + ); + } +#endif // USE_PYTORCH_QNNPACK +#if AT_MKLDNN_ENABLED() + if (ctx.qEngine() == at::QEngine::ONEDNN) { + return PackedConvWeightsOnednn::prepack( + weight.value(), + bias, + stride, + padding, + output_padding, + dilation, + groups, + transpose + ); + } +#endif // AT_MKLDNN_ENABLED() +TORCH_CHECK( + false, + "Didn't find engine for when deserializing ConvPackedParams: ", + toString(ctx.qEngine())); +} diff --git a/shared/package-files/33/33eee347c02ac8fbbcb935dbc3820d2dbf51b192ab3e66653ceed3eccb2443ff/blob b/shared/package-files/33/33eee347c02ac8fbbcb935dbc3820d2dbf51b192ab3e66653ceed3eccb2443ff/blob new file mode 100644 index 0000000000000000000000000000000000000000..ee0956afdd7a982769fdb5035db02e17fac3f2cb --- /dev/null +++ b/shared/package-files/33/33eee347c02ac8fbbcb935dbc3820d2dbf51b192ab3e66653ceed3eccb2443ff/blob @@ -0,0 +1,373 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include +#include +#include + +#include "arrow/filesystem/filesystem.h" +#include "arrow/util/macros.h" +#include "arrow/util/uri.h" + +namespace Azure::Core::Credentials { +class TokenCredential; +} + +namespace Azure::Storage { +class StorageSharedKeyCredential; +} + +namespace Azure::Storage::Blobs { +class BlobServiceClient; +} + +namespace Azure::Storage::Files::DataLake { +class DataLakeFileSystemClient; +class DataLakeServiceClient; +} // namespace Azure::Storage::Files::DataLake + +namespace arrow::fs { + +class TestAzureFileSystem; +class TestAzureOptions; + +/// Options for the AzureFileSystem implementation. +/// +/// By default, authentication is handled by the Azure SDK's credential chain +/// which may read from multiple environment variables, such as: +/// - `AZURE_TENANT_ID` +/// - `AZURE_CLIENT_ID` +/// - `AZURE_CLIENT_SECRET` +/// - `AZURE_AUTHORITY_HOST` +/// - `AZURE_CLIENT_CERTIFICATE_PATH` +/// - `AZURE_FEDERATED_TOKEN_FILE` +/// +/// Functions are provided for explicit configuration of credentials if that is preferred. +struct ARROW_EXPORT AzureOptions { + friend class TestAzureOptions; + + /// \brief The name of the Azure Storage Account being accessed. + /// + /// All service URLs will be constructed using this storage account name. + /// `ConfigureAccountKeyCredential` assumes the user wants to authenticate + /// this account. + std::string account_name; + + /// \brief hostname[:port] of the Azure Blob Storage Service. + /// + /// If the hostname is a relative domain name (one that starts with a '.'), then storage + /// account URLs will be constructed by prepending the account name to the hostname. + /// If the hostname is a fully qualified domain name, then the hostname will be used + /// as-is and the account name will follow the hostname in the URL path. + /// + /// Default: ".blob.core.windows.net" + std::string blob_storage_authority = ".blob.core.windows.net"; + + /// \brief hostname[:port] of the Azure Data Lake Storage Gen 2 Service. + /// + /// If the hostname is a relative domain name (one that starts with a '.'), then storage + /// account URLs will be constructed by prepending the account name to the hostname. + /// If the hostname is a fully qualified domain name, then the hostname will be used + /// as-is and the account name will follow the hostname in the URL path. + /// + /// Default: ".dfs.core.windows.net" + std::string dfs_storage_authority = ".dfs.core.windows.net"; + + /// \brief Azure Blob Storage connection transport. + /// + /// Default: "https" + std::string blob_storage_scheme = "https"; + + /// \brief Azure Data Lake Storage Gen 2 connection transport. + /// + /// Default: "https" + std::string dfs_storage_scheme = "https"; + + // TODO(GH-38598): Add support for more auth methods. + // std::string connection_string; + // std::string sas_token; + + /// \brief Default metadata for OpenOutputStream. + /// + /// This will be ignored if non-empty metadata is passed to OpenOutputStream. + std::shared_ptr default_metadata; + + /// Whether OutputStream writes will be issued in the background, without blocking. + bool background_writes = true; + + private: + enum class CredentialKind { + kDefault, + kAnonymous, + kStorageSharedKey, + kSASToken, + kClientSecret, + kManagedIdentity, + kCLI, + kWorkloadIdentity, + kEnvironment, + } credential_kind_ = CredentialKind::kDefault; + + std::shared_ptr + storage_shared_key_credential_; + std::string sas_token_; + mutable std::shared_ptr token_credential_; + + public: + AzureOptions(); + ~AzureOptions(); + + private: + void ExtractFromUriSchemeAndHierPart(const Uri& uri, std::string* out_path); + Status ExtractFromUriQuery(const Uri& uri); + + public: + /// \brief Construct a new AzureOptions from an URI. + /// + /// Supported formats: + /// + /// 1. abfs[s]://\.blob.core.windows.net[/\[/\]] + /// 2. abfs[s]://\\@\.dfs.core.windows.net[/path] + /// 3. abfs[s]://[\[\<:port\>][/\[/path]] + /// 4. abfs[s]://[\[/path] + /// + /// (1) and (2) are compatible with the Azure Data Lake Storage Gen2 URIs + /// [1], (3) is for Azure Blob Storage compatible service including Azurite, + /// and (4) is a shorter version of (1) and (2). + /// + /// Note that there is no difference between abfs and abfss. HTTPS is + /// used with abfs by default. You can force to use HTTP by specifying + /// "enable_tls=false" query. + /// + /// Supported query parameters: + /// + /// * blob_storage_authority: Set AzureOptions::blob_storage_authority + /// * dfs_storage_authority: Set AzureOptions::dfs_storage_authority + /// * enable_tls: If it's "false" or "0", HTTP not HTTPS is used. + /// * credential_kind: One of "default", "anonymous", "workload_identity", + /// "environment" or "cli". If "default" is specified, it's + /// just ignored. If "anonymous" is specified, + /// AzureOptions::ConfigureAnonymousCredential() is called. If + /// "workload_identity" is specified, + /// AzureOptions::ConfigureWorkloadIdentityCredential() is called. If + /// "environment" is specified, + /// AzureOptions::ConfigureEnvironmentCredential() is called. If "cli" is + /// specified, AzureOptions::ConfigureCLICredential() is called. + /// * tenant_id: You must specify "client_id" and "client_secret" + /// too. AzureOptions::ConfigureClientSecretCredential() is called. + /// * client_id: If you don't specify "tenant_id" and + /// "client_secret", + /// AzureOptions::ConfigureManagedIdentityCredential() is + /// called. If you specify "tenant_id" and "client_secret" too, + /// AzureOptions::ConfigureClientSecretCredential() is called. + /// * client_secret: You must specify "tenant_id" and "client_id" + /// too. AzureOptions::ConfigureClientSecretCredential() is called. + /// * A SAS token is made up of several query parameters. Appending a SAS + /// token to the URI configures SAS token auth by calling + /// AzureOptions::ConfigureSASCredential(). + /// + /// [1]: + /// https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction-abfs-uri + static Result FromUri(const Uri& uri, std::string* out_path); + static Result FromUri(const std::string& uri, std::string* out_path); + + Status ConfigureDefaultCredential(); + Status ConfigureAnonymousCredential(); + Status ConfigureAccountKeyCredential(const std::string& account_key); + Status ConfigureSASCredential(const std::string& sas_token); + Status ConfigureClientSecretCredential(const std::string& tenant_id, + const std::string& client_id, + const std::string& client_secret); + Status ConfigureManagedIdentityCredential(const std::string& client_id = std::string()); + Status ConfigureCLICredential(); + Status ConfigureWorkloadIdentityCredential(); + Status ConfigureEnvironmentCredential(); + + bool Equals(const AzureOptions& other) const; + + std::string AccountBlobUrl(const std::string& account_name) const; + std::string AccountDfsUrl(const std::string& account_name) const; + + Result> + MakeBlobServiceClient() const; + + Result> + MakeDataLakeServiceClient() const; +}; + +/// \brief FileSystem implementation backed by Azure Blob Storage (ABS) [1] and +/// Azure Data Lake Storage Gen2 (ADLS Gen2) [2]. +/// +/// ADLS Gen2 isn't a dedicated service or account type. It's a set of capabilities that +/// support high throughput analytic workloads, built on Azure Blob Storage. All the data +/// ingested via the ADLS Gen2 APIs is persisted as blobs in the storage account. +/// ADLS Gen2 provides filesystem semantics, file-level security, and Hadoop +/// compatibility. ADLS Gen1 exists as a separate object that will retired on 2024-02-29 +/// and new ADLS accounts use Gen2 instead. +/// +/// ADLS Gen2 and Blob APIs can operate on the same data, but there are +/// some limitations [3]. The ones that are relevant to this +/// implementation are listed here: +/// +/// - You can't use Blob APIs, and ADLS APIs to write to the same instance of a file. If +/// you write to a file by using ADLS APIs then that file's blocks won't be visible +/// to calls to the GetBlockList Blob API. The only exception is when you're +/// overwriting. +/// - When you use the ListBlobs operation without specifying a delimiter, the results +/// include both directories and blobs. If you choose to use a delimiter, use only a +/// forward slash (/) \--- the only supported delimiter. +/// - If you use the DeleteBlob API to delete a directory, that directory is deleted only +/// if it's empty. This means that you can't use the Blob API delete directories +/// recursively. +/// +/// [1]: https://azure.microsoft.com/en-us/products/storage/blobs +/// [2]: https://azure.microsoft.com/en-us/products/storage/data-lake-storage +/// [3]: +/// https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-known-issues +class ARROW_EXPORT AzureFileSystem : public FileSystem { + private: + class Impl; + std::unique_ptr impl_; + + explicit AzureFileSystem(std::unique_ptr&& impl); + + friend class TestAzureFileSystem; + void ForceCachedHierarchicalNamespaceSupport(int hns_support); + + public: + ~AzureFileSystem() override = default; + + static Result> Make( + const AzureOptions& options, const io::IOContext& = io::default_io_context()); + + std::string type_name() const override { return "abfs"; } + + /// Return the original Azure options when constructing the filesystem + const AzureOptions& options() const; + + bool Equals(const FileSystem& other) const override; + + /// \cond FALSE + using FileSystem::CreateDir; + using FileSystem::DeleteDirContents; + using FileSystem::GetFileInfo; + using FileSystem::OpenAppendStream; + using FileSystem::OpenOutputStream; + /// \endcond + + Result GetFileInfo(const std::string& path) override; + + Result GetFileInfo(const FileSelector& select) override; + + Status CreateDir(const std::string& path, bool recursive) override; + + /// \brief Delete a directory and its contents recursively. + /// + /// Atomicity is guaranteed only on Hierarchical Namespace Storage accounts. + Status DeleteDir(const std::string& path) override; + + /// \brief Non-atomically deletes the contents of a directory. + /// + /// This function can return a bad Status after only partially deleting the + /// contents of the directory. + Status DeleteDirContents(const std::string& path, bool missing_dir_ok) override; + + /// \brief Deletion of all the containers in the storage account (not + /// implemented for safety reasons). + /// + /// \return Status::NotImplemented + Status DeleteRootDirContents() override; + + /// \brief Deletes a file. + /// + /// Supported on both flat namespace and Hierarchical Namespace storage + /// accounts. A check is made to guarantee the parent directory doesn't + /// disappear after the blob is deleted and while this operation is running, + /// no other client can delete the parent directory due to the use of leases. + /// + /// This means applications can safely retry this operation without coordination to + /// guarantee only one client/process is trying to delete the same file. + Status DeleteFile(const std::string& path) override; + + /// \brief Move/rename a file or directory. + /// + /// There are no files immediately at the root directory, so paths like + /// "/segment" always refer to a container of the storage account and are + /// treated as directories. + /// + /// If `dest` exists but the operation fails for some reason, `Move` + /// guarantees `dest` is not lost. + /// + /// Conditions for a successful move: + /// + /// 1. `src` must exist. + /// 2. `dest` can't contain a strict path prefix of `src`. More generally, + /// a directory can't be made a subdirectory of itself. + /// 3. If `dest` already exists and it's a file, `src` must also be a file. + /// `dest` is then replaced by `src`. + /// 4. All components of `dest` must exist, except for the last. + /// 5. If `dest` already exists and it's a directory, `src` must also be a + /// directory and `dest` must be empty. `dest` is then replaced by `src` + /// and its contents. + /// + /// Leases are used to guarantee the pre-condition checks and the rename + /// operation are atomic: other clients can't invalidate the pre-condition in + /// the time between the checks and the actual rename operation. + /// + /// This is possible because Move() is only support on storage accounts with + /// Hierarchical Namespace Support enabled. + /// + /// ## Limitations + /// + /// - Moves are not supported on storage accounts without + /// Hierarchical Namespace support enabled + /// - Moves across different containers are not supported + /// - Moving a path of the form `/container` is not supported as it would + /// require moving all the files in a container to another container. + /// The only exception is a `Move("/container_a", "/container_b")` where + /// both containers are empty or `container_b` doesn't even exist. + /// The atomicity of the emptiness checks followed by the renaming operation + /// is guaranteed by the use of leases. + Status Move(const std::string& src, const std::string& dest) override; + + Status CopyFile(const std::string& src, const std::string& dest) override; + + Result> OpenInputStream( + const std::string& path) override; + + Result> OpenInputStream(const FileInfo& info) override; + + Result> OpenInputFile( + const std::string& path) override; + + Result> OpenInputFile( + const FileInfo& info) override; + + Result> OpenOutputStream( + const std::string& path, + const std::shared_ptr& metadata) override; + + Result> OpenAppendStream( + const std::string& path, + const std::shared_ptr& metadata) override; + + Result PathFromUri(const std::string& uri_string) const override; +}; + +} // namespace arrow::fs diff --git a/shared/package-files/33/33ef6721d000ca7309ec5bc51531d7244519153f2e3936e2cdfe593a7389f939/blob b/shared/package-files/33/33ef6721d000ca7309ec5bc51531d7244519153f2e3936e2cdfe593a7389f939/blob new file mode 100644 index 0000000000000000000000000000000000000000..036e4de20ba538bc4dbe6636fc802fb9c8f10e5d --- /dev/null +++ b/shared/package-files/33/33ef6721d000ca7309ec5bc51531d7244519153f2e3936e2cdfe593a7389f939/blob @@ -0,0 +1,132 @@ +import pytest + +from pandas import Series +from pandas.core.strings.accessor import StringMethods + +_any_string_method = [ + ("cat", (), {"sep": ","}), + ("cat", (Series(list("zyx")),), {"sep": ",", "join": "left"}), + ("center", (10,), {}), + ("contains", ("a",), {}), + ("count", ("a",), {}), + ("decode", ("UTF-8",), {}), + ("encode", ("UTF-8",), {}), + ("endswith", ("a",), {}), + ("endswith", ((),), {}), + ("endswith", (("a",),), {}), + ("endswith", (("a", "b"),), {}), + ("endswith", (("a", "MISSING"),), {}), + ("endswith", ("a",), {"na": True}), + ("endswith", ("a",), {"na": False}), + ("extract", ("([a-z]*)",), {"expand": False}), + ("extract", ("([a-z]*)",), {"expand": True}), + ("extractall", ("([a-z]*)",), {}), + ("find", ("a",), {}), + ("findall", ("a",), {}), + ("get", (0,), {}), + # because "index" (and "rindex") fail intentionally + # if the string is not found, search only for empty string + ("index", ("",), {}), + ("join", (",",), {}), + ("ljust", (10,), {}), + ("match", ("a",), {}), + ("fullmatch", ("a",), {}), + ("normalize", ("NFC",), {}), + ("pad", (10,), {}), + ("partition", (" ",), {"expand": False}), + ("partition", (" ",), {"expand": True}), + ("repeat", (3,), {}), + ("replace", ("a", "z"), {}), + ("rfind", ("a",), {}), + ("rindex", ("",), {}), + ("rjust", (10,), {}), + ("rpartition", (" ",), {"expand": False}), + ("rpartition", (" ",), {"expand": True}), + ("slice", (0, 1), {}), + ("slice_replace", (0, 1, "z"), {}), + ("split", (" ",), {"expand": False}), + ("split", (" ",), {"expand": True}), + ("startswith", ("a",), {}), + ("startswith", (("a",),), {}), + ("startswith", (("a", "b"),), {}), + ("startswith", (("a", "MISSING"),), {}), + ("startswith", ((),), {}), + ("startswith", ("a",), {"na": True}), + ("startswith", ("a",), {"na": False}), + ("removeprefix", ("a",), {}), + ("removesuffix", ("a",), {}), + # translating unicode points of "a" to "d" + ("translate", ({97: 100},), {}), + ("wrap", (2,), {}), + ("zfill", (10,), {}), +] + list( + zip( + [ + # methods without positional arguments: zip with empty tuple and empty dict + "capitalize", + "cat", + "get_dummies", + "isalnum", + "isalpha", + "isdecimal", + "isdigit", + "islower", + "isnumeric", + "isspace", + "istitle", + "isupper", + "len", + "lower", + "lstrip", + "partition", + "rpartition", + "rsplit", + "rstrip", + "slice", + "slice_replace", + "split", + "strip", + "swapcase", + "title", + "upper", + "casefold", + ], + [()] * 100, + [{}] * 100, + ) +) +ids, _, _ = zip(*_any_string_method) # use method name as fixture-id +missing_methods = {f for f in dir(StringMethods) if not f.startswith("_")} - set(ids) + +# test that the above list captures all methods of StringMethods +assert not missing_methods + + +@pytest.fixture(params=_any_string_method, ids=ids) +def any_string_method(request): + """ + Fixture for all public methods of `StringMethods` + + This fixture returns a tuple of the method name and sample arguments + necessary to call the method. + + Returns + ------- + method_name : str + The name of the method in `StringMethods` + args : tuple + Sample values for the positional arguments + kwargs : dict + Sample values for the keyword arguments + + Examples + -------- + >>> def test_something(any_string_method): + ... s = Series(['a', 'b', np.nan, 'd']) + ... + ... method_name, args, kwargs = any_string_method + ... method = getattr(s.str, method_name) + ... # will not raise + ... method(*args, **kwargs) + """ + return request.param diff --git a/shared/package-files/33/33f206593c938eb5fdd0da338d551fc2d3ed4ea60d912803c5f05202b3deb30b/blob b/shared/package-files/33/33f206593c938eb5fdd0da338d551fc2d3ed4ea60d912803c5f05202b3deb30b/blob new file mode 100644 index 0000000000000000000000000000000000000000..8ad5dd1d75e81258ee47dce3080abf1915eee2bd --- /dev/null +++ b/shared/package-files/33/33f206593c938eb5fdd0da338d551fc2d3ed4ea60d912803c5f05202b3deb30b/blob @@ -0,0 +1,48711 @@ +{ + "parent_package": "/workspace/research/production-affinity-length1/candidate/package", + "parent_provenance": { + "method": "Three-parameter affinity length residual supported by held-out-half recipe evidence", + "parent": "/workspace/research/production-solubility-mean1/candidate/package", + "parent_model_sha256": "ea3bb28deaae8b95f10e8fcfe83ae5f1884eac7c3ecfece4ba5669a31d3e304f", + "parent_provenance": { + "parent_package": "/workspace/research/production-dual-fold-fullpool1/candidate/package", + "parent_sha256": "492ad2b7a8866a3d633616adbc75f29ec4cf093b14957d63171bffa842ea7e07", + "parent_provenance": { + "parent_package": "/workspace/research/production-fold-shared1/candidate/package", + "parent_model_sha256": "93a8fa2aadcb92983cefa53154866e9efc47a21deea0d847042c1f836883b513", + "parent_provenance": { + "parent_package": "/workspace/research/production-allfit-ss1/candidate/package", + "parent_sha256": "7d2e535cf57b776189bd0a6658cf6aca790af0253bb4814ef6a19deffb0f7c39", + "parent_provenance": { + "parent_package": "/workspace/research/production-dual-residue-ss1/candidate/package", + "parent_sha256": "d52293a81c168347002c88a81f2469cb8be72e7a527699946b68b4614b857dfe", + "parent_provenance": { + "parent_package": "/workspace/research/production-shared-fusion8h-ss1/candidate/package", + "parent_sha256": "f7c7dbbdcd9d6f4cc853b2074d1501579c24588405c121430a67b6f0482324d8", + "parent_provenance": { + "parent_package": "/workspace/research/production-dual-summary-subcellular1/candidate/package", + "parent_sha256": "8badfd129686a5d20216b1aba16450f6f471722c8b6ddfc61278dd572283abc0", + "parent_provenance": { + "method": "One primary backbone remains common to all11 tasks. Configured classification heads concatenate two native seven-summary representations. Auxiliary encoder is stored once and was itself jointly trained on all11 tasks.", + "primary_package": "/workspace/research/selected-stability-lengthweight1-replay/candidate/package", + "primary_sha256": "d581e2aad1c8ea712968423348ff2c540352c7d9ad2b36a46e795a1f4d31b73b", + "primary_provenance": { + "parent_package": "/workspace/research/selected-stability-midpoint1/candidate/package", + "parent_sha256": "e01ae99a458b5d8d2aba968e1efc663b3d346220fd16b5498a3f91b5cf29626c", + "parent_provenance": { + "method": "One fixed 50:50 parameter midpoint of parent and fit-only 16-epoch stability head continuation; no ensemble.", + "source_parent": "/workspace/research/shared-summary-residual1/candidate/package", + "source_candidate": "/workspace/research/selected-stability-head64/candidate/package", + "source_model_sha256": { + "/workspace/research/shared-summary-residual1/candidate/package": "f890eebb10bb2dc08b84c28e7e0378960af5df4fb0d646ab2e8b33e130c74202", + "/workspace/research/selected-stability-head64/candidate/package": "8fe80a673a65650bb5769b1cf75a59f10a65961da91cc62a491094f874042c79" + }, + "parent_provenance": { + "method": "One jointly learned nonlinear residual map over frozen shared sequence summaries, with task-specific zero-initialized outputs.", + "fit_tasks": [ + "solubility", + "subcellular_localization", + "binary_localization" + ], + "selected_tasks": [ + "binary_localization" + ], + "selected_global_step": 3000, + "source": "/workspace/research/ss-distillation-continuation1/candidate/package", + "export_base": "/workspace/research/ss-distillation-continuation1/candidate/package", + "export_base_model_sha256": "4fee0a0154af24665de9a95f11a722017f3fa6d92354475bec8e81235a219f00", + "rebased_SS_tensors": [], + "seed": 20270102, + "steps": 6000, + "lr": 0.001, + "weight_decay": 0.01, + "dropout": 0.2, + "data": "Fit only for gradients and existing normalization; Tune chooses oneglobalcheckpoint andresidualexits usingpredeclaredconditionalCIgate.", + "original_parameters_exact": true, + "parameters": 53000306, + "encoder_parameters": 44150303, + "feature_cache_exported": false + }, + "fit_recipe": { + "seed": 20270129, + "epochs": 64, + "evaluate_epochs": [ + 4, + 16, + 32, + 64 + ], + "batch_size": 512, + "lr": 0.0001, + "weight_decay": 0.01, + "loss": "MSE to original fit-standardized stabilitylabels, matching selectedmodeltarget semantics;clip1;originaldropout active inbotharms;fixednormalizationbuffers. No newranktargetchange.", + "optimizer": "FreshCPUAdamW,cosine64epochs to0.1floor; matcheddataorder/dropoutRNG/updatecounts; per-epochatomicresume." + }, + "source_selected_epoch": 16, + "diagnostic": { + "utc": "2026-10-25T13:39:33.197851+00:00", + "status": "CPU_diagnostic_complete_no_export", + "alpha": 0.5, + "points": { + "parent": 0.7226969980994319, + "midpoint": 0.7274924148853711, + "whole": 0.7274598466634085 + }, + "midpoint_delta_vs_parent": 0.004795416785939199, + "conditional95": [ + 0.0017412267324550784, + 0.007940572842815559 + ], + "draws": 1000, + "seed": 20270130, + "parameters": 53000306, + "six_changed_learned_tensors": [ + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.linear.weight", + "heads.stability.3.linear.bias" + ], + "all_other_tensors_and_buffers_exact": true, + "eligible_for_manual_complete_replay": true, + "publication": false, + "GPU_used": false, + "limitations": "Singlepredeclaredparameter midpoint, notpredictionensemble. Conditionalrowbootstrapuncorrectedforpriorcheckpointselectionandfamilydependence. CPUdiagnosticisnotan11taskreplay.", + "source_sha256": { + "/workspace/research/check_selected_stability_midpoint.py": "13615a5b2689a0bd503cbc8a9a8a722014962677f6769cec871e13aa5133ff77", + "/workspace/research/shared-summary-residual1/candidate/package/model.pt": "f890eebb10bb2dc08b84c28e7e0378960af5df4fb0d646ab2e8b33e130c74202", + "/workspace/research/selected-stability-head64/candidate/package/model.pt": "8fe80a673a65650bb5769b1cf75a59f10a65961da91cc62a491094f874042c79" + } + }, + "data": "Fit-only labels and fixed normalization; tune selects epoch and evaluates one predeclared midpoint.", + "parameters": 53000306, + "feature_cache_exported": false + }, + "fit_plan": { + "utc": "2026-10-25T16:08:33.461759+00:00", + "status": "queued", + "CPU_only": true, + "recovery_registered": false, + "source_package": "/workspace/research/selected-stability-midpoint1/candidate/package", + "source_report": "/workspace/research/selected-stability-midpoint1/candidate/report.json", + "features": "/workspace/research/rank-target-functions2/features-stability", + "feature_producer": "/workspace/research/rank-target-fluorescence1/candidate/package", + "arms": [ + "natural", + "balanced" + ], + "expected_fit_lengths": [ + 43, + 50 + ], + "seed": 20270208, + "threads": 6, + "epochs": 16, + "batch_size": 512, + "lr": 0.0001, + "weight_decay": 0.01, + "alpha": 0.5, + "minimum_gain": 0.001, + "bootstrap_seed": 20270209, + "bootstrap_draws": 1000, + "hypothesis": "Natural stability fit data are68%43-residue proteins but all observed Tune chains have50residues. Equal loss mass for the two fit-length groups may reduce interference on the50-residue domain. This is a test prompted by visible Tune distribution, not evidence of benefit.", + "loss": "Original-fit-standardized-label MSE. Identical shuffled full-fit batches in both arms; natural unit weights; balanced weights N/(2*N_group), averaged over minibatch without per-batch renormalization. Both train all six existing head tensors, fixed feature-normalization buffers.", + "schedule": "FreshAdamW,16epochs/1680updates,cosine to0.1floor,clip1; originaldropoutactive with identical RNG and data order. Same current selected initial head.", + "selection": "Only one fixed50:50 parameter midpoint at the final16epoch endpoint per arm is eligible. Raw endpoints are descriptive. Require gain>=.001 and positive conditional95versus selected; balanced additionally requires positive conditional95versus natural control. No intermediate Tune selection, no seed/mixture grid. Manual review then full11 native replay before any publication.", + "all_task_policy": "Only six stabilityheadparameters may change. Shared encoder remains jointly learned for all11. All10otherparameters/config/outputfiles must remain exact on native replay. No automatic export or publication.", + "resume": "CPU per-epoch atomic optimizer/head/NumPy/torchRNG checkpoints; rerun same script after interruption. Planhash verified on resume.", + "recovery_command": [ + "env", + "CUDA_VISIBLE_DEVICES=", + "OMP_NUM_THREADS=6", + "MKL_NUM_THREADS=6", + "OPENBLAS_NUM_THREADS=1", + "python3", + "-u", + "/workspace/research/run_stability_length_weighting.py", + "--run", + "/workspace/research/selected-stability-lengthweight1" + ], + "frozen_sha256": { + "/workspace/research/run_stability_length_weighting.py": "3c5aac6a79a1397e5c50278a7635e32d7c3583438f64996c8a42a372d16a29f6", + "/workspace/research/check_shared_adapters_cpu.py": "db7d8d846b90929decad5865de36dd55fb95139aaa116b6ae2987cd96786c990", + "/workspace/research/crossfit_beta_labels.py": "bd1d29e2ab78cb0273213ef1a00657cef450a91f155ba7d9aa7f3db7721bd632", + "/workspace/research/stability-length-shift-diagnostic.json": "36a890f702bb6709e893c5f9d94c5cf15959f83f4a91d71e58a7b5f681065f6d", + "/workspace/research/selected-stability-midpoint1/candidate/report.json": "feedb171d285a4fa4d3c2a2bdd819873caaad1308ef90fd59df9df1ace166827", + "/workspace/research/selected-stability-midpoint1/candidate/package/model.pt": "e01ae99a458b5d8d2aba968e1efc663b3d346220fd16b5498a3f91b5cf29626c", + "/workspace/research/selected-stability-midpoint1/candidate/package/config.json": "162a2f4985944bba7492854315bd594fd3a38386548ab1c6b0c7a4f0d2bd7625", + "/workspace/research/selected-stability-midpoint1/candidate/package/unified.py": "bb00abef5853bc8badfef6a8d38ef8cb11f0ff6d9fe143eb7deebd582058efa3", + "/workspace/research/selected-stability-midpoint1/candidate/package/esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "/workspace/research/selected-stability-midpoint1/candidate/package/replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "/workspace/research/selected-stability-midpoint1/candidate/package/infer.sh": "60f55b73f5b39a35a61df84026abed9a127b1cc035d650c9e1ca62f54fc2b468", + "/workspace/research/rank-target-fluorescence1/candidate/package/model.pt": "a13dad3c4f0cd7a1917d5b6763b27aaf3d38f3b7d775e747b61241ea36b681e0", + "/workspace/research/rank-target-fluorescence1/candidate/package/config.json": "e3da1d0ea2df3e6d6cc8b069016bffca2a37fd05accf1597cc6453f946d8fd89", + "/workspace/research/rank-target-functions2/features-stability/stability-fit.pt": "3fde47645a74370a003dd5f509a73ccecbaaac36ce4e8871938979a003ba3862", + "/workspace/research/rank-target-functions2/features-stability/stability-tune.pt": "92066e0c8abfcfc4ac3b8f2c7edcc4319cb8f8b4b97b53dd6e589147a1c460bf" + } + }, + "fit_outcome": { + "utc": "2026-10-25T16:08:53.918703+00:00", + "status": "cached_analysis_complete", + "arms": { + "natural": { + "arm": "natural", + "endpoint_reward": 0.7291215996959544, + "raw_reward_descriptive_only": 0.72991937369715, + "step": 1680, + "active_seconds": 5.326252081984421, + "final_numpy_rng": { + "bit_generator": "PCG64", + "state": { + "state": 264542032468656517169208881192101401107, + "inc": 100251262600960163324587047460976422035 + }, + "has_uint32": 1, + "uinteger": 637011686 + }, + "final_torch_rng_sha256": "fd56e05488c9ae31e940c2b1d859f13ca90497826206c0e3602aaba9c339ef52", + "optimizer_steps": [ + 1680.0 + ], + "lr": 1.0000078679859099e-05, + "fixed_buffers_exact": true + }, + "balanced": { + "arm": "balanced", + "endpoint_reward": 0.7311607642876724, + "raw_reward_descriptive_only": 0.7330130871638806, + "step": 1680, + "active_seconds": 5.340115340979537, + "final_numpy_rng": { + "bit_generator": "PCG64", + "state": { + "state": 264542032468656517169208881192101401107, + "inc": 100251262600960163324587047460976422035 + }, + "has_uint32": 1, + "uinteger": 637011686 + }, + "final_torch_rng_sha256": "fd56e05488c9ae31e940c2b1d859f13ca90497826206c0e3602aaba9c339ef52", + "optimizer_steps": [ + 1680.0 + ], + "lr": 1.0000078679859099e-05, + "fixed_buffers_exact": true + } + }, + "comparisons": { + "natural_vs_parent": { + "delta": 0.001629184810583273, + "conditional_95": [ + 0.00024683637661263025, + 0.003237432482155497 + ] + }, + "balanced_vs_parent": { + "delta": 0.0036683494023013186, + "conditional_95": [ + 0.0019018632266723152, + 0.0054815225624275 + ] + }, + "balanced_vs_natural": { + "delta": 0.0020391645917180456, + "conditional_95": [ + 0.0012832147204794586, + 0.0028118185483942955 + ] + } + }, + "eligible_arms": [ + "natural", + "balanced" + ], + "published": false, + "GPU_used": false, + "candidate_exported": false, + "matched_order_dropout_optimizer_clocks": true, + "ten_other_tasks": "No state edited; any proposed export must keep their parameters/configuration exact and independently replay all eleven.", + "limitations": "Conditional example bootstrap after repeated tune inspection; family dependence and selection uncertainty omitted. Tune length distribution informed this hypothesis. Raw endpoints are descriptive only. No full-pool or test-time fitting." + }, + "changed_tensors": [ + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.linear.weight", + "heads.stability.3.linear.bias" + ], + "all_other_tensors_and_buffers_exact": true, + "method": "One fixed final balanced-length continuation midpoint; no output averaging or test-time fitting." + }, + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "auxiliary_sha256": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "auxiliary_provenance": { + "method": "Fixed rank-target readout transfer within one tensor-identical shared backbone", + "parent": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/candidate/package", + "parent_provenance": { + "method": "Consolidated task readouts with tensor-identical jointly learned shared components; one literal parameter set", + "shared_parameter_digest": "397be7af196fb356e544d391fbcdc9928f0ea6e4cfd66ab6ea4a4e4c656770bc", + "head_sources": { + "fluorescence": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fluorescence/package", + "stability": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-stability/package", + "beta_lactamase": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-beta_lactamase/package", + "solubility": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-solubility/package", + "subcellular_localization": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-subcellular_localization/package", + "binary_localization": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "fold": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fold/package", + "secondary_structure": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-secondary_structure/package", + "yeast_ppi": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-yeast_ppi/package", + "human_ppi": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "ppi_affinity": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-ppi_affinity/package" + }, + "parent_provenance": [ + { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "beta_lactamase", + "readout_kind": "residue", + "bins": 320, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fluorescence", + "readout_kind": "residue", + "bins": 256, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fold", + "readout_kind": "summary", + "bins": null, + "ridge": 0.0001, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.5, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "ppi_affinity", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random linear local readout on same joint residue states; fit-only fixed normalization and sampled fit residue labels; ridge cross entropy LBFGS", + "seed": 20261103, + "fit_residues_including_window_duplicates": 505584, + "kernel": 9, + "ridge": 0.01, + "retained_learned_nonlinear_prefix": true, + "training_device": "cuda", + "tune_policy": "fixed supplied strengths or default three strengths; full valid-residue accuracy with overlapping-window probability aggregation", + "tested_ridges": [ + 0.01 + ], + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "solubility", + "readout_kind": "summary", + "bins": null, + "ridge": 0.1, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Retained joint pair nonlinear prefix; random final layer fit using fixed fit normalization and regularized LBFGS", + "seed": 20261107, + "selected_ridges": { + "stability": 0.001 + }, + "tested_ridges": [ + 0.001 + ], + "tune_policy": "fixed supplied strengths or default five strengths; small tune sets limit confidence", + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "subcellular_localization", + "readout_kind": "summary", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "yeast_ppi", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + } + ], + "feature_cache_exported": false, + "pair_context_selection": { + "policy": "One fixed1536-token alternative versus the current context, chosen on tune with all learned tensors frozen.", + "choice_basis": "Earlier fit-only chain-length audit; human and yeast fit maxima1500/1495residues.", + "choices": { + "human_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8180272108843538, + "macro_f1": 0.8181606424889357, + "reward": 0.819047619047619 + }, + "1536": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8171768707482994, + "macro_f1": 0.817806370435012, + "reward": 0.819047619047619 + } + } + }, + "yeast_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.5894736842105263, + "balanced_accuracy": 0.570054945054945, + "macro_f1": 0.5704347826086956, + "reward": 0.5894736842105263 + }, + "1536": { + "accuracy": 0.5789473684210527, + "balanced_accuracy": 0.5611263736263736, + "macro_f1": 0.5614035087719298, + "reward": 0.5789473684210527 + } + } + } + }, + "learned_parameter_updates": 0 + } + }, + "rank_head_sources": { + "fluorescence": "/workspace/research/scale85m-8h-rank3/head-fluorescence/package", + "beta_lactamase": "/workspace/research/scale85m-8h-rank3/head-beta_lactamase/package", + "stability": "/workspace/research/scale85m-8h-rank3/head-stability/package" + }, + "head_seeds": { + "fluorescence": 20261031, + "beta_lactamase": 20261031, + "stability": 20261107 + }, + "ridges": { + "fluorescence": 1.0, + "beta_lactamase": 1.0, + "stability": 0.001 + }, + "fit_only_feature_statistics_and_rank_targets": true, + "all_other_tensors_exact": true, + "feature_cache_exported": false + }, + "readout_evidence": { + "subcellular_localization": { + "plan": { + "created_utc": "2026-10-25T16:59:37.548696+00:00", + "status": "queued", + "recovery_registered": true, + "run": "/workspace/research/dual-summary-subcellular1", + "task": "subcellular_localization", + "feature_checks": "/workspace/research/dual-summary-feature-checks.json", + "features": { + "primary": "/workspace/research/conditioned-readout-refit1/features-summary/subcellular_localization", + "auxiliary": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/subcellular_localization" + }, + "parent_package": "/workspace/research/selected-stability-lengthweight1-replay/candidate/package", + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "parent_predictions": "/workspace/research/selected-stability-lengthweight1-replay/candidate/replay/predictions/subcellular_localization.jsonl", + "frozen_sha256": { + "/workspace/research/dual-summary-feature-checks.json": "c0f3988785747df6360d12eb7d1cfba267f5f80679868fd6f710bde1f803a25f", + "/workspace/research/run_dual_summary_classification_cpu.py": "a8905391b3818364147fc48cc2484aae686a455587ee1d636dae2271abf20474", + "/workspace/research/conditioned-readout-refit1/features-summary/subcellular_localization/fit.pt": "38804fc2d842fa28203cd729e62ebd86ff4acb716cf5ee9e130134a9effdc229", + "/workspace/research/conditioned-readout-refit1/features-summary/subcellular_localization/tune.pt": "8e8a05d1e0553bd24a4915ee88bdc17ee050adc57e989a86874b4de12395a3ec", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/subcellular_localization/fit.pt": "5da5817b413a8c3ab1aaad18f2e888015c2807f1dcb02336bd249031272df6aa", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/subcellular_localization/tune.pt": "e7c213d642afefdcd0a7c329f6628bdda9fd34367750d1e2fe015ac4fc317143" + }, + "recovery_command": [ + "env", + "CUDA_VISIBLE_DEVICES=", + "OMP_NUM_THREADS=4", + "MKL_NUM_THREADS=4", + "OPENBLAS_NUM_THREADS=1", + "/opt/conda/bin/python3", + "-u", + "/workspace/research/run_dual_summary_classification_cpu.py", + "--run", + "/workspace/research/dual-summary-subcellular1" + ], + "hypothesis": "Apply the same dual-summary representation comparison to a classification task whose two native encoders make complementary errors. All11 tasks retain one shared primary backbone; any enabled auxiliary routes also share exactly the same auxiliary encoder state. Task-specific readout heads are allowed; no separate task encoder is fitted.", + "recipe": { + "seed": 20270207, + "arms": [ + "primary", + "auxiliary", + "full" + ], + "same_initial_linear_state": true, + "normalization": "fit-only per-feature mean/std floor1e-5; same-width controls zero the inactive normalized block", + "ridge": 0.01, + "class_weights": null, + "optimizer": "FP32CPU LBFGS lr1,strong_wolfe,history30,tolerance_grad1e-6;15 resumable blocks max10iterations/max50evaluations each", + "selection": "Only final15block head; no grid/earlier checkpoint selection" + }, + "eligibility": "Full gains>.005overfit-onlyparent and paired1000drawconditional95lower>0, fullpointbeatsbothmatchedcontrols, primaryfeaturezeroingdrop>=.02. Then standalonearchitecture/all11native/dependence review. Noautoexport/publication.", + "limitations": "One recipe/seed; repeated tune selection, family dependence, CPU/chunkedoptimizer differences and masked-control L2 effects. Ablation is a dependence diagnostic.", + "queued_utc": "2026-10-25T16:59:38.013790+00:00" + }, + "result": { + "utc": "2026-10-25T17:00:11.081483+00:00", + "status": "eligible_for_shared_architecture_native_review", + "task": "subcellular_localization", + "ridge": 0.01, + "results": { + "primary": { + "accuracy": 0.7513340448239061, + "blocks": 15, + "active_seconds": 10.906512092013145, + "LBFGS_iterations": 150, + "closure_evaluations": 174, + "primary_zeroed_accuracy": 0.28779793667733905, + "auxiliary_zeroed_accuracy": 0.7513340448239061 + }, + "auxiliary": { + "accuracy": 0.7776591960156528, + "blocks": 15, + "active_seconds": 7.2808296459843405, + "LBFGS_iterations": 150, + "closure_evaluations": 178, + "primary_zeroed_accuracy": 0.7776591960156528, + "auxiliary_zeroed_accuracy": 0.28779793667733905 + }, + "full": { + "accuracy": 0.7908217716115261, + "blocks": 15, + "active_seconds": 6.470482572942274, + "LBFGS_iterations": 150, + "closure_evaluations": 173, + "primary_zeroed_accuracy": 0.736392742796158, + "auxiliary_zeroed_accuracy": 0.5990750622554251 + } + }, + "comparisons": { + "full_minus_parent": { + "delta": 0.036997509782995375, + "conditional95": [ + 0.024181785841337605, + 0.05052472429740305 + ] + }, + "full_minus_primary": { + "delta": 0.03948772678762007, + "conditional95": [ + 0.026680896478121666, + 0.05407328352899324 + ] + }, + "full_minus_auxiliary": { + "delta": 0.013162575595873355, + "conditional95": [ + 0.002845962290999644, + 0.022767698327997153 + ] + } + }, + "eligible": true, + "GPU_used": false, + "published": false, + "limitations": "One fixed fit-only readout recipe. CPU float32 versus earlier CUDA references may differ. Repeated tune selection; conditional intervals ignore family dependence. Zeroing normalized primary features is a dependence diagnostic, not an in-distribution intervention. Full native architecture and all11 review required." + } + } + }, + "all_nonchanged_primary_tensors_exact": true, + "auxiliary_encoder_copies": 1, + "only_active_auxiliary_pool_rows_included": true, + "external_weights_used": false, + "disposable_check_weights_used": false, + "training_feature_caches_included": false, + "previous_production": { + "utc": "2026-10-25T16:19:32.935143+00:00", + "package": "/workspace/research/production-stability-lengthweight-fullpool1/candidate/package", + "score_kind": "tune_labels_used_for_fold_fluorescence_beta_lactamase_ppi_affinity_and_stability", + "model_sha256": "a6d4bcb459500aa1b7e624c447156560d5343a5e6edbf2d7d1708f4f8d7871c1", + "inference_assets_sha256": { + "model.pt": "a6d4bcb459500aa1b7e624c447156560d5343a5e6edbf2d7d1708f4f8d7871c1", + "config.json": "162a2f4985944bba7492854315bd594fd3a38386548ab1c6b0c7a4f0d2bd7625", + "esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "unified.py": "bb00abef5853bc8badfef6a8d38ef8cb11f0ff6d9fe143eb7deebd582058efa3", + "replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "infer.sh": "60f55b73f5b39a35a61df84026abed9a127b1cc035d650c9e1ca62f54fc2b468" + }, + "parameters": 53000306, + "fit_only_development_reference": { + "package": "/workspace/research/selected-stability-lengthweight1-replay/candidate/package", + "report": "/workspace/research/selected-stability-lengthweight1-replay/candidate/report.json", + "reward": 0.7166638090200526, + "model_sha256": "d581e2aad1c8ea712968423348ff2c540352c7d9ad2b36a46e795a1f4d31b73b" + }, + "recipe_selection_evidence": { + "kind": "two_fold_added_label_pilot_not_fullpool_model_replay", + "fold_accuracy": 0.26902173913043476, + "parent_fold_accuracy": 0.24864130434782608, + "matched_fit_only_refit_accuracy": 0.23505434782608695, + "fold_delta": 0.020380434782608696, + "conditional_fold_delta95": [ + 0.001358695652173913, + 0.04076086956521739 + ], + "heldout_half_case_gains": [ + 4, + 11 + ], + "other_ten_tasks": "Unchanged parent weights; full production replay must verify byte-identical predictions.", + "limitations": "Prior tune checkpoint/hyperparameter selection biases thisestimate. Halvesarestratifiedbylabel,notproteinfamily. Crossfitestimatestherecipewithhalftheaddedlabels,notafinalfull-poolmodel. Pairedbootstrapisconditionalanddoesnotcorrectalldependence." + }, + "in_sample_verification_report": "/workspace/research/production-stability-lengthweight-fullpool1/candidate/report.json", + "verification": { + "all_eleven_outputs_valid": true, + "other_ten_predictions_byte_identical_to_previous_production": true, + "tune_rows_used_for_fitting": { + "fold": 736, + "fluorescence": 5362, + "beta_lactamase": 520, + "ppi_affinity": 203, + "stability": 2512 + }, + "in_sample_scores_of_reused_label_tasks_excluded_from_selection": true, + "ss_predictions_exact_accepted_fit_only_development": true, + "stability_native_replay_valid_in_sample": true + }, + "training": "Own-session random-initialized shared all-eleven lineage. Stability now uses the fixed balanced-length whole-head recipe on53614fit+2512Tune labels after positive two-halfcrossfit evidence;1680updates from originalownhead and a fixed50:50parameter midpoint. Six learnedheadtensorschanged, all otherproductionstate/configexact.", + "ss_fit_only_selection_evidence": { + "kind": "fit_only_tune_complete_replay", + "task": "secondary_structure", + "before": 0.7438318211771296, + "after": 0.7441316787896526, + "delta": 0.00029985761252291574, + "conditional_95_percentile_interval": [ + 4.102067509503305e-05, + 0.0005682928659789181 + ], + "examples": 2170, + "valid_residues": 556931, + "correct_residue_gain": 167, + "method": "own-session teacher distillation", + "teacher": "Own85M2hMLM+jointall11+taskconditioning; fit-onlylabels; no teacher exported", + "matched_controls": { + "hard": { + "delta": 0.0006984707261761331, + "conditional95": [ + 0.00020130648256647902, + 0.001201981603808556 + ], + "protein_units": 2170, + "valid_residues": 556931, + "draws": 2000, + "limitations": "Conditional paired protein bootstrap, not corrected for repeated tune selection or protein-family dependence." + }, + "smooth": { + "delta": 0.00027112873946682803, + "conditional95": [ + -0.00019057496656699647, + 0.0007187128477994618 + ], + "protein_units": 2170, + "valid_residues": 556931, + "draws": 2000, + "limitations": "Conditional paired protein bootstrap, not corrected for repeated tune selection or protein-family dependence." + } + }, + "other_ten_development_predictions_byte_identical": true, + "limitations": "Conditional paired protein bootstrap, not corrected for repeated tune selection or protein-family dependence. Teacher-versus-smoothing64 interval crosseszero.", + "selected_distillation_epoch": 64, + "distillation_updates": 9152, + "additional_updates_after16": 6864 + }, + "previous_production_package": "/workspace/research/production-stability-lengthweight1/candidate/package", + "tasks_reusing_tune_labels": [ + "fold", + "fluorescence", + "beta_lactamase", + "ppi_affinity", + "stability" + ], + "fluorescence_recipe_selection_evidence": { + "incumbent_spearman": 0.826705913429907, + "matched_fit_only_refit_spearman": 0.8267059285858314, + "crossfit_spearman": 0.8289887921828193, + "crossfit_delta_vs_incumbent": 0.0022828787529123318, + "crossfit_delta_vs_fit_only_refit": 0.0022828635969879274, + "conditional_paired_95_vs_incumbent": [ + 0.0009792262424118709, + 0.0036331746186231443 + ], + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 2681, + "added_tune_rows": 2681, + "training_rows": 24127, + "heldout_spearman": 0.8232686916324296, + "incumbent_same_half_spearman": 0.8211575283985865, + "fit_seconds": 1.7692138720012736, + "closures": 160 + }, + { + "heldout_half": 1, + "heldout_rows": 2681, + "added_tune_rows": 2681, + "training_rows": 24127, + "heldout_spearman": 0.8349378336333676, + "incumbent_same_half_spearman": 0.8324217270853131, + "fit_seconds": 1.6950949229940306, + "closures": 160 + } + ], + "limitations": "Prior tune model selection biases the estimate. Label stratification is not a protein-family split, and unseen test distribution may differ. Combined OOF scores come from two heads with training-only rank normalization, not one full-pool model. Conditional paired bootstrap ignores remaining family dependence and selection." + }, + "beta_lactamase_recipe_selection_evidence": { + "incumbent_spearman": 0.8851158090618965, + "matched_fit_only_refit_spearman": 0.8851173641514167, + "crossfit_spearman": 0.8939613181865891, + "crossfit_delta_vs_incumbent": 0.008845509124692619, + "crossfit_delta_vs_fit_only_refit": 0.008843954035172352, + "conditional_paired_95_vs_incumbent": [ + 0.0030908473904126045, + 0.016275743694867638 + ], + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 260, + "added_tune_rows": 260, + "training_rows": 4418, + "heldout_spearman": 0.8954806478975963, + "incumbent_same_half_spearman": 0.8876831699844637, + "fit_seconds": 0.7535757489968091, + "closures": 163 + }, + { + "heldout_half": 1, + "heldout_rows": 260, + "added_tune_rows": 260, + "training_rows": 4418, + "heldout_spearman": 0.8906708928087468, + "incumbent_same_half_spearman": 0.8805064277745905, + "fit_seconds": 0.7396053560078144, + "closures": 161 + } + ], + "limitations": "Prior tune model selection biases the estimate. Label stratification is not a protein-family split, and unseen test distribution may differ. Combined OOF scores come from two heads with training-only rank normalization, not one full-pool model. Conditional paired bootstrap ignores remaining family dependence and selection." + }, + "ppi_affinity_recipe_selection_evidence": { + "status": "research_only_crossfit_complete", + "task": "ppi_affinity", + "incumbent_reward": 0.5341420012716276, + "matched_fit_only_reward": 0.5210555476068024, + "crossfit_reward": 0.5515877648877663, + "crossfit_delta_vs_incumbent": 0.0174457636161387, + "conditional_paired_95_vs_incumbent": [ + 0.002641673708393072, + 0.0303974991382099 + ], + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 102, + "added_tune_rows": 101, + "reward": 0.5641044100756688, + "incumbent_reward": 0.5459868174958554, + "closures": 166, + "seconds": 0.1286191190010868 + }, + { + "heldout_half": 1, + "heldout_rows": 101, + "added_tune_rows": 102, + "reward": 0.5396756511271861, + "incumbent_reward": 0.522833934532602, + "closures": 163, + "seconds": 0.12902537698391825 + } + ], + "published": false, + "exported": false, + "limitations": "Tune influenced earlier backbone/head selection. Pair-example resampling does not establish protein or family independence. OOF heads are research evidence only, not a single replayable model.", + "publication": "Research-only out-of-fold evidence; no full-pool head, lookup or package is exported." + }, + "shared_summary_fit_only_evidence": { + "kind": "complete_fit_only_tune_replay", + "selected_global_step": 3000, + "jointly_trained_tasks": [ + "solubility", + "subcellular_localization", + "binary_localization" + ], + "parameters_added": 475906, + "tasks": { + "binary_localization": { + "before": 0.9375361480624639, + "after": 0.9462116830537883, + "delta": 0.008675534991324466, + "case_gain": 15, + "conditional95": [ + 0.002891844997108155, + 0.015037593984962405 + ], + "examples": 1729, + "limitations": "Conditional paired-example bootstrap; not corrected for repeated tune selection or family dependence." + } + }, + "other_ten_development_prediction_files_exact": true, + "limitations": "Conditional paired-example bootstrap does not correct repeated tune selection or family dependence. Only binary localization passes the predeclared exit gate." + }, + "stability_fit_only_selection_evidence": { + "kind": "fit_only_complete_tune_replay", + "task": "stability", + "before": 0.7274923808177973, + "after": 0.7311607642876724, + "delta": 0.0036683834698750806, + "conditional_95_percentile_interval": [ + 0.0017767471141417273, + 0.00544199745819068 + ], + "examples": 2512, + "mean_delta": 0.0003334894063522801, + "conditional_mean95": [ + 0.0001615224649219752, + 0.0004947270416536983 + ], + "matched_natural_mixture_control": { + "delta": 0.0020391645917180456, + "conditional_95": [ + 0.0012832147204794586, + 0.0028118185483942955 + ] + }, + "fixed_endpoint_updates": 1680, + "alpha": 0.5, + "ten_other_prediction_files_exact": true, + "limitations": "Conditional on already-selected models. Does not account for repeated tune selection, shared proteins across tasks, or family dependence within splits; not an independent generalization guarantee. The visible Tune length distribution informed the group-weighting hypothesis." + }, + "stability_extra_label_recipe_selection_evidence": { + "utc": "2026-10-25T16:17:04.539090+00:00", + "status": "research_only_crossfit_complete", + "scores": { + "incumbent": 0.7311607642876724, + "matched_fit_only": 0.7311607642876724, + "crossfit": 0.7337159019671029 + }, + "comparisons": { + "incumbent": { + "delta": 0.002555137679430497, + "conditional_95": [ + 0.0015641029747572976, + 0.0036431410475218527 + ] + }, + "matched_fit_only": { + "delta": 0.002555137679430497, + "conditional_95": [ + 0.0015641029747572976, + 0.0036431410475218527 + ] + } + }, + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 1256, + "incumbent_same_half": 0.7325449010474826, + "matched_control_same_half": 0.7325449010474826, + "crossfit_same_half": 0.7351256285381212, + "step": 1680, + "epochs_started": 16, + "active_seconds": 7.389840035961242, + "training_rows": 54870, + "added_tune_rows": 1256, + "fixed_buffers_exact": true, + "group_counts": { + "43": 36446, + "50": 18424 + }, + "final_lr": 1.0000078679859099e-05 + }, + { + "heldout_half": 1, + "heldout_rows": 1256, + "incumbent_same_half": 0.7298113878884595, + "matched_control_same_half": 0.7298113878884595, + "crossfit_same_half": 0.7327158507790285, + "step": 1680, + "epochs_started": 16, + "active_seconds": 7.374784096988151, + "training_rows": 54870, + "added_tune_rows": 1256, + "fixed_buffers_exact": true, + "group_counts": { + "43": 36446, + "50": 18424 + }, + "final_lr": 1.0000078679859099e-05 + } + ], + "passes_predeclared_fullpool_gate": true, + "fit_only_reproduction_all_head_tensors_bit_exact": true, + "updates_per_arm": 1680, + "published": false, + "fullpool_head_fitted": false, + "candidate_exported": false, + "GPU_used": false, + "limitations": "Earlier Tune checkpoint/architecture selection biases estimates. Fixed label-stratified halves do not enforce protein-family or designed-scaffold independence. OOF predicts with two research heads trained on half the extra labels; it is recipe evidence, not a single final model measurement. Conditional bootstrap omits family dependence and prior selection." + } + }, + "production_merge": "All existing production tensors except the subcellular head are preserved bit-for-bit. One own-session auxiliary encoder and its active pool row are shared with the new development architecture. No fitting occurs in assembly.", + "common_feature_state_and_config_exact": true, + "retained_extra_label_heads": [ + "beta_lactamase", + "fluorescence", + "fold", + "ppi_affinity", + "stability" + ], + "native_selection_evidence": { + "kind": "fit_only_complete_native_tune_replay", + "task": "subcellular_localization", + "before": 0.7538242618285308, + "after": 0.7908217716115261, + "delta": 0.03699750978299532, + "conditional95": [ + 0.024181785841337605, + 0.05052472429740305 + ], + "mean_delta": 0.0033634099802724027, + "conditional_mean95": [ + 0.0021983441673943276, + 0.004593156754309368 + ], + "case_gain": 104, + "examples": 2811, + "matched_controls": { + "full_minus_parent": { + "delta": 0.036997509782995375, + "conditional95": [ + 0.024181785841337605, + 0.05052472429740305 + ] + }, + "full_minus_primary": { + "delta": 0.03948772678762007, + "conditional95": [ + 0.026680896478121666, + 0.05407328352899324 + ] + }, + "full_minus_auxiliary": { + "delta": 0.013162575595873355, + "conditional95": [ + 0.002845962290999644, + 0.022767698327997153 + ] + } + }, + "native_dependency": { + "native_accuracy": 0.7908217716115261, + "normal_replay_bit_exact": true, + "primary_ablated": { + "accuracy": 0.736392742796158, + "accuracy_drop": 0.054429028815368194, + "conditional95_drop": [ + 0.04054606901458555, + 0.06794734969761651 + ], + "prediction_changes": 464 + }, + "auxiliary_ablated": { + "accuracy": 0.5990750622554251, + "accuracy_drop": 0.19174670935610102, + "conditional95_drop": [ + 0.17467093561010316, + 0.20988971896122377 + ], + "prediction_changes": 899 + } + }, + "task_deltas": { + "beta_lactamase": 0.0, + "binary_localization": 0.0, + "fluorescence": 0.0, + "fold": 0.0, + "human_ppi": 0.0, + "ppi_affinity": 0.0, + "secondary_structure": 0.0, + "solubility": 0.0, + "stability": 0.0, + "subcellular_localization": 0.03699750978299532, + "yeast_ppi": 0.0 + }, + "ten_other_prediction_files_byte_exact": true, + "limitations": "Conditional paired-example bootstrap after repeated Tune selection; not corrected for protein-family dependence. Feature removal is a dependence diagnostic, not an in-distribution intervention." + } + }, + "fusion_source": "/workspace/research/shared-fusion8h-study1/full/final-ema/package", + "fusion_source_sha256": "8c6f6e7d334d4668a2a6692aa49ab320447b194f6fb4dae66e4859e1171886cb", + "fusion_provenance": { + "method": "One shared residue fusion trained jointly on all11fit tasks; all original tensors frozen.", + "training_provenance": { + "seed": 20270204, + "created_utc": "2026-10-25T17:20:42Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/shared-fusion8h-study1/source/model.pt", + "arguments": { + "run": "/workspace/research/shared-fusion8h-study1/full", + "init": "/workspace/research/shared-fusion8h-study1/source/model.pt", + "resume": null, + "config": "/workspace/research/shared-fusion8h-study1/full/config.json", + "seconds": 1000000000.0, + "max_steps": 4000, + "eval_seconds": 240, + "evaluate_initial": false, + "lr": 0.0001, + "schedule_seconds": 1000000000.0, + "schedule_steps": 4000, + "eval_steps": "4000", + "structure_distillation_cache": null, + "head_lr": 0.0001, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20270204, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 0.0, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "shared_adapter_only": false, + "shared_fusion_only": true, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "e2a420839c9315dbb80570b137568143361ecde29e36921a1539a99a7cda8152", + "transfer": { + "transferred": 521, + "new_tensors": [], + "unexpected": [] + }, + "parent_provenance": null, + "parent_training": {}, + "provenance.json": { + "utc": "2026-10-25T16:36:47.086545+00:00", + "fusion_initialization_seed": 20270204, + "primary_package": "/workspace/research/selected-stability-lengthweight1-replay/candidate/package", + "primary_sha256": "d581e2aad1c8ea712968423348ff2c540352c7d9ad2b36a46e795a1f4d31b73b", + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "auxiliary_sha256": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "primary_provenance": { + "parent_package": "/workspace/research/selected-stability-midpoint1/candidate/package", + "parent_sha256": "e01ae99a458b5d8d2aba968e1efc663b3d346220fd16b5498a3f91b5cf29626c", + "parent_provenance": { + "method": "One fixed 50:50 parameter midpoint of parent and fit-only 16-epoch stability head continuation; no ensemble.", + "source_parent": "/workspace/research/shared-summary-residual1/candidate/package", + "source_candidate": "/workspace/research/selected-stability-head64/candidate/package", + "source_model_sha256": { + "/workspace/research/shared-summary-residual1/candidate/package": "f890eebb10bb2dc08b84c28e7e0378960af5df4fb0d646ab2e8b33e130c74202", + "/workspace/research/selected-stability-head64/candidate/package": "8fe80a673a65650bb5769b1cf75a59f10a65961da91cc62a491094f874042c79" + }, + "parent_provenance": { + "method": "One jointly learned nonlinear residual map over frozen shared sequence summaries, with task-specific zero-initialized outputs.", + "fit_tasks": [ + "solubility", + "subcellular_localization", + "binary_localization" + ], + "selected_tasks": [ + "binary_localization" + ], + "selected_global_step": 3000, + "source": "/workspace/research/ss-distillation-continuation1/candidate/package", + "export_base": "/workspace/research/ss-distillation-continuation1/candidate/package", + "export_base_model_sha256": "4fee0a0154af24665de9a95f11a722017f3fa6d92354475bec8e81235a219f00", + "rebased_SS_tensors": [], + "seed": 20270102, + "steps": 6000, + "lr": 0.001, + "weight_decay": 0.01, + "dropout": 0.2, + "data": "Fit only for gradients and existing normalization; Tune chooses oneglobalcheckpoint andresidualexits usingpredeclaredconditionalCIgate.", + "original_parameters_exact": true, + "parameters": 53000306, + "encoder_parameters": 44150303, + "feature_cache_exported": false + }, + "fit_recipe": { + "seed": 20270129, + "epochs": 64, + "evaluate_epochs": [ + 4, + 16, + 32, + 64 + ], + "batch_size": 512, + "lr": 0.0001, + "weight_decay": 0.01, + "loss": "MSE to original fit-standardized stabilitylabels, matching selectedmodeltarget semantics;clip1;originaldropout active inbotharms;fixednormalizationbuffers. No newranktargetchange.", + "optimizer": "FreshCPUAdamW,cosine64epochs to0.1floor; matcheddataorder/dropoutRNG/updatecounts; per-epochatomicresume." + }, + "source_selected_epoch": 16, + "diagnostic": { + "utc": "2026-10-25T13:39:33.197851+00:00", + "status": "CPU_diagnostic_complete_no_export", + "alpha": 0.5, + "points": { + "parent": 0.7226969980994319, + "midpoint": 0.7274924148853711, + "whole": 0.7274598466634085 + }, + "midpoint_delta_vs_parent": 0.004795416785939199, + "conditional95": [ + 0.0017412267324550784, + 0.007940572842815559 + ], + "draws": 1000, + "seed": 20270130, + "parameters": 53000306, + "six_changed_learned_tensors": [ + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.linear.weight", + "heads.stability.3.linear.bias" + ], + "all_other_tensors_and_buffers_exact": true, + "eligible_for_manual_complete_replay": true, + "publication": false, + "GPU_used": false, + "limitations": "Singlepredeclaredparameter midpoint, notpredictionensemble. Conditionalrowbootstrapuncorrectedforpriorcheckpointselectionandfamilydependence. CPUdiagnosticisnotan11taskreplay.", + "source_sha256": { + "/workspace/research/check_selected_stability_midpoint.py": "13615a5b2689a0bd503cbc8a9a8a722014962677f6769cec871e13aa5133ff77", + "/workspace/research/shared-summary-residual1/candidate/package/model.pt": "f890eebb10bb2dc08b84c28e7e0378960af5df4fb0d646ab2e8b33e130c74202", + "/workspace/research/selected-stability-head64/candidate/package/model.pt": "8fe80a673a65650bb5769b1cf75a59f10a65961da91cc62a491094f874042c79" + } + }, + "data": "Fit-only labels and fixed normalization; tune selects epoch and evaluates one predeclared midpoint.", + "parameters": 53000306, + "feature_cache_exported": false + }, + "fit_plan": { + "utc": "2026-10-25T16:08:33.461759+00:00", + "status": "queued", + "CPU_only": true, + "recovery_registered": false, + "source_package": "/workspace/research/selected-stability-midpoint1/candidate/package", + "source_report": "/workspace/research/selected-stability-midpoint1/candidate/report.json", + "features": "/workspace/research/rank-target-functions2/features-stability", + "feature_producer": "/workspace/research/rank-target-fluorescence1/candidate/package", + "arms": [ + "natural", + "balanced" + ], + "expected_fit_lengths": [ + 43, + 50 + ], + "seed": 20270208, + "threads": 6, + "epochs": 16, + "batch_size": 512, + "lr": 0.0001, + "weight_decay": 0.01, + "alpha": 0.5, + "minimum_gain": 0.001, + "bootstrap_seed": 20270209, + "bootstrap_draws": 1000, + "hypothesis": "Natural stability fit data are68%43-residue proteins but all observed Tune chains have50residues. Equal loss mass for the two fit-length groups may reduce interference on the50-residue domain. This is a test prompted by visible Tune distribution, not evidence of benefit.", + "loss": "Original-fit-standardized-label MSE. Identical shuffled full-fit batches in both arms; natural unit weights; balanced weights N/(2*N_group), averaged over minibatch without per-batch renormalization. Both train all six existing head tensors, fixed feature-normalization buffers.", + "schedule": "FreshAdamW,16epochs/1680updates,cosine to0.1floor,clip1; originaldropoutactive with identical RNG and data order. Same current selected initial head.", + "selection": "Only one fixed50:50 parameter midpoint at the final16epoch endpoint per arm is eligible. Raw endpoints are descriptive. Require gain>=.001 and positive conditional95versus selected; balanced additionally requires positive conditional95versus natural control. No intermediate Tune selection, no seed/mixture grid. Manual review then full11 native replay before any publication.", + "all_task_policy": "Only six stabilityheadparameters may change. Shared encoder remains jointly learned for all11. All10otherparameters/config/outputfiles must remain exact on native replay. No automatic export or publication.", + "resume": "CPU per-epoch atomic optimizer/head/NumPy/torchRNG checkpoints; rerun same script after interruption. Planhash verified on resume.", + "recovery_command": [ + "env", + "CUDA_VISIBLE_DEVICES=", + "OMP_NUM_THREADS=6", + "MKL_NUM_THREADS=6", + "OPENBLAS_NUM_THREADS=1", + "python3", + "-u", + "/workspace/research/run_stability_length_weighting.py", + "--run", + "/workspace/research/selected-stability-lengthweight1" + ], + "frozen_sha256": { + "/workspace/research/run_stability_length_weighting.py": "3c5aac6a79a1397e5c50278a7635e32d7c3583438f64996c8a42a372d16a29f6", + "/workspace/research/check_shared_adapters_cpu.py": "db7d8d846b90929decad5865de36dd55fb95139aaa116b6ae2987cd96786c990", + "/workspace/research/crossfit_beta_labels.py": "bd1d29e2ab78cb0273213ef1a00657cef450a91f155ba7d9aa7f3db7721bd632", + "/workspace/research/stability-length-shift-diagnostic.json": "36a890f702bb6709e893c5f9d94c5cf15959f83f4a91d71e58a7b5f681065f6d", + "/workspace/research/selected-stability-midpoint1/candidate/report.json": "feedb171d285a4fa4d3c2a2bdd819873caaad1308ef90fd59df9df1ace166827", + "/workspace/research/selected-stability-midpoint1/candidate/package/model.pt": "e01ae99a458b5d8d2aba968e1efc663b3d346220fd16b5498a3f91b5cf29626c", + "/workspace/research/selected-stability-midpoint1/candidate/package/config.json": "162a2f4985944bba7492854315bd594fd3a38386548ab1c6b0c7a4f0d2bd7625", + "/workspace/research/selected-stability-midpoint1/candidate/package/unified.py": "bb00abef5853bc8badfef6a8d38ef8cb11f0ff6d9fe143eb7deebd582058efa3", + "/workspace/research/selected-stability-midpoint1/candidate/package/esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "/workspace/research/selected-stability-midpoint1/candidate/package/replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "/workspace/research/selected-stability-midpoint1/candidate/package/infer.sh": "60f55b73f5b39a35a61df84026abed9a127b1cc035d650c9e1ca62f54fc2b468", + "/workspace/research/rank-target-fluorescence1/candidate/package/model.pt": "a13dad3c4f0cd7a1917d5b6763b27aaf3d38f3b7d775e747b61241ea36b681e0", + "/workspace/research/rank-target-fluorescence1/candidate/package/config.json": "e3da1d0ea2df3e6d6cc8b069016bffca2a37fd05accf1597cc6453f946d8fd89", + "/workspace/research/rank-target-functions2/features-stability/stability-fit.pt": "3fde47645a74370a003dd5f509a73ccecbaaac36ce4e8871938979a003ba3862", + "/workspace/research/rank-target-functions2/features-stability/stability-tune.pt": "92066e0c8abfcfc4ac3b8f2c7edcc4319cb8f8b4b97b53dd6e589147a1c460bf" + } + }, + "fit_outcome": { + "utc": "2026-10-25T16:08:53.918703+00:00", + "status": "cached_analysis_complete", + "arms": { + "natural": { + "arm": "natural", + "endpoint_reward": 0.7291215996959544, + "raw_reward_descriptive_only": 0.72991937369715, + "step": 1680, + "active_seconds": 5.326252081984421, + "final_numpy_rng": { + "bit_generator": "PCG64", + "state": { + "state": 264542032468656517169208881192101401107, + "inc": 100251262600960163324587047460976422035 + }, + "has_uint32": 1, + "uinteger": 637011686 + }, + "final_torch_rng_sha256": "fd56e05488c9ae31e940c2b1d859f13ca90497826206c0e3602aaba9c339ef52", + "optimizer_steps": [ + 1680.0 + ], + "lr": 1.0000078679859099e-05, + "fixed_buffers_exact": true + }, + "balanced": { + "arm": "balanced", + "endpoint_reward": 0.7311607642876724, + "raw_reward_descriptive_only": 0.7330130871638806, + "step": 1680, + "active_seconds": 5.340115340979537, + "final_numpy_rng": { + "bit_generator": "PCG64", + "state": { + "state": 264542032468656517169208881192101401107, + "inc": 100251262600960163324587047460976422035 + }, + "has_uint32": 1, + "uinteger": 637011686 + }, + "final_torch_rng_sha256": "fd56e05488c9ae31e940c2b1d859f13ca90497826206c0e3602aaba9c339ef52", + "optimizer_steps": [ + 1680.0 + ], + "lr": 1.0000078679859099e-05, + "fixed_buffers_exact": true + } + }, + "comparisons": { + "natural_vs_parent": { + "delta": 0.001629184810583273, + "conditional_95": [ + 0.00024683637661263025, + 0.003237432482155497 + ] + }, + "balanced_vs_parent": { + "delta": 0.0036683494023013186, + "conditional_95": [ + 0.0019018632266723152, + 0.0054815225624275 + ] + }, + "balanced_vs_natural": { + "delta": 0.0020391645917180456, + "conditional_95": [ + 0.0012832147204794586, + 0.0028118185483942955 + ] + } + }, + "eligible_arms": [ + "natural", + "balanced" + ], + "published": false, + "GPU_used": false, + "candidate_exported": false, + "matched_order_dropout_optimizer_clocks": true, + "ten_other_tasks": "No state edited; any proposed export must keep their parameters/configuration exact and independently replay all eleven.", + "limitations": "Conditional example bootstrap after repeated tune inspection; family dependence and selection uncertainty omitted. Tune length distribution informed this hypothesis. Raw endpoints are descriptive only. No full-pool or test-time fitting." + }, + "changed_tensors": [ + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.linear.weight", + "heads.stability.3.linear.bias" + ], + "all_other_tensors_and_buffers_exact": true, + "method": "One fixed final balanced-length continuation midpoint; no output averaging or test-time fitting." + }, + "auxiliary_provenance": { + "method": "Fixed rank-target readout transfer within one tensor-identical shared backbone", + "parent": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/candidate/package", + "parent_provenance": { + "method": "Consolidated task readouts with tensor-identical jointly learned shared components; one literal parameter set", + "shared_parameter_digest": "397be7af196fb356e544d391fbcdc9928f0ea6e4cfd66ab6ea4a4e4c656770bc", + "head_sources": { + "fluorescence": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fluorescence/package", + "stability": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-stability/package", + "beta_lactamase": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-beta_lactamase/package", + "solubility": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-solubility/package", + "subcellular_localization": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-subcellular_localization/package", + "binary_localization": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "fold": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fold/package", + "secondary_structure": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-secondary_structure/package", + "yeast_ppi": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-yeast_ppi/package", + "human_ppi": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "ppi_affinity": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-ppi_affinity/package" + }, + "parent_provenance": [ + { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "beta_lactamase", + "readout_kind": "residue", + "bins": 320, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fluorescence", + "readout_kind": "residue", + "bins": 256, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fold", + "readout_kind": "summary", + "bins": null, + "ridge": 0.0001, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.5, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "ppi_affinity", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random linear local readout on same joint residue states; fit-only fixed normalization and sampled fit residue labels; ridge cross entropy LBFGS", + "seed": 20261103, + "fit_residues_including_window_duplicates": 505584, + "kernel": 9, + "ridge": 0.01, + "retained_learned_nonlinear_prefix": true, + "training_device": "cuda", + "tune_policy": "fixed supplied strengths or default three strengths; full valid-residue accuracy with overlapping-window probability aggregation", + "tested_ridges": [ + 0.01 + ], + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "solubility", + "readout_kind": "summary", + "bins": null, + "ridge": 0.1, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Retained joint pair nonlinear prefix; random final layer fit using fixed fit normalization and regularized LBFGS", + "seed": 20261107, + "selected_ridges": { + "stability": 0.001 + }, + "tested_ridges": [ + 0.001 + ], + "tune_policy": "fixed supplied strengths or default five strengths; small tune sets limit confidence", + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "subcellular_localization", + "readout_kind": "summary", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "yeast_ppi", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + } + ], + "feature_cache_exported": false, + "pair_context_selection": { + "policy": "One fixed1536-token alternative versus the current context, chosen on tune with all learned tensors frozen.", + "choice_basis": "Earlier fit-only chain-length audit; human and yeast fit maxima1500/1495residues.", + "choices": { + "human_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8180272108843538, + "macro_f1": 0.8181606424889357, + "reward": 0.819047619047619 + }, + "1536": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8171768707482994, + "macro_f1": 0.817806370435012, + "reward": 0.819047619047619 + } + } + }, + "yeast_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.5894736842105263, + "balanced_accuracy": 0.570054945054945, + "macro_f1": 0.5704347826086956, + "reward": 0.5894736842105263 + }, + "1536": { + "accuracy": 0.5789473684210527, + "balanced_accuracy": 0.5611263736263736, + "macro_f1": 0.5614035087719298, + "reward": 0.5789473684210527 + } + } + } + }, + "learned_parameter_updates": 0 + } + }, + "rank_head_sources": { + "fluorescence": "/workspace/research/scale85m-8h-rank3/head-fluorescence/package", + "beta_lactamase": "/workspace/research/scale85m-8h-rank3/head-beta_lactamase/package", + "stability": "/workspace/research/scale85m-8h-rank3/head-stability/package" + }, + "head_seeds": { + "fluorescence": 20261031, + "beta_lactamase": 20261031, + "stability": 20261107 + }, + "ridges": { + "fluorescence": 1.0, + "beta_lactamase": 1.0, + "stability": 0.001 + }, + "fit_only_feature_statistics_and_rank_targets": true, + "all_other_tensors_exact": true, + "feature_cache_exported": false + }, + "auxiliary_encoder_only": true, + "disposable_check_weights_used": false, + "external_weights_used": false, + "new_fusion_optimizer_updates": 0 + }, + "structural_teacher_signature": null + }, + "initial_provenance": { + "utc": "2026-10-25T16:36:47.086545+00:00", + "fusion_initialization_seed": 20270204, + "primary_package": "/workspace/research/selected-stability-lengthweight1-replay/candidate/package", + "primary_sha256": "d581e2aad1c8ea712968423348ff2c540352c7d9ad2b36a46e795a1f4d31b73b", + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "auxiliary_sha256": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "primary_provenance": { + "parent_package": "/workspace/research/selected-stability-midpoint1/candidate/package", + "parent_sha256": "e01ae99a458b5d8d2aba968e1efc663b3d346220fd16b5498a3f91b5cf29626c", + "parent_provenance": { + "method": "One fixed 50:50 parameter midpoint of parent and fit-only 16-epoch stability head continuation; no ensemble.", + "source_parent": "/workspace/research/shared-summary-residual1/candidate/package", + "source_candidate": "/workspace/research/selected-stability-head64/candidate/package", + "source_model_sha256": { + "/workspace/research/shared-summary-residual1/candidate/package": "f890eebb10bb2dc08b84c28e7e0378960af5df4fb0d646ab2e8b33e130c74202", + "/workspace/research/selected-stability-head64/candidate/package": "8fe80a673a65650bb5769b1cf75a59f10a65961da91cc62a491094f874042c79" + }, + "parent_provenance": { + "method": "One jointly learned nonlinear residual map over frozen shared sequence summaries, with task-specific zero-initialized outputs.", + "fit_tasks": [ + "solubility", + "subcellular_localization", + "binary_localization" + ], + "selected_tasks": [ + "binary_localization" + ], + "selected_global_step": 3000, + "source": "/workspace/research/ss-distillation-continuation1/candidate/package", + "export_base": "/workspace/research/ss-distillation-continuation1/candidate/package", + "export_base_model_sha256": "4fee0a0154af24665de9a95f11a722017f3fa6d92354475bec8e81235a219f00", + "rebased_SS_tensors": [], + "seed": 20270102, + "steps": 6000, + "lr": 0.001, + "weight_decay": 0.01, + "dropout": 0.2, + "data": "Fit only for gradients and existing normalization; Tune chooses oneglobalcheckpoint andresidualexits usingpredeclaredconditionalCIgate.", + "original_parameters_exact": true, + "parameters": 53000306, + "encoder_parameters": 44150303, + "feature_cache_exported": false + }, + "fit_recipe": { + "seed": 20270129, + "epochs": 64, + "evaluate_epochs": [ + 4, + 16, + 32, + 64 + ], + "batch_size": 512, + "lr": 0.0001, + "weight_decay": 0.01, + "loss": "MSE to original fit-standardized stabilitylabels, matching selectedmodeltarget semantics;clip1;originaldropout active inbotharms;fixednormalizationbuffers. No newranktargetchange.", + "optimizer": "FreshCPUAdamW,cosine64epochs to0.1floor; matcheddataorder/dropoutRNG/updatecounts; per-epochatomicresume." + }, + "source_selected_epoch": 16, + "diagnostic": { + "utc": "2026-10-25T13:39:33.197851+00:00", + "status": "CPU_diagnostic_complete_no_export", + "alpha": 0.5, + "points": { + "parent": 0.7226969980994319, + "midpoint": 0.7274924148853711, + "whole": 0.7274598466634085 + }, + "midpoint_delta_vs_parent": 0.004795416785939199, + "conditional95": [ + 0.0017412267324550784, + 0.007940572842815559 + ], + "draws": 1000, + "seed": 20270130, + "parameters": 53000306, + "six_changed_learned_tensors": [ + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.linear.weight", + "heads.stability.3.linear.bias" + ], + "all_other_tensors_and_buffers_exact": true, + "eligible_for_manual_complete_replay": true, + "publication": false, + "GPU_used": false, + "limitations": "Singlepredeclaredparameter midpoint, notpredictionensemble. Conditionalrowbootstrapuncorrectedforpriorcheckpointselectionandfamilydependence. CPUdiagnosticisnotan11taskreplay.", + "source_sha256": { + "/workspace/research/check_selected_stability_midpoint.py": "13615a5b2689a0bd503cbc8a9a8a722014962677f6769cec871e13aa5133ff77", + "/workspace/research/shared-summary-residual1/candidate/package/model.pt": "f890eebb10bb2dc08b84c28e7e0378960af5df4fb0d646ab2e8b33e130c74202", + "/workspace/research/selected-stability-head64/candidate/package/model.pt": "8fe80a673a65650bb5769b1cf75a59f10a65961da91cc62a491094f874042c79" + } + }, + "data": "Fit-only labels and fixed normalization; tune selects epoch and evaluates one predeclared midpoint.", + "parameters": 53000306, + "feature_cache_exported": false + }, + "fit_plan": { + "utc": "2026-10-25T16:08:33.461759+00:00", + "status": "queued", + "CPU_only": true, + "recovery_registered": false, + "source_package": "/workspace/research/selected-stability-midpoint1/candidate/package", + "source_report": "/workspace/research/selected-stability-midpoint1/candidate/report.json", + "features": "/workspace/research/rank-target-functions2/features-stability", + "feature_producer": "/workspace/research/rank-target-fluorescence1/candidate/package", + "arms": [ + "natural", + "balanced" + ], + "expected_fit_lengths": [ + 43, + 50 + ], + "seed": 20270208, + "threads": 6, + "epochs": 16, + "batch_size": 512, + "lr": 0.0001, + "weight_decay": 0.01, + "alpha": 0.5, + "minimum_gain": 0.001, + "bootstrap_seed": 20270209, + "bootstrap_draws": 1000, + "hypothesis": "Natural stability fit data are68%43-residue proteins but all observed Tune chains have50residues. Equal loss mass for the two fit-length groups may reduce interference on the50-residue domain. This is a test prompted by visible Tune distribution, not evidence of benefit.", + "loss": "Original-fit-standardized-label MSE. Identical shuffled full-fit batches in both arms; natural unit weights; balanced weights N/(2*N_group), averaged over minibatch without per-batch renormalization. Both train all six existing head tensors, fixed feature-normalization buffers.", + "schedule": "FreshAdamW,16epochs/1680updates,cosine to0.1floor,clip1; originaldropoutactive with identical RNG and data order. Same current selected initial head.", + "selection": "Only one fixed50:50 parameter midpoint at the final16epoch endpoint per arm is eligible. Raw endpoints are descriptive. Require gain>=.001 and positive conditional95versus selected; balanced additionally requires positive conditional95versus natural control. No intermediate Tune selection, no seed/mixture grid. Manual review then full11 native replay before any publication.", + "all_task_policy": "Only six stabilityheadparameters may change. Shared encoder remains jointly learned for all11. All10otherparameters/config/outputfiles must remain exact on native replay. No automatic export or publication.", + "resume": "CPU per-epoch atomic optimizer/head/NumPy/torchRNG checkpoints; rerun same script after interruption. Planhash verified on resume.", + "recovery_command": [ + "env", + "CUDA_VISIBLE_DEVICES=", + "OMP_NUM_THREADS=6", + "MKL_NUM_THREADS=6", + "OPENBLAS_NUM_THREADS=1", + "python3", + "-u", + "/workspace/research/run_stability_length_weighting.py", + "--run", + "/workspace/research/selected-stability-lengthweight1" + ], + "frozen_sha256": { + "/workspace/research/run_stability_length_weighting.py": "3c5aac6a79a1397e5c50278a7635e32d7c3583438f64996c8a42a372d16a29f6", + "/workspace/research/check_shared_adapters_cpu.py": "db7d8d846b90929decad5865de36dd55fb95139aaa116b6ae2987cd96786c990", + "/workspace/research/crossfit_beta_labels.py": "bd1d29e2ab78cb0273213ef1a00657cef450a91f155ba7d9aa7f3db7721bd632", + "/workspace/research/stability-length-shift-diagnostic.json": "36a890f702bb6709e893c5f9d94c5cf15959f83f4a91d71e58a7b5f681065f6d", + "/workspace/research/selected-stability-midpoint1/candidate/report.json": "feedb171d285a4fa4d3c2a2bdd819873caaad1308ef90fd59df9df1ace166827", + "/workspace/research/selected-stability-midpoint1/candidate/package/model.pt": "e01ae99a458b5d8d2aba968e1efc663b3d346220fd16b5498a3f91b5cf29626c", + "/workspace/research/selected-stability-midpoint1/candidate/package/config.json": "162a2f4985944bba7492854315bd594fd3a38386548ab1c6b0c7a4f0d2bd7625", + "/workspace/research/selected-stability-midpoint1/candidate/package/unified.py": "bb00abef5853bc8badfef6a8d38ef8cb11f0ff6d9fe143eb7deebd582058efa3", + "/workspace/research/selected-stability-midpoint1/candidate/package/esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "/workspace/research/selected-stability-midpoint1/candidate/package/replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "/workspace/research/selected-stability-midpoint1/candidate/package/infer.sh": "60f55b73f5b39a35a61df84026abed9a127b1cc035d650c9e1ca62f54fc2b468", + "/workspace/research/rank-target-fluorescence1/candidate/package/model.pt": "a13dad3c4f0cd7a1917d5b6763b27aaf3d38f3b7d775e747b61241ea36b681e0", + "/workspace/research/rank-target-fluorescence1/candidate/package/config.json": "e3da1d0ea2df3e6d6cc8b069016bffca2a37fd05accf1597cc6453f946d8fd89", + "/workspace/research/rank-target-functions2/features-stability/stability-fit.pt": "3fde47645a74370a003dd5f509a73ccecbaaac36ce4e8871938979a003ba3862", + "/workspace/research/rank-target-functions2/features-stability/stability-tune.pt": "92066e0c8abfcfc4ac3b8f2c7edcc4319cb8f8b4b97b53dd6e589147a1c460bf" + } + }, + "fit_outcome": { + "utc": "2026-10-25T16:08:53.918703+00:00", + "status": "cached_analysis_complete", + "arms": { + "natural": { + "arm": "natural", + "endpoint_reward": 0.7291215996959544, + "raw_reward_descriptive_only": 0.72991937369715, + "step": 1680, + "active_seconds": 5.326252081984421, + "final_numpy_rng": { + "bit_generator": "PCG64", + "state": { + "state": 264542032468656517169208881192101401107, + "inc": 100251262600960163324587047460976422035 + }, + "has_uint32": 1, + "uinteger": 637011686 + }, + "final_torch_rng_sha256": "fd56e05488c9ae31e940c2b1d859f13ca90497826206c0e3602aaba9c339ef52", + "optimizer_steps": [ + 1680.0 + ], + "lr": 1.0000078679859099e-05, + "fixed_buffers_exact": true + }, + "balanced": { + "arm": "balanced", + "endpoint_reward": 0.7311607642876724, + "raw_reward_descriptive_only": 0.7330130871638806, + "step": 1680, + "active_seconds": 5.340115340979537, + "final_numpy_rng": { + "bit_generator": "PCG64", + "state": { + "state": 264542032468656517169208881192101401107, + "inc": 100251262600960163324587047460976422035 + }, + "has_uint32": 1, + "uinteger": 637011686 + }, + "final_torch_rng_sha256": "fd56e05488c9ae31e940c2b1d859f13ca90497826206c0e3602aaba9c339ef52", + "optimizer_steps": [ + 1680.0 + ], + "lr": 1.0000078679859099e-05, + "fixed_buffers_exact": true + } + }, + "comparisons": { + "natural_vs_parent": { + "delta": 0.001629184810583273, + "conditional_95": [ + 0.00024683637661263025, + 0.003237432482155497 + ] + }, + "balanced_vs_parent": { + "delta": 0.0036683494023013186, + "conditional_95": [ + 0.0019018632266723152, + 0.0054815225624275 + ] + }, + "balanced_vs_natural": { + "delta": 0.0020391645917180456, + "conditional_95": [ + 0.0012832147204794586, + 0.0028118185483942955 + ] + } + }, + "eligible_arms": [ + "natural", + "balanced" + ], + "published": false, + "GPU_used": false, + "candidate_exported": false, + "matched_order_dropout_optimizer_clocks": true, + "ten_other_tasks": "No state edited; any proposed export must keep their parameters/configuration exact and independently replay all eleven.", + "limitations": "Conditional example bootstrap after repeated tune inspection; family dependence and selection uncertainty omitted. Tune length distribution informed this hypothesis. Raw endpoints are descriptive only. No full-pool or test-time fitting." + }, + "changed_tensors": [ + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.linear.weight", + "heads.stability.3.linear.bias" + ], + "all_other_tensors_and_buffers_exact": true, + "method": "One fixed final balanced-length continuation midpoint; no output averaging or test-time fitting." + }, + "auxiliary_provenance": { + "method": "Fixed rank-target readout transfer within one tensor-identical shared backbone", + "parent": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/candidate/package", + "parent_provenance": { + "method": "Consolidated task readouts with tensor-identical jointly learned shared components; one literal parameter set", + "shared_parameter_digest": "397be7af196fb356e544d391fbcdc9928f0ea6e4cfd66ab6ea4a4e4c656770bc", + "head_sources": { + "fluorescence": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fluorescence/package", + "stability": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-stability/package", + "beta_lactamase": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-beta_lactamase/package", + "solubility": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-solubility/package", + "subcellular_localization": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-subcellular_localization/package", + "binary_localization": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "fold": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fold/package", + "secondary_structure": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-secondary_structure/package", + "yeast_ppi": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-yeast_ppi/package", + "human_ppi": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "ppi_affinity": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-ppi_affinity/package" + }, + "parent_provenance": [ + { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "beta_lactamase", + "readout_kind": "residue", + "bins": 320, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fluorescence", + "readout_kind": "residue", + "bins": 256, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fold", + "readout_kind": "summary", + "bins": null, + "ridge": 0.0001, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.5, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "ppi_affinity", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random linear local readout on same joint residue states; fit-only fixed normalization and sampled fit residue labels; ridge cross entropy LBFGS", + "seed": 20261103, + "fit_residues_including_window_duplicates": 505584, + "kernel": 9, + "ridge": 0.01, + "retained_learned_nonlinear_prefix": true, + "training_device": "cuda", + "tune_policy": "fixed supplied strengths or default three strengths; full valid-residue accuracy with overlapping-window probability aggregation", + "tested_ridges": [ + 0.01 + ], + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "solubility", + "readout_kind": "summary", + "bins": null, + "ridge": 0.1, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Retained joint pair nonlinear prefix; random final layer fit using fixed fit normalization and regularized LBFGS", + "seed": 20261107, + "selected_ridges": { + "stability": 0.001 + }, + "tested_ridges": [ + 0.001 + ], + "tune_policy": "fixed supplied strengths or default five strengths; small tune sets limit confidence", + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "subcellular_localization", + "readout_kind": "summary", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "yeast_ppi", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + } + ], + "feature_cache_exported": false, + "pair_context_selection": { + "policy": "One fixed1536-token alternative versus the current context, chosen on tune with all learned tensors frozen.", + "choice_basis": "Earlier fit-only chain-length audit; human and yeast fit maxima1500/1495residues.", + "choices": { + "human_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8180272108843538, + "macro_f1": 0.8181606424889357, + "reward": 0.819047619047619 + }, + "1536": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8171768707482994, + "macro_f1": 0.817806370435012, + "reward": 0.819047619047619 + } + } + }, + "yeast_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.5894736842105263, + "balanced_accuracy": 0.570054945054945, + "macro_f1": 0.5704347826086956, + "reward": 0.5894736842105263 + }, + "1536": { + "accuracy": 0.5789473684210527, + "balanced_accuracy": 0.5611263736263736, + "macro_f1": 0.5614035087719298, + "reward": 0.5789473684210527 + } + } + } + }, + "learned_parameter_updates": 0 + } + }, + "rank_head_sources": { + "fluorescence": "/workspace/research/scale85m-8h-rank3/head-fluorescence/package", + "beta_lactamase": "/workspace/research/scale85m-8h-rank3/head-beta_lactamase/package", + "stability": "/workspace/research/scale85m-8h-rank3/head-stability/package" + }, + "head_seeds": { + "fluorescence": 20261031, + "beta_lactamase": 20261031, + "stability": 20261107 + }, + "ridges": { + "fluorescence": 1.0, + "beta_lactamase": 1.0, + "stability": 0.001 + }, + "fit_only_feature_statistics_and_rank_targets": true, + "all_other_tensors_exact": true, + "feature_cache_exported": false + }, + "auxiliary_encoder_only": true, + "disposable_check_weights_used": false, + "external_weights_used": false, + "new_fusion_optimizer_updates": 0 + }, + "arm": "full", + "weights": "final4000EMA", + "all_primary_auxiliary_and_head_state_tensors_exact": true, + "disposable_check_weights_used": false, + "pending_native_replay_and_selection": true + }, + "all_parent_state_tensors_bit_exact": true, + "new_shared_parameters": 462080, + "auxiliary_encoder_copies": 1, + "method": "One final4000EMA fusion state jointly trained on all11fit tasks. Only SS enables it; accepted subcellular dual summaries and all other paths remain unchanged.", + "selection_evidence": { + "full_original_study": { + "status": "selected_pending_assembly_ablations_and_native_review", + "chosen_arm": "full", + "candidates": { + "zero": { + "enabled_tasks": [], + "routed_mean": 0.7166638090200526, + "mean_gain": 0.0, + "conditional95": [ + 0.0, + 0.0 + ], + "eligible": false + }, + "full": { + "enabled_tasks": [ + "secondary_structure", + "subcellular_localization" + ], + "routed_mean": 0.7188819946010887, + "mean_gain": 0.002218185581036117, + "conditional95": [ + 0.0015618427916501052, + 0.0029223180172046797 + ], + "eligible": true, + "same_routes_control_comparison": { + "mean_delta": 0.002266686052709703, + "conditional95": [ + 0.00163301878385431, + 0.0028783273901904533 + ], + "definition": "Treatment-enabled routes only; all other task deltas zero. Both states are final4000EMA." + } + } + }, + "tasks": { + "beta_lactamase": { + "examples": 520, + "parent": 0.8851158090618965, + "zero": 0.8848969852420536, + "full": 0.8845439568759146, + "comparisons": { + "zero_minus_parent": { + "delta": -0.00021882381984283938, + "conditional95": [ + -0.0019190809982984557, + 0.001469238318171373 + ] + }, + "full_minus_parent": { + "delta": -0.0005718521859818804, + "conditional95": [ + -0.002610170059700731, + 0.0012711578290376243 + ] + }, + "full_minus_zero": { + "delta": -0.000353028366139041, + "conditional95": [ + -0.001745614993564945, + 0.0009405445898092214 + ] + } + } + }, + "binary_localization": { + "examples": 1729, + "parent": 0.9462116830537883, + "zero": 0.945054945054945, + "full": 0.945054945054945, + "comparisons": { + "zero_minus_parent": { + "delta": -0.0011567379988433046, + "conditional95": [ + -0.0046269519953731075, + 0.002313475997686501 + ] + }, + "full_minus_parent": { + "delta": -0.0011567379988433046, + "conditional95": [ + -0.0063620589936379535, + 0.003470213996529803 + ] + }, + "full_minus_zero": { + "delta": 0.0, + "conditional95": [ + -0.004048582995951344, + 0.004048582995951344 + ] + } + } + }, + "fluorescence": { + "examples": 5362, + "parent": 0.826705913429907, + "zero": 0.8261891093573827, + "full": 0.8261173562838637, + "comparisons": { + "zero_minus_parent": { + "delta": -0.0005168040725243017, + "conditional95": [ + -0.0009074676903033013, + -0.00010004212525541478 + ] + }, + "full_minus_parent": { + "delta": -0.0005885571460432226, + "conditional95": [ + -0.001125277545181083, + -5.1938701607648406e-05 + ] + }, + "full_minus_zero": { + "delta": -7.175307351892091e-05, + "conditional95": [ + -0.0005318636811548316, + 0.0003805983773495475 + ] + } + } + }, + "fold": { + "examples": 736, + "parent": 0.24864130434782608, + "zero": 0.24320652173913043, + "full": 0.24592391304347827, + "comparisons": { + "zero_minus_parent": { + "delta": -0.0054347826086956486, + "conditional95": [ + -0.014945652173913027, + 0.002717391304347838 + ] + }, + "full_minus_parent": { + "delta": -0.0027173913043478104, + "conditional95": [ + -0.012228260869565244, + 0.008152173913043459 + ] + }, + "full_minus_zero": { + "delta": 0.002717391304347838, + "conditional95": [ + -0.005434782608695676, + 0.012228260869565216 + ] + } + } + }, + "human_ppi": { + "examples": 315, + "parent": 0.7968253968253968, + "zero": 0.7841269841269841, + "full": 0.780952380952381, + "comparisons": { + "zero_minus_parent": { + "delta": -0.012698412698412653, + "conditional95": [ + -0.03492063492063491, + 0.009523809523809493 + ] + }, + "full_minus_parent": { + "delta": -0.015873015873015817, + "conditional95": [ + -0.0444444444444444, + 0.012698412698412764 + ] + }, + "full_minus_zero": { + "delta": -0.0031746031746031633, + "conditional95": [ + -0.022222222222222254, + 0.015873015873015817 + ] + } + } + }, + "ppi_affinity": { + "examples": 203, + "parent": 0.5341420012716276, + "zero": 0.5189355347334772, + "full": 0.5250420716238517, + "comparisons": { + "zero_minus_parent": { + "delta": -0.015206466538150387, + "conditional95": [ + -0.027845041079411027, + -0.004519207693363675 + ] + }, + "full_minus_parent": { + "delta": -0.00909992964777584, + "conditional95": [ + -0.01808313521817929, + -0.0005967466520302408 + ] + }, + "full_minus_zero": { + "delta": 0.006106536890374548, + "conditional95": [ + 0.0007892307088291708, + 0.012730268854570593 + ] + } + } + }, + "secondary_structure": { + "examples": 2170, + "parent": 0.7441316787896526, + "zero": 0.7439539188876181, + "full": 0.759638088021676, + "comparisons": { + "zero_minus_parent": { + "delta": -0.0001777599020345022, + "conditional95": [ + -0.0004337054552560532, + 8.817027773533869e-05 + ] + }, + "full_minus_parent": { + "delta": 0.0155064092320234, + "conditional95": [ + 0.014309663742752683, + 0.016726396557557775 + ] + }, + "full_minus_zero": { + "delta": 0.0156841691340579, + "conditional95": [ + 0.014499037971929394, + 0.01689329854300642 + ] + } + } + }, + "solubility": { + "examples": 6942, + "parent": 0.7533851915874388, + "zero": 0.7492077211178335, + "full": 0.7539613944108327, + "comparisons": { + "zero_minus_parent": { + "delta": -0.00417747046960526, + "conditional95": [ + -0.007202535292422985, + -0.0008643042350907626 + ] + }, + "full_minus_parent": { + "delta": 0.0005762028233938787, + "conditional95": [ + -0.003892970325554695, + 0.005189426678190781 + ] + }, + "full_minus_zero": { + "delta": 0.004753673292999139, + "conditional95": [ + 0.0004321521175453258, + 0.00907519446845284 + ] + } + } + }, + "stability": { + "examples": 2512, + "parent": 0.7311607642876724, + "zero": 0.730056227683189, + "full": 0.7329317436395436, + "comparisons": { + "zero_minus_parent": { + "delta": -0.001104536604483397, + "conditional95": [ + -0.0028202937870095784, + 0.0005720436213680235 + ] + }, + "full_minus_parent": { + "delta": 0.0017709793518712047, + "conditional95": [ + -0.0009297756963640934, + 0.004598901782002785 + ] + }, + "full_minus_zero": { + "delta": 0.0028755159563546018, + "conditional95": [ + 0.0007289400154873922, + 0.005253062278283147 + ] + } + } + }, + "subcellular_localization": { + "examples": 2811, + "parent": 0.7538242618285308, + "zero": 0.7534685165421559, + "full": 0.7627178939879047, + "comparisons": { + "zero_minus_parent": { + "delta": -0.0003557452863749422, + "conditional95": [ + -0.00570081821415867, + 0.004980434009249302 + ] + }, + "full_minus_parent": { + "delta": 0.008893632159373888, + "conditional95": [ + 0.0010672358591249376, + 0.016364283173248007 + ] + }, + "full_minus_zero": { + "delta": 0.00924937744574883, + "conditional95": [ + 0.0024902170046247063, + 0.015652792600498015 + ] + } + } + }, + "yeast_ppi": { + "examples": 95, + "parent": 0.6631578947368421, + "zero": 0.6421052631578947, + "full": 0.6421052631578947, + "comparisons": { + "zero_minus_parent": { + "delta": -0.021052631578947323, + "conditional95": [ + -0.0736842105263158, + 0.03157894736842104 + ] + }, + "full_minus_parent": { + "delta": -0.021052631578947323, + "conditional95": [ + -0.0736842105263158, + 0.021315789473684035 + ] + }, + "full_minus_zero": { + "delta": 0.0, + "conditional95": [ + -0.03157894736842104, + 0.03157894736842104 + ] + } + } + } + }, + "one_final_EMA_state_per_arm": true, + "mixed_shared_weights": false, + "bootstrap_draws": 1000, + "bootstrap_seed": 20261111, + "sampling": "Paired examples per task; SS by protein. Same resamples for all three predictions.", + "limitations": "Repeated tune selection; conditional intervals do not correct selection or protein-family dependence. Zero auxiliary changes joint LayerNorm input distribution.", + "published": false, + "next": "If eligible, use one complete shared state, prove primary dependency, prune unused auxiliary for zero, native replay and compare current selected. Renew extra-label evidence on changed feature routes." + }, + "retained_dual_tasks": [ + "subcellular_localization" + ], + "active_fusion_tasks": [ + "secondary_structure" + ], + "remaining_full_minus_zero_conditional95": [ + 0.014499037971929394, + 0.01689329854300642 + ], + "SS_gain": { + "delta": 0.0155064092320234, + "conditional95": [ + 0.014309663742752683, + 0.016726396557557775 + ] + }, + "production_extra_label_feature_paths_unchanged": true, + "limitations": "Conditional paired protein intervals after repeated Tune selection; not corrected for protein-family dependence." + }, + "no_quality_updates_during_assembly": true + }, + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "auxiliary_sha256": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "auxiliary_provenance": { + "method": "Fixed rank-target readout transfer within one tensor-identical shared backbone", + "parent": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/candidate/package", + "parent_provenance": { + "method": "Consolidated task readouts with tensor-identical jointly learned shared components; one literal parameter set", + "shared_parameter_digest": "397be7af196fb356e544d391fbcdc9928f0ea6e4cfd66ab6ea4a4e4c656770bc", + "head_sources": { + "fluorescence": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fluorescence/package", + "stability": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-stability/package", + "beta_lactamase": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-beta_lactamase/package", + "solubility": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-solubility/package", + "subcellular_localization": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-subcellular_localization/package", + "binary_localization": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "fold": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fold/package", + "secondary_structure": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-secondary_structure/package", + "yeast_ppi": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-yeast_ppi/package", + "human_ppi": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "ppi_affinity": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-ppi_affinity/package" + }, + "parent_provenance": [ + { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "beta_lactamase", + "readout_kind": "residue", + "bins": 320, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fluorescence", + "readout_kind": "residue", + "bins": 256, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fold", + "readout_kind": "summary", + "bins": null, + "ridge": 0.0001, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.5, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "ppi_affinity", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random linear local readout on same joint residue states; fit-only fixed normalization and sampled fit residue labels; ridge cross entropy LBFGS", + "seed": 20261103, + "fit_residues_including_window_duplicates": 505584, + "kernel": 9, + "ridge": 0.01, + "retained_learned_nonlinear_prefix": true, + "training_device": "cuda", + "tune_policy": "fixed supplied strengths or default three strengths; full valid-residue accuracy with overlapping-window probability aggregation", + "tested_ridges": [ + 0.01 + ], + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "solubility", + "readout_kind": "summary", + "bins": null, + "ridge": 0.1, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Retained joint pair nonlinear prefix; random final layer fit using fixed fit normalization and regularized LBFGS", + "seed": 20261107, + "selected_ridges": { + "stability": 0.001 + }, + "tested_ridges": [ + 0.001 + ], + "tune_policy": "fixed supplied strengths or default five strengths; small tune sets limit confidence", + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "subcellular_localization", + "readout_kind": "summary", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "yeast_ppi", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + } + ], + "feature_cache_exported": false, + "pair_context_selection": { + "policy": "One fixed1536-token alternative versus the current context, chosen on tune with all learned tensors frozen.", + "choice_basis": "Earlier fit-only chain-length audit; human and yeast fit maxima1500/1495residues.", + "choices": { + "human_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8180272108843538, + "macro_f1": 0.8181606424889357, + "reward": 0.819047619047619 + }, + "1536": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8171768707482994, + "macro_f1": 0.817806370435012, + "reward": 0.819047619047619 + } + } + }, + "yeast_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.5894736842105263, + "balanced_accuracy": 0.570054945054945, + "macro_f1": 0.5704347826086956, + "reward": 0.5894736842105263 + }, + "1536": { + "accuracy": 0.5789473684210527, + "balanced_accuracy": 0.5611263736263736, + "macro_f1": 0.5614035087719298, + "reward": 0.5789473684210527 + } + } + } + }, + "learned_parameter_updates": 0 + } + }, + "rank_head_sources": { + "fluorescence": "/workspace/research/scale85m-8h-rank3/head-fluorescence/package", + "beta_lactamase": "/workspace/research/scale85m-8h-rank3/head-beta_lactamase/package", + "stability": "/workspace/research/scale85m-8h-rank3/head-stability/package" + }, + "head_seeds": { + "fluorescence": 20261031, + "beta_lactamase": 20261031, + "stability": 20261107 + }, + "ridges": { + "fluorescence": 1.0, + "beta_lactamase": 1.0, + "stability": 0.001 + }, + "fit_only_feature_statistics_and_rank_targets": true, + "all_other_tensors_exact": true, + "feature_cache_exported": false + }, + "readout_plan": { + "utc": "2026-10-25T17:32:40.507737+00:00", + "status": "queued", + "recovery_registered": true, + "run": "/workspace/research/dual-residue-readout1", + "parent_trainer": "/workspace/research/scale170m-grown4h-compiled1", + "features": "/workspace/research/dual-residue-cache1/features", + "cache_checks": "/workspace/research/dual-residue-cache1/cache-checks.json", + "native_references": { + "native_primary": "/workspace/research/dual-summary-subcellular1-replay/candidate/replay/predictions/secondary_structure.jsonl", + "native_auxiliary": "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/secondary_structure.jsonl", + "native_fusion": "/workspace/research/shared-fusion8h-selected-replay/candidate/replay/predictions/secondary_structure.jsonl" + }, + "frozen_sha256": { + "/workspace/research/fit_dual_residue_readouts.py": "a55238416ea2052f98e5cf00a2707c3b568183af1972e98e3a7cc43b8f9073fe", + "/workspace/research/run_dual_residue_readout_study.py": "437b4ebd6de6b5cdf4622e80943ddd271bb5f391b917056f4dca4cb1976b97e8", + "/workspace/research/run_pair_residue_study.py": "756ba8daae98d29beeb535d4647adaedfe71b3e07ef0d38aa3149f79d407f54b", + "/workspace/research/dual-residue-readout1/code/gpu_slot.py": "5e05607e4b0435be232a52b05cc392151d8a81bfbb908cf1ef3d4360786b0a0a", + "/workspace/research/dual-residue-cache1/cache-checks.json": "efcbf47de4ea451e258b7444aef22a6b4b800e580cadea342e8f677b91a7df75", + "/workspace/research/dual-residue-cache1/features/fit.pt": "3c9a3aef3fa95d8e622eb15b72dc717471de3b38f4782def971c655d63e0826f", + "/workspace/research/dual-residue-cache1/features/tune.pt": "f9287c99fe150b9bc306bfec02c9b0a7fbee04b1358f723d28373da076e7ada6", + "/workspace/research/dual-residue-development/QUALITY-PROPOSAL.md": "693e2307f6686ba33c39d6d4bf37d20f16f14666566c790471f0cb4ad0319639", + "/workspace/research/dual-residue-development/CPU-checks.json": "32986158405d6311456e092de885795523be967b84cb857dfc0af969a9c60892", + "/workspace/research/shared-fusion8h-selected-replay/decision.json": "ea19d642c76d013fd391a609371cc7ff6ee2778c7077f6397a41d9ef2f8ee3cd", + "/workspace/research/dual-summary-subcellular1-replay/candidate/replay/predictions/secondary_structure.jsonl": "5cff30bb0b0348a78da9a72b56fa2c9cea271fa8220bcbedd28fb969a10d5032", + "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/secondary_structure.jsonl": "9881b533b566b3d7772971a3d44ff32c0f386fe8685ed3ec91977165589fdf29", + "/workspace/research/shared-fusion8h-selected-replay/candidate/replay/predictions/secondary_structure.jsonl": "b98150e58890d1066a91bdbce62cd7d50594433a32ef25e3e7ac058f22729f7a" + }, + "required_publication": "/workspace/research/production-shared-fusion8h-ss1/decision.json", + "quality_proposal": "/workspace/research/dual-residue-development/QUALITY-PROPOSAL.md", + "recipe": { + "arms": [ + "primary", + "auxiliary", + "full" + ], + "seed": 20270212, + "ridge": 0.01, + "optimizer": "FP32CUDA LBFGS lr1,history30,strong_wolfe,tolerance_grad1e-5;12blocksmax10iterations/max50closures", + "fit_unique_residues": 500000, + "normalization": "fitmean/std floor1e-4", + "selection": "Final12block only; no grids/earliercheckpointchoices" + }, + "extra_current_reference_gate": "FullmustalsoimproveacceptedfusionSSby>.0005withpositivepaired2000proteinbootstrap95lower. This is fixed beforequalitytraining.", + "proof": "Disposable actual1280width/3class/all3masks CUDA3+1vs4optimizer/modelproof requiredfirst;noneofthoseweightsreused.", + "publication": "Noautoexport/publish. Anyeligibleheadrequiresstandaloneall11nativecomparison,currentselectedandcommonprimarydependencereview.", + "recovery_command": [ + "python3", + "-u", + "/workspace/research/run_dual_residue_readout_study.py", + "--run", + "/workspace/research/dual-residue-readout1" + ] + }, + "readout_result": { + "status": "eligible_for_native_all11_review", + "eligible": true, + "results": { + "primary": { + "accuracy": 0.7436379012840011, + "blocks": 12, + "active_seconds": 0.7173126210400369, + "LBFGS_iterations": 76, + "closure_evaluations": 129 + }, + "auxiliary": { + "accuracy": 0.7654377292698736, + "blocks": 12, + "active_seconds": 0.5298353870166466, + "LBFGS_iterations": 98, + "closure_evaluations": 119 + }, + "full": { + "accuracy": 0.7674307948381397, + "blocks": 12, + "active_seconds": 0.5488360379531514, + "LBFGS_iterations": 107, + "closure_evaluations": 122, + "primary_zeroed_accuracy": 0.7548798684217614, + "auxiliary_zeroed_accuracy": 0.6333926464858304 + } + }, + "comparisons": { + "full_minus_primary": { + "delta": 0.023792893554138664, + "conditional95": [ + 0.02227601983558547, + 0.025405620421006168 + ] + }, + "full_minus_auxiliary": { + "delta": 0.001993065568266087, + "conditional95": [ + 0.0013915113450666237, + 0.00262078806389141 + ] + }, + "full_minus_primary_ablated": { + "delta": 0.01255092641637833, + "conditional95": [ + 0.01141412252412414, + 0.01367599499083551 + ] + }, + "full_minus_auxiliary_ablated": { + "delta": 0.13403814835230934, + "conditional95": [ + 0.13069689870620071, + 0.13760283893506345 + ] + }, + "full_minus_native_primary": { + "delta": 0.023299116048487157, + "conditional95": [ + 0.021785460201619564, + 0.024879231525420348 + ] + }, + "full_minus_native_auxiliary": { + "delta": 0.002027181105020191, + "conditional95": [ + 0.0014295698320689104, + 0.0026466899667084306 + ] + }, + "full_minus_native_fusion": { + "delta": 0.007792706816463799, + "conditional95": [ + 0.0069797076175643485, + 0.00868359254180614 + ] + } + }, + "fit_unique_residues": 500000, + "fit_rows_including_overlap": 505584, + "tune_valid_residues": 556931, + "tune_proteins": 2170, + "published": false, + "exported": false, + "limitations": "One fixed fit-only recipe; repeated Tune selection and protein-family dependence are not corrected by conditional protein bootstrap. Feature removal is an out-of-distribution diagnostic. Native all11 review still required." + }, + "all_non_SS_parent_state_exact": true, + "unused_SS_residue_fusion_removed": true, + "auxiliary_encoder_copies": 1, + "method": "Frozen primary and auxiliary local SS prefixes feed one fit-only normalized linear readout. Both encoders originated from own-session joint all-task models; original primary stays common to all11 tasks. No fitting in assembly." + }, + "allfit_plan": { + "source_package": "/workspace/research/dual-summary-subcellular1-replay/candidate/package", + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "primary_predictions": "/workspace/research/dual-summary-subcellular1-replay/candidate/replay/predictions/secondary_structure.jsonl", + "auxiliary_predictions": "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/secondary_structure.jsonl", + "CPU_checks": "/workspace/research/dual-residue-development/CPU-checks.json", + "parent_trainer": "/workspace/research/scale170m-grown4h-compiled1", + "created_utc": "2026-10-25T17:52:56.160697+00:00", + "status": "queued", + "recovery_registered": true, + "run": "/workspace/research/dual-residue-allfit1", + "sampled_features": "/workspace/research/dual-residue-cache1/features", + "features": "/workspace/research/dual-residue-allfit1/features", + "native_references": { + "native_primary": "/workspace/research/dual-summary-subcellular1-replay/candidate/replay/predictions/secondary_structure.jsonl", + "native_auxiliary": "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/secondary_structure.jsonl", + "native_current": "/workspace/research/dual-residue-readout1-replay/candidate/replay/predictions/secondary_structure.jsonl" + }, + "recovery_command": [ + "/opt/conda/bin/python", + "-u", + "/workspace/research/run_dual_residue_allfit_study.py", + "--run", + "/workspace/research/dual-residue-allfit1" + ], + "proposal": "/workspace/research/dual-residue-allfit1/PROPOSAL.md", + "quality_seed": 20270212, + "final_blocks": 12, + "ridge": 0.01, + "frozen_sha256": { + "/workspace/research/ss-nonlinear-head1/code/ss_head_features.py": "145bf1faed0a1677af19ea323cacc84d10ddc09dd029c0624a0b173df5e8ea39", + "/workspace/research/dual-residue-development/CPU-checks.json": "32986158405d6311456e092de885795523be967b84cb857dfc0af969a9c60892", + "/workspace/research/dual-summary-subcellular1-replay/candidate/package/model.pt": "1b5b390aae06941e5a43cfd8ea681df090499e916750d08604e32963da54a1da", + "/workspace/research/dual-summary-subcellular1-replay/candidate/package/unified.py": "c5d22277c0153f0e83cf73324ac87bc0f89160e7a082fd7e8b9eca7ca2639bf3", + "/workspace/research/dual-summary-subcellular1-replay/candidate/package/esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "/workspace/research/dual-summary-subcellular1-replay/candidate/package/replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "/workspace/research/dual-summary-subcellular1-replay/candidate/package/config.json": "9a737008935673cd4bbfc6df460d7805737a9eabfd77bae76dfaa6e72ac26d9f", + "/workspace/research/scale85m-8h-rank3/candidate/package/model.pt": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "/workspace/research/scale85m-8h-rank3/candidate/package/unified.py": "bdb192772a9ad9a6def993b701564c3ab2d392702bc03c66ff0dbdd2dca096e5", + "/workspace/research/scale85m-8h-rank3/candidate/package/esm2.py": "11a5d8effc523ef016e7b3a223948c51b3f3fa8b6c5af7c84ec4be356417d3f7", + "/workspace/research/scale85m-8h-rank3/candidate/package/replay.py": "248a71d46bb8d45508dfe329e1350b37b1ce8ba21ace5c099a8253e7fc3d2364", + "/workspace/research/scale85m-8h-rank3/candidate/package/config.json": "96b66062420d075cb8810e95cbcce76fd316c60191edf4e413f6bf21b594a7c1", + "/workspace/research/cache_dual_residue_allfit.py": "1db0f0e3e5eb966373054962786f48dec037f2216bfaffaa05c36be4534413a5", + "/workspace/research/fit_dual_residue_allfit.py": "0a657d6ab212e94f2aa0691814dc59f00e36a4e1ac17b98774da5c6a5a6db6c5", + "/workspace/research/run_dual_residue_allfit_study.py": "596382e03a92129d69c8f0b654d1042956658c862a8aeaac21656733c1505ea5", + "/workspace/research/run_pair_residue_study.py": "756ba8daae98d29beeb535d4647adaedfe71b3e07ef0d38aa3149f79d407f54b", + "/workspace/research/check_shared_adapters_cpu.py": "db7d8d846b90929decad5865de36dd55fb95139aaa116b6ae2987cd96786c990", + "/workspace/research/dual-residue-allfit1/code/gpu_slot.py": "5e05607e4b0435be232a52b05cc392151d8a81bfbb908cf1ef3d4360786b0a0a", + "/workspace/research/dual-residue-allfit1/PROPOSAL.md": "d7dc111a031f9ec0317455a459a4108e3c68652c7cfc6d5e4d219b9b13ceb088", + "/workspace/research/dual-residue-cache1/features/fit.pt": "3c9a3aef3fa95d8e622eb15b72dc717471de3b38f4782def971c655d63e0826f", + "/workspace/research/dual-residue-cache1/features/tune.pt": "f9287c99fe150b9bc306bfec02c9b0a7fbee04b1358f723d28373da076e7ada6", + "/workspace/research/dual-summary-subcellular1-replay/candidate/replay/predictions/secondary_structure.jsonl": "5cff30bb0b0348a78da9a72b56fa2c9cea271fa8220bcbedd28fb969a10d5032", + "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/secondary_structure.jsonl": "9881b533b566b3d7772971a3d44ff32c0f386fe8685ed3ec91977165589fdf29", + "/workspace/research/dual-residue-readout1-replay/candidate/replay/predictions/secondary_structure.jsonl": "2f17a90be5ef227ab681561b13bb195e6102973dae3dc3d622bb2535605b0800" + } + }, + "allfit_result": { + "status": "no_eligible_gain", + "eligible": false, + "results": { + "primary": { + "accuracy": 0.7439952166426361, + "blocks": 12, + "active_seconds": 33.79976832002285, + "LBFGS_iterations": 78, + "closure_evaluations": 95 + }, + "auxiliary": { + "accuracy": 0.7657573379826226, + "blocks": 12, + "active_seconds": 39.97318197999266, + "LBFGS_iterations": 95, + "closure_evaluations": 113 + }, + "full": { + "accuracy": 0.767856341270283, + "blocks": 12, + "active_seconds": 47.72406517597847, + "LBFGS_iterations": 94, + "closure_evaluations": 135, + "primary_zeroed_accuracy": 0.75506481054206, + "auxiliary_zeroed_accuracy": 0.6353803253903985 + } + }, + "comparisons": { + "full_minus_primary": { + "delta": 0.023861124627646873, + "conditional95": [ + 0.022379338837469887, + 0.025445967719600684 + ] + }, + "full_minus_auxiliary": { + "delta": 0.00209900328766041, + "conditional95": [ + 0.0015060823960767902, + 0.002693751613766381 + ] + }, + "full_minus_primary_ablated": { + "delta": 0.012791530728223066, + "conditional95": [ + 0.011645440660906075, + 0.013867778003418266 + ] + }, + "full_minus_auxiliary_ablated": { + "delta": 0.13247601587988458, + "conditional95": [ + 0.12906435535847655, + 0.13591862258160314 + ] + }, + "full_minus_native_primary": { + "delta": 0.023724662480630456, + "conditional95": [ + 0.022235593476518073, + 0.025308672752640978 + ] + }, + "full_minus_native_auxiliary": { + "delta": 0.002452727537163491, + "conditional95": [ + 0.0018196905898359643, + 0.0030741079436519656 + ] + }, + "full_minus_native_current": { + "delta": 0.0004255464321432996, + "conditional95": [ + 0.000153183526907052, + 0.0007048781132075278 + ] + } + }, + "fit_unique_residues": 2221507, + "same_seed_and_recipe_as_500k_parent": true, + "fit_rows_including_overlap": 2245710, + "tune_valid_residues": 556931, + "tune_proteins": 2170, + "published": false, + "exported": false, + "limitations": "One fixed fit-only recipe; repeated Tune selection and protein-family dependence are not corrected by conditional protein bootstrap. Feature removal is an out-of-distribution diagnostic. Native all11 review still required." + }, + "publication_policy_review": { + "utc": "2026-10-25T17:57:48.483468+00:00", + "status": "publication_policy_review_before_new_native_audits", + "retrospective_policy_change": true, + "original_studies_unchanged": [ + "dual-residue-allfit1", + "fold-logit-fusion1" + ], + "reason": "The operator requires strongest complete compliant shared-parameter model. Earlier research screens imposed extra minimum-gain and accuracy-ablation-benefit conditions. They test stricter scientific hypotheses, not the stated replay/shared-parameter contract. Keep failed original hypothesis outcomes intact; assess deployment separately and disclose retrospective selection.", + "quality_policy": "Native all11 valid; compare each affected fit-only task to selected reference, require positive gain and positive paired conditional95lower, other outputs exact for isolatedhead changes. No arbitrary minimum positive effect floor. MultipleTune selection and family dependence remain limitations.", + "common_parameter_policy": "One original37845535parameter jointlylearned primary encoder actually supplies everytask. Audit native prediction sensitivity to sharedparameter intervention and frozen feature intervention withoutlabels. Improvement after removal does not establish independence; prediction invariance would. Any independentpathwithnegligibleprimary effect muststillfail.", + "SS_review": "Unchangednativearchitecture, fullfithead; original>.0005gatefailedat+.000425546, paired95[.000153184,.000704878]. Independentnativeall11/oldcacheidentity/sharedfeaturedependence recheck beforeselection. Noadditionalheadfit.", + "fold_review": "Fixednormalizedscorefusion pilot.331521739vsselected.248641304(delta+.082880435,95[.055706522,.111413043]); stillbelowaux.34375, originalcontrolgatefailed. Newstandalonearchitectureandlabel-freeprimarysharedparameterdependence tests required. Sources/rulefixed; noadditionalweights, temperatures orgrids.", + "fold_label_free_checks_predeclared_before_measurement": { + "primary_logit_centered_RMS_fraction_minimum": 0.25, + "predicted_class_changes_under_fitmean_primary_features_minimum_fraction": 0.1, + "predicted_class_changes_under_fixed_primary_feature_permutation_minimum_fraction": 0.15, + "predicted_class_changes_under_native_zero_shared_primary_final_normalization_minimum_fraction": 0.1, + "all_ten_other_normal_outputs_byte_exact": true + }, + "production_policy": "Preserveunchangedextra-labelpaths. Ifnewfit-onlyfoldroutepasses, explicitlyreplacepreviousfullpoolfoldroutewithfit-onlyone; remainingfourfullpoolheadsretained. Scoresofretainedfullpoolheadsremainin-sampleandnotselectionevidence.", + "publication": "Noautomaticpublication; completefreshnativeaudits, writehonestREADMEandselectionrecord, atomicmandatorypublisher." + }, + "all_non_SS_readout_state_exact": true, + "method": "Same shared architecture and own-session encoders/local prefixes; only SS readout/fit statistics replaced by final all-fit state. No fitting in assembly." + }, + "fit_only_primary_fold_source": "/workspace/research/dual-residue-readout1-replay/candidate/package", + "fit_only_primary_fold_source_sha256": "bd9bdcc7561bc61d64523b9e99cff98df05ddceebd211a740b07ee8b94abb18e", + "auxiliary_package": "/workspace/research/scale85m-8h-rank3/candidate/package", + "auxiliary_sha256": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "auxiliary_provenance": { + "method": "Fixed rank-target readout transfer within one tensor-identical shared backbone", + "parent": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/candidate/package", + "parent_provenance": { + "method": "Consolidated task readouts with tensor-identical jointly learned shared components; one literal parameter set", + "shared_parameter_digest": "397be7af196fb356e544d391fbcdc9928f0ea6e4cfd66ab6ea4a4e4c656770bc", + "head_sources": { + "fluorescence": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fluorescence/package", + "stability": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-stability/package", + "beta_lactamase": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-beta_lactamase/package", + "solubility": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-solubility/package", + "subcellular_localization": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-subcellular_localization/package", + "binary_localization": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "fold": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-fold/package", + "secondary_structure": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-secondary_structure/package", + "yeast_ppi": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-yeast_ppi/package", + "human_ppi": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "ppi_affinity": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/head-ppi_affinity/package" + }, + "parent_provenance": [ + { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "beta_lactamase", + "readout_kind": "residue", + "bins": 320, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fluorescence", + "readout_kind": "residue", + "bins": 256, + "ridge": 1.0, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "fold", + "readout_kind": "summary", + "bins": null, + "ridge": 0.0001, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.5, + "training_device": "cuda", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "ppi_affinity", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random linear local readout on same joint residue states; fit-only fixed normalization and sampled fit residue labels; ridge cross entropy LBFGS", + "seed": 20261103, + "fit_residues_including_window_duplicates": 505584, + "kernel": 9, + "ridge": 0.01, + "retained_learned_nonlinear_prefix": true, + "training_device": "cuda", + "tune_policy": "fixed supplied strengths or default three strengths; full valid-residue accuracy with overlapping-window probability aggregation", + "tested_ridges": [ + 0.01 + ], + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "solubility", + "readout_kind": "summary", + "bins": null, + "ridge": 0.1, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Retained joint pair nonlinear prefix; random final layer fit using fixed fit normalization and regularized LBFGS", + "seed": 20261107, + "selected_ridges": { + "stability": 0.001 + }, + "tested_ridges": [ + 0.001 + ], + "tune_policy": "fixed supplied strengths or default five strengths; small tune sets limit confidence", + "feature_cache_exported": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "subcellular_localization", + "readout_kind": "summary", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + }, + { + "parent": "/run-state/workspace/research/reviews/scale85m-continue4h-compiled1-at14400-joint8486-eval-0008486/raw/package", + "parent_provenance": { + "parent_run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "training_provenance": { + "seed": 20261026, + "created_utc": "2026-10-25T15:44:31Z", + "fit": "/workspace/data/fit", + "tune_policy": "selection only", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486", + "init": "/workspace/research/scale85m-continue4h-compiled1/snapshots/at-0014400s.pt", + "resume": null, + "config": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486/config.json", + "seconds": 3600.0, + "max_steps": 8486, + "eval_seconds": 300.0, + "evaluate_initial": false, + "lr": 3e-05, + "schedule_seconds": 3600.0, + "schedule_steps": 50916, + "head_lr": 0.0003, + "task_alpha": 0.25, + "task_weights": "{\"fold\": 1.5, \"secondary_structure\": 1.3, \"yeast_ppi\": 1.25, \"human_ppi\": 1.25, \"ppi_affinity\": 1.1}", + "token_budget": 16384, + "pair_token_budget": 32768, + "batch_size": 64, + "seed": 20261026, + "ema": 0.999, + "rank_weight": 0.1, + "pair_swap": 0.5, + "pair_label_smoothing": 0.05, + "anchor_decay": 1e-05, + "regression_encoder_scale": 1.0, + "freeze_heads": false, + "condition_only": false, + "condition_row_optimizer": false, + "extension_only": false, + "publish": false + }, + "initial_checkpoint_sha256": "f581d540b6abbb34eef9b424e3cb8d47a876d6e5abdf1ad85402841ea9dc93dc", + "transfer": { + "transferred": 196, + "new_tensors": [ + "pool_query", + "pool_position", + "heads.solubility.0.weight", + "heads.solubility.0.bias", + "heads.solubility.2.weight", + "heads.solubility.2.bias", + "heads.solubility.3.weight", + "heads.solubility.3.bias", + "heads.subcellular_localization.0.weight", + "heads.subcellular_localization.0.bias", + "heads.subcellular_localization.2.weight", + "heads.subcellular_localization.2.bias", + "heads.subcellular_localization.3.weight", + "heads.subcellular_localization.3.bias", + "heads.binary_localization.0.weight", + "heads.binary_localization.0.bias", + "heads.binary_localization.2.weight", + "heads.binary_localization.2.bias", + "heads.binary_localization.3.weight", + "heads.binary_localization.3.bias", + "heads.fold.0.weight", + "heads.fold.0.bias", + "heads.fold.2.weight", + "heads.fold.2.bias", + "heads.fold.3.weight", + "heads.fold.3.bias", + "heads.yeast_ppi.0.weight", + "heads.yeast_ppi.0.bias", + "heads.yeast_ppi.2.weight", + "heads.yeast_ppi.2.bias", + "heads.yeast_ppi.3.weight", + "heads.yeast_ppi.3.bias", + "heads.human_ppi.0.weight", + "heads.human_ppi.0.bias", + "heads.human_ppi.2.weight", + "heads.human_ppi.2.bias", + "heads.human_ppi.3.weight", + "heads.human_ppi.3.bias", + "heads.fluorescence.0.weight", + "heads.fluorescence.0.bias", + "heads.fluorescence.2.weight", + "heads.fluorescence.2.bias", + "heads.fluorescence.3.weight", + "heads.fluorescence.3.bias", + "heads.stability.0.weight", + "heads.stability.0.bias", + "heads.stability.2.weight", + "heads.stability.2.bias", + "heads.stability.3.weight", + "heads.stability.3.bias", + "heads.beta_lactamase.0.weight", + "heads.beta_lactamase.0.bias", + "heads.beta_lactamase.2.weight", + "heads.beta_lactamase.2.bias", + "heads.beta_lactamase.3.weight", + "heads.beta_lactamase.3.bias", + "heads.ppi_affinity.0.weight", + "heads.ppi_affinity.0.bias", + "heads.ppi_affinity.2.weight", + "heads.ppi_affinity.2.bias", + "heads.ppi_affinity.3.weight", + "heads.ppi_affinity.3.bias", + "heads.secondary_structure.0.weight", + "heads.secondary_structure.0.bias", + "heads.secondary_structure.2.weight", + "heads.secondary_structure.2.bias", + "heads.secondary_structure.3.weight", + "heads.secondary_structure.3.bias", + "heads.secondary_structure.context.0.weight", + "heads.secondary_structure.context.0.bias", + "heads.secondary_structure.context.2.weight", + "heads.secondary_structure.context.2.bias", + "pool_fuse.weight", + "pool_fuse.bias", + "pair_fuse.weight", + "pair_fuse.bias" + ], + "unexpected": [] + }, + "parent_provenance": { + "initialization": "Own-session random-initialized lineage; new MLM phase with fresh optimizer", + "parent": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "parent_provenance": { + "initialization": "Fresh random initialization in this session", + "parent": null, + "parent_provenance": null, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": false, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-mlm4h", + "init": null, + "config": "/workspace/research/scale85m-mlm4h/config.json", + "resume": null, + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0004, + "mlm_readout": "linear", + "seed": 20261121, + "snapshot_seconds": "3600,7200,14400", + "stop_after_steps": 0 + } + }, + "sources": { + "generic": { + "source": "/workspace/data/pretrain/uniref50_subset.fasta", + "sequences": 37338993, + "residues": 9903283016, + "seconds": 79.3608110989444, + "byteorder": "little", + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "manifest": { + "decontamination": { + "args": [ + "--min-seq-id", + "0.5", + "--alignment-mode", + "3", + "-c", + "0.8", + "--cov-mode", + "0", + "--max-seqs", + "300", + "-s", + "7" + ], + "query_sequences": 50254, + "removed": 45522, + "tool": "mmseqs easy-search" + }, + "files": { + "uniref50_subset.fasta": "fd68ec1e02ecb6bd1bcba093720a0e03b5e83a13593f241748fa10d98f18c2b6" + }, + "length": { + "max": 1024, + "mean": 265.2263015234503, + "median": 203, + "min": 30 + }, + "pinned_release": "2026_03", + "residues": 9903283016, + "sampling": { + "max_length": 1024, + "method": "all-in-range", + "min_length": 30, + "records_in_range": 37384515, + "records_scanned": 38840027 + }, + "schema": "peer-protein-pretrain/v1", + "sequences": 37338993, + "source": "UniRef50", + "source_release_note": null, + "source_sha256": "95bdf597d2f892295b5aa2925f5da593e1f2e1fcd7a0a4f5e66b9f1c2e83290d", + "source_size": 8780552383 + } + }, + "domain": { + "source": "/workspace/data/fit", + "sequences": 179628, + "residues": 39733941, + "alphabet": "LAGVSERTIDPKQNFYMHWCXBUZO", + "first_residue": 4, + "tokens_sha256": "1f297779c964ed55aa920fe31da99c15aa8797ef049cd2cb484ebd5677aa63fe", + "manifest": { + "inputs": { + "beta_lactamase.jsonl": { + "file_sha256": "6a5305b73b1359f23b3789a0c4198228cc48278ad8a8f91c93e0a04be1d28a91", + "sequence_presentations": 4158 + }, + "binary_localization.jsonl": { + "file_sha256": "6d281ff0a0be446d674358c18a14465658c2c694de7b567a0027237c527354b4", + "sequence_presentations": 5184 + }, + "fluorescence.jsonl": { + "file_sha256": "ff5d18a78ecb0cf584d6d3b96b8d18c8553593007afa356c4e228559b084d9b6", + "sequence_presentations": 21446 + }, + "fold.jsonl": { + "file_sha256": "931f4be0125ef6b38e97a2fc1c8adebb91bf6ae7493ca6f5661573d1d1a19b9a", + "sequence_presentations": 12312 + }, + "human_ppi.jsonl": { + "file_sha256": "ec222f1759d3de2aeacaf77da312df770c64ecaf9fe2c4704109826fb8e8b7f2", + "sequence_presentations": 71338 + }, + "ppi_affinity.jsonl": { + "file_sha256": "b8f571c32248cbb2a9d2b8a3c2393abed4354849b9ca147c46117ffe2174ddce", + "sequence_presentations": 4842 + }, + "secondary_structure.jsonl": { + "file_sha256": "4ef39e08b03fa8c1ed2efce9aa01c003e7ef3b874985e8f800a435eb0fb7be18", + "sequence_presentations": 8678 + }, + "solubility.jsonl": { + "file_sha256": "abe4036e453a79f5428b755721b539899ed81c9be2d2376e9efb0737d8d2ebeb", + "sequence_presentations": 62478 + }, + "stability.jsonl": { + "file_sha256": "48b7663d46efd4d9c9b7128203fac007c5550779923348ffb3262dd71f624d62", + "sequence_presentations": 53614 + }, + "subcellular_localization.jsonl": { + "file_sha256": "72b6be9573ec8eec77268eae099a208f128f409356860c555664d2dad8db2538", + "sequence_presentations": 8420 + }, + "yeast_ppi.jsonl": { + "file_sha256": "43669433617fa600682858d50ce3e23751acf21b85afcd70f16ab4dc37e2b0a9", + "sequence_presentations": 9890 + } + }, + "labels_used": false, + "tune_used": false, + "deduplication": "Exact sequence across all eleven fit tasks; first occurrence in sorted task files" + }, + "purpose": "Training-only label-free domain MLM corpus; never an inference lookup" + } + }, + "labels_used": false, + "tune_used": false, + "mlm_readout": { + "kind": "linear", + "training_only": true, + "inherited": true, + "parameters": 0, + "initialization": "inherited or parameter-free" + }, + "mixing": "Bernoulli by token-budgeted batch; actual tokens reported per corpus", + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": null, + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + }, + "parent_sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "inherited_data_stream": { + "parent_stage_tokens_seen": 4491780664, + "parent_stage_active_seconds": 14400.080329400342, + "parent_stage_source_tokens": { + "generic": 4491780664, + "domain": 0 + }, + "stream_positions": { + "generic": { + "permutation_seed": 38378812455577342, + "cursor": 16809984, + "epoch": 1, + "without_replacement": true + }, + "domain": { + "permutation_seed": null, + "cursor": 0, + "epoch": 0, + "without_replacement": true + } + }, + "pending_batches": { + "generic": 11, + "domain": 0 + }, + "masking_rng": "Fresh stage seed; recovery restores the stage masking RNG exactly", + "optimizer": "Fresh stage optimizer; no optimizer state imported with the data stream", + "sha256": "43f4a552918678df8f1f4acad66ac05a435c5d84905409d84a45ad1591755d8f", + "checkpoint": "/workspace/research/scale85m-mlm4h/pretrain.pt" + }, + "encoder_execution": { + "backend": "torch_inductor", + "dynamic": true, + "fullgraph": true, + "max_rotary_length": 1024, + "persistent_state_keys_unchanged": true, + "inference_requires_compiler": false, + "cache_manager": "same_directory_atomic_replace", + "compile_threads": 4, + "coalesce_tiling_analysis": false, + "max_tiles": 3, + "numerics": "Close but not bit-identical to eager; downstream selection remains required." + }, + "continuations": [ + { + "utc": "2026-10-25T08:58:57Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 0, + "active_seconds": 0.0, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + }, + { + "utc": "2026-10-25T09:06:53Z", + "resume_from": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "step": 1598, + "active_seconds": 300.5015191048733, + "arguments": { + "run": "/workspace/research/scale85m-continue4h-compiled1", + "init": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "config": null, + "resume": "/workspace/research/scale85m-continue4h-compiled1/pretrain.pt", + "init_data_state": "/workspace/research/scale85m-mlm4h/pretrain.pt", + "corpus": "/workspace/research/cache/uniref50", + "domain": "/workspace/research/cache/fit-text", + "domain_fraction": 0.0, + "seconds": 14400.0, + "eval_seconds": 600.0, + "token_budget": 65536, + "lr": 0.0001, + "mlm_readout": "linear", + "compile_encoder": true, + "seed": 20261210, + "snapshot_seconds": "7200,14400", + "stop_after_steps": 0 + } + } + ], + "compiler_warmups": [ + { + "seconds": 73.32705240600626, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + }, + { + "seconds": 41.77339493698673, + "batch_sizes": [ + 4, + 1 + ], + "synthetic_length": 128, + "optimizer_updates": 0, + "parameters_modified": false, + "RNG_restored": true, + "excluded_from_active_training_clock": true, + "reported_as_additional_startup_wall_time": true + } + ] + }, + "parent_training": { + "phase": "pretrain", + "active_seconds": 14400.099049523531, + "step": 90848, + "tokens_seen": 5762728738, + "history": [ + { + "step": 0, + "active_seconds": 0.0, + "tokens": 0, + "source_tokens": { + "generic": 0, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.423511048027335, + "domain": 2.4946916702850217 + } + }, + { + "step": 3492, + "active_seconds": 600.1476070382632, + "tokens": 221623432, + "source_tokens": { + "generic": 221623432, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4253183783676837, + "domain": 2.4948402063720803 + } + }, + { + "step": 7292, + "active_seconds": 1200.1844144255156, + "tokens": 462490612, + "source_tokens": { + "generic": 462490612, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4239450584638504, + "domain": 2.494536972506796 + } + }, + { + "step": 11084, + "active_seconds": 1800.3797199359105, + "tokens": 702974589, + "source_tokens": { + "generic": 702974589, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4218759844501063, + "domain": 2.491229815872936 + } + }, + { + "step": 14881, + "active_seconds": 2400.385638829466, + "tokens": 943804461, + "source_tokens": { + "generic": 943804461, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.419531168362674, + "domain": 2.4875500407982614 + } + }, + { + "step": 18694, + "active_seconds": 3000.49771780608, + "tokens": 1185700038, + "source_tokens": { + "generic": 1185700038, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.417477845550631, + "domain": 2.4883330016508087 + } + }, + { + "step": 22495, + "active_seconds": 3600.5847576800443, + "tokens": 1426832861, + "source_tokens": { + "generic": 1426832861, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4149791911258496, + "domain": 2.4841147177106406 + } + }, + { + "step": 26300, + "active_seconds": 4200.59286573666, + "tokens": 1668114975, + "source_tokens": { + "generic": 1668114975, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4128974753320813, + "domain": 2.482289464189824 + } + }, + { + "step": 30113, + "active_seconds": 4800.7282401409175, + "tokens": 1909816913, + "source_tokens": { + "generic": 1909816913, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4104219554847988, + "domain": 2.480595113831345 + } + }, + { + "step": 33919, + "active_seconds": 5400.8894071894465, + "tokens": 2151378174, + "source_tokens": { + "generic": 2151378174, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4081391597540662, + "domain": 2.4788178428417407 + } + }, + { + "step": 37724, + "active_seconds": 6000.945332366187, + "tokens": 2392498343, + "source_tokens": { + "generic": 2392498343, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.40604953234298, + "domain": 2.4760817078267636 + } + }, + { + "step": 41539, + "active_seconds": 6600.987033036014, + "tokens": 2634479816, + "source_tokens": { + "generic": 2634479816, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4048449735994493, + "domain": 2.4754943315063263 + } + }, + { + "step": 45345, + "active_seconds": 7200.023320763808, + "tokens": 2876046075, + "source_tokens": { + "generic": 2876046075, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.402990461686931, + "domain": 2.471542294896966 + } + }, + { + "step": 49141, + "active_seconds": 7800.068156623776, + "tokens": 3116989552, + "source_tokens": { + "generic": 3116989552, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.4007241614982235, + "domain": 2.470990069713636 + } + }, + { + "step": 52904, + "active_seconds": 8400.131869991426, + "tokens": 3356055558, + "source_tokens": { + "generic": 3356055558, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.399649958355359, + "domain": 2.4703706067141984 + } + }, + { + "step": 56697, + "active_seconds": 9000.173056922475, + "tokens": 3596533259, + "source_tokens": { + "generic": 3596533259, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3977112399422813, + "domain": 2.468582323340381 + } + }, + { + "step": 60495, + "active_seconds": 9600.258449959103, + "tokens": 3837667685, + "source_tokens": { + "generic": 3837667685, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.396356180387372, + "domain": 2.467015188962025 + } + }, + { + "step": 64294, + "active_seconds": 10200.273898192594, + "tokens": 4078536135, + "source_tokens": { + "generic": 4078536135, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3955589558835735, + "domain": 2.4658141508088334 + } + }, + { + "step": 68115, + "active_seconds": 10800.419885064737, + "tokens": 4320950711, + "source_tokens": { + "generic": 4320950711, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3943983132191766, + "domain": 2.4638538644816 + } + }, + { + "step": 71916, + "active_seconds": 11400.505260802456, + "tokens": 4561960446, + "source_tokens": { + "generic": 4561960446, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3931896485983737, + "domain": 2.4637948531786984 + } + }, + { + "step": 75715, + "active_seconds": 12000.620743476233, + "tokens": 4802972926, + "source_tokens": { + "generic": 4802972926, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3925407879288936, + "domain": 2.4616549764964257 + } + }, + { + "step": 79513, + "active_seconds": 12600.718148327753, + "tokens": 5043800640, + "source_tokens": { + "generic": 5043800640, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3921744404289553, + "domain": 2.462337334630697 + } + }, + { + "step": 83309, + "active_seconds": 13200.741079131374, + "tokens": 5284462688, + "source_tokens": { + "generic": 5284462688, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3915259279186594, + "domain": 2.461360936005462 + } + }, + { + "step": 87101, + "active_seconds": 13800.777039410808, + "tokens": 5525156396, + "source_tokens": { + "generic": 5525156396, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3916266299612445, + "domain": 2.4602868844077226 + } + }, + { + "step": 90848, + "active_seconds": 14400.099049523531, + "tokens": 5762728738, + "source_tokens": { + "generic": 5762728738, + "domain": 0 + }, + "mlm_loss": { + "generic": 2.3906130185218766, + "domain": 2.4593765764752398 + } + } + ] + } + }, + "snapshot_step": 8486, + "weights": "raw" + }, + "method": "Random-initialized linear head over expanded shared encoder states; fit-only feature normalization and ridge LBFGS; tune selection", + "task": "yeast_ppi", + "readout_kind": "pair_symmetric", + "bins": null, + "ridge": 0.01, + "seed": 20261031, + "encoder_layers": 12, + "class_weight_power": 0.0, + "training_device": "cpu", + "cpu_threads": 4, + "feature_cache_exported": false, + "fixed_shared_bilinear_residual_included": false, + "uncompressed_chain_summaries": false + } + ], + "feature_cache_exported": false, + "pair_context_selection": { + "policy": "One fixed1536-token alternative versus the current context, chosen on tune with all learned tensors frozen.", + "choice_basis": "Earlier fit-only chain-length audit; human and yeast fit maxima1500/1495residues.", + "choices": { + "human_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8180272108843538, + "macro_f1": 0.8181606424889357, + "reward": 0.819047619047619 + }, + "1536": { + "accuracy": 0.819047619047619, + "balanced_accuracy": 0.8171768707482994, + "macro_f1": 0.817806370435012, + "reward": 0.819047619047619 + } + } + }, + "yeast_ppi": { + "original_tokens": 1024, + "selected_tokens": 1024, + "metrics_by_context": { + "1024": { + "accuracy": 0.5894736842105263, + "balanced_accuracy": 0.570054945054945, + "macro_f1": 0.5704347826086956, + "reward": 0.5894736842105263 + }, + "1536": { + "accuracy": 0.5789473684210527, + "balanced_accuracy": 0.5611263736263736, + "macro_f1": 0.5614035087719298, + "reward": 0.5789473684210527 + } + } + } + }, + "learned_parameter_updates": 0 + } + }, + "rank_head_sources": { + "fluorescence": "/workspace/research/scale85m-8h-rank3/head-fluorescence/package", + "beta_lactamase": "/workspace/research/scale85m-8h-rank3/head-beta_lactamase/package", + "stability": "/workspace/research/scale85m-8h-rank3/head-stability/package" + }, + "head_seeds": { + "fluorescence": 20261031, + "beta_lactamase": 20261031, + "stability": 20261107 + }, + "ridges": { + "fluorescence": 1.0, + "beta_lactamase": 1.0, + "stability": 0.001 + }, + "fit_only_feature_statistics_and_rank_targets": true, + "all_other_tensors_exact": true, + "feature_cache_exported": false + }, + "fold_study": { + "created_utc": "2026-10-25T17:54:35.605070+00:00", + "status": "queued", + "run": "/workspace/research/fold-logit-fusion1", + "packages": { + "primary": "/workspace/research/dual-residue-readout1-replay/candidate/package", + "auxiliary": "/workspace/research/scale85m-8h-rank3/candidate/package" + }, + "features": { + "primary": "/workspace/research/conditioned-readout-refit1/features-summary/fold/tune.pt", + "auxiliary": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold/tune.pt" + }, + "predictions": { + "primary": "/workspace/research/dual-residue-readout1-replay/candidate/replay/predictions/fold.jsonl", + "auxiliary": "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/fold.jsonl" + }, + "frozen_sha256": { + "/workspace/research/run_fold_logit_fusion.py": "3249a75fa71fbcd888e344200b8b0899e76fb6f049d864078f16b938d60cbe75", + "/workspace/research/fit_dual_residue_readouts.py": "a55238416ea2052f98e5cf00a2707c3b568183af1972e98e3a7cc43b8f9073fe", + "/workspace/research/fold-logit-fusion1/PROPOSAL.md": "e0c08009551809807db0941a3ad16e9a7abcc3dd43c3dcd0ea74e15e3d484162", + "/workspace/research/dual-summary-feature-checks.json": "c0f3988785747df6360d12eb7d1cfba267f5f80679868fd6f710bde1f803a25f", + "/workspace/research/conditioned-readout-refit1/features-summary/fold/tune.pt": "7e0bc2c0d63b6673d3dcbbb6f7d15a0251c061742ed6bd949d640ad6fcd82296", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold/tune.pt": "ab948028b9be27d990a0a83b6e6e92384fc19667bc6f87e6777368c9aac2b9da", + "/workspace/research/dual-residue-readout1-replay/candidate/replay/predictions/fold.jsonl": "365d0e8cf6d51bfe90a154cef6dd6ea9d6ca37467193655c131cc2ab1df17a36", + "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/fold.jsonl": "6c63e2d7c933cb1350be5f3938bee3f73026542122c32a6c572dcbed2c167f73", + "/workspace/research/dual-residue-readout1-replay/candidate/package/model.pt": "bd9bdcc7561bc61d64523b9e99cff98df05ddceebd211a740b07ee8b94abb18e", + "/workspace/research/dual-residue-readout1-replay/candidate/package/config.json": "fa516bd8637412d039d46cc25ceeb318e8da206b892fae9a8fc84540dc68e943", + "/workspace/research/scale85m-8h-rank3/candidate/package/model.pt": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "/workspace/research/scale85m-8h-rank3/candidate/package/config.json": "96b66062420d075cb8810e95cbcce76fd316c60191edf4e413f6bf21b594a7c1" + }, + "recovery_registered": true, + "recovery_command": [ + "/opt/conda/bin/python", + "-u", + "/workspace/research/run_fold_logit_fusion.py", + "--run", + "/workspace/research/fold-logit-fusion1" + ], + "new_training_updates": 0 + }, + "fold_result": { + "status": "no_eligible_gain", + "eligible": false, + "accuracies": { + "primary": 0.24864130434782608, + "auxiliary": 0.34375, + "raw": 0.31657608695652173, + "full": 0.33152173913043476 + }, + "comparisons": { + "full_minus_primary": { + "delta": 0.08288043478260869, + "conditional95": [ + 0.05570652173913043, + 0.11141304347826086 + ] + }, + "full_minus_auxiliary": { + "delta": -0.012228260869565218, + "conditional95": [ + -0.03264266304347826, + 0.009544836956521554 + ] + }, + "full_minus_raw": { + "delta": 0.014945652173913044, + "conditional95": [ + 0.001358695652173913, + 0.028532608695652172 + ] + } + }, + "native_feature_head_checks": { + "primary": { + "native_argmax_exact": true, + "maximum_probability_difference": 3.814697265625e-06 + }, + "auxiliary": { + "native_argmax_exact": true, + "maximum_probability_difference": 2.6226043701171875e-06 + } + }, + "new_training_updates": 0, + "learned_parameter_provenance": "Both source models jointly trained all11 from scratch in this session.", + "exported": false, + "published": false, + "limitations": "Fixedequalweights/rowRMS inference only; conditional intervals do not correct repeated selection or familydependence. Removingprimarylogits yieldsauxiliaryargmax, so dependencegate requirespositive>=.02gain overauxiliary." + }, + "publication_policy_review": { + "utc": "2026-10-25T17:57:48.483468+00:00", + "status": "publication_policy_review_before_new_native_audits", + "retrospective_policy_change": true, + "original_studies_unchanged": [ + "dual-residue-allfit1", + "fold-logit-fusion1" + ], + "reason": "The operator requires strongest complete compliant shared-parameter model. Earlier research screens imposed extra minimum-gain and accuracy-ablation-benefit conditions. They test stricter scientific hypotheses, not the stated replay/shared-parameter contract. Keep failed original hypothesis outcomes intact; assess deployment separately and disclose retrospective selection.", + "quality_policy": "Native all11 valid; compare each affected fit-only task to selected reference, require positive gain and positive paired conditional95lower, other outputs exact for isolatedhead changes. No arbitrary minimum positive effect floor. MultipleTune selection and family dependence remain limitations.", + "common_parameter_policy": "One original37845535parameter jointlylearned primary encoder actually supplies everytask. Audit native prediction sensitivity to sharedparameter intervention and frozen feature intervention withoutlabels. Improvement after removal does not establish independence; prediction invariance would. Any independentpathwithnegligibleprimary effect muststillfail.", + "SS_review": "Unchangednativearchitecture, fullfithead; original>.0005gatefailedat+.000425546, paired95[.000153184,.000704878]. Independentnativeall11/oldcacheidentity/sharedfeaturedependence recheck beforeselection. Noadditionalheadfit.", + "fold_review": "Fixednormalizedscorefusion pilot.331521739vsselected.248641304(delta+.082880435,95[.055706522,.111413043]); stillbelowaux.34375, originalcontrolgatefailed. Newstandalonearchitectureandlabel-freeprimarysharedparameterdependence tests required. Sources/rulefixed; noadditionalweights, temperatures orgrids.", + "fold_label_free_checks_predeclared_before_measurement": { + "primary_logit_centered_RMS_fraction_minimum": 0.25, + "predicted_class_changes_under_fitmean_primary_features_minimum_fraction": 0.1, + "predicted_class_changes_under_fixed_primary_feature_permutation_minimum_fraction": 0.15, + "predicted_class_changes_under_native_zero_shared_primary_final_normalization_minimum_fraction": 0.1, + "all_ten_other_normal_outputs_byte_exact": true + }, + "production_policy": "Preserveunchangedextra-labelpaths. Ifnewfit-onlyfoldroutepasses, explicitlyreplacepreviousfullpoolfoldroutewithfit-onlyone; remainingfourfullpoolheadsretained. Scoresofretainedfullpoolheadsremainin-sampleandnotselectionevidence.", + "publication": "Noautomaticpublication; completefreshnativeaudits, writehonestREADMEandselectionrecord, atomicmandatorypublisher." + }, + "one_auxiliary_encoder": true, + "all_non_fold_parent_paths_exact": true, + "new_training_updates": 0, + "method": "Reuse the two active native fit-only fold readouts; center and divide each class-logit vector by its rowRMS, floor1e-6, and take equalmean. All11 retain the same common jointlytrained primaryencoder. No test-time fitting or lookup." + }, + "fullpool_recipe_plan": { + "created_utc": "2026-10-25T18:10:25.957757+00:00", + "status": "queued", + "recovery_registered": true, + "run": "/workspace/research/production-dual-fold-fullpool1", + "parent_trainer": "/workspace/research/scale170m-grown4h-compiled1", + "pilot_run": "/workspace/research/crossfit-dual-fold-labels1", + "source_fit_only_package": "/workspace/research/fold-shared-publication-review1/candidate/package", + "fit_only_development_reference": { + "reward": 0.7297185914788012, + "tasks": { + "beta_lactamase": { + "invalid_reason": null, + "reward": 0.8851158090618965, + "spearman": 0.8851158090618965 + }, + "binary_localization": { + "accuracy": 0.9462116830537883, + "balanced_accuracy": 0.9419155998103367, + "invalid_reason": null, + "macro_f1": 0.9439947337349208, + "reward": 0.9462116830537883 + }, + "fluorescence": { + "invalid_reason": null, + "reward": 0.826705913429907, + "spearman": 0.826705913429907 + }, + "fold": { + "accuracy": 0.33152173913043476, + "balanced_accuracy": 0.24829334307555725, + "invalid_reason": null, + "macro_f1": 0.06260331921007772, + "reward": 0.33152173913043476 + }, + "human_ppi": { + "accuracy": 0.7968253968253968, + "balanced_accuracy": 0.8005952380952381, + "invalid_reason": null, + "macro_f1": 0.7968233491897122, + "reward": 0.7968253968253968 + }, + "ppi_affinity": { + "invalid_reason": null, + "reward": 0.5341420012716276, + "rmse": 1.9334586965956642, + "spearman": 0.7162121646852028 + }, + "secondary_structure": { + "accuracy": 0.767856341270283, + "invalid_reason": null, + "reward": 0.767856341270283, + "valid_residues": 556931 + }, + "solubility": { + "accuracy": 0.7533851915874388, + "balanced_accuracy": 0.7392508255204544, + "invalid_reason": null, + "macro_f1": 0.742264399722415, + "reward": 0.7533851915874388 + }, + "stability": { + "invalid_reason": null, + "reward": 0.7311607642876724, + "spearman": 0.7311607642876724 + }, + "subcellular_localization": { + "accuracy": 0.7908217716115261, + "balanced_accuracy": 0.6999121500389823, + "invalid_reason": null, + "macro_f1": 0.7198401417205603, + "reward": 0.7908217716115261 + }, + "yeast_ppi": { + "accuracy": 0.6631578947368421, + "balanced_accuracy": 0.6597985347985349, + "invalid_reason": null, + "macro_f1": 0.6567299006323397, + "reward": 0.6631578947368421 + } + }, + "package": "/workspace/research/fold-shared-publication-review1/candidate/package", + "report": "/workspace/research/fold-shared-publication-review1/candidate/report.json", + "model_sha256": "19088470dfe6d5940dcf1589c40a693dcbbf81342320a0551e4bc3612077fb6d", + "inference_assets_sha256": { + "model.pt": "19088470dfe6d5940dcf1589c40a693dcbbf81342320a0551e4bc3612077fb6d", + "config.json": "c0d1e24fea3f93877d6815607918ab67c4f4d79ca213d9f507c4ee31775bd705", + "esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "unified.py": "836d7d3834d8601d2fe2a6f5f3513e9a02153aa39d44f8d38de0a354cf529883", + "replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "infer.sh": "60f55b73f5b39a35a61df84026abed9a127b1cc035d650c9e1ca62f54fc2b468" + }, + "parameters": 145755212, + "score_kind": "fit_only_development_tune_selection", + "decision": "/workspace/research/fold-shared-publication-review1/decision.json" + }, + "production_parent": { + "utc": "2026-10-25T18:05:12.882285+00:00", + "package": "/workspace/research/production-fold-shared1/candidate/package", + "score_kind": "tune_labels_used_for_fluorescence_beta_lactamase_ppi_affinity_and_stability", + "model_sha256": "93a8fa2aadcb92983cefa53154866e9efc47a21deea0d847042c1f836883b513", + "inference_assets_sha256": { + "model.pt": "93a8fa2aadcb92983cefa53154866e9efc47a21deea0d847042c1f836883b513", + "config.json": "c0d1e24fea3f93877d6815607918ab67c4f4d79ca213d9f507c4ee31775bd705", + "esm2.py": "d4d512296047ebbd0f9a26dc1390107f72762cb5de011eefc9fecb18118a9be9", + "unified.py": "836d7d3834d8601d2fe2a6f5f3513e9a02153aa39d44f8d38de0a354cf529883", + "replay.py": "9c5add2d3fb117470241cf63f621e4797a16962cddadbaad6de2cfb481e7fa85", + "infer.sh": "60f55b73f5b39a35a61df84026abed9a127b1cc035d650c9e1ca62f54fc2b468" + }, + "parameters": 145755212, + "fit_only_development_reference": { + "package": "/workspace/research/fold-shared-publication-review1/candidate/package", + "report": "/workspace/research/fold-shared-publication-review1/candidate/report.json", + "reward": 0.7297185914788012, + "model_sha256": "19088470dfe6d5940dcf1589c40a693dcbbf81342320a0551e4bc3612077fb6d" + }, + "in_sample_verification_report": "/workspace/research/production-fold-shared1/candidate/report.json", + "verification": { + "all_eleven_outputs_valid": true, + "ten_other_predictions_byte_identical_to_previous_production": true, + "fold_predictions_byte_identical_to_accepted_fit_only_development": true, + "all_non_fold_feature_paths_unchanged": true, + "four_extra_label_heads_and_features_exact": true, + "one_auxiliary_encoder": true, + "tune_rows_used_for_fitting": { + "fluorescence": 5362, + "beta_lactamase": 520, + "ppi_affinity": 203, + "stability": 2512 + }, + "in_sample_scores_of_reused_label_tasks_excluded_from_selection": true, + "native_shared_primary_norm_zero_fold_class_change_fraction": 0.5040760869565217 + }, + "training": "Own-session jointlytrained all11 primary and auxiliary encoders, one copyeach. Fixed equalmean of two centered/RMS-normalized fit-only foldreadouts; primarycommonencoder remainsactiveall11 andnativeparameterzeroingchanges50.4%folddecisions. AllfitSSandother10paths unchanged. Four extra-labelheadsGFP/beta/affinity/stability retained exactly; previousfullpoolfoldheadremoved.", + "ss_fit_only_selection_evidence": { + "kind": "fit_only_tune_complete_replay", + "task": "secondary_structure", + "before": 0.7438318211771296, + "after": 0.7441316787896526, + "delta": 0.00029985761252291574, + "conditional_95_percentile_interval": [ + 4.102067509503305e-05, + 0.0005682928659789181 + ], + "examples": 2170, + "valid_residues": 556931, + "correct_residue_gain": 167, + "method": "own-session teacher distillation", + "teacher": "Own85M2hMLM+jointall11+taskconditioning; fit-onlylabels; no teacher exported", + "matched_controls": { + "hard": { + "delta": 0.0006984707261761331, + "conditional95": [ + 0.00020130648256647902, + 0.001201981603808556 + ], + "protein_units": 2170, + "valid_residues": 556931, + "draws": 2000, + "limitations": "Conditional paired protein bootstrap, not corrected for repeated tune selection or protein-family dependence." + }, + "smooth": { + "delta": 0.00027112873946682803, + "conditional95": [ + -0.00019057496656699647, + 0.0007187128477994618 + ], + "protein_units": 2170, + "valid_residues": 556931, + "draws": 2000, + "limitations": "Conditional paired protein bootstrap, not corrected for repeated tune selection or protein-family dependence." + } + }, + "other_ten_development_predictions_byte_identical": true, + "limitations": "Conditional paired protein bootstrap, not corrected for repeated tune selection or protein-family dependence. Teacher-versus-smoothing64 interval crosseszero.", + "selected_distillation_epoch": 64, + "distillation_updates": 9152, + "additional_updates_after16": 6864 + }, + "previous_production_package": "/workspace/research/production-allfit-ss1/candidate/package", + "tasks_reusing_tune_labels": [ + "fluorescence", + "beta_lactamase", + "ppi_affinity", + "stability" + ], + "fluorescence_recipe_selection_evidence": { + "incumbent_spearman": 0.826705913429907, + "matched_fit_only_refit_spearman": 0.8267059285858314, + "crossfit_spearman": 0.8289887921828193, + "crossfit_delta_vs_incumbent": 0.0022828787529123318, + "crossfit_delta_vs_fit_only_refit": 0.0022828635969879274, + "conditional_paired_95_vs_incumbent": [ + 0.0009792262424118709, + 0.0036331746186231443 + ], + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 2681, + "added_tune_rows": 2681, + "training_rows": 24127, + "heldout_spearman": 0.8232686916324296, + "incumbent_same_half_spearman": 0.8211575283985865, + "fit_seconds": 1.7692138720012736, + "closures": 160 + }, + { + "heldout_half": 1, + "heldout_rows": 2681, + "added_tune_rows": 2681, + "training_rows": 24127, + "heldout_spearman": 0.8349378336333676, + "incumbent_same_half_spearman": 0.8324217270853131, + "fit_seconds": 1.6950949229940306, + "closures": 160 + } + ], + "limitations": "Prior tune model selection biases the estimate. Label stratification is not a protein-family split, and unseen test distribution may differ. Combined OOF scores come from two heads with training-only rank normalization, not one full-pool model. Conditional paired bootstrap ignores remaining family dependence and selection." + }, + "beta_lactamase_recipe_selection_evidence": { + "incumbent_spearman": 0.8851158090618965, + "matched_fit_only_refit_spearman": 0.8851173641514167, + "crossfit_spearman": 0.8939613181865891, + "crossfit_delta_vs_incumbent": 0.008845509124692619, + "crossfit_delta_vs_fit_only_refit": 0.008843954035172352, + "conditional_paired_95_vs_incumbent": [ + 0.0030908473904126045, + 0.016275743694867638 + ], + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 260, + "added_tune_rows": 260, + "training_rows": 4418, + "heldout_spearman": 0.8954806478975963, + "incumbent_same_half_spearman": 0.8876831699844637, + "fit_seconds": 0.7535757489968091, + "closures": 163 + }, + { + "heldout_half": 1, + "heldout_rows": 260, + "added_tune_rows": 260, + "training_rows": 4418, + "heldout_spearman": 0.8906708928087468, + "incumbent_same_half_spearman": 0.8805064277745905, + "fit_seconds": 0.7396053560078144, + "closures": 161 + } + ], + "limitations": "Prior tune model selection biases the estimate. Label stratification is not a protein-family split, and unseen test distribution may differ. Combined OOF scores come from two heads with training-only rank normalization, not one full-pool model. Conditional paired bootstrap ignores remaining family dependence and selection." + }, + "ppi_affinity_recipe_selection_evidence": { + "status": "research_only_crossfit_complete", + "task": "ppi_affinity", + "incumbent_reward": 0.5341420012716276, + "matched_fit_only_reward": 0.5210555476068024, + "crossfit_reward": 0.5515877648877663, + "crossfit_delta_vs_incumbent": 0.0174457636161387, + "conditional_paired_95_vs_incumbent": [ + 0.002641673708393072, + 0.0303974991382099 + ], + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 102, + "added_tune_rows": 101, + "reward": 0.5641044100756688, + "incumbent_reward": 0.5459868174958554, + "closures": 166, + "seconds": 0.1286191190010868 + }, + { + "heldout_half": 1, + "heldout_rows": 101, + "added_tune_rows": 102, + "reward": 0.5396756511271861, + "incumbent_reward": 0.522833934532602, + "closures": 163, + "seconds": 0.12902537698391825 + } + ], + "published": false, + "exported": false, + "limitations": "Tune influenced earlier backbone/head selection. Pair-example resampling does not establish protein or family independence. OOF heads are research evidence only, not a single replayable model.", + "publication": "Research-only out-of-fold evidence; no full-pool head, lookup or package is exported." + }, + "shared_summary_fit_only_evidence": { + "kind": "complete_fit_only_tune_replay", + "selected_global_step": 3000, + "jointly_trained_tasks": [ + "solubility", + "subcellular_localization", + "binary_localization" + ], + "parameters_added": 475906, + "tasks": { + "binary_localization": { + "before": 0.9375361480624639, + "after": 0.9462116830537883, + "delta": 0.008675534991324466, + "case_gain": 15, + "conditional95": [ + 0.002891844997108155, + 0.015037593984962405 + ], + "examples": 1729, + "limitations": "Conditional paired-example bootstrap; not corrected for repeated tune selection or family dependence." + } + }, + "other_ten_development_prediction_files_exact": true, + "limitations": "Conditional paired-example bootstrap does not correct repeated tune selection or family dependence. Only binary localization passes the predeclared exit gate." + }, + "stability_fit_only_selection_evidence": { + "kind": "fit_only_complete_tune_replay", + "task": "stability", + "before": 0.7274923808177973, + "after": 0.7311607642876724, + "delta": 0.0036683834698750806, + "conditional_95_percentile_interval": [ + 0.0017767471141417273, + 0.00544199745819068 + ], + "examples": 2512, + "mean_delta": 0.0003334894063522801, + "conditional_mean95": [ + 0.0001615224649219752, + 0.0004947270416536983 + ], + "matched_natural_mixture_control": { + "delta": 0.0020391645917180456, + "conditional_95": [ + 0.0012832147204794586, + 0.0028118185483942955 + ] + }, + "fixed_endpoint_updates": 1680, + "alpha": 0.5, + "ten_other_prediction_files_exact": true, + "limitations": "Conditional on already-selected models. Does not account for repeated tune selection, shared proteins across tasks, or family dependence within splits; not an independent generalization guarantee. The visible Tune length distribution informed the group-weighting hypothesis." + }, + "stability_extra_label_recipe_selection_evidence": { + "utc": "2026-10-25T16:17:04.539090+00:00", + "status": "research_only_crossfit_complete", + "scores": { + "incumbent": 0.7311607642876724, + "matched_fit_only": 0.7311607642876724, + "crossfit": 0.7337159019671029 + }, + "comparisons": { + "incumbent": { + "delta": 0.002555137679430497, + "conditional_95": [ + 0.0015641029747572976, + 0.0036431410475218527 + ] + }, + "matched_fit_only": { + "delta": 0.002555137679430497, + "conditional_95": [ + 0.0015641029747572976, + 0.0036431410475218527 + ] + } + }, + "fold_results": [ + { + "heldout_half": 0, + "heldout_rows": 1256, + "incumbent_same_half": 0.7325449010474826, + "matched_control_same_half": 0.7325449010474826, + "crossfit_same_half": 0.7351256285381212, + "step": 1680, + "epochs_started": 16, + "active_seconds": 7.389840035961242, + "training_rows": 54870, + "added_tune_rows": 1256, + "fixed_buffers_exact": true, + "group_counts": { + "43": 36446, + "50": 18424 + }, + "final_lr": 1.0000078679859099e-05 + }, + { + "heldout_half": 1, + "heldout_rows": 1256, + "incumbent_same_half": 0.7298113878884595, + "matched_control_same_half": 0.7298113878884595, + "crossfit_same_half": 0.7327158507790285, + "step": 1680, + "epochs_started": 16, + "active_seconds": 7.374784096988151, + "training_rows": 54870, + "added_tune_rows": 1256, + "fixed_buffers_exact": true, + "group_counts": { + "43": 36446, + "50": 18424 + }, + "final_lr": 1.0000078679859099e-05 + } + ], + "passes_predeclared_fullpool_gate": true, + "fit_only_reproduction_all_head_tensors_bit_exact": true, + "updates_per_arm": 1680, + "published": false, + "fullpool_head_fitted": false, + "candidate_exported": false, + "GPU_used": false, + "limitations": "Earlier Tune checkpoint/architecture selection biases estimates. Fixed label-stratified halves do not enforce protein-family or designed-scaffold independence. OOF predicts with two research heads trained on half the extra labels; it is recipe evidence, not a single final model measurement. Conditional bootstrap omits family dependence and prior selection." + }, + "subcellular_fit_only_selection_evidence": { + "kind": "fit_only_complete_native_tune_replay", + "task": "subcellular_localization", + "before": 0.7538242618285308, + "after": 0.7908217716115261, + "delta": 0.03699750978299532, + "conditional95": [ + 0.024181785841337605, + 0.05052472429740305 + ], + "mean_delta": 0.0033634099802724027, + "conditional_mean95": [ + 0.0021983441673943276, + 0.004593156754309368 + ], + "case_gain": 104, + "examples": 2811, + "matched_controls": { + "full_minus_parent": { + "delta": 0.036997509782995375, + "conditional95": [ + 0.024181785841337605, + 0.05052472429740305 + ] + }, + "full_minus_primary": { + "delta": 0.03948772678762007, + "conditional95": [ + 0.026680896478121666, + 0.05407328352899324 + ] + }, + "full_minus_auxiliary": { + "delta": 0.013162575595873355, + "conditional95": [ + 0.002845962290999644, + 0.022767698327997153 + ] + } + }, + "native_dependency": { + "native_accuracy": 0.7908217716115261, + "normal_replay_bit_exact": true, + "primary_ablated": { + "accuracy": 0.736392742796158, + "accuracy_drop": 0.054429028815368194, + "conditional95_drop": [ + 0.04054606901458555, + 0.06794734969761651 + ], + "prediction_changes": 464 + }, + "auxiliary_ablated": { + "accuracy": 0.5990750622554251, + "accuracy_drop": 0.19174670935610102, + "conditional95_drop": [ + 0.17467093561010316, + 0.20988971896122377 + ], + "prediction_changes": 899 + } + }, + "task_deltas": { + "beta_lactamase": 0.0, + "binary_localization": 0.0, + "fluorescence": 0.0, + "fold": 0.0, + "human_ppi": 0.0, + "ppi_affinity": 0.0, + "secondary_structure": 0.0, + "solubility": 0.0, + "stability": 0.0, + "subcellular_localization": 0.03699750978299532, + "yeast_ppi": 0.0 + }, + "ten_other_prediction_files_byte_exact": true, + "limitations": "Conditional paired-example bootstrap after repeated Tune selection; not corrected for protein-family dependence. Feature removal is a dependence diagnostic, not an in-distribution intervention." + }, + "SS_fusion_fit_only_selection_evidence": { + "kind": "fit_only_complete_native_tune_replay", + "task": "secondary_structure", + "before": 0.7441316787896526, + "after": 0.759638088021676, + "delta": 0.0155064092320234, + "conditional95": [ + 0.014309663742752683, + 0.016726396557557775 + ], + "mean_delta": 0.0014096735665475313, + "conditional_mean95": [ + 0.0013008785220684257, + 0.001520581505232525 + ], + "valid_residues": 556931, + "correct_residue_gain": 8636, + "protein_units": 2170, + "native_dependence": { + "native_accuracy": 0.759638088021676, + "normal_replay_bit_exact": true, + "proteins": 2170, + "valid_residues": 556931, + "primary_ablated": { + "accuracy": 0.6834275700221392, + "accuracy_drop": 0.07621051799953675, + "conditional95_drop": [ + 0.07213367476903872, + 0.08041229260742996 + ], + "changed_valid_residue_predictions": 124744 + }, + "auxiliary_ablated": { + "accuracy": 0.7315897301461043, + "accuracy_drop": 0.02804835787557166, + "conditional95_drop": [ + 0.026594330149706396, + 0.029575409027225635 + ], + "changed_valid_residue_predictions": 57661 + } + }, + "matched_zero_control": 0.7439539188876181, + "full_minus_zero": { + "delta": 0.0156841691340579, + "conditional95": [ + 0.014499037971929394, + 0.01689329854300642 + ] + }, + "ten_other_prediction_files_byte_identical": true, + "retained_subcellular_accuracy": 0.7908217716115261, + "limitations": "Repeated tune selection; conditional intervals do not correct selection or protein-family dependence. Zero auxiliary changes joint LayerNorm input distribution." + }, + "SS_dual_residue_fit_only_selection_evidence": { + "kind": "fit_only_complete_native_tune_replay", + "task": "secondary_structure", + "before": 0.759638088021676, + "after": 0.7674307948381397, + "delta": 0.0077927068164637125, + "conditional95": [ + 0.0069797076175643485, + 0.00868359254180614 + ], + "mean_delta": 0.0007084278924057719, + "conditional_mean95": [ + 0.0006345188743240317, + 0.0007894175038005582 + ], + "correct_residue_gain": 4340, + "valid_residues": 556931, + "protein_units": 2170, + "native_dependence_and_control_comparisons": { + "native_accuracy": 0.7674307948381397, + "normal_replay_bit_exact": true, + "proteins": 2170, + "valid_residues": 556931, + "primary_ablated": { + "accuracy": 0.7548798684217614, + "accuracy_drop": 0.01255092641637833, + "conditional95_drop": [ + 0.011389639190540375, + 0.013723655455911954 + ], + "changed_valid_residue_predictions": 47630 + }, + "auxiliary_ablated": { + "accuracy": 0.6333926464858304, + "accuracy_drop": 0.13403814835230934, + "conditional95_drop": [ + 0.13031405384716288, + 0.13710269901418365 + ], + "changed_valid_residue_predictions": 164881 + }, + "cached_vs_native_valid_argmax_changes": 0, + "comparisons": { + "full_minus_primary": { + "delta": 0.023792893554138664, + "conditional95": [ + 0.02227601983558547, + 0.025405620421006168 + ] + }, + "full_minus_auxiliary": { + "delta": 0.001993065568266087, + "conditional95": [ + 0.0013915113450666237, + 0.00262078806389141 + ] + }, + "full_minus_native_primary": { + "delta": 0.023299116048487157, + "conditional95": [ + 0.021785460201619564, + 0.024879231525420348 + ] + }, + "full_minus_native_auxiliary": { + "delta": 0.002027181105020191, + "conditional95": [ + 0.0014295698320689104, + 0.0026466899667084306 + ] + }, + "full_minus_native_fusion": { + "delta": 0.007792706816463799, + "conditional95": [ + 0.0069797076175643485, + 0.00868359254180614 + ] + } + } + }, + "ten_other_prediction_files_byte_identical": true, + "head_fit_unique_residues": 500000, + "fit_blocks": 12, + "ridge": 0.01, + "limitations": "Feature removal is an out-of-distribution diagnostic. Conditional protein bootstrap does not correct repeated selection or family dependence." + }, + "SS_allfit_publication_review": { + "original_minimum_effect_gate_passed": false, + "retrospective_policy": "/workspace/research/publication-selection-review-20261025.json", + "native_evidence": { + "status": "passed_native_all_readout_and_dependence_gates", + "tasks": { + "secondary_structure": { + "native_accuracy": 0.767856341270283, + "normal_replay_bit_exact": true, + "proteins": 2170, + "valid_residues": 556931, + "primary_ablated": { + "accuracy": 0.75506481054206, + "accuracy_drop": 0.012791530728223066, + "conditional95_drop": [ + 0.011657463875457472, + 0.013965807112484933 + ], + "changed_valid_residue_predictions": 47742 + }, + "auxiliary_ablated": { + "accuracy": 0.6353803253903985, + "accuracy_drop": 0.13247601587988458, + "conditional95_drop": [ + 0.12859561434070454, + 0.13576243044433273 + ], + "changed_valid_residue_predictions": 163028 + }, + "cached_vs_native_valid_argmax_changes": 0, + "comparisons": { + "full_minus_primary": { + "delta": 0.023861124627646873, + "conditional95": [ + 0.022379338837469887, + 0.025445967719600684 + ] + }, + "full_minus_auxiliary": { + "delta": 0.00209900328766041, + "conditional95": [ + 0.0015060823960767902, + 0.002693751613766381 + ] + }, + "full_minus_native_primary": { + "delta": 0.023724662480630456, + "conditional95": [ + 0.022235593476518073, + 0.025308672752640978 + ] + }, + "full_minus_native_auxiliary": { + "delta": 0.002452727537163491, + "conditional95": [ + 0.0018196905898359643, + 0.0030741079436519656 + ] + }, + "full_minus_native_current": { + "delta": 0.0004255464321432996, + "conditional95": [ + 0.000153183526907052, + 0.0007048781132075278 + ] + } + } + } + }, + "model_sha256": "a1f79716243444a342df73ad3bfc06ddf5f19bbe8b5b3fe625de12829c5ec9a4", + "weights_modified": false, + "parameter_updates": 0, + "method": "Replace one local-feature block by its fixed fit mean before the normalized linear readout. Both encoders and prefixes execute; no parameter updates. Recompute publication-review gates from native predictions. The original .0005 minimum-effect hypothesis failed and is preserved; this separately recorded retrospective publication review uses positive native improvement with conditional95lower>0.", + "limitations": "Feature removal is an out-of-distribution diagnostic. Conditional protein bootstrap does not correct repeated selection or family dependence.", + "published": false + }, + "gain": { + "delta": 0.0004255464321432996, + "conditional95": [ + 0.000153183526907052, + 0.0007048781132075278 + ] + }, + "fit_unique_residues": 2221507, + "ten_other_production_files_exact": true + }, + "retired_fold_extra_label_recipe_evidence": { + "kind": "two_fold_added_label_pilot_not_fullpool_model_replay", + "fold_accuracy": 0.26902173913043476, + "parent_fold_accuracy": 0.24864130434782608, + "matched_fit_only_refit_accuracy": 0.23505434782608695, + "fold_delta": 0.020380434782608696, + "conditional_fold_delta95": [ + 0.001358695652173913, + 0.04076086956521739 + ], + "heldout_half_case_gains": [ + 4, + 11 + ], + "other_ten_tasks": "Unchanged parent weights; full production replay must verify byte-identical predictions.", + "limitations": "Prior tune checkpoint/hyperparameter selection biases thisestimate. Halvesarestratifiedbylabel,notproteinfamily. Crossfitestimatestherecipewithhalftheaddedlabels,notafinalfull-poolmodel. Pairedbootstrapisconditionalanddoesnotcorrectalldependence." + }, + "retired_production_fold_head": { + "previous_package": "/workspace/research/production-allfit-ss1/candidate/package", + "previous_Tune_label_count": 736, + "replaced_by": "two fit-only native foldreadouts withfixednormalizedequalmean", + "previous_crossfit_accuracy": 0.26902173913043476, + "current_fit_only_accuracy": 0.33152173913043476 + }, + "fold_fit_only_publication_review": { + "original_auxiliary_control_hypothesis_passed": false, + "retrospective_policy": "/workspace/research/publication-selection-review-20261025.json", + "native_shared_parameter_sensitivity": { + "status": "passed_native_label_free_shared_parameter_sensitivity", + "labels_used": false, + "examples": 736, + "normal_replay_bit_exact": true, + "cached_native_class_changes": 0, + "native_interventions": { + "primary_fitmean_features": { + "class_change_fraction": 0.9008152173913043, + "changed_examples": 663, + "mean_probability_L1": 0.8340545014675982 + }, + "zero_shared_primary_final_normalization": { + "class_change_fraction": 0.5040760869565217, + "changed_examples": 371, + "mean_probability_L1": 0.6933331481662077, + "learned_parameter_names": [ + "encoder.norm.weight", + "encoder.norm.bias" + ], + "parameters_restored_exactly": true + } + }, + "cached_feature_interventions": { + "status": "passed_cached_stage", + "primary_mean_replacement_class_change_fraction": 0.9008152173913043, + "primary_fixed_permutation_class_change_fraction": 0.6453804347826086, + "primary_logit_norm_fraction": 0.5, + "permutation_seed": 20270222, + "labels_used": false + }, + "primary_common_encoder_parameters": 37845535, + "primary_encoder_active_in_all_eleven_tasks": true, + "model_sha256": "19088470dfe6d5940dcf1589c40a693dcbbf81342320a0551e4bc3612077fb6d", + "exported_weights_modified": false, + "fitting_updates": 0, + "publication_policy_review_is_retrospective": true, + "original_quality_control_gate_still_failed": true, + "limitations": "Sensitivity establishes prediction dependence, not an accuracy benefit or in-distribution intervention. Previously observed Tune quality supplies separate conditional selection evidence." + }, + "gain_vs_previous_fit_only": { + "delta": 0.08288043478260869, + "conditional95": [ + 0.05570652173913043, + 0.11141304347826086 + ] + }, + "full_accuracy": 0.33152173913043476, + "auxiliary_accuracy": 0.34375, + "raw_mean_accuracy": 0.31657608695652173, + "ten_other_production_files_exact": true, + "primary_encoder_common_parameters": 37845535, + "limitations": "Retrospectivepublicationpolicy; originalfailedhypothesisunchanged. ConditionalTuneintervals ignoreselection/familydependence; sensitivitydoesnotimplyaccuracybenefit." + } + }, + "features": { + "primary": "/workspace/research/conditioned-readout-refit1/features-summary/fold", + "auxiliary": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold" + }, + "recipe": "Exactpositivelycrossvalidatedwarmstartfunctionpreservingnormalization;inverse-sqrtclassweightedCEridge1e-4/15LBFGSblocksforeachofbothreadouts; nowfitplusall736Tune. Bothencoders/otherheadsunchanged. No furtherselectiononfullpoolTunescore.", + "parameters": 145755212, + "frozen_sha256": { + "/workspace/research/fit_fullpool_dual_fold.py": "de1f81bae675c6d28718067e284e431840ff1a73688a58c3390daf75cbfe7ba6", + "/workspace/research/assemble_fullpool_dual_fold.py": "a5a414685fabb7042eb3b509a7c52adfb1adb48a82141ed0be32a8274604b347", + "/workspace/research/run_fullpool_dual_fold.py": "82719db7cead31889b215b481cca5654be05a0249960cb6cf0f5f2222fd78b36", + "/workspace/research/check_fullpool_fold_shared_native.py": "7c0913f1fb07c9de02b3e5777208aae0e3eea3d20bf666ba0cbff6e782707508", + "/workspace/research/fit_fold_dual_crossfit.py": "10b48b2b4177858d4c84a1c402f4215dcf429dba8fa7dfc608e985c2a6ebeed9", + "/workspace/research/fit_dual_residue_readouts.py": "a55238416ea2052f98e5cf00a2707c3b568183af1972e98e3a7cc43b8f9073fe", + "/workspace/research/run_pair_residue_study.py": "756ba8daae98d29beeb535d4647adaedfe71b3e07ef0d38aa3149f79d407f54b", + "/workspace/research/check_shared_adapters_cpu.py": "db7d8d846b90929decad5865de36dd55fb95139aaa116b6ae2987cd96786c990", + "/workspace/research/publication-selection-review-20261025.json": "1d7d663e9a56121d45c70fcad93d80f2f03a9cbbd07fdf94546be774ba67f170", + "/workspace/research/production-dual-fold-fullpool1/code/gpu_slot.py": "5e05607e4b0435be232a52b05cc392151d8a81bfbb908cf1ef3d4360786b0a0a", + "/workspace/research/crossfit-dual-fold-labels1/plan.json": "8d737ee751a8e7b55c178448378f8ff480b7fed80128f531387f048c146861a5", + "/workspace/research/crossfit-dual-fold-labels1/outcome.json": "7f87de8a629bb70205fc04ec3afac5a9fbfed5c46c063a9d0b75630bde1d6d35", + "/workspace/research/crossfit-dual-fold-labels1/decision.json": "6a6ce8ee723559ad9559275a06d9ddc0ebe1cdb052ce6cb6e57accb11e181cdd", + "/workspace/research/crossfit-dual-fold-labels1/CUDA-checks.json": "0f69e6302fdf5c87d0e3383be5608479073ac76dd1df6291a1c014aa5b9f69c3", + "/workspace/research/fold-shared-publication-review1/candidate/package/model.pt": "19088470dfe6d5940dcf1589c40a693dcbbf81342320a0551e4bc3612077fb6d", + "/workspace/research/production-fold-shared1/candidate/package/model.pt": "93a8fa2aadcb92983cefa53154866e9efc47a21deea0d847042c1f836883b513", + "/workspace/research/production-fold-shared1/candidate/package/config.json": "c0d1e24fea3f93877d6815607918ab67c4f4d79ca213d9f507c4ee31775bd705", + "/workspace/research/conditioned-readout-refit1/features-summary/fold/fit.pt": "c52e3b4ba2460481d23a345128373725fd41dd6d9c3934b9c032ff134fd6d6f4", + "/workspace/research/conditioned-readout-refit1/features-summary/fold/tune.pt": "7e0bc2c0d63b6673d3dcbbb6f7d15a0251c061742ed6bd949d640ad6fcd82296", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold/fit.pt": "bfc7f3dfc5de857965d83c2dabdc2496a17f1937299fdc1c6384dff74bdfc9ac", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold/tune.pt": "ab948028b9be27d990a0a83b6e6e92384fc19667bc6f87e6777368c9aac2b9da" + }, + "recovery_command": [ + "/opt/conda/bin/python", + "-u", + "/workspace/research/run_fullpool_dual_fold.py", + "--run", + "/workspace/research/production-dual-fold-fullpool1" + ], + "publication": "Aftercompleteall11native+tenunchangedfiles+label-freeprimaryparameterdependence; manualrecordedreviewthenatomicmandatorypublisher. Fit-onlyreferenceunchanged." + }, + "fullpool_readout_training": { + "status": "completed_fixed_fullpool_readouts", + "fit_rows": 12312, + "added_Tune_rows": 736, + "branches": { + "primary": { + "blocks": 15, + "active_seconds": 1.5581168120261282, + "training_rows": 13048, + "LBFGS_iterations": 150, + "closures": 177, + "initial_function_max_logit_error": 7.2479248046875e-05 + }, + "auxiliary": { + "blocks": 15, + "active_seconds": 1.9283095080172643, + "training_rows": 13048, + "LBFGS_iterations": 150, + "closures": 171, + "initial_function_max_logit_error": 0.0001163482666015625 + } + }, + "label_free_sensitivity": { + "primary_mean_replacement_class_change_fraction": 0.6589673913043478, + "primary_fixed_permutation_class_change_fraction": 0.36684782608695654, + "primary_logit_norm_fraction": 0.5, + "permutation_seed": 20270227, + "labels_used": false, + "status": "passed_cached_stage" + }, + "parameters_fitted_only_in_fold_readouts": true, + "in_sample_Tune_fold_score_excluded_from_selection": true, + "quality_evidence": "/workspace/research/crossfit-dual-fold-labels1/decision.json", + "all_other_model_tensors_unmodified": true, + "exported": false, + "published": false + }, + "crossfit_quality_evidence": { + "status": "eligible_for_manual_fullpool_recipe_review", + "eligible": true, + "OOF_accuracy": 0.3736413043478261, + "incumbent_accuracy": 0.33152173913043476, + "matched_control_accuracy": 0.33152173913043476, + "comparisons": { + "OOF_minus_incumbent": { + "delta": 0.042119565217391304, + "conditional95": [ + 0.02309782608695652, + 0.06117527173913025 + ] + }, + "OOF_minus_matched_control": { + "delta": 0.042119565217391304, + "conditional95": [ + 0.024456521739130436, + 0.06114130434782609 + ] + } + }, + "arms": [ + { + "arm": "fit-only-control", + "heldout_rows": 736, + "added_tune_rows": 0, + "accuracy": 0.33152173913043476, + "incumbent_accuracy": 0.33152173913043476, + "branches": { + "primary": { + "blocks": 15, + "active_seconds": 1.493866186006926, + "training_rows": 12312, + "LBFGS_iterations": 150, + "closures": 173, + "initial_function_max_logit_error": 0.0001049041748046875 + }, + "auxiliary": { + "blocks": 15, + "active_seconds": 1.9239742969803046, + "training_rows": 12312, + "LBFGS_iterations": 150, + "closures": 174, + "initial_function_max_logit_error": 0.0 + } + }, + "sensitivity": { + "primary_fitmean_class_change_fraction": 0.7703804347826086, + "primary_permutation_class_change_fraction": 0.7133152173913043, + "labels_used": false + } + }, + { + "arm": "heldout-0", + "heldout_rows": 371, + "added_tune_rows": 365, + "accuracy": 0.40161725067385445, + "incumbent_accuracy": 0.33692722371967654, + "branches": { + "primary": { + "blocks": 15, + "active_seconds": 1.4214324810891412, + "training_rows": 12677, + "LBFGS_iterations": 150, + "closures": 177, + "initial_function_max_logit_error": 8.392333984375e-05 + }, + "auxiliary": { + "blocks": 15, + "active_seconds": 1.928408305044286, + "training_rows": 12677, + "LBFGS_iterations": 150, + "closures": 174, + "initial_function_max_logit_error": 0.0001125335693359375 + } + }, + "sensitivity": { + "primary_fitmean_class_change_fraction": 0.77088948787062, + "primary_permutation_class_change_fraction": 0.660377358490566, + "labels_used": false + } + }, + { + "arm": "heldout-1", + "heldout_rows": 365, + "added_tune_rows": 371, + "accuracy": 0.3452054794520548, + "incumbent_accuracy": 0.32602739726027397, + "branches": { + "primary": { + "blocks": 15, + "active_seconds": 1.4144776619796176, + "training_rows": 12683, + "LBFGS_iterations": 150, + "closures": 177, + "initial_function_max_logit_error": 7.2479248046875e-05 + }, + "auxiliary": { + "blocks": 15, + "active_seconds": 1.9321627549652476, + "training_rows": 12683, + "LBFGS_iterations": 150, + "closures": 174, + "initial_function_max_logit_error": 9.918212890625e-05 + } + }, + "sensitivity": { + "primary_fitmean_class_change_fraction": 0.7917808219178082, + "primary_permutation_class_change_fraction": 0.6794520547945205, + "labels_used": false + } + } + ], + "fullpool_head_fitted": false, + "exported": false, + "published": false, + "limitations": "OOF estimates adding half the Tune labels, not fullpool replay. Existing representations and previous selection used Tune. Conditional paired-example intervals ignore family dependence. Mean/permutation sensitivity is out of distribution." + }, + "all_non_fold_tensors_exact": true, + "head_training": "Only primary and auxiliary fold readouts continued from own-session fit-only states; same fixed inverse-sqrtweightedCE/ridge1e-4/15LBFGSblocks with function-preserving normalization transfer. Both encoders and all other heads frozen." + }, + "auxiliary_fit_only_readout_source": "/workspace/research/scale85m-8h-rank3/candidate/package", + "auxiliary_sha256": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "solubility_mean_plan": { + "created_utc": "2026-10-25T18:17:08.060403+00:00", + "status": "queued", + "recovery_registered": true, + "run": "/workspace/research/solubility-fixed-mean1", + "packages": { + "primary": "/workspace/research/fold-shared-publication-review1/candidate/package", + "auxiliary": "/workspace/research/scale85m-8h-rank3/candidate/package" + }, + "features": { + "primary": "/workspace/research/conditioned-readout-refit1/features-summary/solubility/tune.pt", + "auxiliary": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/solubility/tune.pt" + }, + "predictions": { + "primary": "/workspace/research/fold-shared-publication-review1/candidate/replay/predictions/solubility.jsonl", + "auxiliary": "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/solubility.jsonl" + }, + "frozen_sha256": { + "/workspace/research/solubility-fixed-mean1/PROPOSAL.md": "400a1aa94d8899c8e4dfa735eced1a63ae9eb47ce626a647d6db30f67d979048", + "/workspace/research/review_solubility_mean.py": "61f9c3d4f0f7059adc582b4967c91a182a026c74215b49a74b6c4cf4ecb0b58e", + "/workspace/research/fit_dual_residue_readouts.py": "a55238416ea2052f98e5cf00a2707c3b568183af1972e98e3a7cc43b8f9073fe", + "/workspace/research/dual-summary-feature-checks.json": "c0f3988785747df6360d12eb7d1cfba267f5f80679868fd6f710bde1f803a25f", + "/workspace/research/conditioned-readout-refit1/features-summary/solubility/tune.pt": "0a253bbe46f86be5e220bda28ba3489b548b2f76a7f082fe8df79be0f5fdd353", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/solubility/tune.pt": "e7e4271fc8a028b83b43a5fbc73463ddf7a7c089013c092b4323c1f294b0772d", + "/workspace/research/fold-shared-publication-review1/candidate/replay/predictions/solubility.jsonl": "000113a9e356601d942cfa093b9dfebeb3d962e6cce34c9e379bb15e3105cba9", + "/workspace/research/scale85m-8h-rank3/candidate/replay/predictions/solubility.jsonl": "2a4dbf782bd2195240fcffa6bf47f850564f573bb2314a4cf44618b2f1620a27", + "/workspace/research/fold-shared-publication-review1/candidate/package/model.pt": "19088470dfe6d5940dcf1589c40a693dcbbf81342320a0551e4bc3612077fb6d", + "/workspace/research/fold-shared-publication-review1/candidate/package/config.json": "c0d1e24fea3f93877d6815607918ab67c4f4d79ca213d9f507c4ee31775bd705", + "/workspace/research/scale85m-8h-rank3/candidate/package/model.pt": "e601068c8d9b9a81934404866cea95d69950eb161fe8be0c6dec04bbca36d7db", + "/workspace/research/scale85m-8h-rank3/candidate/package/config.json": "96b66062420d075cb8810e95cbcce76fd316c60191edf4e413f6bf21b594a7c1" + }, + "recovery_command": [ + "env", + "CUDA_VISIBLE_DEVICES=", + "OMP_NUM_THREADS=4", + "MKL_NUM_THREADS=4", + "OPENBLAS_NUM_THREADS=1", + "/opt/conda/bin/python", + "-u", + "/workspace/research/review_solubility_mean.py", + "--run", + "/workspace/research/solubility-fixed-mean1" + ] + }, + "solubility_mean_result": { + "status": "eligible_for_native_architecture_review", + "eligible": true, + "accuracies": { + "primary": 0.7533851915874388, + "auxiliary": 0.7503601267646212, + "full": 0.7620282339383463 + }, + "comparisons": { + "full_minus_primary": { + "delta": 0.00864304235090752, + "conditional95": [ + 0.0023048112935753384, + 0.0149812734082397 + ] + }, + "full_minus_auxiliary": { + "delta": 0.011668107173725151, + "conditional95": [ + 0.004897723998847595, + 0.017862287525208874 + ] + } + }, + "label_free_sensitivity": { + "primary_fitmean_mean_probability_L1": 0.2038029432296753, + "primary_fitmean_class_change_fraction": 0.1571593200806684, + "primary_permutation_class_change_fraction": 0.24603860558916738, + "primary_centered_logit_norm_fraction": 0.502633273601532, + "labels_used": false, + "permutation_seed": 20270304 + }, + "source_cached_native_checks": { + "primary": { + "native_argmax_exact": true, + "maximum_probability_difference": 2.980232238769531e-07 + }, + "auxiliary": { + "native_argmax_exact": true, + "maximum_probability_difference": 5.364418029785156e-07 + } + }, + "new_training_updates": 0, + "exported": false, + "published": false, + "limitations": "One fixed equalrawlogitmean; no weightsearch. Conditional paired-example intervals ignore repeatedTune selection andfamilydependence. Mean/permutationinterventionsoutofdistribution. Nativeall11 andunlabeledcommonparameterprobabilitysensitivityrequired beforepublication." + }, + "all_non_solubility_paths_exact": true, + "one_auxiliary_encoder": true, + "new_training_updates": 0, + "method": "Concatenate source normalization buffers, concatenate half of each native solubility weight matrix, average biases; one normalized linear readout realizes exactly equal native logit mean. Only one auxiliary pool row is added; inference code unchanged." + }, + "source_of_new_weights": "Fresh random seed20270329 and FP64 LBFGS on permitted fit+allTune affinity residuals; convex optimum independently checked.", + "rows_used": { + "fit": 2421, + "tune": 203 + }, + "normalization": "Length feature moments use fit+allTune; affinity regression scale retains original fit mean/std.", + "old_model_parameters_unchanged": true, + "new_parameters": 3, + "OOF_evidence": "/workspace/research/crossfit-affinity-length1/outcome.json", + "lookup_or_feature_caches_exported": false, + "in_sample_scores_excluded_from_selection": true + }, + "method": "One bounded scalar learned from FIT-only two-half readout crossvalidation; existing fold heads and all other parameters retained exactly.", + "pilot_plan": { + "utc": "2026-10-26T02:35:55.270604+00:00", + "status": "queued_CPU", + "parent_package": "/workspace/research/affinity-length-residual1/candidate/package", + "parent_model_sha256": "0f0dc93a68cc0b047867d6689d4f974f7dfa65f9d8809ffa1dbbf438e5cc9008", + "old_fold_pilot": "/workspace/research/crossfit-dual-fold-labels1", + "features": { + "primary": "/workspace/research/conditioned-readout-refit1/features-summary/fold", + "auxiliary": "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold" + }, + "split_seed": 20270417, + "head_seed": 20270418, + "head_recipe": "Two classbalanced FIT halves. Fresh readout perbranch/half, training-half moments floor1e-5, inverse-rootCE/ridge1e-4/15blocks max10LBFGS/strongWolfe/history30/gradtol1e-6. No nativehead warmstart. AllFITrows receive OOF logits, including singletonclasses missing in their head-training half.", + "calibration_recipe": "Normalize each branch logits by existing centeredRMS; one global primaryalpha in[1/3,2/3] minimizes unweighted FIT-OOF CE+.01*(alpha-.5)^2/2, FP64 bounded convex solve, exportFP32. Encoders alreadytrained onFIT; this is conditional readoutcrossvalidation only. NoTune labels enteralpha.", + "quality_gate": "Single learnedalpha versus fixed.5, no grid. Independentfit-onlyTune requires positivepaired95foldgain andsharedprimaryconformance beforedevelopmentexport. Production separatelyrequires positivepaired95 vsoldOOF275/736, bothhalfpointgains, sharedprimaryconformance; sameFIT-onlyalpha, noextra fitting onTune. Nativeall11/tenotherbyteexact beforepublication.", + "limits": "Frozenencoders saw allFITlabels; calibrationcrossvalidation onlyholds labelsout from temporaryreadouts. DifferentFIT-half training size and many rareclasses maymiscalibratefull-data heads. RepeatedTunechoices/familydependence remain. ResearchOOFheads neverexported.", + "frozen_sha256": { + "/run-state/workspace/research/fold_blend_calibration.py": "31abf968835efcb376d2309aa39d3cc72d201dbf8f5d3ef2d8a584764d5731c0", + "/workspace/research/fit_fold_dual_crossfit.py": "10b48b2b4177858d4c84a1c402f4215dcf429dba8fa7dfc608e985c2a6ebeed9", + "/workspace/research/fit_dual_residue_readouts.py": "a55238416ea2052f98e5cf00a2707c3b568183af1972e98e3a7cc43b8f9073fe", + "/workspace/research/auxiliary_refresh_production_common.py": "41f368fb0a3255578920254f6ab66c23b39cc1105fd18628f3886bdd1812bce5", + "/workspace/research/fold-blend-calibration1/CPU-checks.json": "5341c9c353bc1ceb08bc793987b857b0513188c3e809b4e3c3b02c22dc497fef", + "/workspace/research/crossfit-dual-fold-labels1/research-predictions.pt": "9547fcbf6b1d41876df7ce7479ef523060faa33e46bcaffe352ac8f8d37189c3", + "/workspace/research/affinity-length-residual1/candidate/package/model.pt": "0f0dc93a68cc0b047867d6689d4f974f7dfa65f9d8809ffa1dbbf438e5cc9008", + "/workspace/research/affinity-length-residual1/candidate/package/config.json": "94c311134ce12d8268e5ad0117baee82596fd8a01b9bdb9c9bff4747dc5418d9", + "/workspace/research/affinity-length-residual1/candidate/replay/predictions/fold.jsonl": "d466ab551a58003a32a0ea2aa5caa6e2a355af96d23d0f4657d3dbd5dec8ee4e", + "/workspace/research/conditioned-readout-refit1/features-summary/fold/fit.pt": "c52e3b4ba2460481d23a345128373725fd41dd6d9c3934b9c032ff134fd6d6f4", + "/workspace/research/conditioned-readout-refit1/features-summary/fold/tune.pt": "7e0bc2c0d63b6673d3dcbbb6f7d15a0251c061742ed6bd949d640ad6fcd82296", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold/fit.pt": "bfc7f3dfc5de857965d83c2dabdc2496a17f1937299fdc1c6384dff74bdfc9ac", + "/workspace/research/scale85m-continue4h-compiled1-at14400-joint8486-readout-review/features-summary/fold/tune.pt": "ab948028b9be27d990a0a83b6e6e92384fc19667bc6f87e6777368c9aac2b9da", + "/workspace/research/crossfit-dual-fold-labels1/heldout-0-primary/head.pt": "049652eab4f2d721d5f664857439e133602ddbf5f1c7ab51aa0aba78951e2c8f", + "/workspace/research/crossfit-dual-fold-labels1/heldout-0-auxiliary/head.pt": "a39f5525bbe5e4241f85dcc83498d232ded65cd6b012423c9135bd2b89d79396", + "/workspace/research/crossfit-dual-fold-labels1/heldout-1-primary/head.pt": "5576a41b512edf374407ba1c9f78cd5f722eb9981ad21b95d1148c2e2cf41862", + "/workspace/research/crossfit-dual-fold-labels1/heldout-1-auxiliary/head.pt": "0e51c9138d60edb1bac98fcbc524dd84589a5ed1ae95134c4a27d2dd79655adf" + }, + "GPU_used": false, + "quality_updates": 0, + "automatic_publication": false, + "queue_decision": { + "utc": "2026-10-26T02:36:09.967927+00:00", + "reason": "Analytic scalarobjective/gradient/Hessian and actualwidth3plus1vs4 readoutresume passed; fixed recipe and both development/productionOOF gates frozen. CPU-only, mainMLM uninterrupted.", + "CPU_threads": 4, + "GPU": false + } + }, + "pilot_results": { + "status": "complete_calibration_quality_review_pending", + "calibration": { + "primary_alpha_FP64": 0.3333333333333333, + "export_alpha_FP32": 0.3333333432674408, + "objective_at_equal": [ + 1.6003692461763912, + 0.7014380237944748, + 1.5587358448608297 + ], + "objective_at_optimum": [ + 1.504147971867554, + 0.45872725047152185, + 1.360423020545405 + ], + "FIT_rows": 12312, + "Tune_labels_used_for_fitting": false + }, + "development": { + "before": 0.33152173913043476, + "after": 0.34375, + "delta": 0.012228260869565218, + "conditional95": [ + 0.0, + 0.024456521739130436 + ] + }, + "production_OOF": { + "before": 0.3736413043478261, + "after": 0.389945652173913, + "delta": 0.016304347826086956, + "conditional95": [ + 0.002717391304347826, + 0.029891304347826088 + ] + }, + "production_halves": [ + { + "before": 0.40161725067385445, + "after": 0.40970350404312667, + "delta": 0.008086253369272238, + "conditional95": [ + -0.01078167115902965, + 0.029649595687331536 + ] + }, + { + "before": 0.3452054794520548, + "after": 0.3698630136986301, + "delta": 0.024657534246575342, + "conditional95": [ + 0.005479452054794521, + 0.043835616438356165 + ] + } + ], + "development_statistical_gate": false, + "production_statistical_gate": true, + "shared_primary_conformance_and_native_replay_pending_if_positive": true, + "limits": "Frozenencoders saw allFITlabels; calibrationcrossvalidation onlyholds labelsout from temporaryreadouts. DifferentFIT-half training size and many rareclasses maymiscalibratefull-data heads. RepeatedTunechoices/familydependence remain. ResearchOOFheads neverexported.", + "exported": false, + "published": false + }, + "primary_alpha_FP32": 0.3333333432674408, + "old_parameter_tensors_retained_exact": 532, + "new_learned_parameters": 1, + "temporary_crossfit_heads_not_exported": true, + "additional_Tune_fitting_for_scalar": false, + "failed_training_input_conformance_and_separate_unlabeled_followup": { + "utc": "2026-10-26T02:46:41.154845+00:00", + "status": "separate_unlabeled_conformance_followup_before_new_predictions", + "prior_failure": "/workspace/research/production-fold-blend1-assembly-v1-failed/failure.json", + "prior_failure_remains_failed": true, + "weights_and_learned_alpha_unchanged": true, + "quality_selection_evidence_unchanged": "FIT-only learnedalpha; productionOOF275to287,positivepaired95andbothhalvespositive;developmentgatefailedunchanged.", + "reason": "Fullpoolheads useallTune labels and theirtraining-class agreement is saturated. OOFfeaturedependence passed, but finalfullpoolinput-class checks failed. Test actual frozenfullpoolmodel on previously fixed unlabeled sample to assess commonparameterdependence on inputsnotusedas supervisedlabels. This adds a new conformance distribution after a failed check; doesnot retroactively pass originalcriterion.", + "unlabeled_inputs": "/workspace/research/production-dual-fold-fullpool1/unlabeled-audit-inputs.jsonl", + "unlabeled_inputs_sha256": "d16c4bbe8d7feb87070a2aedacffc6cb30b719cb13bac13989f42c8ad2e7febe", + "rows": 1024, + "fixed_thresholds": { + "native_primary_training_mean_class_change_min": 0.1, + "native_primary_permutation_class_change_min": 0.15, + "native_shared_norm_zero_class_change_min": 0.1, + "native_shared_norm_zero_probability_L1_min": 0.1, + "primary_weighted_logit_RMS_fraction_min": 0.25 + }, + "permutation_seed": 20270227, + "sample_or_coefficient_search": false, + "limits": "Unlabeledsampleisnotfoldtestdistribution. Outofdistributioninterventionsestablishdependence,notaccuracybenefit. Priortraining-inputfailure andretrospectivefollowupchoice mustbedisclosed." + }, + "independent_native_verification": { + "all11_valid": true, + "ten_other_files_exact": [ + "beta_lactamase", + "binary_localization", + "fluorescence", + "human_ppi", + "ppi_affinity", + "secondary_structure", + "solubility", + "stability", + "subcellular_localization", + "yeast_ppi" + ], + "common_primary_native_checks": { + "status": "passed_native_common_primary_dependence", + "native_Tune_predictions_bit_exact": true, + "native_cached_fold_classes_exact": true, + "native_training_mean_intervention": { + "class_change_fraction": 0.08016304347826086, + "mean_probability_L1": 0.7129052172857414 + }, + "fixed1024_unlabeled_shared_norm_zero": { + "class_change_fraction": 0.4931640625, + "mean_probability_L1": 0.4397785993781522 + }, + "fixed1024_unlabeled_training_mean": { + "class_change_fraction": 0.623046875, + "mean_probability_L1": 0.3721115595105666 + }, + "fixed1024_unlabeled_primary_permutation": { + "class_change_fraction": 0.5595703125, + "mean_probability_L1": 0.38590037528734855 + }, + "unlabeled_primary_weighted_logit_RMS_fraction": 0.3333333730697632, + "cached_primary_dependence": { + "OOF-half0": { + "primary_training_mean_class_change": 0.4716981132075472, + "primary_permutation_class_change": 0.41778975741239893, + "primary_weighted_logit_RMS_fraction": 0.3333333730697632, + "labels_used": false, + "passed": true + }, + "OOF-half1": { + "primary_training_mean_class_change": 0.5095890410958904, + "primary_permutation_class_change": 0.39452054794520547, + "primary_weighted_logit_RMS_fraction": 0.3333333432674408, + "labels_used": false, + "passed": true + }, + "fullpool": { + "primary_training_mean_class_change": 0.08016304347826086, + "primary_permutation_class_change": 0.019021739130434784, + "primary_weighted_logit_RMS_fraction": 0.33333340287208557, + "labels_used": false, + "passed": false + } + }, + "common_primary_parameters": 37845535, + "original_fullpool_training_input_conformance_failed_and_preserved": true, + "separate_unlabeled_followup_policy": { + "utc": "2026-10-26T02:46:41.154845+00:00", + "status": "separate_unlabeled_conformance_followup_before_new_predictions", + "prior_failure": "/workspace/research/production-fold-blend1-assembly-v1-failed/failure.json", + "prior_failure_remains_failed": true, + "weights_and_learned_alpha_unchanged": true, + "quality_selection_evidence_unchanged": "FIT-only learnedalpha; productionOOF275to287,positivepaired95andbothhalvespositive;developmentgatefailedunchanged.", + "reason": "Fullpoolheads useallTune labels and theirtraining-class agreement is saturated. OOFfeaturedependence passed, but finalfullpoolinput-class checks failed. Test actual frozenfullpoolmodel on previously fixed unlabeled sample to assess commonparameterdependence on inputsnotusedas supervisedlabels. This adds a new conformance distribution after a failed check; doesnot retroactively pass originalcriterion.", + "unlabeled_inputs": "/workspace/research/production-dual-fold-fullpool1/unlabeled-audit-inputs.jsonl", + "unlabeled_inputs_sha256": "d16c4bbe8d7feb87070a2aedacffc6cb30b719cb13bac13989f42c8ad2e7febe", + "rows": 1024, + "fixed_thresholds": { + "native_primary_training_mean_class_change_min": 0.1, + "native_primary_permutation_class_change_min": 0.15, + "native_shared_norm_zero_class_change_min": 0.1, + "native_shared_norm_zero_probability_L1_min": 0.1, + "primary_weighted_logit_RMS_fraction_min": 0.25 + }, + "permutation_seed": 20270227, + "sample_or_coefficient_search": false, + "limits": "Unlabeledsampleisnotfoldtestdistribution. Outofdistributioninterventionsestablishdependence,notaccuracybenefit. Priortraining-inputfailure andretrospectivefollowupchoice mustbedisclosed." + }, + "old_parameters_restored_exactly": true, + "saved_weights_unchanged": true, + "optimizer_updates": 0, + "labels_used": false, + "thresholds": { + "primary_training_mean_class_change_min": 0.1, + "primary_permutation_min": 0.15, + "primary_weighted_logit_RMS_fraction_min": 0.25, + "unlabeled_shared_norm_class_change_min": 0.1, + "unlabeled_shared_norm_probability_L1_min": 0.1 + }, + "limits": "Out-of-distribution sensitivity establishes common-parameter use, not an accuracy benefit. The fixed unlabeled sample was already used for the parent publication; no resampling." + } + } +} diff --git a/shared/package-files/33/33f2185d264f69b410265dd2c179990b08eee2f7b320795c353f4ea910ce438c/blob b/shared/package-files/33/33f2185d264f69b410265dd2c179990b08eee2f7b320795c353f4ea910ce438c/blob new file mode 100644 index 0000000000000000000000000000000000000000..e205f06ace3893dd7a0a15cf4e0e77f9ec118e63 --- /dev/null +++ b/shared/package-files/33/33f2185d264f69b410265dd2c179990b08eee2f7b320795c353f4ea910ce438c/blob @@ -0,0 +1,38 @@ +import io +import os.path + +from IPython.utils import openpy + +mydir = os.path.dirname(__file__) +nonascii_path = os.path.join(mydir, "../../core/tests/nonascii.py") + + +def test_detect_encoding(): + with open(nonascii_path, "rb") as f: + enc, lines = openpy.detect_encoding(f.readline) + assert enc == "iso-8859-5" + + +def test_read_file(): + with io.open(nonascii_path, encoding="iso-8859-5") as f: + read_specified_enc = f.read() + read_detected_enc = openpy.read_py_file(nonascii_path, skip_encoding_cookie=False) + assert read_detected_enc == read_specified_enc + assert "coding: iso-8859-5" in read_detected_enc + + read_strip_enc_cookie = openpy.read_py_file( + nonascii_path, skip_encoding_cookie=True + ) + assert "coding: iso-8859-5" not in read_strip_enc_cookie + + +def test_source_to_unicode(): + with io.open(nonascii_path, "rb") as f: + source_bytes = f.read() + assert ( + openpy.source_to_unicode(source_bytes, skip_encoding_cookie=False).splitlines() + == source_bytes.decode("iso-8859-5").splitlines() + ) + + source_no_cookie = openpy.source_to_unicode(source_bytes, skip_encoding_cookie=True) + assert "coding: iso-8859-5" not in source_no_cookie diff --git a/shared/package-files/33/33f2c0b6e16357e083c3a98877e7317abe1578a44c288e5979c9d96fb5aa6727/blob b/shared/package-files/33/33f2c0b6e16357e083c3a98877e7317abe1578a44c288e5979c9d96fb5aa6727/blob new file mode 100644 index 0000000000000000000000000000000000000000..762550cf73dc0b627612465e63f0368d06847ae1 --- /dev/null +++ b/shared/package-files/33/33f2c0b6e16357e083c3a98877e7317abe1578a44c288e5979c9d96fb5aa6727/blob @@ -0,0 +1,53 @@ +""" +Optional fixer to transform set() calls to set literals. +""" + +# Author: Benjamin Peterson + +from lib2to3 import fixer_base, pytree +from lib2to3.fixer_util import token, syms + + + +class FixSetLiteral(fixer_base.BaseFix): + + BM_compatible = True + explicit = True + + PATTERN = """power< 'set' trailer< '(' + (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > + | + single=any) ']' > + | + atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > + ) + ')' > > + """ + + def transform(self, node, results): + single = results.get("single") + if single: + # Make a fake listmaker + fake = pytree.Node(syms.listmaker, [single.clone()]) + single.replace(fake) + items = fake + else: + items = results["items"] + + # Build the contents of the literal + literal = [pytree.Leaf(token.LBRACE, "{")] + literal.extend(n.clone() for n in items.children) + literal.append(pytree.Leaf(token.RBRACE, "}")) + # Set the prefix of the right brace to that of the ')' or ']' + literal[-1].prefix = items.next_sibling.prefix + maker = pytree.Node(syms.dictsetmaker, literal) + maker.prefix = node.prefix + + # If the original was a one tuple, we need to remove the extra comma. + if len(maker.children) == 4: + n = maker.children[2] + n.remove() + maker.children[-1].prefix = n.prefix + + # Finally, replace the set call with our shiny new literal. + return maker diff --git a/shared/package-files/33/33f307d4f57bc0df4b2e5a3080cd5efa60e7c5e3e28648eda492a2f4b7a0709c/model.pt b/shared/package-files/33/33f307d4f57bc0df4b2e5a3080cd5efa60e7c5e3e28648eda492a2f4b7a0709c/model.pt new file mode 100644 index 0000000000000000000000000000000000000000..97ecd94557b84afa85aa5fe134dd08bcec9b8c34 --- /dev/null +++ b/shared/package-files/33/33f307d4f57bc0df4b2e5a3080cd5efa60e7c5e3e28648eda492a2f4b7a0709c/model.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33f307d4f57bc0df4b2e5a3080cd5efa60e7c5e3e28648eda492a2f4b7a0709c +size 102743639 diff --git a/shared/package-files/33/33f4c177ed378fedd873d2b0846128053c1227158ed653c11bb9ddb2dd7a3c6a/blob b/shared/package-files/33/33f4c177ed378fedd873d2b0846128053c1227158ed653c11bb9ddb2dd7a3c6a/blob new file mode 100644 index 0000000000000000000000000000000000000000..69f0faad1e7247882721bb81a7242ddd4b1d269f Binary files /dev/null and b/shared/package-files/33/33f4c177ed378fedd873d2b0846128053c1227158ed653c11bb9ddb2dd7a3c6a/blob differ diff --git a/shared/package-files/33/33f541d42514a67b8cda24709d798b2756eaf1efe884b11edac1d9d5f0dcdcec/blob b/shared/package-files/33/33f541d42514a67b8cda24709d798b2756eaf1efe884b11edac1d9d5f0dcdcec/blob new file mode 100644 index 0000000000000000000000000000000000000000..66c9b456f18adc6824333e46f8dbc3e3f806221e --- /dev/null +++ b/shared/package-files/33/33f541d42514a67b8cda24709d798b2756eaf1efe884b11edac1d9d5f0dcdcec/blob @@ -0,0 +1,382 @@ +import numpy as np +import pytest + +import pandas as pd +from pandas import ( + DataFrame, + DatetimeIndex, + Index, + Period, + PeriodIndex, + Series, + Timedelta, + TimedeltaIndex, + Timestamp, +) +import pandas._testing as tm +from pandas.tests.copy_view.util import get_array + +# ----------------------------------------------------------------------------- +# Copy/view behaviour for Series / DataFrame constructors + + +@pytest.mark.parametrize("dtype", [None, "int64"]) +def test_series_from_series(dtype, using_copy_on_write, warn_copy_on_write): + # Case: constructing a Series from another Series object follows CoW rules: + # a new object is returned and thus mutations are not propagated + ser = Series([1, 2, 3], name="name") + + # default is copy=False -> new Series is a shallow copy / view of original + result = Series(ser, dtype=dtype) + + # the shallow copy still shares memory + assert np.shares_memory(get_array(ser), get_array(result)) + + if using_copy_on_write: + assert result._mgr.blocks[0].refs.has_reference() + + if using_copy_on_write: + # mutating new series copy doesn't mutate original + result.iloc[0] = 0 + assert ser.iloc[0] == 1 + # mutating triggered a copy-on-write -> no longer shares memory + assert not np.shares_memory(get_array(ser), get_array(result)) + else: + # mutating shallow copy does mutate original + with tm.assert_cow_warning(warn_copy_on_write): + result.iloc[0] = 0 + assert ser.iloc[0] == 0 + # and still shares memory + assert np.shares_memory(get_array(ser), get_array(result)) + + # the same when modifying the parent + result = Series(ser, dtype=dtype) + + if using_copy_on_write: + # mutating original doesn't mutate new series + ser.iloc[0] = 0 + assert result.iloc[0] == 1 + else: + # mutating original does mutate shallow copy + with tm.assert_cow_warning(warn_copy_on_write): + ser.iloc[0] = 0 + assert result.iloc[0] == 0 + + +def test_series_from_series_with_reindex(using_copy_on_write, warn_copy_on_write): + # Case: constructing a Series from another Series with specifying an index + # that potentially requires a reindex of the values + ser = Series([1, 2, 3], name="name") + + # passing an index that doesn't actually require a reindex of the values + # -> without CoW we get an actual mutating view + for index in [ + ser.index, + ser.index.copy(), + list(ser.index), + ser.index.rename("idx"), + ]: + result = Series(ser, index=index) + assert np.shares_memory(ser.values, result.values) + with tm.assert_cow_warning(warn_copy_on_write): + result.iloc[0] = 0 + if using_copy_on_write: + assert ser.iloc[0] == 1 + else: + assert ser.iloc[0] == 0 + + # ensure that if an actual reindex is needed, we don't have any refs + # (mutating the result wouldn't trigger CoW) + result = Series(ser, index=[0, 1, 2, 3]) + assert not np.shares_memory(ser.values, result.values) + if using_copy_on_write: + assert not result._mgr.blocks[0].refs.has_reference() + + +@pytest.mark.parametrize("fastpath", [False, True]) +@pytest.mark.parametrize("dtype", [None, "int64"]) +@pytest.mark.parametrize("idx", [None, pd.RangeIndex(start=0, stop=3, step=1)]) +@pytest.mark.parametrize( + "arr", [np.array([1, 2, 3], dtype="int64"), pd.array([1, 2, 3], dtype="Int64")] +) +def test_series_from_array(using_copy_on_write, idx, dtype, fastpath, arr): + if idx is None or dtype is not None: + fastpath = False + msg = "The 'fastpath' keyword in pd.Series is deprecated" + with tm.assert_produces_warning(DeprecationWarning, match=msg): + ser = Series(arr, dtype=dtype, index=idx, fastpath=fastpath) + ser_orig = ser.copy() + data = getattr(arr, "_data", arr) + if using_copy_on_write: + assert not np.shares_memory(get_array(ser), data) + else: + assert np.shares_memory(get_array(ser), data) + + arr[0] = 100 + if using_copy_on_write: + tm.assert_series_equal(ser, ser_orig) + else: + expected = Series([100, 2, 3], dtype=dtype if dtype is not None else arr.dtype) + tm.assert_series_equal(ser, expected) + + +@pytest.mark.parametrize("copy", [True, False, None]) +def test_series_from_array_different_dtype(using_copy_on_write, copy): + arr = np.array([1, 2, 3], dtype="int64") + ser = Series(arr, dtype="int32", copy=copy) + assert not np.shares_memory(get_array(ser), arr) + + +@pytest.mark.parametrize( + "idx", + [ + Index([1, 2]), + DatetimeIndex([Timestamp("2019-12-31"), Timestamp("2020-12-31")]), + PeriodIndex([Period("2019-12-31"), Period("2020-12-31")]), + TimedeltaIndex([Timedelta("1 days"), Timedelta("2 days")]), + ], +) +def test_series_from_index(using_copy_on_write, idx): + ser = Series(idx) + expected = idx.copy(deep=True) + if using_copy_on_write: + assert np.shares_memory(get_array(ser), get_array(idx)) + assert not ser._mgr._has_no_reference(0) + else: + assert not np.shares_memory(get_array(ser), get_array(idx)) + ser.iloc[0] = ser.iloc[1] + tm.assert_index_equal(idx, expected) + + +def test_series_from_index_different_dtypes(using_copy_on_write): + idx = Index([1, 2, 3], dtype="int64") + ser = Series(idx, dtype="int32") + assert not np.shares_memory(get_array(ser), get_array(idx)) + if using_copy_on_write: + assert ser._mgr._has_no_reference(0) + + +@pytest.mark.filterwarnings("ignore:Setting a value on a view:FutureWarning") +@pytest.mark.parametrize("fastpath", [False, True]) +@pytest.mark.parametrize("dtype", [None, "int64"]) +@pytest.mark.parametrize("idx", [None, pd.RangeIndex(start=0, stop=3, step=1)]) +def test_series_from_block_manager(using_copy_on_write, idx, dtype, fastpath): + ser = Series([1, 2, 3], dtype="int64") + ser_orig = ser.copy() + msg = "The 'fastpath' keyword in pd.Series is deprecated" + with tm.assert_produces_warning(DeprecationWarning, match=msg): + ser2 = Series(ser._mgr, dtype=dtype, fastpath=fastpath, index=idx) + assert np.shares_memory(get_array(ser), get_array(ser2)) + if using_copy_on_write: + assert not ser2._mgr._has_no_reference(0) + + ser2.iloc[0] = 100 + if using_copy_on_write: + tm.assert_series_equal(ser, ser_orig) + else: + expected = Series([100, 2, 3]) + tm.assert_series_equal(ser, expected) + + +def test_series_from_block_manager_different_dtype(using_copy_on_write): + ser = Series([1, 2, 3], dtype="int64") + msg = "Passing a SingleBlockManager to Series" + with tm.assert_produces_warning(DeprecationWarning, match=msg): + ser2 = Series(ser._mgr, dtype="int32") + assert not np.shares_memory(get_array(ser), get_array(ser2)) + if using_copy_on_write: + assert ser2._mgr._has_no_reference(0) + + +@pytest.mark.parametrize("use_mgr", [True, False]) +@pytest.mark.parametrize("columns", [None, ["a"]]) +def test_dataframe_constructor_mgr_or_df( + using_copy_on_write, warn_copy_on_write, columns, use_mgr +): + df = DataFrame({"a": [1, 2, 3]}) + df_orig = df.copy() + + if use_mgr: + data = df._mgr + warn = DeprecationWarning + else: + data = df + warn = None + msg = "Passing a BlockManager to DataFrame" + with tm.assert_produces_warning(warn, match=msg, check_stacklevel=False): + new_df = DataFrame(data) + + assert np.shares_memory(get_array(df, "a"), get_array(new_df, "a")) + with tm.assert_cow_warning(warn_copy_on_write and not use_mgr): + new_df.iloc[0] = 100 + + if using_copy_on_write: + assert not np.shares_memory(get_array(df, "a"), get_array(new_df, "a")) + tm.assert_frame_equal(df, df_orig) + else: + assert np.shares_memory(get_array(df, "a"), get_array(new_df, "a")) + tm.assert_frame_equal(df, new_df) + + +@pytest.mark.parametrize("dtype", [None, "int64", "Int64"]) +@pytest.mark.parametrize("index", [None, [0, 1, 2]]) +@pytest.mark.parametrize("columns", [None, ["a", "b"], ["a", "b", "c"]]) +def test_dataframe_from_dict_of_series( + request, using_copy_on_write, warn_copy_on_write, columns, index, dtype +): + # Case: constructing a DataFrame from Series objects with copy=False + # has to do a lazy following CoW rules + # (the default for DataFrame(dict) is still to copy to ensure consolidation) + s1 = Series([1, 2, 3]) + s2 = Series([4, 5, 6]) + s1_orig = s1.copy() + expected = DataFrame( + {"a": [1, 2, 3], "b": [4, 5, 6]}, index=index, columns=columns, dtype=dtype + ) + + result = DataFrame( + {"a": s1, "b": s2}, index=index, columns=columns, dtype=dtype, copy=False + ) + + # the shallow copy still shares memory + assert np.shares_memory(get_array(result, "a"), get_array(s1)) + + # mutating the new dataframe doesn't mutate original + with tm.assert_cow_warning(warn_copy_on_write): + result.iloc[0, 0] = 10 + if using_copy_on_write: + assert not np.shares_memory(get_array(result, "a"), get_array(s1)) + tm.assert_series_equal(s1, s1_orig) + else: + assert s1.iloc[0] == 10 + + # the same when modifying the parent series + s1 = Series([1, 2, 3]) + s2 = Series([4, 5, 6]) + result = DataFrame( + {"a": s1, "b": s2}, index=index, columns=columns, dtype=dtype, copy=False + ) + with tm.assert_cow_warning(warn_copy_on_write): + s1.iloc[0] = 10 + if using_copy_on_write: + assert not np.shares_memory(get_array(result, "a"), get_array(s1)) + tm.assert_frame_equal(result, expected) + else: + assert result.iloc[0, 0] == 10 + + +@pytest.mark.parametrize("dtype", [None, "int64"]) +def test_dataframe_from_dict_of_series_with_reindex(dtype): + # Case: constructing a DataFrame from Series objects with copy=False + # and passing an index that requires an actual (no-view) reindex -> need + # to ensure the result doesn't have refs set up to unnecessarily trigger + # a copy on write + s1 = Series([1, 2, 3]) + s2 = Series([4, 5, 6]) + df = DataFrame({"a": s1, "b": s2}, index=[1, 2, 3], dtype=dtype, copy=False) + + # df should own its memory, so mutating shouldn't trigger a copy + arr_before = get_array(df, "a") + assert not np.shares_memory(arr_before, get_array(s1)) + df.iloc[0, 0] = 100 + arr_after = get_array(df, "a") + assert np.shares_memory(arr_before, arr_after) + + +@pytest.mark.parametrize("cons", [Series, Index]) +@pytest.mark.parametrize( + "data, dtype", [([1, 2], None), ([1, 2], "int64"), (["a", "b"], object)] +) +def test_dataframe_from_series_or_index( + using_copy_on_write, warn_copy_on_write, data, dtype, cons +): + obj = cons(data, dtype=dtype) + obj_orig = obj.copy() + df = DataFrame(obj, dtype=dtype) + assert np.shares_memory(get_array(obj), get_array(df, 0)) + if using_copy_on_write: + assert not df._mgr._has_no_reference(0) + + with tm.assert_cow_warning(warn_copy_on_write): + df.iloc[0, 0] = data[-1] + if using_copy_on_write: + tm.assert_equal(obj, obj_orig) + + +@pytest.mark.parametrize("cons", [Series, Index]) +def test_dataframe_from_series_or_index_different_dtype(using_copy_on_write, cons): + obj = cons([1, 2], dtype="int64") + df = DataFrame(obj, dtype="int32") + assert not np.shares_memory(get_array(obj), get_array(df, 0)) + if using_copy_on_write: + assert df._mgr._has_no_reference(0) + + +def test_dataframe_from_series_infer_datetime(using_copy_on_write): + ser = Series([Timestamp("2019-12-31"), Timestamp("2020-12-31")], dtype=object) + with tm.assert_produces_warning(FutureWarning, match="Dtype inference"): + df = DataFrame(ser) + assert not np.shares_memory(get_array(ser), get_array(df, 0)) + if using_copy_on_write: + assert df._mgr._has_no_reference(0) + + +@pytest.mark.parametrize("index", [None, [0, 1, 2]]) +def test_dataframe_from_dict_of_series_with_dtype(index): + # Variant of above, but now passing a dtype that causes a copy + # -> need to ensure the result doesn't have refs set up to unnecessarily + # trigger a copy on write + s1 = Series([1.0, 2.0, 3.0]) + s2 = Series([4, 5, 6]) + df = DataFrame({"a": s1, "b": s2}, index=index, dtype="int64", copy=False) + + # df should own its memory, so mutating shouldn't trigger a copy + arr_before = get_array(df, "a") + assert not np.shares_memory(arr_before, get_array(s1)) + df.iloc[0, 0] = 100 + arr_after = get_array(df, "a") + assert np.shares_memory(arr_before, arr_after) + + +@pytest.mark.parametrize("copy", [False, None, True]) +def test_frame_from_numpy_array(using_copy_on_write, copy, using_array_manager): + arr = np.array([[1, 2], [3, 4]]) + df = DataFrame(arr, copy=copy) + + if ( + using_copy_on_write + and copy is not False + or copy is True + or (using_array_manager and copy is None) + ): + assert not np.shares_memory(get_array(df, 0), arr) + else: + assert np.shares_memory(get_array(df, 0), arr) + + +def test_dataframe_from_records_with_dataframe(using_copy_on_write, warn_copy_on_write): + df = DataFrame({"a": [1, 2, 3]}) + df_orig = df.copy() + with tm.assert_produces_warning(FutureWarning): + df2 = DataFrame.from_records(df) + if using_copy_on_write: + assert not df._mgr._has_no_reference(0) + assert np.shares_memory(get_array(df, "a"), get_array(df2, "a")) + with tm.assert_cow_warning(warn_copy_on_write): + df2.iloc[0, 0] = 100 + if using_copy_on_write: + tm.assert_frame_equal(df, df_orig) + else: + tm.assert_frame_equal(df, df2) + + +def test_frame_from_dict_of_index(using_copy_on_write): + idx = Index([1, 2, 3]) + expected = idx.copy(deep=True) + df = DataFrame({"a": idx}, copy=False) + assert np.shares_memory(get_array(df, "a"), idx._values) + if using_copy_on_write: + assert not df._mgr._has_no_reference(0) + + df.iloc[0, 0] = 100 + tm.assert_index_equal(idx, expected) diff --git a/shared/package-files/33/33f6f39c2078b9e22df61925315bb89825ec9082a465ed405412f96e2692bd36/blob b/shared/package-files/33/33f6f39c2078b9e22df61925315bb89825ec9082a465ed405412f96e2692bd36/blob new file mode 100644 index 0000000000000000000000000000000000000000..1595e40d16a01b8355510c4721ca0fb6b5b23b4a --- /dev/null +++ b/shared/package-files/33/33f6f39c2078b9e22df61925315bb89825ec9082a465ed405412f96e2692bd36/blob @@ -0,0 +1,972 @@ +"""Generic interface for least-squares minimization.""" +from warnings import warn + +import numpy as np +from numpy.linalg import norm + +from scipy.sparse import issparse +from scipy.sparse.linalg import LinearOperator +from scipy.optimize import _minpack, OptimizeResult +from scipy.optimize._numdiff import approx_derivative, group_columns +from scipy.optimize._minimize import Bounds + +from .trf import trf +from .dogbox import dogbox +from .common import EPS, in_bounds, make_strictly_feasible + + +TERMINATION_MESSAGES = { + -1: "Improper input parameters status returned from `leastsq`", + 0: "The maximum number of function evaluations is exceeded.", + 1: "`gtol` termination condition is satisfied.", + 2: "`ftol` termination condition is satisfied.", + 3: "`xtol` termination condition is satisfied.", + 4: "Both `ftol` and `xtol` termination conditions are satisfied." +} + + +FROM_MINPACK_TO_COMMON = { + 0: -1, # Improper input parameters from MINPACK. + 1: 2, + 2: 3, + 3: 4, + 4: 1, + 5: 0 + # There are 6, 7, 8 for too small tolerance parameters, + # but we guard against it by checking ftol, xtol, gtol beforehand. +} + + +def call_minpack(fun, x0, jac, ftol, xtol, gtol, max_nfev, x_scale, diff_step): + n = x0.size + + if diff_step is None: + epsfcn = EPS + else: + epsfcn = diff_step**2 + + # Compute MINPACK's `diag`, which is inverse of our `x_scale` and + # ``x_scale='jac'`` corresponds to ``diag=None``. + if isinstance(x_scale, str) and x_scale == 'jac': + diag = None + else: + diag = 1 / x_scale + + full_output = True + col_deriv = False + factor = 100.0 + + if jac is None: + if max_nfev is None: + # n squared to account for Jacobian evaluations. + max_nfev = 100 * n * (n + 1) + x, info, status = _minpack._lmdif( + fun, x0, (), full_output, ftol, xtol, gtol, + max_nfev, epsfcn, factor, diag) + else: + if max_nfev is None: + max_nfev = 100 * n + x, info, status = _minpack._lmder( + fun, jac, x0, (), full_output, col_deriv, + ftol, xtol, gtol, max_nfev, factor, diag) + + f = info['fvec'] + + if callable(jac): + J = jac(x) + else: + J = np.atleast_2d(approx_derivative(fun, x)) + + cost = 0.5 * np.dot(f, f) + g = J.T.dot(f) + g_norm = norm(g, ord=np.inf) + + nfev = info['nfev'] + njev = info.get('njev', None) + + status = FROM_MINPACK_TO_COMMON[status] + active_mask = np.zeros_like(x0, dtype=int) + + return OptimizeResult( + x=x, cost=cost, fun=f, jac=J, grad=g, optimality=g_norm, + active_mask=active_mask, nfev=nfev, njev=njev, status=status) + + +def prepare_bounds(bounds, n): + lb, ub = (np.asarray(b, dtype=float) for b in bounds) + if lb.ndim == 0: + lb = np.resize(lb, n) + + if ub.ndim == 0: + ub = np.resize(ub, n) + + return lb, ub + + +def check_tolerance(ftol, xtol, gtol, method): + def check(tol, name): + if tol is None: + tol = 0 + elif tol < EPS: + warn(f"Setting `{name}` below the machine epsilon ({EPS:.2e}) effectively " + f"disables the corresponding termination condition.", + stacklevel=3) + return tol + + ftol = check(ftol, "ftol") + xtol = check(xtol, "xtol") + gtol = check(gtol, "gtol") + + if method == "lm" and (ftol < EPS or xtol < EPS or gtol < EPS): + raise ValueError("All tolerances must be higher than machine epsilon " + f"({EPS:.2e}) for method 'lm'.") + elif ftol < EPS and xtol < EPS and gtol < EPS: + raise ValueError("At least one of the tolerances must be higher than " + f"machine epsilon ({EPS:.2e}).") + + return ftol, xtol, gtol + + +def check_x_scale(x_scale, x0): + if isinstance(x_scale, str) and x_scale == 'jac': + return x_scale + + try: + x_scale = np.asarray(x_scale, dtype=float) + valid = np.all(np.isfinite(x_scale)) and np.all(x_scale > 0) + except (ValueError, TypeError): + valid = False + + if not valid: + raise ValueError("`x_scale` must be 'jac' or array_like with " + "positive numbers.") + + if x_scale.ndim == 0: + x_scale = np.resize(x_scale, x0.shape) + + if x_scale.shape != x0.shape: + raise ValueError("Inconsistent shapes between `x_scale` and `x0`.") + + return x_scale + + +def check_jac_sparsity(jac_sparsity, m, n): + if jac_sparsity is None: + return None + + if not issparse(jac_sparsity): + jac_sparsity = np.atleast_2d(jac_sparsity) + + if jac_sparsity.shape != (m, n): + raise ValueError("`jac_sparsity` has wrong shape.") + + return jac_sparsity, group_columns(jac_sparsity) + + +# Loss functions. + + +def huber(z, rho, cost_only): + mask = z <= 1 + rho[0, mask] = z[mask] + rho[0, ~mask] = 2 * z[~mask]**0.5 - 1 + if cost_only: + return + rho[1, mask] = 1 + rho[1, ~mask] = z[~mask]**-0.5 + rho[2, mask] = 0 + rho[2, ~mask] = -0.5 * z[~mask]**-1.5 + + +def soft_l1(z, rho, cost_only): + t = 1 + z + rho[0] = 2 * (t**0.5 - 1) + if cost_only: + return + rho[1] = t**-0.5 + rho[2] = -0.5 * t**-1.5 + + +def cauchy(z, rho, cost_only): + rho[0] = np.log1p(z) + if cost_only: + return + t = 1 + z + rho[1] = 1 / t + rho[2] = -1 / t**2 + + +def arctan(z, rho, cost_only): + rho[0] = np.arctan(z) + if cost_only: + return + t = 1 + z**2 + rho[1] = 1 / t + rho[2] = -2 * z / t**2 + + +IMPLEMENTED_LOSSES = dict(linear=None, huber=huber, soft_l1=soft_l1, + cauchy=cauchy, arctan=arctan) + + +def construct_loss_function(m, loss, f_scale): + if loss == 'linear': + return None + + if not callable(loss): + loss = IMPLEMENTED_LOSSES[loss] + rho = np.empty((3, m)) + + def loss_function(f, cost_only=False): + z = (f / f_scale) ** 2 + loss(z, rho, cost_only=cost_only) + if cost_only: + return 0.5 * f_scale ** 2 * np.sum(rho[0]) + rho[0] *= f_scale ** 2 + rho[2] /= f_scale ** 2 + return rho + else: + def loss_function(f, cost_only=False): + z = (f / f_scale) ** 2 + rho = loss(z) + if cost_only: + return 0.5 * f_scale ** 2 * np.sum(rho[0]) + rho[0] *= f_scale ** 2 + rho[2] /= f_scale ** 2 + return rho + + return loss_function + + +def least_squares( + fun, x0, jac='2-point', bounds=(-np.inf, np.inf), method='trf', + ftol=1e-8, xtol=1e-8, gtol=1e-8, x_scale=1.0, loss='linear', + f_scale=1.0, diff_step=None, tr_solver=None, tr_options=None, + jac_sparsity=None, max_nfev=None, verbose=0, args=(), kwargs=None): + """Solve a nonlinear least-squares problem with bounds on the variables. + + Given the residuals f(x) (an m-D real function of n real + variables) and the loss function rho(s) (a scalar function), `least_squares` + finds a local minimum of the cost function F(x):: + + minimize F(x) = 0.5 * sum(rho(f_i(x)**2), i = 0, ..., m - 1) + subject to lb <= x <= ub + + The purpose of the loss function rho(s) is to reduce the influence of + outliers on the solution. + + Parameters + ---------- + fun : callable + Function which computes the vector of residuals, with the signature + ``fun(x, *args, **kwargs)``, i.e., the minimization proceeds with + respect to its first argument. The argument ``x`` passed to this + function is an ndarray of shape (n,) (never a scalar, even for n=1). + It must allocate and return a 1-D array_like of shape (m,) or a scalar. + If the argument ``x`` is complex or the function ``fun`` returns + complex residuals, it must be wrapped in a real function of real + arguments, as shown at the end of the Examples section. + x0 : array_like with shape (n,) or float + Initial guess on independent variables. If float, it will be treated + as a 1-D array with one element. When `method` is 'trf', the initial + guess might be slightly adjusted to lie sufficiently within the given + `bounds`. + jac : {'2-point', '3-point', 'cs', callable}, optional + Method of computing the Jacobian matrix (an m-by-n matrix, where + element (i, j) is the partial derivative of f[i] with respect to + x[j]). The keywords select a finite difference scheme for numerical + estimation. The scheme '3-point' is more accurate, but requires + twice as many operations as '2-point' (default). The scheme 'cs' + uses complex steps, and while potentially the most accurate, it is + applicable only when `fun` correctly handles complex inputs and + can be analytically continued to the complex plane. Method 'lm' + always uses the '2-point' scheme. If callable, it is used as + ``jac(x, *args, **kwargs)`` and should return a good approximation + (or the exact value) for the Jacobian as an array_like (np.atleast_2d + is applied), a sparse matrix (csr_matrix preferred for performance) or + a `scipy.sparse.linalg.LinearOperator`. + bounds : 2-tuple of array_like or `Bounds`, optional + There are two ways to specify bounds: + + 1. Instance of `Bounds` class + 2. Lower and upper bounds on independent variables. Defaults to no + bounds. Each array must match the size of `x0` or be a scalar, + in the latter case a bound will be the same for all variables. + Use ``np.inf`` with an appropriate sign to disable bounds on all + or some variables. + + method : {'trf', 'dogbox', 'lm'}, optional + Algorithm to perform minimization. + + * 'trf' : Trust Region Reflective algorithm, particularly suitable + for large sparse problems with bounds. Generally robust method. + * 'dogbox' : dogleg algorithm with rectangular trust regions, + typical use case is small problems with bounds. Not recommended + for problems with rank-deficient Jacobian. + * 'lm' : Levenberg-Marquardt algorithm as implemented in MINPACK. + Doesn't handle bounds and sparse Jacobians. Usually the most + efficient method for small unconstrained problems. + + Default is 'trf'. See Notes for more information. + ftol : float or None, optional + Tolerance for termination by the change of the cost function. Default + is 1e-8. The optimization process is stopped when ``dF < ftol * F``, + and there was an adequate agreement between a local quadratic model and + the true model in the last step. + + If None and 'method' is not 'lm', the termination by this condition is + disabled. If 'method' is 'lm', this tolerance must be higher than + machine epsilon. + xtol : float or None, optional + Tolerance for termination by the change of the independent variables. + Default is 1e-8. The exact condition depends on the `method` used: + + * For 'trf' and 'dogbox' : ``norm(dx) < xtol * (xtol + norm(x))``. + * For 'lm' : ``Delta < xtol * norm(xs)``, where ``Delta`` is + a trust-region radius and ``xs`` is the value of ``x`` + scaled according to `x_scale` parameter (see below). + + If None and 'method' is not 'lm', the termination by this condition is + disabled. If 'method' is 'lm', this tolerance must be higher than + machine epsilon. + gtol : float or None, optional + Tolerance for termination by the norm of the gradient. Default is 1e-8. + The exact condition depends on a `method` used: + + * For 'trf' : ``norm(g_scaled, ord=np.inf) < gtol``, where + ``g_scaled`` is the value of the gradient scaled to account for + the presence of the bounds [STIR]_. + * For 'dogbox' : ``norm(g_free, ord=np.inf) < gtol``, where + ``g_free`` is the gradient with respect to the variables which + are not in the optimal state on the boundary. + * For 'lm' : the maximum absolute value of the cosine of angles + between columns of the Jacobian and the residual vector is less + than `gtol`, or the residual vector is zero. + + If None and 'method' is not 'lm', the termination by this condition is + disabled. If 'method' is 'lm', this tolerance must be higher than + machine epsilon. + x_scale : array_like or 'jac', optional + Characteristic scale of each variable. Setting `x_scale` is equivalent + to reformulating the problem in scaled variables ``xs = x / x_scale``. + An alternative view is that the size of a trust region along jth + dimension is proportional to ``x_scale[j]``. Improved convergence may + be achieved by setting `x_scale` such that a step of a given size + along any of the scaled variables has a similar effect on the cost + function. If set to 'jac', the scale is iteratively updated using the + inverse norms of the columns of the Jacobian matrix (as described in + [JJMore]_). + loss : str or callable, optional + Determines the loss function. The following keyword values are allowed: + + * 'linear' (default) : ``rho(z) = z``. Gives a standard + least-squares problem. + * 'soft_l1' : ``rho(z) = 2 * ((1 + z)**0.5 - 1)``. The smooth + approximation of l1 (absolute value) loss. Usually a good + choice for robust least squares. + * 'huber' : ``rho(z) = z if z <= 1 else 2*z**0.5 - 1``. Works + similarly to 'soft_l1'. + * 'cauchy' : ``rho(z) = ln(1 + z)``. Severely weakens outliers + influence, but may cause difficulties in optimization process. + * 'arctan' : ``rho(z) = arctan(z)``. Limits a maximum loss on + a single residual, has properties similar to 'cauchy'. + + If callable, it must take a 1-D ndarray ``z=f**2`` and return an + array_like with shape (3, m) where row 0 contains function values, + row 1 contains first derivatives and row 2 contains second + derivatives. Method 'lm' supports only 'linear' loss. + f_scale : float, optional + Value of soft margin between inlier and outlier residuals, default + is 1.0. The loss function is evaluated as follows + ``rho_(f**2) = C**2 * rho(f**2 / C**2)``, where ``C`` is `f_scale`, + and ``rho`` is determined by `loss` parameter. This parameter has + no effect with ``loss='linear'``, but for other `loss` values it is + of crucial importance. + max_nfev : None or int, optional + Maximum number of function evaluations before the termination. + If None (default), the value is chosen automatically: + + * For 'trf' and 'dogbox' : 100 * n. + * For 'lm' : 100 * n if `jac` is callable and 100 * n * (n + 1) + otherwise (because 'lm' counts function calls in Jacobian + estimation). + + diff_step : None or array_like, optional + Determines the relative step size for the finite difference + approximation of the Jacobian. The actual step is computed as + ``x * diff_step``. If None (default), then `diff_step` is taken to be + a conventional "optimal" power of machine epsilon for the finite + difference scheme used [NR]_. + tr_solver : {None, 'exact', 'lsmr'}, optional + Method for solving trust-region subproblems, relevant only for 'trf' + and 'dogbox' methods. + + * 'exact' is suitable for not very large problems with dense + Jacobian matrices. The computational complexity per iteration is + comparable to a singular value decomposition of the Jacobian + matrix. + * 'lsmr' is suitable for problems with sparse and large Jacobian + matrices. It uses the iterative procedure + `scipy.sparse.linalg.lsmr` for finding a solution of a linear + least-squares problem and only requires matrix-vector product + evaluations. + + If None (default), the solver is chosen based on the type of Jacobian + returned on the first iteration. + tr_options : dict, optional + Keyword options passed to trust-region solver. + + * ``tr_solver='exact'``: `tr_options` are ignored. + * ``tr_solver='lsmr'``: options for `scipy.sparse.linalg.lsmr`. + Additionally, ``method='trf'`` supports 'regularize' option + (bool, default is True), which adds a regularization term to the + normal equation, which improves convergence if the Jacobian is + rank-deficient [Byrd]_ (eq. 3.4). + + jac_sparsity : {None, array_like, sparse matrix}, optional + Defines the sparsity structure of the Jacobian matrix for finite + difference estimation, its shape must be (m, n). If the Jacobian has + only few non-zero elements in *each* row, providing the sparsity + structure will greatly speed up the computations [Curtis]_. A zero + entry means that a corresponding element in the Jacobian is identically + zero. If provided, forces the use of 'lsmr' trust-region solver. + If None (default), then dense differencing will be used. Has no effect + for 'lm' method. + verbose : {0, 1, 2}, optional + Level of algorithm's verbosity: + + * 0 (default) : work silently. + * 1 : display a termination report. + * 2 : display progress during iterations (not supported by 'lm' + method). + + args, kwargs : tuple and dict, optional + Additional arguments passed to `fun` and `jac`. Both empty by default. + The calling signature is ``fun(x, *args, **kwargs)`` and the same for + `jac`. + + Returns + ------- + result : OptimizeResult + `OptimizeResult` with the following fields defined: + + x : ndarray, shape (n,) + Solution found. + cost : float + Value of the cost function at the solution. + fun : ndarray, shape (m,) + Vector of residuals at the solution. + jac : ndarray, sparse matrix or LinearOperator, shape (m, n) + Modified Jacobian matrix at the solution, in the sense that J^T J + is a Gauss-Newton approximation of the Hessian of the cost function. + The type is the same as the one used by the algorithm. + grad : ndarray, shape (m,) + Gradient of the cost function at the solution. + optimality : float + First-order optimality measure. In unconstrained problems, it is + always the uniform norm of the gradient. In constrained problems, + it is the quantity which was compared with `gtol` during iterations. + active_mask : ndarray of int, shape (n,) + Each component shows whether a corresponding constraint is active + (that is, whether a variable is at the bound): + + * 0 : a constraint is not active. + * -1 : a lower bound is active. + * 1 : an upper bound is active. + + Might be somewhat arbitrary for 'trf' method as it generates a + sequence of strictly feasible iterates and `active_mask` is + determined within a tolerance threshold. + nfev : int + Number of function evaluations done. Methods 'trf' and 'dogbox' do + not count function calls for numerical Jacobian approximation, as + opposed to 'lm' method. + njev : int or None + Number of Jacobian evaluations done. If numerical Jacobian + approximation is used in 'lm' method, it is set to None. + status : int + The reason for algorithm termination: + + * -1 : improper input parameters status returned from MINPACK. + * 0 : the maximum number of function evaluations is exceeded. + * 1 : `gtol` termination condition is satisfied. + * 2 : `ftol` termination condition is satisfied. + * 3 : `xtol` termination condition is satisfied. + * 4 : Both `ftol` and `xtol` termination conditions are satisfied. + + message : str + Verbal description of the termination reason. + success : bool + True if one of the convergence criteria is satisfied (`status` > 0). + + See Also + -------- + leastsq : A legacy wrapper for the MINPACK implementation of the + Levenberg-Marquadt algorithm. + curve_fit : Least-squares minimization applied to a curve-fitting problem. + + Notes + ----- + Method 'lm' (Levenberg-Marquardt) calls a wrapper over least-squares + algorithms implemented in MINPACK (lmder, lmdif). It runs the + Levenberg-Marquardt algorithm formulated as a trust-region type algorithm. + The implementation is based on paper [JJMore]_, it is very robust and + efficient with a lot of smart tricks. It should be your first choice + for unconstrained problems. Note that it doesn't support bounds. Also, + it doesn't work when m < n. + + Method 'trf' (Trust Region Reflective) is motivated by the process of + solving a system of equations, which constitute the first-order optimality + condition for a bound-constrained minimization problem as formulated in + [STIR]_. The algorithm iteratively solves trust-region subproblems + augmented by a special diagonal quadratic term and with trust-region shape + determined by the distance from the bounds and the direction of the + gradient. This enhancements help to avoid making steps directly into bounds + and efficiently explore the whole space of variables. To further improve + convergence, the algorithm considers search directions reflected from the + bounds. To obey theoretical requirements, the algorithm keeps iterates + strictly feasible. With dense Jacobians trust-region subproblems are + solved by an exact method very similar to the one described in [JJMore]_ + (and implemented in MINPACK). The difference from the MINPACK + implementation is that a singular value decomposition of a Jacobian + matrix is done once per iteration, instead of a QR decomposition and series + of Givens rotation eliminations. For large sparse Jacobians a 2-D subspace + approach of solving trust-region subproblems is used [STIR]_, [Byrd]_. + The subspace is spanned by a scaled gradient and an approximate + Gauss-Newton solution delivered by `scipy.sparse.linalg.lsmr`. When no + constraints are imposed the algorithm is very similar to MINPACK and has + generally comparable performance. The algorithm works quite robust in + unbounded and bounded problems, thus it is chosen as a default algorithm. + + Method 'dogbox' operates in a trust-region framework, but considers + rectangular trust regions as opposed to conventional ellipsoids [Voglis]_. + The intersection of a current trust region and initial bounds is again + rectangular, so on each iteration a quadratic minimization problem subject + to bound constraints is solved approximately by Powell's dogleg method + [NumOpt]_. The required Gauss-Newton step can be computed exactly for + dense Jacobians or approximately by `scipy.sparse.linalg.lsmr` for large + sparse Jacobians. The algorithm is likely to exhibit slow convergence when + the rank of Jacobian is less than the number of variables. The algorithm + often outperforms 'trf' in bounded problems with a small number of + variables. + + Robust loss functions are implemented as described in [BA]_. The idea + is to modify a residual vector and a Jacobian matrix on each iteration + such that computed gradient and Gauss-Newton Hessian approximation match + the true gradient and Hessian approximation of the cost function. Then + the algorithm proceeds in a normal way, i.e., robust loss functions are + implemented as a simple wrapper over standard least-squares algorithms. + + .. versionadded:: 0.17.0 + + References + ---------- + .. [STIR] M. A. Branch, T. F. Coleman, and Y. Li, "A Subspace, Interior, + and Conjugate Gradient Method for Large-Scale Bound-Constrained + Minimization Problems," SIAM Journal on Scientific Computing, + Vol. 21, Number 1, pp 1-23, 1999. + .. [NR] William H. Press et. al., "Numerical Recipes. The Art of Scientific + Computing. 3rd edition", Sec. 5.7. + .. [Byrd] R. H. Byrd, R. B. Schnabel and G. A. Shultz, "Approximate + solution of the trust region problem by minimization over + two-dimensional subspaces", Math. Programming, 40, pp. 247-263, + 1988. + .. [Curtis] A. Curtis, M. J. D. Powell, and J. Reid, "On the estimation of + sparse Jacobian matrices", Journal of the Institute of + Mathematics and its Applications, 13, pp. 117-120, 1974. + .. [JJMore] J. J. More, "The Levenberg-Marquardt Algorithm: Implementation + and Theory," Numerical Analysis, ed. G. A. Watson, Lecture + Notes in Mathematics 630, Springer Verlag, pp. 105-116, 1977. + .. [Voglis] C. Voglis and I. E. Lagaris, "A Rectangular Trust Region + Dogleg Approach for Unconstrained and Bound Constrained + Nonlinear Optimization", WSEAS International Conference on + Applied Mathematics, Corfu, Greece, 2004. + .. [NumOpt] J. Nocedal and S. J. Wright, "Numerical optimization, + 2nd edition", Chapter 4. + .. [BA] B. Triggs et. al., "Bundle Adjustment - A Modern Synthesis", + Proceedings of the International Workshop on Vision Algorithms: + Theory and Practice, pp. 298-372, 1999. + + Examples + -------- + In this example we find a minimum of the Rosenbrock function without bounds + on independent variables. + + >>> import numpy as np + >>> def fun_rosenbrock(x): + ... return np.array([10 * (x[1] - x[0]**2), (1 - x[0])]) + + Notice that we only provide the vector of the residuals. The algorithm + constructs the cost function as a sum of squares of the residuals, which + gives the Rosenbrock function. The exact minimum is at ``x = [1.0, 1.0]``. + + >>> from scipy.optimize import least_squares + >>> x0_rosenbrock = np.array([2, 2]) + >>> res_1 = least_squares(fun_rosenbrock, x0_rosenbrock) + >>> res_1.x + array([ 1., 1.]) + >>> res_1.cost + 9.8669242910846867e-30 + >>> res_1.optimality + 8.8928864934219529e-14 + + We now constrain the variables, in such a way that the previous solution + becomes infeasible. Specifically, we require that ``x[1] >= 1.5``, and + ``x[0]`` left unconstrained. To this end, we specify the `bounds` parameter + to `least_squares` in the form ``bounds=([-np.inf, 1.5], np.inf)``. + + We also provide the analytic Jacobian: + + >>> def jac_rosenbrock(x): + ... return np.array([ + ... [-20 * x[0], 10], + ... [-1, 0]]) + + Putting this all together, we see that the new solution lies on the bound: + + >>> res_2 = least_squares(fun_rosenbrock, x0_rosenbrock, jac_rosenbrock, + ... bounds=([-np.inf, 1.5], np.inf)) + >>> res_2.x + array([ 1.22437075, 1.5 ]) + >>> res_2.cost + 0.025213093946805685 + >>> res_2.optimality + 1.5885401433157753e-07 + + Now we solve a system of equations (i.e., the cost function should be zero + at a minimum) for a Broyden tridiagonal vector-valued function of 100000 + variables: + + >>> def fun_broyden(x): + ... f = (3 - x) * x + 1 + ... f[1:] -= x[:-1] + ... f[:-1] -= 2 * x[1:] + ... return f + + The corresponding Jacobian matrix is sparse. We tell the algorithm to + estimate it by finite differences and provide the sparsity structure of + Jacobian to significantly speed up this process. + + >>> from scipy.sparse import lil_matrix + >>> def sparsity_broyden(n): + ... sparsity = lil_matrix((n, n), dtype=int) + ... i = np.arange(n) + ... sparsity[i, i] = 1 + ... i = np.arange(1, n) + ... sparsity[i, i - 1] = 1 + ... i = np.arange(n - 1) + ... sparsity[i, i + 1] = 1 + ... return sparsity + ... + >>> n = 100000 + >>> x0_broyden = -np.ones(n) + ... + >>> res_3 = least_squares(fun_broyden, x0_broyden, + ... jac_sparsity=sparsity_broyden(n)) + >>> res_3.cost + 4.5687069299604613e-23 + >>> res_3.optimality + 1.1650454296851518e-11 + + Let's also solve a curve fitting problem using robust loss function to + take care of outliers in the data. Define the model function as + ``y = a + b * exp(c * t)``, where t is a predictor variable, y is an + observation and a, b, c are parameters to estimate. + + First, define the function which generates the data with noise and + outliers, define the model parameters, and generate data: + + >>> from numpy.random import default_rng + >>> rng = default_rng() + >>> def gen_data(t, a, b, c, noise=0., n_outliers=0, seed=None): + ... rng = default_rng(seed) + ... + ... y = a + b * np.exp(t * c) + ... + ... error = noise * rng.standard_normal(t.size) + ... outliers = rng.integers(0, t.size, n_outliers) + ... error[outliers] *= 10 + ... + ... return y + error + ... + >>> a = 0.5 + >>> b = 2.0 + >>> c = -1 + >>> t_min = 0 + >>> t_max = 10 + >>> n_points = 15 + ... + >>> t_train = np.linspace(t_min, t_max, n_points) + >>> y_train = gen_data(t_train, a, b, c, noise=0.1, n_outliers=3) + + Define function for computing residuals and initial estimate of + parameters. + + >>> def fun(x, t, y): + ... return x[0] + x[1] * np.exp(x[2] * t) - y + ... + >>> x0 = np.array([1.0, 1.0, 0.0]) + + Compute a standard least-squares solution: + + >>> res_lsq = least_squares(fun, x0, args=(t_train, y_train)) + + Now compute two solutions with two different robust loss functions. The + parameter `f_scale` is set to 0.1, meaning that inlier residuals should + not significantly exceed 0.1 (the noise level used). + + >>> res_soft_l1 = least_squares(fun, x0, loss='soft_l1', f_scale=0.1, + ... args=(t_train, y_train)) + >>> res_log = least_squares(fun, x0, loss='cauchy', f_scale=0.1, + ... args=(t_train, y_train)) + + And, finally, plot all the curves. We see that by selecting an appropriate + `loss` we can get estimates close to optimal even in the presence of + strong outliers. But keep in mind that generally it is recommended to try + 'soft_l1' or 'huber' losses first (if at all necessary) as the other two + options may cause difficulties in optimization process. + + >>> t_test = np.linspace(t_min, t_max, n_points * 10) + >>> y_true = gen_data(t_test, a, b, c) + >>> y_lsq = gen_data(t_test, *res_lsq.x) + >>> y_soft_l1 = gen_data(t_test, *res_soft_l1.x) + >>> y_log = gen_data(t_test, *res_log.x) + ... + >>> import matplotlib.pyplot as plt + >>> plt.plot(t_train, y_train, 'o') + >>> plt.plot(t_test, y_true, 'k', linewidth=2, label='true') + >>> plt.plot(t_test, y_lsq, label='linear loss') + >>> plt.plot(t_test, y_soft_l1, label='soft_l1 loss') + >>> plt.plot(t_test, y_log, label='cauchy loss') + >>> plt.xlabel("t") + >>> plt.ylabel("y") + >>> plt.legend() + >>> plt.show() + + In the next example, we show how complex-valued residual functions of + complex variables can be optimized with ``least_squares()``. Consider the + following function: + + >>> def f(z): + ... return z - (0.5 + 0.5j) + + We wrap it into a function of real variables that returns real residuals + by simply handling the real and imaginary parts as independent variables: + + >>> def f_wrap(x): + ... fx = f(x[0] + 1j*x[1]) + ... return np.array([fx.real, fx.imag]) + + Thus, instead of the original m-D complex function of n complex + variables we optimize a 2m-D real function of 2n real variables: + + >>> from scipy.optimize import least_squares + >>> res_wrapped = least_squares(f_wrap, (0.1, 0.1), bounds=([0, 0], [1, 1])) + >>> z = res_wrapped.x[0] + res_wrapped.x[1]*1j + >>> z + (0.49999999999925893+0.49999999999925893j) + + """ + if method not in ['trf', 'dogbox', 'lm']: + raise ValueError("`method` must be 'trf', 'dogbox' or 'lm'.") + + if jac not in ['2-point', '3-point', 'cs'] and not callable(jac): + raise ValueError("`jac` must be '2-point', '3-point', 'cs' or " + "callable.") + + if tr_solver not in [None, 'exact', 'lsmr']: + raise ValueError("`tr_solver` must be None, 'exact' or 'lsmr'.") + + if loss not in IMPLEMENTED_LOSSES and not callable(loss): + raise ValueError(f"`loss` must be one of {IMPLEMENTED_LOSSES.keys()}" + " or a callable.") + + if method == 'lm' and loss != 'linear': + raise ValueError("method='lm' supports only 'linear' loss function.") + + if verbose not in [0, 1, 2]: + raise ValueError("`verbose` must be in [0, 1, 2].") + + if max_nfev is not None and max_nfev <= 0: + raise ValueError("`max_nfev` must be None or positive integer.") + + if np.iscomplexobj(x0): + raise ValueError("`x0` must be real.") + + x0 = np.atleast_1d(x0).astype(float) + + if x0.ndim > 1: + raise ValueError("`x0` must have at most 1 dimension.") + + if isinstance(bounds, Bounds): + lb, ub = bounds.lb, bounds.ub + bounds = (lb, ub) + else: + if len(bounds) == 2: + lb, ub = prepare_bounds(bounds, x0.shape[0]) + else: + raise ValueError("`bounds` must contain 2 elements.") + + if method == 'lm' and not np.all((lb == -np.inf) & (ub == np.inf)): + raise ValueError("Method 'lm' doesn't support bounds.") + + if lb.shape != x0.shape or ub.shape != x0.shape: + raise ValueError("Inconsistent shapes between bounds and `x0`.") + + if np.any(lb >= ub): + raise ValueError("Each lower bound must be strictly less than each " + "upper bound.") + + if not in_bounds(x0, lb, ub): + raise ValueError("Initial guess is outside of provided bounds") + + x_scale = check_x_scale(x_scale, x0) + + ftol, xtol, gtol = check_tolerance(ftol, xtol, gtol, method) + + if method == 'trf': + x0 = make_strictly_feasible(x0, lb, ub) + + if kwargs is None: + kwargs = {} + if tr_options is None: + tr_options = {} + + def fun_wrapped(x): + return np.atleast_1d(fun(x, *args, **kwargs)) + + f0 = fun_wrapped(x0) + + if f0.ndim != 1: + raise ValueError("`fun` must return at most 1-d array_like. " + f"f0.shape: {f0.shape}") + + if not np.all(np.isfinite(f0)): + raise ValueError("Residuals are not finite in the initial point.") + + n = x0.size + m = f0.size + + if method == 'lm' and m < n: + raise ValueError("Method 'lm' doesn't work when the number of " + "residuals is less than the number of variables.") + + loss_function = construct_loss_function(m, loss, f_scale) + if callable(loss): + rho = loss_function(f0) + if rho.shape != (3, m): + raise ValueError("The return value of `loss` callable has wrong " + "shape.") + initial_cost = 0.5 * np.sum(rho[0]) + elif loss_function is not None: + initial_cost = loss_function(f0, cost_only=True) + else: + initial_cost = 0.5 * np.dot(f0, f0) + + if callable(jac): + J0 = jac(x0, *args, **kwargs) + + if issparse(J0): + J0 = J0.tocsr() + + def jac_wrapped(x, _=None): + return jac(x, *args, **kwargs).tocsr() + + elif isinstance(J0, LinearOperator): + def jac_wrapped(x, _=None): + return jac(x, *args, **kwargs) + + else: + J0 = np.atleast_2d(J0) + + def jac_wrapped(x, _=None): + return np.atleast_2d(jac(x, *args, **kwargs)) + + else: # Estimate Jacobian by finite differences. + if method == 'lm': + if jac_sparsity is not None: + raise ValueError("method='lm' does not support " + "`jac_sparsity`.") + + if jac != '2-point': + warn(f"jac='{jac}' works equivalently to '2-point' for method='lm'.", + stacklevel=2) + + J0 = jac_wrapped = None + else: + if jac_sparsity is not None and tr_solver == 'exact': + raise ValueError("tr_solver='exact' is incompatible " + "with `jac_sparsity`.") + + jac_sparsity = check_jac_sparsity(jac_sparsity, m, n) + + def jac_wrapped(x, f): + J = approx_derivative(fun, x, rel_step=diff_step, method=jac, + f0=f, bounds=bounds, args=args, + kwargs=kwargs, sparsity=jac_sparsity) + if J.ndim != 2: # J is guaranteed not sparse. + J = np.atleast_2d(J) + + return J + + J0 = jac_wrapped(x0, f0) + + if J0 is not None: + if J0.shape != (m, n): + raise ValueError( + f"The return value of `jac` has wrong shape: expected {(m, n)}, " + f"actual {J0.shape}." + ) + + if not isinstance(J0, np.ndarray): + if method == 'lm': + raise ValueError("method='lm' works only with dense " + "Jacobian matrices.") + + if tr_solver == 'exact': + raise ValueError( + "tr_solver='exact' works only with dense " + "Jacobian matrices.") + + jac_scale = isinstance(x_scale, str) and x_scale == 'jac' + if isinstance(J0, LinearOperator) and jac_scale: + raise ValueError("x_scale='jac' can't be used when `jac` " + "returns LinearOperator.") + + if tr_solver is None: + if isinstance(J0, np.ndarray): + tr_solver = 'exact' + else: + tr_solver = 'lsmr' + + if method == 'lm': + result = call_minpack(fun_wrapped, x0, jac_wrapped, ftol, xtol, gtol, + max_nfev, x_scale, diff_step) + + elif method == 'trf': + result = trf(fun_wrapped, jac_wrapped, x0, f0, J0, lb, ub, ftol, xtol, + gtol, max_nfev, x_scale, loss_function, tr_solver, + tr_options.copy(), verbose) + + elif method == 'dogbox': + if tr_solver == 'lsmr' and 'regularize' in tr_options: + warn("The keyword 'regularize' in `tr_options` is not relevant " + "for 'dogbox' method.", + stacklevel=2) + tr_options = tr_options.copy() + del tr_options['regularize'] + + result = dogbox(fun_wrapped, jac_wrapped, x0, f0, J0, lb, ub, ftol, + xtol, gtol, max_nfev, x_scale, loss_function, + tr_solver, tr_options, verbose) + + result.message = TERMINATION_MESSAGES[result.status] + result.success = result.status > 0 + + if verbose >= 1: + print(result.message) + print(f"Function evaluations {result.nfev}, initial cost {initial_cost:.4e}, " + f"final cost {result.cost:.4e}, " + f"first-order optimality {result.optimality:.2e}.") + + return result diff --git a/shared/package-files/33/33f8936bd3e7f05ee343593a44df4abdb8449f4d20ed46096793d5e7b8a47193/blob b/shared/package-files/33/33f8936bd3e7f05ee343593a44df4abdb8449f4d20ed46096793d5e7b8a47193/blob new file mode 100644 index 0000000000000000000000000000000000000000..e15ed0801a0d9b70c0abdb0723df6793fae12046 --- /dev/null +++ b/shared/package-files/33/33f8936bd3e7f05ee343593a44df4abdb8449f4d20ed46096793d5e7b8a47193/blob @@ -0,0 +1,154 @@ +import sys +from typing import Any + +import numpy as np +import numpy.typing as npt + +if sys.version_info >= (3, 11): + from typing import assert_type +else: + from typing_extensions import assert_type + +AR_U: npt.NDArray[np.str_] +AR_S: npt.NDArray[np.bytes_] + +assert_type(np.char.equal(AR_U, AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.equal(AR_S, AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.not_equal(AR_U, AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.not_equal(AR_S, AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.greater_equal(AR_U, AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.greater_equal(AR_S, AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.less_equal(AR_U, AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.less_equal(AR_S, AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.greater(AR_U, AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.greater(AR_S, AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.less(AR_U, AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.less(AR_S, AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.multiply(AR_U, 5), npt.NDArray[np.str_]) +assert_type(np.char.multiply(AR_S, [5, 4, 3]), npt.NDArray[np.bytes_]) + +assert_type(np.char.mod(AR_U, "test"), npt.NDArray[np.str_]) +assert_type(np.char.mod(AR_S, "test"), npt.NDArray[np.bytes_]) + +assert_type(np.char.capitalize(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.capitalize(AR_S), npt.NDArray[np.bytes_]) + +assert_type(np.char.center(AR_U, 5), npt.NDArray[np.str_]) +assert_type(np.char.center(AR_S, [2, 3, 4], b"a"), npt.NDArray[np.bytes_]) + +assert_type(np.char.encode(AR_U), npt.NDArray[np.bytes_]) +assert_type(np.char.decode(AR_S), npt.NDArray[np.str_]) + +assert_type(np.char.expandtabs(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.expandtabs(AR_S, tabsize=4), npt.NDArray[np.bytes_]) + +assert_type(np.char.join(AR_U, "_"), npt.NDArray[np.str_]) +assert_type(np.char.join(AR_S, [b"_", b""]), npt.NDArray[np.bytes_]) + +assert_type(np.char.ljust(AR_U, 5), npt.NDArray[np.str_]) +assert_type(np.char.ljust(AR_S, [4, 3, 1], fillchar=[b"a", b"b", b"c"]), npt.NDArray[np.bytes_]) +assert_type(np.char.rjust(AR_U, 5), npt.NDArray[np.str_]) +assert_type(np.char.rjust(AR_S, [4, 3, 1], fillchar=[b"a", b"b", b"c"]), npt.NDArray[np.bytes_]) + +assert_type(np.char.lstrip(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.lstrip(AR_S, chars=b"_"), npt.NDArray[np.bytes_]) +assert_type(np.char.rstrip(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.rstrip(AR_S, chars=b"_"), npt.NDArray[np.bytes_]) +assert_type(np.char.strip(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.strip(AR_S, chars=b"_"), npt.NDArray[np.bytes_]) + +assert_type(np.char.partition(AR_U, "\n"), npt.NDArray[np.str_]) +assert_type(np.char.partition(AR_S, [b"a", b"b", b"c"]), npt.NDArray[np.bytes_]) +assert_type(np.char.rpartition(AR_U, "\n"), npt.NDArray[np.str_]) +assert_type(np.char.rpartition(AR_S, [b"a", b"b", b"c"]), npt.NDArray[np.bytes_]) + +assert_type(np.char.replace(AR_U, "_", "-"), npt.NDArray[np.str_]) +assert_type(np.char.replace(AR_S, [b"_", b""], [b"a", b"b"]), npt.NDArray[np.bytes_]) + +assert_type(np.char.split(AR_U, "_"), npt.NDArray[np.object_]) +assert_type(np.char.split(AR_S, maxsplit=[1, 2, 3]), npt.NDArray[np.object_]) +assert_type(np.char.rsplit(AR_U, "_"), npt.NDArray[np.object_]) +assert_type(np.char.rsplit(AR_S, maxsplit=[1, 2, 3]), npt.NDArray[np.object_]) + +assert_type(np.char.splitlines(AR_U), npt.NDArray[np.object_]) +assert_type(np.char.splitlines(AR_S, keepends=[True, True, False]), npt.NDArray[np.object_]) + +assert_type(np.char.swapcase(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.swapcase(AR_S), npt.NDArray[np.bytes_]) + +assert_type(np.char.title(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.title(AR_S), npt.NDArray[np.bytes_]) + +assert_type(np.char.upper(AR_U), npt.NDArray[np.str_]) +assert_type(np.char.upper(AR_S), npt.NDArray[np.bytes_]) + +assert_type(np.char.zfill(AR_U, 5), npt.NDArray[np.str_]) +assert_type(np.char.zfill(AR_S, [2, 3, 4]), npt.NDArray[np.bytes_]) + +assert_type(np.char.count(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.int_]) +assert_type(np.char.count(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.int_]) + +assert_type(np.char.endswith(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.bool_]) +assert_type(np.char.endswith(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.bool_]) +assert_type(np.char.startswith(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.bool_]) +assert_type(np.char.startswith(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.bool_]) + +assert_type(np.char.find(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.int_]) +assert_type(np.char.find(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.int_]) +assert_type(np.char.rfind(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.int_]) +assert_type(np.char.rfind(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.int_]) + +assert_type(np.char.index(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.int_]) +assert_type(np.char.index(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.int_]) +assert_type(np.char.rindex(AR_U, "a", start=[1, 2, 3]), npt.NDArray[np.int_]) +assert_type(np.char.rindex(AR_S, [b"a", b"b", b"c"], end=9), npt.NDArray[np.int_]) + +assert_type(np.char.isalpha(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isalpha(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.isalnum(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isalnum(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.isdecimal(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isdecimal(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.isdigit(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isdigit(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.islower(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.islower(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.isnumeric(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isnumeric(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.isspace(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isspace(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.istitle(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.istitle(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.isupper(AR_U), npt.NDArray[np.bool_]) +assert_type(np.char.isupper(AR_S), npt.NDArray[np.bool_]) + +assert_type(np.char.str_len(AR_U), npt.NDArray[np.int_]) +assert_type(np.char.str_len(AR_S), npt.NDArray[np.int_]) + +assert_type(np.char.array(AR_U), np.chararray[Any, np.dtype[np.str_]]) +assert_type(np.char.array(AR_S, order="K"), np.chararray[Any, np.dtype[np.bytes_]]) +assert_type(np.char.array("bob", copy=True), np.chararray[Any, np.dtype[np.str_]]) +assert_type(np.char.array(b"bob", itemsize=5), np.chararray[Any, np.dtype[np.bytes_]]) +assert_type(np.char.array(1, unicode=False), np.chararray[Any, np.dtype[np.bytes_]]) +assert_type(np.char.array(1, unicode=True), np.chararray[Any, np.dtype[np.str_]]) + +assert_type(np.char.asarray(AR_U), np.chararray[Any, np.dtype[np.str_]]) +assert_type(np.char.asarray(AR_S, order="K"), np.chararray[Any, np.dtype[np.bytes_]]) +assert_type(np.char.asarray("bob"), np.chararray[Any, np.dtype[np.str_]]) +assert_type(np.char.asarray(b"bob", itemsize=5), np.chararray[Any, np.dtype[np.bytes_]]) +assert_type(np.char.asarray(1, unicode=False), np.chararray[Any, np.dtype[np.bytes_]]) +assert_type(np.char.asarray(1, unicode=True), np.chararray[Any, np.dtype[np.str_]]) diff --git a/shared/package-files/33/33fc59c3510c8ab78df0264c9a523fb02895b2e9fc45cab41659d190f7967584/blob b/shared/package-files/33/33fc59c3510c8ab78df0264c9a523fb02895b2e9fc45cab41659d190f7967584/blob new file mode 100644 index 0000000000000000000000000000000000000000..0dc002edd9410b9120a518e31972b978e54b57b1 --- /dev/null +++ b/shared/package-files/33/33fc59c3510c8ab78df0264c9a523fb02895b2e9fc45cab41659d190f7967584/blob @@ -0,0 +1,364 @@ +# mypy: allow-untyped-defs +"""Record warnings during test function execution.""" + +from __future__ import annotations + +from pprint import pformat +import re +from types import TracebackType +from typing import Any +from typing import Callable +from typing import final +from typing import Generator +from typing import Iterator +from typing import overload +from typing import Pattern +from typing import TYPE_CHECKING +from typing import TypeVar + + +if TYPE_CHECKING: + from typing_extensions import Self + +import warnings + +from _pytest.deprecated import check_ispytest +from _pytest.fixtures import fixture +from _pytest.outcomes import Exit +from _pytest.outcomes import fail + + +T = TypeVar("T") + + +@fixture +def recwarn() -> Generator[WarningsRecorder]: + """Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. + + See :ref:`warnings` for information on warning categories. + """ + wrec = WarningsRecorder(_ispytest=True) + with wrec: + warnings.simplefilter("default") + yield wrec + + +@overload +def deprecated_call(*, match: str | Pattern[str] | None = ...) -> WarningsRecorder: ... + + +@overload +def deprecated_call(func: Callable[..., T], *args: Any, **kwargs: Any) -> T: ... + + +def deprecated_call( + func: Callable[..., Any] | None = None, *args: Any, **kwargs: Any +) -> WarningsRecorder | Any: + """Assert that code produces a ``DeprecationWarning`` or ``PendingDeprecationWarning`` or ``FutureWarning``. + + This function can be used as a context manager:: + + >>> import warnings + >>> def api_call_v2(): + ... warnings.warn('use v3 of this api', DeprecationWarning) + ... return 200 + + >>> import pytest + >>> with pytest.deprecated_call(): + ... assert api_call_v2() == 200 + + It can also be used by passing a function and ``*args`` and ``**kwargs``, + in which case it will ensure calling ``func(*args, **kwargs)`` produces one of + the warnings types above. The return value is the return value of the function. + + In the context manager form you may use the keyword argument ``match`` to assert + that the warning matches a text or regex. + + The context manager produces a list of :class:`warnings.WarningMessage` objects, + one for each warning raised. + """ + __tracebackhide__ = True + if func is not None: + args = (func, *args) + return warns( + (DeprecationWarning, PendingDeprecationWarning, FutureWarning), *args, **kwargs + ) + + +@overload +def warns( + expected_warning: type[Warning] | tuple[type[Warning], ...] = ..., + *, + match: str | Pattern[str] | None = ..., +) -> WarningsChecker: ... + + +@overload +def warns( + expected_warning: type[Warning] | tuple[type[Warning], ...], + func: Callable[..., T], + *args: Any, + **kwargs: Any, +) -> T: ... + + +def warns( + expected_warning: type[Warning] | tuple[type[Warning], ...] = Warning, + *args: Any, + match: str | Pattern[str] | None = None, + **kwargs: Any, +) -> WarningsChecker | Any: + r"""Assert that code raises a particular class of warning. + + Specifically, the parameter ``expected_warning`` can be a warning class or tuple + of warning classes, and the code inside the ``with`` block must issue at least one + warning of that class or classes. + + This helper produces a list of :class:`warnings.WarningMessage` objects, one for + each warning emitted (regardless of whether it is an ``expected_warning`` or not). + Since pytest 8.0, unmatched warnings are also re-emitted when the context closes. + + This function can be used as a context manager:: + + >>> import pytest + >>> with pytest.warns(RuntimeWarning): + ... warnings.warn("my warning", RuntimeWarning) + + In the context manager form you may use the keyword argument ``match`` to assert + that the warning matches a text or regex:: + + >>> with pytest.warns(UserWarning, match='must be 0 or None'): + ... warnings.warn("value must be 0 or None", UserWarning) + + >>> with pytest.warns(UserWarning, match=r'must be \d+$'): + ... warnings.warn("value must be 42", UserWarning) + + >>> with pytest.warns(UserWarning): # catch re-emitted warning + ... with pytest.warns(UserWarning, match=r'must be \d+$'): + ... warnings.warn("this is not here", UserWarning) + Traceback (most recent call last): + ... + Failed: DID NOT WARN. No warnings of type ...UserWarning... were emitted... + + **Using with** ``pytest.mark.parametrize`` + + When using :ref:`pytest.mark.parametrize ref` it is possible to parametrize tests + such that some runs raise a warning and others do not. + + This could be achieved in the same way as with exceptions, see + :ref:`parametrizing_conditional_raising` for an example. + + """ + __tracebackhide__ = True + if not args: + if kwargs: + argnames = ", ".join(sorted(kwargs)) + raise TypeError( + f"Unexpected keyword arguments passed to pytest.warns: {argnames}" + "\nUse context-manager form instead?" + ) + return WarningsChecker(expected_warning, match_expr=match, _ispytest=True) + else: + func = args[0] + if not callable(func): + raise TypeError(f"{func!r} object (type: {type(func)}) must be callable") + with WarningsChecker(expected_warning, _ispytest=True): + return func(*args[1:], **kwargs) + + +class WarningsRecorder(warnings.catch_warnings): # type:ignore[type-arg] + """A context manager to record raised warnings. + + Each recorded warning is an instance of :class:`warnings.WarningMessage`. + + Adapted from `warnings.catch_warnings`. + + .. note:: + ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated + differently; see :ref:`ensuring_function_triggers`. + + """ + + def __init__(self, *, _ispytest: bool = False) -> None: + check_ispytest(_ispytest) + super().__init__(record=True) + self._entered = False + self._list: list[warnings.WarningMessage] = [] + + @property + def list(self) -> list[warnings.WarningMessage]: + """The list of recorded warnings.""" + return self._list + + def __getitem__(self, i: int) -> warnings.WarningMessage: + """Get a recorded warning by index.""" + return self._list[i] + + def __iter__(self) -> Iterator[warnings.WarningMessage]: + """Iterate through the recorded warnings.""" + return iter(self._list) + + def __len__(self) -> int: + """The number of recorded warnings.""" + return len(self._list) + + def pop(self, cls: type[Warning] = Warning) -> warnings.WarningMessage: + """Pop the first recorded warning which is an instance of ``cls``, + but not an instance of a child class of any other match. + Raises ``AssertionError`` if there is no match. + """ + best_idx: int | None = None + for i, w in enumerate(self._list): + if w.category == cls: + return self._list.pop(i) # exact match, stop looking + if issubclass(w.category, cls) and ( + best_idx is None + or not issubclass(w.category, self._list[best_idx].category) + ): + best_idx = i + if best_idx is not None: + return self._list.pop(best_idx) + __tracebackhide__ = True + raise AssertionError(f"{cls!r} not found in warning list") + + def clear(self) -> None: + """Clear the list of recorded warnings.""" + self._list[:] = [] + + def __enter__(self) -> Self: + if self._entered: + __tracebackhide__ = True + raise RuntimeError(f"Cannot enter {self!r} twice") + _list = super().__enter__() + # record=True means it's None. + assert _list is not None + self._list = _list + warnings.simplefilter("always") + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + if not self._entered: + __tracebackhide__ = True + raise RuntimeError(f"Cannot exit {self!r} without entering first") + + super().__exit__(exc_type, exc_val, exc_tb) + + # Built-in catch_warnings does not reset entered state so we do it + # manually here for this context manager to become reusable. + self._entered = False + + +@final +class WarningsChecker(WarningsRecorder): + def __init__( + self, + expected_warning: type[Warning] | tuple[type[Warning], ...] = Warning, + match_expr: str | Pattern[str] | None = None, + *, + _ispytest: bool = False, + ) -> None: + check_ispytest(_ispytest) + super().__init__(_ispytest=True) + + msg = "exceptions must be derived from Warning, not %s" + if isinstance(expected_warning, tuple): + for exc in expected_warning: + if not issubclass(exc, Warning): + raise TypeError(msg % type(exc)) + expected_warning_tup = expected_warning + elif isinstance(expected_warning, type) and issubclass( + expected_warning, Warning + ): + expected_warning_tup = (expected_warning,) + else: + raise TypeError(msg % type(expected_warning)) + + self.expected_warning = expected_warning_tup + self.match_expr = match_expr + + def matches(self, warning: warnings.WarningMessage) -> bool: + assert self.expected_warning is not None + return issubclass(warning.category, self.expected_warning) and bool( + self.match_expr is None or re.search(self.match_expr, str(warning.message)) + ) + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + super().__exit__(exc_type, exc_val, exc_tb) + + __tracebackhide__ = True + + # BaseExceptions like pytest.{skip,fail,xfail,exit} or Ctrl-C within + # pytest.warns should *not* trigger "DID NOT WARN" and get suppressed + # when the warning doesn't happen. Control-flow exceptions should always + # propagate. + if exc_val is not None and ( + not isinstance(exc_val, Exception) + # Exit is an Exception, not a BaseException, for some reason. + or isinstance(exc_val, Exit) + ): + return + + def found_str() -> str: + return pformat([record.message for record in self], indent=2) + + try: + if not any(issubclass(w.category, self.expected_warning) for w in self): + fail( + f"DID NOT WARN. No warnings of type {self.expected_warning} were emitted.\n" + f" Emitted warnings: {found_str()}." + ) + elif not any(self.matches(w) for w in self): + fail( + f"DID NOT WARN. No warnings of type {self.expected_warning} matching the regex were emitted.\n" + f" Regex: {self.match_expr}\n" + f" Emitted warnings: {found_str()}." + ) + finally: + # Whether or not any warnings matched, we want to re-emit all unmatched warnings. + for w in self: + if not self.matches(w): + warnings.warn_explicit( + message=w.message, + category=w.category, + filename=w.filename, + lineno=w.lineno, + module=w.__module__, + source=w.source, + ) + + # Currently in Python it is possible to pass other types than an + # `str` message when creating `Warning` instances, however this + # causes an exception when :func:`warnings.filterwarnings` is used + # to filter those warnings. See + # https://github.com/python/cpython/issues/103577 for a discussion. + # While this can be considered a bug in CPython, we put guards in + # pytest as the error message produced without this check in place + # is confusing (#10865). + for w in self: + if type(w.message) is not UserWarning: + # If the warning was of an incorrect type then `warnings.warn()` + # creates a UserWarning. Any other warning must have been specified + # explicitly. + continue + if not w.message.args: + # UserWarning() without arguments must have been specified explicitly. + continue + msg = w.message.args[0] + if isinstance(msg, str): + continue + # It's possible that UserWarning was explicitly specified, and + # its first argument was not a string. But that case can't be + # distinguished from an invalid type. + raise TypeError( + f"Warning must be str or Warning, got {msg!r} (type {type(msg).__name__})" + ) diff --git a/shared/package-files/33/33fc889cbff57bb78c913bb6c24c5d52bd02f3cba0f4b1cb2913340294a6ec1a/blob b/shared/package-files/33/33fc889cbff57bb78c913bb6c24c5d52bd02f3cba0f4b1cb2913340294a6ec1a/blob new file mode 100644 index 0000000000000000000000000000000000000000..3ad00565549968629376276f2a304dbce070076a --- /dev/null +++ b/shared/package-files/33/33fc889cbff57bb78c913bb6c24c5d52bd02f3cba0f4b1cb2913340294a6ec1a/blob @@ -0,0 +1,113 @@ +# Copyright (C) 2001-2006 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""email package exception classes.""" + + +class MessageError(Exception): + """Base class for errors in the email package.""" + + +class MessageParseError(MessageError): + """Base class for message parsing errors.""" + + +class HeaderParseError(MessageParseError): + """Error while parsing headers.""" + + +class BoundaryError(MessageParseError): + """Couldn't find terminating boundary.""" + + +class MultipartConversionError(MessageError, TypeError): + """Conversion to a multipart is prohibited.""" + + +class CharsetError(MessageError): + """An illegal charset was given.""" + + +# These are parsing defects which the parser was able to work around. +class MessageDefect(ValueError): + """Base class for a message defect.""" + + def __init__(self, line=None): + if line is not None: + super().__init__(line) + self.line = line + +class NoBoundaryInMultipartDefect(MessageDefect): + """A message claimed to be a multipart but had no boundary parameter.""" + +class StartBoundaryNotFoundDefect(MessageDefect): + """The claimed start boundary was never found.""" + +class CloseBoundaryNotFoundDefect(MessageDefect): + """A start boundary was found, but not the corresponding close boundary.""" + +class FirstHeaderLineIsContinuationDefect(MessageDefect): + """A message had a continuation line as its first header line.""" + +class MisplacedEnvelopeHeaderDefect(MessageDefect): + """A 'Unix-from' header was found in the middle of a header block.""" + +class MissingHeaderBodySeparatorDefect(MessageDefect): + """Found line with no leading whitespace and no colon before blank line.""" +# XXX: backward compatibility, just in case (it was never emitted). +MalformedHeaderDefect = MissingHeaderBodySeparatorDefect + +class MultipartInvariantViolationDefect(MessageDefect): + """A message claimed to be a multipart but no subparts were found.""" + +class InvalidMultipartContentTransferEncodingDefect(MessageDefect): + """An invalid content transfer encoding was set on the multipart itself.""" + +class UndecodableBytesDefect(MessageDefect): + """Header contained bytes that could not be decoded""" + +class InvalidBase64PaddingDefect(MessageDefect): + """base64 encoded sequence had an incorrect length""" + +class InvalidBase64CharactersDefect(MessageDefect): + """base64 encoded sequence had characters not in base64 alphabet""" + +class InvalidBase64LengthDefect(MessageDefect): + """base64 encoded sequence had invalid length (1 mod 4)""" + +# These errors are specific to header parsing. + +class HeaderDefect(MessageDefect): + """Base class for a header defect.""" + + def __init__(self, *args, **kw): + super().__init__(*args, **kw) + +class InvalidHeaderDefect(HeaderDefect): + """Header is not valid, message gives details.""" + +class HeaderMissingRequiredValue(HeaderDefect): + """A header that must have a value had none""" + +class NonPrintableDefect(HeaderDefect): + """ASCII characters outside the ascii-printable range found""" + + def __init__(self, non_printables): + super().__init__(non_printables) + self.non_printables = non_printables + + def __str__(self): + return ("the following ASCII non-printables found in header: " + "{}".format(self.non_printables)) + +class ObsoleteHeaderDefect(HeaderDefect): + """Header uses syntax declared obsolete by RFC 5322""" + +class NonASCIILocalPartDefect(HeaderDefect): + """local_part contains non-ASCII characters""" + # This defect only occurs during unicode parsing, not when + # parsing messages decoded from binary. + +class InvalidDateDefect(HeaderDefect): + """Header has unparsable or invalid date""" diff --git a/shared/package-files/33/33ffa2f718e123fd1c4e536bb4a471978515787ee9fbf7806a92073a787a733a/blob b/shared/package-files/33/33ffa2f718e123fd1c4e536bb4a471978515787ee9fbf7806a92073a787a733a/blob new file mode 100644 index 0000000000000000000000000000000000000000..485d5a75a29c1ad8f39f4558ce4759797951baa1 --- /dev/null +++ b/shared/package-files/33/33ffa2f718e123fd1c4e536bb4a471978515787ee9fbf7806a92073a787a733a/blob @@ -0,0 +1,14 @@ +import os.path +import sys + + +# Enable running IDLE with idlelib in a non-standard location. +# This was once used to run development versions of IDLE. +# Because PEP 434 declared idle.py a public interface, +# removal should require deprecation. +idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if idlelib_dir not in sys.path: + sys.path.insert(0, idlelib_dir) + +from idlelib.pyshell import main # This is subject to change +main() diff --git a/shared/package-files/34/34048a84478aee7a9955cbe83bfff8581662b1119da716f1a3c9ddfca78eba6f/blob b/shared/package-files/34/34048a84478aee7a9955cbe83bfff8581662b1119da716f1a3c9ddfca78eba6f/blob new file mode 100644 index 0000000000000000000000000000000000000000..90b56ca08633b02d6e402577a30bedd0561a4791 --- /dev/null +++ b/shared/package-files/34/34048a84478aee7a9955cbe83bfff8581662b1119da716f1a3c9ddfca78eba6f/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34048a84478aee7a9955cbe83bfff8581662b1119da716f1a3c9ddfca78eba6f +size 151740 diff --git a/shared/package-files/34/3406568f50200cca5329a788f90922130a1b59f3c14dd467e2f2e55ab0af22a5/blob b/shared/package-files/34/3406568f50200cca5329a788f90922130a1b59f3c14dd467e2f2e55ab0af22a5/blob new file mode 100644 index 0000000000000000000000000000000000000000..2fbbd8f6c3ae19d4c85025c0221c46116e6ff41d --- /dev/null +++ b/shared/package-files/34/3406568f50200cca5329a788f90922130a1b59f3c14dd467e2f2e55ab0af22a5/blob @@ -0,0 +1,852 @@ +# mypy: ignore-errors + +import datetime +import difflib +import functools +import inspect +import json +import os +import re +import tempfile +import threading +import unittest +from typing import Any, Callable, Dict, List, Optional, Tuple, Union + +import torch + +import torch._dynamo + +import torch.utils._pytree as pytree +from torch._dynamo.utils import clone_input +from torch._subclasses.schema_check_mode import SchemaCheckMode +from torch._utils_internal import get_file_path_2 +from torch.overrides import TorchFunctionMode +from torch.testing._internal.optests import ( + aot_autograd_check, + autograd_registration_check, + fake_check, +) + + +def dontGenerateOpCheckTests(reason: str): + def inner(fun): + fun._torch_dont_generate_opcheck_tests = True + return fun + + return inner + + +def is_abstract(tensor: torch.Tensor) -> bool: + if tensor.is_meta: + return True + if torch._subclasses.fake_tensor.is_fake(tensor): + return True + return False + + +def safe_schema_check( + op: torch._ops.OpOverload, + args: Tuple[Any, ...], + kwargs: Dict[str, Any], + *, + copy_inputs: bool = True, +) -> Any: + if copy_inputs: + args, kwargs = deepcopy_tensors((args, kwargs)) + if pytree.tree_any_only(torch.Tensor, is_abstract, (args, kwargs)): + return None + with SchemaCheckMode(): + result = op(*args, **kwargs) + return result + + +def safe_autograd_registration_check( + op: torch._ops.OpOverload, + args: Tuple[Any, ...], + kwargs: Dict[str, Any], + *, + copy_inputs: bool = True, +) -> None: + if pytree.tree_any_only(torch.Tensor, is_abstract, (args, kwargs)): + return + if copy_inputs: + args, kwargs = deepcopy_tensors((args, kwargs)) + # Don't perform autograd_registration_check if none of the inputs require grad. + if not pytree.tree_any_only( + torch.Tensor, lambda x: x.requires_grad, (args, kwargs) + ): + return + return autograd_registration_check(op, args, kwargs) + + +def safe_fake_check( + op: torch._ops.OpOverload, + args: Tuple[Any, ...], + kwargs: Dict[str, Any], + *, + copy_inputs: bool = True, +) -> None: + if pytree.tree_any_only(torch.Tensor, is_abstract, (args, kwargs)): + return None + if copy_inputs: + args, kwargs = deepcopy_tensors((args, kwargs)) + return fake_check(op, args, kwargs) + + +def safe_aot_autograd_check( + op: torch._ops.OpOverload, + args: Tuple[Any, ...], + kwargs: Dict[str, Any], + dynamic: bool, + *, + copy_inputs: bool = True, +) -> Any: + # NB: copy_inputs does nothing for aot_autograd_check: it always needs to copy + # inputs. + if pytree.tree_any_only(torch.Tensor, is_abstract, (args, kwargs)): + return None + + def func(*args, **kwargs): + args, kwargs = pytree.tree_map_only(torch.Tensor, torch.clone, (args, kwargs)) + return op(*args, **kwargs) + + # aot_autograd_check runs func(*args, **kwargs) multiple times + # and assumes `func` does not modify its inputs. + return aot_autograd_check(func, args, kwargs, dynamic, check_gradients="auto") + + +def deepcopy_tensors(inputs: Any) -> Any: + return pytree.tree_map_only(torch.Tensor, clone_input, inputs) + + +# Test util requirements +# - The test util must have signature (op: OpOverload, args, kwargs) +# - The test util must NOT mutate args, kwargs. +# - The test utils in this list must not be prefixes of each other. For example, +# having both "test_schema" and "test_schema_is_functional" is NOT OK. +# - The order of items in this dict matters (for opcheck), we'll run them +# in order. +ALL_TEST_UTILS = { + "test_schema": safe_schema_check, + "test_autograd_registration": safe_autograd_registration_check, + "test_faketensor": safe_fake_check, + "test_aot_dispatch_static": functools.partial( + safe_aot_autograd_check, + dynamic=False, + ), + "test_aot_dispatch_dynamic": functools.partial( + safe_aot_autograd_check, + dynamic=True, + ), +} + +GDOC = "https://docs.google.com/document/d/1Pj5HRZvdOq3xpFpbEjUZp2hBovhy7Wnxw14m6lF2154/edit" + +DEFAULT_TEST_UTILS = [ + "test_schema", + "test_autograd_registration", + "test_faketensor", + "test_aot_dispatch_static", + "test_aot_dispatch_dynamic", +] + + +def generate_opcheck_tests( + testcase: Any, + namespaces: List[str], + failures_dict_path: Optional[str] = None, + additional_decorators: Dict[str, Callable] = None, + test_utils: List[str] = DEFAULT_TEST_UTILS, +) -> None: + """Given an existing TestCase, use the existing tests to generate + additional validation tests for custom operators. + + For {all existing tests in the TestCase} x {all test utils}, + we will generate one new test. The new test runs a TorchFunctionMode + that intercepts ``op(*args, **kwargs)`` calls and invokes + ``test_util(op, *args, **kwargs)``, where ``op`` is an operator. + + The test_util that we support are in ALL_TEST_UTILS. They are: + - test_schema: This runs SchemaCheckMode. + - test_autograd_registration: This runs autograd_registration_check. + - test_faketensor: This runs CrossRefFakeMode. + - test_aot_dispatch_static: This runs aot_autograd_check, which: + checks that the outputs (and gradients, if they are computable) + are the same under eager-mode PyTorch and using AOTAutograd. + - test_aot_dispatch_dynamic: Same as aot_dispatch_static, but + runs AOTAutograd using dynamic shapes instead of static shapes. + + The generated test will have name ``{test_util}__{original_name}``. + For example, if there is a method named ``test_cumsum``, then + we will generate a ``test_schema__test_cumsum``, + ``test_faketensor__test_cumsum``, etc. + + For more details, see https://docs.google.com/document/d/1Pj5HRZvdOq3xpFpbEjUZp2hBovhy7Wnxw14m6lF2154/edit + + Args: + testcase: The testcase we will modify and generate additional tests for. + namespaces: We will only intercept calls to custom operators with these + namespaces. + failures_dict_path: See ``validate_failures_dict_structure`` for more details + test_utils: a list of test_utils to generate. Example: ["test_schema", "test_faketensor"] + """ + if additional_decorators is None: + additional_decorators = {} + test_methods = [ + m + for m in dir(testcase) + if m.startswith("test_") and callable(getattr(testcase, m)) + ] + if failures_dict_path is None: + # The default failures_dict_path is failures_dict.json in + # the same directory as the test file. + prev_frame = inspect.currentframe().f_back + filename = inspect.getframeinfo(prev_frame)[0] + failures_dict_path = get_file_path_2( + os.path.dirname(filename), "failures_dict.json" + ) + failures_dict = FailuresDict.load( + failures_dict_path, create_file=should_update_failures_dict() + ) + validate_failures_dict_structure(failures_dict, test_utils, testcase) + validate_failures_dict_formatting(failures_dict_path) + + def construct_method(attr, prefix, tester): + method = getattr(testcase, attr) + if getattr(method, "_torch_dont_generate_opcheck_tests", False): + return + new_method_name = prefix + "__" + attr + + @functools.wraps(method) + def new_method(*args, **kwargs): + with OpCheckMode( + namespaces, + prefix, + tester, + failures_dict, + f"{testcase.__name__}.{new_method_name}", + failures_dict_path, + ): + result = method(*args, **kwargs) + return result + + if pytestmark := new_method.__dict__.get("pytestmark"): + import pytest + + # check if we need to simplify the parametrize marks + # NB: you need to add this mark to your pytest.ini + opcheck_only_one = False + for mark in pytestmark: + if isinstance(mark, pytest.Mark) and mark.name == "opcheck_only_one": + opcheck_only_one = True + + if opcheck_only_one: + new_pytestmark = [] + for mark in pytestmark: + if isinstance(mark, pytest.Mark) and mark.name == "parametrize": + argnames, argvalues = mark.args + assert not mark.kwargs, "NYI" + # Special case for device, we want to run on all + # devices + if argnames != "device": + new_pytestmark.append( + pytest.mark.parametrize( + argnames, (next(iter(argvalues)),) + ) + ) + continue + new_pytestmark.append(mark) + new_method.__dict__["pytestmark"] = new_pytestmark + + if new_method_name in additional_decorators: + for dec in additional_decorators[new_method_name]: + new_method = dec(new_method) + + if hasattr(testcase, new_method_name): + raise RuntimeError( + f"Tried to autogenerate {new_method_name} but {testcase} already " + f"has method named {new_method_name}. Please rename the original " + f"method on the TestCase." + ) + setattr(testcase, new_method_name, new_method) + + test_utils = {name: ALL_TEST_UTILS[name] for name in test_utils} + for attr in test_methods: + for prefix, tester in test_utils.items(): + construct_method(attr, prefix, tester) + + generate_tag_tests(testcase, failures_dict, additional_decorators) + + +def generate_tag_tests(testcase, failures_dict, additional_decorators): + def generate_test(qualname, definitely_not_pt2_compliant, xfailed_tests): + def inner(self): + try: + op = torch._library.utils.lookup_op(qualname) + except AttributeError as e: + # Operator not importable in this test file + raise unittest.SkipTest(f"Can't import operator {qualname}") from e + op_marked_as_compliant = torch.Tag.pt2_compliant_tag in op.tags + if not op_marked_as_compliant: + return + if not definitely_not_pt2_compliant: + return + raise AssertionError( + f"op '{qualname}' was tagged with torch.Tag.pt2_compliant_tag " + f"but it failed some of the generated opcheck tests " + f"({xfailed_tests}). This may lead to silent correctness issues, " + f"please fix this." + ) + + return inner + + for qualname, test_dict in failures_dict.data.items(): + xfailed_tests = [ + test + for test, status_dict in test_dict.items() + # We're about to delete the following test after Ed's PR + # to specialize on C++ .size() calls + if "test_aot_dispatch_static" not in test + and status_dict["status"] == "xfail" + ] + definitely_not_pt2_compliant = len(xfailed_tests) > 0 + generated = generate_test(qualname, definitely_not_pt2_compliant, xfailed_tests) + + # Could result in collisions, but unlikely. We'll raise if we see one below. + mangled_qualname = qualname.replace("::", "_").replace(".", "_") + test_name = "test_pt2_compliant_tag_" + mangled_qualname + + # You can skip this test via the additional_decorators argument + # in generate_opcheck_tests + if test_name in additional_decorators: + for decorator in additional_decorators[test_name]: + generated = decorator(generated) + + if hasattr(testcase, test_name): + raise RuntimeError( + f"Tried to generate a test named {test_name}, but it exists " + f"already. This could be because of a name collision (where " + f"we generated two tests with the same name), or where we " + f"generated a test with the same name as an existing test." + ) + setattr(testcase, test_name, generated) + + +TEST_OPTIONS = ("xfail", "skip", "xsuccess") + + +def validate_failures_dict_formatting(failures_dict_path: str) -> None: + with open(failures_dict_path) as fp: + actual = fp.read() + failures_dict = FailuresDict.load(failures_dict_path) + expected = failures_dict._save(to_str=True) + if actual == expected: + return + if should_update_failures_dict(): + failures_dict = FailuresDict.load(failures_dict_path) + failures_dict.save() + return + expected = expected.splitlines(1) + actual = actual.splitlines(1) + diff = difflib.unified_diff(actual, expected) + diff = "".join(diff) + raise RuntimeError( + f"\n{diff}\n\nExpected the failures dict to be formatted " + f"a certain way. Please see the above diff; you can correct " + f"this either manually or by re-running the test with " + f"PYTORCH_OPCHECK_ACCEPT=1" + ) + + +def validate_failures_dict_structure( + failure_dict: "FailuresDict", test_utils: List[str], testcase: Any +) -> None: + """Validates the failures dict. + + The failure dict looks something like the following. + It maps operator name (qualname) to a list of autogenerated tests. + Each autogenerated test may have a check for the operator (if the operator is + called by the test); the dictionary specifies if we should skip the check, + or if we expect some check to fail. + + { + "fbgemm::split_lengths": { + "test_schema__test_split_lengths": { + "comment": "you can put whatever you want into the comment section", + "status": "xfail", + } + "test_schema__test_split_lengths_empty": { + "comment": "", + "status": "skip", + }, + }, + "fbgemm::gather_lengths": { + "test_schema__test_gather_lengths": { + "comment": "", + "status": "skip", + }, + }, + } + + """ + failure_dict = failure_dict.data + qualnames = list(failure_dict.keys()) + for test_to_option in failure_dict.values(): + test_names = list(test_to_option.keys()) + for test_name, test_dict in test_to_option.items(): + if set(test_dict.keys()) != set({"comment", "status"}): + raise RuntimeError( + "in failures_dict, expected sub-dict to have keys 'comment' and 'status'" + ) + test_option = test_dict["status"] + if test_option not in TEST_OPTIONS: + raise RuntimeError( + f"In failures_dict, got status={test_option} but it needs to be in {TEST_OPTIONS}" + ) + test_class, actual_test_name = test_name.split(".") + if not any(actual_test_name.startswith(test) for test in test_utils): + raise RuntimeError( + f"In failures_dict, test name '{test_name}' should begin with one of {test_utils}" + ) + for test in test_utils: + if not actual_test_name.startswith(test): + continue + base_test_name = actual_test_name[len(test) + 2 :] + # remove potential pytest parametrization suffix + base_test_name = re.sub(r"\[.*\]", "", base_test_name) + if testcase.__name__ != test_class: + continue + if hasattr(testcase, base_test_name): + continue + raise RuntimeError( + f"In failures dict, got test name '{test_name}'. We parsed this as " + f"running test '{test}' on '{base_test_name}', but " + f"{base_test_name} does not exist on the TestCase '{testcase.__name__}]. " + f"Maybe you need to change the test name?" + ) + + +def should_update_failures_dict() -> bool: + key = "PYTORCH_OPCHECK_ACCEPT" + return key in os.environ and os.environ[key] == "1" + + +_is_inside_opcheck_mode = threading.local() +_is_inside_opcheck_mode.value = False + + +def is_inside_opcheck_mode(): + return _is_inside_opcheck_mode.value + + +class OpCheckMode(TorchFunctionMode): + """ + For a given test, OpCheckMode intercepts calls to operators and runs + test_util(op, args, kwargs) for each intercepted (op, args, kwargs). + """ + + def __init__( + self, + namespaces: List[str], + test_util_name: str, + test_util: Callable, + failures_dict: "FailuresDict", + test_name: str, + failures_dict_path: str, + ): + # We will intercept calls to ops with these namespaces + self.namespaces = namespaces + # The test utility function. Its signature should be (op, args, kwargs) -> None. + # Examples of test utilities are: schema_check, make_fx_check + self.test_util = test_util + self.test_util_name = test_util_name + # The name of the test that is running this OpCheckMode. + self.test_name = test_name + # Maps qualname -> test_name -> skip/xfail + # Tells us if we should skip a test or assert that there is a failure. + self.failures_dict = failures_dict + # Location of the failures dict. Makes it so that the error message is better. + self.failures_dict_path = failures_dict_path + + # OpCheckMode surpresses errors, collects them here, and then raises them on exit. + # Maps qualname -> List[(Exception, func, maybe args, maybe kwargs)] + self.seen_ops_to_errors = {} + + def maybe_raise_errors_on_exit(self) -> None: + # Check expected failures first + for qualname in self.seen_ops_to_errors.keys(): + option = self.failures_dict.get_status(qualname, self.test_name) + if len(self.seen_ops_to_errors[qualname]) == 0: + if should_update_failures_dict(): + self.failures_dict.set_status( + qualname, self.test_name, "xsuccess", comment="" + ) + else: + if option == "xfail": + raise OpCheckError( + f"generate_opcheck_tests: Unexpected success for operator " + f"{qualname} on test {self.test_name}. This may mean that " + f"you have fixed this test failure. Please rerun the test with " + f"PYTORCH_OPCHECK_ACCEPT=1 to automatically update the test runner " + f"or manually remove the " + f"expected failure in the failure dict at " + f"{self.failures_dict_path}" + f"For more details, see " + f"{GDOC}" + ) + continue + failed_ops = [] + for qualname in self.seen_ops_to_errors.keys(): + option = self.failures_dict.get_status(qualname, self.test_name) + if option != "xsuccess": + continue + if len(self.seen_ops_to_errors[qualname]) == 0: + continue + failed_ops.append(qualname) + if not failed_ops: + return + + if should_update_failures_dict(): + for op in failed_ops: + self.failures_dict.set_status(op, self.test_name, "xfail") + return + + # Raise from the first error but also report about all of them to make + # recording xfails easier. + ex, op, args, kwargs = self.seen_ops_to_errors[failed_ops[0]][0] + repro_command = generate_repro( + self.test_util_name, op, args, kwargs, save_data=should_print_better_repro() + ) + raise OpCheckError( + f"Test generated by `generate_opcheck_tests`, {self.test_name}, " + f"failed on operators {failed_ops}. This usually means that the " + f"operators are not implemented correctly and may lead to silently " + f"incorrect behavior. Set PYTORCH_OPCHECK_PRINT_BETTER_REPRO=1 for a standalone repro, " + f"or please see " + f"{GDOC} " + f"for more recommendations. " + f"To reproduce this problem locally, try to run the following:\n{repro_command}" + ) from ex + + def __enter__(self, *args, **kwargs): + self.prev_is_opcheck_mode = _is_inside_opcheck_mode.value + self.prev_dynamo_disable = os.environ.get("TORCHDYNAMO_DISABLE", "") + _is_inside_opcheck_mode.value = True + os.environ["TORCHDYNAMO_DISABLE"] = "1" + return super().__enter__(*args, **kwargs) + + def __exit__(self, *args, **kwargs): + _is_inside_opcheck_mode.value = self.prev_is_opcheck_mode + os.environ["TORCHDYNAMO_DISABLE"] = self.prev_dynamo_disable + try: + self.maybe_raise_errors_on_exit() + if should_update_failures_dict(): + self.failures_dict.save() + finally: + result = super().__exit__(*args, **kwargs) + return result + + def run_test_util(self, op, args, kwargs): + try: + self.test_util(op, args, kwargs, copy_inputs=False) + except torch._subclasses.fake_tensor.UnsupportedFakeTensorException: + # We might get here if the input is already a FakeTensor + # or if we're in a torch.compile block. Just ignore these + # since we can't handle them and reporting them as failures + # is too noisy. + pass + + def __torch_function__(self, func, types, args=(), kwargs=None): + kwargs = kwargs if kwargs else {} + + # Only intercept calls to operators + if not isinstance(func, (torch._ops.OpOverloadPacket, torch._ops.OpOverload)): + return func(*args, **kwargs) + if ( + torch.jit.is_tracing() + or torch.jit.is_scripting() + or torch._dynamo.is_compiling() + ): + return func(*args, **kwargs) + # Pre-existing code may not use the .default overload. If we see an + # OpOverloadPacket and we cannot resolve the overload, then we just throw + # and ask the user to clarify. Otherwise, we attempt to resolve the overload. + if isinstance(func, torch._ops.OpOverloadPacket): + func = resolve_unique_overload_or_throw(func) + qualname = func.name() + ns = qualname.split("::")[0] + if ns not in self.namespaces: + return func(*args, **kwargs) + + args_c, kwargs_c = deepcopy_tensors((args, kwargs)) + result = func(*args, **kwargs) + + option = self.failures_dict.get_status(qualname, self.test_name) + if option == "xsuccess" or option == "xfail": + # Surpress all errors during execution. Raise them during __exit__. + try: + if qualname not in self.seen_ops_to_errors: + self.seen_ops_to_errors[qualname] = [] + self.run_test_util(func, args_c, kwargs_c) + except Exception as ex: + if should_print_better_repro(): + self.seen_ops_to_errors[qualname].append((ex, func, args, kwargs)) + else: + self.seen_ops_to_errors[qualname].append((ex, func, None, None)) + elif option == "skip": + pass + return result + + +def should_print_better_repro() -> None: + """If set, the tests generated by `generate_opcheck_tests` will print a + repro command on failure. + + In order to print the repro command, we need to save some tensors to disk. + These will be saved under the following directory: + {tempfile.gettempdir()}/pytorch_opcheck_safe_to_delete/. + + Although this is a temp folder, it will usually not automatically get cleaned + up, so you'll need to manually delete it. + """ + key = "PYTORCH_OPCHECK_PRINT_BETTER_REPRO" + if key not in os.environ: + return False + value = os.environ[key] + return value == "1" or value == 1 + + +def opcheck( + op: torch._ops.OperatorBase, + args: Tuple[Any, ...], + kwargs: Optional[Dict[str, Any]] = None, + *, + test_utils: Union[str, List[str]] = "ALL", + raise_exception: bool = True, +) -> Dict[str, str]: + """Given an operator and some sample arguments, tests if the operator is + registered correctly. + + We test the following (which are important for correctness in eager-mode + PyTorch and with torch.compile): + - test_schema: if the operator's schema is correct. + - test_autograd_registration: if autograd was registered correctly, + i.e. to the correct DispatchKey. + - test_faketensor: If the operator has a FakeTensor implementation + (and if it is correct). + - test_aot_dispatch_static: If the operator works with + AOTAutograd/AOTDispatch, which is one of the parts in the PT2 stack. + Checks that the outputs (and gradients, if they are computable) + of the operator are the same under eager-mode PyTorch and torch.compile. + - test_aot_dispatch_dynamic: Same as aot_dispatch_static, but + tests dynamic shapes instead of static shapes. + + For best results, please call ``opcheck`` multiple times with a + representative set of inputs. For example, if your operator supports + autograd, please use ``opcheck`` with inputs that require_grad. + + Args: + op: The operator. Should look like torch.ops.aten.foo + args: The args to the operator + kwargs: The kwargs to the operator + test_utils: Tests that we should run. Default: all of them. + Example: ["test_schema", "test_faketensor"] + raise_exception: If we should raise an exception on the first + error. If False, we will return a dict with information + on if each test passed or not. + + """ + + if kwargs is None: + kwargs = {} + if isinstance(op, torch._ops.OpOverloadPacket): + op = resolve_unique_overload_or_throw(op) + if not isinstance(op, torch._ops.OpOverload): + raise ValueError( + f"opcheck(op, ...): op must be instance of torch._ops.OpOverload, " + f"e.g. torch.ops.aten.sin.default, got {type(op)}" + ) + if test_utils == "ALL": + test_utils = tuple(ALL_TEST_UTILS.keys()) + if isinstance(test_utils, str): + test_utils = (test_utils,) + if not isinstance(test_utils, (tuple, list)) or not set(test_utils).issubset( + ALL_TEST_UTILS.keys() + ): + raise ValueError( + f"opcheck(op, ..., test_utils={test_utils}), expected test_utils " + f"to be subset of {tuple(ALL_TEST_UTILS.keys())} but it was not" + ) + + results_dict = {} + for test_util in test_utils: + tester = ALL_TEST_UTILS[test_util] + try: + tester(op, args, kwargs) + results_dict[test_util] = "SUCCESS" + except Exception as ex: + if raise_exception: + raise OpCheckError( + f"opcheck(op, ...): {test_util} failed with {ex} " + f"(scroll up for stack trace)" + ) from ex + results_dict[test_util] = ex + return results_dict + + +class OpCheckError(Exception): + pass + + +def generate_repro( + test: str, + op: torch._ops.OpOverload, + args: Tuple[Any, ...], + kwargs: Dict[str, Any], + *, + save_data: bool, + dry_run: bool = False, +) -> str: + if save_data: + now = datetime.datetime.now() + path = os.path.join(tempfile.gettempdir(), "pytorch_opcheck_safe_to_delete") + unix_timestamp = datetime.datetime.timestamp(now) * 100000 + filepath = os.path.join(path, f"repro_{unix_timestamp}.pt") + if not dry_run: + os.makedirs(path, exist_ok=True) + torch.save((args, kwargs), filepath) + args_kwargs = f'args, kwargs = torch.load("{filepath}")' + else: + args_kwargs = ( + "# If you rerun your test with PYTORCH_OPCHECK_PRINT_BETTER_REPRO=1\n" + "# we will fill them in same (args, kwargs) as in your test\n" + "args = () # args to the operator\n" + "kwargs = {} # kwargs to the operator" + ) + + ns, name = op._schema.name.split("::") + overload = op._overloadname + + repro_command = ( + f"# =========================================================\n" + f"# BEGIN REPRO SCRIPT\n" + f"# =========================================================\n" + f"import torch\n" + f"from torch.testing._internal.optests import opcheck\n" + f"\n" + f"# Make sure you have loaded the library that contains the op\n" + f"# via an import or torch.ops.load_library(...)\n" + f"op = torch.ops.{ns}.{name}.{overload}\n" + f"\n" + f"{args_kwargs}\n" + f'opcheck(op, args, kwargs, test_utils="{test}")\n' + f"# =========================================================\n" + f"# END REPRO SCRIPT\n" + f"# =========================================================\n" + ) + return repro_command + + +def resolve_unique_overload_or_throw( + op: torch._ops.OpOverloadPacket, +) -> torch._ops.OpOverload: + all_schemas = torch._C._jit_get_schemas_for_operator(op._qualified_op_name) + if len(all_schemas) != 1: + raise RuntimeError( + f"opcheck can only test operators without overloads. " + f"Got the following overloads for {op._qualified_op_name}: " + f"{[schema.overload_name for schema in all_schemas]}" + ) + + overload_name = all_schemas[0].overload_name + if overload_name == "": + return op.default + return getattr(op, overload_name) + + +DUMP_OPTIONS = {"indent": 2, "sort_keys": True} + + +FailuresDictData = Dict[str, Dict[str, Dict[str, str]]] + + +VERSION = 1 +DESCRIPTION = ( + f"This is a dict containing failures for tests autogenerated by " + f"generate_opcheck_tests. " + f"For more details, please see {GDOC}" +) + + +class FailuresDict: + def __init__(self, path: str, data: FailuresDictData): + self.path = path + self.data = data + + @staticmethod + def load(path, *, create_file=False) -> "FailuresDict": + if create_file and not os.path.exists(path): + result = FailuresDict(path, {}) + FailuresDict.save() + return result + with open(path) as fp: + contents = fp.read() + if contents.strip() == "": + dct = { + "_description": DESCRIPTION, + "data": {}, + "_version": VERSION, + } + else: + dct = json.loads(contents) + assert "data" in dct + assert "_version" in dct and dct["_version"] == VERSION + return FailuresDict(path, dct["data"]) + + def _save(self, to_str=False) -> Optional[str]: + to_dump = { + "_description": DESCRIPTION, + "data": self.data, + "_version": VERSION, + } + # json.dumps doesn't end with a newline. Let's add one because files + # should end in newlines. + serialized = json.dumps(to_dump, **DUMP_OPTIONS) + "\n" + if to_str: + return serialized + with open(self.path, "w") as fp: + fp.write(serialized) + return None + + def save(self) -> None: + return self._save() + + def get_status(self, qualname: str, test_name: str) -> str: + if qualname not in self.data: + return "xsuccess" + dct = self.data[qualname] + if test_name not in dct: + return "xsuccess" + return dct[test_name]["status"] + + def set_status( + self, + qualname: str, + test_name: str, + status: str, + *, + comment: Optional[str] = None, + ): + if qualname not in self.data: + self.data[qualname] = {} + dct = self.data[qualname] + if test_name not in dct: + dct[test_name] = {"status": None, "comment": ""} + + if status == "xsuccess": + # The default status is "xsuccess". + del dct[test_name] + else: + dct[test_name]["status"] = status + if comment is not None: + dct[test_name]["comment"] = comment diff --git a/shared/package-files/34/340662fb86740eb95029992470aad6c681f1cd6b8a17163c8a9842070780f639/blob b/shared/package-files/34/340662fb86740eb95029992470aad6c681f1cd6b8a17163c8a9842070780f639/blob new file mode 100644 index 0000000000000000000000000000000000000000..dba447e30cf579c9f2f5c0bd917a4e0837143ed3 --- /dev/null +++ b/shared/package-files/34/340662fb86740eb95029992470aad6c681f1cd6b8a17163c8a9842070780f639/blob @@ -0,0 +1,69 @@ +import pytest + +from pandas.util._validators import ( + validate_bool_kwarg, + validate_kwargs, +) + + +@pytest.fixture +def _fname(): + return "func" + + +def test_bad_kwarg(_fname): + good_arg = "f" + bad_arg = good_arg + "o" + + compat_args = {good_arg: "foo", bad_arg + "o": "bar"} + kwargs = {good_arg: "foo", bad_arg: "bar"} + + msg = rf"{_fname}\(\) got an unexpected keyword argument '{bad_arg}'" + + with pytest.raises(TypeError, match=msg): + validate_kwargs(_fname, kwargs, compat_args) + + +@pytest.mark.parametrize("i", range(1, 3)) +def test_not_all_none(i, _fname): + bad_arg = "foo" + msg = ( + rf"the '{bad_arg}' parameter is not supported " + rf"in the pandas implementation of {_fname}\(\)" + ) + + compat_args = {"foo": 1, "bar": "s", "baz": None} + + kwarg_keys = ("foo", "bar", "baz") + kwarg_vals = (2, "s", None) + + kwargs = dict(zip(kwarg_keys[:i], kwarg_vals[:i])) + + with pytest.raises(ValueError, match=msg): + validate_kwargs(_fname, kwargs, compat_args) + + +def test_validation(_fname): + # No exceptions should be raised. + compat_args = {"f": None, "b": 1, "ba": "s"} + + kwargs = {"f": None, "b": 1} + validate_kwargs(_fname, kwargs, compat_args) + + +@pytest.mark.parametrize("name", ["inplace", "copy"]) +@pytest.mark.parametrize("value", [1, "True", [1, 2, 3], 5.0]) +def test_validate_bool_kwarg_fail(name, value): + msg = ( + f'For argument "{name}" expected type bool, ' + f"received type {type(value).__name__}" + ) + + with pytest.raises(ValueError, match=msg): + validate_bool_kwarg(value, name) + + +@pytest.mark.parametrize("name", ["inplace", "copy"]) +@pytest.mark.parametrize("value", [True, False, None]) +def test_validate_bool_kwarg(name, value): + assert validate_bool_kwarg(value, name) == value diff --git a/shared/package-files/34/340804f73b620686ab698b2202191d69227e736b1652271c99f2cfef03d72296/blob b/shared/package-files/34/340804f73b620686ab698b2202191d69227e736b1652271c99f2cfef03d72296/blob new file mode 100644 index 0000000000000000000000000000000000000000..8fd20c7e3a8dff031501a2ded266f7c20b5d344e --- /dev/null +++ b/shared/package-files/34/340804f73b620686ab698b2202191d69227e736b1652271c99f2cfef03d72296/blob @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_BW DATE_FORMAT "%d %B %Y" + ::msgcat::mcset en_BW TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset en_BW DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/shared/package-files/34/340814de786c3fe486fd4fb6a21f372f59bd60ddf00ecbb7a1c1acf21e894a0b/blob b/shared/package-files/34/340814de786c3fe486fd4fb6a21f372f59bd60ddf00ecbb7a1c1acf21e894a0b/blob new file mode 100644 index 0000000000000000000000000000000000000000..ea0ad0a776193f01c7f8ee57d6f4d00a69ead404 --- /dev/null +++ b/shared/package-files/34/340814de786c3fe486fd4fb6a21f372f59bd60ddf00ecbb7a1c1acf21e894a0b/blob @@ -0,0 +1,20 @@ +# This file is part of Patsy +# Copyright (C) 2011-2014 Nathaniel Smith +# See file LICENSE.txt for license information. + +# This file must be kept very simple, because it is consumed from several +# places -- it is imported by patsy/__init__.py, execfile'd by setup.py, etc. + +# We use a simple scheme: +# 1.0.3 -> 1.0.3+dev -> 1.1.0 -> 1.1.0+dev +# where the +dev versions are never released into the wild, they're just what +# we stick into the VCS in between releases. +# +# This is compatible with PEP 440: +# http://legacy.python.org/dev/peps/pep-0440/ +# via the use of the "local suffix" "+dev", which is disallowed on index +# servers and causes 1.0.3+dev to sort after plain 1.0.3, which is what we +# want. (Contrast with the special suffix 1.0.3.dev, which sorts *before* +# 1.0.3.) + +__version__ = "1.0.3" diff --git a/shared/package-files/34/34088d8ebba10ea8d5a5976eb167a607cfde6617b9e021edbc018a0e3bc714a6/blob b/shared/package-files/34/34088d8ebba10ea8d5a5976eb167a607cfde6617b9e021edbc018a0e3bc714a6/blob new file mode 100644 index 0000000000000000000000000000000000000000..c6e77c68f4bca7b8eb36afa63dfc86a15659bf60 --- /dev/null +++ b/shared/package-files/34/34088d8ebba10ea8d5a5976eb167a607cfde6617b9e021edbc018a0e3bc714a6/blob @@ -0,0 +1,4 @@ +from typing import Any, List + +class CheckFieldDefaultMixin: + def check(self, **kwargs: Any) -> List[Any]: ... diff --git a/shared/package-files/34/3409fa91f7ace557894632676656e32264fe5ef7581535725dc9a23774551bd4/blob b/shared/package-files/34/3409fa91f7ace557894632676656e32264fe5ef7581535725dc9a23774551bd4/blob new file mode 100644 index 0000000000000000000000000000000000000000..46f4b2846fd708ecb81b2d665434ce6379aa1101 --- /dev/null +++ b/shared/package-files/34/3409fa91f7ace557894632676656e32264fe5ef7581535725dc9a23774551bd4/blob @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010 - 2023 Holger Krekel and others + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/shared/package-files/34/340ae18db492caaa2c933f32b35684143136371369ac1cda631c967d96790d8b/blob b/shared/package-files/34/340ae18db492caaa2c933f32b35684143136371369ac1cda631c967d96790d8b/blob new file mode 100644 index 0000000000000000000000000000000000000000..5de0601dbddaf1f443cc2aa700a6c0efa6065b02 --- /dev/null +++ b/shared/package-files/34/340ae18db492caaa2c933f32b35684143136371369ac1cda631c967d96790d8b/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API diff { + using schema = at::Tensor (const at::Tensor &, int64_t, int64_t, const c10::optional &, const c10::optional &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::diff") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "diff(Tensor self, int n=1, int dim=-1, Tensor? prepend=None, Tensor? append=None) -> Tensor") + static at::Tensor call(const at::Tensor & self, int64_t n, int64_t dim, const c10::optional & prepend, const c10::optional & append); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t n, int64_t dim, const c10::optional & prepend, const c10::optional & append); +}; + +struct TORCH_API diff_out { + using schema = at::Tensor & (const at::Tensor &, int64_t, int64_t, const c10::optional &, const c10::optional &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::diff") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "diff.out(Tensor self, int n=1, int dim=-1, Tensor? prepend=None, Tensor? append=None, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, int64_t n, int64_t dim, const c10::optional & prepend, const c10::optional & append, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t n, int64_t dim, const c10::optional & prepend, const c10::optional & append, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/34/340b69d195a8937ec92754d5444bd9683e02ab3bc84094541ce0051e5fdaba80/blob b/shared/package-files/34/340b69d195a8937ec92754d5444bd9683e02ab3bc84094541ce0051e5fdaba80/blob new file mode 100644 index 0000000000000000000000000000000000000000..b8baa47d14751ee7954e380ef16b97707bce9e0d --- /dev/null +++ b/shared/package-files/34/340b69d195a8937ec92754d5444bd9683e02ab3bc84094541ce0051e5fdaba80/blob @@ -0,0 +1,761 @@ +# mypy: ignore-errors +from __future__ import annotations + +import itertools +import railroad +import pyparsing +import dataclasses +import typing +from typing import ( + Generic, + TypeVar, + Callable, + Iterable, +) +from jinja2 import Template +from io import StringIO +import inspect +import re + + +jinja2_template_source = """\ +{% if not embed %} + + + +{% endif %} + {% if not head %} + + {% else %} + {{ head | safe }} + {% endif %} +{% if not embed %} + + +{% endif %} + +{{ body | safe }} +{% for diagram in diagrams %} +
+

{{ diagram.title }}

+
{{ diagram.text }}
+
+ {{ diagram.svg }} +
+
+{% endfor %} +{% if not embed %} + + +{% endif %} +""" + +template = Template(jinja2_template_source) + + +_bookmark_lookup = {} +_bookmark_ids = itertools.count(start=1) + +def _make_bookmark(s: str) -> str: + """ + Converts a string into a valid HTML bookmark (ID or anchor name). + """ + if s in _bookmark_lookup: + return _bookmark_lookup[s] + + # Replace invalid characters with hyphens and ensure only valid characters + bookmark = re.sub(r'[^a-zA-Z0-9-]+', '-', s) + + # Ensure it starts with a letter by adding 'z' if necessary + if not bookmark[:1].isalpha(): + bookmark = f"z{bookmark}" + + # Convert to lowercase and strip hyphens + bookmark = bookmark.lower().strip('-') + + _bookmark_lookup[s] = bookmark = f"{bookmark}-{next(_bookmark_ids):04d}" + + return bookmark + + +def _collapse_verbose_regex(regex_str: str) -> str: + if "\n" not in regex_str: + return regex_str + collapsed = pyparsing.Regex(r"#.*$").suppress().transform_string(regex_str) + collapsed = re.sub(r"\s*\n\s*", "", collapsed) + return collapsed + + +@dataclasses.dataclass +class NamedDiagram: + """ + A simple structure for associating a name with a railroad diagram + """ + + name: str + index: int + diagram: railroad.DiagramItem = None + + @property + def bookmark(self): + bookmark = _make_bookmark(self.name) + return bookmark + + +T = TypeVar("T") + + +class EachItem(railroad.Group): + """ + Custom railroad item to compose a: + + - :class:`railroad.Group` containing a + + - :class:`railroad.OneOrMore` containing a + + - :class:`railroad.Choice` of the elements in the + :class:`railroad.Each` + + with the group label indicating that all must be matched + """ + + all_label = "[ALL]" + + def __init__(self, *items) -> None: + choice_item = railroad.Choice(len(items) - 1, *items) + one_or_more_item = railroad.OneOrMore(item=choice_item) + super().__init__(one_or_more_item, label=self.all_label) + + +class AnnotatedItem(railroad.Group): + """ + Simple subclass of Group that creates an annotation label + """ + + def __init__(self, label: str, item) -> None: + super().__init__(item=item, label=f"[{label}]" if label else "") + + +class EditablePartial(Generic[T]): + """ + Acts like a functools.partial, but can be edited. In other words, it represents a type that hasn't yet been + constructed. + """ + + # We need this here because the railroad constructors actually transform the data, so can't be called until the + # entire tree is assembled + + def __init__(self, func: Callable[..., T], args: list, kwargs: dict) -> None: + self.func = func + self.args = args + self.kwargs = kwargs + + @classmethod + def from_call(cls, func: Callable[..., T], *args, **kwargs) -> EditablePartial[T]: + """ + If you call this function in the same way that you would call the constructor, + it will store the arguments as you expect. For example + ``EditablePartial.from_call(Fraction, 1, 3)() == Fraction(1, 3)`` + """ + return EditablePartial(func=func, args=list(args), kwargs=kwargs) + + @property + def name(self): + return self.kwargs["name"] + + def __call__(self) -> T: + """ + Evaluate the partial and return the result + """ + args = self.args.copy() + kwargs = self.kwargs.copy() + + # This is a helpful hack to allow you to specify varargs parameters (e.g. *args) as keyword args (e.g. + # args=['list', 'of', 'things']) + arg_spec = inspect.getfullargspec(self.func) + if arg_spec.varargs in self.kwargs: + args += kwargs.pop(arg_spec.varargs) + + return self.func(*args, **kwargs) + + +def railroad_to_html(diagrams: list[NamedDiagram], embed=False, **kwargs) -> str: + """ + Given a list of :class:`NamedDiagram`, produce a single HTML string + that visualises those diagrams. + + :params kwargs: kwargs to be passed in to the template + """ + data = [] + for diagram in diagrams: + if diagram.diagram is None: + continue + io = StringIO() + try: + css = kwargs.get("css") + diagram.diagram.writeStandalone(io.write, css=css) + except AttributeError: + diagram.diagram.writeSvg(io.write) + title = diagram.name + if diagram.index == 0: + title += " (root)" + data.append( + { + "title": title, "text": "", "svg": io.getvalue(), "bookmark": diagram.bookmark + } + ) + + return template.render(diagrams=data, embed=embed, **kwargs) + + +def resolve_partial(partial: EditablePartial[T]) -> T: + """ + Recursively resolves a collection of Partials into whatever type they are + """ + if isinstance(partial, EditablePartial): + partial.args = resolve_partial(partial.args) + partial.kwargs = resolve_partial(partial.kwargs) + return partial() + elif isinstance(partial, list): + return [resolve_partial(x) for x in partial] + elif isinstance(partial, dict): + return {key: resolve_partial(x) for key, x in partial.items()} + else: + return partial + + +def to_railroad( + element: pyparsing.ParserElement, + diagram_kwargs: typing.Optional[dict] = None, + vertical: int = 3, + show_results_names: bool = False, + show_groups: bool = False, + show_hidden: bool = False, +) -> list[NamedDiagram]: + """ + Convert a pyparsing element tree into a list of diagrams. This is the recommended entrypoint to diagram + creation if you want to access the Railroad tree before it is converted to HTML + + :param element: base element of the parser being diagrammed + + :param diagram_kwargs: kwargs to pass to the :meth:`Diagram` constructor + + :param vertical: (optional) int - limit at which number of alternatives + should be shown vertically instead of horizontally + + :param show_results_names: bool to indicate whether results name + annotations should be included in the diagram + + :param show_groups: bool to indicate whether groups should be highlighted + with an unlabeled surrounding box + + :param show_hidden: bool to indicate whether internal elements that are + typically hidden should be shown + """ + # Convert the whole tree underneath the root + lookup = ConverterState(diagram_kwargs=diagram_kwargs or {}) + _to_diagram_element( + element, + lookup=lookup, + parent=None, + vertical=vertical, + show_results_names=show_results_names, + show_groups=show_groups, + show_hidden=show_hidden, + ) + + root_id = id(element) + # Convert the root if it hasn't been already + if root_id in lookup: + if not element.customName: + lookup[root_id].name = "" + lookup[root_id].mark_for_extraction(root_id, lookup, force=True) + + # Now that we're finished, we can convert from intermediate structures into Railroad elements + diags = list(lookup.diagrams.values()) + if len(diags) > 1: + # collapse out duplicate diags with the same name + seen = set() + deduped_diags = [] + for d in diags: + # don't extract SkipTo elements, they are uninformative as subdiagrams + if d.name == "...": + continue + if d.name is not None and d.name not in seen: + seen.add(d.name) + deduped_diags.append(d) + resolved = [resolve_partial(partial) for partial in deduped_diags] + else: + # special case - if just one diagram, always display it, even if + # it has no name + resolved = [resolve_partial(partial) for partial in diags] + return sorted(resolved, key=lambda diag: diag.index) + + +def _should_vertical( + specification: int, exprs: Iterable[pyparsing.ParserElement] +) -> bool: + """ + Returns true if we should return a vertical list of elements + """ + if specification is None: + return False + else: + return len(_visible_exprs(exprs)) >= specification + + +@dataclasses.dataclass +class ElementState: + """ + State recorded for an individual pyparsing Element + """ + + #: The pyparsing element that this represents + element: pyparsing.ParserElement + #: The output Railroad element in an unconverted state + converted: EditablePartial + #: The parent Railroad element, which we store so that we can extract this if it's duplicated + parent: EditablePartial + #: The order in which we found this element, used for sorting diagrams if this is extracted into a diagram + number: int + #: The name of the element + name: str = None + #: The index of this inside its parent + parent_index: typing.Optional[int] = None + #: If true, we should extract this out into a subdiagram + extract: bool = False + #: If true, all of this element's children have been filled out + complete: bool = False + + def mark_for_extraction( + self, el_id: int, state: ConverterState, name: str = None, force: bool = False + ): + """ + Called when this instance has been seen twice, and thus should eventually be extracted into a sub-diagram + :param el_id: id of the element + :param state: element/diagram state tracker + :param name: name to use for this element's text + :param force: If true, force extraction now, regardless of the state of this. Only useful for extracting the + root element when we know we're finished + """ + self.extract = True + + # Set the name + if not self.name: + if name: + # Allow forcing a custom name + self.name = name + elif self.element.customName: + self.name = self.element.customName + else: + self.name = "" + + # Just because this is marked for extraction doesn't mean we can do it yet. We may have to wait for children + # to be added + # Also, if this is just a string literal etc, don't bother extracting it + if force or (self.complete and _worth_extracting(self.element)): + state.extract_into_diagram(el_id) + + +class ConverterState: + """ + Stores some state that persists between recursions into the element tree + """ + index_generator = itertools.count(start=1) + + def __init__(self, diagram_kwargs: typing.Optional[dict] = None) -> None: + #: A dictionary mapping ParserElements to state relating to them + self._element_diagram_states: dict[int, ElementState] = {} + #: A dictionary mapping ParserElement IDs to subdiagrams generated from them + self.diagrams: dict[int, EditablePartial[NamedDiagram]] = {} + #: The index of the next element. This is used for sorting + self.index: int = 0 + #: Shared kwargs that are used to customize the construction of diagrams + self.diagram_kwargs: dict = diagram_kwargs or {} + self.extracted_diagram_names: set[str] = set() + + def __setitem__(self, key: int, value: ElementState): + self._element_diagram_states[key] = value + + def __getitem__(self, key: int) -> ElementState: + return self._element_diagram_states[key] + + def __delitem__(self, key: int): + del self._element_diagram_states[key] + + def __contains__(self, key: int): + return key in self._element_diagram_states + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default + + def generate_index(self) -> int: + """ + Generate a number used to index a diagram + """ + return next(self.index_generator) + + def extract_into_diagram(self, el_id: int): + """ + Used when we encounter the same token twice in the same tree. When this + happens, we replace all instances of that token with a terminal, and + create a new subdiagram for the token + """ + position = self[el_id] + + # Replace the original definition of this element with a regular block + if position.parent: + href = f"#{_make_bookmark(position.name)}" + ret = EditablePartial.from_call(railroad.NonTerminal, text=position.name, href=href) + if "item" in position.parent.kwargs: + position.parent.kwargs["item"] = ret + elif "items" in position.parent.kwargs: + position.parent.kwargs["items"][position.parent_index] = ret + + # If the element we're extracting is a group, skip to its content but keep the title + if position.converted.func == railroad.Group: + content = position.converted.kwargs["item"] + else: + content = position.converted + + self.diagrams[el_id] = EditablePartial.from_call( + NamedDiagram, + name=position.name, + diagram=EditablePartial.from_call( + railroad.Diagram, content, **self.diagram_kwargs + ), + index=position.number, + ) + + del self[el_id] + + +def _worth_extracting(element: pyparsing.ParserElement) -> bool: + """ + Returns true if this element is worth having its own sub-diagram. Simply, if any of its children + themselves have children, then its complex enough to extract + """ + children = element.recurse() + return any(child.recurse() for child in children) + + +def _apply_diagram_item_enhancements(fn): + """ + decorator to ensure enhancements to a diagram item (such as results name annotations) + get applied on return from _to_diagram_element (we do this since there are several + returns in _to_diagram_element) + """ + + def _inner( + element: pyparsing.ParserElement, + parent: typing.Optional[EditablePartial], + lookup: ConverterState = None, + vertical: int = None, + index: int = 0, + name_hint: str = None, + show_results_names: bool = False, + show_groups: bool = False, + show_hidden: bool = False, + ) -> typing.Optional[EditablePartial]: + ret = fn( + element, + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + show_hidden, + ) + + # apply annotation for results name, if present + if show_results_names and ret is not None: + element_results_name = element.resultsName + if element_results_name: + # add "*" to indicate if this is a "list all results" name + modal_tag = "" if element.modalResults else "*" + ret = EditablePartial.from_call( + railroad.Group, + item=ret, + label=f"{repr(element_results_name)}{modal_tag}", + ) + + return ret + + return _inner + + +def _visible_exprs(exprs: Iterable[pyparsing.ParserElement]): + non_diagramming_exprs = ( + pyparsing.ParseElementEnhance, + pyparsing.PositionToken, + pyparsing.And._ErrorStop, + ) + return [ + e + for e in exprs + if not isinstance(e, non_diagramming_exprs) + ] + + +@_apply_diagram_item_enhancements +def _to_diagram_element( + element: pyparsing.ParserElement, + parent: typing.Optional[EditablePartial], + lookup: ConverterState = None, + vertical: int = None, + index: int = 0, + name_hint: str = None, + show_results_names: bool = False, + show_groups: bool = False, + show_hidden: bool = False, +) -> typing.Optional[EditablePartial]: + """ + Recursively converts a PyParsing Element to a railroad Element + :param lookup: The shared converter state that keeps track of useful things + :param index: The index of this element within the parent + :param parent: The parent of this element in the output tree + :param vertical: Controls at what point we make a list of elements vertical. If this is an integer (the default), + it sets the threshold of the number of items before we go vertical. If True, always go vertical, if False, never + do so + :param name_hint: If provided, this will override the generated name + :param show_results_names: bool flag indicating whether to add annotations for results names + :param show_groups: bool flag indicating whether to show groups using bounding box + :param show_hidden: bool flag indicating whether to show elements that are typically hidden + :returns: The converted version of the input element, but as a Partial that hasn't yet been constructed + """ + exprs = element.recurse() + name = name_hint or element.customName or type(element).__name__ + + # Python's id() is used to provide a unique identifier for elements + el_id = id(element) + + element_results_name = element.resultsName + + # Here we basically bypass processing certain wrapper elements if they contribute nothing to the diagram + if not element.customName: + if isinstance( + element, + ( + # pyparsing.TokenConverter, + pyparsing.Forward, + pyparsing.Located, + pyparsing.AtStringStart, + pyparsing.AtLineStart, + ), + ): + # However, if this element has a useful custom name, and its child does not, we can pass it on to the child + if exprs: + if not exprs[0].customName: + propagated_name = name + else: + propagated_name = None + + return _to_diagram_element( + element.expr, + parent=parent, + lookup=lookup, + vertical=vertical, + index=index, + name_hint=propagated_name, + show_results_names=show_results_names, + show_groups=show_groups, + show_hidden=show_hidden, + ) + + # If the element isn't worth extracting, we always treat it as the first time we say it + if _worth_extracting(element): + looked_up = lookup.get(el_id) + if looked_up and looked_up.name is not None: + # If we've seen this element exactly once before, we are only just now finding out that it's a duplicate, + # so we have to extract it into a new diagram. + looked_up.mark_for_extraction(el_id, lookup, name=name_hint) + href = f"#{_make_bookmark(looked_up.name)}" + ret = EditablePartial.from_call(railroad.NonTerminal, text=looked_up.name, href=href) + return ret + + elif el_id in lookup.diagrams: + # If we have seen the element at least twice before, and have already extracted it into a subdiagram, we + # just put in a marker element that refers to the sub-diagram + text = lookup.diagrams[el_id].kwargs["name"] + ret = EditablePartial.from_call( + railroad.NonTerminal, text=text, href=f"#{_make_bookmark(text)}" + ) + return ret + + # Recursively convert child elements + # Here we find the most relevant Railroad element for matching pyparsing Element + # We use ``items=[]`` here to hold the place for where the child elements will go once created + + # see if this element is normally hidden, and whether hidden elements are desired + # if not, just return None + if not element.show_in_diagram and not show_hidden: + return None + + if isinstance(element, pyparsing.And): + # detect And's created with ``expr*N`` notation - for these use a OneOrMore with a repeat + # (all will have the same name, and resultsName) + if not exprs: + return None + if len(set((e.name, e.resultsName) for e in exprs)) == 1 and len(exprs) > 2: + ret = EditablePartial.from_call( + railroad.OneOrMore, item="", repeat=str(len(exprs)) + ) + elif _should_vertical(vertical, exprs): + ret = EditablePartial.from_call(railroad.Stack, items=[]) + else: + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + elif isinstance(element, (pyparsing.Or, pyparsing.MatchFirst)): + if not exprs: + return None + if _should_vertical(vertical, exprs): + ret = EditablePartial.from_call(railroad.Choice, 0, items=[]) + else: + ret = EditablePartial.from_call(railroad.HorizontalChoice, items=[]) + elif isinstance(element, pyparsing.Each): + if not exprs: + return None + ret = EditablePartial.from_call(EachItem, items=[]) + elif isinstance(element, pyparsing.NotAny): + ret = EditablePartial.from_call(AnnotatedItem, label="NOT", item="") + elif isinstance(element, pyparsing.FollowedBy): + ret = EditablePartial.from_call(AnnotatedItem, label="LOOKAHEAD", item="") + elif isinstance(element, pyparsing.PrecededBy): + ret = EditablePartial.from_call(AnnotatedItem, label="LOOKBEHIND", item="") + elif isinstance(element, pyparsing.Group): + if show_groups: + ret = EditablePartial.from_call(AnnotatedItem, label="", item="") + else: + ret = EditablePartial.from_call( + railroad.Group, item=None, label=element_results_name + ) + elif isinstance(element, pyparsing.TokenConverter): + label = type(element).__name__.lower() + if label == "tokenconverter": + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + else: + ret = EditablePartial.from_call(AnnotatedItem, label=label, item="") + elif isinstance(element, pyparsing.Opt): + ret = EditablePartial.from_call(railroad.Optional, item="") + elif isinstance(element, pyparsing.OneOrMore): + if element.not_ender is not None: + args = [ + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + show_hidden, + ] + return _to_diagram_element( + (~element.not_ender.expr + element.expr)[1, ...].set_name(element.name), + *args, + ) + ret = EditablePartial.from_call(railroad.OneOrMore, item=None) + elif isinstance(element, pyparsing.ZeroOrMore): + if element.not_ender is not None: + args = [ + parent, + lookup, + vertical, + index, + name_hint, + show_results_names, + show_groups, + show_hidden, + ] + return _to_diagram_element( + (~element.not_ender.expr + element.expr)[...].set_name(element.name), + *args, + ) + ret = EditablePartial.from_call(railroad.ZeroOrMore, item="") + elif isinstance(element, pyparsing.Empty) and not element.customName: + # Skip unnamed "Empty" elements + ret = None + elif isinstance(element, pyparsing.ParseElementEnhance): + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + elif len(exprs) > 0 and not element_results_name: + ret = EditablePartial.from_call(railroad.Group, item="", label=name) + elif isinstance(element, pyparsing.Regex): + collapsed_patt = _collapse_verbose_regex(element.pattern) + ret = EditablePartial.from_call(railroad.Terminal, collapsed_patt) + elif len(exprs) > 0: + ret = EditablePartial.from_call(railroad.Sequence, items=[]) + else: + terminal = EditablePartial.from_call(railroad.Terminal, element.defaultName) + ret = terminal + + if ret is None: + return + + # Indicate this element's position in the tree so we can extract it if necessary + lookup[el_id] = ElementState( + element=element, + converted=ret, + parent=parent, + parent_index=index, + number=lookup.generate_index(), + ) + if element.customName: + lookup[el_id].mark_for_extraction(el_id, lookup, element.customName) + + i = 0 + for expr in exprs: + # Add a placeholder index in case we have to extract the child before we even add it to the parent + if "items" in ret.kwargs: + ret.kwargs["items"].insert(i, None) + + item = _to_diagram_element( + expr, + parent=ret, + lookup=lookup, + vertical=vertical, + index=i, + show_results_names=show_results_names, + show_groups=show_groups, + show_hidden=show_hidden, + ) + + # Some elements don't need to be shown in the diagram + if item is not None: + if "item" in ret.kwargs: + ret.kwargs["item"] = item + elif "items" in ret.kwargs: + # If we've already extracted the child, don't touch this index, since it's occupied by a nonterminal + ret.kwargs["items"][i] = item + i += 1 + elif "items" in ret.kwargs: + # If we're supposed to skip this element, remove it from the parent + del ret.kwargs["items"][i] + + # If all this items children are none, skip this item + if ret and ( + ("items" in ret.kwargs and len(ret.kwargs["items"]) == 0) + or ("item" in ret.kwargs and ret.kwargs["item"] is None) + ): + ret = EditablePartial.from_call(railroad.Terminal, name) + + # Mark this element as "complete", ie it has all of its children + if el_id in lookup: + lookup[el_id].complete = True + + if el_id in lookup and lookup[el_id].extract and lookup[el_id].complete: + lookup.extract_into_diagram(el_id) + if ret is not None: + text = lookup.diagrams[el_id].kwargs["name"] + href = f"#{_make_bookmark(text)}" + ret = EditablePartial.from_call( + railroad.NonTerminal, text=text, href=href + ) + + return ret diff --git a/shared/package-files/34/340c783381e32fbbc034225b73eb64d38564a25f93d28697790dd3da1f9752f3/blob b/shared/package-files/34/340c783381e32fbbc034225b73eb64d38564a25f93d28697790dd3da1f9752f3/blob new file mode 100644 index 0000000000000000000000000000000000000000..a1e1b33c403a0bb0b7b9326d49237be7e0ad6d7d --- /dev/null +++ b/shared/package-files/34/340c783381e32fbbc034225b73eb64d38564a25f93d28697790dd3da1f9752f3/blob @@ -0,0 +1,570 @@ +StartFontMetrics 2.0 +Comment Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved. +Comment Creation Date: Thu Mar 15 09:43:00 1990 +Comment UniqueID 28357 +Comment VMusage 26878 33770 +FontName Helvetica-Bold +FullName Helvetica Bold +FamilyName Helvetica +Weight Bold +ItalicAngle 0 +IsFixedPitch false +FontBBox -170 -228 1003 962 +UnderlinePosition -100 +UnderlineThickness 50 +Version 001.007 +Notice Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All Rights Reserved.Helvetica is a trademark of Linotype AG and/or its subsidiaries. +EncodingScheme AdobeStandardEncoding +CapHeight 718 +XHeight 532 +Ascender 718 +Descender -207 +StartCharMetrics 228 +C 32 ; WX 278 ; N space ; B 0 0 0 0 ; +C 33 ; WX 333 ; N exclam ; B 90 0 244 718 ; +C 34 ; WX 474 ; N quotedbl ; B 98 447 376 718 ; +C 35 ; WX 556 ; N numbersign ; B 18 0 538 698 ; +C 36 ; WX 556 ; N dollar ; B 30 -115 523 775 ; +C 37 ; WX 889 ; N percent ; B 28 -19 861 710 ; +C 38 ; WX 722 ; N ampersand ; B 54 -19 701 718 ; +C 39 ; WX 278 ; N quoteright ; B 69 445 209 718 ; +C 40 ; WX 333 ; N parenleft ; B 35 -208 314 734 ; +C 41 ; WX 333 ; N parenright ; B 19 -208 298 734 ; +C 42 ; WX 389 ; N asterisk ; B 27 387 362 718 ; +C 43 ; WX 584 ; N plus ; B 40 0 544 506 ; +C 44 ; WX 278 ; N comma ; B 64 -168 214 146 ; +C 45 ; WX 333 ; N hyphen ; B 27 215 306 345 ; +C 46 ; WX 278 ; N period ; B 64 0 214 146 ; +C 47 ; WX 278 ; N slash ; B -33 -19 311 737 ; +C 48 ; WX 556 ; N zero ; B 32 -19 524 710 ; +C 49 ; WX 556 ; N one ; B 69 0 378 710 ; +C 50 ; WX 556 ; N two ; B 26 0 511 710 ; +C 51 ; WX 556 ; N three ; B 27 -19 516 710 ; +C 52 ; WX 556 ; N four ; B 27 0 526 710 ; +C 53 ; WX 556 ; N five ; B 27 -19 516 698 ; +C 54 ; WX 556 ; N six ; B 31 -19 520 710 ; +C 55 ; WX 556 ; N seven ; B 25 0 528 698 ; +C 56 ; WX 556 ; N eight ; B 32 -19 524 710 ; +C 57 ; WX 556 ; N nine ; B 30 -19 522 710 ; +C 58 ; WX 333 ; N colon ; B 92 0 242 512 ; +C 59 ; WX 333 ; N semicolon ; B 92 -168 242 512 ; +C 60 ; WX 584 ; N less ; B 38 -8 546 514 ; +C 61 ; WX 584 ; N equal ; B 40 87 544 419 ; +C 62 ; WX 584 ; N greater ; B 38 -8 546 514 ; +C 63 ; WX 611 ; N question ; B 60 0 556 727 ; +C 64 ; WX 975 ; N at ; B 118 -19 856 737 ; +C 65 ; WX 722 ; N A ; B 20 0 702 718 ; +C 66 ; WX 722 ; N B ; B 76 0 669 718 ; +C 67 ; WX 722 ; N C ; B 44 -19 684 737 ; +C 68 ; WX 722 ; N D ; B 76 0 685 718 ; +C 69 ; WX 667 ; N E ; B 76 0 621 718 ; +C 70 ; WX 611 ; N F ; B 76 0 587 718 ; +C 71 ; WX 778 ; N G ; B 44 -19 713 737 ; +C 72 ; WX 722 ; N H ; B 71 0 651 718 ; +C 73 ; WX 278 ; N I ; B 64 0 214 718 ; +C 74 ; WX 556 ; N J ; B 22 -18 484 718 ; +C 75 ; WX 722 ; N K ; B 87 0 722 718 ; +C 76 ; WX 611 ; N L ; B 76 0 583 718 ; +C 77 ; WX 833 ; N M ; B 69 0 765 718 ; +C 78 ; WX 722 ; N N ; B 69 0 654 718 ; +C 79 ; WX 778 ; N O ; B 44 -19 734 737 ; +C 80 ; WX 667 ; N P ; B 76 0 627 718 ; +C 81 ; WX 778 ; N Q ; B 44 -52 737 737 ; +C 82 ; WX 722 ; N R ; B 76 0 677 718 ; +C 83 ; WX 667 ; N S ; B 39 -19 629 737 ; +C 84 ; WX 611 ; N T ; B 14 0 598 718 ; +C 85 ; WX 722 ; N U ; B 72 -19 651 718 ; +C 86 ; WX 667 ; N V ; B 19 0 648 718 ; +C 87 ; WX 944 ; N W ; B 16 0 929 718 ; +C 88 ; WX 667 ; N X ; B 14 0 653 718 ; +C 89 ; WX 667 ; N Y ; B 15 0 653 718 ; +C 90 ; WX 611 ; N Z ; B 25 0 586 718 ; +C 91 ; WX 333 ; N bracketleft ; B 63 -196 309 722 ; +C 92 ; WX 278 ; N backslash ; B -33 -19 311 737 ; +C 93 ; WX 333 ; N bracketright ; B 24 -196 270 722 ; +C 94 ; WX 584 ; N asciicircum ; B 62 323 522 698 ; +C 95 ; WX 556 ; N underscore ; B 0 -125 556 -75 ; +C 96 ; WX 278 ; N quoteleft ; B 69 454 209 727 ; +C 97 ; WX 556 ; N a ; B 29 -14 527 546 ; +C 98 ; WX 611 ; N b ; B 61 -14 578 718 ; +C 99 ; WX 556 ; N c ; B 34 -14 524 546 ; +C 100 ; WX 611 ; N d ; B 34 -14 551 718 ; +C 101 ; WX 556 ; N e ; B 23 -14 528 546 ; +C 102 ; WX 333 ; N f ; B 10 0 318 727 ; L i fi ; L l fl ; +C 103 ; WX 611 ; N g ; B 40 -217 553 546 ; +C 104 ; WX 611 ; N h ; B 65 0 546 718 ; +C 105 ; WX 278 ; N i ; B 69 0 209 725 ; +C 106 ; WX 278 ; N j ; B 3 -214 209 725 ; +C 107 ; WX 556 ; N k ; B 69 0 562 718 ; +C 108 ; WX 278 ; N l ; B 69 0 209 718 ; +C 109 ; WX 889 ; N m ; B 64 0 826 546 ; +C 110 ; WX 611 ; N n ; B 65 0 546 546 ; +C 111 ; WX 611 ; N o ; B 34 -14 578 546 ; +C 112 ; WX 611 ; N p ; B 62 -207 578 546 ; +C 113 ; WX 611 ; N q ; B 34 -207 552 546 ; +C 114 ; WX 389 ; N r ; B 64 0 373 546 ; +C 115 ; WX 556 ; N s ; B 30 -14 519 546 ; +C 116 ; WX 333 ; N t ; B 10 -6 309 676 ; +C 117 ; WX 611 ; N u ; B 66 -14 545 532 ; +C 118 ; WX 556 ; N v ; B 13 0 543 532 ; +C 119 ; WX 778 ; N w ; B 10 0 769 532 ; +C 120 ; WX 556 ; N x ; B 15 0 541 532 ; +C 121 ; WX 556 ; N y ; B 10 -214 539 532 ; +C 122 ; WX 500 ; N z ; B 20 0 480 532 ; +C 123 ; WX 389 ; N braceleft ; B 48 -196 365 722 ; +C 124 ; WX 280 ; N bar ; B 84 -19 196 737 ; +C 125 ; WX 389 ; N braceright ; B 24 -196 341 722 ; +C 126 ; WX 584 ; N asciitilde ; B 61 163 523 343 ; +C 161 ; WX 333 ; N exclamdown ; B 90 -186 244 532 ; +C 162 ; WX 556 ; N cent ; B 34 -118 524 628 ; +C 163 ; WX 556 ; N sterling ; B 28 -16 541 718 ; +C 164 ; WX 167 ; N fraction ; B -170 -19 336 710 ; +C 165 ; WX 556 ; N yen ; B -9 0 565 698 ; +C 166 ; WX 556 ; N florin ; B -10 -210 516 737 ; +C 167 ; WX 556 ; N section ; B 34 -184 522 727 ; +C 168 ; WX 556 ; N currency ; B -3 76 559 636 ; +C 169 ; WX 238 ; N quotesingle ; B 70 447 168 718 ; +C 170 ; WX 500 ; N quotedblleft ; B 64 454 436 727 ; +C 171 ; WX 556 ; N guillemotleft ; B 88 76 468 484 ; +C 172 ; WX 333 ; N guilsinglleft ; B 83 76 250 484 ; +C 173 ; WX 333 ; N guilsinglright ; B 83 76 250 484 ; +C 174 ; WX 611 ; N fi ; B 10 0 542 727 ; +C 175 ; WX 611 ; N fl ; B 10 0 542 727 ; +C 177 ; WX 556 ; N endash ; B 0 227 556 333 ; +C 178 ; WX 556 ; N dagger ; B 36 -171 520 718 ; +C 179 ; WX 556 ; N daggerdbl ; B 36 -171 520 718 ; +C 180 ; WX 278 ; N periodcentered ; B 58 172 220 334 ; +C 182 ; WX 556 ; N paragraph ; B -8 -191 539 700 ; +C 183 ; WX 350 ; N bullet ; B 10 194 340 524 ; +C 184 ; WX 278 ; N quotesinglbase ; B 69 -146 209 127 ; +C 185 ; WX 500 ; N quotedblbase ; B 64 -146 436 127 ; +C 186 ; WX 500 ; N quotedblright ; B 64 445 436 718 ; +C 187 ; WX 556 ; N guillemotright ; B 88 76 468 484 ; +C 188 ; WX 1000 ; N ellipsis ; B 92 0 908 146 ; +C 189 ; WX 1000 ; N perthousand ; B -3 -19 1003 710 ; +C 191 ; WX 611 ; N questiondown ; B 55 -195 551 532 ; +C 193 ; WX 333 ; N grave ; B -23 604 225 750 ; +C 194 ; WX 333 ; N acute ; B 108 604 356 750 ; +C 195 ; WX 333 ; N circumflex ; B -10 604 343 750 ; +C 196 ; WX 333 ; N tilde ; B -17 610 350 737 ; +C 197 ; WX 333 ; N macron ; B -6 604 339 678 ; +C 198 ; WX 333 ; N breve ; B -2 604 335 750 ; +C 199 ; WX 333 ; N dotaccent ; B 104 614 230 729 ; +C 200 ; WX 333 ; N dieresis ; B 6 614 327 729 ; +C 202 ; WX 333 ; N ring ; B 59 568 275 776 ; +C 203 ; WX 333 ; N cedilla ; B 6 -228 245 0 ; +C 205 ; WX 333 ; N hungarumlaut ; B 9 604 486 750 ; +C 206 ; WX 333 ; N ogonek ; B 71 -228 304 0 ; +C 207 ; WX 333 ; N caron ; B -10 604 343 750 ; +C 208 ; WX 1000 ; N emdash ; B 0 227 1000 333 ; +C 225 ; WX 1000 ; N AE ; B 5 0 954 718 ; +C 227 ; WX 370 ; N ordfeminine ; B 22 276 347 737 ; +C 232 ; WX 611 ; N Lslash ; B -20 0 583 718 ; +C 233 ; WX 778 ; N Oslash ; B 33 -27 744 745 ; +C 234 ; WX 1000 ; N OE ; B 37 -19 961 737 ; +C 235 ; WX 365 ; N ordmasculine ; B 6 276 360 737 ; +C 241 ; WX 889 ; N ae ; B 29 -14 858 546 ; +C 245 ; WX 278 ; N dotlessi ; B 69 0 209 532 ; +C 248 ; WX 278 ; N lslash ; B -18 0 296 718 ; +C 249 ; WX 611 ; N oslash ; B 22 -29 589 560 ; +C 250 ; WX 944 ; N oe ; B 34 -14 912 546 ; +C 251 ; WX 611 ; N germandbls ; B 69 -14 579 731 ; +C -1 ; WX 611 ; N Zcaron ; B 25 0 586 936 ; +C -1 ; WX 556 ; N ccedilla ; B 34 -228 524 546 ; +C -1 ; WX 556 ; N ydieresis ; B 10 -214 539 729 ; +C -1 ; WX 556 ; N atilde ; B 29 -14 527 737 ; +C -1 ; WX 278 ; N icircumflex ; B -37 0 316 750 ; +C -1 ; WX 333 ; N threesuperior ; B 8 271 326 710 ; +C -1 ; WX 556 ; N ecircumflex ; B 23 -14 528 750 ; +C -1 ; WX 611 ; N thorn ; B 62 -208 578 718 ; +C -1 ; WX 556 ; N egrave ; B 23 -14 528 750 ; +C -1 ; WX 333 ; N twosuperior ; B 9 283 324 710 ; +C -1 ; WX 556 ; N eacute ; B 23 -14 528 750 ; +C -1 ; WX 611 ; N otilde ; B 34 -14 578 737 ; +C -1 ; WX 722 ; N Aacute ; B 20 0 702 936 ; +C -1 ; WX 611 ; N ocircumflex ; B 34 -14 578 750 ; +C -1 ; WX 556 ; N yacute ; B 10 -214 539 750 ; +C -1 ; WX 611 ; N udieresis ; B 66 -14 545 729 ; +C -1 ; WX 834 ; N threequarters ; B 16 -19 799 710 ; +C -1 ; WX 556 ; N acircumflex ; B 29 -14 527 750 ; +C -1 ; WX 722 ; N Eth ; B -5 0 685 718 ; +C -1 ; WX 556 ; N edieresis ; B 23 -14 528 729 ; +C -1 ; WX 611 ; N ugrave ; B 66 -14 545 750 ; +C -1 ; WX 1000 ; N trademark ; B 44 306 956 718 ; +C -1 ; WX 611 ; N ograve ; B 34 -14 578 750 ; +C -1 ; WX 556 ; N scaron ; B 30 -14 519 750 ; +C -1 ; WX 278 ; N Idieresis ; B -21 0 300 915 ; +C -1 ; WX 611 ; N uacute ; B 66 -14 545 750 ; +C -1 ; WX 556 ; N agrave ; B 29 -14 527 750 ; +C -1 ; WX 611 ; N ntilde ; B 65 0 546 737 ; +C -1 ; WX 556 ; N aring ; B 29 -14 527 776 ; +C -1 ; WX 500 ; N zcaron ; B 20 0 480 750 ; +C -1 ; WX 278 ; N Icircumflex ; B -37 0 316 936 ; +C -1 ; WX 722 ; N Ntilde ; B 69 0 654 923 ; +C -1 ; WX 611 ; N ucircumflex ; B 66 -14 545 750 ; +C -1 ; WX 667 ; N Ecircumflex ; B 76 0 621 936 ; +C -1 ; WX 278 ; N Iacute ; B 64 0 329 936 ; +C -1 ; WX 722 ; N Ccedilla ; B 44 -228 684 737 ; +C -1 ; WX 778 ; N Odieresis ; B 44 -19 734 915 ; +C -1 ; WX 667 ; N Scaron ; B 39 -19 629 936 ; +C -1 ; WX 667 ; N Edieresis ; B 76 0 621 915 ; +C -1 ; WX 278 ; N Igrave ; B -50 0 214 936 ; +C -1 ; WX 556 ; N adieresis ; B 29 -14 527 729 ; +C -1 ; WX 778 ; N Ograve ; B 44 -19 734 936 ; +C -1 ; WX 667 ; N Egrave ; B 76 0 621 936 ; +C -1 ; WX 667 ; N Ydieresis ; B 15 0 653 915 ; +C -1 ; WX 737 ; N registered ; B -11 -19 748 737 ; +C -1 ; WX 778 ; N Otilde ; B 44 -19 734 923 ; +C -1 ; WX 834 ; N onequarter ; B 26 -19 766 710 ; +C -1 ; WX 722 ; N Ugrave ; B 72 -19 651 936 ; +C -1 ; WX 722 ; N Ucircumflex ; B 72 -19 651 936 ; +C -1 ; WX 667 ; N Thorn ; B 76 0 627 718 ; +C -1 ; WX 584 ; N divide ; B 40 -42 544 548 ; +C -1 ; WX 722 ; N Atilde ; B 20 0 702 923 ; +C -1 ; WX 722 ; N Uacute ; B 72 -19 651 936 ; +C -1 ; WX 778 ; N Ocircumflex ; B 44 -19 734 936 ; +C -1 ; WX 584 ; N logicalnot ; B 40 108 544 419 ; +C -1 ; WX 722 ; N Aring ; B 20 0 702 962 ; +C -1 ; WX 278 ; N idieresis ; B -21 0 300 729 ; +C -1 ; WX 278 ; N iacute ; B 69 0 329 750 ; +C -1 ; WX 556 ; N aacute ; B 29 -14 527 750 ; +C -1 ; WX 584 ; N plusminus ; B 40 0 544 506 ; +C -1 ; WX 584 ; N multiply ; B 40 1 545 505 ; +C -1 ; WX 722 ; N Udieresis ; B 72 -19 651 915 ; +C -1 ; WX 584 ; N minus ; B 40 197 544 309 ; +C -1 ; WX 333 ; N onesuperior ; B 26 283 237 710 ; +C -1 ; WX 667 ; N Eacute ; B 76 0 621 936 ; +C -1 ; WX 722 ; N Acircumflex ; B 20 0 702 936 ; +C -1 ; WX 737 ; N copyright ; B -11 -19 749 737 ; +C -1 ; WX 722 ; N Agrave ; B 20 0 702 936 ; +C -1 ; WX 611 ; N odieresis ; B 34 -14 578 729 ; +C -1 ; WX 611 ; N oacute ; B 34 -14 578 750 ; +C -1 ; WX 400 ; N degree ; B 57 426 343 712 ; +C -1 ; WX 278 ; N igrave ; B -50 0 209 750 ; +C -1 ; WX 611 ; N mu ; B 66 -207 545 532 ; +C -1 ; WX 778 ; N Oacute ; B 44 -19 734 936 ; +C -1 ; WX 611 ; N eth ; B 34 -14 578 737 ; +C -1 ; WX 722 ; N Adieresis ; B 20 0 702 915 ; +C -1 ; WX 667 ; N Yacute ; B 15 0 653 936 ; +C -1 ; WX 280 ; N brokenbar ; B 84 -19 196 737 ; +C -1 ; WX 834 ; N onehalf ; B 26 -19 794 710 ; +EndCharMetrics +StartKernData +StartKernPairs 209 + +KPX A y -30 +KPX A w -30 +KPX A v -40 +KPX A u -30 +KPX A Y -110 +KPX A W -60 +KPX A V -80 +KPX A U -50 +KPX A T -90 +KPX A Q -40 +KPX A O -40 +KPX A G -50 +KPX A C -40 + +KPX B U -10 +KPX B A -30 + +KPX D period -30 +KPX D comma -30 +KPX D Y -70 +KPX D W -40 +KPX D V -40 +KPX D A -40 + +KPX F period -100 +KPX F comma -100 +KPX F a -20 +KPX F A -80 + +KPX J u -20 +KPX J period -20 +KPX J comma -20 +KPX J A -20 + +KPX K y -40 +KPX K u -30 +KPX K o -35 +KPX K e -15 +KPX K O -30 + +KPX L y -30 +KPX L quoteright -140 +KPX L quotedblright -140 +KPX L Y -120 +KPX L W -80 +KPX L V -110 +KPX L T -90 + +KPX O period -40 +KPX O comma -40 +KPX O Y -70 +KPX O X -50 +KPX O W -50 +KPX O V -50 +KPX O T -40 +KPX O A -50 + +KPX P period -120 +KPX P o -40 +KPX P e -30 +KPX P comma -120 +KPX P a -30 +KPX P A -100 + +KPX Q period 20 +KPX Q comma 20 +KPX Q U -10 + +KPX R Y -50 +KPX R W -40 +KPX R V -50 +KPX R U -20 +KPX R T -20 +KPX R O -20 + +KPX T y -60 +KPX T w -60 +KPX T u -90 +KPX T semicolon -40 +KPX T r -80 +KPX T period -80 +KPX T o -80 +KPX T hyphen -120 +KPX T e -60 +KPX T comma -80 +KPX T colon -40 +KPX T a -80 +KPX T O -40 +KPX T A -90 + +KPX U period -30 +KPX U comma -30 +KPX U A -50 + +KPX V u -60 +KPX V semicolon -40 +KPX V period -120 +KPX V o -90 +KPX V hyphen -80 +KPX V e -50 +KPX V comma -120 +KPX V colon -40 +KPX V a -60 +KPX V O -50 +KPX V G -50 +KPX V A -80 + +KPX W y -20 +KPX W u -45 +KPX W semicolon -10 +KPX W period -80 +KPX W o -60 +KPX W hyphen -40 +KPX W e -35 +KPX W comma -80 +KPX W colon -10 +KPX W a -40 +KPX W O -20 +KPX W A -60 + +KPX Y u -100 +KPX Y semicolon -50 +KPX Y period -100 +KPX Y o -100 +KPX Y e -80 +KPX Y comma -100 +KPX Y colon -50 +KPX Y a -90 +KPX Y O -70 +KPX Y A -110 + +KPX a y -20 +KPX a w -15 +KPX a v -15 +KPX a g -10 + +KPX b y -20 +KPX b v -20 +KPX b u -20 +KPX b l -10 + +KPX c y -10 +KPX c l -20 +KPX c k -20 +KPX c h -10 + +KPX colon space -40 + +KPX comma space -40 +KPX comma quoteright -120 +KPX comma quotedblright -120 + +KPX d y -15 +KPX d w -15 +KPX d v -15 +KPX d d -10 + +KPX e y -15 +KPX e x -15 +KPX e w -15 +KPX e v -15 +KPX e period 20 +KPX e comma 10 + +KPX f quoteright 30 +KPX f quotedblright 30 +KPX f period -10 +KPX f o -20 +KPX f e -10 +KPX f comma -10 + +KPX g g -10 +KPX g e 10 + +KPX h y -20 + +KPX k o -15 + +KPX l y -15 +KPX l w -15 + +KPX m y -30 +KPX m u -20 + +KPX n y -20 +KPX n v -40 +KPX n u -10 + +KPX o y -20 +KPX o x -30 +KPX o w -15 +KPX o v -20 + +KPX p y -15 + +KPX period space -40 +KPX period quoteright -120 +KPX period quotedblright -120 + +KPX quotedblright space -80 + +KPX quoteleft quoteleft -46 + +KPX quoteright v -20 +KPX quoteright space -80 +KPX quoteright s -60 +KPX quoteright r -40 +KPX quoteright quoteright -46 +KPX quoteright l -20 +KPX quoteright d -80 + +KPX r y 10 +KPX r v 10 +KPX r t 20 +KPX r s -15 +KPX r q -20 +KPX r period -60 +KPX r o -20 +KPX r hyphen -20 +KPX r g -15 +KPX r d -20 +KPX r comma -60 +KPX r c -20 + +KPX s w -15 + +KPX semicolon space -40 + +KPX space quoteleft -60 +KPX space quotedblleft -80 +KPX space Y -120 +KPX space W -80 +KPX space V -80 +KPX space T -100 + +KPX v period -80 +KPX v o -30 +KPX v comma -80 +KPX v a -20 + +KPX w period -40 +KPX w o -20 +KPX w comma -40 + +KPX x e -10 + +KPX y period -80 +KPX y o -25 +KPX y e -10 +KPX y comma -80 +KPX y a -30 + +KPX z e 10 +EndKernPairs +EndKernData +StartComposites 58 +CC Aacute 2 ; PCC A 0 0 ; PCC acute 195 186 ; +CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex 195 186 ; +CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis 195 186 ; +CC Agrave 2 ; PCC A 0 0 ; PCC grave 195 186 ; +CC Aring 2 ; PCC A 0 0 ; PCC ring 195 186 ; +CC Atilde 2 ; PCC A 0 0 ; PCC tilde 195 186 ; +CC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 215 0 ; +CC Eacute 2 ; PCC E 0 0 ; PCC acute 167 186 ; +CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 167 186 ; +CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 167 186 ; +CC Egrave 2 ; PCC E 0 0 ; PCC grave 167 186 ; +CC Iacute 2 ; PCC I 0 0 ; PCC acute -27 186 ; +CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex -27 186 ; +CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis -27 186 ; +CC Igrave 2 ; PCC I 0 0 ; PCC grave -27 186 ; +CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 195 186 ; +CC Oacute 2 ; PCC O 0 0 ; PCC acute 223 186 ; +CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 223 186 ; +CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 223 186 ; +CC Ograve 2 ; PCC O 0 0 ; PCC grave 223 186 ; +CC Otilde 2 ; PCC O 0 0 ; PCC tilde 223 186 ; +CC Scaron 2 ; PCC S 0 0 ; PCC caron 167 186 ; +CC Uacute 2 ; PCC U 0 0 ; PCC acute 195 186 ; +CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 195 186 ; +CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 195 186 ; +CC Ugrave 2 ; PCC U 0 0 ; PCC grave 195 186 ; +CC Yacute 2 ; PCC Y 0 0 ; PCC acute 167 186 ; +CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 167 186 ; +CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 186 ; +CC aacute 2 ; PCC a 0 0 ; PCC acute 112 0 ; +CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 112 0 ; +CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 112 0 ; +CC agrave 2 ; PCC a 0 0 ; PCC grave 112 0 ; +CC aring 2 ; PCC a 0 0 ; PCC ring 112 0 ; +CC atilde 2 ; PCC a 0 0 ; PCC tilde 112 0 ; +CC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 132 0 ; +CC eacute 2 ; PCC e 0 0 ; PCC acute 112 0 ; +CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 112 0 ; +CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 112 0 ; +CC egrave 2 ; PCC e 0 0 ; PCC grave 112 0 ; +CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ; +CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ; +CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ; +CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ; +CC ntilde 2 ; PCC n 0 0 ; PCC tilde 139 0 ; +CC oacute 2 ; PCC o 0 0 ; PCC acute 139 0 ; +CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 139 0 ; +CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 139 0 ; +CC ograve 2 ; PCC o 0 0 ; PCC grave 139 0 ; +CC otilde 2 ; PCC o 0 0 ; PCC tilde 139 0 ; +CC scaron 2 ; PCC s 0 0 ; PCC caron 112 0 ; +CC uacute 2 ; PCC u 0 0 ; PCC acute 139 0 ; +CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 139 0 ; +CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 139 0 ; +CC ugrave 2 ; PCC u 0 0 ; PCC grave 139 0 ; +CC yacute 2 ; PCC y 0 0 ; PCC acute 112 0 ; +CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 112 0 ; +CC zcaron 2 ; PCC z 0 0 ; PCC caron 84 0 ; +EndComposites +EndFontMetrics diff --git a/shared/package-files/34/340d24962cf7d4594b9d8c6fde9a737abb8e36a35892e12fb6ce70cd711e21ce/blob b/shared/package-files/34/340d24962cf7d4594b9d8c6fde9a737abb8e36a35892e12fb6ce70cd711e21ce/blob new file mode 100644 index 0000000000000000000000000000000000000000..ca48ee85153645a7510e201d574e9b119c089dce Binary files /dev/null and b/shared/package-files/34/340d24962cf7d4594b9d8c6fde9a737abb8e36a35892e12fb6ce70cd711e21ce/blob differ diff --git a/shared/package-files/34/340d89dd7ce026743ca660153776261bf1460684bd438e23e9d22fd280096bcb/blob b/shared/package-files/34/340d89dd7ce026743ca660153776261bf1460684bd438e23e9d22fd280096bcb/blob new file mode 100644 index 0000000000000000000000000000000000000000..4979e59898891e7efc47be193ed6140846f9c9c7 --- /dev/null +++ b/shared/package-files/34/340d89dd7ce026743ca660153776261bf1460684bd438e23e9d22fd280096bcb/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::sigmoid_backward.grad_input(Tensor grad_output, Tensor output, *, Tensor(a!) grad_input) -> Tensor(a!) +inline at::Tensor & sigmoid_backward_out(at::Tensor & grad_input, const at::Tensor & grad_output, const at::Tensor & output) { + return at::_ops::sigmoid_backward_grad_input::call(grad_output, output, grad_input); +} +// aten::sigmoid_backward.grad_input(Tensor grad_output, Tensor output, *, Tensor(a!) grad_input) -> Tensor(a!) +inline at::Tensor & sigmoid_backward_outf(const at::Tensor & grad_output, const at::Tensor & output, at::Tensor & grad_input) { + return at::_ops::sigmoid_backward_grad_input::call(grad_output, output, grad_input); +} + +// aten::sigmoid_backward(Tensor grad_output, Tensor output) -> Tensor +inline at::Tensor sigmoid_backward(const at::Tensor & grad_output, const at::Tensor & output) { + return at::_ops::sigmoid_backward::call(grad_output, output); +} + +} diff --git a/shared/package-files/34/340efe5aa12b8ec9d6b6e9dc90c8ee07e3716325ddf3aa076570eb7c4fde263f/blob b/shared/package-files/34/340efe5aa12b8ec9d6b6e9dc90c8ee07e3716325ddf3aa076570eb7c4fde263f/blob new file mode 100644 index 0000000000000000000000000000000000000000..891f62f3cb7128ff3d79b7ee14fa5af1878176a0 --- /dev/null +++ b/shared/package-files/34/340efe5aa12b8ec9d6b6e9dc90c8ee07e3716325ddf3aa076570eb7c4fde263f/blob @@ -0,0 +1,1168 @@ +# Copyright (C) 2014 Anaconda, Inc +# SPDX-License-Identifier: BSD-3-Clause +""" +Tools for converting CPAN packages to conda recipes. +""" +import codecs +import gzip +import hashlib +import json +import os +import pickle +import subprocess +import sys +import tempfile +from functools import lru_cache, partial +from glob import glob +from os import makedirs +from os.path import basename, dirname, exists, join + +import requests +from conda.core.index import get_index + +from .. import environ +from ..conda_interface import ( + CondaError, + CondaHTTPError, + MatchSpec, + Resolve, + TemporaryDirectory, + TmpDownload, + download, +) +from ..config import Config, get_or_merge_config +from ..utils import check_call_env, on_linux, on_win +from ..variants import get_default_variant +from ..version import _parse as parse_version + +CPAN_META = """\ +{{% set name = "{packagename}" %}} +{{% set version = "{version}" %}} +{{% set sha256 = "{sha256}" %}} + +package: + name: {{{{ name }}}} + version: {{{{ version }}}} + +{source_comment}source: + {useurl}url: {cpanurl} + {usesha256}sha256: {{{{ sha256 }}}} + +# If this is a new build for the same version, increment the build +# number. If you do not include this key, it defaults to 0. +build: + number: 0 + run_exports: + weak: + - {{{{ name }}}} ={{{{ version }}}} + +requirements: + build:{build_depends} + + # Run exports are used now + host: + - perl{host_depends} + + run: + - perl{run_depends} + +{import_comment}test: + # Perl 'use' tests + {import_comment}imports:{import_tests} + + # You can also put a file called run_test.pl (or run_test.py) in the recipe + # that will be run at test time. + +about: + home: {homeurl} + license: {license} + summary: {summary} + +# See +# https://docs.conda.io/projects/conda-build for +# more information about meta.yaml +""" + +CPAN_BUILD_SH = """\ +#!/bin/bash + +set -o errexit -o pipefail + +# If it has Build.PL use that, otherwise use Makefile.PL +if [[ -f Build.PL ]]; then + perl Build.PL + perl ./Build + perl ./Build test + # Make sure this goes in site + perl ./Build install --installdirs site +elif [[ -f Makefile.PL ]]; then + # Make sure this goes in site + perl Makefile.PL INSTALLDIRS=site + make + make test + make install +else + echo 'Unable to find Build.PL or Makefile.PL. You need to modify build.sh.' + exit 1 +fi + +# Add more build steps here, if they are necessary. + +# See +# https://docs.conda.io/projects/conda-build +# for a list of environment variables that are set during the build process. +""" + +CPAN_BLD_BAT = """\ +:: If it has Build.PL use that, otherwise use Makefile.PL +IF exist Build.PL ( + perl Build.PL + IF %ERRORLEVEL% NEQ 0 exit /B 1 + Build + IF %ERRORLEVEL% NEQ 0 exit /B 1 + Build test + :: Make sure this goes in site + Build install --installdirs site + IF %ERRORLEVEL% NEQ 0 exit /B 1 +) ELSE IF exist Makefile.PL ( + :: Make sure this goes in site + perl Makefile.PL INSTALLDIRS=site + IF %ERRORLEVEL% NEQ 0 exit /B 1 + make + IF %ERRORLEVEL% NEQ 0 exit /B 1 + make test + IF %ERRORLEVEL% NEQ 0 exit /B 1 + make install +) ELSE ( + ECHO 'Unable to find Build.PL or Makefile.PL. You need to modify bld.bat.' + exit 1 +) + +:: Add more build steps here, if they are necessary. + +:: See +:: https://docs.conda.io/projects/conda-build +:: for a list of environment variables that are set during the build process. +""" + +perl_core = [] + + +class InvalidReleaseError(RuntimeError): + + """ + An exception that is raised when a release is not available on MetaCPAN. + """ + + pass + + +class PerlTmpDownload(TmpDownload): + + """ + Subclass Conda's TmpDownload to replace : in download filenames. + Critical on win. + """ + + def __enter__(self): + if "://" not in self.url: + # if we provide the file itself, no tmp dir is created + self.tmp_dir = None + return self.url + else: + if "CHECKSUMS" in self.url: + turl = self.url.split("id/") + filename = turl[1] + else: + filename = basename(self.url) + + filename = filename.replace("::", "-") + + self.tmp_dir = tempfile.mkdtemp() + + home = os.path.expanduser("~") + base_dir = join( + home, ".conda-build", "cpan", basename(self.url).replace("::", "-") + ) + dst = join(base_dir, filename) + dst = dst.replace("::", "-") + base_dir = dirname(dst) + + if not exists(base_dir): + makedirs(base_dir) + dst = get_pickle_file_path( + cache_dir=base_dir, filename_prefix=filename, other_hashed=(self.url,) + ) + if not exists(os.path.dirname(dst)): + makedirs(os.path.dirname(dst)) + if not exists(dst): + download(self.url, dst) + + return dst + + +def get_build_dependencies_from_src_archive(package_url, sha256, src_cache): + import tarfile + + from .. import source + + cached_path, _ = source.download_to_cache( + src_cache, "", {"url": package_url, "sha256": sha256} + ) + result = [] + with tarfile.open(cached_path) as tf: + need_f = any( + [ + f.name.lower().endswith((".f", ".f90", ".f77", ".f95", ".f03")) + for f in tf + ] + ) + # Fortran builds use CC to perform the link (they do not call the linker directly). + need_c = ( + True + if need_f + else any([f.name.lower().endswith((".c", ".xs")) for f in tf]) + ) + need_cxx = any( + [f.name.lower().endswith((".cxx", ".cpp", ".cc", ".c++")) for f in tf] + ) + need_autotools = any([f.name.lower().endswith("/configure") for f in tf]) + need_make = ( + True + if any((need_autotools, need_f, need_cxx, need_c)) + else any([f.name.lower().endswith(("/makefile", "/makevars")) for f in tf]) + ) + if need_c or need_cxx or need_f: + result.append("{{ compiler('c') }}") + if need_cxx: + result.append("{{ compiler('cxx') }}") + if need_f: + result.append("{{ compiler('fortran') }}") + if need_autotools: + result.append("autoconf # [not win]") + result.append("automake # [not win]") + result.append("m2-autoconf # [win]") + result.append("m2-automake-wrapper # [win]") + if need_make: + result.append("make # [not win]") + result.append("m2-make # [win]") + print( + f"INFO :: For {os.path.basename(package_url)}, we need the following build tools:\n{result}" + ) + return result + + +def loose_version(ver): + return str(parse_version(str(ver))) + + +def get_cpan_api_url(url, colons): + if not colons: + url = url.replace("::", "-") + with PerlTmpDownload(url) as json_path: + try: + with gzip.open(json_path) as dist_json_file: + output = dist_json_file.read() + if hasattr(output, "decode"): + output = output.decode("utf-8-sig") + rel_dict = json.loads(output) + except OSError: + rel_dict = json.loads(codecs.open(json_path, encoding="utf-8").read()) + except CondaHTTPError: + rel_dict = None + return rel_dict + + +# Probably uses a system cpan? TODO :: Fix this. +def package_exists(package_name): + try: + cmd = ["cpan", "-D", package_name] + if on_win: + cmd.insert(0, "/c") + cmd.insert(0, "/d") + cmd.insert(0, "cmd.exe") + check_call_env(cmd) + in_repo = True + except subprocess.CalledProcessError: + in_repo = False + return in_repo + + +def md5d_file_and_other(filename, other_hashed): + sha1 = hashlib.md5() + with open(filename, "rb") as f: + while True: + data = f.read(65536) + if not data: + break + sha1.update(data) + for other in other_hashed: + sha1.update(other.encode("utf-8") if hasattr(other, "encode") else other) + return sha1.hexdigest() + + +def get_pickle_file_path(cache_dir, filename_prefix, other_hashed=()): + h = "h" + md5d_file_and_other(__file__, other_hashed)[2:10] + return os.path.join(cache_dir, filename_prefix.replace("::", "-") + "." + h + ".p") + + +def load_or_pickle(filename_prefix, base_folder, data_partial, key): + # It might be nice to hash the entire code tree of data_partial + # along with all the args to it via hashlib instead but that's + # difficult. + pickled = get_pickle_file_path( + cache_dir=base_folder, filename_prefix=filename_prefix + key + ) + # if exists(pickled): + # os.unlink(pickled) + if exists(pickled): + with open(pickled, "rb") as f: + key_stored = pickle.load(f) + if key and key_stored and key == key_stored: + return pickle.load(f) + result = data_partial() + try: + os.makedirs(os.path.dirname(pickled)) + except: + pass + with open(pickled, "wb") as f: + pickle.dump(key, f) + pickle.dump(result, f) + return result + + +def install_perl_get_core_modules(version): + try: + config = Config() + + if on_win: + subdirs = ("win-64", "Library", "bin", "perl.exe") + elif on_linux: + subdirs = ("linux-64", "bin", "perl") + else: + subdirs = ("osx-64", "bin", "perl") + # Return one of the dist things instead? + with TemporaryDirectory() as tmpdir: + environ.create_env( + tmpdir, + [f"perl={version}"], + env="host", + config=config, + subdir=subdirs[0], + ) + args = [ + f"{join(tmpdir, *subdirs[1:])}", + "-e", + "use Module::CoreList; " + "my @modules = grep {Module::CoreList::is_core($_)} Module::CoreList->find_modules(qr/.*/); " + 'print join "\n", @modules;', + ] + all_core_modules = ( + subprocess.check_output(args, shell=False) + .decode("utf-8") + .replace("\r\n", "\n") + .split("\n") + ) + return all_core_modules + except Exception as e: + print( + "Failed to query perl={} for core modules list, attempted command was:\n{}".format( + version, " ".join(args) + ) + ) + print(e.message) + + return [] + + +def get_core_modules_for_this_perl_version(version, cache_dir): + return load_or_pickle( + "perl-core-modules", + base_folder=cache_dir, + data_partial=partial(install_perl_get_core_modules, version), + key=version, + ) + + +# meta_cpan_url="http://api.metacpan.org", +def skeletonize( + packages, + output_dir=".", + version=None, + meta_cpan_url="https://fastapi.metacpan.org/v1", + recursive=False, + force=False, + config=None, + write_core=False, +): + """ + Loops over packages, outputting conda recipes converted from CPAN metata. + """ + config = get_or_merge_config(config) + cache_dir = os.path.join(config.src_cache_root, ".conda-build", "pickled.cb") + + # TODO :: Make a temp env. with perl (which we need anyway) and use whatever version + # got installed instead of this. Also allow the version to be specified. + perl_version = config.variant.get("perl", get_default_variant(config)["perl"]) + core_modules = get_core_modules_for_this_perl_version(perl_version, cache_dir) + + # wildcards are not valid for perl + perl_version = perl_version.replace(".*", "") + package_dicts = {} + indent = "\n - " + indent_core = "\n #- " + processed_packages = set() + orig_version = version + new_packages = [] + for package in packages: + # TODO :: Determine whether the user asked for a module or a package here. + # :: if a package, then the 2nd element is None, if a module then the + # :: 2nd element gives the name of that module. + # :: I also need to take care about the differences between package + # :: versions and module versions. + # module = package + # module = dist_for_module(meta_cpan_url, cache_dir, core_modules, package) + module = None + new_packages.append((package, module)) + packages = new_packages + while packages: + package, module = packages.pop() + # If we're passed version in the same format as `PACKAGE=VERSION` + # update version + if "=" in package: + package, _, version = package.partition("=") + else: + version = orig_version + + # Skip duplicates + if package in processed_packages: + continue + processed_packages.add(package) + + # Convert modules into distributions .. incorrectly. Instead we should just look up + # https://fastapi.metacpan.org/v1/module/Regexp::Common which seems to contain every + # bit of information we could want here. Versions, modules, module versions, + # distribution name, urls. The lot. Instead we mess about with other API end-points + # getting a load of nonsense. + orig_package = package + package = dist_for_module( + meta_cpan_url, cache_dir, core_modules, module if module else package + ) + if package == "perl": + print( + f"WARNING: {orig_package} is a Perl core module that is not developed " + f"outside of Perl, so we are skipping creating a recipe " + f"for it." + ) + continue + elif package not in {orig_package, orig_package.replace("::", "-")}: + print( + f"WARNING: {orig_package} was part of the {package} distribution, so we are " + f"making a recipe for {package} instead." + ) + + latest_release_data = get_release_info( + meta_cpan_url, + cache_dir, + core_modules, + module if module else orig_package, + version, + ) + packagename = perl_to_conda(package) + + # Skip duplicates + if ( + version is not None + and ((packagename + "-" + version) in processed_packages) + ) or ( + (packagename + "-" + latest_release_data["version"]) in processed_packages + ): + continue + + d = package_dicts.setdefault( + package, + { + "packagename": packagename, + "build_depends": "", + "host_depends": "", + "run_depends": "", + "build_comment": "# ", + "test_commands": "", + "usesha256": "", + "useurl": "", + "source_comment": "", + "summary": "''", + "import_tests": "", + }, + ) + + # Fetch all metadata from CPAN + if version is None: + release_data = latest_release_data + else: + release_data = get_release_info( + meta_cpan_url, cache_dir, core_modules, package, parse_version(version) + ) + + # Check if recipe directory already exists + dir_path = join(output_dir, packagename, release_data["version"]) + + # Add Perl version to core module requirements, since these are empty + # packages, unless we're newer than what's in core + if metacpan_api_is_core_version(meta_cpan_url, package): + if not write_core: + print( + "We found core module %s. Skipping recipe creation." % packagename + ) + continue + + d["useurl"] = "#" + d["usesha256"] = "#" + d["source_comment"] = "#" + empty_recipe = True + # Add dependencies to d if not in core, or newer than what's in core + else: + deps, packages_to_append = deps_for_package( + package, + release_data=release_data, + output_dir=output_dir, + cache_dir=cache_dir, + meta_cpan_url=meta_cpan_url, + recursive=recursive, + core_modules=core_modules, + ) + + # If this is something we're downloading, get MD5 + d["cpanurl"] = "" + d["sha256"] = "" + if release_data.get("download_url"): + d["cpanurl"] = release_data["download_url"] + d["sha256"], size = get_checksum_and_size(release_data["download_url"]) + print("Using url {} ({}) for {}.".format(d["cpanurl"], size, package)) + src_build_depends = get_build_dependencies_from_src_archive( + release_data["download_url"], d["sha256"], config.src_cache + ) + else: + src_build_depends = [] + d["useurl"] = "#" + d["usesha256"] = "#" + d["source_comment"] = "#" + + d["build_depends"] += indent.join([""] + src_build_depends) + + # d['build_depends'] += indent_core.join([''] + list(deps['build']['core'] | + # deps['run']['core'])) + + d["host_depends"] += indent.join( + [""] + list(deps["build"]["noncore"] | deps["run"]["noncore"]) + ) + + # run_exports will set these, but: + # TODO :: Add ignore_run_exports for things in deps['build'] that are not also + # in deps['run'] + d["run_depends"] += indent_core.join([""] + list(deps["run"]["noncore"])) + + # Make sure we append any packages before continuing + for pkg in packages_to_append: + if pkg not in packages: + packages.append(pkg) + else: + print( + "INFO :: Already building package {} (module {})".format(*pkg) + ) + empty_recipe = False + + # If we are recursively getting packages for a particular version + # we need to make sure this is reset on the loop + version = None + if exists(dir_path) and not force: + print( + "Directory %s already exists and you have not specified --force " + % dir_path + ) + continue + elif exists(dir_path) and force: + print("Directory %s already exists, but forcing recipe creation" % dir_path) + + try: + d["homeurl"] = release_data["resources"]["homepage"] + except KeyError: + d["homeurl"] = "http://metacpan.org/pod/" + package + if "abstract" in release_data: + # TODO this does not escape quotes in a YAML friendly manner + summary = repr(release_data["abstract"]).lstrip("u") + d["summary"] = summary + # d['summary'] = repr(release_data['abstract']).lstrip('u') + try: + d["license"] = ( + release_data["license"][0] + if isinstance(release_data["license"], list) + else release_data["license"] + ) + except KeyError: + d["license"] = "perl_5" + d["version"] = release_data["version"] + + processed_packages.add(packagename + "-" + d["version"]) + + # Create import tests + module_prefix = package.replace("::", "-").split("-")[0] + if "provides" in release_data: + for provided_mod in sorted(set(release_data["provides"])): + # Filter out weird modules that don't belong + if provided_mod.startswith(module_prefix) and "::_" not in provided_mod: + d["import_tests"] += indent + provided_mod + if d["import_tests"]: + d["import_comment"] = "" + else: + d["import_comment"] = "# " + + if not exists(dir_path): + makedirs(dir_path) + + # Write recipe files to a directory + # TODO def write_recipe + print("Writing recipe for {}-{}".format(packagename, d["version"])) + with open(join(dir_path, "meta.yaml"), "wb") as f: + f.write(CPAN_META.format(**d).encode("utf-8")) + with open(join(dir_path, "build.sh"), "wb") as f: + if empty_recipe: + f.write(b'#!/bin/bash\necho "Nothing to do."\n') + else: + f.write(CPAN_BUILD_SH.format(**d).encode("utf-8")) + with open(join(dir_path, "bld.bat"), "w") as f: + if empty_recipe: + f.write('echo "Nothing to do."\n') + else: + f.write(CPAN_BLD_BAT.format(**d)) + + +@lru_cache(maxsize=None) +def is_core_version(core_version, version): + if core_version is None: + return False + elif core_version is not None and ( + (version in [None, ""]) or (core_version >= parse_version(version)) + ): + return True + else: + return False + + +def add_parser(repos): + cpan = repos.add_parser( + "cpan", + help=""" + Create recipe skeleton for packages hosted on the Comprehensive Perl Archive + Network (CPAN) (cpan.org). + """, + ) + cpan.add_argument( + "packages", + nargs="+", + help="CPAN packages to create recipe skeletons for.", + ) + cpan.add_argument( + "--output-dir", + help="Directory to write recipes to (default: %(default)s).", + default=".", + ) + cpan.add_argument( + "--version", + help="Version to use. Applies to all packages.", + ) + cpan.add_argument( + "--meta-cpan-url", + default="https://fastapi.metacpan.org/v1", + help="URL to use for MetaCPAN API. It must include a version, such as v1", + ) + cpan.add_argument( + "--recursive", + action="store_true", + help="Create recipes for dependencies if they do not already exist (default: %(default)s).", + ) + cpan.add_argument( + "--force", + action="store_true", + help="Force overwrite of existing recipes (default: %(default)s).", + ) + cpan.add_argument( + "--write_core", + action="store_true", + help="Write recipes for perl core modules (default: %(default)s). ", + ) + + +@lru_cache(maxsize=None) +def latest_pkg_version(pkg): + """ + :returns: the latest version of the specified conda package available + """ + r = Resolve(get_index()) + try: + pkg_list = sorted(r.get_pkgs(MatchSpec(pkg))) + except: + pkg_list = None + if pkg_list: + pkg_version = parse_version(pkg_list[-1].version) + else: + pkg_version = None + return pkg_version + + +def deps_for_package( + package, release_data, output_dir, cache_dir, meta_cpan_url, recursive, core_modules +): + """ + Build the sets of dependencies and packages we need recipes for. This should + only be called for non-core modules/distributions, as dependencies are + ignored for core modules. + + :param package: Perl distribution we're checking dependencies of. + :type package: str + :param release_data: The metadata about the current release of the package. + :type release_data: dict + :param perl_version: The target version of Perl we're building this for. + This only really matters for core modules. + :type perl_version: str + :param output_dir: The output directory to write recipes to + :type output_dir: str + :param processed_packages: The set of packages we have built recipes for + already. + + :returns: Build dependencies, runtime dependencies, and set of packages to + add to list of recipes to create. + :rtype: 3-tuple of sets + """ + + # Create lists of dependencies + deps = { + "build": {"core": set(), "noncore": set()}, + "test": {"core": set(), "noncore": set()}, + "run": {"core": set(), "noncore": set()}, + } + phase_to_dep_type = { + "build": "build", + "configure": "build", + "test": "test", + "runtime": "run", + # TODO :: Check this, I am unsure about it .. + # These (sometimes?) reference sub-components of modules + # e.g. inc::MMPackageStash instead of inc which does not + # get found on metacpan fastapi. We may need to chop the + # suffix off an try again (and repeat until we find it). + "x_Dist_Zilla": None, + "develop": None, + } + packages_to_append = set() + + print("Processing dependencies for %s..." % package, end="") + sys.stdout.flush() + + if not release_data.get("dependency"): + return deps, packages_to_append + + # release_data['dependency'] = ['FindBin-libs' if r == 'FindBin' else r for r in release_data['dependency']] + new_deps = [] + for dep in release_data["dependency"]: + if "phase" in dep and dep["phase"] == "develop": + print("Skipping develop dependency {}".format(dep["module"])) + continue + elif "module" in dep and dep["module"] == "FindBin": + dep["module"] = "FindBin::Bin" + elif "module" in dep and dep["module"] == "Exporter": + dep["module"] = "Exporter" + new_deps.append(dep) + release_data["dependency"] = new_deps + + for dep_dict in release_data["dependency"]: + # Only care about requirements + try: + if dep_dict["relationship"] == "requires": + if not phase_to_dep_type[dep_dict["phase"]]: + continue + if "module" in dep_dict and dep_dict["module"] == "common::sense": + print("debug common::sense version mismatch") + print(".", end="") + sys.stdout.flush() + # Format dependency string (with Perl trailing dist comment) + orig_dist = dist_for_module( + meta_cpan_url, cache_dir, core_modules, dep_dict["module"] + ) + + dep_entry = perl_to_conda(orig_dist) + # Skip perl as a dependency, since it's already in list + if orig_dist.lower() == "perl": + continue + + # See if version is specified + # There is a dep version and a pkg_version ... why? + if dep_dict["version"] in {"", "undef"}: + dep_dict["version"] = "0" + dep_version = parse_version(dep_dict["version"]) + + # Make sure specified version is valid + # TODO def valid_release_info + try: + get_release_info( + meta_cpan_url, + cache_dir, + core_modules, + dep_dict["module"], + dep_version, + ) + except InvalidReleaseError: + print( + f"WARNING: The version of {orig_dist} listed as a " + f"dependency for {package}, {dep_version}, is not available on MetaCPAN, " + f"so we are just assuming the latest version is " + f"okay." + ) + dep_version = parse_version("0") + + # Add version number to dependency, if it's newer than latest + # we have package for. + if loose_version(dep_version) > loose_version("0"): + pkg_version = latest_pkg_version(dep_entry) + # If we don't have a package, use core version as version + if pkg_version is None: + # pkg_version = core_module_version(dep_entry, + # perl_version, + # config=config) + # print('dep entry is {}'.format(dep_entry)) + pkg_version = metacpan_api_get_core_version( + core_modules, dep_dict["module"] + ) + # If no package is available at all, it's in the core, or + # the latest is already good enough, don't specify version. + # This is because conda doesn't support > in version + # requirements. + # J = Conda does support >= ? + try: + if pkg_version is not None and ( + loose_version(dep_version) > loose_version(pkg_version) + ): + dep_entry += " " + dep_dict["version"] + except Exception: + print("We have got an expected error with dependency versions") + print("Module {}".format(dep_dict["module"])) + print(f"Pkg_version {pkg_version}") + print(f"Dep Version {dep_version}") + + # If recursive, check if we have a recipe for this dependency + if recursive: + # If dependency entry is versioned, make sure this is too + if " " in dep_entry: + if not exists(join(output_dir, dep_entry.replace("::", "-"))): + packages_to_append.add( + ("=".join((orig_dist, dep_dict["version"]))), + dep_dict["module"], + ) + elif not glob(join(output_dir, (dep_entry + "-[v1-9][0-9.]*"))): + packages_to_append.add((orig_dist, dep_dict["module"])) + + # Add to appropriate dependency list + core = metacpan_api_is_core_version(meta_cpan_url, dep_dict["module"]) + + cb_phase = phase_to_dep_type[dep_dict["phase"]] + if cb_phase: + if core: + deps[cb_phase]["core"].add(dep_entry) + else: + deps[cb_phase]["noncore"].add(dep_entry) + else: + print( + "Skipping {} dependency {}".format(dep_dict["phase"], dep_entry) + ) + # seemingly new in conda 4.3: HTTPErrors arise when we ask for + # something that is a + # perl module, but not a package. + # See https://github.com/conda/conda-build/issues/1675 + except (CondaError, CondaHTTPError): + continue + + print(f"module {package} adds {packages_to_append}") + + return deps, packages_to_append + + +def dist_for_module(cpan_url, cache_dir, core_modules, module): + """ + Given a name that could be a module or a distribution, return the + distribution. + """ + if "Git::Check" in module: + print("debug this") + # First check if it is a core module, those mask distributions here, or at least they + # do in the case of `import Exporter` + distribution = None + try: + mod_dict = core_module_dict(core_modules, module) + distribution = mod_dict["distribution"] + except: + # Next check if its already a distribution + rel_dict = release_module_dict(cpan_url, cache_dir, module) + if rel_dict is not None: + if rel_dict["distribution"] != module.replace("::", "-"): + print( + "WARNING :: module {} found in distribution {}".format( + module, rel_dict["distribution"] + ) + ) + distribution = rel_dict["distribution"] + if not distribution: + print("debug") + assert distribution, "dist_for_module must succeed" + + return distribution + + +def release_module_dict_direct(cpan_url, cache_dir, module): + if "Dist-Zilla-Plugin-Git" in module: + print(f"debug {module}") + elif "Dist::Zilla::Plugin::Git" in module: + print(f"debug {module}") + elif "Time::Zone" in module: + print(f"debug {module}") + + try: + url_module = f"{cpan_url}/module/{module}" + print(f"INFO :: url_module {url_module}") + rel_dict = get_cpan_api_url(url_module, colons=True) + except RuntimeError: + rel_dict = None + except CondaHTTPError: + rel_dict = None + if not rel_dict: + print(f"WARNING :: Did not find rel_dict for module {module}") + distribution = module.replace("::", "-") + if not rel_dict or "dependency" not in rel_dict: + if rel_dict and "distribution" in rel_dict: + distribution = rel_dict["distribution"] + else: + print( + f"WARNING :: 'distribution' was not in {module}'s module info, making it up" + ) + try: + url_release = f"{cpan_url}/release/{distribution}" + rel_dict2 = get_cpan_api_url(url_release, colons=False) + rel_dict = rel_dict2 + except RuntimeError: + rel_dict = None + except CondaHTTPError: + rel_dict = None + else: + print(f"INFO :: OK, found 'dependency' in module {module}") + if not rel_dict or "dependency" not in rel_dict: + print( + f"WARNING :: No dependencies found for module {module} in distribution {distribution}\n" + f"WARNING :: Please check {url_module} and {url_release}" + ) + return rel_dict + + +def release_module_dict(cpan_url, cache_dir, module): + if "Regexp-Common" in module: + print("debug") + rel_dict = release_module_dict_direct(cpan_url, cache_dir, module) + if not rel_dict: + # In this case, the module may be a submodule of another dist, let's try something else. + # An example of this is Dist::Zilla::Plugin::Git::Check. + pickled = get_pickle_file_path(cache_dir, module + ".dl_url") + url = f"{cpan_url}/download_url/{module}" + try: + os.makedirs(os.path.dirname(pickled)) + except: + pass + download(url, pickled) + with open(pickled, "rb") as dl_url_json: + output = dl_url_json.read() + if hasattr(output, "decode"): + output = output.decode("utf-8-sig") + dl_url_dict = json.loads(output) + if dl_url_dict["release"].endswith(dl_url_dict["version"]): + # Easy case. + print(f"Up to date: {module}") + dist = dl_url_dict["release"].replace("-" + dl_url_dict["version"], "") + else: + # Difficult case. + print(f"Not up to date: {module}") + # cpan -D Time::Zone + # Time::Zone + # ------------------------------------------------------------------------- + # (no description) + # A/AT/ATOOMIC/TimeDate-2.33.tar.gz + # (no installation file) + # Installed: not installed + # CPAN: 2.24 Not up to date + # icolas . (ATOOMIC) + # atoomic@cpan.org + # + # .. there is no field that lists a version of '2.33' in the data. We need + # to inspect the tarball. + dst = os.path.join(cache_dir, basename(dl_url_dict["download_url"])) + download(dl_url_dict["download_url"], dst) + with gzip.open(dst) as dist_json_file: + output = dist_json_file.read() + # (base) Rays-Mac-Pro:Volumes rdonnelly$ cpan -D Time::Zone + rel_dict = release_module_dict_direct(cpan_url, cache_dir, dist) + + return rel_dict + + +def core_module_dict_old(cpan_url, module): + if "FindBin" in module: + print("debug") + if "Exporter" in module: + print("debug") + try: + mod_dict = get_cpan_api_url(f"{cpan_url}/module/{module}", colons=True) + # If there was an error, report it + except CondaHTTPError as e: + sys.exit( + f"Error: Could not find module or distribution named" + f" {module} on MetaCPAN. Error was: {e.message}" + ) + else: + mod_dict = {"distribution": "perl"} + + return mod_dict + + +def core_module_dict(core_modules, module): + if module in core_modules: + return {"distribution": "perl"} + return None + + +@lru_cache(maxsize=None) +def metacpan_api_is_core_version(cpan_url, module): + if "FindBin" in module: + print("debug") + url = f"{cpan_url}/release/{module}" + url = url.replace("::", "-") + req = requests.get(url) + + if req.status_code == 200: + return False + else: + url = f"{cpan_url}/module/{module}" + req = requests.get(url) + if req.status_code == 200: + return True + else: + sys.exit( + ( + "Error: Could not find module or distribution named" + " %s on MetaCPAN." + ) + % (module) + ) + + +def metacpan_api_get_core_version(core_modules, module): + module_dict = core_module_dict(core_modules, module) + try: + version = module_dict["module"][-1]["version"] + except Exception: + version = None + + return version + + +def get_release_info(cpan_url, cache_dir, core_modules, package, version): + """ + Return a dictionary of the JSON information stored at cpan.metacpan.org + corresponding to the given package/dist/module. + """ + # Transform module name to dist name if necessary + orig_package = package + package = dist_for_module(cpan_url, cache_dir, core_modules, package) + + # Get latest info to find author, which is necessary for retrieving a + # specific version + try: + rel_dict = get_cpan_api_url(f"{cpan_url}/release/{package}", colons=False) + rel_dict["version"] = str(rel_dict["version"]).lstrip("v") + except CondaHTTPError: + core_version = metacpan_api_is_core_version(cpan_url, package) + if core_version is not None and (version is None or (version == core_version)): + print( + f"WARNING: {orig_package} is not available on MetaCPAN, but it's a " + f"core module, so we do not actually need the source file, " + f"and are omitting the URL and MD5 from the recipe " + f"entirely." + ) + rel_dict = { + "version": str(core_version), + "download_url": "", + "license": ["perl_5"], + "dependency": {}, + } + else: + sys.exit( + ("Error: Could not find any versions of package %s on " + "MetaCPAN.") + % (orig_package) + ) + + version_mismatch = False + + if version is not None: + version_str = str(version) + rel_version = str(rel_dict["version"]) + loose_str = str(parse_version(version_str)) + + try: + version_mismatch = (version is not None) and ( + loose_version("0") != loose_version(version_str) + and parse_version(rel_version) != loose_version(version_str) + ) + # print(version_mismatch) + except Exception as e: + print("We have some strange version mismatches. Please investigate.") + print(e) + print(f"Package {package}") + print(f"Version {version}") + print("Pkg Version {}".format(rel_dict["version"])) + print(f"Loose Version {loose_str}") + + # TODO - check for major/minor version mismatches + # Allow for minor + if version_mismatch: + print(f"WARNING :: Version mismatch in {package}") + print(f"WARNING :: Version: {version_str}, RelVersion: {rel_version}") + + return rel_dict + + +def get_checksum_and_size(download_url): + """ + Looks in the CHECKSUMS file in the same directory as the file specified + at download_url and returns the sha256 hash and file size. + """ + base_url = dirname(download_url) + filename = basename(download_url) + with PerlTmpDownload(base_url + "/CHECKSUMS") as checksum_path: + with open(checksum_path) as checksum_file: + found_file = False + sha256 = None + size = None + for line in checksum_file: + line = line.strip() + if line.startswith("'" + filename): + found_file = True + elif found_file: + if line.startswith("'sha256'"): + sha256 = line.split("=>")[1].strip("', ") + elif line.startswith("'size"): + size = line.split("=>")[1].strip("', ") + break + # This should never happen, but just in case + elif line.startswith("}"): + break + return sha256, size + + +def perl_to_conda(name): + """Sanitizes a Perl package name for use as a conda package name.""" + return "perl-" + name.replace("::", "-").lower() diff --git a/shared/package-files/34/340faee6b313ac3143142f10cd129410a306d39eb584e0f8a814ebdd9e29bfa1/blob b/shared/package-files/34/340faee6b313ac3143142f10cd129410a306d39eb584e0f8a814ebdd9e29bfa1/blob new file mode 100644 index 0000000000000000000000000000000000000000..4a7105d17916a7237f3df6e59d65ca82375f8803 --- /dev/null +++ b/shared/package-files/34/340faee6b313ac3143142f10cd129410a306d39eb584e0f8a814ebdd9e29bfa1/blob @@ -0,0 +1,221 @@ +import io +import socket +import ssl + +from ..exceptions import ProxySchemeUnsupported +from ..packages import six + +SSL_BLOCKSIZE = 16384 + + +class SSLTransport: + """ + The SSLTransport wraps an existing socket and establishes an SSL connection. + + Contrary to Python's implementation of SSLSocket, it allows you to chain + multiple TLS connections together. It's particularly useful if you need to + implement TLS within TLS. + + The class supports most of the socket API operations. + """ + + @staticmethod + def _validate_ssl_context_for_tls_in_tls(ssl_context): + """ + Raises a ProxySchemeUnsupported if the provided ssl_context can't be used + for TLS in TLS. + + The only requirement is that the ssl_context provides the 'wrap_bio' + methods. + """ + + if not hasattr(ssl_context, "wrap_bio"): + if six.PY2: + raise ProxySchemeUnsupported( + "TLS in TLS requires SSLContext.wrap_bio() which isn't " + "supported on Python 2" + ) + else: + raise ProxySchemeUnsupported( + "TLS in TLS requires SSLContext.wrap_bio() which isn't " + "available on non-native SSLContext" + ) + + def __init__( + self, socket, ssl_context, server_hostname=None, suppress_ragged_eofs=True + ): + """ + Create an SSLTransport around socket using the provided ssl_context. + """ + self.incoming = ssl.MemoryBIO() + self.outgoing = ssl.MemoryBIO() + + self.suppress_ragged_eofs = suppress_ragged_eofs + self.socket = socket + + self.sslobj = ssl_context.wrap_bio( + self.incoming, self.outgoing, server_hostname=server_hostname + ) + + # Perform initial handshake. + self._ssl_io_loop(self.sslobj.do_handshake) + + def __enter__(self): + return self + + def __exit__(self, *_): + self.close() + + def fileno(self): + return self.socket.fileno() + + def read(self, len=1024, buffer=None): + return self._wrap_ssl_read(len, buffer) + + def recv(self, len=1024, flags=0): + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv") + return self._wrap_ssl_read(len) + + def recv_into(self, buffer, nbytes=None, flags=0): + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv_into") + if buffer and (nbytes is None): + nbytes = len(buffer) + elif nbytes is None: + nbytes = 1024 + return self.read(nbytes, buffer) + + def sendall(self, data, flags=0): + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to sendall") + count = 0 + with memoryview(data) as view, view.cast("B") as byte_view: + amount = len(byte_view) + while count < amount: + v = self.send(byte_view[count:]) + count += v + + def send(self, data, flags=0): + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to send") + response = self._ssl_io_loop(self.sslobj.write, data) + return response + + def makefile( + self, mode="r", buffering=None, encoding=None, errors=None, newline=None + ): + """ + Python's httpclient uses makefile and buffered io when reading HTTP + messages and we need to support it. + + This is unfortunately a copy and paste of socket.py makefile with small + changes to point to the socket directly. + """ + if not set(mode) <= {"r", "w", "b"}: + raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,)) + + writing = "w" in mode + reading = "r" in mode or not writing + assert reading or writing + binary = "b" in mode + rawmode = "" + if reading: + rawmode += "r" + if writing: + rawmode += "w" + raw = socket.SocketIO(self, rawmode) + self.socket._io_refs += 1 + if buffering is None: + buffering = -1 + if buffering < 0: + buffering = io.DEFAULT_BUFFER_SIZE + if buffering == 0: + if not binary: + raise ValueError("unbuffered streams must be binary") + return raw + if reading and writing: + buffer = io.BufferedRWPair(raw, raw, buffering) + elif reading: + buffer = io.BufferedReader(raw, buffering) + else: + assert writing + buffer = io.BufferedWriter(raw, buffering) + if binary: + return buffer + text = io.TextIOWrapper(buffer, encoding, errors, newline) + text.mode = mode + return text + + def unwrap(self): + self._ssl_io_loop(self.sslobj.unwrap) + + def close(self): + self.socket.close() + + def getpeercert(self, binary_form=False): + return self.sslobj.getpeercert(binary_form) + + def version(self): + return self.sslobj.version() + + def cipher(self): + return self.sslobj.cipher() + + def selected_alpn_protocol(self): + return self.sslobj.selected_alpn_protocol() + + def selected_npn_protocol(self): + return self.sslobj.selected_npn_protocol() + + def shared_ciphers(self): + return self.sslobj.shared_ciphers() + + def compression(self): + return self.sslobj.compression() + + def settimeout(self, value): + self.socket.settimeout(value) + + def gettimeout(self): + return self.socket.gettimeout() + + def _decref_socketios(self): + self.socket._decref_socketios() + + def _wrap_ssl_read(self, len, buffer=None): + try: + return self._ssl_io_loop(self.sslobj.read, len, buffer) + except ssl.SSLError as e: + if e.errno == ssl.SSL_ERROR_EOF and self.suppress_ragged_eofs: + return 0 # eof, return 0. + else: + raise + + def _ssl_io_loop(self, func, *args): + """Performs an I/O loop between incoming/outgoing and the socket.""" + should_loop = True + ret = None + + while should_loop: + errno = None + try: + ret = func(*args) + except ssl.SSLError as e: + if e.errno not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE): + # WANT_READ, and WANT_WRITE are expected, others are not. + raise e + errno = e.errno + + buf = self.outgoing.read() + self.socket.sendall(buf) + + if errno is None: + should_loop = False + elif errno == ssl.SSL_ERROR_WANT_READ: + buf = self.socket.recv(SSL_BLOCKSIZE) + if buf: + self.incoming.write(buf) + else: + self.incoming.write_eof() + return ret diff --git a/shared/package-files/34/3411d55cef15d7feb19368303287c57d5b7d9d7d540a75c78bbf364bacc1602c/blob b/shared/package-files/34/3411d55cef15d7feb19368303287c57d5b7d9d7d540a75c78bbf364bacc1602c/blob new file mode 100644 index 0000000000000000000000000000000000000000..da655883f3f69db316a23362de485ba412d212b5 --- /dev/null +++ b/shared/package-files/34/3411d55cef15d7feb19368303287c57d5b7d9d7d540a75c78bbf364bacc1602c/blob @@ -0,0 +1,22 @@ +#pragma once + +#include + +namespace torch { +namespace autograd { +namespace utils { + +inline std::string requires_grad_leaf_error(bool requires_grad) { + std::ostringstream oss; + oss << "you can only change requires_grad flags of leaf variables."; + if (requires_grad == false) { + oss << " If you want to use a computed variable in a subgraph " + "that doesn't require differentiation use " + "var_no_grad = var.detach()."; + } + return oss.str(); +} + +} // namespace utils +} // namespace autograd +} // namespace torch diff --git a/shared/package-files/34/34130ad85e83d6c5de62137db97e6f9f4f2699bf8d01f636eb1d38b118338843/blob b/shared/package-files/34/34130ad85e83d6c5de62137db97e6f9f4f2699bf8d01f636eb1d38b118338843/blob new file mode 100644 index 0000000000000000000000000000000000000000..fd884d762101fded87d988f8f24dc7c9582a3104 --- /dev/null +++ b/shared/package-files/34/34130ad85e83d6c5de62137db97e6f9f4f2699bf8d01f636eb1d38b118338843/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API inverse { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::inverse") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "inverse(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API inverse_out { + using schema = at::Tensor & (const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::inverse") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "inverse.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/34/3416520f14de14fc066edfe3f2b08b820895537e690d9a6066ce24c4b7544a93/blob b/shared/package-files/34/3416520f14de14fc066edfe3f2b08b820895537e690d9a6066ce24c4b7544a93/blob new file mode 100644 index 0000000000000000000000000000000000000000..559a17a13d6ae35f4a97a008d6e4c07e4dc77923 --- /dev/null +++ b/shared/package-files/34/3416520f14de14fc066edfe3f2b08b820895537e690d9a6066ce24c4b7544a93/blob @@ -0,0 +1,630 @@ +# coding=utf8 +""" +Label propagation in the context of this module refers to a set of +semi-supervised classification algorithms. At a high level, these algorithms +work by forming a fully-connected graph between all points given and solving +for the steady-state distribution of labels at each point. + +These algorithms perform very well in practice. The cost of running can be very +expensive, at approximately O(N^3) where N is the number of (labeled and +unlabeled) points. The theory (why they perform so well) is motivated by +intuitions from random walk algorithms and geometric relationships in the data. +For more information see the references below. + +Model Features +-------------- +Label clamping: + The algorithm tries to learn distributions of labels over the dataset given + label assignments over an initial subset. In one variant, the algorithm does + not allow for any errors in the initial assignment (hard-clamping) while + in another variant, the algorithm allows for some wiggle room for the initial + assignments, allowing them to change by a fraction alpha in each iteration + (soft-clamping). + +Kernel: + A function which projects a vector into some higher dimensional space. This + implementation supports RBF and KNN kernels. Using the RBF kernel generates + a dense matrix of size O(N^2). KNN kernel will generate a sparse matrix of + size O(k*N) which will run much faster. See the documentation for SVMs for + more info on kernels. + +Examples +-------- +>>> import numpy as np +>>> from sklearn import datasets +>>> from sklearn.semi_supervised import LabelPropagation +>>> label_prop_model = LabelPropagation() +>>> iris = datasets.load_iris() +>>> rng = np.random.RandomState(42) +>>> random_unlabeled_points = rng.rand(len(iris.target)) < 0.3 +>>> labels = np.copy(iris.target) +>>> labels[random_unlabeled_points] = -1 +>>> label_prop_model.fit(iris.data, labels) +LabelPropagation(...) + +Notes +----- +References: +[1] Yoshua Bengio, Olivier Delalleau, Nicolas Le Roux. In Semi-Supervised +Learning (2006), pp. 193-216 + +[2] Olivier Delalleau, Yoshua Bengio, Nicolas Le Roux. Efficient +Non-Parametric Function Induction in Semi-Supervised Learning. AISTAT 2005 +""" + +# Authors: The scikit-learn developers +# SPDX-License-Identifier: BSD-3-Clause + +import warnings +from abc import ABCMeta, abstractmethod +from numbers import Integral, Real + +import numpy as np +from scipy import sparse + +from ..base import BaseEstimator, ClassifierMixin, _fit_context +from ..exceptions import ConvergenceWarning +from ..metrics.pairwise import rbf_kernel +from ..neighbors import NearestNeighbors +from ..utils._param_validation import Interval, StrOptions +from ..utils.extmath import safe_sparse_dot +from ..utils.fixes import laplacian as csgraph_laplacian +from ..utils.multiclass import check_classification_targets +from ..utils.validation import check_is_fitted, validate_data + + +class BaseLabelPropagation(ClassifierMixin, BaseEstimator, metaclass=ABCMeta): + """Base class for label propagation module. + + Parameters + ---------- + kernel : {'knn', 'rbf'} or callable, default='rbf' + String identifier for kernel function to use or the kernel function + itself. Only 'rbf' and 'knn' strings are valid inputs. The function + passed should take two inputs, each of shape (n_samples, n_features), + and return a (n_samples, n_samples) shaped weight matrix. + + gamma : float, default=20 + Parameter for rbf kernel. + + n_neighbors : int, default=7 + Parameter for knn kernel. Need to be strictly positive. + + alpha : float, default=1.0 + Clamping factor. + + max_iter : int, default=30 + Change maximum number of iterations allowed. + + tol : float, default=1e-3 + Convergence tolerance: threshold to consider the system at steady + state. + + n_jobs : int, default=None + The number of parallel jobs to run. + ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context. + ``-1`` means using all processors. See :term:`Glossary ` + for more details. + """ + + _parameter_constraints: dict = { + "kernel": [StrOptions({"knn", "rbf"}), callable], + "gamma": [Interval(Real, 0, None, closed="left")], + "n_neighbors": [Interval(Integral, 0, None, closed="neither")], + "alpha": [None, Interval(Real, 0, 1, closed="neither")], + "max_iter": [Interval(Integral, 0, None, closed="neither")], + "tol": [Interval(Real, 0, None, closed="left")], + "n_jobs": [None, Integral], + } + + def __init__( + self, + kernel="rbf", + *, + gamma=20, + n_neighbors=7, + alpha=1, + max_iter=30, + tol=1e-3, + n_jobs=None, + ): + self.max_iter = max_iter + self.tol = tol + + # kernel parameters + self.kernel = kernel + self.gamma = gamma + self.n_neighbors = n_neighbors + + # clamping factor + self.alpha = alpha + + self.n_jobs = n_jobs + + def _get_kernel(self, X, y=None): + if self.kernel == "rbf": + if y is None: + return rbf_kernel(X, X, gamma=self.gamma) + else: + return rbf_kernel(X, y, gamma=self.gamma) + elif self.kernel == "knn": + if self.nn_fit is None: + self.nn_fit = NearestNeighbors( + n_neighbors=self.n_neighbors, n_jobs=self.n_jobs + ).fit(X) + if y is None: + return self.nn_fit.kneighbors_graph( + self.nn_fit._fit_X, self.n_neighbors, mode="connectivity" + ) + else: + return self.nn_fit.kneighbors(y, return_distance=False) + elif callable(self.kernel): + if y is None: + return self.kernel(X, X) + else: + return self.kernel(X, y) + + @abstractmethod + def _build_graph(self): + raise NotImplementedError( + "Graph construction must be implemented to fit a label propagation model." + ) + + def predict(self, X): + """Perform inductive inference across the model. + + Parameters + ---------- + X : array-like of shape (n_samples, n_features) + The data matrix. + + Returns + ------- + y : ndarray of shape (n_samples,) + Predictions for input data. + """ + # Note: since `predict` does not accept semi-supervised labels as input, + # `fit(X, y).predict(X) != fit(X, y).transduction_`. + # Hence, `fit_predict` is not implemented. + # See https://github.com/scikit-learn/scikit-learn/pull/24898 + probas = self.predict_proba(X) + return self.classes_[np.argmax(probas, axis=1)].ravel() + + def predict_proba(self, X): + """Predict probability for each possible outcome. + + Compute the probability estimates for each single sample in X + and each possible outcome seen during training (categorical + distribution). + + Parameters + ---------- + X : array-like of shape (n_samples, n_features) + The data matrix. + + Returns + ------- + probabilities : ndarray of shape (n_samples, n_classes) + Normalized probability distributions across + class labels. + """ + check_is_fitted(self) + + X_2d = validate_data( + self, + X, + accept_sparse=["csc", "csr", "coo", "dok", "bsr", "lil", "dia"], + reset=False, + ) + weight_matrices = self._get_kernel(self.X_, X_2d) + if self.kernel == "knn": + probabilities = np.array( + [ + np.sum(self.label_distributions_[weight_matrix], axis=0) + for weight_matrix in weight_matrices + ] + ) + else: + weight_matrices = weight_matrices.T + probabilities = safe_sparse_dot(weight_matrices, self.label_distributions_) + normalizer = np.atleast_2d(np.sum(probabilities, axis=1)).T + probabilities /= normalizer + return probabilities + + @_fit_context(prefer_skip_nested_validation=True) + def fit(self, X, y): + """Fit a semi-supervised label propagation model to X. + + The input samples (labeled and unlabeled) are provided by matrix X, + and target labels are provided by matrix y. We conventionally apply the + label -1 to unlabeled samples in matrix y in a semi-supervised + classification. + + Parameters + ---------- + X : {array-like, sparse matrix} of shape (n_samples, n_features) + Training data, where `n_samples` is the number of samples + and `n_features` is the number of features. + + y : array-like of shape (n_samples,) + Target class values with unlabeled points marked as -1. + All unlabeled samples will be transductively assigned labels + internally, which are stored in `transduction_`. + + Returns + ------- + self : object + Returns the instance itself. + """ + X, y = validate_data( + self, + X, + y, + accept_sparse=["csr", "csc"], + reset=True, + ) + self.X_ = X + check_classification_targets(y) + + # actual graph construction (implementations should override this) + graph_matrix = self._build_graph() + + # label construction + # construct a categorical distribution for classification only + classes = np.unique(y) + classes = classes[classes != -1] + self.classes_ = classes + + n_samples, n_classes = len(y), len(classes) + + y = np.asarray(y) + unlabeled = y == -1 + + # initialize distributions + self.label_distributions_ = np.zeros((n_samples, n_classes)) + for label in classes: + self.label_distributions_[y == label, classes == label] = 1 + + y_static = np.copy(self.label_distributions_) + if self._variant == "propagation": + # LabelPropagation + y_static[unlabeled] = 0 + else: + # LabelSpreading + y_static *= 1 - self.alpha + + l_previous = np.zeros((self.X_.shape[0], n_classes)) + + unlabeled = unlabeled[:, np.newaxis] + if sparse.issparse(graph_matrix): + graph_matrix = graph_matrix.tocsr() + + for self.n_iter_ in range(self.max_iter): + if np.abs(self.label_distributions_ - l_previous).sum() < self.tol: + break + + l_previous = self.label_distributions_ + self.label_distributions_ = safe_sparse_dot( + graph_matrix, self.label_distributions_ + ) + + if self._variant == "propagation": + normalizer = np.sum(self.label_distributions_, axis=1)[:, np.newaxis] + normalizer[normalizer == 0] = 1 + self.label_distributions_ /= normalizer + self.label_distributions_ = np.where( + unlabeled, self.label_distributions_, y_static + ) + else: + # clamp + self.label_distributions_ = ( + np.multiply(self.alpha, self.label_distributions_) + y_static + ) + else: + warnings.warn( + "max_iter=%d was reached without convergence." % self.max_iter, + category=ConvergenceWarning, + ) + self.n_iter_ += 1 + + normalizer = np.sum(self.label_distributions_, axis=1)[:, np.newaxis] + normalizer[normalizer == 0] = 1 + self.label_distributions_ /= normalizer + + # set the transduction item + transduction = self.classes_[np.argmax(self.label_distributions_, axis=1)] + self.transduction_ = transduction.ravel() + return self + + def __sklearn_tags__(self): + tags = super().__sklearn_tags__() + tags.input_tags.sparse = True + return tags + + +class LabelPropagation(BaseLabelPropagation): + """Label Propagation classifier. + + Read more in the :ref:`User Guide `. + + Parameters + ---------- + kernel : {'knn', 'rbf'} or callable, default='rbf' + String identifier for kernel function to use or the kernel function + itself. Only 'rbf' and 'knn' strings are valid inputs. The function + passed should take two inputs, each of shape (n_samples, n_features), + and return a (n_samples, n_samples) shaped weight matrix. + + gamma : float, default=20 + Parameter for rbf kernel. + + n_neighbors : int, default=7 + Parameter for knn kernel which need to be strictly positive. + + max_iter : int, default=1000 + Change maximum number of iterations allowed. + + tol : float, default=1e-3 + Convergence tolerance: threshold to consider the system at steady + state. + + n_jobs : int, default=None + The number of parallel jobs to run. + ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context. + ``-1`` means using all processors. See :term:`Glossary ` + for more details. + + Attributes + ---------- + X_ : {array-like, sparse matrix} of shape (n_samples, n_features) + Input array. + + classes_ : ndarray of shape (n_classes,) + The distinct labels used in classifying instances. + + label_distributions_ : ndarray of shape (n_samples, n_classes) + Categorical distribution for each item. + + transduction_ : ndarray of shape (n_samples) + Label assigned to each item during :term:`fit`. + + n_features_in_ : int + Number of features seen during :term:`fit`. + + .. versionadded:: 0.24 + + feature_names_in_ : ndarray of shape (`n_features_in_`,) + Names of features seen during :term:`fit`. Defined only when `X` + has feature names that are all strings. + + .. versionadded:: 1.0 + + n_iter_ : int + Number of iterations run. + + See Also + -------- + LabelSpreading : Alternate label propagation strategy more robust to noise. + + References + ---------- + Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data + with label propagation. Technical Report CMU-CALD-02-107, Carnegie Mellon + University, 2002 http://pages.cs.wisc.edu/~jerryzhu/pub/CMU-CALD-02-107.pdf + + Examples + -------- + >>> import numpy as np + >>> from sklearn import datasets + >>> from sklearn.semi_supervised import LabelPropagation + >>> label_prop_model = LabelPropagation() + >>> iris = datasets.load_iris() + >>> rng = np.random.RandomState(42) + >>> random_unlabeled_points = rng.rand(len(iris.target)) < 0.3 + >>> labels = np.copy(iris.target) + >>> labels[random_unlabeled_points] = -1 + >>> label_prop_model.fit(iris.data, labels) + LabelPropagation(...) + """ + + _variant = "propagation" + + _parameter_constraints: dict = {**BaseLabelPropagation._parameter_constraints} + _parameter_constraints.pop("alpha") + + def __init__( + self, + kernel="rbf", + *, + gamma=20, + n_neighbors=7, + max_iter=1000, + tol=1e-3, + n_jobs=None, + ): + super().__init__( + kernel=kernel, + gamma=gamma, + n_neighbors=n_neighbors, + max_iter=max_iter, + tol=tol, + n_jobs=n_jobs, + alpha=None, + ) + + def _build_graph(self): + """Matrix representing a fully connected graph between each sample + + This basic implementation creates a non-stochastic affinity matrix, so + class distributions will exceed 1 (normalization may be desired). + """ + if self.kernel == "knn": + self.nn_fit = None + affinity_matrix = self._get_kernel(self.X_) + normalizer = affinity_matrix.sum(axis=0) + if sparse.issparse(affinity_matrix): + affinity_matrix.data /= np.diag(np.array(normalizer)) + else: + affinity_matrix /= normalizer[:, np.newaxis] + return affinity_matrix + + def fit(self, X, y): + """Fit a semi-supervised label propagation model to X. + + Parameters + ---------- + X : {array-like, sparse matrix} of shape (n_samples, n_features) + Training data, where `n_samples` is the number of samples + and `n_features` is the number of features. + + y : array-like of shape (n_samples,) + Target class values with unlabeled points marked as -1. + All unlabeled samples will be transductively assigned labels + internally, which are stored in `transduction_`. + + Returns + ------- + self : object + Returns the instance itself. + """ + return super().fit(X, y) + + +class LabelSpreading(BaseLabelPropagation): + """LabelSpreading model for semi-supervised learning. + + This model is similar to the basic Label Propagation algorithm, + but uses affinity matrix based on the normalized graph Laplacian + and soft clamping across the labels. + + Read more in the :ref:`User Guide `. + + Parameters + ---------- + kernel : {'knn', 'rbf'} or callable, default='rbf' + String identifier for kernel function to use or the kernel function + itself. Only 'rbf' and 'knn' strings are valid inputs. The function + passed should take two inputs, each of shape (n_samples, n_features), + and return a (n_samples, n_samples) shaped weight matrix. + + gamma : float, default=20 + Parameter for rbf kernel. + + n_neighbors : int, default=7 + Parameter for knn kernel which is a strictly positive integer. + + alpha : float, default=0.2 + Clamping factor. A value in (0, 1) that specifies the relative amount + that an instance should adopt the information from its neighbors as + opposed to its initial label. + alpha=0 means keeping the initial label information; alpha=1 means + replacing all initial information. + + max_iter : int, default=30 + Maximum number of iterations allowed. + + tol : float, default=1e-3 + Convergence tolerance: threshold to consider the system at steady + state. + + n_jobs : int, default=None + The number of parallel jobs to run. + ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context. + ``-1`` means using all processors. See :term:`Glossary ` + for more details. + + Attributes + ---------- + X_ : ndarray of shape (n_samples, n_features) + Input array. + + classes_ : ndarray of shape (n_classes,) + The distinct labels used in classifying instances. + + label_distributions_ : ndarray of shape (n_samples, n_classes) + Categorical distribution for each item. + + transduction_ : ndarray of shape (n_samples,) + Label assigned to each item during :term:`fit`. + + n_features_in_ : int + Number of features seen during :term:`fit`. + + .. versionadded:: 0.24 + + feature_names_in_ : ndarray of shape (`n_features_in_`,) + Names of features seen during :term:`fit`. Defined only when `X` + has feature names that are all strings. + + .. versionadded:: 1.0 + + n_iter_ : int + Number of iterations run. + + See Also + -------- + LabelPropagation : Unregularized graph based semi-supervised learning. + + References + ---------- + `Dengyong Zhou, Olivier Bousquet, Thomas Navin Lal, Jason Weston, + Bernhard Schoelkopf. Learning with local and global consistency (2004) + `_ + + Examples + -------- + >>> import numpy as np + >>> from sklearn import datasets + >>> from sklearn.semi_supervised import LabelSpreading + >>> label_prop_model = LabelSpreading() + >>> iris = datasets.load_iris() + >>> rng = np.random.RandomState(42) + >>> random_unlabeled_points = rng.rand(len(iris.target)) < 0.3 + >>> labels = np.copy(iris.target) + >>> labels[random_unlabeled_points] = -1 + >>> label_prop_model.fit(iris.data, labels) + LabelSpreading(...) + """ + + _variant = "spreading" + + _parameter_constraints: dict = {**BaseLabelPropagation._parameter_constraints} + _parameter_constraints["alpha"] = [Interval(Real, 0, 1, closed="neither")] + + def __init__( + self, + kernel="rbf", + *, + gamma=20, + n_neighbors=7, + alpha=0.2, + max_iter=30, + tol=1e-3, + n_jobs=None, + ): + # this one has different base parameters + super().__init__( + kernel=kernel, + gamma=gamma, + n_neighbors=n_neighbors, + alpha=alpha, + max_iter=max_iter, + tol=tol, + n_jobs=n_jobs, + ) + + def _build_graph(self): + """Graph matrix for Label Spreading computes the graph laplacian""" + # compute affinity matrix (or gram matrix) + if self.kernel == "knn": + self.nn_fit = None + n_samples = self.X_.shape[0] + affinity_matrix = self._get_kernel(self.X_) + laplacian = csgraph_laplacian(affinity_matrix, normed=True) + laplacian = -laplacian + if sparse.issparse(laplacian): + diag_mask = laplacian.row == laplacian.col + laplacian.data[diag_mask] = 0.0 + else: + laplacian.flat[:: n_samples + 1] = 0.0 # set diag to 0.0 + return laplacian diff --git a/shared/package-files/34/34170979fc64f4f5e6dfa66ef27dec314ffffc5852000c60f4836ec1dfbf156e/blob b/shared/package-files/34/34170979fc64f4f5e6dfa66ef27dec314ffffc5852000c60f4836ec1dfbf156e/blob new file mode 100644 index 0000000000000000000000000000000000000000..93e41fb6965a930641ba181a3ae4e1008246d9d5 --- /dev/null +++ b/shared/package-files/34/34170979fc64f4f5e6dfa66ef27dec314ffffc5852000c60f4836ec1dfbf156e/blob @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2021-2025, ContourPy Developers. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/shared/package-files/34/3417fa86467ba72ac42e5854a4ff82beebc13c480eefb16001f843dfc28493e4/blob b/shared/package-files/34/3417fa86467ba72ac42e5854a4ff82beebc13c480eefb16001f843dfc28493e4/blob new file mode 100644 index 0000000000000000000000000000000000000000..9647ea6456426c9a62178ff277b0f35017a8310b --- /dev/null +++ b/shared/package-files/34/3417fa86467ba72ac42e5854a4ff82beebc13c480eefb16001f843dfc28493e4/blob @@ -0,0 +1,297 @@ +"""Delegators for alternative backends in scipy.ndimage. + +The signature of `func_signature` must match the signature of ndimage.func. +The job of a `func_signature` is to know which arguments of `ndimage.func` +are arrays. + +* signatures are generated by + +-------------- +import inspect +from scipy import ndimage + +names = [x for x in dir(ndimage) if not x.startswith('_')] +objs = [getattr(ndimage, name) for name in names] +funcs = [obj for obj in objs if inspect.isroutine(obj)] + +for func in funcs: + sig = inspect.signature(func) + print(f"def {func.__name__}_signature{sig}:\n\tpass\n\n") +--------------- + +* which arguments to delegate on: manually trawled the documentation for + array-like and array arguments + +""" +import numpy as np +from scipy._lib._array_api import array_namespace +from scipy.ndimage._ni_support import _skip_if_dtype, _skip_if_int + + +def affine_transform_signature( + input, matrix, offset=0.0, output_shape=None, output=None, *args, **kwds +): + return array_namespace(input, matrix, _skip_if_dtype(output)) + + +def binary_closing_signature( + input, structure=None, iterations=1, output=None, *args, **kwds +): + return array_namespace(input, structure, _skip_if_dtype(output)) + +binary_opening_signature = binary_closing_signature + + +def binary_dilation_signature( + input, structure=None, iterations=1, mask=None, output=None, *args, **kwds +): + return array_namespace(input, structure, _skip_if_dtype(output), mask) + +binary_erosion_signature = binary_dilation_signature + + +def binary_fill_holes_signature( + input, structure=None, output=None, origin=0, *args, **kwargs +): + return array_namespace(input, structure, _skip_if_dtype(output)) + + +def label_signature(input, structure=None, output=None, origin=0): + return array_namespace(input, structure, _skip_if_dtype(output)) + + +def binary_hit_or_miss_signature( + input, structure1=None, structure2=None, output=None, *args, **kwds +): + return array_namespace(input, structure1, structure2, _skip_if_dtype(output)) + + +def binary_propagation_signature( + input, structure=None, mask=None, output=None, *args, **kwds +): + return array_namespace(input, structure, mask, _skip_if_dtype(output)) + + +def convolve_signature(input, weights, output=None, *args, **kwds): + return array_namespace(input, weights, _skip_if_dtype(output)) + +correlate_signature = convolve_signature + + +def convolve1d_signature(input, weights, axis=-1, output=None, *args, **kwds): + return array_namespace(input, weights, _skip_if_dtype(output)) + +correlate1d_signature = convolve1d_signature + + +def distance_transform_bf_signature( + input, metric='euclidean', sampling=None, return_distances=True, + return_indices=False, distances=None, indices=None +): + return array_namespace(input, distances, indices) + + +def distance_transform_cdt_signature( + input, metric='chessboard', return_distances=True, return_indices=False, + distances=None, indices=None +): + return array_namespace(input, distances, indices) + + +def distance_transform_edt_signature( + input, sampling=None, return_distances=True, return_indices=False, + distances=None, indices=None +): + return array_namespace(input, distances, indices) + + +def find_objects_signature(input, max_label=0): + return array_namespace(input) + + +def fourier_ellipsoid_signature(input, size, n=-1, axis=-1, output=None): + return array_namespace(input, _skip_if_dtype(output)) + +fourier_uniform_signature = fourier_ellipsoid_signature + + +def fourier_gaussian_signature(input, sigma, n=-1, axis=-1, output=None): + return array_namespace(input, _skip_if_dtype(output)) + +def fourier_shift_signature(input, shift, n=-1, axis=-1, output=None): + return array_namespace(input, _skip_if_dtype(output)) + + +def gaussian_filter_signature(input, sigma, order=0, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + + +def gaussian_filter1d_signature( + input, sigma, axis=-1, order=0, output=None, *args, **kwds +): + return array_namespace(input, _skip_if_dtype(output)) + + +def gaussian_gradient_magnitude_signature(input, sigma, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + +gaussian_laplace_signature = gaussian_gradient_magnitude_signature + + +def generate_binary_structure_signature(rank, connectivity): + # XXX: no input arrays; always return numpy + return np + + +def generic_filter_signature( + input, function, size=None, footprint=None, output=None, *args, **kwds +): + # XXX: function LowLevelCallable w/backends + return array_namespace(input, footprint, _skip_if_dtype(output)) + + +def generic_filter1d_signature( + input, function, filter_size, axis=-1, output=None, *args, **kwds +): + return array_namespace(input, _skip_if_dtype(output)) + + +def generic_gradient_magnitude_signature( + input, derivative, output=None, *args, **kwds +): + # XXX: function LowLevelCallable w/backends + return array_namespace(input, _skip_if_dtype(output)) + + +def generic_laplace_signature(input, derivative2, output=None, *args, **kwds): + # XXX: function LowLevelCallable w/backends + return array_namespace(input, _skip_if_dtype(output)) + + +def geometric_transform_signature( + input, mapping, output_shape=None, output=None, *args, **kwds +): + return array_namespace(input, _skip_if_dtype(output)) + + +def histogram_signature(input, min, max, bins, labels=None, index=None): + return array_namespace(input, labels) + + +def iterate_structure_signature(structure, iterations, origin=None): + return array_namespace(structure) + + +def labeled_comprehension_signature(input, labels, *args, **kwds): + return array_namespace(input, labels) + + +def laplace_signature(input, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + + +def map_coordinates_signature(input, coordinates, output=None, *args, **kwds): + return array_namespace(input, coordinates, _skip_if_dtype(output)) + + +def maximum_filter1d_signature(input, size, axis=-1, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + +minimum_filter1d_signature = maximum_filter1d_signature +uniform_filter1d_signature = maximum_filter1d_signature + + +def maximum_signature(input, labels=None, index=None): + return array_namespace(input, labels, _skip_if_int(index)) + +minimum_signature = maximum_signature +median_signature = maximum_signature +mean_signature = maximum_signature +variance_signature = maximum_signature +standard_deviation_signature = maximum_signature +sum_labels_signature = maximum_signature +sum_signature = maximum_signature # ndimage.sum is sum_labels + +maximum_position_signature = maximum_signature +minimum_position_signature = maximum_signature + +extrema_signature = maximum_signature +center_of_mass_signature = extrema_signature + + +def median_filter_signature( + input, size=None, footprint=None, output=None, *args, **kwds +): + return array_namespace(input, footprint, _skip_if_dtype(output)) + +minimum_filter_signature = median_filter_signature +maximum_filter_signature = median_filter_signature + + +def morphological_gradient_signature( + input, size=None, footprint=None, structure=None, output=None, *args, **kwds +): + return array_namespace(input, footprint, structure, _skip_if_dtype(output)) + +morphological_laplace_signature = morphological_gradient_signature +white_tophat_signature = morphological_gradient_signature +black_tophat_signature = morphological_gradient_signature +grey_closing_signature = morphological_gradient_signature +grey_dilation_signature = morphological_gradient_signature +grey_erosion_signature = morphological_gradient_signature +grey_opening_signature = morphological_gradient_signature + + +def percentile_filter_signature( + input, percentile, size=None, footprint=None, output=None, *args, **kwds +): + return array_namespace(input, footprint, _skip_if_dtype(output)) + + +def prewitt_signature(input, axis=-1, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + +sobel_signature = prewitt_signature + + +def rank_filter_signature( + input, rank, size=None, footprint=None, output=None, *args, **kwds +): + return array_namespace(input, footprint, _skip_if_dtype(output)) + + +def rotate_signature( + input, angle, axes=(1, 0), reshape=True, output=None , *args, **kwds +): + return array_namespace(input, _skip_if_dtype(output)) + + +def shift_signature(input, shift, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + + +def spline_filter_signature(input, order=3, output=np.float64, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + + +def spline_filter1d_signature( + input, order=3, axis=-1, output=np.float64, *args, **kwds +): + return array_namespace(input, _skip_if_dtype(output)) + + +def uniform_filter_signature(input, size=3, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + + +def value_indices_signature(arr, *args, **kwds): + return array_namespace(arr) + + +def watershed_ift_signature(input, markers, structure=None, output=None): + return array_namespace(input, markers, structure, _skip_if_dtype(output)) + + +def zoom_signature(input, zoom, output=None, *args, **kwds): + return array_namespace(input, _skip_if_dtype(output)) + diff --git a/shared/package-files/34/341805db3bb0ef9838c8b5f8c40e55ec2a69651998d2a1844a9eab385d0242ba/blob b/shared/package-files/34/341805db3bb0ef9838c8b5f8c40e55ec2a69651998d2a1844a9eab385d0242ba/blob new file mode 100644 index 0000000000000000000000000000000000000000..a365ba8e04aa0e710db7e0e73241aacc923474e4 --- /dev/null +++ b/shared/package-files/34/341805db3bb0ef9838c8b5f8c40e55ec2a69651998d2a1844a9eab385d0242ba/blob @@ -0,0 +1,282 @@ +""" +Parser for parsing a regular expression. +Take a string representing a regular expression and return the root node of its +parse tree. + +usage:: + + root_node = parse_regex('(hello|world)') + +Remarks: +- The regex parser processes multiline, it ignores all whitespace and supports + multiple named groups with the same name and #-style comments. + +Limitations: +- Lookahead is not supported. +""" +from __future__ import annotations + +import re + +__all__ = [ + "Repeat", + "Variable", + "Regex", + "Lookahead", + "tokenize_regex", + "parse_regex", +] + + +class Node: + """ + Base class for all the grammar nodes. + (You don't initialize this one.) + """ + + def __add__(self, other_node: Node) -> NodeSequence: + return NodeSequence([self, other_node]) + + def __or__(self, other_node: Node) -> AnyNode: + return AnyNode([self, other_node]) + + +class AnyNode(Node): + """ + Union operation (OR operation) between several grammars. You don't + initialize this yourself, but it's a result of a "Grammar1 | Grammar2" + operation. + """ + + def __init__(self, children: list[Node]) -> None: + self.children = children + + def __or__(self, other_node: Node) -> AnyNode: + return AnyNode(self.children + [other_node]) + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.children!r})" + + +class NodeSequence(Node): + """ + Concatenation operation of several grammars. You don't initialize this + yourself, but it's a result of a "Grammar1 + Grammar2" operation. + """ + + def __init__(self, children: list[Node]) -> None: + self.children = children + + def __add__(self, other_node: Node) -> NodeSequence: + return NodeSequence(self.children + [other_node]) + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.children!r})" + + +class Regex(Node): + """ + Regular expression. + """ + + def __init__(self, regex: str) -> None: + re.compile(regex) # Validate + + self.regex = regex + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(/{self.regex}/)" + + +class Lookahead(Node): + """ + Lookahead expression. + """ + + def __init__(self, childnode: Node, negative: bool = False) -> None: + self.childnode = childnode + self.negative = negative + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.childnode!r})" + + +class Variable(Node): + """ + Mark a variable in the regular grammar. This will be translated into a + named group. Each variable can have his own completer, validator, etc.. + + :param childnode: The grammar which is wrapped inside this variable. + :param varname: String. + """ + + def __init__(self, childnode: Node, varname: str = "") -> None: + self.childnode = childnode + self.varname = varname + + def __repr__(self) -> str: + return "{}(childnode={!r}, varname={!r})".format( + self.__class__.__name__, + self.childnode, + self.varname, + ) + + +class Repeat(Node): + def __init__( + self, + childnode: Node, + min_repeat: int = 0, + max_repeat: int | None = None, + greedy: bool = True, + ) -> None: + self.childnode = childnode + self.min_repeat = min_repeat + self.max_repeat = max_repeat + self.greedy = greedy + + def __repr__(self) -> str: + return f"{self.__class__.__name__}(childnode={self.childnode!r})" + + +def tokenize_regex(input: str) -> list[str]: + """ + Takes a string, representing a regular expression as input, and tokenizes + it. + + :param input: string, representing a regular expression. + :returns: List of tokens. + """ + # Regular expression for tokenizing other regular expressions. + p = re.compile( + r"""^( + \(\?P\<[a-zA-Z0-9_-]+\> | # Start of named group. + \(\?#[^)]*\) | # Comment + \(\?= | # Start of lookahead assertion + \(\?! | # Start of negative lookahead assertion + \(\?<= | # If preceded by. + \(\?< | # If not preceded by. + \(?: | # Start of group. (non capturing.) + \( | # Start of group. + \(?[iLmsux] | # Flags. + \(?P=[a-zA-Z]+\) | # Back reference to named group + \) | # End of group. + \{[^{}]*\} | # Repetition + \*\? | \+\? | \?\?\ | # Non greedy repetition. + \* | \+ | \? | # Repetition + \#.*\n | # Comment + \\. | + + # Character group. + \[ + ( [^\]\\] | \\.)* + \] | + + [^(){}] | + . + )""", + re.VERBOSE, + ) + + tokens = [] + + while input: + m = p.match(input) + if m: + token, input = input[: m.end()], input[m.end() :] + if not token.isspace(): + tokens.append(token) + else: + raise Exception("Could not tokenize input regex.") + + return tokens + + +def parse_regex(regex_tokens: list[str]) -> Node: + """ + Takes a list of tokens from the tokenizer, and returns a parse tree. + """ + # We add a closing brace because that represents the final pop of the stack. + tokens: list[str] = [")"] + regex_tokens[::-1] + + def wrap(lst: list[Node]) -> Node: + """Turn list into sequence when it contains several items.""" + if len(lst) == 1: + return lst[0] + else: + return NodeSequence(lst) + + def _parse() -> Node: + or_list: list[list[Node]] = [] + result: list[Node] = [] + + def wrapped_result() -> Node: + if or_list == []: + return wrap(result) + else: + or_list.append(result) + return AnyNode([wrap(i) for i in or_list]) + + while tokens: + t = tokens.pop() + + if t.startswith("(?P<"): + variable = Variable(_parse(), varname=t[4:-1]) + result.append(variable) + + elif t in ("*", "*?"): + greedy = t == "*" + result[-1] = Repeat(result[-1], greedy=greedy) + + elif t in ("+", "+?"): + greedy = t == "+" + result[-1] = Repeat(result[-1], min_repeat=1, greedy=greedy) + + elif t in ("?", "??"): + if result == []: + raise Exception("Nothing to repeat." + repr(tokens)) + else: + greedy = t == "?" + result[-1] = Repeat( + result[-1], min_repeat=0, max_repeat=1, greedy=greedy + ) + + elif t == "|": + or_list.append(result) + result = [] + + elif t in ("(", "(?:"): + result.append(_parse()) + + elif t == "(?!": + result.append(Lookahead(_parse(), negative=True)) + + elif t == "(?=": + result.append(Lookahead(_parse(), negative=False)) + + elif t == ")": + return wrapped_result() + + elif t.startswith("#"): + pass + + elif t.startswith("{"): + # TODO: implement! + raise Exception(f"{t}-style repetition not yet supported") + + elif t.startswith("(?"): + raise Exception("%r not supported" % t) + + elif t.isspace(): + pass + else: + result.append(Regex(t)) + + raise Exception("Expecting ')' token") + + result = _parse() + + if len(tokens) != 0: + raise Exception("Unmatched parentheses.") + else: + return result diff --git a/shared/package-files/34/341d1a4ee65ad05487174e4cf4edadce58f3a37ccead327cc38a76a9c936c267/blob b/shared/package-files/34/341d1a4ee65ad05487174e4cf4edadce58f3a37ccead327cc38a76a9c936c267/blob new file mode 100644 index 0000000000000000000000000000000000000000..9bdf8a6ef88dd112fa842f3aff026413ab906dbb --- /dev/null +++ b/shared/package-files/34/341d1a4ee65ad05487174e4cf4edadce58f3a37ccead327cc38a76a9c936c267/blob @@ -0,0 +1,49 @@ +from __future__ import annotations + +from collections.abc import Iterable, Mapping +from datetime import date, datetime, timedelta +from typing import Any, Optional, Union, Tuple, List, Dict + +from numpy import ndarray # TODO use ArrayLike? +from pandas import Series, Index, Timestamp, Timedelta +from matplotlib.colors import Colormap, Normalize + + +ColumnName = Union[ + str, bytes, date, datetime, timedelta, bool, complex, Timestamp, Timedelta +] +Vector = Union[Series, Index, ndarray] + +VariableSpec = Union[ColumnName, Vector, None] +VariableSpecList = Union[List[VariableSpec], Index, None] + +# A DataSource can be an object implementing __dataframe__, or a Mapping +# (and is optional in all contexts where it is used). +# I don't think there's an abc for "has __dataframe__", so we type as object +# but keep the (slightly odd) Union alias for better user-facing annotations. +DataSource = Union[object, Mapping, None] + +OrderSpec = Union[Iterable, None] # TODO technically str is iterable +NormSpec = Union[Tuple[Optional[float], Optional[float]], Normalize, None] + +# TODO for discrete mappings, it would be ideal to use a parameterized type +# as the dict values / list entries should be of specific type(s) for each method +PaletteSpec = Union[str, list, dict, Colormap, None] +DiscreteValueSpec = Union[dict, list, None] +ContinuousValueSpec = Union[ + Tuple[float, float], List[float], Dict[Any, float], None, +] + + +class Default: + def __repr__(self): + return "" + + +class Deprecated: + def __repr__(self): + return "" + + +default = Default() +deprecated = Deprecated() diff --git a/shared/package-files/34/341d1af67bf11b74e8ea86c8af55feaa281e05e3f3328cc96b533347563fdfcb/blob b/shared/package-files/34/341d1af67bf11b74e8ea86c8af55feaa281e05e3f3328cc96b533347563fdfcb/blob new file mode 100644 index 0000000000000000000000000000000000000000..33f40c83fb8315ba14aa125b17669a3768c40549 --- /dev/null +++ b/shared/package-files/34/341d1af67bf11b74e8ea86c8af55feaa281e05e3f3328cc96b533347563fdfcb/blob @@ -0,0 +1,36 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor logspace(const at::Scalar & start, const at::Scalar & end, int64_t steps, double base=10.0, at::TensorOptions options={}); +TORCH_API at::Tensor logspace(const at::Scalar & start, const at::Scalar & end, int64_t steps, double base, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor logspace(const at::Tensor & start, const at::Tensor & end, int64_t steps, double base=10.0, at::TensorOptions options={}); +TORCH_API at::Tensor logspace(const at::Tensor & start, const at::Tensor & end, int64_t steps, double base, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor & logspace_out(at::Tensor & out, const at::Tensor & start, const at::Tensor & end, int64_t steps, double base=10.0); +TORCH_API at::Tensor & logspace_outf(const at::Tensor & start, const at::Tensor & end, int64_t steps, double base, at::Tensor & out); +TORCH_API at::Tensor logspace(const at::Tensor & start, const at::Scalar & end, int64_t steps, double base=10.0, at::TensorOptions options={}); +TORCH_API at::Tensor logspace(const at::Tensor & start, const at::Scalar & end, int64_t steps, double base, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor & logspace_out(at::Tensor & out, const at::Tensor & start, const at::Scalar & end, int64_t steps, double base=10.0); +TORCH_API at::Tensor & logspace_outf(const at::Tensor & start, const at::Scalar & end, int64_t steps, double base, at::Tensor & out); +TORCH_API at::Tensor logspace(const at::Scalar & start, const at::Tensor & end, int64_t steps, double base=10.0, at::TensorOptions options={}); +TORCH_API at::Tensor logspace(const at::Scalar & start, const at::Tensor & end, int64_t steps, double base, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory); +TORCH_API at::Tensor & logspace_out(at::Tensor & out, const at::Scalar & start, const at::Tensor & end, int64_t steps, double base=10.0); +TORCH_API at::Tensor & logspace_outf(const at::Scalar & start, const at::Tensor & end, int64_t steps, double base, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/34/341e6e7fc1c85fcfa58bde582e864ed3d9c02c85a52c21c31796a27d229c067f/blob b/shared/package-files/34/341e6e7fc1c85fcfa58bde582e864ed3d9c02c85a52c21c31796a27d229c067f/blob new file mode 100644 index 0000000000000000000000000000000000000000..84b134e490b081d661daf69f98e0b9b1fdddd36f --- /dev/null +++ b/shared/package-files/34/341e6e7fc1c85fcfa58bde582e864ed3d9c02c85a52c21c31796a27d229c067f/blob @@ -0,0 +1,282 @@ +import logging +import os +import subprocess +from optparse import Values +from typing import Any, List, Optional + +from pip._internal.cli.base_command import Command +from pip._internal.cli.status_codes import ERROR, SUCCESS +from pip._internal.configuration import ( + Configuration, + Kind, + get_configuration_files, + kinds, +) +from pip._internal.exceptions import PipError +from pip._internal.utils.logging import indent_log +from pip._internal.utils.misc import get_prog, write_output + +logger = logging.getLogger(__name__) + + +class ConfigurationCommand(Command): + """ + Manage local and global configuration. + + Subcommands: + + - list: List the active configuration (or from the file specified) + - edit: Edit the configuration file in an editor + - get: Get the value associated with command.option + - set: Set the command.option=value + - unset: Unset the value associated with command.option + - debug: List the configuration files and values defined under them + + Configuration keys should be dot separated command and option name, + with the special prefix "global" affecting any command. For example, + "pip config set global.index-url https://example.org/" would configure + the index url for all commands, but "pip config set download.timeout 10" + would configure a 10 second timeout only for "pip download" commands. + + If none of --user, --global and --site are passed, a virtual + environment configuration file is used if one is active and the file + exists. Otherwise, all modifications happen to the user file by + default. + """ + + ignore_require_venv = True + usage = """ + %prog [] list + %prog [] [--editor ] edit + + %prog [] get command.option + %prog [] set command.option value + %prog [] unset command.option + %prog [] debug + """ + + def add_options(self) -> None: + self.cmd_opts.add_option( + "--editor", + dest="editor", + action="store", + default=None, + help=( + "Editor to use to edit the file. Uses VISUAL or EDITOR " + "environment variables if not provided." + ), + ) + + self.cmd_opts.add_option( + "--global", + dest="global_file", + action="store_true", + default=False, + help="Use the system-wide configuration file only", + ) + + self.cmd_opts.add_option( + "--user", + dest="user_file", + action="store_true", + default=False, + help="Use the user configuration file only", + ) + + self.cmd_opts.add_option( + "--site", + dest="site_file", + action="store_true", + default=False, + help="Use the current environment configuration file only", + ) + + self.parser.insert_option_group(0, self.cmd_opts) + + def run(self, options: Values, args: List[str]) -> int: + handlers = { + "list": self.list_values, + "edit": self.open_in_editor, + "get": self.get_name, + "set": self.set_name_value, + "unset": self.unset_name, + "debug": self.list_config_values, + } + + # Determine action + if not args or args[0] not in handlers: + logger.error( + "Need an action (%s) to perform.", + ", ".join(sorted(handlers)), + ) + return ERROR + + action = args[0] + + # Determine which configuration files are to be loaded + # Depends on whether the command is modifying. + try: + load_only = self._determine_file( + options, need_value=(action in ["get", "set", "unset", "edit"]) + ) + except PipError as e: + logger.error(e.args[0]) + return ERROR + + # Load a new configuration + self.configuration = Configuration( + isolated=options.isolated_mode, load_only=load_only + ) + self.configuration.load() + + # Error handling happens here, not in the action-handlers. + try: + handlers[action](options, args[1:]) + except PipError as e: + logger.error(e.args[0]) + return ERROR + + return SUCCESS + + def _determine_file(self, options: Values, need_value: bool) -> Optional[Kind]: + file_options = [ + key + for key, value in ( + (kinds.USER, options.user_file), + (kinds.GLOBAL, options.global_file), + (kinds.SITE, options.site_file), + ) + if value + ] + + if not file_options: + if not need_value: + return None + # Default to user, unless there's a site file. + elif any( + os.path.exists(site_config_file) + for site_config_file in get_configuration_files()[kinds.SITE] + ): + return kinds.SITE + else: + return kinds.USER + elif len(file_options) == 1: + return file_options[0] + + raise PipError( + "Need exactly one file to operate upon " + "(--user, --site, --global) to perform." + ) + + def list_values(self, options: Values, args: List[str]) -> None: + self._get_n_args(args, "list", n=0) + + for key, value in sorted(self.configuration.items()): + write_output("%s=%r", key, value) + + def get_name(self, options: Values, args: List[str]) -> None: + key = self._get_n_args(args, "get [name]", n=1) + value = self.configuration.get_value(key) + + write_output("%s", value) + + def set_name_value(self, options: Values, args: List[str]) -> None: + key, value = self._get_n_args(args, "set [name] [value]", n=2) + self.configuration.set_value(key, value) + + self._save_configuration() + + def unset_name(self, options: Values, args: List[str]) -> None: + key = self._get_n_args(args, "unset [name]", n=1) + self.configuration.unset_value(key) + + self._save_configuration() + + def list_config_values(self, options: Values, args: List[str]) -> None: + """List config key-value pairs across different config files""" + self._get_n_args(args, "debug", n=0) + + self.print_env_var_values() + # Iterate over config files and print if they exist, and the + # key-value pairs present in them if they do + for variant, files in sorted(self.configuration.iter_config_files()): + write_output("%s:", variant) + for fname in files: + with indent_log(): + file_exists = os.path.exists(fname) + write_output("%s, exists: %r", fname, file_exists) + if file_exists: + self.print_config_file_values(variant) + + def print_config_file_values(self, variant: Kind) -> None: + """Get key-value pairs from the file of a variant""" + for name, value in self.configuration.get_values_in_config(variant).items(): + with indent_log(): + write_output("%s: %s", name, value) + + def print_env_var_values(self) -> None: + """Get key-values pairs present as environment variables""" + write_output("%s:", "env_var") + with indent_log(): + for key, value in sorted(self.configuration.get_environ_vars()): + env_var = f"PIP_{key.upper()}" + write_output("%s=%r", env_var, value) + + def open_in_editor(self, options: Values, args: List[str]) -> None: + editor = self._determine_editor(options) + + fname = self.configuration.get_file_to_edit() + if fname is None: + raise PipError("Could not determine appropriate file.") + elif '"' in fname: + # This shouldn't happen, unless we see a username like that. + # If that happens, we'd appreciate a pull request fixing this. + raise PipError( + f'Can not open an editor for a file name containing "\n{fname}' + ) + + try: + subprocess.check_call(f'{editor} "{fname}"', shell=True) + except FileNotFoundError as e: + if not e.filename: + e.filename = editor + raise + except subprocess.CalledProcessError as e: + raise PipError( + "Editor Subprocess exited with exit code {}".format(e.returncode) + ) + + def _get_n_args(self, args: List[str], example: str, n: int) -> Any: + """Helper to make sure the command got the right number of arguments""" + if len(args) != n: + msg = ( + "Got unexpected number of arguments, expected {}. " + '(example: "{} config {}")' + ).format(n, get_prog(), example) + raise PipError(msg) + + if n == 1: + return args[0] + else: + return args + + def _save_configuration(self) -> None: + # We successfully ran a modifying command. Need to save the + # configuration. + try: + self.configuration.save() + except Exception: + logger.exception( + "Unable to save configuration. Please report this as a bug." + ) + raise PipError("Internal Error.") + + def _determine_editor(self, options: Values) -> str: + if options.editor is not None: + return options.editor + elif "VISUAL" in os.environ: + return os.environ["VISUAL"] + elif "EDITOR" in os.environ: + return os.environ["EDITOR"] + else: + raise PipError("Could not determine editor to use.") diff --git a/shared/package-files/34/342513ee9dc8da663b0cfbc6a2ff5cc89d8f69d5ceb889d662536e45591feb72/blob b/shared/package-files/34/342513ee9dc8da663b0cfbc6a2ff5cc89d8f69d5ceb889d662536e45591feb72/blob new file mode 100644 index 0000000000000000000000000000000000000000..8b64eac2e58168dcc25814fa7eb617b4ffcc007f --- /dev/null +++ b/shared/package-files/34/342513ee9dc8da663b0cfbc6a2ff5cc89d8f69d5ceb889d662536e45591feb72/blob @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor special_log_softmax(const at::Tensor & self, int64_t dim, c10::optional dtype=c10::nullopt); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/34/34272d04d198528f44849f881647f4e54d58297f20f80433faaaf1112917e538/blob b/shared/package-files/34/34272d04d198528f44849f881647f4e54d58297f20f80433faaaf1112917e538/blob new file mode 100644 index 0000000000000000000000000000000000000000..39e07d580bc5d3cc9d72a2ce4037a547ec991d6c --- /dev/null +++ b/shared/package-files/34/34272d04d198528f44849f881647f4e54d58297f20f80433faaaf1112917e538/blob @@ -0,0 +1,83 @@ +import torch +from torch.distributions import constraints +from torch.distributions.exponential import Exponential +from torch.distributions.gumbel import euler_constant +from torch.distributions.transformed_distribution import TransformedDistribution +from torch.distributions.transforms import AffineTransform, PowerTransform +from torch.distributions.utils import broadcast_all + +__all__ = ["Weibull"] + + +class Weibull(TransformedDistribution): + r""" + Samples from a two-parameter Weibull distribution. + + Example: + + >>> # xdoctest: +IGNORE_WANT("non-deterministic") + >>> m = Weibull(torch.tensor([1.0]), torch.tensor([1.0])) + >>> m.sample() # sample from a Weibull distribution with scale=1, concentration=1 + tensor([ 0.4784]) + + Args: + scale (float or Tensor): Scale parameter of distribution (lambda). + concentration (float or Tensor): Concentration parameter of distribution (k/shape). + """ + arg_constraints = { + "scale": constraints.positive, + "concentration": constraints.positive, + } + support = constraints.positive + + def __init__(self, scale, concentration, validate_args=None): + self.scale, self.concentration = broadcast_all(scale, concentration) + self.concentration_reciprocal = self.concentration.reciprocal() + base_dist = Exponential( + torch.ones_like(self.scale), validate_args=validate_args + ) + transforms = [ + PowerTransform(exponent=self.concentration_reciprocal), + AffineTransform(loc=0, scale=self.scale), + ] + super().__init__(base_dist, transforms, validate_args=validate_args) + + def expand(self, batch_shape, _instance=None): + new = self._get_checked_instance(Weibull, _instance) + new.scale = self.scale.expand(batch_shape) + new.concentration = self.concentration.expand(batch_shape) + new.concentration_reciprocal = new.concentration.reciprocal() + base_dist = self.base_dist.expand(batch_shape) + transforms = [ + PowerTransform(exponent=new.concentration_reciprocal), + AffineTransform(loc=0, scale=new.scale), + ] + super(Weibull, new).__init__(base_dist, transforms, validate_args=False) + new._validate_args = self._validate_args + return new + + @property + def mean(self): + return self.scale * torch.exp(torch.lgamma(1 + self.concentration_reciprocal)) + + @property + def mode(self): + return ( + self.scale + * ((self.concentration - 1) / self.concentration) + ** self.concentration.reciprocal() + ) + + @property + def variance(self): + return self.scale.pow(2) * ( + torch.exp(torch.lgamma(1 + 2 * self.concentration_reciprocal)) + - torch.exp(2 * torch.lgamma(1 + self.concentration_reciprocal)) + ) + + def entropy(self): + return ( + euler_constant * (1 - self.concentration_reciprocal) + + torch.log(self.scale * self.concentration_reciprocal) + + 1 + ) diff --git a/shared/package-files/34/34296f728e7fe68cccb97a9f6edbf3bf3a686f44044c744fe85f207a92ed4811/blob b/shared/package-files/34/34296f728e7fe68cccb97a9f6edbf3bf3a686f44044c744fe85f207a92ed4811/blob new file mode 100644 index 0000000000000000000000000000000000000000..bf6d8ddfd04c934003004472d7f03bfa3f06b5f5 --- /dev/null +++ b/shared/package-files/34/34296f728e7fe68cccb97a9f6edbf3bf3a686f44044c744fe85f207a92ed4811/blob @@ -0,0 +1,20 @@ +"""Core XML support for Python. + +This package contains four sub-packages: + +dom -- The W3C Document Object Model. This supports DOM Level 1 + + Namespaces. + +parsers -- Python wrappers for XML parsers (currently only supports Expat). + +sax -- The Simple API for XML, developed by XML-Dev, led by David + Megginson and ported to Python by Lars Marius Garshol. This + supports the SAX 2 API. + +etree -- The ElementTree XML library. This is a subset of the full + ElementTree XML release. + +""" + + +__all__ = ["dom", "parsers", "sax", "etree"] diff --git a/shared/package-files/34/342b2c16a3e7682eb34e6655dec0bc6b086c3d4c9b6b21f52ccf3a91ad82f734/blob b/shared/package-files/34/342b2c16a3e7682eb34e6655dec0bc6b086c3d4c9b6b21f52ccf3a91ad82f734/blob new file mode 100644 index 0000000000000000000000000000000000000000..fe2a79eeedadbf3f0b872f22bff4af31d004f642 --- /dev/null +++ b/shared/package-files/34/342b2c16a3e7682eb34e6655dec0bc6b086c3d4c9b6b21f52ccf3a91ad82f734/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:342b2c16a3e7682eb34e6655dec0bc6b086c3d4c9b6b21f52ccf3a91ad82f734 +size 409177 diff --git a/shared/package-files/34/342b5f7485310e2d6ed3369a9ac7126e25b36f19f64ce23e3071d638a5344674/blob b/shared/package-files/34/342b5f7485310e2d6ed3369a9ac7126e25b36f19f64ce23e3071d638a5344674/blob new file mode 100644 index 0000000000000000000000000000000000000000..89bffaa34d61fbb12cfafbe7287af0b92139b19c --- /dev/null +++ b/shared/package-files/34/342b5f7485310e2d6ed3369a9ac7126e25b36f19f64ce23e3071d638a5344674/blob @@ -0,0 +1,11 @@ +from torio.utils import ffmpeg_utils + +from . import sox_utils +from .download import download_asset + + +__all__ = [ + "download_asset", + "sox_utils", + "ffmpeg_utils", +] diff --git a/shared/package-files/34/342f5127b689c480628f1a26fec511a6102efab5659c5f23d1c1e163f55b2647/blob b/shared/package-files/34/342f5127b689c480628f1a26fec511a6102efab5659c5f23d1c1e163f55b2647/blob new file mode 100644 index 0000000000000000000000000000000000000000..86d5937d6bc992f3b1ce19867ed25de4d6268d81 --- /dev/null +++ b/shared/package-files/34/342f5127b689c480628f1a26fec511a6102efab5659c5f23d1c1e163f55b2647/blob @@ -0,0 +1,133 @@ +from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Tuple, Union + +__author__: str +__credits__: str + +AMPER: int +AMPEREQUAL: int +AT: int +BACKQUOTE: int +Binnumber: str +Bracket: str +CIRCUMFLEX: int +CIRCUMFLEXEQUAL: int +COLON: int +COMMA: int +COMMENT: int +Comment: str +ContStr: str +DEDENT: int +DOT: int +DOUBLESLASH: int +DOUBLESLASHEQUAL: int +DOUBLESTAR: int +DOUBLESTAREQUAL: int +Decnumber: str +Double: str +Double3: str +ENDMARKER: int +EQEQUAL: int +EQUAL: int +ERRORTOKEN: int +Expfloat: str +Exponent: str +Floatnumber: str +Funny: str +GREATER: int +GREATEREQUAL: int +Hexnumber: str +INDENT: int + +def ISEOF(x: int) -> bool: ... +def ISNONTERMINAL(x: int) -> bool: ... +def ISTERMINAL(x: int) -> bool: ... + +Ignore: str +Imagnumber: str +Intnumber: str +LBRACE: int +LEFTSHIFT: int +LEFTSHIFTEQUAL: int +LESS: int +LESSEQUAL: int +LPAR: int +LSQB: int +MINEQUAL: int +MINUS: int +NAME: int +NEWLINE: int +NL: int +NOTEQUAL: int +NT_OFFSET: int +NUMBER: int +N_TOKENS: int +Name: str +Number: str +OP: int +Octnumber: str +Operator: str +PERCENT: int +PERCENTEQUAL: int +PLUS: int +PLUSEQUAL: int +PlainToken: str +Pointfloat: str +PseudoExtras: str +PseudoToken: str +RBRACE: int +RIGHTSHIFT: int +RIGHTSHIFTEQUAL: int +RPAR: int +RSQB: int +SEMI: int +SLASH: int +SLASHEQUAL: int +STAR: int +STAREQUAL: int +STRING: int +Single: str +Single3: str +Special: str +String: str +TILDE: int +Token: str +Triple: str +VBAR: int +VBAREQUAL: int +Whitespace: str +chain: type +double3prog: type +endprogs: Dict[str, Any] +pseudoprog: type +single3prog: type +single_quoted: Dict[str, str] +t: str +tabsize: int +tok_name: Dict[int, str] +tokenprog: type +triple_quoted: Dict[str, str] +x: str + +_Pos = Tuple[int, int] +_TokenType = Tuple[int, str, _Pos, _Pos, str] + +def any(*args, **kwargs) -> str: ... +def generate_tokens(readline: Callable[[], str]) -> Generator[_TokenType, None, None]: ... +def group(*args: str) -> str: ... +def maybe(*args: str) -> str: ... +def printtoken(type: int, token: str, srow_scol: _Pos, erow_ecol: _Pos, line: str) -> None: ... +def tokenize(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... +def tokenize_loop(readline: Callable[[], str], tokeneater: Callable[[Tuple[int, str, _Pos, _Pos, str]], None]) -> None: ... +def untokenize(iterable: Iterable[_TokenType]) -> str: ... + +class StopTokenizing(Exception): ... +class TokenError(Exception): ... + +class Untokenizer: + prev_col: int + prev_row: int + tokens: List[str] + def __init__(self) -> None: ... + def add_whitespace(self, _Pos) -> None: ... + def compat(self, token: Tuple[int, Any], iterable: Iterator[_TokenType]) -> None: ... + def untokenize(self, iterable: Iterable[_TokenType]) -> str: ... diff --git a/shared/package-files/34/3434fdb0ee99663ee112a8bfd7f9378eb1c3d36e6f75519e4378b446e77d38c9/blob b/shared/package-files/34/3434fdb0ee99663ee112a8bfd7f9378eb1c3d36e6f75519e4378b446e77d38c9/blob new file mode 100644 index 0000000000000000000000000000000000000000..4dae7bd5ffec44a4e9704f09afa3262895633294 --- /dev/null +++ b/shared/package-files/34/3434fdb0ee99663ee112a8bfd7f9378eb1c3d36e6f75519e4378b446e77d38c9/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3434fdb0ee99663ee112a8bfd7f9378eb1c3d36e6f75519e4378b446e77d38c9 +size 831312 diff --git a/shared/package-files/34/34373a14a0c63ab18876f483a49f4cabd3be684d31c3e2e823a2feadcad6d1c2/blob b/shared/package-files/34/34373a14a0c63ab18876f483a49f4cabd3be684d31c3e2e823a2feadcad6d1c2/blob new file mode 100644 index 0000000000000000000000000000000000000000..4174d2adc810b872e7ec0b1e3ca820e3d2c3920d --- /dev/null +++ b/shared/package-files/34/34373a14a0c63ab18876f483a49f4cabd3be684d31c3e2e823a2feadcad6d1c2/blob @@ -0,0 +1,414 @@ +import numpy as np +import pytest + +import pandas as pd +from pandas import ( + Categorical, + DataFrame, + Series, + Timestamp, + date_range, +) +import pandas._testing as tm + + +class TestCategoricalOpsWithFactor: + def test_categories_none_comparisons(self): + factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True) + tm.assert_categorical_equal(factor, factor) + + def test_comparisons(self): + factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True) + result = factor[factor == "a"] + expected = factor[np.asarray(factor) == "a"] + tm.assert_categorical_equal(result, expected) + + result = factor[factor != "a"] + expected = factor[np.asarray(factor) != "a"] + tm.assert_categorical_equal(result, expected) + + result = factor[factor < "c"] + expected = factor[np.asarray(factor) < "c"] + tm.assert_categorical_equal(result, expected) + + result = factor[factor > "a"] + expected = factor[np.asarray(factor) > "a"] + tm.assert_categorical_equal(result, expected) + + result = factor[factor >= "b"] + expected = factor[np.asarray(factor) >= "b"] + tm.assert_categorical_equal(result, expected) + + result = factor[factor <= "b"] + expected = factor[np.asarray(factor) <= "b"] + tm.assert_categorical_equal(result, expected) + + n = len(factor) + + other = factor[np.random.default_rng(2).permutation(n)] + result = factor == other + expected = np.asarray(factor) == np.asarray(other) + tm.assert_numpy_array_equal(result, expected) + + result = factor == "d" + expected = np.zeros(len(factor), dtype=bool) + tm.assert_numpy_array_equal(result, expected) + + # comparisons with categoricals + cat_rev = Categorical(["a", "b", "c"], categories=["c", "b", "a"], ordered=True) + cat_rev_base = Categorical( + ["b", "b", "b"], categories=["c", "b", "a"], ordered=True + ) + cat = Categorical(["a", "b", "c"], ordered=True) + cat_base = Categorical(["b", "b", "b"], categories=cat.categories, ordered=True) + + # comparisons need to take categories ordering into account + res_rev = cat_rev > cat_rev_base + exp_rev = np.array([True, False, False]) + tm.assert_numpy_array_equal(res_rev, exp_rev) + + res_rev = cat_rev < cat_rev_base + exp_rev = np.array([False, False, True]) + tm.assert_numpy_array_equal(res_rev, exp_rev) + + res = cat > cat_base + exp = np.array([False, False, True]) + tm.assert_numpy_array_equal(res, exp) + + # Only categories with same categories can be compared + msg = "Categoricals can only be compared if 'categories' are the same" + with pytest.raises(TypeError, match=msg): + cat > cat_rev + + cat_rev_base2 = Categorical(["b", "b", "b"], categories=["c", "b", "a", "d"]) + + with pytest.raises(TypeError, match=msg): + cat_rev > cat_rev_base2 + + # Only categories with same ordering information can be compared + cat_unordered = cat.set_ordered(False) + assert not (cat > cat).any() + + with pytest.raises(TypeError, match=msg): + cat > cat_unordered + + # comparison (in both directions) with Series will raise + s = Series(["b", "b", "b"], dtype=object) + msg = ( + "Cannot compare a Categorical for op __gt__ with type " + r"" + ) + with pytest.raises(TypeError, match=msg): + cat > s + with pytest.raises(TypeError, match=msg): + cat_rev > s + with pytest.raises(TypeError, match=msg): + s < cat + with pytest.raises(TypeError, match=msg): + s < cat_rev + + # comparison with numpy.array will raise in both direction, but only on + # newer numpy versions + a = np.array(["b", "b", "b"], dtype=object) + with pytest.raises(TypeError, match=msg): + cat > a + with pytest.raises(TypeError, match=msg): + cat_rev > a + + # Make sure that unequal comparison take the categories order in + # account + cat_rev = Categorical(list("abc"), categories=list("cba"), ordered=True) + exp = np.array([True, False, False]) + res = cat_rev > "b" + tm.assert_numpy_array_equal(res, exp) + + # check that zero-dim array gets unboxed + res = cat_rev > np.array("b") + tm.assert_numpy_array_equal(res, exp) + + +class TestCategoricalOps: + @pytest.mark.parametrize( + "categories", + [["a", "b"], [0, 1], [Timestamp("2019"), Timestamp("2020")]], + ) + def test_not_equal_with_na(self, categories): + # https://github.com/pandas-dev/pandas/issues/32276 + c1 = Categorical.from_codes([-1, 0], categories=categories) + c2 = Categorical.from_codes([0, 1], categories=categories) + + result = c1 != c2 + + assert result.all() + + def test_compare_frame(self): + # GH#24282 check that Categorical.__cmp__(DataFrame) defers to frame + data = ["a", "b", 2, "a"] + cat = Categorical(data) + + df = DataFrame(cat) + + result = cat == df.T + expected = DataFrame([[True, True, True, True]]) + tm.assert_frame_equal(result, expected) + + result = cat[::-1] != df.T + expected = DataFrame([[False, True, True, False]]) + tm.assert_frame_equal(result, expected) + + def test_compare_frame_raises(self, comparison_op): + # alignment raises unless we transpose + op = comparison_op + cat = Categorical(["a", "b", 2, "a"]) + df = DataFrame(cat) + msg = "Unable to coerce to Series, length must be 1: given 4" + with pytest.raises(ValueError, match=msg): + op(cat, df) + + def test_datetime_categorical_comparison(self): + dt_cat = Categorical(date_range("2014-01-01", periods=3), ordered=True) + tm.assert_numpy_array_equal(dt_cat > dt_cat[0], np.array([False, True, True])) + tm.assert_numpy_array_equal(dt_cat[0] < dt_cat, np.array([False, True, True])) + + def test_reflected_comparison_with_scalars(self): + # GH8658 + cat = Categorical([1, 2, 3], ordered=True) + tm.assert_numpy_array_equal(cat > cat[0], np.array([False, True, True])) + tm.assert_numpy_array_equal(cat[0] < cat, np.array([False, True, True])) + + def test_comparison_with_unknown_scalars(self): + # https://github.com/pandas-dev/pandas/issues/9836#issuecomment-92123057 + # and following comparisons with scalars not in categories should raise + # for unequal comps, but not for equal/not equal + cat = Categorical([1, 2, 3], ordered=True) + + msg = "Invalid comparison between dtype=category and int" + with pytest.raises(TypeError, match=msg): + cat < 4 + with pytest.raises(TypeError, match=msg): + cat > 4 + with pytest.raises(TypeError, match=msg): + 4 < cat + with pytest.raises(TypeError, match=msg): + 4 > cat + + tm.assert_numpy_array_equal(cat == 4, np.array([False, False, False])) + tm.assert_numpy_array_equal(cat != 4, np.array([True, True, True])) + + def test_comparison_with_tuple(self): + cat = Categorical(np.array(["foo", (0, 1), 3, (0, 1)], dtype=object)) + + result = cat == "foo" + expected = np.array([True, False, False, False], dtype=bool) + tm.assert_numpy_array_equal(result, expected) + + result = cat == (0, 1) + expected = np.array([False, True, False, True], dtype=bool) + tm.assert_numpy_array_equal(result, expected) + + result = cat != (0, 1) + tm.assert_numpy_array_equal(result, ~expected) + + @pytest.mark.filterwarnings("ignore::RuntimeWarning") + def test_comparison_of_ordered_categorical_with_nan_to_scalar( + self, compare_operators_no_eq_ne + ): + # https://github.com/pandas-dev/pandas/issues/26504 + # BUG: fix ordered categorical comparison with missing values (#26504 ) + # and following comparisons with scalars in categories with missing + # values should be evaluated as False + + cat = Categorical([1, 2, 3, None], categories=[1, 2, 3], ordered=True) + scalar = 2 + expected = getattr(np.array(cat), compare_operators_no_eq_ne)(scalar) + actual = getattr(cat, compare_operators_no_eq_ne)(scalar) + tm.assert_numpy_array_equal(actual, expected) + + @pytest.mark.filterwarnings("ignore::RuntimeWarning") + def test_comparison_of_ordered_categorical_with_nan_to_listlike( + self, compare_operators_no_eq_ne + ): + # https://github.com/pandas-dev/pandas/issues/26504 + # and following comparisons of missing values in ordered Categorical + # with listlike should be evaluated as False + + cat = Categorical([1, 2, 3, None], categories=[1, 2, 3], ordered=True) + other = Categorical([2, 2, 2, 2], categories=[1, 2, 3], ordered=True) + expected = getattr(np.array(cat), compare_operators_no_eq_ne)(2) + actual = getattr(cat, compare_operators_no_eq_ne)(other) + tm.assert_numpy_array_equal(actual, expected) + + @pytest.mark.parametrize( + "data,reverse,base", + [(list("abc"), list("cba"), list("bbb")), ([1, 2, 3], [3, 2, 1], [2, 2, 2])], + ) + def test_comparisons(self, data, reverse, base): + cat_rev = Series(Categorical(data, categories=reverse, ordered=True)) + cat_rev_base = Series(Categorical(base, categories=reverse, ordered=True)) + cat = Series(Categorical(data, ordered=True)) + cat_base = Series( + Categorical(base, categories=cat.cat.categories, ordered=True) + ) + s = Series(base, dtype=object if base == list("bbb") else None) + a = np.array(base) + + # comparisons need to take categories ordering into account + res_rev = cat_rev > cat_rev_base + exp_rev = Series([True, False, False]) + tm.assert_series_equal(res_rev, exp_rev) + + res_rev = cat_rev < cat_rev_base + exp_rev = Series([False, False, True]) + tm.assert_series_equal(res_rev, exp_rev) + + res = cat > cat_base + exp = Series([False, False, True]) + tm.assert_series_equal(res, exp) + + scalar = base[1] + res = cat > scalar + exp = Series([False, False, True]) + exp2 = cat.values > scalar + tm.assert_series_equal(res, exp) + tm.assert_numpy_array_equal(res.values, exp2) + res_rev = cat_rev > scalar + exp_rev = Series([True, False, False]) + exp_rev2 = cat_rev.values > scalar + tm.assert_series_equal(res_rev, exp_rev) + tm.assert_numpy_array_equal(res_rev.values, exp_rev2) + + # Only categories with same categories can be compared + msg = "Categoricals can only be compared if 'categories' are the same" + with pytest.raises(TypeError, match=msg): + cat > cat_rev + + # categorical cannot be compared to Series or numpy array, and also + # not the other way around + msg = ( + "Cannot compare a Categorical for op __gt__ with type " + r"" + ) + with pytest.raises(TypeError, match=msg): + cat > s + with pytest.raises(TypeError, match=msg): + cat_rev > s + with pytest.raises(TypeError, match=msg): + cat > a + with pytest.raises(TypeError, match=msg): + cat_rev > a + + with pytest.raises(TypeError, match=msg): + s < cat + with pytest.raises(TypeError, match=msg): + s < cat_rev + + with pytest.raises(TypeError, match=msg): + a < cat + with pytest.raises(TypeError, match=msg): + a < cat_rev + + @pytest.mark.parametrize( + "ctor", + [ + lambda *args, **kwargs: Categorical(*args, **kwargs), + lambda *args, **kwargs: Series(Categorical(*args, **kwargs)), + ], + ) + def test_unordered_different_order_equal(self, ctor): + # https://github.com/pandas-dev/pandas/issues/16014 + c1 = ctor(["a", "b"], categories=["a", "b"], ordered=False) + c2 = ctor(["a", "b"], categories=["b", "a"], ordered=False) + assert (c1 == c2).all() + + c1 = ctor(["a", "b"], categories=["a", "b"], ordered=False) + c2 = ctor(["b", "a"], categories=["b", "a"], ordered=False) + assert (c1 != c2).all() + + c1 = ctor(["a", "a"], categories=["a", "b"], ordered=False) + c2 = ctor(["b", "b"], categories=["b", "a"], ordered=False) + assert (c1 != c2).all() + + c1 = ctor(["a", "a"], categories=["a", "b"], ordered=False) + c2 = ctor(["a", "b"], categories=["b", "a"], ordered=False) + result = c1 == c2 + tm.assert_numpy_array_equal(np.array(result), np.array([True, False])) + + def test_unordered_different_categories_raises(self): + c1 = Categorical(["a", "b"], categories=["a", "b"], ordered=False) + c2 = Categorical(["a", "c"], categories=["c", "a"], ordered=False) + + with pytest.raises(TypeError, match=("Categoricals can only be compared")): + c1 == c2 + + def test_compare_different_lengths(self): + c1 = Categorical([], categories=["a", "b"]) + c2 = Categorical([], categories=["a"]) + + msg = "Categoricals can only be compared if 'categories' are the same." + with pytest.raises(TypeError, match=msg): + c1 == c2 + + def test_compare_unordered_different_order(self): + # https://github.com/pandas-dev/pandas/issues/16603#issuecomment- + # 349290078 + a = Categorical(["a"], categories=["a", "b"]) + b = Categorical(["b"], categories=["b", "a"]) + assert not a.equals(b) + + def test_numeric_like_ops(self): + df = DataFrame({"value": np.random.default_rng(2).integers(0, 10000, 100)}) + labels = [f"{i} - {i + 499}" for i in range(0, 10000, 500)] + cat_labels = Categorical(labels, labels) + + df = df.sort_values(by=["value"], ascending=True) + df["value_group"] = pd.cut( + df.value, range(0, 10500, 500), right=False, labels=cat_labels + ) + + # numeric ops should not succeed + for op, str_rep in [ + ("__add__", r"\+"), + ("__sub__", "-"), + ("__mul__", r"\*"), + ("__truediv__", "/"), + ]: + msg = f"Series cannot perform the operation {str_rep}|unsupported operand" + with pytest.raises(TypeError, match=msg): + getattr(df, op)(df) + + # reduction ops should not succeed (unless specifically defined, e.g. + # min/max) + s = df["value_group"] + for op in ["kurt", "skew", "var", "std", "mean", "sum", "median"]: + msg = f"does not support reduction '{op}'" + with pytest.raises(TypeError, match=msg): + getattr(s, op)(numeric_only=False) + + def test_numeric_like_ops_series(self): + # numpy ops + s = Series(Categorical([1, 2, 3, 4])) + with pytest.raises(TypeError, match="does not support reduction 'sum'"): + np.sum(s) + + @pytest.mark.parametrize( + "op, str_rep", + [ + ("__add__", r"\+"), + ("__sub__", "-"), + ("__mul__", r"\*"), + ("__truediv__", "/"), + ], + ) + def test_numeric_like_ops_series_arith(self, op, str_rep): + # numeric ops on a Series + s = Series(Categorical([1, 2, 3, 4])) + msg = f"Series cannot perform the operation {str_rep}|unsupported operand" + with pytest.raises(TypeError, match=msg): + getattr(s, op)(2) + + def test_numeric_like_ops_series_invalid(self): + # invalid ufunc + s = Series(Categorical([1, 2, 3, 4])) + msg = "Object with dtype category cannot perform the numpy op log" + with pytest.raises(TypeError, match=msg): + np.log(s) diff --git a/shared/package-files/34/343c9699a1eb073490150c6de586bdc021742a99d23fad2bb53e97b041b36f5a/blob b/shared/package-files/34/343c9699a1eb073490150c6de586bdc021742a99d23fad2bb53e97b041b36f5a/blob new file mode 100644 index 0000000000000000000000000000000000000000..085892f86c89b5514efc25dc68e07d606fd4088b Binary files /dev/null and b/shared/package-files/34/343c9699a1eb073490150c6de586bdc021742a99d23fad2bb53e97b041b36f5a/blob differ diff --git a/shared/package-files/34/344099296e829acbec89347a3829da7cb458f2e68e72a5b3f4e934fbefdfeb08/blob b/shared/package-files/34/344099296e829acbec89347a3829da7cb458f2e68e72a5b3f4e934fbefdfeb08/blob new file mode 100644 index 0000000000000000000000000000000000000000..7332ca0b501f8f0a02db026730fce6b677ba3972 --- /dev/null +++ b/shared/package-files/34/344099296e829acbec89347a3829da7cb458f2e68e72a5b3f4e934fbefdfeb08/blob @@ -0,0 +1,28 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor mkldnn_convolution(const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups); +TORCH_API at::Tensor mkldnn_convolution_symint(const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups); +TORCH_API at::Tensor & mkldnn_convolution_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups); +TORCH_API at::Tensor & mkldnn_convolution_outf(const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, at::IntArrayRef padding, at::IntArrayRef stride, at::IntArrayRef dilation, int64_t groups, at::Tensor & out); +TORCH_API at::Tensor & mkldnn_convolution_symint_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups); +TORCH_API at::Tensor & mkldnn_convolution_symint_outf(const at::Tensor & self, const at::Tensor & weight, const c10::optional & bias, c10::SymIntArrayRef padding, c10::SymIntArrayRef stride, c10::SymIntArrayRef dilation, c10::SymInt groups, at::Tensor & out); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/34/34412307f038847fb2d9f61a4511860416cd28e24ecedfbe962601a7f375630b/EXPERIMENTS.md b/shared/package-files/34/34412307f038847fb2d9f61a4511860416cd28e24ecedfbe962601a7f375630b/EXPERIMENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..7c3f3ece686d474adcd695082fa2132362901ae4 --- /dev/null +++ b/shared/package-files/34/34412307f038847fb2d9f61a4511860416cd28e24ecedfbe962601a7f375630b/EXPERIMENTS.md @@ -0,0 +1,443 @@ +# Experiments + +All models initialize from random weights. Train labels are used for fitting; validation labels only for selection and error analysis. No test data or pretrained assets are available. Hardware: one H100 80 GB, 22 CPU allocation. Primary reported metrics are validation retrieval rates, not estimates of the external reference's test improvement. + +## E000 — starter plumbing smoke +- Hypothesis: the supplied train/publish/relocate/replay path works. +- Seed 0; one epoch; deterministic 4,096 train / 512 validation-loss rows. +- Retrieval: deterministic 128-spectrum sample, seed 0; query JSONL SHA256 `9fe86c73720456e94f6e454516b3f1768e289413f89b185df2dff3fa8f23f75a`. +- Checkpoint SHA256 `e1a27fbe5db99c9868650e830c65dc53ce420a4ab1362d7a166d833e5ae0c8f4`. +- Compute: training 10.358 s (one H100 allocated), relocated inference 18.373 s; no scientific benchmark claim from this subset. +- Metrics: `{"hit_rate_at_1": 0.0, "hit_rate_at_20": 0.0546875, "hit_rate_at_5": 0.015625, "mces_at_1": 30.61328125}`. All 128 rankings valid. +- Deliberately truncated ranking correctly invalidated with `ranking is not an exact candidate permutation`. +- Initial timing invocation failed because /usr/bin/time is unavailable; replaced with Python monotonic timing. Initial MCES invocation failed in GLACIER Python; evaluation uses the supplied system Python with myopic_mces. Neither failure changed fitting or inference. +- Selection: validation cosine loss for commissioning only. + +## E001 — all-condition inverse spectrum encoder +- Hypothesis: explicit fragment and neutral-loss bins retain more discriminating spectrum information than DeepSets mean pooling and provide a useful all-condition fallback. +- Changed factor: residual binned-spectrum architecture; 0.1 Da bins through 1500 Da, up to 128 peaks; Morgan4096 radius 2; cosine plus weighted BCE loss. Metadata uses precursor, adduct, instrument and observed/missing energy, never true formula. +- Seed 1; complete 194,119 training spectra; 50 epochs scheduled; one H100; AdamW, batch 512, width 1024, three residual blocks. +- Selection: full 19,429-query validation retrieval Hit@1 each epoch. Query JSONL SHA256 `7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6`. +- No validation parameters fitted; candidate fingerprints are derived only from supplied structures. +- Completed 50 epochs in 160.517 s on one H100; max allocated GPU memory 5.631 GB. Selected epoch 2; Hit@1 0.09511555, Hit@5 0.21622317, Hit@20 0.39348397. Independent full replay: Hit@1 0.09393175, Hit@5 0.21606876, Hit@20 0.39389572; 19,429 complete rankings in 49.663 s. MCES running. +- Checkpoint SHA256 `bce84afa449b4952efaddd558af4c5439e8170976cbe56143a57abf98540f608`. Negative result: continued fitting overfit; final epoch Hit@1 0.08749807. Keep epoch 2. The initially logged retrieval used input-order tie resolution; replay uses candidate-ID ties. All 23 top-one discrepancies were identical-fingerprint ties. Validation cache now uses candidate-ID ties too; repeated evaluation exactly matches replay. No fitting or checkpoint change. Replay 95% molecule bootstrap interval: [0.08021314, 0.10881266], 3,185 molecule groups, 2,000 resamples. Paired smoke subset gain versus E000: +0.0703125; same 117 molecule groups. +- Packaging adapter initially imported the starter predict module because of sys.path precedence; fixed before any live publication. A premature replay invocation failed while the candidate package was not yet built; the complete replay subsequently passed. + + + +## E002 — clean synthetic augmentation +- Hypothesis: 435,076 synthetic molecular structures increase chemical coverage and reduce the severe train/validation generalization gap in E001. +- Changed factor: add only the supplied 2,333,485 sanitized ICEBERG simulations. Same formula-free input features; synthetic precursor masses derived from train-only simulation formula metadata. No simulated validation structures or pretrained assets. +- Seed 1; same architecture/loss as E001, random initialization; 40 epochs × 1,200 steps, batch 512, 25% experimental train / 75% clean synthetic sampling. Eight null/empty simulation spectra are excluded from fitting, leaving 2,333,477 usable rows. Initial preparation stopped on an empty payload; resumed from 1,283,584 complete rows, finished remaining rows in 44.062 s. Failed log and prior source retained. Full-validation selection uses fixed candidate-ID ties. Completed 40 epochs in 292.360 s on the one H100; max allocated CUDA memory 12.316 GB. Selected epoch 40, checkpoint SHA256 `bc0f0251108bb6c602c0ea44de892719c6b0d29c69ef26854911726c57c0faf2`. Independent replay: all 19,429 rankings valid in 86.279 s; Hit@1 0.2329507437, Hit@5 0.3749034948, Hit@20 0.5380101910. Replay exactly matches selection. Same full-validation query hash as E001. Paired molecule-bootstrap improvement over E001 +0.13901899 (95% CI [0.12379366,0.15556200], 3,185 molecule groups, 2,000 resamples). MCES running. +- Error analysis: H+ Hit@1 0.2745712 versus Na+ 0.1038632; missing energy 0.1650095; released GLACIER conditions 0.3017259 versus remaining conditions 0.1638989. Missing-condition and sodium transfer remain weak. + + +## E003 — GLACIER all-condition training (preparing) +- Hypothesis: the native forward model can learn spectra outside the published condition domain using explicit missing-energy and unknown-instrument embeddings already present in native code. +- Changed factor: broaden fragment-supervised fitting to all conditions. Preserve existing prepared targets, derive additional MAGMa targets only from corresponding training/validation structures and spectra. Engine reuse per SMILES reduces preparation time without using information across folds. Native architecture kept intact. +- The first 100-molecule/209-spectrum preparation smoke revealed missing sibling fragments when compared against native preparation. Invalidated those 209 derived rows, added native sibling expansion, and verified all 10 selected cases exactly (root canonical SMILES, raw target spectrum, fragment-mask set). Full preparation now running on 17,050 additional molecular groups / 104,473 spectra, retaining supplied targets unchanged. + +## E004 — fine-mass peak transformer +- Hypothesis: shared peak attention and fine mass-defect features reduce the information loss of 0.1 Da bins and improve unseen-structure retrieval. +- Changed factor: spectrum architecture/representation; same seed 1, same train+clean-synthetic mixture and loss as E002. Four transformer layers, width 384, 64 strongest peaks, 0.1 Da learned embeddings plus exact-mass sine/cosine features, precursor/condition token. 12,836,736 parameters. +- Full train fold, 40 epochs × 1,200 steps, batch 512; 25% experimental/75% synthetic. Exact original source/config/logs in E004. Retrieval uses the same full validation query set and candidate-ID ties. Completed in 1120.843 s on the sole H100, maximum allocated CUDA memory10.957 GB. Selected epoch37, checkpoint SHA256 `1d1d4418b4e305306996953e54426a15cd35f0b767c989840c91ec0880818193`; ordinary-cosine validation Hit@1 .30207421895, Hit@5 .47269545525, Hit@20 .63482423182. Final epoch40 was lower (.29996397138), so retained epoch37. Independent replay will use the stronger E008 ranking of these same trained weights. + +## Evaluation engineering notes +- E001 full MCES initially spent 671.031 s in a serial-result pool and was restarted to add an exact identical-graph shortcut and a persistent completed-pair cache. Official MCES threshold=15, stronger bound and CBC solver options are unchanged. The zero shortcut only recognizes the same atom/bond graph (stereochemistry is ignored by the supplied MCES graph definition). +- Cached MCES jobs were restarted once more after changing SQLite transactions to commit each completed pair, avoiding write locks across long solves. Diagnostic compute is CPU-only; full secondary metrics remain pending until every pair completes. + +## E005 — sodium mass-coordinate normalization (prepared) +- Hypothesis: shifting Na+ fragment and precursor masses by -21.981944235 Da to proton-equivalent coordinates shares fragmentation features with the much larger H+ training population. Neutral losses and the observed adduct indicator remain unchanged. +- Changed factor: mass-coordinate preprocessing only, compared with E002. Planned same random seed 1, MLP architecture, training mixture, loss, epochs and steps. All training structures remain in the train/clean-synthetic folds. Preparation took 14.136 s; corrected synthetic fractional-precursor feature to preserve original H+ rows exactly. No synthetic positive peak falls below the normalization shift. Candidate IDs never affect the learned score. +- Completed40 epochs in 306.592s; maxCUDA12.316GB. Selected epoch31 SHA256 `cfa96e4e60bee9ab19dc8acae446f08c7d5ddbd114ba999ad1eb58bcb3c2cca7`; Hit@1 0.230068454, Hit@5 0.368727160, Hit@20 0.527407484. Negative result versus E002: overall delta-.00288229 (95% molecule-CI[-.01317966,.00657117]); sodium delta-.01393287 (CI[-.03895166,.01135473]); proton delta+.00068064 (CI[-.00860138,.00998709]). Did not publish. Separately checked40train+40validation records: normalized preprocessing exactly matches runtime features. + +Further engineering: E002 passed new-input contract probes including arbitrary IDs, unseen structures, singleton pools, out-of-window peaks, missing/novel instrument labels, and candidate-order invariance. E003 preparation resumed with ten CPU workers after 787.907 s; committed targets retained. Batch-32/accumulation-1 native training will scale MAGMa schedule intervals from 2500 to625 microbatches to preserve the original schedule per observed spectrum; optimizer warmup remains2000 steps. + +## E006 — fixed fingerprint score comparison +- Hypothesis: common Morgan bits dominate ordinary cosine; weighting by their training-fold information content improves discrimination without retraining the spectrum encoder. +- Changed factor: fixed ranking function only, using the completed E002 checkpoint. Compared eight prespecified rules: cosine, soft Tanimoto, BCE likelihood, size-normalized BCE, cosine with sqrt-IDF, cosine with IDF, square-root-size-normalized dot, and mean dot. No validation fitting; IDF uses only 25,046 experimental train SMILES fingerprints. +- Selected IDF-weighted cosine: Hit@1 0.2459725153, Hit@5 0.3981162180, Hit@20 0.5622008338 on the same full validation query hash. Paired molecule-bootstrap gain over E002 +0.01302177 (95% CI [0.00855167,0.01742674], 3,185 groups). Eight-rule comparison took 8.841 s on the sole H100, overlapping E004 training briefly. +- Negative comparisons: BCE Hit@1 0.20433373; normalized BCE 0.22358330; mean dot 0.20505430. Tanimoto 0.23310515; sqrt-IDF cosine 0.24226671; dot/sqrt(size) equals cosine ranking 0.23295074. All results/source retained. Derived checkpoint SHA256 `c20a89ff4ee9c6ec69b593b48971e15a233c8f0382ad5d828700568b550583c7`; full independent replay passed all 19,429 queries in 115.219 s and exactly matched all three hit rates. MCES pending. + +## E007 — training-only hard-negative contrastive fine-tuning (prepared) +- Hypothesis: fingerprint regression ignores which similar-mass candidates must be separated; listwise training against training-only molecular negatives improves retrieval. +- Changed factor: add multi-positive near-mass InfoNCE to the fingerprint loss, initialized from the task-trained E004 checkpoint after its run completes. No external initialization assets. +- Negative pools derive solely from 25,046 experimental train and 435,076 sanitized synthetic molecular structures. Neutral masses use their training formula metadata. A ±0.01 Da neighborhood is widened to at least 32 molecules; identical fingerprint negatives are treated as positives to avoid contradictory supervision. Pool preparation 14.511 s. +- Planned fixed settings: 32 negatives, temperature 0.05, contrastive loss weight0.2, learning rate1e-4,20epochs×1200steps; same experimental/synthetic mixture. Validation only selects checkpoints; no validation candidate is used as a training negative. Training pending. + +## E008 — transformer with training-IDF fingerprint ranking +- Hypothesis/change: apply the fixed training-IDF weighting from E006 to E004 outputs. Network parameters are unchanged; weights derive only from train fingerprints. Same eight predefined fixed rules evaluated in4.108 s; full comparison retained. +- Selected weighted-cosine validation Hit@1 .31988264965, Hit@5 .49997426527, Hit@20 .67131607391. Source checkpoint E004 epoch37; derived checkpoint SHA256 `c611ede98e88041dafc82cfb71182dcb34f4ac4d93e91603557d0438e859036d`. Full replay passed all19,429 queries in98.440s and exactly matched all hit rates. Paired gain over E006 +.07391013,95% molecule-CI[.05529783,.09264636]. Proton Hit@1 .3674789, sodium .1722609; released GLACIER domain .4087734, remaining conditions .2306343. MCES pending. Exact selected fitting source, configuration, metrics and logs are copied into E008/research lineage; no external pretrained assets. + +## E009 — ten-peak transformer (planned from training-source analysis) +- Hypothesis: retaining many diffuse simulated peaks creates a source mismatch and distracts the encoder; limit both experimental and simulated inputs to the ten strongest peaks. +- Training-only analysis: deterministic seed1 samples of100,000 spectra per source show top10 retains89.963% of experimental raw intensity versus40.715% of synthetic intensity; mean retained peak counts33.50 versus58.35 (cap128). The ten-peak setting also matches the supplied MIST reproduction recipe. +- Changed factor versus E004: maximum peak tokens64→10, with the same width384/depth4, seed1, loss, mixture, steps, epochs and cosine checkpoint selection. Check fixed IDF ranking afterward using the already established scoring family. Training pending native smoke and single-GPU availability. + +## E010 — precursor mass likelihood (training-only calibration, prepared) +- Hypothesis: accurate observed precursor mass separates different formulae within mass-based candidate pools, complementing learned fingerprints. No true query formula is used. +- Fit only experimental-train residuals between observed precursor and RDKit exact target mass plus the public adduct. Robust Cauchy offsets/scales are median/MAD per adduct/instrument, scale floor0.1ppm; unknown instruments fall back to adduct-specific training calibration. Train audit8.290s: median absolute error0.229ppm overall, proton0.153ppm, sodium2.896ppm. +- Predefined score family: E008 IDF cosine plus mass log-likelihood with coefficient in [0,.005,.01,.02,.05]. Validation selects one fixed rule; no query fitting. Candidate mass caching uses only candidate SMILES and is a development convenience; runtime computes these from supplied structures. Results pending. + +E003 pipeline smoke completed: native full-size architecture trained128 optimizer steps, seed1, provided original training supervision, batch32/accumulation1. Wall114.478s, peakCUDA5.589GB; steady steps25–125 took26.477s. This is only a pipeline/timing probe, not baseline confirmation or scientific model selection. Ten deterministic validation strata queries replayed successfully in76.540s from /tmp; every supported candidate had a prediction, including sodium and missing CE/instrument. Hit@1=.3 on this tiny nonrepresentative probe, not a full-validation result. Full all-condition preparation remains running. For the next throughput probe, enable TF32 high matmul precision and examine larger batches before committing the full run. + +E009 training started from scratch with40epochs×1200steps, batch512, seed1, max10peaks; all other E004 settings retained. + +E010 internal full-validation result: coefficient.05 selected Hit@1 .373256472284, Hit@5 .558855319368, Hit@20 .722167893355. Coefficient.02 yields .368881568789/.563899325750/.731020639251; primary Hit@1 governs selection. Paired gain over E008 +.05337382,95% molecule-CI[.04342458,.06387135]. Proton Hit@1 .43615573 (gain+.06867683); sodium .17817184 (gain+.00591091, CI includeszero). Five-rule evaluation10.078s on soleH100, briefly overlapping E009. Candidate mass preparation84.728s on2CPUs, uses only candidate SMILES. Derived checkpoint SHA256 `72e3da9cc1bb57846e15932f057cf43d63fc1f3b9ea40c74bf69a9c70d9cba13`; validation query hash `7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6`. Relocated independent replay started; not yet published. + +E003 throughput preparation: added an explicit training matmul-precision setting (high enables TF32), configurable native learning-rate decay interval, and a bounded per-worker graph-feature cache. The cache holds only deterministic molecular graph features with one-hot edge tensors packed as uint8; targets remain spectrum-specific. Exact collated tensor comparison passed64 deterministic seed1 training examples, testing misses and repeated hits, in3.390s. Batch128 schedule preserves sample counts with LRwarmup500/decay1250 and MAGMa156/156 (rounded from156.25); peak LR unchanged. Larger-batch probe pending GPU availability. + +## E011 — equal-weight peak-encoder ensemble (planned) +- Hypothesis: ten-peak and64-peak encoders make complementary errors; a fixed equal-weight ensemble improves retrieval. +- After E009 completes, compare two predefined rules using E004 and E009: arithmetic mean of fingerprint probabilities, or arithmetic mean of training-IDF cosine scores. Both use E010's already-selected train-calibrated mass score with coefficient.05. No parameter fitting or labels at inference; select on full validation Hit@1, report molecule-bootstrap uncertainty. + +E010 independent relocated full replay PASSED:19,429/19,429 valid rankings, no global error,113.689s (overlapped E009 training and CPU research jobs). All three hit rates exactly match internal evaluation. New-input probes passed in11.634s: arbitrary IDs/new structures, singleton pools, missing/novel instruments, out-of-range peaks, candidate-order invariance, no package mutation. Published as the new selected package after these checks; MCES remains pending. + +## E013 — condition-aware precursor calibration (prepared) +- E010 validation error analysis: released-domain Hit@1 rose to.53133, but remaining conditions fell to.21454 fromE008's.23063; proton/missing-CE Hit@1 is.24929. Hypothesis: metadata completeness marks different precursor-error distributions, and pooled calibration overtrusts missing-CE precursor masses. +- Changed factor: fit train-only median/MAD calibration separately by adduct, instrument, and whether collision energy is present. Groups smaller than64 train rows fall back to adduct/CE, then adduct. Retain E010 coefficient.05, E004 network and training-IDF weights. No validation fitting. Calibration/evaluation pending. + +E009 COMPLETE:574.627s on oneH100 (brief scoring/replay overlaps logged), peakCUDA9.256GB. Epoch37 selected by raw cosine retrieval; Hit@1 .333676463019, Hit@5 .501878635030, Hit@20 .661639816769. Raw checkpoint SHA256 `6960d7591a47579956d77ae2fed7257680d8fd6b0602bcda03865abdce412c0e`. Paired raw-score gain vs64peak E004 0.03160224406814555,95% molecule-CI[0.018987894860506185,0.04320836517468455]. Final weighted/mass and ensemble evaluation pending. + +E013 full-validation internal result .382520973802/.575531422101/.736167584539 (Hit@1/5/20), versus E010 .37325647/.55885532/.72216789. Paired Hit@1 gain+.00926450,95% molecule-CI[.00652667,.01220483]. Train audit confirms proton precursor MAD.0401ppm with knownCE versus1.2050ppm with missingCE; calibration remains train-only. Evaluation12.819s, briefly overlapping E009. Derived checkpoint SHA256 `9c3570d912486378c6e4fea28f967da1c49b9369b1dd52e364801e9a07218dac`; same full validation query hash. Independent replay pending. + +E011 COMPLETE internal evaluation: ten-peak IDF-only .35374955; ten-peak plus fixed E010mass .39744712/.57079623/.73277060. Equal-probability ensemble .424725925163/.596788306140/.750939317515; equal-cosine ensemble .42060837/.59287663/.74754233. Select equal probabilities by Hit@1. Evaluation36.783s; a redundant NPZ-index read inside the mass loop was fixed afterward without changing scores. Source before/after preserved. E012 names the ten-peak+mass ablation. + +## E014 — combine selected equal-probability ensemble and condition-aware mass calibration +- Combine independently promising E011 encoder ensemble with E013 train-calibrated precursor likelihood. Same coefficient.05 and equal encoder weights; no new fitted parameter or validation weight search. Compare both prior ensemble rules and single-encoder controls for a complete ablation. Independent replay will target the strongest full-validation candidate. + +E014 internal full-validation result: equal-probability ensemble .432446343095/.611971794740/.765299294868; equal-cosine .42971846/.61053065/.76313758. Single ten-peak conditioned control .40537341/.58721499/.74630707;64-peak exactly reproduces E013 .38252097. Evaluation5.231s after caching the NPZ indices, during native probe startup. Paired gain vs publishedE010+.05918987,95% molecule-CI[.05121523,.06739473]; vs E011+.00772042,CI[.00518289,.01035210]; vs single ten-peak conditioned+.02707293,CI[.01861828,.03595447]. Checkpoint SHA256 `33f307d4f57bc0df4b2e5a3080cd5efa60e7c5e3e28648eda492a2f4b7a0709c`. E013/E012 are retained ablations; strongest E014 proceeds to independent replay. + +E003 larger-batch probe INTERRUPTED for diagnosis after248.421s: CSV stopped after step30; parent CPU remained active while GPU was idle for over two minutes. Peak observed GPU reserved memory28.45GB, no OOM reported. This is a failed throughput probe, not a scored scientific model. Exact source/config/logs retained in smoke-b128; a seed1 batch128 reproduction with periodic Python stack dumps and checkpoints every16steps is running. No affected model was published. + +E014 independent relocated replay PASSED:19,429/19,429 valid rankings, exact agreement with all internal hit rates,118.138s, peak summed process RSS9,148,887,040bytes. Unseen-input/candidate-order/package-mutation probes passed13.545s. Published as selected package. MCES pending; validation is not directly comparable to the external test score. + +E003 full fragment preparation COMPLETE:189,031/194,119 train spectra and18,170/19,429 validation spectra annotated;6,347 total no-fragment exclusions affect only fitting/loss validation, never retrieval denominator. Resumed phase2414.156s plus recorded prior787.907s=3202.062s, excluding earlier invalidated smoke. Manifest and source digests preserved. Batch128 debug repetition completed40steps in134.157s, peakCUDA25.757GB; prior stall did not reproduce. Stack dumps identify substantial worker-startup/loading time but do not establish the original stall cause. Added compact worker metadata and retained periodic checkpoints. +Native source audit found a separate signed-bit bug: packed boundary atom63 was erased by a >0 test on signed int64. Changed to !=0; direct tests at32,64,65,100atoms now recover every expected boundary. This changes training fragment supervision for large molecules and is recorded as an additional E003 factor. No previous inverse/ensemble model is affected. +Full native training will start from random seed1 with all189,031 training spectra, batch128,6loader workers, TF32 high precision, sample-scaled LR/MAGMa schedules; first stage4000optimizersteps, retain milestones every2000. A fixed hash-selected4096 validation spectra monitors loss; checkpoint/model publication to root requires validation retrieval metrics. Current root remains independently verified E014 during native fitting. + +## E015 — native forward reranking of ensemble shortlists (implementation/pipeline phase) +- Hypothesis: the native simulator can resolve ambiguous top candidates while E014 limits candidate-simulation cost. Use the top20 ensemble candidates per query; union candidates sharing the same public pool/condition to reuse simulations. Rank only each query's own shortlist, then append its remaining ensemble order. +- Compare fixed reciprocal-rank fusion with native weights[0,.25,.5,.75,1] and offset10; no query-specific fit. Unsupported candidates retain their ensemble rank as neutral native evidence; unsupported observations keep the ensemble ranking. Shortlist unit checks pass complete permutations, union deduplication, order invariance, exact zero-weight identity, and own-shortlist-only reranking. A pipeline smoke uses the prior40-step native probe; scientific evaluation awaits native training milestones. + +## E016 — training-only mixture model for precursor errors (fitting) +- Hypothesis: precursor errors combine very precise and noisy sources within each metadata group, which one Cauchy scale cannot capture. +- Replace E014's single Cauchy density with a mixture of fixed Cauchy scales[.003,.01,.03,.1,.3,1,3,10,30,100,1000]ppm. Fit only mixture weights by100 deterministic EM iterations on experimental-train residuals, with one pseudo-observation/component; offsets are training medians. Keep E014 encoder ensemble, equal member weights, coefficient.05 and metadata grouping unchanged. No validation coefficient search. Results pending. + +E015 pipeline replay PASSED after relocation:10/10 complete valid rankings acrossadduct/energy/instrumentstrata,62.081s. Native smoke weights only, so tiny Hit@1 .4/Hit@5 .7/Hit@20 .9 is not scientific selection. Full-validation top20 staging needs217,475 candidate-condition simulations for19,429queries,about91.7% fewer than256candidates across10,192conditions; stage51.069s. A fixed1024query uniform sample(seed0,query hash`84cb02ac31cd0711f2fae667ec8c529f6bced72c00ee13b98565616cdb25035e`) has17,656 simulations; stage8.146s. This sample is for checkpoint screening, with full validation required before root publication. +E016 fitting16.348s CPU, evaluation11.969s on soleH100 overlapping native training. Fixed mean-probability ensemble Hit@1 .433475732153,Hit@5 .612074733646,Hit@20 .765299294868. Gain over E014+.00102939,95% molecule-CI[-.00031004,.00243175]:54 queries gained,34lost; the small gain is statistically uncertain. Derived checkpointSHA256 `51461bd376a5e4faeef4b57286af5a7d8739b36dbf9115f1d1ca36adcb3eb719`. Independent relocated replay returned successfully in101.208s,peak summed RSS9,139,843,072bytes; score/probe checks pending. + +E016 final independent checks PASSED: 19,429/19,429 valid rankings, all hit rates exactly reproduced; unseen-query and candidate-order probes passed in14.670s with package unchanged. Exact paired MCES@1 delta versus E014 is−.01636729 (lower is better),95% molecule-CI[−.09724679,.07164605]; unchanged predictions cancel,450changed queries,90new molecular pairs,20.982s/2CPU workers. Both Hit@1 and MCES changes are statistically uncertain. Select E016 by its higher primary validation point estimate; E014 remains the fixed E015 checkpoint-screening control. Full absolute MCES remains pending. Root publication includes the selected fitting source, all encoder lineage/config/logs and these checks. + +## E017 — synthetic collision-energy masking (prepared) +- Training-only source audit: experimental spectra have47.656% missing energy; clean simulations have none. With25% real/75% synthetic sampling, only11.914% of training inputs have missing energy. Validation error analysis shows this remains a weak condition. +- Hypothesis: masking energy on50% of sampled synthetic spectra teaches the same encoder to handle unknown collision energy across more molecules. Keep the spectrum, target, adduct and instrument unchanged. This probability is a fixed rounded training-source rate, not fitted on validation. +- Planned changed factor versus E009: synthetic energy metadata masking only; random seed1, max10peaks,40epochs×1200steps,batch512,width384/depth4,same objective/optimizer/mixture. An independent seed17001 augmentation RNG preserves the main data/dropout RNG stream and is checkpointed for resumption. Training not yet started. CPU source audit.252s; source prepared inpeak-condition-drop. + +E015 first scientific checkpoint screen COMPLETE (E003 step1477, exported checkpointSHA256`79b83bea7d6039994d3d4dfda38fafbb656afa4ff490abdf3a82a7391b2fa759`). Fixed1024query set as above; native replay199.876s,peak summedRSS12,260,560,896bytes,full screening203.264s,oneH100 overlapping native training. All1024 rankings valid. Hit@1 forweights[0,.25,.5,.75,1]=[.41894531,.44628906,.45996094,.44042969,.42675781]. Select.5 on this screen:Hit@5 .64453125,Hit@20 .7578125;pairedHit@1gain+.041015625,95%molecule-CI[.01421717,.06907370] overE014on668groups. Known-domain Hit@1 .692164 vsbaseline.604478;remainingconditions .204918 vs.215164, so the early benefit is concentrated inknown-energyproton spectra. This is a subset screen, not a full-validation or test result. Next comparestep2000beforefullvalidation. + +E017 starting on the same soleH100 alongside E003. E009 measured peak allocated9.256GB and current E003 GPU reservation55.1GB leave capacity; cap E017 allocator at16% of totalGPU memory (~12.8GiB), retaining headroom. The cap changes resource allocation, not training math. All wall times will explicitly record overlap; no secondGPU is used. + +E017 preregistered post-training retrieval comparisons: apply frozen E016 training-IDF/mass-mixture score to the selected E017 encoder alone; replace E009 in the E004+E009 equal-probability ensemble withE017; and use an equal three-member E004+E009+E017 ensemble. Include E016 unchanged as an exact control. No learned ensemble weights or new mass coefficient; select by full-validation Hit@1 with molecule-group uncertainty. + +E001 full absolute MCES@1 COMPLETE:19.734700705132 on19,429queries. Exact official settings,8,663unique molecular pairs; current resumed phase computed8,363new pairs in4249.433s with4CPU workers, with earlier cache-preparation/interrupted logs retained separately. This updates only the secondary metric for the early MLP control; model selection is unchanged. + +E015 step2000 scientific screen COMPLETE: checkpointSHA256`e79b4150ce92647fe99446477caf1f6c3819d343ea3867db8af1e2e7ad0ed369`,same1024queryhash/seed. Native replay251.147s,peak summedRSS12,563,185,664bytes,total254.038s; overlaps E003/E017training onsoleH100. Forweights[0,.25,.5,.75,1],Hit@1=[.41894531,.4375,.46484375,.435546875,.416015625]. Selectweight.5:Hit@5 .63671875,Hit@20 .7578125;gainvsE014+.04589844,95%molecule-CI[.01937100,.07447167]. The primary point estimate improves overstep1477by.0048828125, whileHit@5 decreases; full validation is next. Exactnative-alone shortlistreranking isweakerthanE014 atthischeckpoint, so the gain depends onthehybrid. + +Full absolute MCES is now complete for E014 andE016:10.276828452314 and10.260461166298 respectively. E014 used6,339unique pairs,2,375new pairs,1820.068s with4CPU workers. E016 used6,315pairs,allcached,5.363s with2workers. The difference exactly reproduces the independently calculated pairedMCES delta. Selection remainsE016 whileE015 fullvalidation runs. + +E015 step2000 fixed hybrid relocated-package unseen-input probes PASSED in114.968s: newstructures/arbitraryqueryIDs,completecandidatepermutations,singletonpool,missing/novelinstrument,out-of-windowpeaks,candidate-orderinvariance,andpackageimmutability. Full19,429queryreplay isrunning. Nativecheckpoint remainsfixed atstep2000 despite continued E003training. + +E017 training COMPLETE:676.215s onsoleH100 overlappingE003training/E015retrieval;peakallocated9,255,555,584bytes. Epoch28 selectedrawHit@1 .339801327912,Hit@5 .507540274847,Hit@20 .658963405219;checkpointSHA256`15d84dfaaacf65ad9224f15f513f2689afffe4eecbff1b35ce8bc55cd1539248`. RawgainoverE009+.00612486,95%molecule-CI[−.00430701,.01656211],statisticallyuncertain. Fixedcalibrated postscore8.922s:single .41000566/.59977353/.75253487;replacementE004+E017 .43553451/.61933193/.76998302;threeE004+E009+E017 .44289464/.62710381/.77904164. ControlE016 exactlyreproduced. Three-member gainvsE016+.00941891,95%molecule-CI[.00365417,.01517550]. + +## E018 — selected three-member inverse ensemble +- Select the preregistered equal E004/E009/E017 probability ensemble from E017 postscore. Same train-IDF and frozen train-only E016 precursor-mixture likelihood, coefficient.05; no fitted ensemble weight. Fullvalidation queryhash`7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6`. Independentreplaypending; preserveallthree traininglineages. + +E007 contrastive training STARTING: originally preregistered E004epoch37 initialization,20epochs×1200steps,batch512,seed1,lr1e-4,25%real/75%clean synthetic,32near-mass negatives,temp.05,lossweight.2. Negativesfromtrain/cleansynthetic structuresonly. Allocate atmost20%of soleGPU memory; overlapsE003/E015, nosecondGPU. CurrentE003reservation42.8GB leaves headroom for~14GB estimated contrastive peak. + +E017 condition diagnosis supports the masking hypothesis: rawsingle-encoder Hit@1 onmissing-energy spectra rises .22033002→.24328327,delta+.02295325,95%molecule-CI[.00815355,.03826665];sodium .17394976→.19886004,delta+.02491028,CI[.00146445,.04560380]. Known-energy rawperformance decreases .44110276→.43127820 (CIincludeszero). In E018three-memberensemble,missing-energy Hit@1 improves .25142797→.26591919 andsodium .19674900→.21173739; bothpairedCIspositive. Additional post-hoc attribution control: duplicate E009 in an equal E004/E009/E009 ensemble to distinguish added encoder diversity from merely increasing ten-peak weight. This control does not fit any parameter. + +E007 attempt 1 FAILED before a completed epoch or selected checkpoint. Observed log lifetime58.718s (filesystem creation to last error write; cleanup excluded). Float32 negative sampling added the large pool offset before flooring, occasionally rounding to the exclusive upper bound. Reproduction on the real highest-mass pool produced index460122 for an array of length460122. Fixed by flooring the random offset before integer addition and enforcing the upper bound. Check:29,447,808draws over all460,122pools had3,999old out-of-pool samples andzero fixed failures; CUDAedgecase fixed460122→460121,1.094s. Failedsource/recipe/log retained in E007/failed-attempt-1. Restart from the same original E004 checkpoint,seed1; no validation update was selected from the failed run. + +E018 independent relocated full replay PASSED:19,429/19,429 valid rankings and exact agreement with internal Hit@1 .442894642030,Hit@5 .627103813886,Hit@20 .779041638787. Wall103.294s,peak summedRSS9,598,693,376bytes; oneH100 overlapping E003/E007training,E015replay andCPU MCES. Unseen/order/package-immutability probes passed15.337s. CheckpointSHA256`b2cf7e886b8f81bb0d14953d4bdb5027760cf027bf9b11936f042518ef52975c`. Select and publish by the improved full-validation primary metric; pairedMCES is running and will be added when complete. +Attribution control15.589s: repeating E009 as a third member yieldsHit@1 .43100520,Hit@5 .61197179,Hit@20 .76246847,below E016. The selected distinct E017 member reproduces .44289464/.62710381/.77904164. Thus simply increasing the original ten-peak encoder weight does not explain E018's gain. +E015 step1477 sample pairedMCES complete:delta−.55224609,95%molecule-CI[−1.23643969,.16746359],439changed queries,195newpairs,761.893s/2workers. This remains a1024-query screening result; no full-hybrid score is claimed. + +## E019 — combine the improved inverse ensemble with later forward checkpoints +- Hypothesis: E018's stronger missing-energy retrieval and higher top-20 recall complement continued E003 forward training. Replace the E014 shortlist source with the fixed, verified E018 ensemble; retain top 20, the same fixed RRF family [0, .25, .5, .75, 1], and offset 10. No additional fitting or new scoring coefficient. +- Stage the same fixed 1,024-query screen and the complete validation fold using public inputs and E018 predictions only. Test the next retained native milestone when available; compare against E018 on exactly the same queries, then require full replay before root publication. This is a combined-model experiment, so its gain will not be attributed solely to either component. No E019 retrieval result yet. + +## E020 — coarse extension of the global precursor-score coefficient +- Hypothesis: E010 selected the largest coefficient in its original fixed grid, so E018 may benefit from a stronger precursor likelihood. Compare exactly [.05, .1, .2], using .05 as the verified control. +- Changed factor: one fixed global scoring constant. Keep all E018 encoders, equal weights, training-IDF weights and train-fitted mass-error distributions fixed. No query-specific coefficient or calibration fitting. Select the fixed ranking rule on full-validation retrieval and report paired molecule-group uncertainty. + +E018 MCES COMPLETE:9.988136291111 versus E01610.260461166298. Exact paired delta−.272324875187,95%molecule-CI[−.43056669,−.12622224];3,317changed predictions,617new pairs,353.519s with4CPU workers. Full absolute score then used6,173cached pairs in5.261s. All four validation metrics improve. +E020 first scoring attempt was interrupted after168.637s (175.30CPU seconds), without metrics, because it was unexpectedly slow; originalsource/log/record retained in slow-attempt-1. Instrumented restart identifies time spent loading the large candidate NPZ via NumPy read_array, not in ranking or model fitting. Letting the read finish; no cause beyond the observed location is established. This changes no scientific scoring rule. + +E020 COMPLETE, negative result. Coefficient .05 exactly reproduces E018. Coefficient .1 lowers Hit@1 to .43450512 (paired delta −.00838952, 95% molecule-CI [−.01146519, −.00538412]); .2 lowers it to .40830717 (delta −.03458747, CI [−.04214415, −.02730915]). Hit@5/20 also decrease for both. Retain .05. Instrumented scoring took 51.390 s, including about 45.2 s loading the candidate cache, plus the separately recorded 168.637 s interrupted attempt. No model parameter or package change was selected. +E007 preregistered post-training rules: with fixed E018 IDF/mass calibration, compare the selected contrastive encoder alone, replace E004 with E007 in the three-member ensemble, and use an equal four-member E004/E007/E009/E017 ensemble. Include E018 unchanged as control. Keep global mass coefficient .05 after the negative E020 result; compare paired outcomes against E018. + +## E021 — independent masked-energy encoder for ensemble diversity (prepared) +- Hypothesis: an independently initialized masked-energy encoder makes complementary errors and improves the fixed ensemble. This run is for a new ensemble member, not to confirm a baseline score. +- Changed factor versus E017: seed 1 → 2, including the independent augmentation generator seed 17001 → 17002. Keep architecture, 10 peaks, 50% synthetic energy masking, data mixture, objective, 40 × 1200 steps, batch 512 and learning-rate schedule identical. Start from random initialization. +- After fitting, compare E021 alone with the frozen calibration, replacing E017 in E018, and an equal E004/E009/E017/E021 ensemble; include E018 unchanged. No fitted ensemble weights or new mass coefficient. Begin after E007 finishes so the single GPU remains within the established memory allocation. + + +E007 contrastive restart COMPLETE:880.379s on the sole H100 overlapping native training and hybrid replay; peak allocated13,295,123,968bytes. Select epoch4 by full-validation raw retrieval:Hit@1 .310000514695,Hit@5 .483143754182,Hit@20 .643882855525,checkpointSHA256 `0440569a4a87aadf5571781bf60078b22bc11459abf153a2039ed229056087f2`. Later training loss decreases without retrieval improvement. Add the failed first-attempt observed58.718s separately; no failed weights selected. Frozen calibrated score-family evaluation10.864s: single .38658706/.57887694/.73560142; replacement E007/E009/E017 .44279170/.62978023/.77847547; four E004/E007/E009/E017 .44418138/.62545679/.77698286; E018 control exactly reproduced. Four-member Hit@1 gain+.00128674,95% molecule-CI[−.00327597,.00582098] is small and uncertain, with lower Hit@5/20. Same full validation query hash `7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6`. + +## E021 — independent seed for masked synthetic encoder (training) +- Hypothesis: a second independently trained masked ten-peak encoder contributes complementary errors. This tests ensemble diversity, not reproduction of a supplied baseline. +- Change E017 random seed1 to2 (separate augmentation RNG17002); otherwise retain40×1200steps,batch512,50% synthetic energy masking,25% experimental sampling,lr.0003,top10peaks and from-scratch initialization. Sole H100 allocator cap16%; overlap E003 native training/E015 replay. Preserve frozen-training and copied fit source. +- Predefined fixed postscore comparisons: E021 alone, replace E017 in E004/E009/E017 by E021, equal four-member E004/E009/E017/E021, with exact E018 control. Frozen train-IDF/mass mixture and coefficient.05; full-validation retrieval selection and molecule uncertainty. Compute/checkpoint/result pending. + +## E022 — four-member inverse ensemble including contrastive encoder +- Select the preregistered E007 four-member score family by primary validation point estimate. Same E018 calibration, coefficient.05 and equal probabilities; no additional fitting. Full independent relocation/replay, input probes and paired MCES pending before publication. + + +## E023 — increase experimental fraction (prepared) +- Hypothesis: increasing experimental sampling reduces the simulated-to-experimental spectral gap that remains strongest for missing energy and sodium. Change only E017 real_fraction from.25 to.50; random seed1,40×1200steps,batch512,max10peaks,synthetic energy masking.5 and all other training settings unchanged. Train from scratch after E021 finishes. +- Predefined fixed comparisons: calibrated E023 alone, replace E017 in E018, or add E023 as a fourth equal-probability member; E018 unchanged control. Retain frozen training-IDF/mass-mixture and coefficient.05. Full validation selection with molecule-group uncertainty; result/compute/checkpoint pending. + + +## E024 — expand native shortlist to64 (prepared) +- Hypothesis: the current top20 shortlist excludes about22% of full-validation correct candidates under E018, limiting recovery. Compare top64 with top20 on the same fixed1024query screen, same E018 baseline, same upcoming native step4000 weights and fixed RRF family[0,.25,.5,.75,1],offset10. No labels or query fitting used to form shortlists. Measure simulation work and replay resources; full validation required before publishing. Compute/checkpoint/results pending. + + +## E025 — conservative native fusion outside known-energy proton spectra (planned) +- Early E015 screens show gains concentrated in proton spectra with known collision energy. Test three fixed public-condition rules on the upcoming E019 step4000/top20 screen: known-energy proton native RRF weight.5, with all other conditions receiving.5(control),.25,or0. Rank offset10 and E018 baseline unchanged. This is global rule selection, not fitted/query-specific parameters. Full validation required before publication. Reuse fixed native outputs; no extra model fitting or label-derived shortlists. + + +E003 native first stage COMPLETE at4000optimizersteps:3839.656s cumulative wall time on the sole H100 with inverse fitting/scoring/native replay overlaps; peak allocated42,274,433,024bytes. Random seed1/all189,031 annotated train spectra; latest loss validation at2954 gives.60216558 versus.62852305 at1477. Loss-selected checkpoint remains2954; immutable step4000 milestone will be evaluated on retrieval separately. Resume exactly preserved optimizer/sampler/RNG/MAGMa state to8000steps under cumulative24000s budget, keeping identical frozen recipe/source. Stage4000 result/log/checksum preserved. + + +E022 independently relocated full replay PASSED in114.330s,peak summed RSS9,884,073,984bytes,19,429/19,429 complete valid rankings and all three hit rates exactly reproduced. Unseen-structure/arbitrary-ID/singleton/missing-or-novel-instrument/candidate-order/package-immutability probes passed18.359s. Derived checkpointSHA256 `bdb075fec1a50bd0ca3f8a8e3ee939f977407cb1808605e69c1a34238b00ba30`. Paired MCES is computing165new molecular pairs for2,320changed top predictions; retain E018 until this comparison and current hybrid full retrieval are available. +E007 raw contrastive gain over E004 is+.00792630,95%molecule-CI[.00241820,.01342294];known-energy gain+.01463659,CI[.00727480,.02181830],missing-energy and sodium intervals includezero. The small four-member ensemble gain is uncertain in every major adduct/energy stratum. +E024 top64 subset preparation completed26.228s,55,556candidate-condition simulations versus17,666for top20. Query hash unchanged. The forthcoming subset replay will measure the roughly3.14×simulation-work tradeoff. + + +E022 MCES COMPLETE:9.921174532915 versus E0189.988136291111;delta−.0669617582,95%molecule-CI[−.169066412,.028457375],also uncertain. Paired computation165newpairs/2workers/199.675s; absolute6208cachedpairs4.913s. Select E022 by primary full-validation Hit@1 point estimate after exact relocated replay and unseen-input checks; Hit@5/20 decline slightly. This is a small, uncertain improvement and no evidence of surpassing the test reference. Publish the fixed four-member package atomically while native hybrid evaluation continues. + + +## E026 — align contrastive training with training-IDF retrieval (prepared) +- Hypothesis: E007 ordinary-cosine contrastive training differs from the selected IDF-weighted retrieval metric. Change only the contrastive cosine to multiply predicted/candidate fingerprint features by square-root training-IDF, computed from unique experimental training structures. No validation statistics. Keep E007 initializationE004,seed1,20×1200steps,batch512,lr1e-4,32near-mass negatives,temp.05,lossweight.2 and raw retrieval checkpoint selection. +- After E023, compare calibrated E026/E007 single encoders, replacement of E007 in E022, and a five-member equal-probability ensemble. Frozen E018 mass coefficient.05,full-validation Hit@1 selection and molecule uncertainty. Result/compute/checkpoint pending. + + +E021 independent-seed masked encoder COMPLETE:692.382153s on sole H100 with native fitting/replay overlap,peak allocated9,255,555,584bytes. Selectedepoch35 rawHit@1 .339286633383,Hit@5 .510525503114,Hit@20 .660456019353,checkpointSHA256 `6033332c96b67d6b8384da54ec79d8c8a220dcb9998ffa6c3079944b5e3487c0`. Calibrated fixed score-family9.557344s:single .41067476/.59797210/.75752741;replacement E004/E009/E021 .45076947/.63230223/.77806372;four E004/E009/E017/E021 .45272531/.63724330/.78249009. E018 and current E022 controls reproduced exactly. Four-member gainovercurrentE022+.00854393,95%molecule-CI[.00333186,.01361497]. Same fullqueryhash `7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6`. Fixed calibration/IDF/mass coefficient.05 unchanged. Post-hoc attribution control will duplicate E017 at the same four-member weight to distinguish new-seed diversity from increasing masked-model weight; no fitting. + +## E027 — ensemble with both masked-encoder seeds +- Select preregistered E021 four-member rule E004/E009/E017/E021 by full-validation Hit@1. Preserve all fit lineages. Relocated independent replay, unseen-input/order checks and MCES comparison pending before root publication. + +E023 started after E021 scoring on the same GPU, maintaining native training and retrieval overlap. Exact prepared seed1 recipe with experimental fraction.50; training results pending. + + +## E028 — fingerprint similarity family for stronger ensemble (prepared) +- Hypothesis: with the stronger E027 ensemble, Tanimoto/Jaccard may better reflect candidate fingerprint cardinality, while fixed binarization may suppress diffuse weak bits. Evaluate training-IDF cosine(control), squared-norm Tanimoto, soft Jaccard, and binary IDF-Tanimoto at fixed thresholds[.1,.2,.3,.5]. Retain the same E004/E009/E017/E021 probabilities and frozen training-only precursor likelihood,coefficient.05. No additional fitting. Select by full-validation Hit@1 with molecule-group uncertainty; independent replay needed for a changed runtime rule. Run after E027 replay frees GPU resources. + + +E015 step2000/E014-top20/uniformRRF.5 FULL REPLAY COMPLETE:2676.615274s,peak summed RSS18,870,747,136bytes,sampledCPU6087.96s,19,429/19,429 valid complete rankings. Hit@1 .457409027742,Hit@5 .658345771784,Hit@20 .765299294868. Against current E022,Hit@1 gain+.01322765,95%molecule-CI[−.00057051,.02772758];against E027+.00468372,CI[−.01008924,.02005136]. Point estimates improve primary Hit@1 but differences are uncertain; Hit@20 decreases. Known-energy proton Hit@1 .68091227,other conditions .23300670; sodium .17880515,showing the remaining condition imbalance. Prior relocated unseen/order/immutability probes passed114.968s. MCES is computing1814new pairs with2workers. Primary retrieval governs selection; select and atomically publish this verified fixed package while the secondary metric continues, explicitly pending. Native checkpointSHAe79b4150ce92647fe99446477caf1f6c3819d343ea3867db8af1e2e7ad0ed369; full queryhash unchanged. + +E019 step4000 with E018 top20 subset screen COMPLETE:237.849315s native replay,RSS12,401,762,304bytes,total241.105239s;native exportedSHA8600c82817533b0d8bca768c14bfdb17cca4b75f3ce1e773615ff9ada4f62527. Same1024queryhash84cb02ac31cd0711f2fae667ec8c529f6bced72c00ee13b98565616cdb25035e. RRFweights[0,.25,.5,.75,1] Hit@1=[.4296875,.45800781,.46191406,.45507813,.43652344]. Weight.5 selected:Hit@5 .67089844,Hit@20 .77441406,gainvsE018+.03222656,CI[.00755183,.05981277]. The baseline and native checkpoint both changed from E015; this does not establish a checkpoint-only improvement. +E025 conditional-rule screen5.547154s:uniform.5/.5 gives.46191406;known-energy-proton.5/other.25 gives.47070313/.66210938/.77441406;known-proton.5/other0 gives.47167969/.65136719/.77441406. Selectother0 byprimarypointestimate;gainvsE018+.04199219,95%molecule-CI[.02293099,.06274910]. Full validation and packaged conditional routing remain pending. +E021 attribution control:duplicating masked seed1 in E004/E009/E017/E017 yields.44274023/.62736116/.77806372,versus distinctseed2 four.45272531/.63724330/.78249009. Additional seed contributes beyond merely increasing masked-model weight. +E027 relocated full replay PASSED104.278846s,RSS9,978,441,728bytes,19,429valid andexacthitmetrics;new-input/order/immutableprobes16.183228s. CheckpointSHAa836e8e99ce5676c5116c9f62234d8d74e75ab860af43dc7b4cc73c8edce054d. PairedMCES vsE022 is computing349newpairs. E027 is currently the strongest inverse-only model; E015 has higher full-validation primary point estimate. +E028 initial scorer failed before results because stable argsort requires keyword dim. First process duration was not captured;117s is only a conservative log-birth-to-error-archival upper bound (1sresolution,includesidleafterexit). Timing-record helper failures and missing /usr/bin/time are preserved; a repeated failed scorer is timed8.667140s. Corrected keyword argument and added a Python timing wrapper that records failed executions. No fitted parameter/checkpoint/model selection changed in these failures; corrected evaluation running. +Development-only attempt to preserve completed E015 forward predictions found the temporary directory already cleaned; no assets copied or results changed. Empty-cache status records this. No submission depends on a development cache. + + +## E029 — fixed native/inverse composition by public conditions +- Full-validation error analysis shows E015 strong on known-energy proton spectra but weaker on sodium/missing-energy spectra. E025 independently tested this public-condition rule on the fixed subset with step4000/E018. Now combine fixed E015 for known-energy proton inputs with verified E027 inverse ensemble for all other inputs. This changes both the inverse component and routing relative to E015, so it is a combined-model experiment. No labels/IDs/formulae are used to route inference. +- Construct full validation ranks from independently replayed components, measure all retrieval metrics/uncertainty, then package and independently relocate/replay the full composition if better. No parameter fitting. + + +E027 MCES COMPLETE:9.681429821401;pairedgainversusE022−.239744711514,95%molecule-CI[−.38422582,−.10200790],349newpairs/2workers/313.500823s,3547changedtop predictions. All full-replay/probe checks passed. Retain as strongest inverse component even though E015 has higher overall primary point estimate. +E028 COMPLETE NEGATIVE:cosine control exactly reproduces all E027 ranks. Hit@1 for squared Tanimoto .42904936,softJaccard .42791703,binarythresholds[.1,.2,.3,.5]=[.43146842,.40676309,.38319008,.33491173];everyvariant reduces all three hit rates. Retain cosine. Corrected scoring computation12.522339s,external timed process16.253912s includingimports; failed attempts/timing-helper issues separately preserved. Same E027checkpoint/queryhash; no package change. +E029 fixed-condition composed full-validation result .479643831386/.666426475887/.780637191827 (Hit@1/5/20). GainoverE015+.022234803644,95%molecule-CI[.010433974590,.033726201927]. Derived solely from independently replayed component ranks using public adduct/energy presence; no fitting. Full end-to-end relocated replay and unseen/order checks are next, before publication. +E026 now starts the prepared train-IDF contrastive objective from E004,seed1,20×1200steps,all other E007 settings fixed. SoleGPU/22CPUshared allocation; result pending. +E015 selected-final generation was promoted atomically with publish_directory after exact runtime/config/native+baseline checkpoint equality to the verified relocated package. Initial premature snapshot calls were rejected before changing the current manifest; snapshot CLI requires a new directory and is not the promotion API. The current selected generation is generation-1x4e_dwk; public model remains fully valid throughout. MCES still computing. + + +## E030 — add stronger inverse ranking evidence within the native branch +- Hypothesis: E027 may correct residual errors in E015's known-energy proton ranking beyond the older E014 inverse component. For known-energy proton spectra only, compare fixed RRF of full E015 and E027 rankings with inverse weights[0,.25,.5],offset10; all other inputs retain E027. Weight0 must exactly reproduce E029. No training or query-specific fit. Select full-validation Hit@1 with molecule-group uncertainty; any selected runtime change requires independent replay. + + +E023 real-fraction.50 training COMPLETE:683.151044s,peakallocated9,255,555,584bytes,seed1,epoch37 rawselected.296515518040/.463997117711/.632199289722,checkpointSHA256 `025eb1297877bb16d496c49f58952dc22fde58e505cd41423ac28667b4bc87cb`. This is below E017 raw.33980133. Calibrated score-family9.881355s:single.37248443/.57048742/.73122652,replacement.44263729/.62545679/.77147563,four.44654897/.62993463/.77708580. Four improves olderE022 by.00236759 withCI[−.00293817,.00741728],but is below the strongerE027.45272531; no promotion. Full queryhash unchanged. +E024 top64 step4000 screen COMPLETE663.863061s total. Weights[0,.25,.5,.75,1] Hit@1=[.4296875,.46972656,.47167969,.45605469,.42480469]. Select.5:Hit@5.67871094,Hit@20.796875;comparedtop20sameweights.46191406/.67089844/.77441406,all three improve. Full validation remains pending. Extend the already-fixed E025 conditional-weight comparisons to these top64 outputs as an additional screen; no fitting. An explicit development-only snapshot of forward predictions was successfully captured after the writer completed:294,341,508bytes HDF5,copy.568256s. It is not a package asset or inference dependency; condition mapping and deterministic reuse still require verification. +E030 fixed full-rank fusion COMPLETE35.390457s:inverseweights[0,.25,.5] giveHit@1[.47964383,.47815122,.47068815]. Higher inverse weight raisesHit@20slightly but lowers primaryHit@1; retainweight0,exactlyE029. No runtimechange. +E029 relocated unseen/order/immutability probes PASSED135.549754s;full end-to-end replay now running. +E026 first attempt FAILED before a completed epoch/selectedcheckpoint,14.518228s measured in exceptionhandler. Native fitting process grew to67GiBGPU memory,leavinginsufficientspaceforE026's12.15GiB; no failed weights selected. Preserve source/recipe/log/failure record. Restart the exact original E026recipe after rescheduling native fitting. +E003 deliberately stopped for resource scheduling after preservingstep5250checkpointSHA256`03a048abe4844d84cd8b8ebc6e19458dc99cb2f56504d9d2d1ac18b2f44f99bb`;checkpointelapsed5208.127598s. Lastmetrics5350elapsed5271.257472s;post-checkpointstepswillbereplayed. Conservative cumulativebudgetledger5294.819912s chargesallworkincludingloststeps/import/shutdown. No model/source/recipe change. Resume fromthisspecificsnapshot to8000after large GPU replay and contrastive work finish; rootlast.ckpt maystillbeolder and mustnotbeused. Whole research remains active. New scheduling separates the large nativefit from contrastive/inference GPU workloads. + + +## E031 — add objective/source diversity to the best inverse ensemble (prepared) +- After E026, compare E027control; addE007; addE026; addE023; addE026+E023; addallthree. Each uses equal mean probabilities and frozen training-IDF/mass coefficient.05; no learned weights. These fixed sets test whether contrastive objectives or real-data sampling complement the two masked seeds. Full validation/molecule uncertainty, then replay for any improved candidate. E026's originally planned single/replacement/E022-plus comparisons will also be retained. + +## E032 — additional experimental peaks with synthetic truncation retained (prepared) +- Hypothesis: more real fragment evidence can help while synthetic diffuse peaks remain suppressed. Change only effective experimental peak cap from10to32 relative to E017; set modelmax_peaks32 and synthetic_peaks10,so synthetic input remains its top10. Randomseed1,40×1200steps,batch512,real_fraction.25,syntheticCEmasking.5,lr.0003,other architecture/objective unchanged. +- After E026 and its scoring, train this small encoder alongside native inference, keeping the large E003fit rescheduled. Compare calibratedsingle,replaceE004inE027,andaddasfifthmember. Full validation selection and molecule uncertainty; no new fitted calibration. + + +## E033 — reduce experimental oversampling (prepared, later scheduling window) +- E023 real_fraction.50 doubled experimental exposure fromabout32to63passes and reduced simulated coverage,hurting standalone retrieval. Hypothesis: real_fraction.10 improves held-out-structure generalization through greater simulated chemical diversity while synthetic energy masking preserves realistic missingness. Change only fraction.25→.10 versusE017;seed1,40×1200steps,batch512,max10,syntheticCEmasking.5,lr.0003,fromscratch. +- Compare calibratedsingle,replaceE017inE027,andaddfifthmember,with frozen training calibration. Run only after large E003fit reaches8000or during a safe inference window,not concurrently with the large fit. Compute/results pending. + + +E025 top64 conditional screen COMPLETE:uniform.5/.5 gives.47167969/.67871094/.796875;known-proton.5/other.25 gives.48632813/.67285156/.80078125;known-proton.5/other0 gives.48242188/.66210938/.796875. Select other.25 by subsetHit@1; this remains a subset result using E018 and native4000,not a full-validation or test result. The best top20/top64 conditional choices differ,so comparisons between their selected rules combine shortlist and rule changes. A full native4000/top64 conditional replay is a later GPU scheduling candidate. + + +E008 full MCES COMPLETE13.366333830871 on19,429queries;7,826unique pairs,5,454newpairs,5679.476428s with2CPUworkers,officialexactsettings. This updates the secondary metric of the earlier64peak+IDF model; selection remains the later nativehybrid. +E029 branch diagnosis versusE027:known-energy-proton Hit@1.68091227vs.62718307,gain+.05372920,95%molecule-CI[.03845800,.06950437] on9,734queries/2,334groups;other9,695queries remainexactlyE027 at.27756576. This confirms the composed rule's intended behavior; full-runtime replay still pending. + + +## E034 — calibrated precursor evidence within native ranking +- Hypothesis: native entropy ranks lose useful precursor-error confidence; a small training-only mass likelihood term before rank fusion may reduce incompatible-formula competitors. On the exact E024top64/step4000fixedsubset,compare native score−entropy+lambda×frozenE018precursorloglikelihood forlambda[0,.005,.01,.05],then nativeRRFweight[.5,1],offset10. BaselineE018shortlist/remainingorder unchanged; unsupportedcandidates retainneutralbaselinerank. +- Reuse the exact cached E024generatedspectra for identical staged queries/candidates/conditions,no remapping. Lambda0 must reproduce E024rankings exactly. No parameters fitted; no truequeryformula used. Fullvalidation and independentpackagereplay required beforepublication. + + +E026 corrected-schedule run COMPLETE690.948666s,peakallocated13,440,710,656bytes;failedfirstattempt14.518228s separatelycharged. Epoch4 selectedraw.305419733388/.478408564517/.639147665860,checkpointSHAce0f03cfdc7b2600376e9c7d676aa4f3529c2f7dac2cacd49a23d77a14dc38c7. Originalcalibratedfamily9.324957s:single.38643265vsE007.38658706,replacementE022.44366668vs.44418138,addingbothfine-tunedencoders.43949766. No standalone objective-alignment benefit established. +E031 diversityfamily9.337930s:controlE027.45272531;addE007.45380617;addE026.45370323;addE023.45540172;addE026+E023.45627670/.63976530/.78182099;addallthree.45457821. Select the six-member E004/E009/E017/E021/E023/E026 point estimate for furthercomponentverification. Fixed-condition composed evaluation2.009142s gives.48283494/.66833085/.77868135,deltaoverE029+.00319111,95%molecule-CI[.00033945,.00627948]. Thiscombinationgain does not establish an IDFcontrastive-training benefit. An additional attributioncontrol compares oldE007+E023 againstE026+E023 under the same six-member structure. +E032 experimental32/synthetic10 training hasstarted automatically aftertheseE026/E031scores. E003largefit remains rescheduled until smallfitting/scoring and E029nativeGPU inference finish. + + +E034 COMPLETE:exactzero-mass controls reproduce all E024rankings. Native-only addition of mass raisesHit@1.42480469→.4453125 atlambda.01,but hybridRRF.5 remains strongest atlambda0:.47167969/.67871094/.796875. Positive lambdas[.005,.01,.05] givehybridHit@1[.46972656,.46484375,.44921875];retainunchangednativeentropy. Cached-scoreevaluation140.510738s,CPU-only,identicalquery/candidate/condition predictions. The inverse ranking already includes precursor evidence; this result doesnot establish that adding it twice helps. No runtime/modelchange. +Resource diagnosis clarification:the OOM log measures67GiB totalmemoryuse bynativeprocess; the exact split between active batch tensors and reserved allocator memory wasnot separatelycaptured. Scheduling uses the observed footprint,without claiming an unmeasured allocator cause. + + +E031 additional attribution comparison COMPLETE8.965414s:oldE007+E023six-memberensemble.457254619383/.640074116012/.781872458696 beats E026+E023six.45627670/.63976530/.78182099 bypointestimate. Under unchangedE029publicconditioncomposition,oldCF+real yields.483092284729/.668433784549/.778784291523,deltaoverE029+.00344845,95%molecule-CI[.00054013,.00665180];IDF-CF+real yields.48283494. The IDFcontrastivechange isnotselected; retain its negative results. + +## E035 — six-member inverse component +- Select additional E031attribution rule E004/E007/E009/E017/E021/E023 usingequalmeanprobabilities and frozen E018calibration. This is an additional comparison following the initial family,explicitly recorded; no fitted weights. Preserveallselectedtraininglineages. Independentreplay/probes/MCES pending. Candidate for improving the inverse branch of E029; current published package remains E015 until stronger verified composition is ready. + + +## E036 — continuous score fusion on the fixed top64 screen +- Hypothesis: calibrated inverse cosine/mass scores and native entropy similarities retain confidence margins that rank fusion discards. Compare fixed native coefficients[0,.1,.25,.5,1,2],sameE018inverse,step4000native,top64candidateinputs,and1024queryhash84cb02ac31cd0711f2fae667ec8c529f6bced72c00ee13b98565616cdb25035e. Unsupportednativecandidatesreceivezeroextracontribution; inversetailunchanged. No fitting. Zero uses exact baseline; independently checkCPUinverse-scoreordering against packagedbaseline and preserveanyroundingdifferences. Save model-derived rawscores for identical-input research only,neverpackageassets. Fullvalidation/replay required beforepublication. + +E035 full relocated replay COMPLETE114.295734s,RSS10,649,985,024bytes;all19,429valid and exactscreenhitmetrics .457254619383/.640074116012/.781872458696. Unseen/order/packageimmutabilityprobes19.024052s passed. MCES9.556333316177;pairedvsE027−.125096505224,95%molecule-CI[−.214510594149,−.034071065873],148newpairs113.541414s2workers. Candidate improves E027inverse,while standaloneprimaryremains slightlybelowE015; use as potentialcondition-hybridcomponent. +E029 composed MCES COMPLETE9.038216068763,6,178pairs/96new798.181942s2workers. End-to-end replay remains authoritative and isstillpending. + + +## E037 — native spectral metric/intensity comparison +- Hypothesis:cosine-trainednativeintensities mayrank better withcosineororiginal-intensityscoring. ExactE024step4000/top64/1024inputcache; compareentropyandcosine withsqrt-intensity orrestoredoriginalintensities. EachusesfixeduniformRRF.5andpreviousE025publiccondition.5/.25;noadditionalweightsearch/fitting. Entropysqrtcontrols mustexactlyreproduceE024andE025. Preserverawdistancesforidentical-inputresearch. Fullvalidation/replay required beforepublication. + + +## E038 — replace/add the wider-peak encoder in E035 +- Fixed equal ensembles: controlE035;replaceE004byE032;addE032. PlannedafterobservingrawE032improvement,beforeviewingthisensemblecomparison. No fitting. Native-resume driver waited11.740853s for scoring,withongoingCPUreplay; resumedautomatically. + +## E039 — full-validation transfer of continuous fusion +- Transfer E036selectednativecoefficient1 toexistingE029known-energy-protonbranch,keepingE003step2000/E014top20inputs/otherE027branchfixed. ReuseexactE029forwardpredictions,notrekeyed; reconstructRRFcontrolandrequireallranksexact againstfullE029replay. No fitting/additionalcoefficientsearch. Full19,429validationselection andmoleculegroupuncertainty; runtimeverificationrequiredbeforepublication. + + +E032 completed: 804.328503 seconds, peak CUDA allocation 9,653,676,032 bytes, seed 1, selected epoch 38. Raw Hit@1/5/20 = .352823099490/.521591435483/.674764527254; SHA256 7ffcaea9641c049f2f710030e9fd0f931054a553cb3220054be8fc5cd7f8b8ca. Calibrated single = .41875547; replacement in E027 = .45735756; adding a fifth member = .46214422/.64285347/.78547532. Five-member gain versus E027 .00941891, molecule CI [.00617547,.01270078]. Scoring took 7.890546 seconds. + +E038 completed: replacing E004 in E035 with E032 gives .464151526069/.644088733337/.783519481188; gain .006896906686, molecule CI [.002935439462,.010690458586]. Adding E032 gives .462298625766/.644603427866/.784394461887. Select replacement by primary Hit@1. Scoring took 7.679218 seconds; both E032/E038 scoring jobs preceded large native training, despite the generic scorer’s stale overlap description. Model weights and calibration were fixed. + +E036 completed: fixed native coefficients [0,.1,.25,.5,1,2] gave screen Hit@1 [.4296875,.46582031,.49609375,.52148438,.54394531,.54296875]. Select coefficient 1: Hit@5 .693359375, Hit@20 .806640625. CPU scoring took 188.743023 seconds, external process 191.010128 seconds. CPU inverse recomputation differed in three lower-order rankings from the GPU replay, with no top-1 differences and one top64 ordering difference; recorded explicitly. Zero control uses the exact baseline. This is a 1024-query screen, not full validation or test evidence. Fixed-coefficient transfer to E029 is E039. + +E037 completed negative: entropy on square-root intensities remains best. Uniform/public-condition Hit@1: entropy sqrt .47167969/.48632813; entropy original .44628906/.45703125; cosine sqrt .44726563/.46386719; cosine original .4140625/.43457031. Both entropy-sqrt controls exactly reproduce E024/E025. CPU scoring 144.562353 seconds. No runtime metric change selected. + +E039 first attempt failed after 48.925095 seconds in development mass calculation on invalid candidate SMILES. Source/log/timing preserved; corrected to NaN mass and neutral likelihood, matching the existing packaged inverse. No fitted weights changed. Corrected full-analysis run started. + +## E040 — wider-peak replacement inverse package +Select E038 replacement E032/E007/E009/E017/E021/E023, equal probabilities and frozen training-only IDF/mass calibration. Derived checkpoint SHA256 95a9f513278f9b854ceb5f516486a33237b98a1763f71bc764b124a383eae1b1. Preserve E004 training lineage as E007 task-trained initialization even though it is no longer a direct voting member. Independent relocated replay, arbitrary-query/order probes, and MCES follow. + +E029 full relocated replay PASSED: 1833.537362 seconds, peak summed RSS16,749,576,192 bytes, all19,429valid. Authoritative Hit@1/5/20 = .479695300839/.666272067528/.780637191827; gain over publishedE015 .022286273097,95%moleculeCI[.010538643735,.033746547174]. Actual runtime differs from separately composed ranks on2598complete permutations and44top predictions; branch attribution is recorded. The actual replay, not the composed approximation, determines selection. Unseen/order/immutability probes already passed135.549754s. Refreshing MCES for changed actual predictions. Atomically promote after runtime-asset equality to the independently replayed generation. + +E029 atomically published with all209runtime assets byte-identical to the replayed generation; primary checkpoint remains e79b4150ce92647fe99446477caf1f6c3819d343ea3867db8af1e2e7ad0ed369 and inverse a836e8e99ce5676c5116c9f62234d8d74e75ab860af43dc7b4cc73c8edce054d. Actual replay MCES9.039863091255 (14newpairs/14.098211seconds). The44top changes versus component composition all arise in the known-proton branch; the inverse branch has only2lower-order differences and no top-1 changes. Current selection uses actual replay metrics. + + +## E041 — portable continuous-score conditional hybrid +Prepare a fixed package using E039 native2000/E014top20 continuous similarity coefficient1 for known-energy protons, and verified E040 inverse weights otherwise. This combines two independently evaluated changes; E039 isolates fusion. Internal score sidecars are computed only from current inputs inside an owned temporary directory and removed at completion. No external cache or query fitting. Publish only after full selection and package replay. + + +## E042 — second seed of the wider-peak encoder +Repeat E032 with seed2 only; all other architecture, training mixture,40×1200steps and masking settings unchanged. Evaluate single, replace E032 in E040, and add as a seventh equal member, using frozen training-only calibration. Run after E033 and while large native fitting is checkpointed. E033 lower-experimental-fraction training has started. Native6000 preserved with SHA2564d0fb6ac154f03690d87467c703d05e87c0df17aa907e8a4859477271b5ee372; checkpointelapsed5930.422737s and conservative cumulative ledger5950.910453s. Validation5908loss.584782302380. + + +E039 corrected full analysis completed: RRF control exactly reproduces every E029 ranking. Fixed continuous coefficient1 gives Hit@1/5/20 .510834319831/.667455864944/.780637191827, gain .031139018992, molecule CI [.025991188375,.036648383902]. CPU analysis305.747798s, external309.808768s; failed48.925095s separately preserved. Recomputed inverse scores have31 lower-order differences and zero top1 changes relative to packaged GPU baseline; actual package replay will be authoritative. + +E040 fully verified: relocated replay108.260723s, RSS10,661,572,608bytes, unseen/order/immutability probes18.539235s; exact Hit@1/5/20 .464151526069/.644088733337/.783519481188. MCES9.385042976993, paired versusE035−.171290339184, molecule CI[−.268217831794,−.073235187374],196newpairs237.988240s2workers. + +E041 composed selection gives .516393020742/.671367543363/.779968088939; Hit1 gain overE029 .036697719903, molecule CI[.030773143460,.042972008107]. Component-based development selection pending independent package replay. First runtime probe failed because baseline launcher dropped optional internal score arguments; corrected launcher forwards all arguments. The premature probe before build completion is separately recorded. No weights changed or failed model promoted. Failed runtime native simulation1.867344s; full failed wall time was not directly captured,296.968868s is a conservative log-birth-to-archival upper bound including idle diagnosis and slow archive copy. Subsequent probes use the external timing wrapper. + +E002 MCES completed:16.865947809975,9461pairs/9405new,9503.114812s2workers. Earlier primary metrics unchanged. + + +## E043 — larger molecular neighborhoods in the inverse target +Change only Morgan fingerprint radius2 to3,keeping4096bits and E032 experimental32/synthetic10 model/recipe,seed1. Prepare deterministic candidate/train/synthetic fingerprints without changing spectral inputs or label indices. New IDF uses unique experimental training structures only; precursor calibration stays frozen. No averaging across incompatible fingerprint coordinate systems. CPU preparation starts now; fitting is scheduled for a later safe GPU window after native8000 or explicit rescheduling. +E041 corrected relocated probes passed140.282452s (external140.318174s); full replay started after native6000 checkpoint and shutdown. + + +## E044 — stronger inverse scores with fixed native coverage +Compare E036 exact continuous1 control with E040 inverse scores,holding E018top64 shortlist/tail,native4000 predictions and coefficient1 fixed. This isolates scoring under the same simulator coverage; it does not test a new E040 shortlist. No fitting; fixed1024subset then fullverification if useful. + +E043 fingerprint preparation complete68.289470s (external69.003930s),10CPUworkers. Train25,046,validation3,386,candidate828,117,clean-synthetic435,076molecules; all spectral inputs and row/label indices retained unchanged. Fingerprint file hashes and source manifests are recorded. No fitting yet. + +E033 lower-real-fraction training completed558.500856s,peakCUDA9,255,556,096bytes,seed1; selected epoch31 rawHit1 .343404189613,checkpointSHA5f7ceeb8c23c2b06a730741f1da0698092f5a734230a8067251da5355f5899d2. Calibrated replacement inE027 .458026661177/.642750527562/.787894384683; adding fifth .459879561480/.643625508261/.790210510062. Five gain overE027+.007154253950,CI[.004037911401,.010516443428],scoring7.657642s. Below E040 primary,so no standalonepromotion. E042 seed2 wider-peak training has started. +E044 fixed-coverage stronger-inverse comparison completed8.488117sCPU: E018control EXACT .5439453125/.693359375/.806640625; E040scores .5546875/.7041015625/.8115234375. Hit1 gain .0107421875,moleculeCI[−.001957187692,.023414808008] crosseszero. SameE018top64simulatorcoverage/native4000; no claim that new E040shortlisting is tested. Promising for later full candidate,not published. + + +## E045 — all-condition top64 continuous-fusion candidate (preparation) +Stage fixed E040top64 candidates for every usable public condition, with no labels, to measure simulation load. This candidate family combines wider coverage, stronger inverse scores and native evidence outside the known-energy-proton branch. Native4000 has supporting subset results; later6000/8000 checkpoints require their own retrieval screen before full-replay selection. No model is published from this preparation alone. + +E041 composed MCES completed8.382701116887,5774pairs/339new,779.870035s2workers. Fullruntime replay remains pending. +E043 validation representation diagnosis: exact fingerprint-and-exact-mass competitors affect272queries with radius2 versus92withradius3; tie set shrinks on205queries and never grows. Counts only diagnose representation limits and do not predict trained retrieval gains. Exact-mass analysis3.706628s; earlier near-mass tolerance analysis retained separately (6.021980s external) and superseded for strict tie claims. No fitting or runtime answers were encoded. + + +## E046 — combine source-fraction and seed diversity +Fixed equal ensembles: E040control;addE033 lower-real-fraction member;addE042 second wider-peak seed;addboth;replace E023real.5 with E033real.1 while adding E042. Compare all full-validation metrics and molecule-group uncertainty. Defined before inspecting E042 ensemble results; generation timestamps are recorded separately in plan.json. No fitting. The pending native-resume shell is temporarily held until this short family completes, with automatic resume in a finally block. + +E042 seed2 wider-peak fit completed797.048802s,peak9,653,676,032bytes,selectedepoch40raw .356580369551/.529105975603/.684234906583,SHA4448ab7a55cb304071a442b7ddd970851c211b975a2adefd3fe2d92b53619807. Calibrated single .42488033;replace E032 inE040 .46389418;addseed .467805857224/.649801842606/.789078182099,delta+.003654331154CI[.000616724186,.006837367729]. Scoring8.541588680818677s. +E046 family completed8.314853356219828s: control.46415153;addlower-real.46713675;addsecondseed.46780586;addboth .470173452056/.653147357044/.793453085594;replaceE023withE033andaddseed .46991610/.65325030/.79515158. Select both by primary. GainvsE040+.006021925987CI[.002341792691,.009720839474]. Training/calibration fixed; plan records generation/inspection timing. Large native-resume shell was automatically released after scoring. +E045 exact public top64 staging requires674,875candidate simulations across19,429queries,125.420322s preparation. Linear scaling from E029 predicts5931.925GPU seconds; this is planning only and does not establish full runtime. +E015 MCES completed9.644037263884;pairedvsE022−.277137269031,CI[−.663706006646,.110747722877],1814newpairs4078.282604s2workers. This fills the historical secondary metric; current root remains stronger E029. + +## E047 — eight-member inverse component +Select E046both: E032/E007/E009/E017/E021/E023/E042/E033, fixed equal probabilities and unchanged training-only IDF/precursor mixture. Independent relocated full replay, contract probes and MCES follow. Preserve E004 as E007 task-training initialization lineage. + +E041 actual full relocated replay completed: {"composition_check": {"complete_ranking_differences": 2, "note": "actual end-to-end replay is authoritative; cached CPU inverse and batch-dependent native predictions can have numerical differences", "queries": 19429, "top_one_differences": 0}, "metrics": {"hit_rate_at_1": 0.5163930207421895, "hit_rate_at_20": 0.7799680889392145, "hit_rate_at_5": 0.6713675433630141, "mces_at_1": 8.382701116887127}, "paired_delta_vs_E029": {"confidence": 0.95, "estimate": 0.036697719903237426, "grouping": "supplied target_inchikey connectivity block", "lower": 0.03077314346017011, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.04297200810663419}, "peak_rss_bytes": 16826572800, "replay_seconds": 1539.617059001699}. Select actual replay and atomically promote only after runtime-asset equality to the verified generation. + + +## E048 — replace the inverse branch with E047 +Keep E041continuous native branch and public routing unchanged; substitute E047eight-member inverse for other conditions. Independently replay the new inverse on its exact public partition. Reuse the already verified native branch only after exact input-hash equality, all native runtime-asset equality and parent-code equality; configuration may differ only in the inverse checkpoint hash. Officially score the complete composed rankings and run relocated end-to-end arbitrary-input/order/immutability probes. This is component-based full-validation verification, not a repeated full native GPU replay; report the distinction and a conservative measured component runtime sum. No fitting. + +E041 atomically published after full replay and all210runtime assets verified byte-identical to the tested generation. Actual metrics .516393020742/.671367543363/.779968088939,MCES8.382701116887;1539.617059s,peakRSS16,826,572,800bytes. Only2lower-order ranking differences versus component analysis,zero top1 differences. Publication-record.json identifies the selected immutable generation. Research continues. + +E047 complete relocated validation: {"checkpoint_sha256": "4b9bdcb42ff4dfc05f28b6fd1417f27c95892be2f29c8c403b6ccf9e7fc9f3ec", "delta_vs_E040": {"confidence": 0.95, "estimate": 0.006021925986926759, "grouping": "supplied target_inchikey connectivity block", "lower": 0.0023417926905038608, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.00972083947417943}, "metrics": {"hit_rate_at_1": 0.47017345205620464, "hit_rate_at_20": 0.7934530855937001, "hit_rate_at_5": 0.6531473570435946, "mces_at_1": 9.201219826033249}, "probe_seconds": 17.909732793923467, "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "replay_seconds": 97.21025992929935, "rss_bytes": 11440472064}. All probes passed. Best inverse component; primary remains E041 pending E048 branch-combination validation. Source/configuration/logs archived in research/E047-completed and lineage preserved in component package. + +E048 component-based full validation completed: {"checkpoint_sha256": "4b9bdcb42ff4dfc05f28b6fd1417f27c95892be2f29c8c403b6ccf9e7fc9f3ec", "conservative_component_wall_sum": 1584.7063106442802, "metrics": {"hit_rate_at_1": 0.5181429821400999, "hit_rate_at_20": 0.7882546708528488, "hit_rate_at_5": 0.676823305368264, "mces_at_1": 8.276776982860673}, "paired_delta_vs_E041": {"confidence": 0.95, "estimate": 0.0017499613979103403, "grouping": "supplied target_inchikey connectivity block", "lower": -0.0011288682151963936, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.004648510340562341}, "probe_wall_seconds": 136.13644129224122, "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "verification": {"configuration_changes": {"inverse_checkpoint_sha256": ["95a9f513278f9b854ceb5f516486a33237b98a1763f71bc764b124a383eae1b1", "4b9bdcb42ff4dfc05f28b6fd1417f27c95892be2f29c8c403b6ccf9e7fc9f3ec"]}, "native_asset_files": 190, "native_input_hashes_equal": true, "parent_inference_source_equal": true, "unchanged_native_runtime_assets": true, "verification_kind": "changed inverse branch replay plus unchanged native branch reuse from E041fullreplay and end-to-end arbitrary-input probes"}}. Selection uses validation Hit@1; uncertainty includes zero. No new full native GPU replay: identical native component and exact public partition reuse the E041 actual replay; changed inverse branch is independently replayed and complete combined rankings officially scored. Atomic publication follows byte-equality to the probed package. + +E049 prepared fixed checkpoint screen: {"baseline_control": "Reconstruct E044new_E040 complete rankings exactly before later checkpoints.", "candidate_tsv_sha256": "0c5b6aea5fa736d8f1b17e9970818216cf44c1fd0bd65566ff657168250bcc6f", "changed_factor": "native optimizer step4000 versus6000 versus8000, seed1 and frozen training recipe unchanged", "created_utc": "2026-10-21T07:49:37.938115+00:00", "full_training_source_sha256": "df6c44d0ca2561aa246e3855f75caf3a52d13d2fb38e42cf503ba8c76b23f0a3", "hypothesis": "More train-only native optimization improves retrieval under fixed inverse scores and candidate coverage.", "molecule_groups": 668, "query_set_sha256": "84cb02ac31cd0711f2fae667ec8c529f6bced72c00ee13b98565616cdb25035e", "schedule": "Wait native8000 training and process exit; sequential native batch32 simulations may share soleH100 with E043smallfit using .16memorycap; no overlap with large native fitting.", "selection": "maximum Hit@1 over fixed three-checkpoint family; secondary hitrates and molecule-group uncertainty reported", "selection_queries": 1024, "unchanged": "E040 six-member inverse scores, E018top64 shortlist/tail, continuous native coefficient1, entropy-sqrt, batch32 prediction and exact candidate TSV"}. No scores yet for6000/8000; unchanged4000 exact-control first. + +E048 atomic promotion completed: selected rootgeneration-tcu6j6n5, runtime210assets byteequal to probed generation-kgboan_i after audit refresh. Publication-record.json records component-based validation and full metrics. E049 exact4000 control reconstructed all E044rankings; scores .5546875/.7041015625/.8115234375. Preparation9.6267905s/external12.9636108s; control14.0838185s/external15.9799265s. E049 checkpoint6000/8000screen queued after native8000training exit; no latercheckpointretrievalresults yet. + +E050 prepared fixed mixed-radius candidate-score family before radius3fitresults: {"changed_factor": "E047radius2 score mixed with E043radius3 score; no incompatible fingerprint coordinates are averaged", "controls": "zero exactly reproduces E047savedranks; one exactly reproduces E043idf_mass ranks; each source TF32setting matched explicitly", "created_utc": "2026-10-21T07:53:15.499032+00:00", "fixed_family_radius3_weights": [0, 0.125, 0.25, 0.5, 1], "hypothesis": "Larger Morgan neighborhoods may complement local radius2 predictions when fused as candidate scores.", "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "schedule": "wait E043fit and score complete; may overlap E049nativebatch32 onsoleH100; scoringGPUcap0.20", "seed": "member training seeds preserved; molecule bootstrapseed0", "selection": "validationHit@1, secondary hits and molecule-group confidence interval; no fittedensembleweights", "unchanged": "Both IDF calibrations use experimental training molecules only; mass calibration E016mixture and coefficient0.05 once; all network weights frozen"}. No fitting or query-specific parameters. + +E048 validation-only failure diagnosis completed: sparse <=5positivepeaks/missingCE Hit1.17922171 versus >32peaks/missingCE .44595300. KnownH .74316828, missingH .34368697, knownNa .23236515, missingNa .23865658. E048vsE041147corrected/113regressed. MoleculeunweightedHit1 .67741256; largest10groups1581queries/1280misses account13.6723%ofallmisses. Diagnosis3.634328588s internal/external5.074839310s. No query-specific inference rules. Motivates syntheticpeakcountaugmentation and broader nativecoverage. + +E051 prepared synthetic peak-count augmentation: {"baseline": "E03232experimental/10synthetic,seed1,real_fraction0.25,CEdrop0.5,40epochs*1200steps*512,lr0.0003", "calibration": "unchanged train-only E016IDF/mass coefficient0.05", "changed_factor": "On50percent of synthetic training examples retain a uniformly drawn1..10 strongest peaks; remaining synthetic examples retain10; experimental spectra unchanged", "created_utc": "2026-10-21T07:54:25.235731+00:00", "fixed_postscore_family": ["E047control", "singleE051", "replaceE032byE051inE047", "addE051toE047"], "hypothesis": "Sparse missing-energy spectra are weak; randomly reducing synthetic peak counts may improve robustness to incomplete experimental fragmentation.", "labels": "experimentaltrain and held-out-clean supplied synthetic only; validationretrieval checkpointselection", "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "rng": "separate seed+27000generator; CEaugmentation stream and model/batch RNG remain unchanged", "scheduling": "afterE043andE050 complete; may shareGPU withE049batch32nativeinference, neverlargeE003fit", "synthetic_order_check": {"descending_intensity": true, "sampled_valid_rows": 4102, "strongest_positive": true}}. Training is queued behind earlier scientific comparisons. + +E052 prepared fixed native inference-throughput comparison: {"changed_factor": "native inference batch32 versus128; batch64 only if128 fails capacity", "checkpoint_selection": "E049fixed family selected by validationHit1, then frozen for all batchsizes", "created_utc": "2026-10-21T07:56:57.389835+00:00", "hypothesis": "Larger native inference batches can reduce full top64simulation cost within oneH100 limits.", "query_set_sha256": "84cb02ac31cd0711f2fae667ec8c529f6bced72c00ee13b98565616cdb25035e", "schedule": "waitE049complete; no large native fitting; may share soleH100withE051smalltraining; processallocatorcap0.65,smallfitcap0.16", "selection": "among successful batches without lower Hit1 than freshbatch32, choose lower measured prediction walltime; independent full package replay remains required", "unchanged": "E049exact1024queries,candidates.tsv,E040inverse,E018top64coverage,coefficient1,allweightsandnativecode", "verification": "both batches produce fullscreen rankings; report numericalchanges and molecule-group uncertainty"}. All failed executions retained; no training changes. + +E003native8000stage completed: {"continuation": "same frozen source and resumed optimizer/sampler/RNG from explicitstep6000 snapshot; no validation fitting", "publication": "only native work-package auto-exported; root model unchanged pending retrieval", "result": {"data_manifest_sha256": "ca938de9bab1e4208ce258419556b9f173d234267e020118969636f52ca444de", "elapsed_seconds": 7328.420031986665, "global_step": 8000, "hardware": "NVIDIA H100 80GB HBM3", "last_validation_loss": 0.5811559557914734, "peak_cuda_allocated_bytes": 42273342976, "selected_checkpoint": "/run-state/workspace/research/E003/full-b128/checkpoints/best.ckpt", "selected_on": "validation spectrum loss; retrieval must be measured separately", "source_sha256": "df6c44d0ca2561aa246e3855f75caf3a52d13d2fb38e42cf503ba8c76b23f0a3", "validation_loss": 0.5811559557914734}, "source_checkpoint_path": "/workspace/research/E003/full-b128/milestones/step-8000.ckpt", "source_checkpoint_sha256": "63af6576ca7ed0010f8394de3cf9adb3302f46d1f0b4c526c94c367a520d65f3", "training_seed": 1}. Cumulativechargedtime7328.420032s including finalization; peakallocated42,273,342,976bytes. E043radius3fit and E049fixedcheckpoint retrievalscreen nowstarted; no furtherlargefit until current smallfit/inferencequeue completes. + +E049 secondaryMCES queue added before6000/8000retrievalresults: exact officialsubset MCES for4000/6000/8000,2CPUworkers,sharedexactpaircache. Primaryselectionunchanged; results recorded separately inE049/mces-results.json. + +E053 prepared future all-conditiontop64continuous-fusion package with fixedE047inverse: {"comparison": "publishedE048 on all19429validationqueries with molecule-group uncertainty; full relocated package replay and MCES required before promotion", "condition_coverage": "all public adduct/energy/instrument conditions with structural/peak support; unsupported cases retain inverse fallback", "created_utc": "2026-10-21T08:01:17.937923+00:00", "current_action": "public-input staging and simulation-count planning only; no native inference until selections complete", "fixed_inverse": "E047eight-member,checkpoint4b9bdcb42ff4dfc05f28b6fd1417f27c95892be2f29c8c403b6ccf9e7fc9f3ec", "hypothesis": "The stronger inverse shortlist and later task-trained native simulator can improve every public condition through continuous-score reranking at top64.", "inference_batch": "pending fixedE052throughput/accuracy check", "native_checkpoint": "pending fixedE0494000/6000/8000 screen selection", "native_coefficient": 1, "replaces_staging_experiment": "E045 usedE040baseline; retained separately as a count-only planning experiment", "top_k": 64}. Nativeweight/batch choices pending existing fixed screens; only public-input staging starts now. E045E040stage remains separate, not silently reused for a different baseline. + +E051 pretrainingpostscore extension: {"created_utc": "2026-10-21T08:02:47.425276+00:00", "reason": "sparse missingCE failure analysis and syntheticaugmentationmax10 motivate one fixed global public condition rule", "rule": "E047+E051equalprobabilityensemble only for missingCE and<=10positiveintensities; E047otherwise", "status": "defined before E051training or retrieval results"}. Singlemodel sparse/remaining strata compareE032 to isolate augmentation; fixedconditionalmodel is an additional validation selection option. + +E053 full-verification driver prepared and queued: waitsE052checkpoint/batchselection andE051postscore/trainerexit, then fixed nativeexport+E047top64continuous1 package, relocation, end-to-endprobes, independent fullreplay, officialHit1/5/20+groupCI, MCES. Fullreplay measuresCPU RSS/time and ownedTMPDIR/output storage; checks18000s/64GiB/50GiB. No automatic rootpromotion before finalscientificselection/audit. + +E053 public staging completed122.595560s/external123.341180s:674264candidate-condition simulations acrossall19429queries usingE047. Count-based extrapolation5926.55GPUseconds is planning only, not actualruntime. +E052 allocator wrapper corrected before execution to apply the cap only when the native model moves toCUDA, after CPUDataLoaderworkers fork; this preserves the pinned native loader ordering. No weights, math, data or measuredresultchanged. + +E052 pre-execution resource schedule update: {"change": "GPU predictions remain sequential; evaluate completedbatch onCPU while nextbatch predicts, then join evaluations before selection", "completed_experiment_work_before_change": false, "original_driver": "run-initial-sequential.py", "previous_driver_had_no_children": true, "previous_waiting_driver_pid": 30079, "reason": "avoid GPU idle interval during independent CPU entropy evaluation", "unchanged": "models,data,checkpointfamily,batchfamily,metrics,rankingmath,selectionrule", "utc": "2026-10-21T08:08:50.889839+00:00"}. No scientificrunfailed or measuredresultdiscarded. +E049 public candidatekeyaudit10.587334s/external11.076522s,4CPUworkers:25duplicate native InChiKeygroups contain51candidate rows with distinct canonicalSMILES, across23conditions in55556inputrows. No labelsread or inferencemutation. This identifies a possible candidate-key collision issue for a later isolated experiment; currentfixedreplaysunchanged. + +E0496000 fixedscreen NEGATIVE: {"factor": "native checkpoint only; inverse E040, shortlist/tail E018top64, native coefficient1 fixed", "fitting": "none in evaluation; native trained on training fold only", "inverse_score_sha256": "08d3c51f26b8552fce82158c021d01dccdc801c72a9d4da08ca5913022d1de05", "metrics": {"hit_rate_at_1": 0.5361328125, "hit_rate_at_20": 0.810546875, "hit_rate_at_5": 0.6943359375}, "native_checkpoint_sha256": "7f6c3108fee735d862962a66e1357760442f29f014d5324bc7af15f1abca8b02", "paired_delta_vs_step4000": {"confidence": 0.95, "estimate": -0.0185546875, "grouping": "supplied target_inchikey connectivity block", "lower": -0.034318919262088965, "molecule_groups": 668, "queries": 1024, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": -0.0020366080807536677}, "prediction_sha256": "bfa9520cfd14630be11f20e04aa65b34ed96579d90ac6e5ae4d0293dcde8938d", "query_set_sha256": "84cb02ac31cd0711f2fae667ec8c529f6bced72c00ee13b98565616cdb25035e", "wall_seconds": 109.85500700725242}. Prediction510.218836s, CPUevaluation109.855007s/external111.456391s; nativeexport7f6c3108fee735d862962a66e1357760442f29f014d5324bc7af15f1abca8b02. Hit1falls1.85547pointswithmoleculeCIbelowzero despite lower spectrumloss. Step8000screen continues; no furthernativefitting currentlyqueued. Control4000MCES7.2451171875,86newpairs352.406969s2workers. + +E043 radius3 trainingcompleted768.037447s, peakCUDA9,653,676,032bytes, seed1,epoch37 selected. RawHit1/5/20 .360337639611/.528642750528/.682587884091; checkpoint0e826bbf817eae6d5fa8211a9602b4ac5b75b4da4d9bcc5b03646f521d7d2194. Fixedcalibratedscore{"calibration": "radius3 IDF from unique experimental training molecules; unchanged E016 precursor mixture and fixed coefficient0.05", "checkpoint_sha256": "0e826bbf817eae6d5fa8211a9602b4ac5b75b4da4d9bcc5b03646f521d7d2194", "fitting": "no validation fitting", "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "results": {"idf_mass": {"hit_rate_at_1": 0.4279170312419579, "hit_rate_at_20": 0.7540789541407175, "hit_rate_at_5": 0.6104277111534304, "paired_delta_vs_E032_matching_rule": {"confidence": 0.95, "estimate": 0.009161562612589429, "grouping": "supplied target_inchikey connectivity block", "lower": -5.6164317218957414e-05, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.018707676076592506}}, "raw": {"hit_rate_at_1": 0.36033763961089094, "hit_rate_at_20": 0.6825878840907921, "hit_rate_at_5": 0.5286427505275619, "paired_delta_vs_E032_matching_rule": {"confidence": 0.95, "estimate": 0.0075145401204385195, "grouping": "supplied target_inchikey connectivity block", "lower": -0.0022048491350484833, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.017696264546879295}}}, "wall_seconds": 6.816029710229486}. +E050 fixed mixed-radiusfamilycompleted: {"fitting": "none; fixed candidate-score weights, validation model selection only", "formula": "(1-alpha)*E047radius2_IDFcosine + alpha*E043radius3_IDFcosine + fixed0.05train_mass_likelihood", "max_cuda_allocated": 8533967360, "overlap": "oneH100 may share E049batch32native simulation; waits E043fit and single-modelscore to finish", "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "radius2_checkpoint_sha256": "4b9bdcb42ff4dfc05f28b6fd1417f27c95892be2f29c8c403b6ccf9e7fc9f3ec", "radius3_checkpoint_sha256": "0e826bbf817eae6d5fa8211a9602b4ac5b75b4da4d9bcc5b03646f521d7d2194", "results": {"0.0": {"hit_rate_at_1": 0.47017345205620464, "hit_rate_at_20": 0.7934530855937001, "hit_rate_at_5": 0.6531473570435946, "paired_delta_vs_E047": {"confidence": 0.95, "estimate": 0.0, "grouping": "supplied target_inchikey connectivity block", "lower": 0.0, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.0}}, "0.125": {"hit_rate_at_1": 0.47506305007977767, "hit_rate_at_20": 0.793298677235061, "hit_rate_at_5": 0.6542282155540686, "paired_delta_vs_E047": {"confidence": 0.95, "estimate": 0.004889598023573009, "grouping": "supplied target_inchikey connectivity block", "lower": 0.0016016934946936467, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.008956275820112488}}, "0.25": {"hit_rate_at_1": 0.4761953780431314, "hit_rate_at_20": 0.792578104894745, "hit_rate_at_5": 0.6539193988367904, "paired_delta_vs_E047": {"confidence": 0.95, "estimate": 0.006021925986926759, "grouping": "supplied target_inchikey connectivity block", "lower": 0.0014786732353629624, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.010820159038317375}}, "0.5": {"hit_rate_at_1": 0.47007051315044523, "hit_rate_at_20": 0.7897987544392403, "hit_rate_at_5": 0.6494930258891348, "paired_delta_vs_E047": {"confidence": 0.95, "estimate": -0.00010293890575943178, "grouping": "supplied target_inchikey connectivity block", "lower": -0.00626833797046343, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": 0.005968667558201503}}, "1.0": {"hit_rate_at_1": 0.4279170312419579, "hit_rate_at_20": 0.7540789541407175, "hit_rate_at_5": 0.6104277111534304, "paired_delta_vs_E047": {"confidence": 0.95, "estimate": -0.04225642081424674, "grouping": "supplied target_inchikey connectivity block", "lower": -0.052750819481318746, "molecule_groups": 3185, "queries": 19429, "resamples": 2000, "seed": 0, "statistic": "spectrum-weighted mean; molecules sampled with replacement", "upper": -0.032182327117425774}}}, "selected": "0.25", "wall_seconds": 13.929276458919048}. Selectalpha.25 for packaging/independentreplay; endpointcontrols exact. This is inversecomponent selection, not an improvement claim for publishedhybrid/test. +E049 discriminationdiagnostic6000vs4000 (conditional936supportedtruth-in-top64queries): native-onlyHit1 .47329vs.46474,uncertaingainCI[-.01522,.03229]; averagecorrectsimilarity+.007583 butstrongestfalse+.009168. This differs fromnegativehybridresult and suggestscheckingfusioncalibration before attributing all decline to simulatorquality. No scorecoefficientschanged or selected bydiagnosis. + +E054 portable mixed-radius package prepared: {"changed_factor": "E047radius2score coefficient0.75 plusE043radius3score coefficient0.25; frozenmasslikelihood coefficient0.05 once", "component_checkpoint_sha256": ["4b9bdcb42ff4dfc05f28b6fd1417f27c95892be2f29c8c403b6ccf9e7fc9f3ec", "0e826bbf817eae6d5fa8211a9602b4ac5b75b4da4d9bcc5b03646f521d7d2194"], "created_utc": "2026-10-21T08:16:55.447240+00:00", "fitting": "none; all networkweights and bothIDFs fitted on authorized trainingdata; mixture selected on validation", "hypothesis": "The selected mixed-radius candidate score combines complementary structural neighborhoods and should reproduce E050alpha0.25 in a portable package.", "query_set_sha256": "7e6f5034f6196d3f18afe31ec8cfc24305b12d09b6cd04293da061cd3f7746e6", "seeds": "E047member seeds preserved; radius3seed1; bootstrap0", "verification": "new-input/candidate-order/immutablepackage/internal-score probes, fullindependentrelocatedreplay, comparisonwithinternalranks, Hit1/5/20 andMCES"}. Independent verification starts; root remains E048. E053all-conditioncandidate retains its predefinedE047baseline for an isolated comparison. diff --git a/shared/package-files/34/3447766fe0ce36a50c57d7fc809db2a1dd7b0bfe5f5c61c7677f0f785b17932c/blob b/shared/package-files/34/3447766fe0ce36a50c57d7fc809db2a1dd7b0bfe5f5c61c7677f0f785b17932c/blob new file mode 100644 index 0000000000000000000000000000000000000000..786486295935319c03a60a349f03328c127935b9 --- /dev/null +++ b/shared/package-files/34/3447766fe0ce36a50c57d7fc809db2a1dd7b0bfe5f5c61c7677f0f785b17932c/blob @@ -0,0 +1 @@ + 8.9084734e-01 9.3573853e-01 9.3507398e-01 9.6040691e-01 9.2918157e-01 9.6617342e-01 9.0430930e-01 9.5753424e-01 8.7106898e-01 9.2169905e-01 9.7401159e-01 8.9013416e-01 9.3956689e-01 9.0041896e-01 9.2588355e-01 9.3849417e-01 8.9713468e-01 9.1481804e-01 9.7500539e-01 9.0012586e-01 9.0962559e-01 8.5860091e-01 8.6981095e-01 8.9995771e-01 8.8070172e-01 9.1456657e-01 8.6711474e-01 9.2593917e-01 8.7560376e-01 8.5193121e-01 9.0898542e-01 8.7765302e-01 8.6555584e-01 8.6093485e-01 9.0447028e-01 8.7614405e-01 9.4803522e-01 8.4998062e-01 7.8398996e-01 8.9538612e-01 8.3902291e-01 9.9039470e-01 9.5480519e-01 8.9152195e-01 9.1623329e-01 7.9094921e-01 9.1777100e-01 9.8972335e-01 9.0429093e-01 8.7646362e-01 9.2136649e-01 9.7178177e-01 8.9610979e-01 9.4710327e-01 9.3612450e-01 9.0241499e-01 7.7992538e-01 8.7262126e-01 9.3325183e-01 8.5796531e-01 9.4267977e-01 6.7224167e-01 7.9568368e-01 8.6411267e-01 9.3311642e-01 9.0160114e-01 9.0698887e-01 8.5833256e-01 9.6902830e-01 9.5072298e-01 8.6808495e-01 9.7879599e-01 8.8060729e-01 8.2818573e-01 8.4366706e-01 8.4506700e-01 9.4532981e-01 9.1792306e-01 7.8917825e-01 9.8337805e-01 8.1751613e-01 9.3037855e-01 9.1618832e-01 8.6568874e-01 8.9751397e-01 8.7923710e-01 8.6814329e-01 9.0330164e-01 8.2426213e-01 9.4644643e-01 8.8431293e-01 8.8497426e-01 9.0633818e-01 9.5537161e-01 8.2167575e-01 8.7771053e-01 9.0681167e-01 8.7626143e-01 8.7463464e-01 9.8033940e-01 9.2920881e-01 9.5108549e-01 9.1287466e-01 8.0052218e-01 9.2409517e-01 8.8252650e-01 8.7873923e-01 9.2989402e-01 9.1985043e-01 9.6172646e-01 8.8223856e-01 9.4477822e-01 8.8310948e-01 9.4461306e-01 9.1875210e-01 9.1233363e-01 9.2124013e-01 9.5460897e-01 8.4640982e-01 9.0882657e-01 9.8169468e-01 9.7828355e-01 8.4150533e-01 8.6888923e-01 9.7138825e-01 8.7988144e-01 9.6720910e-01 8.9450147e-01 9.5331584e-01 8.8871809e-01 8.9736685e-01 8.6258146e-01 9.1331565e-01 9.0968870e-01 9.4833654e-01 9.0536967e-01 9.5099871e-01 8.0251958e-01 9.2526150e-01 9.8971957e-01 9.0340947e-01 9.4955892e-01 9.6838162e-01 8.7534901e-01 9.1178797e-01 9.2649154e-01 9.5260993e-01 9.3178143e-01 9.4943000e-01 8.7816171e-01 9.6506542e-01 8.3422958e-01 9.3443585e-01 9.3220084e-01 8.5706573e-01 8.4666325e-01 9.0474744e-01 9.1080644e-01 9.2406899e-01 8.7901768e-01 9.3265263e-01 9.5992829e-01 9.5696271e-01 9.1932272e-01 8.0937044e-01 9.0904917e-01 8.9516756e-01 9.4797906e-01 8.4159421e-01 9.6773901e-01 9.7099825e-01 9.6941820e-01 9.8174088e-01 9.7569951e-01 9.3655362e-01 8.4130333e-01 9.5994549e-01 8.4235414e-01 9.1429418e-01 9.3418117e-01 8.4600977e-01 8.8166496e-01 8.7594776e-01 8.8571112e-01 9.6308174e-01 9.5315927e-01 8.6997519e-01 8.9383032e-01 9.4686804e-01 9.4399596e-01 diff --git a/shared/package-files/34/3448dde515d0536695d56b013282066665f2aaa282c52e1662af47a854285628/blob b/shared/package-files/34/3448dde515d0536695d56b013282066665f2aaa282c52e1662af47a854285628/blob new file mode 100644 index 0000000000000000000000000000000000000000..aaa7e93e328f7b25ee2271d6ebb9accf0616f78f --- /dev/null +++ b/shared/package-files/34/3448dde515d0536695d56b013282066665f2aaa282c52e1662af47a854285628/blob @@ -0,0 +1,252 @@ +import sys + +import dns._features + +if sys.platform == "win32": + from typing import Any + + import dns.name + + _prefer_wmi = True + + import winreg # pylint: disable=import-error + + # Keep pylint quiet on non-windows. + try: + WindowsError is None # pylint: disable=used-before-assignment + except KeyError: + WindowsError = Exception + + if dns._features.have("wmi"): + import threading + + import pythoncom # pylint: disable=import-error + import wmi # pylint: disable=import-error + + _have_wmi = True + else: + _have_wmi = False + + def _config_domain(domain): + # Sometimes DHCP servers add a '.' prefix to the default domain, and + # Windows just stores such values in the registry (see #687). + # Check for this and fix it. + if domain.startswith("."): + domain = domain[1:] + return dns.name.from_text(domain) + + class DnsInfo: + def __init__(self): + self.domain = None + self.nameservers = [] + self.search = [] + + if _have_wmi: + + class _WMIGetter(threading.Thread): + def __init__(self): + super().__init__() + self.info = DnsInfo() + + def run(self): + pythoncom.CoInitialize() + try: + system = wmi.WMI() + for interface in system.Win32_NetworkAdapterConfiguration(): + if interface.IPEnabled and interface.DNSServerSearchOrder: + self.info.nameservers = list(interface.DNSServerSearchOrder) + if interface.DNSDomain: + self.info.domain = _config_domain(interface.DNSDomain) + if interface.DNSDomainSuffixSearchOrder: + self.info.search = [ + _config_domain(x) + for x in interface.DNSDomainSuffixSearchOrder + ] + break + finally: + pythoncom.CoUninitialize() + + def get(self): + # We always run in a separate thread to avoid any issues with + # the COM threading model. + self.start() + self.join() + return self.info + + else: + + class _WMIGetter: # type: ignore + pass + + class _RegistryGetter: + def __init__(self): + self.info = DnsInfo() + + def _determine_split_char(self, entry): + # + # The windows registry irritatingly changes the list element + # delimiter in between ' ' and ',' (and vice-versa) in various + # versions of windows. + # + if entry.find(" ") >= 0: + split_char = " " + elif entry.find(",") >= 0: + split_char = "," + else: + # probably a singleton; treat as a space-separated list. + split_char = " " + return split_char + + def _config_nameservers(self, nameservers): + split_char = self._determine_split_char(nameservers) + ns_list = nameservers.split(split_char) + for ns in ns_list: + if ns not in self.info.nameservers: + self.info.nameservers.append(ns) + + def _config_search(self, search): + split_char = self._determine_split_char(search) + search_list = search.split(split_char) + for s in search_list: + s = _config_domain(s) + if s not in self.info.search: + self.info.search.append(s) + + def _config_fromkey(self, key, always_try_domain): + try: + servers, _ = winreg.QueryValueEx(key, "NameServer") + except WindowsError: + servers = None + if servers: + self._config_nameservers(servers) + if servers or always_try_domain: + try: + dom, _ = winreg.QueryValueEx(key, "Domain") + if dom: + self.info.domain = _config_domain(dom) + except WindowsError: + pass + else: + try: + servers, _ = winreg.QueryValueEx(key, "DhcpNameServer") + except WindowsError: + servers = None + if servers: + self._config_nameservers(servers) + try: + dom, _ = winreg.QueryValueEx(key, "DhcpDomain") + if dom: + self.info.domain = _config_domain(dom) + except WindowsError: + pass + try: + search, _ = winreg.QueryValueEx(key, "SearchList") + except WindowsError: + search = None + if search is None: + try: + search, _ = winreg.QueryValueEx(key, "DhcpSearchList") + except WindowsError: + search = None + if search: + self._config_search(search) + + def _is_nic_enabled(self, lm, guid): + # Look in the Windows Registry to determine whether the network + # interface corresponding to the given guid is enabled. + # + # (Code contributed by Paul Marks, thanks!) + # + try: + # This hard-coded location seems to be consistent, at least + # from Windows 2000 through Vista. + connection_key = winreg.OpenKey( + lm, + r"SYSTEM\CurrentControlSet\Control\Network" + r"\{4D36E972-E325-11CE-BFC1-08002BE10318}" + r"\%s\Connection" % guid, + ) + + try: + # The PnpInstanceID points to a key inside Enum + (pnp_id, ttype) = winreg.QueryValueEx( + connection_key, "PnpInstanceID" + ) + + if ttype != winreg.REG_SZ: + raise ValueError # pragma: no cover + + device_key = winreg.OpenKey( + lm, r"SYSTEM\CurrentControlSet\Enum\%s" % pnp_id + ) + + try: + # Get ConfigFlags for this device + (flags, ttype) = winreg.QueryValueEx(device_key, "ConfigFlags") + + if ttype != winreg.REG_DWORD: + raise ValueError # pragma: no cover + + # Based on experimentation, bit 0x1 indicates that the + # device is disabled. + # + # XXXRTH I suspect we really want to & with 0x03 so + # that CONFIGFLAGS_REMOVED devices are also ignored, + # but we're shifting to WMI as ConfigFlags is not + # supposed to be used. + return not flags & 0x1 + + finally: + device_key.Close() + finally: + connection_key.Close() + except Exception: # pragma: no cover + return False + + def get(self): + """Extract resolver configuration from the Windows registry.""" + + lm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + try: + tcp_params = winreg.OpenKey( + lm, r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" + ) + try: + self._config_fromkey(tcp_params, True) + finally: + tcp_params.Close() + interfaces = winreg.OpenKey( + lm, + r"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", + ) + try: + i = 0 + while True: + try: + guid = winreg.EnumKey(interfaces, i) + i += 1 + key = winreg.OpenKey(interfaces, guid) + try: + if not self._is_nic_enabled(lm, guid): + continue + self._config_fromkey(key, False) + finally: + key.Close() + except EnvironmentError: + break + finally: + interfaces.Close() + finally: + lm.Close() + return self.info + + _getter_class: Any + if _have_wmi and _prefer_wmi: + _getter_class = _WMIGetter + else: + _getter_class = _RegistryGetter + + def get_dns_info(): + """Extract resolver configuration.""" + getter = _getter_class() + return getter.get() diff --git a/shared/package-files/34/344fdc895fd3c0b6d31a8ab53855055f9c9a772898a0fde6e69a553a80f9dbae/blob b/shared/package-files/34/344fdc895fd3c0b6d31a8ab53855055f9c9a772898a0fde6e69a553a80f9dbae/blob new file mode 100644 index 0000000000000000000000000000000000000000..a3b7da3fa836c955d8d0e4e17754d7834e5c05f1 --- /dev/null +++ b/shared/package-files/34/344fdc895fd3c0b6d31a8ab53855055f9c9a772898a0fde6e69a553a80f9dbae/blob @@ -0,0 +1,721 @@ +from datetime import datetime + +import numpy as np +import pytest + +import pandas as pd +from pandas import ( + DataFrame, + NaT, + Series, + concat, +) +import pandas._testing as tm + + +def test_rank_unordered_categorical_typeerror(): + # GH#51034 should be TypeError, not NotImplementedError + cat = pd.Categorical([], ordered=False) + ser = Series(cat) + df = ser.to_frame() + + msg = "Cannot perform rank with non-ordered Categorical" + + gb = ser.groupby(cat, observed=False) + with pytest.raises(TypeError, match=msg): + gb.rank() + + gb2 = df.groupby(cat, observed=False) + with pytest.raises(TypeError, match=msg): + gb2.rank() + + +def test_rank_apply(): + lev1 = np.array(["a" * 10] * 100, dtype=object) + lev2 = np.array(["b" * 10] * 130, dtype=object) + lab1 = np.random.default_rng(2).integers(0, 100, size=500, dtype=int) + lab2 = np.random.default_rng(2).integers(0, 130, size=500, dtype=int) + + df = DataFrame( + { + "value": np.random.default_rng(2).standard_normal(500), + "key1": lev1.take(lab1), + "key2": lev2.take(lab2), + } + ) + + result = df.groupby(["key1", "key2"]).value.rank() + + expected = [piece.value.rank() for key, piece in df.groupby(["key1", "key2"])] + expected = concat(expected, axis=0) + expected = expected.reindex(result.index) + tm.assert_series_equal(result, expected) + + result = df.groupby(["key1", "key2"]).value.rank(pct=True) + + expected = [ + piece.value.rank(pct=True) for key, piece in df.groupby(["key1", "key2"]) + ] + expected = concat(expected, axis=0) + expected = expected.reindex(result.index) + tm.assert_series_equal(result, expected) + + +@pytest.mark.parametrize("grps", [["qux"], ["qux", "quux"]]) +@pytest.mark.parametrize( + "vals", + [ + np.array([2, 2, 8, 2, 6], dtype=dtype) + for dtype in ["i8", "i4", "i2", "i1", "u8", "u4", "u2", "u1", "f8", "f4", "f2"] + ] + + [ + [ + pd.Timestamp("2018-01-02"), + pd.Timestamp("2018-01-02"), + pd.Timestamp("2018-01-08"), + pd.Timestamp("2018-01-02"), + pd.Timestamp("2018-01-06"), + ], + [ + pd.Timestamp("2018-01-02", tz="US/Pacific"), + pd.Timestamp("2018-01-02", tz="US/Pacific"), + pd.Timestamp("2018-01-08", tz="US/Pacific"), + pd.Timestamp("2018-01-02", tz="US/Pacific"), + pd.Timestamp("2018-01-06", tz="US/Pacific"), + ], + [ + pd.Timestamp("2018-01-02") - pd.Timestamp(0), + pd.Timestamp("2018-01-02") - pd.Timestamp(0), + pd.Timestamp("2018-01-08") - pd.Timestamp(0), + pd.Timestamp("2018-01-02") - pd.Timestamp(0), + pd.Timestamp("2018-01-06") - pd.Timestamp(0), + ], + [ + pd.Timestamp("2018-01-02").to_period("D"), + pd.Timestamp("2018-01-02").to_period("D"), + pd.Timestamp("2018-01-08").to_period("D"), + pd.Timestamp("2018-01-02").to_period("D"), + pd.Timestamp("2018-01-06").to_period("D"), + ], + ], + ids=lambda x: type(x[0]), +) +@pytest.mark.parametrize( + "ties_method,ascending,pct,exp", + [ + ("average", True, False, [2.0, 2.0, 5.0, 2.0, 4.0]), + ("average", True, True, [0.4, 0.4, 1.0, 0.4, 0.8]), + ("average", False, False, [4.0, 4.0, 1.0, 4.0, 2.0]), + ("average", False, True, [0.8, 0.8, 0.2, 0.8, 0.4]), + ("min", True, False, [1.0, 1.0, 5.0, 1.0, 4.0]), + ("min", True, True, [0.2, 0.2, 1.0, 0.2, 0.8]), + ("min", False, False, [3.0, 3.0, 1.0, 3.0, 2.0]), + ("min", False, True, [0.6, 0.6, 0.2, 0.6, 0.4]), + ("max", True, False, [3.0, 3.0, 5.0, 3.0, 4.0]), + ("max", True, True, [0.6, 0.6, 1.0, 0.6, 0.8]), + ("max", False, False, [5.0, 5.0, 1.0, 5.0, 2.0]), + ("max", False, True, [1.0, 1.0, 0.2, 1.0, 0.4]), + ("first", True, False, [1.0, 2.0, 5.0, 3.0, 4.0]), + ("first", True, True, [0.2, 0.4, 1.0, 0.6, 0.8]), + ("first", False, False, [3.0, 4.0, 1.0, 5.0, 2.0]), + ("first", False, True, [0.6, 0.8, 0.2, 1.0, 0.4]), + ("dense", True, False, [1.0, 1.0, 3.0, 1.0, 2.0]), + ("dense", True, True, [1.0 / 3.0, 1.0 / 3.0, 3.0 / 3.0, 1.0 / 3.0, 2.0 / 3.0]), + ("dense", False, False, [3.0, 3.0, 1.0, 3.0, 2.0]), + ("dense", False, True, [3.0 / 3.0, 3.0 / 3.0, 1.0 / 3.0, 3.0 / 3.0, 2.0 / 3.0]), + ], +) +def test_rank_args(grps, vals, ties_method, ascending, pct, exp): + key = np.repeat(grps, len(vals)) + + orig_vals = vals + vals = list(vals) * len(grps) + if isinstance(orig_vals, np.ndarray): + vals = np.array(vals, dtype=orig_vals.dtype) + + df = DataFrame({"key": key, "val": vals}) + result = df.groupby("key").rank(method=ties_method, ascending=ascending, pct=pct) + + exp_df = DataFrame(exp * len(grps), columns=["val"]) + tm.assert_frame_equal(result, exp_df) + + +@pytest.mark.parametrize("grps", [["qux"], ["qux", "quux"]]) +@pytest.mark.parametrize( + "vals", [[-np.inf, -np.inf, np.nan, 1.0, np.nan, np.inf, np.inf]] +) +@pytest.mark.parametrize( + "ties_method,ascending,na_option,exp", + [ + ("average", True, "keep", [1.5, 1.5, np.nan, 3, np.nan, 4.5, 4.5]), + ("average", True, "top", [3.5, 3.5, 1.5, 5.0, 1.5, 6.5, 6.5]), + ("average", True, "bottom", [1.5, 1.5, 6.5, 3.0, 6.5, 4.5, 4.5]), + ("average", False, "keep", [4.5, 4.5, np.nan, 3, np.nan, 1.5, 1.5]), + ("average", False, "top", [6.5, 6.5, 1.5, 5.0, 1.5, 3.5, 3.5]), + ("average", False, "bottom", [4.5, 4.5, 6.5, 3.0, 6.5, 1.5, 1.5]), + ("min", True, "keep", [1.0, 1.0, np.nan, 3.0, np.nan, 4.0, 4.0]), + ("min", True, "top", [3.0, 3.0, 1.0, 5.0, 1.0, 6.0, 6.0]), + ("min", True, "bottom", [1.0, 1.0, 6.0, 3.0, 6.0, 4.0, 4.0]), + ("min", False, "keep", [4.0, 4.0, np.nan, 3.0, np.nan, 1.0, 1.0]), + ("min", False, "top", [6.0, 6.0, 1.0, 5.0, 1.0, 3.0, 3.0]), + ("min", False, "bottom", [4.0, 4.0, 6.0, 3.0, 6.0, 1.0, 1.0]), + ("max", True, "keep", [2.0, 2.0, np.nan, 3.0, np.nan, 5.0, 5.0]), + ("max", True, "top", [4.0, 4.0, 2.0, 5.0, 2.0, 7.0, 7.0]), + ("max", True, "bottom", [2.0, 2.0, 7.0, 3.0, 7.0, 5.0, 5.0]), + ("max", False, "keep", [5.0, 5.0, np.nan, 3.0, np.nan, 2.0, 2.0]), + ("max", False, "top", [7.0, 7.0, 2.0, 5.0, 2.0, 4.0, 4.0]), + ("max", False, "bottom", [5.0, 5.0, 7.0, 3.0, 7.0, 2.0, 2.0]), + ("first", True, "keep", [1.0, 2.0, np.nan, 3.0, np.nan, 4.0, 5.0]), + ("first", True, "top", [3.0, 4.0, 1.0, 5.0, 2.0, 6.0, 7.0]), + ("first", True, "bottom", [1.0, 2.0, 6.0, 3.0, 7.0, 4.0, 5.0]), + ("first", False, "keep", [4.0, 5.0, np.nan, 3.0, np.nan, 1.0, 2.0]), + ("first", False, "top", [6.0, 7.0, 1.0, 5.0, 2.0, 3.0, 4.0]), + ("first", False, "bottom", [4.0, 5.0, 6.0, 3.0, 7.0, 1.0, 2.0]), + ("dense", True, "keep", [1.0, 1.0, np.nan, 2.0, np.nan, 3.0, 3.0]), + ("dense", True, "top", [2.0, 2.0, 1.0, 3.0, 1.0, 4.0, 4.0]), + ("dense", True, "bottom", [1.0, 1.0, 4.0, 2.0, 4.0, 3.0, 3.0]), + ("dense", False, "keep", [3.0, 3.0, np.nan, 2.0, np.nan, 1.0, 1.0]), + ("dense", False, "top", [4.0, 4.0, 1.0, 3.0, 1.0, 2.0, 2.0]), + ("dense", False, "bottom", [3.0, 3.0, 4.0, 2.0, 4.0, 1.0, 1.0]), + ], +) +def test_infs_n_nans(grps, vals, ties_method, ascending, na_option, exp): + # GH 20561 + key = np.repeat(grps, len(vals)) + vals = vals * len(grps) + df = DataFrame({"key": key, "val": vals}) + result = df.groupby("key").rank( + method=ties_method, ascending=ascending, na_option=na_option + ) + exp_df = DataFrame(exp * len(grps), columns=["val"]) + tm.assert_frame_equal(result, exp_df) + + +@pytest.mark.parametrize("grps", [["qux"], ["qux", "quux"]]) +@pytest.mark.parametrize( + "vals", + [ + np.array([2, 2, np.nan, 8, 2, 6, np.nan, np.nan], dtype=dtype) + for dtype in ["f8", "f4", "f2"] + ] + + [ + [ + pd.Timestamp("2018-01-02"), + pd.Timestamp("2018-01-02"), + np.nan, + pd.Timestamp("2018-01-08"), + pd.Timestamp("2018-01-02"), + pd.Timestamp("2018-01-06"), + np.nan, + np.nan, + ], + [ + pd.Timestamp("2018-01-02", tz="US/Pacific"), + pd.Timestamp("2018-01-02", tz="US/Pacific"), + np.nan, + pd.Timestamp("2018-01-08", tz="US/Pacific"), + pd.Timestamp("2018-01-02", tz="US/Pacific"), + pd.Timestamp("2018-01-06", tz="US/Pacific"), + np.nan, + np.nan, + ], + [ + pd.Timestamp("2018-01-02") - pd.Timestamp(0), + pd.Timestamp("2018-01-02") - pd.Timestamp(0), + np.nan, + pd.Timestamp("2018-01-08") - pd.Timestamp(0), + pd.Timestamp("2018-01-02") - pd.Timestamp(0), + pd.Timestamp("2018-01-06") - pd.Timestamp(0), + np.nan, + np.nan, + ], + [ + pd.Timestamp("2018-01-02").to_period("D"), + pd.Timestamp("2018-01-02").to_period("D"), + np.nan, + pd.Timestamp("2018-01-08").to_period("D"), + pd.Timestamp("2018-01-02").to_period("D"), + pd.Timestamp("2018-01-06").to_period("D"), + np.nan, + np.nan, + ], + ], + ids=lambda x: type(x[0]), +) +@pytest.mark.parametrize( + "ties_method,ascending,na_option,pct,exp", + [ + ( + "average", + True, + "keep", + False, + [2.0, 2.0, np.nan, 5.0, 2.0, 4.0, np.nan, np.nan], + ), + ( + "average", + True, + "keep", + True, + [0.4, 0.4, np.nan, 1.0, 0.4, 0.8, np.nan, np.nan], + ), + ( + "average", + False, + "keep", + False, + [4.0, 4.0, np.nan, 1.0, 4.0, 2.0, np.nan, np.nan], + ), + ( + "average", + False, + "keep", + True, + [0.8, 0.8, np.nan, 0.2, 0.8, 0.4, np.nan, np.nan], + ), + ("min", True, "keep", False, [1.0, 1.0, np.nan, 5.0, 1.0, 4.0, np.nan, np.nan]), + ("min", True, "keep", True, [0.2, 0.2, np.nan, 1.0, 0.2, 0.8, np.nan, np.nan]), + ( + "min", + False, + "keep", + False, + [3.0, 3.0, np.nan, 1.0, 3.0, 2.0, np.nan, np.nan], + ), + ("min", False, "keep", True, [0.6, 0.6, np.nan, 0.2, 0.6, 0.4, np.nan, np.nan]), + ("max", True, "keep", False, [3.0, 3.0, np.nan, 5.0, 3.0, 4.0, np.nan, np.nan]), + ("max", True, "keep", True, [0.6, 0.6, np.nan, 1.0, 0.6, 0.8, np.nan, np.nan]), + ( + "max", + False, + "keep", + False, + [5.0, 5.0, np.nan, 1.0, 5.0, 2.0, np.nan, np.nan], + ), + ("max", False, "keep", True, [1.0, 1.0, np.nan, 0.2, 1.0, 0.4, np.nan, np.nan]), + ( + "first", + True, + "keep", + False, + [1.0, 2.0, np.nan, 5.0, 3.0, 4.0, np.nan, np.nan], + ), + ( + "first", + True, + "keep", + True, + [0.2, 0.4, np.nan, 1.0, 0.6, 0.8, np.nan, np.nan], + ), + ( + "first", + False, + "keep", + False, + [3.0, 4.0, np.nan, 1.0, 5.0, 2.0, np.nan, np.nan], + ), + ( + "first", + False, + "keep", + True, + [0.6, 0.8, np.nan, 0.2, 1.0, 0.4, np.nan, np.nan], + ), + ( + "dense", + True, + "keep", + False, + [1.0, 1.0, np.nan, 3.0, 1.0, 2.0, np.nan, np.nan], + ), + ( + "dense", + True, + "keep", + True, + [ + 1.0 / 3.0, + 1.0 / 3.0, + np.nan, + 3.0 / 3.0, + 1.0 / 3.0, + 2.0 / 3.0, + np.nan, + np.nan, + ], + ), + ( + "dense", + False, + "keep", + False, + [3.0, 3.0, np.nan, 1.0, 3.0, 2.0, np.nan, np.nan], + ), + ( + "dense", + False, + "keep", + True, + [ + 3.0 / 3.0, + 3.0 / 3.0, + np.nan, + 1.0 / 3.0, + 3.0 / 3.0, + 2.0 / 3.0, + np.nan, + np.nan, + ], + ), + ("average", True, "bottom", False, [2.0, 2.0, 7.0, 5.0, 2.0, 4.0, 7.0, 7.0]), + ( + "average", + True, + "bottom", + True, + [0.25, 0.25, 0.875, 0.625, 0.25, 0.5, 0.875, 0.875], + ), + ("average", False, "bottom", False, [4.0, 4.0, 7.0, 1.0, 4.0, 2.0, 7.0, 7.0]), + ( + "average", + False, + "bottom", + True, + [0.5, 0.5, 0.875, 0.125, 0.5, 0.25, 0.875, 0.875], + ), + ("min", True, "bottom", False, [1.0, 1.0, 6.0, 5.0, 1.0, 4.0, 6.0, 6.0]), + ( + "min", + True, + "bottom", + True, + [0.125, 0.125, 0.75, 0.625, 0.125, 0.5, 0.75, 0.75], + ), + ("min", False, "bottom", False, [3.0, 3.0, 6.0, 1.0, 3.0, 2.0, 6.0, 6.0]), + ( + "min", + False, + "bottom", + True, + [0.375, 0.375, 0.75, 0.125, 0.375, 0.25, 0.75, 0.75], + ), + ("max", True, "bottom", False, [3.0, 3.0, 8.0, 5.0, 3.0, 4.0, 8.0, 8.0]), + ("max", True, "bottom", True, [0.375, 0.375, 1.0, 0.625, 0.375, 0.5, 1.0, 1.0]), + ("max", False, "bottom", False, [5.0, 5.0, 8.0, 1.0, 5.0, 2.0, 8.0, 8.0]), + ( + "max", + False, + "bottom", + True, + [0.625, 0.625, 1.0, 0.125, 0.625, 0.25, 1.0, 1.0], + ), + ("first", True, "bottom", False, [1.0, 2.0, 6.0, 5.0, 3.0, 4.0, 7.0, 8.0]), + ( + "first", + True, + "bottom", + True, + [0.125, 0.25, 0.75, 0.625, 0.375, 0.5, 0.875, 1.0], + ), + ("first", False, "bottom", False, [3.0, 4.0, 6.0, 1.0, 5.0, 2.0, 7.0, 8.0]), + ( + "first", + False, + "bottom", + True, + [0.375, 0.5, 0.75, 0.125, 0.625, 0.25, 0.875, 1.0], + ), + ("dense", True, "bottom", False, [1.0, 1.0, 4.0, 3.0, 1.0, 2.0, 4.0, 4.0]), + ("dense", True, "bottom", True, [0.25, 0.25, 1.0, 0.75, 0.25, 0.5, 1.0, 1.0]), + ("dense", False, "bottom", False, [3.0, 3.0, 4.0, 1.0, 3.0, 2.0, 4.0, 4.0]), + ("dense", False, "bottom", True, [0.75, 0.75, 1.0, 0.25, 0.75, 0.5, 1.0, 1.0]), + ], +) +def test_rank_args_missing(grps, vals, ties_method, ascending, na_option, pct, exp): + key = np.repeat(grps, len(vals)) + + orig_vals = vals + vals = list(vals) * len(grps) + if isinstance(orig_vals, np.ndarray): + vals = np.array(vals, dtype=orig_vals.dtype) + + df = DataFrame({"key": key, "val": vals}) + result = df.groupby("key").rank( + method=ties_method, ascending=ascending, na_option=na_option, pct=pct + ) + + exp_df = DataFrame(exp * len(grps), columns=["val"]) + tm.assert_frame_equal(result, exp_df) + + +@pytest.mark.parametrize( + "pct,exp", [(False, [3.0, 3.0, 3.0, 3.0, 3.0]), (True, [0.6, 0.6, 0.6, 0.6, 0.6])] +) +def test_rank_resets_each_group(pct, exp): + df = DataFrame( + {"key": ["a", "a", "a", "a", "a", "b", "b", "b", "b", "b"], "val": [1] * 10} + ) + result = df.groupby("key").rank(pct=pct) + exp_df = DataFrame(exp * 2, columns=["val"]) + tm.assert_frame_equal(result, exp_df) + + +@pytest.mark.parametrize( + "dtype", ["int64", "int32", "uint64", "uint32", "float64", "float32"] +) +@pytest.mark.parametrize("upper", [True, False]) +def test_rank_avg_even_vals(dtype, upper): + if upper: + # use IntegerDtype/FloatingDtype + dtype = dtype[0].upper() + dtype[1:] + dtype = dtype.replace("Ui", "UI") + df = DataFrame({"key": ["a"] * 4, "val": [1] * 4}) + df["val"] = df["val"].astype(dtype) + assert df["val"].dtype == dtype + + result = df.groupby("key").rank() + exp_df = DataFrame([2.5, 2.5, 2.5, 2.5], columns=["val"]) + if upper: + exp_df = exp_df.astype("Float64") + tm.assert_frame_equal(result, exp_df) + + +@pytest.mark.parametrize("ties_method", ["average", "min", "max", "first", "dense"]) +@pytest.mark.parametrize("ascending", [True, False]) +@pytest.mark.parametrize("na_option", ["keep", "top", "bottom"]) +@pytest.mark.parametrize("pct", [True, False]) +@pytest.mark.parametrize( + "vals", [["bar", "bar", "foo", "bar", "baz"], ["bar", np.nan, "foo", np.nan, "baz"]] +) +def test_rank_object_dtype(ties_method, ascending, na_option, pct, vals): + df = DataFrame({"key": ["foo"] * 5, "val": vals}) + mask = df["val"].isna() + + gb = df.groupby("key") + res = gb.rank(method=ties_method, ascending=ascending, na_option=na_option, pct=pct) + + # construct our expected by using numeric values with the same ordering + if mask.any(): + df2 = DataFrame({"key": ["foo"] * 5, "val": [0, np.nan, 2, np.nan, 1]}) + else: + df2 = DataFrame({"key": ["foo"] * 5, "val": [0, 0, 2, 0, 1]}) + + gb2 = df2.groupby("key") + alt = gb2.rank( + method=ties_method, ascending=ascending, na_option=na_option, pct=pct + ) + + tm.assert_frame_equal(res, alt) + + +@pytest.mark.parametrize("na_option", [True, "bad", 1]) +@pytest.mark.parametrize("ties_method", ["average", "min", "max", "first", "dense"]) +@pytest.mark.parametrize("ascending", [True, False]) +@pytest.mark.parametrize("pct", [True, False]) +@pytest.mark.parametrize( + "vals", + [ + ["bar", "bar", "foo", "bar", "baz"], + ["bar", np.nan, "foo", np.nan, "baz"], + [1, np.nan, 2, np.nan, 3], + ], +) +def test_rank_naoption_raises(ties_method, ascending, na_option, pct, vals): + df = DataFrame({"key": ["foo"] * 5, "val": vals}) + msg = "na_option must be one of 'keep', 'top', or 'bottom'" + + with pytest.raises(ValueError, match=msg): + df.groupby("key").rank( + method=ties_method, ascending=ascending, na_option=na_option, pct=pct + ) + + +def test_rank_empty_group(): + # see gh-22519 + column = "A" + df = DataFrame({"A": [0, 1, 0], "B": [1.0, np.nan, 2.0]}) + + result = df.groupby(column).B.rank(pct=True) + expected = Series([0.5, np.nan, 1.0], name="B") + tm.assert_series_equal(result, expected) + + result = df.groupby(column).rank(pct=True) + expected = DataFrame({"B": [0.5, np.nan, 1.0]}) + tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize( + "input_key,input_value,output_value", + [ + ([1, 2], [1, 1], [1.0, 1.0]), + ([1, 1, 2, 2], [1, 2, 1, 2], [0.5, 1.0, 0.5, 1.0]), + ([1, 1, 2, 2], [1, 2, 1, np.nan], [0.5, 1.0, 1.0, np.nan]), + ([1, 1, 2], [1, 2, np.nan], [0.5, 1.0, np.nan]), + ], +) +def test_rank_zero_div(input_key, input_value, output_value): + # GH 23666 + df = DataFrame({"A": input_key, "B": input_value}) + + result = df.groupby("A").rank(method="dense", pct=True) + expected = DataFrame({"B": output_value}) + tm.assert_frame_equal(result, expected) + + +def test_rank_min_int(): + # GH-32859 + df = DataFrame( + { + "grp": [1, 1, 2], + "int_col": [ + np.iinfo(np.int64).min, + np.iinfo(np.int64).max, + np.iinfo(np.int64).min, + ], + "datetimelike": [NaT, datetime(2001, 1, 1), NaT], + } + ) + + result = df.groupby("grp").rank() + expected = DataFrame( + {"int_col": [1.0, 2.0, 1.0], "datetimelike": [np.nan, 1.0, np.nan]} + ) + + tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize("use_nan", [True, False]) +def test_rank_pct_equal_values_on_group_transition(use_nan): + # GH#40518 + fill_value = np.nan if use_nan else 3 + df = DataFrame( + [ + [-1, 1], + [-1, 2], + [1, fill_value], + [-1, fill_value], + ], + columns=["group", "val"], + ) + result = df.groupby(["group"])["val"].rank( + method="dense", + pct=True, + ) + if use_nan: + expected = Series([0.5, 1, np.nan, np.nan], name="val") + else: + expected = Series([1 / 3, 2 / 3, 1, 1], name="val") + + tm.assert_series_equal(result, expected) + + +def test_rank_multiindex(): + # GH27721 + df = concat( + { + "a": DataFrame({"col1": [3, 4], "col2": [1, 2]}), + "b": DataFrame({"col3": [5, 6], "col4": [7, 8]}), + }, + axis=1, + ) + + msg = "DataFrame.groupby with axis=1 is deprecated" + with tm.assert_produces_warning(FutureWarning, match=msg): + gb = df.groupby(level=0, axis=1) + msg = "DataFrameGroupBy.rank with axis=1 is deprecated" + with tm.assert_produces_warning(FutureWarning, match=msg): + result = gb.rank(axis=1) + + expected = concat( + [ + df["a"].rank(axis=1), + df["b"].rank(axis=1), + ], + axis=1, + keys=["a", "b"], + ) + tm.assert_frame_equal(result, expected) + + +def test_groupby_axis0_rank_axis1(): + # GH#41320 + df = DataFrame( + {0: [1, 3, 5, 7], 1: [2, 4, 6, 8], 2: [1.5, 3.5, 5.5, 7.5]}, + index=["a", "a", "b", "b"], + ) + msg = "The 'axis' keyword in DataFrame.groupby is deprecated" + with tm.assert_produces_warning(FutureWarning, match=msg): + gb = df.groupby(level=0, axis=0) + + msg = "DataFrameGroupBy.rank with axis=1 is deprecated" + with tm.assert_produces_warning(FutureWarning, match=msg): + res = gb.rank(axis=1) + + # This should match what we get when "manually" operating group-by-group + expected = concat([df.loc["a"].rank(axis=1), df.loc["b"].rank(axis=1)], axis=0) + tm.assert_frame_equal(res, expected) + + # check that we haven't accidentally written a case that coincidentally + # matches rank(axis=0) + msg = "The 'axis' keyword in DataFrameGroupBy.rank" + with tm.assert_produces_warning(FutureWarning, match=msg): + alt = gb.rank(axis=0) + assert not alt.equals(expected) + + +def test_groupby_axis0_cummax_axis1(): + # case where groupby axis is 0 and axis keyword in transform is 1 + + # df has mixed dtype -> multiple blocks + df = DataFrame( + {0: [1, 3, 5, 7], 1: [2, 4, 6, 8], 2: [1.5, 3.5, 5.5, 7.5]}, + index=["a", "a", "b", "b"], + ) + msg = "The 'axis' keyword in DataFrame.groupby is deprecated" + with tm.assert_produces_warning(FutureWarning, match=msg): + gb = df.groupby(level=0, axis=0) + + msg = "DataFrameGroupBy.cummax with axis=1 is deprecated" + with tm.assert_produces_warning(FutureWarning, match=msg): + cmax = gb.cummax(axis=1) + expected = df[[0, 1]].astype(np.float64) + expected[2] = expected[1] + tm.assert_frame_equal(cmax, expected) + + +def test_non_unique_index(): + # GH 16577 + df = DataFrame( + {"A": [1.0, 2.0, 3.0, np.nan], "value": 1.0}, + index=[pd.Timestamp("20170101", tz="US/Eastern")] * 4, + ) + result = df.groupby([df.index, "A"]).value.rank(ascending=True, pct=True) + expected = Series( + [1.0, 1.0, 1.0, np.nan], + index=[pd.Timestamp("20170101", tz="US/Eastern")] * 4, + name="value", + ) + tm.assert_series_equal(result, expected) + + +def test_rank_categorical(): + cat = pd.Categorical(["a", "a", "b", np.nan, "c", "b"], ordered=True) + cat2 = pd.Categorical([1, 2, 3, np.nan, 4, 5], ordered=True) + + df = DataFrame({"col1": [0, 1, 0, 1, 0, 1], "col2": cat, "col3": cat2}) + + gb = df.groupby("col1") + + res = gb.rank() + + expected = df.astype(object).groupby("col1").rank() + tm.assert_frame_equal(res, expected) + + +@pytest.mark.parametrize("na_option", ["top", "bottom"]) +def test_groupby_op_with_nullables(na_option): + # GH 54206 + df = DataFrame({"x": [None]}, dtype="Float64") + result = df.groupby("x", dropna=False)["x"].rank(method="min", na_option=na_option) + expected = Series([1.0], dtype="Float64", name=result.name) + tm.assert_series_equal(result, expected) diff --git a/shared/package-files/34/345519a886fbfb0983f8f556ff97e7837fdca242df6bc5b2ab8945cb7665cb5c/blob b/shared/package-files/34/345519a886fbfb0983f8f556ff97e7837fdca242df6bc5b2ab8945cb7665cb5c/blob new file mode 100644 index 0000000000000000000000000000000000000000..d389b789e56148c8bafcdba0d4e1d65d0ca51432 --- /dev/null +++ b/shared/package-files/34/345519a886fbfb0983f8f556ff97e7837fdca242df6bc5b2ab8945cb7665cb5c/blob @@ -0,0 +1,615 @@ +# TODO Non-Linear Regressions can be used +# TODO Further decomposition of the two_fold parameters i.e. +# the delta method for further two_fold detail +""" +Author: Austin Adams + +This class implements Oaxaca-Blinder Decomposition. It returns +an OaxacaResults Class: + +OaxacaBlinder: +Two-Fold (two_fold) +Three-Fold (three_fold) + +OaxacaResults: +Table Summary (summary) + +Oaxaca-Blinder is a statistical method that is used to explain +the differences between two mean values. The idea is to show +from two mean values what can be explained by the data and +what cannot by using OLS regression frameworks. + +"The original use by Oaxaca's was to explain the wage +differential between two different groups of workers, +but the method has since been applied to numerous other +topics." (Wikipedia) + +The model is designed to accept two endogenous response variables +and two exogenous explanatory variables. They are then fit using +the specific type of decomposition that you want. + +The method was famously used in Card and Krueger's paper +"School Quality and Black-White Relative Earnings: A Direct Assessment" (1992) + +General reference for Oaxaca-Blinder: + +B. Jann "The Blinder-Oaxaca decomposition for linear +regression models," The Stata Journal, 2008. + +Econometrics references for regression models: + +E. M. Kitagawa "Components of a Difference Between Two Rates" +Journal of the American Statistical Association, 1955. + +A. S. Blinder "Wage Discrimination: Reduced Form and Structural +Estimates," The Journal of Human Resources, 1973. +""" + +from textwrap import dedent + +import numpy as np + +from statsmodels.regression.linear_model import OLS +from statsmodels.tools.rng_qrng import check_random_state +from statsmodels.tools.tools import add_constant + + +class OaxacaBlinder: + """ + Class to perform Oaxaca-Blinder Decomposition + + Parameters + ---------- + endog : array_like + The endogenous variable or the dependent variable that you are trying + to explain. + exog : array_like + The exogenous variable(s) or the independent variable(s) that you are + using to explain the endogenous variable. + bifurcate : int or str + The column of the exogenous variable(s) on which to split. This would + generally be the group that you wish to explain the two means for. + Int of the column for a NumPy array or int/string for the name of + the column in Pandas. + hasconst : bool, optional + Indicates whether the two exogenous variables include a user-supplied + constant. If True, a constant is assumed. If False, a constant is added + at the start. If nothing is supplied, then True is assumed. + swap : bool, optional + Imitates the STATA Oaxaca command by allowing users to choose to swap + groups. Unlike STATA, this is assumed to be True instead of False. + cov_type : str, optional + See regression.linear_model.RegressionResults for a description of the + available covariance estimators. + cov_kwds : dict, optional + See linear_model.RegressionResults.get_robustcov_results for a + description of the required keywords for alternative covariance + estimators. + rng : int, array_like of int, numpy.random.Generator, numpy.random.RandomState, optional + If `rng` is None, a new ``Generator`` is created using fresh + entropy from the operating system. If `rng` is an int or array + of ints, a new ``Generator`` is created, seeded with `rng`. If + `rng` is already a ``Generator`` or ``RandomState`` instance, + that instance is used. + + Notes + ----- + Please check if your data includes a constant. This will still run, but + will return incorrect values if set incorrectly. + + You can access the models by using their code as an attribute, e.g., + _t_model for the total model, _f_model for the first model, _s_model for + the second model. + + Examples + -------- + >>> import numpy as np + >>> import statsmodels.api as sm + >>> data = sm.datasets.ccards.load() + + '3' is the column of which we want to explain or which indicates + the two groups. In this case, it is if you rent. + + >>> model = sm.OaxacaBlinder(data.endog, data.exog, 3, hasconst = False) + >>> model.two_fold().summary() + Oaxaca-Blinder Two-fold Effects + Unexplained Effect: 27.94091 + Explained Effect: 130.80954 + Gap: 158.75044 + + >>> model.three_fold().summary() + Oaxaca-Blinder Three-fold Effects + Endowments Effect: 321.74824 + Coefficient Effect: 75.45371 + Interaction Effect: -238.45151 + Gap: 158.75044 + """ + + def __init__( + self, + endog, + exog, + bifurcate, + hasconst=True, + swap=True, + cov_type="nonrobust", + cov_kwds=None, + rng=None, + ): + if str(type(exog)).find("pandas") != -1: + bifurcate = exog.columns.get_loc(bifurcate) + endog, exog = np.array(endog), np.array(exog) + + self.two_fold_type = None + self.bifurcate = bifurcate + self.cov_type = cov_type + self.cov_kwds = cov_kwds + self.neumark = np.delete(exog, bifurcate, axis=1) + self.exog = exog + self.hasconst = hasconst + bi_col = exog[:, bifurcate] + endog = np.column_stack((bi_col, endog)) + bi = np.unique(bi_col) + self.bi_col = bi_col + self.rng = check_random_state(rng) + + # split the data along the bifurcate axis, the issue is you need to + # delete it after you fit the model for the total model. + exog_f = exog[np.where(exog[:, bifurcate] == bi[0])] + exog_s = exog[np.where(exog[:, bifurcate] == bi[1])] + endog_f = endog[np.where(endog[:, 0] == bi[0])] + endog_s = endog[np.where(endog[:, 0] == bi[1])] + exog_f = np.delete(exog_f, bifurcate, axis=1) + exog_s = np.delete(exog_s, bifurcate, axis=1) + endog_f = endog_f[:, 1] + endog_s = endog_s[:, 1] + self.endog = endog[:, 1] + + self.len_f, self.len_s = len(endog_f), len(endog_s) + self.gap = endog_f.mean() - endog_s.mean() + + if swap and self.gap < 0: + endog_f, endog_s = endog_s, endog_f + exog_f, exog_s = exog_s, exog_f + self.gap = endog_f.mean() - endog_s.mean() + bi[0], bi[1] = bi[1], bi[0] + + self.bi = bi + + if hasconst is False: + exog_f = add_constant(exog_f, prepend=False) + exog_s = add_constant(exog_s, prepend=False) + self.exog = add_constant(self.exog, prepend=False) + self.neumark = add_constant(self.neumark, prepend=False) + + self.exog_f_mean = np.mean(exog_f, axis=0) + self.exog_s_mean = np.mean(exog_s, axis=0) + + self._f_model = OLS(endog_f, exog_f).fit(cov_type=cov_type, cov_kwds=cov_kwds) + self._s_model = OLS(endog_s, exog_s).fit(cov_type=cov_type, cov_kwds=cov_kwds) + + # Populated by `two_fold`/`three_fold` (and read back by + # `variance`); declared here so they exist (as None) even before + # either decomposition method has been called. + self.submitted_n = None + self.submitted_conf = None + self.submitted_weight = None + self.t_params = None + self._t_model = None + self.endow_eff = None + self.coef_eff = None + self.int_eff = None + self.unexplained = None + self.explained = None + + def variance(self, decomp_type, n=5000, conf=0.99): + """ + A helper function to calculate the variance/std + + Used to keep the decomposition functions cleaner. + + Parameters + ---------- + decomp_type : int + The type of decomposition being bootstrapped. Use 2 for the + two-fold decomposition or 3 for the three-fold decomposition. + n : int, optional + The number of bootstrap iterations to use to calculate the + standard errors. This defaults to 5000, but is overridden by + ``self.submitted_n`` when it is not None. + conf : float, optional + The confidence level used when trimming the bootstrap + distribution before computing the standard deviation. This + defaults to 0.99, but is overridden by ``self.submitted_conf`` + when it is not None. + + Returns + ------- + list of float + The bootstrapped standard errors for each effect of the + requested decomposition. + """ + if self.submitted_n is not None: + n = self.submitted_n + if self.submitted_conf is not None: + conf = self.submitted_conf + if self.submitted_weight is not None: + submitted_weight = [ + self.submitted_weight, + 1 - self.submitted_weight, + ] + bi = self.bi + bifurcate = self.bifurcate + endow_eff_list = [] + coef_eff_list = [] + int_eff_list = [] + exp_eff_list = [] + unexp_eff_list = [] + for _ in range(n): + endog = np.column_stack((self.bi_col, self.endog)) + exog = self.exog + amount = len(endog) + + if isinstance(self.rng, np.random.RandomState): + samples = self.rng.randint(0, high=amount, size=amount) + else: + samples = self.rng.integers(0, high=amount, size=amount) + endog = endog[samples] + exog = exog[samples] + neumark = np.delete(exog, bifurcate, axis=1) + + exog_f = exog[np.where(exog[:, bifurcate] == bi[0])] + exog_s = exog[np.where(exog[:, bifurcate] == bi[1])] + endog_f = endog[np.where(endog[:, 0] == bi[0])] + endog_s = endog[np.where(endog[:, 0] == bi[1])] + exog_f = np.delete(exog_f, bifurcate, axis=1) + exog_s = np.delete(exog_s, bifurcate, axis=1) + endog_f = endog_f[:, 1] + endog_s = endog_s[:, 1] + endog = endog[:, 1] + + two_fold_type = self.two_fold_type + + if self.hasconst is False: + exog_f = add_constant(exog_f, prepend=False) + exog_s = add_constant(exog_s, prepend=False) + exog = add_constant(exog, prepend=False) + neumark = add_constant(neumark, prepend=False) + + _f_model = OLS(endog_f, exog_f).fit( + cov_type=self.cov_type, cov_kwds=self.cov_kwds + ) + _s_model = OLS(endog_s, exog_s).fit( + cov_type=self.cov_type, cov_kwds=self.cov_kwds + ) + exog_f_mean = np.mean(exog_f, axis=0) + exog_s_mean = np.mean(exog_s, axis=0) + + if decomp_type == 3: + endow_eff = (exog_f_mean - exog_s_mean) @ _s_model.params + coef_eff = exog_s_mean @ (_f_model.params - _s_model.params) + int_eff = (exog_f_mean - exog_s_mean) @ ( + _f_model.params - _s_model.params + ) + + endow_eff_list.append(endow_eff) + coef_eff_list.append(coef_eff) + int_eff_list.append(int_eff) + + elif decomp_type == 2: + len_f = len(exog_f) + len_s = len(exog_s) + + if two_fold_type == "cotton": + t_params = (len_f / (len_f + len_s) * _f_model.params) + ( + len_s / (len_f + len_s) * _s_model.params + ) + + elif two_fold_type == "reimers": + t_params = 0.5 * (_f_model.params + _s_model.params) + + elif two_fold_type == "self_submitted": + t_params = ( + submitted_weight[0] * _f_model.params + + submitted_weight[1] * _s_model.params + ) + + elif two_fold_type == "nuemark": + _t_model = OLS(endog, neumark).fit( + cov_type=self.cov_type, cov_kwds=self.cov_kwds + ) + t_params = _t_model.params + + else: + _t_model = OLS(endog, exog).fit( + cov_type=self.cov_type, cov_kwds=self.cov_kwds + ) + t_params = np.delete(_t_model.params, bifurcate) + + unexplained = (exog_f_mean @ (_f_model.params - t_params)) + ( + exog_s_mean @ (t_params - _s_model.params) + ) + + explained = (exog_f_mean - exog_s_mean) @ t_params + + unexp_eff_list.append(unexplained) + exp_eff_list.append(explained) + + high, low = int(n * conf), int(n * (1 - conf)) + if decomp_type == 3: + return [ + np.std(np.sort(endow_eff_list)[low:high]), + np.std(np.sort(coef_eff_list)[low:high]), + np.std(np.sort(int_eff_list)[low:high]), + ] + elif decomp_type == 2: + return [ + np.std(np.sort(unexp_eff_list)[low:high]), + np.std(np.sort(exp_eff_list)[low:high]), + ] + + def three_fold(self, std=False, n=None, conf=None): + """ + Calculates the three-fold Oaxaca Blinder Decompositions + + Parameters + ---------- + std : bool, optional + If true, bootstrapped standard errors will be calculated. + n : int, optional + The number of iterations to use to calculate the bootstrapped + standard errors. This defaults to 5000. + conf : float, optional + This is the confidence required for the standard error + calculation. Defaults to .99, but could be anything less + than or equal to one. One is heavily discouraged, due to the + extreme outliers inflating the variance. + + Returns + ------- + OaxacaResults + A results container for the three-fold decomposition. + """ + self.submitted_n = n + self.submitted_conf = conf + self.submitted_weight = None + std_val = None + self.endow_eff = (self.exog_f_mean - self.exog_s_mean) @ self._s_model.params + self.coef_eff = self.exog_s_mean @ (self._f_model.params - self._s_model.params) + self.int_eff = (self.exog_f_mean - self.exog_s_mean) @ ( + self._f_model.params - self._s_model.params + ) + + if std is True: + std_val = self.variance(3) + + return OaxacaResults( + (self.endow_eff, self.coef_eff, self.int_eff, self.gap), + 3, + std_val=std_val, + ) + + def two_fold( + self, + std=False, + two_fold_type="pooled", + submitted_weight=None, + n=None, + conf=None, + ): + """ + Calculates the two-fold or pooled Oaxaca Blinder Decompositions + + Parameters + ---------- + std : bool, optional + If true, bootstrapped standard errors will be calculated. + two_fold_type : str, optional + This method allows for the specific calculation of the + non-discriminatory model. There are five different types + available at this time: pooled, nuemark, cotton, reimers, + self_submitted. Pooled is assumed and if a non-viable + parameter is given, pooled will be run. + + pooled - This type assumes that the pooled model's parameters + (a normal regression) is the non-discriminatory model. + This includes the indicator variable. This is generally + the best idea. If you have economic justification for + using others, then use others. + + nuemark - This is similar to the pooled type, but the regression + is not done including the indicator variable. + + cotton - This type uses the adjustment in Cotton (1988), which + accounts for the undervaluation of one group causing the + overvaluation of another. It uses the sample size weights for + a linear combination of the two model parameters. + + reimers - This type uses a linear combination of the two + models with both parameters being 50% of the + non-discriminatory model. + + self_submitted - This allows the user to submit their + own weights. Please be sure to put the weight of the larger mean + group only. This should be submitted in the + submitted_weights variable. + submitted_weight : int or float, optional + Required only for self_submitted. This is the submitted weight + for the larger mean. If the weight for the larger mean is p, + then the weight for the other mean is 1-p. Only submit the + first value. + n : int, optional + The number of iterations to use to calculate the bootstrapped + standard errors. This defaults to 5000. + conf : float, optional + This is the confidence required for the standard error + calculation. Defaults to .99, but could be anything less + than or equal to one. One is heavily discouraged, due to the + extreme outliers inflating the variance. + + Returns + ------- + OaxacaResults + A results container for the two-fold decomposition. + """ + self.submitted_n = n + self.submitted_conf = conf + std_val = None + self.two_fold_type = two_fold_type + self.submitted_weight = submitted_weight + + if two_fold_type == "cotton": + self.t_params = ( + self.len_f / (self.len_f + self.len_s) * self._f_model.params + ) + (self.len_s / (self.len_f + self.len_s) * self._s_model.params) + + elif two_fold_type == "reimers": + self.t_params = 0.5 * (self._f_model.params + self._s_model.params) + + elif two_fold_type == "self_submitted": + if submitted_weight is None: + raise ValueError("Please submit weights") + submitted_weight = [submitted_weight, 1 - submitted_weight] + self.t_params = ( + submitted_weight[0] * self._f_model.params + + submitted_weight[1] * self._s_model.params + ) + + elif two_fold_type == "nuemark": + self._t_model = OLS(self.endog, self.neumark).fit( + cov_type=self.cov_type, cov_kwds=self.cov_kwds + ) + self.t_params = self._t_model.params + + else: + self._t_model = OLS(self.endog, self.exog).fit( + cov_type=self.cov_type, cov_kwds=self.cov_kwds + ) + self.t_params = np.delete(self._t_model.params, self.bifurcate) + + self.unexplained = ( + self.exog_f_mean @ (self._f_model.params - self.t_params) + ) + (self.exog_s_mean @ (self.t_params - self._s_model.params)) + self.explained = (self.exog_f_mean - self.exog_s_mean) @ self.t_params + + if std is True: + std_val = self.variance(2) + + return OaxacaResults( + (self.unexplained, self.explained, self.gap), 2, std_val=std_val + ) + + +class OaxacaResults: + """ + This class summarizes the fit of the OaxacaBlinder model + + Parameters + ---------- + results : tuple of float + The estimated effects. For a two-fold decomposition this is + (unexplained, explained, gap); for a three-fold decomposition + this is (endowment effect, coefficient effect, interaction + effect, gap). + model_type : int + The type of decomposition that produced ``results``. 2 indicates + a two-fold decomposition and 3 indicates a three-fold + decomposition. + std_val : tuple of float or None, optional + The bootstrapped standard errors corresponding to each value in + ``results``, in the same order. None if standard errors were not + requested. + + Notes + ----- + Use .summary() to get a table of the fitted values or + use .params to receive a list of the values + use .std to receive a list of the standard errors + + If a two-fold model was fitted, this will return + unexplained effect, explained effect, and the + mean gap. The list will always be of the following order + and type. If standard error was asked for, then standard error + calculations will also be included for each variable after each + calculated effect. + + unexplained : float + This is the effect that cannot be explained by the data at hand. + This does not mean it cannot be explained with more. + explained : float + This is the effect that can be explained using the data. + gap : float + This is the gap in the mean differences of the two groups. + + If a three-fold model was fitted, this will + return characteristic effect, coefficient effect + interaction effect, and the mean gap. The list will + be of the following order and type. If standard error was asked + for, then standard error calculations will also be included for + each variable after each calculated effect. + + endowment effect : float + This is the effect due to the group differences in + predictors + coefficient effect : float + This is the effect due to differences of the coefficients + of the two groups + interaction effect : float + This is the effect due to differences in both effects + existing at the same time between the two groups. + gap : float + This is the gap in the mean differences of the two groups. + + Attributes + ---------- + params : tuple of float + A tuple of all values for the fitted models. + std : tuple of float or None + A tuple of standard error calculations, or None if standard + errors were not requested. + """ + + def __init__(self, results, model_type, std_val=None): + self.params = results + self.std = std_val + self.model_type = model_type + + def summary(self): + """Print a summary table with the Oaxaca-Blinder effects""" + if self.model_type == 2: + if self.std is None: + print(dedent(f"""\ + Oaxaca-Blinder Two-fold Effects + Unexplained Effect: {self.params[0]:.5f} + Explained Effect: {self.params[1]:.5f} + Gap: {self.params[2]:.5f}""")) + else: + print( + dedent( + f"""\ + Oaxaca-Blinder Two-fold Effects + Unexplained Effect: {self.params[0]:.5f} + Unexplained Standard Error: {self.std[0]:.5f} + Explained Effect: {self.params[1]:.5f} + Explained Standard Error: {self.std[1]:.5f} + Gap: {self.params[2]:.5f}""" + ) + ) + if self.model_type == 3: + if self.std is None: + print(dedent(f"""\ + Oaxaca-Blinder Three-fold Effects + Endowment Effect: {self.params[0]:.5f} + Coefficient Effect: {self.params[1]:.5f} + Interaction Effect: {self.params[2]:.5f} + Gap: {self.params[3]:.5f}""")) + else: + print(dedent(f"""\ + Oaxaca-Blinder Three-fold Effects + Endowment Effect: {self.params[0]:.5f} + Endowment Standard Error: {self.std[0]:.5f} + Coefficient Effect: {self.params[1]:.5f} + Coefficient Standard Error: {self.std[1]:.5f} + Interaction Effect: {self.params[2]:.5f} + Interaction Standard Error: {self.std[2]:.5f} + Gap: {self.params[3]:.5f}""")) diff --git a/shared/package-files/34/3456121ed38b264f326e47d322bb2d62279bd2696e51417e433a1aa2a5932834/blob b/shared/package-files/34/3456121ed38b264f326e47d322bb2d62279bd2696e51417e433a1aa2a5932834/blob new file mode 100644 index 0000000000000000000000000000000000000000..1c9101d8bde37bf2343ba89182c857dfc0093f69 --- /dev/null +++ b/shared/package-files/34/3456121ed38b264f326e47d322bb2d62279bd2696e51417e433a1aa2a5932834/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor linalg_svdvals(const at::Tensor & A, c10::optional driver=c10::nullopt); +TORCH_API at::Tensor & linalg_svdvals_out(at::Tensor & out, const at::Tensor & A, c10::optional driver=c10::nullopt); +TORCH_API at::Tensor & linalg_svdvals_outf(const at::Tensor & A, c10::optional driver, at::Tensor & out); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/34/345c0d55f8316f660c2f373ee36440f922ad35c383a6e9047d87ff4165984ec2/blob b/shared/package-files/34/345c0d55f8316f660c2f373ee36440f922ad35c383a6e9047d87ff4165984ec2/blob new file mode 100644 index 0000000000000000000000000000000000000000..1092f4b61a1b203f7feabb586b51085bb72602dc Binary files /dev/null and b/shared/package-files/34/345c0d55f8316f660c2f373ee36440f922ad35c383a6e9047d87ff4165984ec2/blob differ diff --git a/shared/package-files/34/345cbd03b4144d3ab83c2973e78139aae417324ae4116f2541f7c8348b138642/blob b/shared/package-files/34/345cbd03b4144d3ab83c2973e78139aae417324ae4116f2541f7c8348b138642/blob new file mode 100644 index 0000000000000000000000000000000000000000..20f36019a62b8cdfb330ebea4b7d2aae63c6c9ff --- /dev/null +++ b/shared/package-files/34/345cbd03b4144d3ab83c2973e78139aae417324ae4116f2541f7c8348b138642/blob @@ -0,0 +1,11 @@ +prefix=/opt/conda +exec_prefix=${prefix} +includedir=${prefix}/include +libdir=${exec_prefix}/lib + +Name: libidn2 +Description: Library implementing IDNA2008 and TR46 +Version: 2.3.4 +Cflags: -I${includedir} +Libs: -L${libdir} -lidn2 +Libs.private: -L/opt/conda/lib -lunistring -R/opt/conda/lib diff --git a/shared/package-files/34/345ce48bc63e2565cfd140344c88ddf09743a64f6cc0b09046af2a34e6e54707/blob b/shared/package-files/34/345ce48bc63e2565cfd140344c88ddf09743a64f6cc0b09046af2a34e6e54707/blob new file mode 100644 index 0000000000000000000000000000000000000000..7c142c04b79c0572f97fb76832bcf6b6ec806631 --- /dev/null +++ b/shared/package-files/34/345ce48bc63e2565cfd140344c88ddf09743a64f6cc0b09046af2a34e6e54707/blob @@ -0,0 +1,468 @@ +#pragma once + +// DO NOT DEFINE STATIC DATA IN THIS HEADER! +// See Note [Do not compile initializers with AVX] + +#include +#include +#include +#include +#if defined(CPU_CAPABILITY_AVX2) && !defined(_MSC_VER) +#include +#endif + +namespace at::vec { +// See Note [CPU_CAPABILITY namespace] +inline namespace CPU_CAPABILITY { + +#if defined(CPU_CAPABILITY_AVX2) && !defined(_MSC_VER) + +template <> class Vectorized> { +private: + __m256 values; +public: + using value_type = c10::complex; + using size_type = int; + static constexpr size_type size() { + return 4; + } + Vectorized() {} + Vectorized(__m256 v) : values(v) {} + Vectorized(c10::complex val) { + float real_value = val.real(); + float imag_value = val.imag(); + values = _mm256_setr_ps(real_value, imag_value, + real_value, imag_value, + real_value, imag_value, + real_value, imag_value + ); + } + Vectorized(c10::complex val1, c10::complex val2, c10::complex val3, c10::complex val4) { + values = _mm256_setr_ps(val1.real(), val1.imag(), + val2.real(), val2.imag(), + val3.real(), val3.imag(), + val4.real(), val4.imag() + ); + } + operator __m256() const { + return values; + } + template + static Vectorized> blend(const Vectorized>& a, const Vectorized>& b) { + // convert c10::complex index mask to V index mask: xy -> xxyy + static_assert(mask > -1 && mask < 16, "Unexpected mask range"); + switch (mask) { + case 0: + return a; + case 1: + return _mm256_blend_ps(a.values, b.values, 0x03); //b0000 0001 = b0000 0011 + case 2: + return _mm256_blend_ps(a.values, b.values, 0x0C); //b0000 0010 = b0000 1100 + case 3: + return _mm256_blend_ps(a.values, b.values, 0x0F); //b0000 0011 = b0000 1111 + case 4: + return _mm256_blend_ps(a.values, b.values, 0x30); //b0000 0100 = b0011 0000 + case 5: + return _mm256_blend_ps(a.values, b.values, 0x33); //b0000 0101 = b0011 0011 + case 6: + return _mm256_blend_ps(a.values, b.values, 0x3C); //b0000 0110 = b0011 1100 + case 7: + return _mm256_blend_ps(a.values, b.values, 0x3F); //b0000 0111 = b0011 1111 + case 8: + return _mm256_blend_ps(a.values, b.values, 0xC0); //b0000 1000 = b1100 0000 + case 9: + return _mm256_blend_ps(a.values, b.values, 0xC3); //b0000 1001 = b1100 0011 + case 10: + return _mm256_blend_ps(a.values, b.values, 0xCC); //b0000 1010 = b1100 1100 + case 11: + return _mm256_blend_ps(a.values, b.values, 0xCF); //b0000 1011 = b1100 1111 + case 12: + return _mm256_blend_ps(a.values, b.values, 0xF0); //b0000 1100 = b1111 0000 + case 13: + return _mm256_blend_ps(a.values, b.values, 0xF3); //b0000 1101 = b1111 0011 + case 14: + return _mm256_blend_ps(a.values, b.values, 0xFC); //b0000 1110 = b1111 1100 + default: break; + } + return b; + } + static Vectorized> blendv(const Vectorized>& a, const Vectorized>& b, + const Vectorized>& mask) { + // convert c10::complex index mask to V index mask: xy -> xxyy + auto mask_ = _mm256_unpacklo_ps(mask.values, mask.values); + return _mm256_blendv_ps(a.values, b.values, mask_); + + } + template + static Vectorized> arange(c10::complex base = 0., step_t step = static_cast(1)) { + return Vectorized>(base, + base + step, + base + c10::complex(2)*step, + base + c10::complex(3)*step); + } + static Vectorized> set(const Vectorized>& a, const Vectorized>& b, + int64_t count = size()) { + switch (count) { + case 0: + return a; + case 1: + return blend<1>(a, b); + case 2: + return blend<3>(a, b); + case 3: + return blend<7>(a, b); + } + return b; + } + static Vectorized> loadu(const void* ptr, int64_t count = size()) { + if (count == size()) + return _mm256_loadu_ps(reinterpret_cast(ptr)); + + __at_align__ float tmp_values[2*size()]; + // Ensure uninitialized memory does not change the output value See https://github.com/pytorch/pytorch/issues/32502 + // for more details. We do not initialize arrays to zero using "={0}" because gcc would compile it to two + // instructions while a loop would be compiled to one instruction. + for (const auto i : c10::irange(2*size())) { + tmp_values[i] = 0.0; + } + std::memcpy( + tmp_values, + reinterpret_cast(ptr), + count * sizeof(c10::complex)); + return _mm256_load_ps(tmp_values); + } + void store(void* ptr, int count = size()) const { + if (count == size()) { + _mm256_storeu_ps(reinterpret_cast(ptr), values); + } else if (count > 0) { + float tmp_values[2*size()]; + _mm256_storeu_ps(reinterpret_cast(tmp_values), values); + std::memcpy(ptr, tmp_values, count * sizeof(c10::complex)); + } + } + const c10::complex& operator[](int idx) const = delete; + c10::complex& operator[](int idx) = delete; + Vectorized> map(c10::complex (*const f)(const c10::complex &)) const { + __at_align__ c10::complex tmp[size()]; + store(tmp); + for (const auto i : c10::irange(size())) { + tmp[i] = f(tmp[i]); + } + return loadu(tmp); + } + __m256 abs_2_() const { + auto val_2 = _mm256_mul_ps(values, values); // a*a b*b + auto ret = _mm256_hadd_ps(val_2, val_2); // a*a+b*b a*a+b*b + return _mm256_permute_ps(ret, 0xD8); + } + __m256 abs_() const { + auto real = _mm256_moveldup_ps(values); // real real + auto imag = _mm256_movehdup_ps(values); // imag imag + return Sleef_hypotf8_u05(real, imag); // abs abs + } + Vectorized> abs() const { + const __m256 real_mask = _mm256_castsi256_ps(_mm256_setr_epi32(0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000, + 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000)); + return _mm256_and_ps(abs_(), real_mask); // abs 0 + } + __m256 angle_() const { + //angle = atan2(b/a) + auto b_a = _mm256_permute_ps(values, 0xB1); // b a + return Sleef_atan2f8_u10(values, b_a); // 90-angle angle + } + Vectorized> angle() const { + const __m256 real_mask = _mm256_castsi256_ps(_mm256_setr_epi32(0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000, + 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000)); + auto angle = _mm256_permute_ps(angle_(), 0xB1); // angle 90-angle + return _mm256_and_ps(angle, real_mask); // angle 0 + } + Vectorized> sgn() const { + auto abs = abs_(); + auto zero = _mm256_setzero_ps(); + auto mask = _mm256_cmp_ps(abs, zero, _CMP_EQ_OQ); + auto div = values / abs; + return _mm256_blendv_ps(div, zero, mask); + } + __m256 real_() const { + const __m256 real_mask = _mm256_castsi256_ps(_mm256_setr_epi32(0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000, + 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000000)); + return _mm256_and_ps(values, real_mask); + } + Vectorized> real() const { + return real_(); + } + __m256 imag_() const { + const __m256 imag_mask = _mm256_castsi256_ps(_mm256_setr_epi32(0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, + 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF)); + return _mm256_and_ps(values, imag_mask); + } + Vectorized> imag() const { + return _mm256_permute_ps(imag_(), 0xB1); //b a + } + __m256 conj_() const { + const __m256 sign_mask = _mm256_setr_ps(0.0, -0.0, 0.0, -0.0, 0.0, -0.0, 0.0, -0.0); + return _mm256_xor_ps(values, sign_mask); // a -b + } + Vectorized> conj() const { + return conj_(); + } + Vectorized> log() const { + // Most trigonomic ops use the log() op to improve complex number performance. + return map(std::log); + } + Vectorized> log2() const { + const __m256 log2_ = _mm256_set1_ps(std::log(2)); + return _mm256_div_ps(log(), log2_); + } + Vectorized> log10() const { + const __m256 log10_ = _mm256_set1_ps(std::log(10)); + return _mm256_div_ps(log(), log10_); + } + Vectorized> log1p() const { + return map(std::log1p); + } + Vectorized> asin() const { + // asin(x) + // = -i*ln(iz + sqrt(1 -z^2)) + // = -i*ln((ai - b) + sqrt(1 - (a + bi)*(a + bi))) + // = -i*ln((-b + ai) + sqrt(1 - (a**2 - b**2) - 2*abi)) + const __m256 one = _mm256_set1_ps(1); + + auto conj = conj_(); + auto b_a = _mm256_permute_ps(conj, 0xB1); //-b a + auto ab = _mm256_mul_ps(conj, b_a); //-ab -ab + auto im = _mm256_add_ps(ab, ab); //-2ab -2ab + + auto val_2 = _mm256_mul_ps(values, values); // a*a b*b + auto re = _mm256_hsub_ps(val_2, _mm256_permute_ps(val_2, 0xB1)); // a*a-b*b b*b-a*a + re = _mm256_permute_ps(re, 0xD8); + re = _mm256_sub_ps(one, re); + + auto root = Vectorized(_mm256_blend_ps(re, im, 0xAA)).sqrt(); //sqrt(re + i*im) + auto ln = Vectorized(_mm256_add_ps(b_a, root)).log(); //ln(iz + sqrt()) + return Vectorized(_mm256_permute_ps(ln.values, 0xB1)).conj(); //-i*ln() + } + Vectorized> acos() const { + return map(std::acos); + } + Vectorized> atan() const; + Vectorized> atanh() const { + return map(std::atanh); + } + Vectorized> exp() const { + //exp(a + bi) + // = exp(a)*(cos(b) + sin(b)i) + auto exp = Sleef_expf8_u10(values); //exp(a) exp(b) + exp = _mm256_blend_ps(exp, _mm256_permute_ps(exp, 0xB1), 0xAA); //exp(a) exp(a) + + auto sin_cos = Sleef_sincosf8_u10(values); //[sin(a), cos(a)] [sin(b), cos(b)] + auto cos_sin = _mm256_blend_ps(_mm256_permute_ps(sin_cos.y, 0xB1), + sin_cos.x, 0xAA); //cos(b) sin(b) + return _mm256_mul_ps(exp, cos_sin); + } + Vectorized> exp2() const { + // Use identity 2**x = exp(log(2) * x) + const __m256 ln_2 = _mm256_set1_ps(c10::ln_2); + Vectorized> scaled_values = _mm256_mul_ps(values, ln_2); + return scaled_values.exp(); + } + Vectorized> expm1() const { + return map(std::expm1); + } + Vectorized> sin() const { + return map(std::sin); + } + Vectorized> sinh() const { + return map(std::sinh); + } + Vectorized> cos() const { + return map(std::cos); + } + Vectorized> cosh() const { + return map(std::cosh); + } + Vectorized> ceil() const { + return _mm256_ceil_ps(values); + } + Vectorized> floor() const { + return _mm256_floor_ps(values); + } + Vectorized> neg() const { + auto zero = _mm256_setzero_ps(); + return _mm256_sub_ps(zero, values); + } + Vectorized> round() const { + return _mm256_round_ps(values, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)); + } + Vectorized> tan() const { + return map(std::tan); + } + Vectorized> tanh() const { + return map(std::tanh); + } + Vectorized> trunc() const { + return _mm256_round_ps(values, (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC)); + } + Vectorized> sqrt() const { + return map(std::sqrt); + } + Vectorized> reciprocal() const; + Vectorized> rsqrt() const { + return sqrt().reciprocal(); + } + Vectorized> pow(const Vectorized> &exp) const { + __at_align__ c10::complex x_tmp[size()]; + __at_align__ c10::complex y_tmp[size()]; + store(x_tmp); + exp.store(y_tmp); + for (const auto i : c10::irange(size())) { + x_tmp[i] = std::pow(x_tmp[i], y_tmp[i]); + } + return loadu(x_tmp); + } + // Comparison using the _CMP_**_OQ predicate. + // `O`: get false if an operand is NaN + // `Q`: do not raise if an operand is NaN + Vectorized> operator==(const Vectorized>& other) const { + return _mm256_cmp_ps(values, other.values, _CMP_EQ_OQ); + } + Vectorized> operator!=(const Vectorized>& other) const { + return _mm256_cmp_ps(values, other.values, _CMP_NEQ_UQ); + } + Vectorized> operator<(const Vectorized>& /*other*/) const { + TORCH_CHECK(false, "not supported for complex numbers"); + } + Vectorized> operator<=(const Vectorized>& /*other*/) const { + TORCH_CHECK(false, "not supported for complex numbers"); + } + Vectorized> operator>(const Vectorized>& /*other*/) const { + TORCH_CHECK(false, "not supported for complex numbers"); + } + Vectorized> operator>=(const Vectorized>& /*other*/) const { + TORCH_CHECK(false, "not supported for complex numbers"); + } + + Vectorized> eq(const Vectorized>& other) const; + Vectorized> ne(const Vectorized>& other) const; +}; + +template <> Vectorized> inline operator+(const Vectorized> &a, const Vectorized> &b) { + return _mm256_add_ps(a, b); +} + +template <> Vectorized> inline operator-(const Vectorized> &a, const Vectorized> &b) { + return _mm256_sub_ps(a, b); +} + +template <> Vectorized> inline operator*(const Vectorized> &a, const Vectorized> &b) { + //(a + bi) * (c + di) = (ac - bd) + (ad + bc)i + const __m256 sign_mask = _mm256_setr_ps(0.0, -0.0, 0.0, -0.0, 0.0, -0.0, 0.0, -0.0); + auto ac_bd = _mm256_mul_ps(a, b); //ac bd + + auto d_c = _mm256_permute_ps(b, 0xB1); //d c + d_c = _mm256_xor_ps(sign_mask, d_c); //d -c + auto ad_bc = _mm256_mul_ps(a, d_c); //ad -bc + + auto ret = _mm256_hsub_ps(ac_bd, ad_bc); //ac - bd ad + bc + ret = _mm256_permute_ps(ret, 0xD8); + return ret; +} + +template <> Vectorized> inline operator/(const Vectorized> &a, const Vectorized> &b) { + //re + im*i = (a + bi) / (c + di) + auto mask = _mm256_set1_ps(-0.f); + auto fabs_cd = _mm256_andnot_ps(mask, b); // |c| |d| + auto fabs_dc = _mm256_permute_ps(fabs_cd, 0xB1); // |d| |c| + auto scale = _mm256_rcp_ps(_mm256_max_ps(fabs_cd, fabs_dc)); // 1/sc 1/sc + auto a2 = _mm256_mul_ps(a, scale); // a/sc b/sc + auto b2 = _mm256_mul_ps(b, scale); // c/sc d/sc + auto acbd2 = _mm256_mul_ps(a2, b2); + + const __m256 sign_mask = _mm256_setr_ps(-0.0, 0.0, -0.0, 0.0, -0.0, 0.0, -0.0, 0.0); + auto dc2 = _mm256_permute_ps(b2, 0xB1); // d/sc c/sc + dc2 = _mm256_xor_ps(sign_mask, dc2); // -d/|c,d| c/sc + auto adbc2 = _mm256_mul_ps(a2, dc2); //-ad/sc^2 bc/sc^2 + auto res2 = _mm256_hadd_ps(acbd2, adbc2); //(ac+bd)/sc^2 (bc-ad)/sc^2 + res2 = _mm256_permute_ps(res2, 0xD8); + + // get the denominator + auto denom2 = Vectorized>(b2).abs_2_(); // (c^2+d^2)/sc^2 (c^2+d^2)/sc^2 + res2 = _mm256_div_ps(res2, denom2); + return res2; +} + +// reciprocal. Implement this here so we can use multiplication. +inline Vectorized> Vectorized>::reciprocal() const { + //re + im*i = (a + bi) / (c + di) + //re = (ac + bd)/abs_2() = c/abs_2() + //im = (bc - ad)/abs_2() = d/abs_2() + const __m256 sign_mask = _mm256_setr_ps(0.0, -0.0, 0.0, -0.0, 0.0, -0.0, 0.0, -0.0); + auto c_d = _mm256_xor_ps(sign_mask, values); //c -d + return _mm256_div_ps(c_d, abs_2_()); +} + +inline Vectorized> Vectorized>::atan() const { + // atan(x) = i/2 * ln((i + z)/(i - z)) + const __m256 i = _mm256_setr_ps(0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0); + const Vectorized i_half = _mm256_setr_ps(0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5); + + auto sum = Vectorized(_mm256_add_ps(i, values)); // a 1+b + auto sub = Vectorized(_mm256_sub_ps(i, values)); // -a 1-b + auto ln = (sum/sub).log(); // ln((i + z)/(i - z)) + return i_half*ln; // i/2*ln() +} + +template <> +Vectorized> inline maximum(const Vectorized>& a, const Vectorized>& b) { + auto abs_a = a.abs_2_(); + auto abs_b = b.abs_2_(); + auto mask = _mm256_cmp_ps(abs_a, abs_b, _CMP_LT_OQ); + auto max = _mm256_blendv_ps(a, b, mask); + // Exploit the fact that all-ones is a NaN. + auto isnan = _mm256_cmp_ps(abs_a, abs_b, _CMP_UNORD_Q); + return _mm256_or_ps(max, isnan); +} + +template <> +Vectorized> inline minimum(const Vectorized>& a, const Vectorized>& b) { + auto abs_a = a.abs_2_(); + auto abs_b = b.abs_2_(); + auto mask = _mm256_cmp_ps(abs_a, abs_b, _CMP_GT_OQ); + auto min = _mm256_blendv_ps(a, b, mask); + // Exploit the fact that all-ones is a NaN. + auto isnan = _mm256_cmp_ps(abs_a, abs_b, _CMP_UNORD_Q); + return _mm256_or_ps(min, isnan); +} + +template <> +Vectorized> inline operator&(const Vectorized>& a, const Vectorized>& b) { + return _mm256_and_ps(a, b); +} + +template <> +Vectorized> inline operator|(const Vectorized>& a, const Vectorized>& b) { + return _mm256_or_ps(a, b); +} + +template <> +Vectorized> inline operator^(const Vectorized>& a, const Vectorized>& b) { + return _mm256_xor_ps(a, b); +} + +inline Vectorized> Vectorized>::eq( + const Vectorized>& other) const { + auto eq = (*this == other); // compares real and imag individually + // If both real numbers and imag numbers are equal, then the complex numbers are equal + return (eq.real() & eq.imag()) & Vectorized>(_mm256_set1_ps(1.0f)); +} + +inline Vectorized> Vectorized>::ne( + const Vectorized>& other) const { + auto ne = (*this != other); // compares real and imag individually + // If either real numbers or imag numbers are not equal, then the complex numbers are not equal + return (ne.real() | ne.imag()) & Vectorized>(_mm256_set1_ps(1.0f)); +} + +#endif + +}} // namespace at::vec::CPU_CAPABILITY diff --git a/shared/package-files/34/345f0974bbd6ad26adb25940d1f4646bc2b58becccfb8e281b1ccc4fd5fcc733/blob b/shared/package-files/34/345f0974bbd6ad26adb25940d1f4646bc2b58becccfb8e281b1ccc4fd5fcc733/blob new file mode 100644 index 0000000000000000000000000000000000000000..0c0fba5ce2335a0cb6e3b8ffc5667f6f395f7449 Binary files /dev/null and b/shared/package-files/34/345f0974bbd6ad26adb25940d1f4646bc2b58becccfb8e281b1ccc4fd5fcc733/blob differ diff --git a/shared/package-files/34/345fc6535b90e8836a1ea0b0cd8e97410a91c4a0e1eb39c47831e246a684210d/blob b/shared/package-files/34/345fc6535b90e8836a1ea0b0cd8e97410a91c4a0e1eb39c47831e246a684210d/blob new file mode 100644 index 0000000000000000000000000000000000000000..1f537798130b9a77bc50e1040ea8046557974894 --- /dev/null +++ b/shared/package-files/34/345fc6535b90e8836a1ea0b0cd8e97410a91c4a0e1eb39c47831e246a684210d/blob @@ -0,0 +1,107 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from __future__ import annotations +import enum + +import pyarrow as pa + + +class DlpackDeviceType(enum.IntEnum): + """Integer enum for device type codes matching DLPack.""" + + CPU = 1 + CUDA = 2 + CPU_PINNED = 3 + OPENCL = 4 + VULKAN = 7 + METAL = 8 + VPI = 9 + ROCM = 10 + + +class _PyArrowBuffer: + """ + Data in the buffer is guaranteed to be contiguous in memory. + + Note that there is no dtype attribute present, a buffer can be thought of + as simply a block of memory. However, if the column that the buffer is + attached to has a dtype that's supported by DLPack and ``__dlpack__`` is + implemented, then that dtype information will be contained in the return + value from ``__dlpack__``. + + This distinction is useful to support both data exchange via DLPack on a + buffer and (b) dtypes like variable-length strings which do not have a + fixed number of bytes per element. + """ + + def __init__(self, x: pa.Buffer, allow_copy: bool = True) -> None: + """ + Handle PyArrow Buffers. + """ + self._x = x + + @property + def bufsize(self) -> int: + """ + Buffer size in bytes. + """ + return self._x.size + + @property + def ptr(self) -> int: + """ + Pointer to start of the buffer as an integer. + """ + return self._x.address + + def __dlpack__(self): + """ + Produce DLPack capsule (see array API standard). + + Raises: + - TypeError : if the buffer contains unsupported dtypes. + - NotImplementedError : if DLPack support is not implemented + + Useful to have to connect to array libraries. Support optional because + it's not completely trivial to implement for a Python-only library. + """ + raise NotImplementedError("__dlpack__") + + def __dlpack_device__(self) -> tuple[DlpackDeviceType, int | None]: + """ + Device type and device ID for where the data in the buffer resides. + Uses device type codes matching DLPack. + Note: must be implemented even if ``__dlpack__`` is not. + """ + if self._x.is_cpu: + return (DlpackDeviceType.CPU, None) + else: + raise NotImplementedError("__dlpack_device__") + + def __repr__(self) -> str: + return ( + "PyArrowBuffer(" + + str( + { + "bufsize": self.bufsize, + "ptr": self.ptr, + "device": self.__dlpack_device__()[0].name, + } + ) + + ")" + ) diff --git a/shared/package-files/34/346002a8bef844ec093d2946c9be5b091bb0b300e72ecc4095bae28e8456a8f0/blob b/shared/package-files/34/346002a8bef844ec093d2946c9be5b091bb0b300e72ecc4095bae28e8456a8f0/blob new file mode 100644 index 0000000000000000000000000000000000000000..5d383be659b09b1487973204a59c8de7dcc35f9f --- /dev/null +++ b/shared/package-files/34/346002a8bef844ec093d2946c9be5b091bb0b300e72ecc4095bae28e8456a8f0/blob @@ -0,0 +1,14 @@ +prefix=/opt/conda +exec_prefix=${prefix} +libdir=/opt/conda/lib +includedir=/opt/conda/include + +Name: libavfilter +Description: FFmpeg audio/video filtering library +Version: 7.85.100 +Requires: +Requires.private: libswscale >= 5.7.100, libavformat >= 58.45.100, libavcodec >= 58.91.100, libswresample >= 3.7.100, libavresample >= 4.0.0, libavutil >= 56.51.100 +Conflicts: +Libs: -L${libdir} -lavfilter +Libs.private: -pthread -lm -L/opt/conda/lib -lfreetype +Cflags: -I${includedir} diff --git a/shared/package-files/34/346070f44c73e7e21646d7b492d38471cee77d40a7e6612d269c09d0b64c17df/blob b/shared/package-files/34/346070f44c73e7e21646d7b492d38471cee77d40a7e6612d269c09d0b64c17df/blob new file mode 100644 index 0000000000000000000000000000000000000000..132698a924736145efd48e345bf5a20c5eb437f0 --- /dev/null +++ b/shared/package-files/34/346070f44c73e7e21646d7b492d38471cee77d40a7e6612d269c09d0b64c17df/blob @@ -0,0 +1,129 @@ +import pytest + +import networkx as nx + + +class TestMCS: + @classmethod + def setup_class(cls): + # simple graph + connected_chordal_G = nx.Graph() + connected_chordal_G.add_edges_from( + [ + (1, 2), + (1, 3), + (2, 3), + (2, 4), + (3, 4), + (3, 5), + (3, 6), + (4, 5), + (4, 6), + (5, 6), + ] + ) + cls.connected_chordal_G = connected_chordal_G + + chordal_G = nx.Graph() + chordal_G.add_edges_from( + [ + (1, 2), + (1, 3), + (2, 3), + (2, 4), + (3, 4), + (3, 5), + (3, 6), + (4, 5), + (4, 6), + (5, 6), + (7, 8), + ] + ) + chordal_G.add_node(9) + cls.chordal_G = chordal_G + + non_chordal_G = nx.Graph() + non_chordal_G.add_edges_from([(1, 2), (1, 3), (2, 4), (2, 5), (3, 4), (3, 5)]) + cls.non_chordal_G = non_chordal_G + + self_loop_G = nx.Graph() + self_loop_G.add_edges_from([(1, 1)]) + cls.self_loop_G = self_loop_G + + @pytest.mark.parametrize("G", (nx.DiGraph(), nx.MultiGraph(), nx.MultiDiGraph())) + def test_is_chordal_not_implemented(self, G): + with pytest.raises(nx.NetworkXNotImplemented): + nx.is_chordal(G) + + def test_is_chordal(self): + assert not nx.is_chordal(self.non_chordal_G) + assert nx.is_chordal(self.chordal_G) + assert nx.is_chordal(self.connected_chordal_G) + assert nx.is_chordal(nx.complete_graph(3)) + assert nx.is_chordal(nx.cycle_graph(3)) + assert not nx.is_chordal(nx.cycle_graph(5)) + with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"): + nx.is_chordal(self.self_loop_G) + + def test_induced_nodes(self): + G = nx.generators.classic.path_graph(10) + Induced_nodes = nx.find_induced_nodes(G, 1, 9, 2) + assert Induced_nodes == {1, 2, 3, 4, 5, 6, 7, 8, 9} + pytest.raises( + nx.NetworkXTreewidthBoundExceeded, nx.find_induced_nodes, G, 1, 9, 1 + ) + Induced_nodes = nx.find_induced_nodes(self.chordal_G, 1, 6) + assert Induced_nodes == {1, 2, 4, 6} + pytest.raises(nx.NetworkXError, nx.find_induced_nodes, self.non_chordal_G, 1, 5) + + def test_graph_treewidth(self): + with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"): + nx.chordal_graph_treewidth(self.non_chordal_G) + + def test_chordal_find_cliques(self): + cliques = { + frozenset([9]), + frozenset([7, 8]), + frozenset([1, 2, 3]), + frozenset([2, 3, 4]), + frozenset([3, 4, 5, 6]), + } + assert set(nx.chordal_graph_cliques(self.chordal_G)) == cliques + with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"): + set(nx.chordal_graph_cliques(self.non_chordal_G)) + with pytest.raises(nx.NetworkXError, match="Input graph is not chordal"): + set(nx.chordal_graph_cliques(self.self_loop_G)) + + def test_chordal_find_cliques_path(self): + G = nx.path_graph(10) + cliqueset = nx.chordal_graph_cliques(G) + for u, v in G.edges(): + assert frozenset([u, v]) in cliqueset or frozenset([v, u]) in cliqueset + + def test_chordal_find_cliquesCC(self): + cliques = {frozenset([1, 2, 3]), frozenset([2, 3, 4]), frozenset([3, 4, 5, 6])} + cgc = nx.chordal_graph_cliques + assert set(cgc(self.connected_chordal_G)) == cliques + + def test_complete_to_chordal_graph(self): + fgrg = nx.fast_gnp_random_graph + test_graphs = [ + nx.barbell_graph(6, 2), + nx.cycle_graph(15), + nx.wheel_graph(20), + nx.grid_graph([10, 4]), + nx.ladder_graph(15), + nx.star_graph(5), + nx.bull_graph(), + fgrg(20, 0.3, seed=1), + ] + for G in test_graphs: + H, a = nx.complete_to_chordal_graph(G) + assert nx.is_chordal(H) + assert len(a) == H.number_of_nodes() + if nx.is_chordal(G): + assert G.number_of_edges() == H.number_of_edges() + assert set(a.values()) == {0} + else: + assert len(set(a.values())) == H.number_of_nodes() diff --git a/shared/package-files/34/3464f04938b57a7aafbc5c394ccd4c46823ee607f7fe36b48b91ecbc30ff4e48/blob b/shared/package-files/34/3464f04938b57a7aafbc5c394ccd4c46823ee607f7fe36b48b91ecbc30ff4e48/blob new file mode 100644 index 0000000000000000000000000000000000000000..388614e51b1847cbd81400d9ce48dd734e050e14 --- /dev/null +++ b/shared/package-files/34/3464f04938b57a7aafbc5c394ccd4c46823ee607f7fe36b48b91ecbc30ff4e48/blob @@ -0,0 +1,212 @@ +"""Routine to "compile" a .py file to a .pyc file. + +This module has intimate knowledge of the format of .pyc files. +""" + +import enum +import importlib._bootstrap_external +import importlib.machinery +import importlib.util +import os +import os.path +import sys +import traceback + +__all__ = ["compile", "main", "PyCompileError", "PycInvalidationMode"] + + +class PyCompileError(Exception): + """Exception raised when an error occurs while attempting to + compile the file. + + To raise this exception, use + + raise PyCompileError(exc_type,exc_value,file[,msg]) + + where + + exc_type: exception type to be used in error message + type name can be accesses as class variable + 'exc_type_name' + + exc_value: exception value to be used in error message + can be accesses as class variable 'exc_value' + + file: name of file being compiled to be used in error message + can be accesses as class variable 'file' + + msg: string message to be written as error message + If no value is given, a default exception message will be + given, consistent with 'standard' py_compile output. + message (or default) can be accesses as class variable + 'msg' + + """ + + def __init__(self, exc_type, exc_value, file, msg=''): + exc_type_name = exc_type.__name__ + if exc_type is SyntaxError: + tbtext = ''.join(traceback.format_exception_only( + exc_type, exc_value)) + errmsg = tbtext.replace('File ""', 'File "%s"' % file) + else: + errmsg = "Sorry: %s: %s" % (exc_type_name,exc_value) + + Exception.__init__(self,msg or errmsg,exc_type_name,exc_value,file) + + self.exc_type_name = exc_type_name + self.exc_value = exc_value + self.file = file + self.msg = msg or errmsg + + def __str__(self): + return self.msg + + +class PycInvalidationMode(enum.Enum): + TIMESTAMP = 1 + CHECKED_HASH = 2 + UNCHECKED_HASH = 3 + + +def _get_default_invalidation_mode(): + if os.environ.get('SOURCE_DATE_EPOCH'): + return PycInvalidationMode.CHECKED_HASH + else: + return PycInvalidationMode.TIMESTAMP + + +def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, + invalidation_mode=None, quiet=0): + """Byte-compile one Python source file to Python bytecode. + + :param file: The source file name. + :param cfile: The target byte compiled file name. When not given, this + defaults to the PEP 3147/PEP 488 location. + :param dfile: Purported file name, i.e. the file name that shows up in + error messages. Defaults to the source file name. + :param doraise: Flag indicating whether or not an exception should be + raised when a compile error is found. If an exception occurs and this + flag is set to False, a string indicating the nature of the exception + will be printed, and the function will return to the caller. If an + exception occurs and this flag is set to True, a PyCompileError + exception will be raised. + :param optimize: The optimization level for the compiler. Valid values + are -1, 0, 1 and 2. A value of -1 means to use the optimization + level of the current interpreter, as given by -O command line options. + :param invalidation_mode: + :param quiet: Return full output with False or 0, errors only with 1, + and no output with 2. + + :return: Path to the resulting byte compiled file. + + Note that it isn't necessary to byte-compile Python modules for + execution efficiency -- Python itself byte-compiles a module when + it is loaded, and if it can, writes out the bytecode to the + corresponding .pyc file. + + However, if a Python installation is shared between users, it is a + good idea to byte-compile all modules upon installation, since + other users may not be able to write in the source directories, + and thus they won't be able to write the .pyc file, and then + they would be byte-compiling every module each time it is loaded. + This can slow down program start-up considerably. + + See compileall.py for a script/module that uses this module to + byte-compile all installed files (or all files in selected + directories). + + Do note that FileExistsError is raised if cfile ends up pointing at a + non-regular file or symlink. Because the compilation uses a file renaming, + the resulting file would be regular and thus not the same type of file as + it was previously. + """ + if invalidation_mode is None: + invalidation_mode = _get_default_invalidation_mode() + if cfile is None: + if optimize >= 0: + optimization = optimize if optimize >= 1 else '' + cfile = importlib.util.cache_from_source(file, + optimization=optimization) + else: + cfile = importlib.util.cache_from_source(file) + if os.path.islink(cfile): + msg = ('{} is a symlink and will be changed into a regular file if ' + 'import writes a byte-compiled file to it') + raise FileExistsError(msg.format(cfile)) + elif os.path.exists(cfile) and not os.path.isfile(cfile): + msg = ('{} is a non-regular file and will be changed into a regular ' + 'one if import writes a byte-compiled file to it') + raise FileExistsError(msg.format(cfile)) + loader = importlib.machinery.SourceFileLoader('', file) + source_bytes = loader.get_data(file) + try: + code = loader.source_to_code(source_bytes, dfile or file, + _optimize=optimize) + except Exception as err: + py_exc = PyCompileError(err.__class__, err, dfile or file) + if quiet < 2: + if doraise: + raise py_exc + else: + sys.stderr.write(py_exc.msg + '\n') + return + try: + dirname = os.path.dirname(cfile) + if dirname: + os.makedirs(dirname) + except FileExistsError: + pass + if invalidation_mode == PycInvalidationMode.TIMESTAMP: + source_stats = loader.path_stats(file) + bytecode = importlib._bootstrap_external._code_to_timestamp_pyc( + code, source_stats['mtime'], source_stats['size']) + else: + source_hash = importlib.util.source_hash(source_bytes) + bytecode = importlib._bootstrap_external._code_to_hash_pyc( + code, + source_hash, + (invalidation_mode == PycInvalidationMode.CHECKED_HASH), + ) + mode = importlib._bootstrap_external._calc_mode(file) + importlib._bootstrap_external._write_atomic(cfile, bytecode, mode) + return cfile + + +def main(): + import argparse + + description = 'A simple command-line interface for py_compile module.' + parser = argparse.ArgumentParser(description=description) + parser.add_argument( + '-q', '--quiet', + action='store_true', + help='Suppress error output', + ) + parser.add_argument( + 'filenames', + nargs='+', + help='Files to compile', + ) + args = parser.parse_args() + if args.filenames == ['-']: + filenames = [filename.rstrip('\n') for filename in sys.stdin.readlines()] + else: + filenames = args.filenames + for filename in filenames: + try: + compile(filename, doraise=True) + except PyCompileError as error: + if args.quiet: + parser.exit(1) + else: + parser.exit(1, error.msg) + except OSError as error: + if args.quiet: + parser.exit(1) + else: + parser.exit(1, str(error)) + + +if __name__ == "__main__": + main() diff --git a/shared/package-files/34/34665ad0050cabe08d95e749eb09f5471e9315873bd37707d8eada2f2b283563/blob b/shared/package-files/34/34665ad0050cabe08d95e749eb09f5471e9315873bd37707d8eada2f2b283563/blob new file mode 100644 index 0000000000000000000000000000000000000000..de85a82d8c643156a804f07b994d7febcf2123a5 --- /dev/null +++ b/shared/package-files/34/34665ad0050cabe08d95e749eb09f5471e9315873bd37707d8eada2f2b283563/blob @@ -0,0 +1,359 @@ +# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license + +# Copyright (C) 2001-2017 Nominum, Inc. +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose with or without fee is hereby granted, +# provided that the above copyright notice and this permission notice +# appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +"""DNS nodes. A node is a set of rdatasets.""" + +import enum +import io +from typing import Any, Dict, Optional + +import dns.immutable +import dns.name +import dns.rdataclass +import dns.rdataset +import dns.rdatatype +import dns.renderer +import dns.rrset + +_cname_types = { + dns.rdatatype.CNAME, +} + +# "neutral" types can coexist with a CNAME and thus are not "other data" +_neutral_types = { + dns.rdatatype.NSEC, # RFC 4035 section 2.5 + dns.rdatatype.NSEC3, # This is not likely to happen, but not impossible! + dns.rdatatype.KEY, # RFC 4035 section 2.5, RFC 3007 +} + + +def _matches_type_or_its_signature(rdtypes, rdtype, covers): + return rdtype in rdtypes or (rdtype == dns.rdatatype.RRSIG and covers in rdtypes) + + +@enum.unique +class NodeKind(enum.Enum): + """Rdatasets in nodes""" + + REGULAR = 0 # a.k.a "other data" + NEUTRAL = 1 + CNAME = 2 + + @classmethod + def classify( + cls, rdtype: dns.rdatatype.RdataType, covers: dns.rdatatype.RdataType + ) -> "NodeKind": + if _matches_type_or_its_signature(_cname_types, rdtype, covers): + return NodeKind.CNAME + elif _matches_type_or_its_signature(_neutral_types, rdtype, covers): + return NodeKind.NEUTRAL + else: + return NodeKind.REGULAR + + @classmethod + def classify_rdataset(cls, rdataset: dns.rdataset.Rdataset) -> "NodeKind": + return cls.classify(rdataset.rdtype, rdataset.covers) + + +class Node: + """A Node is a set of rdatasets. + + A node is either a CNAME node or an "other data" node. A CNAME + node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their + covering RRSIG rdatasets. An "other data" node contains any + rdataset other than a CNAME or RRSIG(CNAME) rdataset. When + changes are made to a node, the CNAME or "other data" state is + always consistent with the update, i.e. the most recent change + wins. For example, if you have a node which contains a CNAME + rdataset, and then add an MX rdataset to it, then the CNAME + rdataset will be deleted. Likewise if you have a node containing + an MX rdataset and add a CNAME rdataset, the MX rdataset will be + deleted. + """ + + __slots__ = ["rdatasets"] + + def __init__(self): + # the set of rdatasets, represented as a list. + self.rdatasets = [] + + def to_text(self, name: dns.name.Name, **kw: Dict[str, Any]) -> str: + """Convert a node to text format. + + Each rdataset at the node is printed. Any keyword arguments + to this method are passed on to the rdataset's to_text() method. + + *name*, a ``dns.name.Name``, the owner name of the + rdatasets. + + Returns a ``str``. + + """ + + s = io.StringIO() + for rds in self.rdatasets: + if len(rds) > 0: + s.write(rds.to_text(name, **kw)) # type: ignore[arg-type] + s.write("\n") + return s.getvalue()[:-1] + + def __repr__(self): + return "" + + def __eq__(self, other): + # + # This is inefficient. Good thing we don't need to do it much. + # + for rd in self.rdatasets: + if rd not in other.rdatasets: + return False + for rd in other.rdatasets: + if rd not in self.rdatasets: + return False + return True + + def __ne__(self, other): + return not self.__eq__(other) + + def __len__(self): + return len(self.rdatasets) + + def __iter__(self): + return iter(self.rdatasets) + + def _append_rdataset(self, rdataset): + """Append rdataset to the node with special handling for CNAME and + other data conditions. + + Specifically, if the rdataset being appended has ``NodeKind.CNAME``, + then all rdatasets other than KEY, NSEC, NSEC3, and their covering + RRSIGs are deleted. If the rdataset being appended has + ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted. + """ + # Make having just one rdataset at the node fast. + if len(self.rdatasets) > 0: + kind = NodeKind.classify_rdataset(rdataset) + if kind == NodeKind.CNAME: + self.rdatasets = [ + rds + for rds in self.rdatasets + if NodeKind.classify_rdataset(rds) != NodeKind.REGULAR + ] + elif kind == NodeKind.REGULAR: + self.rdatasets = [ + rds + for rds in self.rdatasets + if NodeKind.classify_rdataset(rds) != NodeKind.CNAME + ] + # Otherwise the rdataset is NodeKind.NEUTRAL and we do not need to + # edit self.rdatasets. + self.rdatasets.append(rdataset) + + def find_rdataset( + self, + rdclass: dns.rdataclass.RdataClass, + rdtype: dns.rdatatype.RdataType, + covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, + create: bool = False, + ) -> dns.rdataset.Rdataset: + """Find an rdataset matching the specified properties in the + current node. + + *rdclass*, a ``dns.rdataclass.RdataClass``, the class of the rdataset. + + *rdtype*, a ``dns.rdatatype.RdataType``, the type of the rdataset. + + *covers*, a ``dns.rdatatype.RdataType``, the covered type. + Usually this value is ``dns.rdatatype.NONE``, but if the + rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``, + then the covers value will be the rdata type the SIG/RRSIG + covers. The library treats the SIG and RRSIG types as if they + were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). + This makes RRSIGs much easier to work with than if RRSIGs + covering different rdata types were aggregated into a single + RRSIG rdataset. + + *create*, a ``bool``. If True, create the rdataset if it is not found. + + Raises ``KeyError`` if an rdataset of the desired type and class does + not exist and *create* is not ``True``. + + Returns a ``dns.rdataset.Rdataset``. + """ + + for rds in self.rdatasets: + if rds.match(rdclass, rdtype, covers): + return rds + if not create: + raise KeyError + rds = dns.rdataset.Rdataset(rdclass, rdtype, covers) + self._append_rdataset(rds) + return rds + + def get_rdataset( + self, + rdclass: dns.rdataclass.RdataClass, + rdtype: dns.rdatatype.RdataType, + covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, + create: bool = False, + ) -> Optional[dns.rdataset.Rdataset]: + """Get an rdataset matching the specified properties in the + current node. + + None is returned if an rdataset of the specified type and + class does not exist and *create* is not ``True``. + + *rdclass*, an ``int``, the class of the rdataset. + + *rdtype*, an ``int``, the type of the rdataset. + + *covers*, an ``int``, the covered type. Usually this value is + dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or + dns.rdatatype.RRSIG, then the covers value will be the rdata + type the SIG/RRSIG covers. The library treats the SIG and RRSIG + types as if they were a family of + types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much + easier to work with than if RRSIGs covering different rdata + types were aggregated into a single RRSIG rdataset. + + *create*, a ``bool``. If True, create the rdataset if it is not found. + + Returns a ``dns.rdataset.Rdataset`` or ``None``. + """ + + try: + rds = self.find_rdataset(rdclass, rdtype, covers, create) + except KeyError: + rds = None + return rds + + def delete_rdataset( + self, + rdclass: dns.rdataclass.RdataClass, + rdtype: dns.rdatatype.RdataType, + covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, + ) -> None: + """Delete the rdataset matching the specified properties in the + current node. + + If a matching rdataset does not exist, it is not an error. + + *rdclass*, an ``int``, the class of the rdataset. + + *rdtype*, an ``int``, the type of the rdataset. + + *covers*, an ``int``, the covered type. + """ + + rds = self.get_rdataset(rdclass, rdtype, covers) + if rds is not None: + self.rdatasets.remove(rds) + + def replace_rdataset(self, replacement: dns.rdataset.Rdataset) -> None: + """Replace an rdataset. + + It is not an error if there is no rdataset matching *replacement*. + + Ownership of the *replacement* object is transferred to the node; + in other words, this method does not store a copy of *replacement* + at the node, it stores *replacement* itself. + + *replacement*, a ``dns.rdataset.Rdataset``. + + Raises ``ValueError`` if *replacement* is not a + ``dns.rdataset.Rdataset``. + """ + + if not isinstance(replacement, dns.rdataset.Rdataset): + raise ValueError("replacement is not an rdataset") + if isinstance(replacement, dns.rrset.RRset): + # RRsets are not good replacements as the match() method + # is not compatible. + replacement = replacement.to_rdataset() + self.delete_rdataset( + replacement.rdclass, replacement.rdtype, replacement.covers + ) + self._append_rdataset(replacement) + + def classify(self) -> NodeKind: + """Classify a node. + + A node which contains a CNAME or RRSIG(CNAME) is a + ``NodeKind.CNAME`` node. + + A node which contains only "neutral" types, i.e. types allowed to + co-exist with a CNAME, is a ``NodeKind.NEUTRAL`` node. The neutral + types are NSEC, NSEC3, KEY, and their associated RRSIGS. An empty node + is also considered neutral. + + A node which contains some rdataset which is not a CNAME, RRSIG(CNAME), + or a neutral type is a a ``NodeKind.REGULAR`` node. Regular nodes are + also commonly referred to as "other data". + """ + for rdataset in self.rdatasets: + kind = NodeKind.classify(rdataset.rdtype, rdataset.covers) + if kind != NodeKind.NEUTRAL: + return kind + return NodeKind.NEUTRAL + + def is_immutable(self) -> bool: + return False + + +@dns.immutable.immutable +class ImmutableNode(Node): + def __init__(self, node): + super().__init__() + self.rdatasets = tuple( + [dns.rdataset.ImmutableRdataset(rds) for rds in node.rdatasets] + ) + + def find_rdataset( + self, + rdclass: dns.rdataclass.RdataClass, + rdtype: dns.rdatatype.RdataType, + covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, + create: bool = False, + ) -> dns.rdataset.Rdataset: + if create: + raise TypeError("immutable") + return super().find_rdataset(rdclass, rdtype, covers, False) + + def get_rdataset( + self, + rdclass: dns.rdataclass.RdataClass, + rdtype: dns.rdatatype.RdataType, + covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, + create: bool = False, + ) -> Optional[dns.rdataset.Rdataset]: + if create: + raise TypeError("immutable") + return super().get_rdataset(rdclass, rdtype, covers, False) + + def delete_rdataset( + self, + rdclass: dns.rdataclass.RdataClass, + rdtype: dns.rdatatype.RdataType, + covers: dns.rdatatype.RdataType = dns.rdatatype.NONE, + ) -> None: + raise TypeError("immutable") + + def replace_rdataset(self, replacement: dns.rdataset.Rdataset) -> None: + raise TypeError("immutable") + + def is_immutable(self) -> bool: + return True diff --git a/shared/package-files/34/34677e12f985660b7c2a8e4c3f74ff4cbc326f2eb24b405733f396f35f7b8695/blob b/shared/package-files/34/34677e12f985660b7c2a8e4c3f74ff4cbc326f2eb24b405733f396f35f7b8695/blob new file mode 100644 index 0000000000000000000000000000000000000000..593e8c6208ab0bf3aa869de89e213b8aa9f8c071 Binary files /dev/null and b/shared/package-files/34/34677e12f985660b7c2a8e4c3f74ff4cbc326f2eb24b405733f396f35f7b8695/blob differ diff --git a/shared/package-files/34/3469efadc2b754fe2a99693b7993480203440facafc9f70405ab0c4e6b0781c9/blob b/shared/package-files/34/3469efadc2b754fe2a99693b7993480203440facafc9f70405ab0c4e6b0781c9/blob new file mode 100644 index 0000000000000000000000000000000000000000..8c1d29002e6952044d026945e1ab81e11a01dee4 --- /dev/null +++ b/shared/package-files/34/3469efadc2b754fe2a99693b7993480203440facafc9f70405ab0c4e6b0781c9/blob @@ -0,0 +1,5 @@ +processor : 0 +hart : 4 +isa : rv64imafdc +mmu : sv39 +uarch : sifive,u74-mc diff --git a/shared/package-files/34/346b586963c0f952e89e0cbcfb1bade0bddd8b679ed0f0294b1223332669db03/blob b/shared/package-files/34/346b586963c0f952e89e0cbcfb1bade0bddd8b679ed0f0294b1223332669db03/blob new file mode 100644 index 0000000000000000000000000000000000000000..5e378ab1a37a6068f24984a434eecad336b383d2 --- /dev/null +++ b/shared/package-files/34/346b586963c0f952e89e0cbcfb1bade0bddd8b679ed0f0294b1223332669db03/blob @@ -0,0 +1,23 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor avg_pool1d(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride={}, at::IntArrayRef padding=0, bool ceil_mode=false, bool count_include_pad=true); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/34/346f1bb03859e443b1313f8cb045b3266d75651dfff020181e51b9dc81a2d29b/blob b/shared/package-files/34/346f1bb03859e443b1313f8cb045b3266d75651dfff020181e51b9dc81a2d29b/blob new file mode 100644 index 0000000000000000000000000000000000000000..7f5110ab9e218e24683acd1489d38bded16c7420 --- /dev/null +++ b/shared/package-files/34/346f1bb03859e443b1313f8cb045b3266d75651dfff020181e51b9dc81a2d29b/blob @@ -0,0 +1,307 @@ +""" +Mesh refinement for triangular grids. +""" + +import numpy as np + +from matplotlib import _api +from matplotlib.tri._triangulation import Triangulation +import matplotlib.tri._triinterpolate + + +class TriRefiner: + """ + Abstract base class for classes implementing mesh refinement. + + A TriRefiner encapsulates a Triangulation object and provides tools for + mesh refinement and interpolation. + + Derived classes must implement: + + - ``refine_triangulation(return_tri_index=False, **kwargs)`` , where + the optional keyword arguments *kwargs* are defined in each + TriRefiner concrete implementation, and which returns: + + - a refined triangulation, + - optionally (depending on *return_tri_index*), for each + point of the refined triangulation: the index of + the initial triangulation triangle to which it belongs. + + - ``refine_field(z, triinterpolator=None, **kwargs)``, where: + + - *z* array of field values (to refine) defined at the base + triangulation nodes, + - *triinterpolator* is an optional `~matplotlib.tri.TriInterpolator`, + - the other optional keyword arguments *kwargs* are defined in + each TriRefiner concrete implementation; + + and which returns (as a tuple) a refined triangular mesh and the + interpolated values of the field at the refined triangulation nodes. + """ + + def __init__(self, triangulation): + _api.check_isinstance(Triangulation, triangulation=triangulation) + self._triangulation = triangulation + + +class UniformTriRefiner(TriRefiner): + """ + Uniform mesh refinement by recursive subdivisions. + + Parameters + ---------- + triangulation : `~matplotlib.tri.Triangulation` + The encapsulated triangulation (to be refined) + """ +# See Also +# -------- +# :class:`~matplotlib.tri.CubicTriInterpolator` and +# :class:`~matplotlib.tri.TriAnalyzer`. +# """ + def __init__(self, triangulation): + super().__init__(triangulation) + + def refine_triangulation(self, return_tri_index=False, subdiv=3): + """ + Compute a uniformly refined triangulation *refi_triangulation* of + the encapsulated :attr:`triangulation`. + + This function refines the encapsulated triangulation by splitting each + father triangle into 4 child sub-triangles built on the edges midside + nodes, recursing *subdiv* times. In the end, each triangle is hence + divided into ``4**subdiv`` child triangles. + + Parameters + ---------- + return_tri_index : bool, default: False + Whether an index table indicating the father triangle index of each + point is returned. + subdiv : int, default: 3 + Recursion level for the subdivision. + Each triangle is divided into ``4**subdiv`` child triangles; + hence, the default results in 64 refined subtriangles for each + triangle of the initial triangulation. + + Returns + ------- + refi_triangulation : `~matplotlib.tri.Triangulation` + The refined triangulation. + found_index : int array + Index of the initial triangulation containing triangle, for each + point of *refi_triangulation*. + Returned only if *return_tri_index* is set to True. + """ + refi_triangulation = self._triangulation + ntri = refi_triangulation.triangles.shape[0] + + # Computes the triangulation ancestors numbers in the reference + # triangulation. + ancestors = np.arange(ntri, dtype=np.int32) + for _ in range(subdiv): + refi_triangulation, ancestors = self._refine_triangulation_once( + refi_triangulation, ancestors) + refi_npts = refi_triangulation.x.shape[0] + refi_triangles = refi_triangulation.triangles + + # Now we compute found_index table if needed + if return_tri_index: + # We have to initialize found_index with -1 because some nodes + # may very well belong to no triangle at all, e.g., in case of + # Delaunay Triangulation with DuplicatePointWarning. + found_index = np.full(refi_npts, -1, dtype=np.int32) + tri_mask = self._triangulation.mask + if tri_mask is None: + found_index[refi_triangles] = np.repeat(ancestors, + 3).reshape(-1, 3) + else: + # There is a subtlety here: we want to avoid whenever possible + # that refined points container is a masked triangle (which + # would result in artifacts in plots). + # So we impose the numbering from masked ancestors first, + # then overwrite it with unmasked ancestor numbers. + ancestor_mask = tri_mask[ancestors] + found_index[refi_triangles[ancestor_mask, :] + ] = np.repeat(ancestors[ancestor_mask], + 3).reshape(-1, 3) + found_index[refi_triangles[~ancestor_mask, :] + ] = np.repeat(ancestors[~ancestor_mask], + 3).reshape(-1, 3) + return refi_triangulation, found_index + else: + return refi_triangulation + + def refine_field(self, z, triinterpolator=None, subdiv=3): + """ + Refine a field defined on the encapsulated triangulation. + + Parameters + ---------- + z : (npoints,) array-like + Values of the field to refine, defined at the nodes of the + encapsulated triangulation. (``n_points`` is the number of points + in the initial triangulation) + triinterpolator : `~matplotlib.tri.TriInterpolator`, optional + Interpolator used for field interpolation. If not specified, + a `~matplotlib.tri.CubicTriInterpolator` will be used. + subdiv : int, default: 3 + Recursion level for the subdivision. + Each triangle is divided into ``4**subdiv`` child triangles. + + Returns + ------- + refi_tri : `~matplotlib.tri.Triangulation` + The returned refined triangulation. + refi_z : 1D array of length: *refi_tri* node count. + The returned interpolated field (at *refi_tri* nodes). + """ + if triinterpolator is None: + interp = matplotlib.tri.CubicTriInterpolator( + self._triangulation, z) + else: + _api.check_isinstance(matplotlib.tri.TriInterpolator, + triinterpolator=triinterpolator) + interp = triinterpolator + + refi_tri, found_index = self.refine_triangulation( + subdiv=subdiv, return_tri_index=True) + refi_z = interp._interpolate_multikeys( + refi_tri.x, refi_tri.y, tri_index=found_index)[0] + return refi_tri, refi_z + + @staticmethod + def _refine_triangulation_once(triangulation, ancestors=None): + """ + Refine a `.Triangulation` by splitting each triangle into 4 + child-masked_triangles built on the edges midside nodes. + + Masked triangles, if present, are also split, but their children + returned masked. + + If *ancestors* is not provided, returns only a new triangulation: + child_triangulation. + + If the array-like key table *ancestor* is given, it shall be of shape + (ntri,) where ntri is the number of *triangulation* masked_triangles. + In this case, the function returns + (child_triangulation, child_ancestors) + child_ancestors is defined so that the 4 child masked_triangles share + the same index as their father: child_ancestors.shape = (4 * ntri,). + """ + + x = triangulation.x + y = triangulation.y + + # According to tri.triangulation doc: + # neighbors[i, j] is the triangle that is the neighbor + # to the edge from point index masked_triangles[i, j] to point + # index masked_triangles[i, (j+1)%3]. + neighbors = triangulation.neighbors + triangles = triangulation.triangles + npts = np.shape(x)[0] + ntri = np.shape(triangles)[0] + if ancestors is not None: + ancestors = np.asarray(ancestors) + if np.shape(ancestors) != (ntri,): + raise ValueError( + "Incompatible shapes provide for " + "triangulation.masked_triangles and ancestors: " + f"{np.shape(triangles)} and {np.shape(ancestors)}") + + # Initiating tables refi_x and refi_y of the refined triangulation + # points + # hint: each apex is shared by 2 masked_triangles except the borders. + borders = np.sum(neighbors == -1) + added_pts = (3*ntri + borders) // 2 + refi_npts = npts + added_pts + refi_x = np.zeros(refi_npts) + refi_y = np.zeros(refi_npts) + + # First part of refi_x, refi_y is just the initial points + refi_x[:npts] = x + refi_y[:npts] = y + + # Second part contains the edge midside nodes. + # Each edge belongs to 1 triangle (if border edge) or is shared by 2 + # masked_triangles (interior edge). + # We first build 2 * ntri arrays of edge starting nodes (edge_elems, + # edge_apexes); we then extract only the masters to avoid overlaps. + # The so-called 'master' is the triangle with biggest index + # The 'slave' is the triangle with lower index + # (can be -1 if border edge) + # For slave and master we will identify the apex pointing to the edge + # start + edge_elems = np.tile(np.arange(ntri, dtype=np.int32), 3) + edge_apexes = np.repeat(np.arange(3, dtype=np.int32), ntri) + edge_neighbors = neighbors[edge_elems, edge_apexes] + mask_masters = (edge_elems > edge_neighbors) + + # Identifying the "masters" and adding to refi_x, refi_y vec + masters = edge_elems[mask_masters] + apex_masters = edge_apexes[mask_masters] + x_add = (x[triangles[masters, apex_masters]] + + x[triangles[masters, (apex_masters+1) % 3]]) * 0.5 + y_add = (y[triangles[masters, apex_masters]] + + y[triangles[masters, (apex_masters+1) % 3]]) * 0.5 + refi_x[npts:] = x_add + refi_y[npts:] = y_add + + # Building the new masked_triangles; each old masked_triangles hosts + # 4 new masked_triangles + # there are 6 pts to identify per 'old' triangle, 3 new_pt_corner and + # 3 new_pt_midside + new_pt_corner = triangles + + # What is the index in refi_x, refi_y of point at middle of apex iapex + # of elem ielem ? + # If ielem is the apex master: simple count, given the way refi_x was + # built. + # If ielem is the apex slave: yet we do not know; but we will soon + # using the neighbors table. + new_pt_midside = np.empty([ntri, 3], dtype=np.int32) + cum_sum = npts + for imid in range(3): + mask_st_loc = (imid == apex_masters) + n_masters_loc = np.sum(mask_st_loc) + elem_masters_loc = masters[mask_st_loc] + new_pt_midside[:, imid][elem_masters_loc] = np.arange( + n_masters_loc, dtype=np.int32) + cum_sum + cum_sum += n_masters_loc + + # Now dealing with slave elems. + # for each slave element we identify the master and then the inode + # once slave_masters is identified, slave_masters_apex is such that: + # neighbors[slaves_masters, slave_masters_apex] == slaves + mask_slaves = np.logical_not(mask_masters) + slaves = edge_elems[mask_slaves] + slaves_masters = edge_neighbors[mask_slaves] + diff_table = np.abs(neighbors[slaves_masters, :] - + np.outer(slaves, np.ones(3, dtype=np.int32))) + slave_masters_apex = np.argmin(diff_table, axis=1) + slaves_apex = edge_apexes[mask_slaves] + new_pt_midside[slaves, slaves_apex] = new_pt_midside[ + slaves_masters, slave_masters_apex] + + # Builds the 4 child masked_triangles + child_triangles = np.empty([ntri*4, 3], dtype=np.int32) + child_triangles[0::4, :] = np.vstack([ + new_pt_corner[:, 0], new_pt_midside[:, 0], + new_pt_midside[:, 2]]).T + child_triangles[1::4, :] = np.vstack([ + new_pt_corner[:, 1], new_pt_midside[:, 1], + new_pt_midside[:, 0]]).T + child_triangles[2::4, :] = np.vstack([ + new_pt_corner[:, 2], new_pt_midside[:, 2], + new_pt_midside[:, 1]]).T + child_triangles[3::4, :] = np.vstack([ + new_pt_midside[:, 0], new_pt_midside[:, 1], + new_pt_midside[:, 2]]).T + child_triangulation = Triangulation(refi_x, refi_y, child_triangles) + + # Builds the child mask + if triangulation.mask is not None: + child_triangulation.set_mask(np.repeat(triangulation.mask, 4)) + + if ancestors is None: + return child_triangulation + else: + return child_triangulation, np.repeat(ancestors, 4) diff --git a/shared/package-files/34/347116664209180c6b8af335a3a0b490426a80925ad9f0f6a514166e37b20b02/blob b/shared/package-files/34/347116664209180c6b8af335a3a0b490426a80925ad9f0f6a514166e37b20b02/blob new file mode 100644 index 0000000000000000000000000000000000000000..7fb48dc461429d54ddd784d4c7d270faff0768d0 --- /dev/null +++ b/shared/package-files/34/347116664209180c6b8af335a3a0b490426a80925ad9f0f6a514166e37b20b02/blob @@ -0,0 +1,306 @@ +""" +Kalman Smoother + +Author: Chad Fulton +License: Simplified-BSD +""" + +import numpy as np + +SMOOTHER_STATE = 0x01 # Durbin and Koopman (2012), Chapter 4.4.2 +SMOOTHER_STATE_COV = 0x02 # ibid., Chapter 4.4.3 +SMOOTHER_DISTURBANCE = 0x04 # ibid., Chapter 4.5 +SMOOTHER_DISTURBANCE_COV = 0x08 # ibid., Chapter 4.5 +SMOOTHER_ALL = ( + SMOOTHER_STATE | SMOOTHER_STATE_COV | SMOOTHER_DISTURBANCE | + SMOOTHER_DISTURBANCE_COV +) + + +class _KalmanSmoother: + """ + Pure Python Kalman smoother + + Parameters + ---------- + model : KalmanFilter + The state space model. + kfilter : FilterResults + The Cython Kalman filter results object with which filtering has + already been performed. + smoother_output : int + Bitmask value to indicate what smoother output to compute. See + `SMOOTHER_STATE`, `SMOOTHER_STATE_COV`, `SMOOTHER_DISTURBANCE`, + `SMOOTHER_DISTURBANCE_COV`, and `SMOOTHER_ALL` for more details. + + Notes + ----- + This is a pure Python (and therefore relatively slow) implementation of + the Kalman smoother algorithm, intended to be used as a check on, or + a substitute for, the faster Cython implementation. + """ + + def __init__(self, model, kfilter, smoother_output): + # Save values + self.model = model + self.kfilter = kfilter + self._kfilter = model._kalman_filter + self.smoother_output = smoother_output + self.t = -1 + + # Create storage + self.scaled_smoothed_estimator = None + self.scaled_smoothed_estimator_cov = None + self.smoothing_error = None + self.smoothed_state = None + self.smoothed_state_cov = None + self.smoothed_state_disturbance = None + self.smoothed_state_disturbance_cov = None + self.smoothed_measurement_disturbance = None + self.smoothed_measurement_disturbance_cov = None + + # Intermediate values + self.tmp_L = np.zeros((model.k_states, model.k_states, model.nobs), + dtype=kfilter.dtype) + + if smoother_output & (SMOOTHER_STATE | SMOOTHER_DISTURBANCE): + self.scaled_smoothed_estimator = ( + np.zeros((model.k_states, model.nobs+1), dtype=kfilter.dtype)) + self.smoothing_error = ( + np.zeros((model.k_endog, model.nobs), dtype=kfilter.dtype)) + if smoother_output & (SMOOTHER_STATE_COV | SMOOTHER_DISTURBANCE_COV): + self.scaled_smoothed_estimator_cov = ( + np.zeros((model.k_states, model.k_states, model.nobs + 1), + dtype=kfilter.dtype)) + + # State smoothing + if smoother_output & SMOOTHER_STATE: + self.smoothed_state = np.zeros((model.k_states, model.nobs), + dtype=kfilter.dtype) + if smoother_output & SMOOTHER_STATE_COV: + self.smoothed_state_cov = ( + np.zeros((model.k_states, model.k_states, model.nobs), + dtype=kfilter.dtype)) + + # Disturbance smoothing + if smoother_output & SMOOTHER_DISTURBANCE: + self.smoothed_state_disturbance = ( + np.zeros((model.k_posdef, model.nobs), dtype=kfilter.dtype)) + self.smoothed_measurement_disturbance = ( + np.zeros((model.k_endog, model.nobs), dtype=kfilter.dtype)) + if smoother_output & SMOOTHER_DISTURBANCE_COV: + self.smoothed_state_disturbance_cov = ( + np.zeros((model.k_posdef, model.k_posdef, model.nobs), + dtype=kfilter.dtype)) + self.smoothed_measurement_disturbance_cov = ( + np.zeros((model.k_endog, model.k_endog, model.nobs), + dtype=kfilter.dtype)) + + def seek(self, t): + """ + Seek the smoother to a specific point in time + + Parameters + ---------- + t : int + Observation index to seek to. + + Raises + ------ + IndexError + If `t` is out of range for the observations in the model. + """ + if t >= self.model.nobs: + raise IndexError("Observation index out of range") + self.t = t + + def __iter__(self): + return self + + def __call__(self): + self.seek(self.model.nobs-1) + # Perform backwards smoothing iterations + for _ in range(self.model.nobs-1, -1, -1): + next(self) + + def next(self): + # next() is required for compatibility with Python2.7. + return self.__next__() + + def __next__(self): + # Check for valid iteration + if not self.t >= 0: + raise StopIteration + + # Get local copies of variables + t = self.t + kfilter = self.kfilter + _kfilter = self._kfilter + model = self.model + smoother_output = self.smoother_output + + scaled_smoothed_estimator = self.scaled_smoothed_estimator + scaled_smoothed_estimator_cov = self.scaled_smoothed_estimator_cov + smoothing_error = self.smoothing_error + smoothed_state = self.smoothed_state + smoothed_state_cov = self.smoothed_state_cov + smoothed_state_disturbance = self.smoothed_state_disturbance + smoothed_state_disturbance_cov = self.smoothed_state_disturbance_cov + smoothed_measurement_disturbance = ( + self.smoothed_measurement_disturbance) + smoothed_measurement_disturbance_cov = ( + self.smoothed_measurement_disturbance_cov) + tmp_L = self.tmp_L + + # Seek the Cython Kalman filter to the right place, setup matrices + _kfilter.seek(t, False) + _kfilter.initialize_statespace_object_pointers() + _kfilter.initialize_filter_object_pointers() + _kfilter.select_missing() + + missing_entire_obs = ( + _kfilter.model.nmissing[t] == _kfilter.model.k_endog) + missing_partial_obs = ( + not missing_entire_obs and _kfilter.model.nmissing[t] > 0) + + # Get the appropriate (possibly time-varying) indices + design_t = 0 if kfilter.design.shape[2] == 1 else t + obs_cov_t = 0 if kfilter.obs_cov.shape[2] == 1 else t + transition_t = 0 if kfilter.transition.shape[2] == 1 else t + selection_t = 0 if kfilter.selection.shape[2] == 1 else t + state_cov_t = 0 if kfilter.state_cov.shape[2] == 1 else t + + # Get endog dimension (can vary if there missing data) + k_endog = _kfilter.k_endog + + # Get references to representation matrices and Kalman filter output + transition = model.transition[:, :, transition_t] + selection = model.selection[:, :, selection_t] + state_cov = model.state_cov[:, :, state_cov_t] + + predicted_state = kfilter.predicted_state[:, t] + predicted_state_cov = kfilter.predicted_state_cov[:, :, t] + + mask = ~kfilter.missing[:, t].astype(bool) + if missing_partial_obs: + design = np.array( + _kfilter.selected_design[:k_endog*model.k_states], copy=True + ).reshape(k_endog, model.k_states, order="F") + obs_cov = np.array( + _kfilter.selected_obs_cov[:k_endog**2], copy=True + ).reshape(k_endog, k_endog) + kalman_gain = kfilter.kalman_gain[:, mask, t] + + forecasts_error_cov = np.array( + _kfilter.forecast_error_cov[:, :, t], copy=True + ).ravel(order="F")[:k_endog**2].reshape(k_endog, k_endog) + forecasts_error = np.array( + _kfilter.forecast_error[:k_endog, t], copy=True) + F_inv = np.linalg.inv(forecasts_error_cov) + else: + if missing_entire_obs: + design = np.zeros(model.design.shape[:-1]) + else: + design = model.design[:, :, design_t] + obs_cov = model.obs_cov[:, :, obs_cov_t] + kalman_gain = kfilter.kalman_gain[:, :, t] + forecasts_error_cov = kfilter.forecasts_error_cov[:, :, t] + forecasts_error = kfilter.forecasts_error[:, t] + F_inv = np.linalg.inv(forecasts_error_cov) + + # Create a temporary matrix + tmp_L[:, :, t] = transition - kalman_gain.dot(design) + L = tmp_L[:, :, t] + + # Perform the recursion + + # Intermediate values + if smoother_output & (SMOOTHER_STATE | SMOOTHER_DISTURBANCE): + if missing_entire_obs: + # smoothing_error is undefined here, keep it as zeros + scaled_smoothed_estimator[:, t - 1] = ( + transition.transpose().dot(scaled_smoothed_estimator[:, t]) + ) + else: + smoothing_error[:k_endog, t] = ( + F_inv.dot(forecasts_error) - + kalman_gain.transpose().dot( + scaled_smoothed_estimator[:, t]) + ) + scaled_smoothed_estimator[:, t - 1] = ( + design.transpose().dot(smoothing_error[:k_endog, t]) + + transition.transpose().dot(scaled_smoothed_estimator[:, t]) + ) + if smoother_output & (SMOOTHER_STATE_COV | SMOOTHER_DISTURBANCE_COV): + if missing_entire_obs: + scaled_smoothed_estimator_cov[:, :, t - 1] = ( + L.transpose().dot( + scaled_smoothed_estimator_cov[:, :, t] + ).dot(L) + ) + else: + scaled_smoothed_estimator_cov[:, :, t - 1] = ( + design.transpose().dot(F_inv).dot(design) + + L.transpose().dot( + scaled_smoothed_estimator_cov[:, :, t] + ).dot(L) + ) + + # State smoothing + if smoother_output & SMOOTHER_STATE: + smoothed_state[:, t] = ( + predicted_state + + predicted_state_cov.dot(scaled_smoothed_estimator[:, t - 1]) + ) + if smoother_output & SMOOTHER_STATE_COV: + smoothed_state_cov[:, :, t] = ( + predicted_state_cov - + predicted_state_cov.dot( + scaled_smoothed_estimator_cov[:, :, t - 1] + ).dot(predicted_state_cov) + ) + + # Disturbance smoothing + if smoother_output & (SMOOTHER_DISTURBANCE | SMOOTHER_DISTURBANCE_COV): + QR = state_cov.dot(selection.transpose()) + + if smoother_output & SMOOTHER_DISTURBANCE: + smoothed_state_disturbance[:, t] = ( + QR.dot(scaled_smoothed_estimator[:, t]) + ) + # measurement disturbance is set to zero when all missing + # (unconditional distribution) + if not missing_entire_obs: + smoothed_measurement_disturbance[mask, t] = ( + obs_cov.dot(smoothing_error[:k_endog, t]) + ) + + if smoother_output & SMOOTHER_DISTURBANCE_COV: + smoothed_state_disturbance_cov[:, :, t] = ( + state_cov - + QR.dot( + scaled_smoothed_estimator_cov[:, :, t] + ).dot(QR.transpose()) + ) + + if missing_entire_obs: + smoothed_measurement_disturbance_cov[:, :, t] = obs_cov + else: + # For non-missing portion, calculate as usual + ix = np.ix_(mask, mask, [t]) + smoothed_measurement_disturbance_cov[ix] = ( + obs_cov - obs_cov.dot( + F_inv + kalman_gain.transpose().dot( + scaled_smoothed_estimator_cov[:, :, t] + ).dot(kalman_gain) + ).dot(obs_cov) + )[:, :, np.newaxis] + + # For missing portion, use unconditional distribution + ix = np.ix_(~mask, ~mask, [t]) + mod_ix = np.ix_(~mask, ~mask, [0]) + smoothed_measurement_disturbance_cov[ix] = np.copy( + model.obs_cov[:, :, obs_cov_t:obs_cov_t+1])[mod_ix] + + # Advance the smoother + self.t -= 1 diff --git a/shared/package-files/34/347151ad93436cac32265eb255b07c75ddb89055ee8aca2c59eebff9df5d5d73/blob b/shared/package-files/34/347151ad93436cac32265eb255b07c75ddb89055ee8aca2c59eebff9df5d5d73/blob new file mode 100644 index 0000000000000000000000000000000000000000..ace5217d2713921d2b03c1a956a0f23ed0bdbccb --- /dev/null +++ b/shared/package-files/34/347151ad93436cac32265eb255b07c75ddb89055ee8aca2c59eebff9df5d5d73/blob @@ -0,0 +1,502 @@ +"""Macintosh binhex compression/decompression. + +easy interface: +binhex(inputfilename, outputfilename) +hexbin(inputfilename, outputfilename) +""" + +# +# Jack Jansen, CWI, August 1995. +# +# The module is supposed to be as compatible as possible. Especially the +# easy interface should work "as expected" on any platform. +# XXXX Note: currently, textfiles appear in mac-form on all platforms. +# We seem to lack a simple character-translate in python. +# (we should probably use ISO-Latin-1 on all but the mac platform). +# XXXX The simple routines are too simple: they expect to hold the complete +# files in-core. Should be fixed. +# XXXX It would be nice to handle AppleDouble format on unix +# (for servers serving macs). +# XXXX I don't understand what happens when you get 0x90 times the same byte on +# input. The resulting code (xx 90 90) would appear to be interpreted as an +# escaped *value* of 0x90. All coders I've seen appear to ignore this nicety... +# +import binascii +import contextlib +import io +import os +import struct +import warnings + +warnings.warn('the binhex module is deprecated', DeprecationWarning, + stacklevel=2) + + +__all__ = ["binhex","hexbin","Error"] + +class Error(Exception): + pass + +# States (what have we written) +_DID_HEADER = 0 +_DID_DATA = 1 + +# Various constants +REASONABLY_LARGE = 32768 # Minimal amount we pass the rle-coder +LINELEN = 64 +RUNCHAR = b"\x90" + +# +# This code is no longer byte-order dependent + + +class FInfo: + def __init__(self): + self.Type = '????' + self.Creator = '????' + self.Flags = 0 + +def getfileinfo(name): + finfo = FInfo() + with io.open(name, 'rb') as fp: + # Quick check for textfile + data = fp.read(512) + if 0 not in data: + finfo.Type = 'TEXT' + fp.seek(0, 2) + dsize = fp.tell() + dir, file = os.path.split(name) + file = file.replace(':', '-', 1) + return file, finfo, dsize, 0 + +class openrsrc: + def __init__(self, *args): + pass + + def read(self, *args): + return b'' + + def write(self, *args): + pass + + def close(self): + pass + + +# DeprecationWarning is already emitted on "import binhex". There is no need +# to repeat the warning at each call to deprecated binascii functions. +@contextlib.contextmanager +def _ignore_deprecation_warning(): + with warnings.catch_warnings(): + warnings.filterwarnings('ignore', '', DeprecationWarning) + yield + + +class _Hqxcoderengine: + """Write data to the coder in 3-byte chunks""" + + def __init__(self, ofp): + self.ofp = ofp + self.data = b'' + self.hqxdata = b'' + self.linelen = LINELEN - 1 + + def write(self, data): + self.data = self.data + data + datalen = len(self.data) + todo = (datalen // 3) * 3 + data = self.data[:todo] + self.data = self.data[todo:] + if not data: + return + with _ignore_deprecation_warning(): + self.hqxdata = self.hqxdata + binascii.b2a_hqx(data) + self._flush(0) + + def _flush(self, force): + first = 0 + while first <= len(self.hqxdata) - self.linelen: + last = first + self.linelen + self.ofp.write(self.hqxdata[first:last] + b'\r') + self.linelen = LINELEN + first = last + self.hqxdata = self.hqxdata[first:] + if force: + self.ofp.write(self.hqxdata + b':\r') + + def close(self): + if self.data: + with _ignore_deprecation_warning(): + self.hqxdata = self.hqxdata + binascii.b2a_hqx(self.data) + self._flush(1) + self.ofp.close() + del self.ofp + +class _Rlecoderengine: + """Write data to the RLE-coder in suitably large chunks""" + + def __init__(self, ofp): + self.ofp = ofp + self.data = b'' + + def write(self, data): + self.data = self.data + data + if len(self.data) < REASONABLY_LARGE: + return + with _ignore_deprecation_warning(): + rledata = binascii.rlecode_hqx(self.data) + self.ofp.write(rledata) + self.data = b'' + + def close(self): + if self.data: + with _ignore_deprecation_warning(): + rledata = binascii.rlecode_hqx(self.data) + self.ofp.write(rledata) + self.ofp.close() + del self.ofp + +class BinHex: + def __init__(self, name_finfo_dlen_rlen, ofp): + name, finfo, dlen, rlen = name_finfo_dlen_rlen + close_on_error = False + if isinstance(ofp, str): + ofname = ofp + ofp = io.open(ofname, 'wb') + close_on_error = True + try: + ofp.write(b'(This file must be converted with BinHex 4.0)\r\r:') + hqxer = _Hqxcoderengine(ofp) + self.ofp = _Rlecoderengine(hqxer) + self.crc = 0 + if finfo is None: + finfo = FInfo() + self.dlen = dlen + self.rlen = rlen + self._writeinfo(name, finfo) + self.state = _DID_HEADER + except: + if close_on_error: + ofp.close() + raise + + def _writeinfo(self, name, finfo): + nl = len(name) + if nl > 63: + raise Error('Filename too long') + d = bytes([nl]) + name.encode("latin-1") + b'\0' + tp, cr = finfo.Type, finfo.Creator + if isinstance(tp, str): + tp = tp.encode("latin-1") + if isinstance(cr, str): + cr = cr.encode("latin-1") + d2 = tp + cr + + # Force all structs to be packed with big-endian + d3 = struct.pack('>h', finfo.Flags) + d4 = struct.pack('>ii', self.dlen, self.rlen) + info = d + d2 + d3 + d4 + self._write(info) + self._writecrc() + + def _write(self, data): + self.crc = binascii.crc_hqx(data, self.crc) + self.ofp.write(data) + + def _writecrc(self): + # XXXX Should this be here?? + # self.crc = binascii.crc_hqx('\0\0', self.crc) + if self.crc < 0: + fmt = '>h' + else: + fmt = '>H' + self.ofp.write(struct.pack(fmt, self.crc)) + self.crc = 0 + + def write(self, data): + if self.state != _DID_HEADER: + raise Error('Writing data at the wrong time') + self.dlen = self.dlen - len(data) + self._write(data) + + def close_data(self): + if self.dlen != 0: + raise Error('Incorrect data size, diff=%r' % (self.rlen,)) + self._writecrc() + self.state = _DID_DATA + + def write_rsrc(self, data): + if self.state < _DID_DATA: + self.close_data() + if self.state != _DID_DATA: + raise Error('Writing resource data at the wrong time') + self.rlen = self.rlen - len(data) + self._write(data) + + def close(self): + if self.state is None: + return + try: + if self.state < _DID_DATA: + self.close_data() + if self.state != _DID_DATA: + raise Error('Close at the wrong time') + if self.rlen != 0: + raise Error("Incorrect resource-datasize, diff=%r" % (self.rlen,)) + self._writecrc() + finally: + self.state = None + ofp = self.ofp + del self.ofp + ofp.close() + +def binhex(inp, out): + """binhex(infilename, outfilename): create binhex-encoded copy of a file""" + finfo = getfileinfo(inp) + ofp = BinHex(finfo, out) + + with io.open(inp, 'rb') as ifp: + # XXXX Do textfile translation on non-mac systems + while True: + d = ifp.read(128000) + if not d: break + ofp.write(d) + ofp.close_data() + + ifp = openrsrc(inp, 'rb') + while True: + d = ifp.read(128000) + if not d: break + ofp.write_rsrc(d) + ofp.close() + ifp.close() + +class _Hqxdecoderengine: + """Read data via the decoder in 4-byte chunks""" + + def __init__(self, ifp): + self.ifp = ifp + self.eof = 0 + + def read(self, totalwtd): + """Read at least wtd bytes (or until EOF)""" + decdata = b'' + wtd = totalwtd + # + # The loop here is convoluted, since we don't really now how + # much to decode: there may be newlines in the incoming data. + while wtd > 0: + if self.eof: return decdata + wtd = ((wtd + 2) // 3) * 4 + data = self.ifp.read(wtd) + # + # Next problem: there may not be a complete number of + # bytes in what we pass to a2b. Solve by yet another + # loop. + # + while True: + try: + with _ignore_deprecation_warning(): + decdatacur, self.eof = binascii.a2b_hqx(data) + break + except binascii.Incomplete: + pass + newdata = self.ifp.read(1) + if not newdata: + raise Error('Premature EOF on binhex file') + data = data + newdata + decdata = decdata + decdatacur + wtd = totalwtd - len(decdata) + if not decdata and not self.eof: + raise Error('Premature EOF on binhex file') + return decdata + + def close(self): + self.ifp.close() + +class _Rledecoderengine: + """Read data via the RLE-coder""" + + def __init__(self, ifp): + self.ifp = ifp + self.pre_buffer = b'' + self.post_buffer = b'' + self.eof = 0 + + def read(self, wtd): + if wtd > len(self.post_buffer): + self._fill(wtd - len(self.post_buffer)) + rv = self.post_buffer[:wtd] + self.post_buffer = self.post_buffer[wtd:] + return rv + + def _fill(self, wtd): + self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 4) + if self.ifp.eof: + with _ignore_deprecation_warning(): + self.post_buffer = self.post_buffer + \ + binascii.rledecode_hqx(self.pre_buffer) + self.pre_buffer = b'' + return + + # + # Obfuscated code ahead. We have to take care that we don't + # end up with an orphaned RUNCHAR later on. So, we keep a couple + # of bytes in the buffer, depending on what the end of + # the buffer looks like: + # '\220\0\220' - Keep 3 bytes: repeated \220 (escaped as \220\0) + # '?\220' - Keep 2 bytes: repeated something-else + # '\220\0' - Escaped \220: Keep 2 bytes. + # '?\220?' - Complete repeat sequence: decode all + # otherwise: keep 1 byte. + # + mark = len(self.pre_buffer) + if self.pre_buffer[-3:] == RUNCHAR + b'\0' + RUNCHAR: + mark = mark - 3 + elif self.pre_buffer[-1:] == RUNCHAR: + mark = mark - 2 + elif self.pre_buffer[-2:] == RUNCHAR + b'\0': + mark = mark - 2 + elif self.pre_buffer[-2:-1] == RUNCHAR: + pass # Decode all + else: + mark = mark - 1 + + with _ignore_deprecation_warning(): + self.post_buffer = self.post_buffer + \ + binascii.rledecode_hqx(self.pre_buffer[:mark]) + self.pre_buffer = self.pre_buffer[mark:] + + def close(self): + self.ifp.close() + +class HexBin: + def __init__(self, ifp): + if isinstance(ifp, str): + ifp = io.open(ifp, 'rb') + # + # Find initial colon. + # + while True: + ch = ifp.read(1) + if not ch: + raise Error("No binhex data found") + # Cater for \r\n terminated lines (which show up as \n\r, hence + # all lines start with \r) + if ch == b'\r': + continue + if ch == b':': + break + + hqxifp = _Hqxdecoderengine(ifp) + self.ifp = _Rledecoderengine(hqxifp) + self.crc = 0 + self._readheader() + + def _read(self, len): + data = self.ifp.read(len) + self.crc = binascii.crc_hqx(data, self.crc) + return data + + def _checkcrc(self): + filecrc = struct.unpack('>h', self.ifp.read(2))[0] & 0xffff + #self.crc = binascii.crc_hqx('\0\0', self.crc) + # XXXX Is this needed?? + self.crc = self.crc & 0xffff + if filecrc != self.crc: + raise Error('CRC error, computed %x, read %x' + % (self.crc, filecrc)) + self.crc = 0 + + def _readheader(self): + len = self._read(1) + fname = self._read(ord(len)) + rest = self._read(1 + 4 + 4 + 2 + 4 + 4) + self._checkcrc() + + type = rest[1:5] + creator = rest[5:9] + flags = struct.unpack('>h', rest[9:11])[0] + self.dlen = struct.unpack('>l', rest[11:15])[0] + self.rlen = struct.unpack('>l', rest[15:19])[0] + + self.FName = fname + self.FInfo = FInfo() + self.FInfo.Creator = creator + self.FInfo.Type = type + self.FInfo.Flags = flags + + self.state = _DID_HEADER + + def read(self, *n): + if self.state != _DID_HEADER: + raise Error('Read data at wrong time') + if n: + n = n[0] + n = min(n, self.dlen) + else: + n = self.dlen + rv = b'' + while len(rv) < n: + rv = rv + self._read(n-len(rv)) + self.dlen = self.dlen - n + return rv + + def close_data(self): + if self.state != _DID_HEADER: + raise Error('close_data at wrong time') + if self.dlen: + dummy = self._read(self.dlen) + self._checkcrc() + self.state = _DID_DATA + + def read_rsrc(self, *n): + if self.state == _DID_HEADER: + self.close_data() + if self.state != _DID_DATA: + raise Error('Read resource data at wrong time') + if n: + n = n[0] + n = min(n, self.rlen) + else: + n = self.rlen + self.rlen = self.rlen - n + return self._read(n) + + def close(self): + if self.state is None: + return + try: + if self.rlen: + dummy = self.read_rsrc(self.rlen) + self._checkcrc() + finally: + self.state = None + self.ifp.close() + +def hexbin(inp, out): + """hexbin(infilename, outfilename) - Decode binhexed file""" + ifp = HexBin(inp) + finfo = ifp.FInfo + if not out: + out = ifp.FName + + with io.open(out, 'wb') as ofp: + # XXXX Do translation on non-mac systems + while True: + d = ifp.read(128000) + if not d: break + ofp.write(d) + ifp.close_data() + + d = ifp.read_rsrc(128000) + if d: + ofp = openrsrc(out, 'wb') + ofp.write(d) + while True: + d = ifp.read_rsrc(128000) + if not d: break + ofp.write(d) + ofp.close() + + ifp.close() diff --git a/shared/package-files/34/3471b6140eadc6412277dbbefe3fef8c345a0f1a59776086b80a3618c3a83e3b/blob b/shared/package-files/34/3471b6140eadc6412277dbbefe3fef8c345a0f1a59776086b80a3618c3a83e3b/blob new file mode 100644 index 0000000000000000000000000000000000000000..031cb77c17ba8d8a983448268851d612e05e80d1 Binary files /dev/null and b/shared/package-files/34/3471b6140eadc6412277dbbefe3fef8c345a0f1a59776086b80a3618c3a83e3b/blob differ diff --git a/shared/package-files/34/34728ee514a67f89049d2db57dc79a0fbc8dfd83609680835ca04fe64b868d46/blob b/shared/package-files/34/34728ee514a67f89049d2db57dc79a0fbc8dfd83609680835ca04fe64b868d46/blob new file mode 100644 index 0000000000000000000000000000000000000000..1861e9b0cc2ff59230fb7766915c09e68a27dab2 --- /dev/null +++ b/shared/package-files/34/34728ee514a67f89049d2db57dc79a0fbc8dfd83609680835ca04fe64b868d46/blob @@ -0,0 +1,744 @@ +import numpy as np +import operator +from collections import namedtuple + +from numba.core import types, utils +from numba.core.typing.templates import (AttributeTemplate, AbstractTemplate, + infer, infer_global, infer_getattr, + signature, bound_function) +# import time side effect: array operations requires typing support of sequence +# defined in collections: e.g. array.shape[i] +from numba.core.typing import collections +from numba.core.errors import (TypingError, RequireLiteralValue, NumbaTypeError, + NumbaNotImplementedError, NumbaAssertionError, + NumbaKeyError, NumbaIndexError, NumbaValueError) +from numba.core.cgutils import is_nonelike + +numpy_version = tuple(map(int, np.__version__.split('.')[:2])) + + +Indexing = namedtuple("Indexing", ("index", "result", "advanced")) + + +def get_array_index_type(ary, idx): + """ + Returns None or a tuple-3 for the types of the input array, index, and + resulting type of ``array[index]``. + + Note: This is shared logic for ndarray getitem and setitem. + """ + if not isinstance(ary, types.Buffer): + return + + ndim = ary.ndim + + left_indices = [] + right_indices = [] + ellipsis_met = False + advanced = False + num_newaxis = 0 + + if not isinstance(idx, types.BaseTuple): + idx = [idx] + + # Here, a subspace is considered as a contiguous group of advanced indices. + # num_subspaces keeps track of the number of such + # contiguous groups. + in_subspace = False + num_subspaces = 0 + array_indices = [] + + # Walk indices + for ty in idx: + if ty is types.ellipsis: + if ellipsis_met: + raise NumbaTypeError( + "Only one ellipsis allowed in array indices " + "(got %s)" % (idx,)) + ellipsis_met = True + in_subspace = False + elif isinstance(ty, types.SliceType): + # If we encounter a non-advanced index while in a + # subspace then that subspace ends. + in_subspace = False + # In advanced indexing, any index broadcastable to an + # array is considered an advanced index. Hence all the + # branches below are considered as advanced indices. + elif isinstance(ty, (types.Integer, types.IntEnumMember)): + # Normalize integer index + # if ty is an instance of IntEnumMember, we can treat it as Integer + if isinstance(ty, types.IntEnumMember): + ty = types.intp + else: + ty = types.intp if ty.signed else types.uintp + # Integer indexing removes the given dimension + ndim -= 1 + # If we're within a subspace/contiguous group of + # advanced indices then no action is necessary + # since we've already counted that subspace once. + if not in_subspace: + # If we're not within a subspace and we encounter + # this branch then we have a new subspace/group. + num_subspaces += 1 + in_subspace = True + elif (isinstance(ty, types.Array) and ty.ndim == 0 + and isinstance(ty.dtype, types.Integer)): + # 0-d array used as integer index + ndim -= 1 + if not in_subspace: + num_subspaces += 1 + in_subspace = True + elif (isinstance(ty, types.Array) + and isinstance(ty.dtype, (types.Integer, types.Boolean))): + array_indices.append(ty.ndim) + advanced = True + ndim -= 1 + if not in_subspace: + num_subspaces += 1 + in_subspace = True + elif (is_nonelike(ty)): + ndim += 1 + num_newaxis += 1 + else: + raise NumbaTypeError("Unsupported array index type %s in %s" + % (ty, idx)) + (right_indices if ellipsis_met else left_indices).append(ty) + + if advanced: + ndim += max(array_indices) + + # Only Numpy arrays support advanced indexing + if advanced and not isinstance(ary, types.Array): + return + + # Check indices and result dimensionality + all_indices = left_indices + right_indices + if ellipsis_met: + assert right_indices[0] is types.ellipsis + del right_indices[0] + + n_indices = len(all_indices) - ellipsis_met - num_newaxis + if n_indices > ary.ndim: + raise NumbaTypeError("cannot index %s with %d indices: %s" + % (ary, n_indices, idx)) + if n_indices == ary.ndim and ndim == 0 and not ellipsis_met: + # Full integer indexing => scalar result + # (note if ellipsis is present, a 0-d view is returned instead) + res = ary.dtype + + elif advanced: + # Result is a copy + res = ary.copy(ndim=ndim, layout='C', readonly=False) + + else: + # Result is a view + if ary.slice_is_copy: + # Avoid view semantics when the original type creates a copy + # when slicing. + return + + # Infer layout + layout = ary.layout + + def keeps_contiguity(ty, is_innermost): + # A slice can only keep an array contiguous if it is the + # innermost index and it is not strided. A newaxis (None) + # index never affects contiguity, as it just inserts a new + # dimension of size 1 without touching the underlying data. + return (ty is types.ellipsis or isinstance(ty, types.Integer) + or is_nonelike(ty) + or (is_innermost and isinstance(ty, types.SliceType) + and not ty.has_step)) + + def check_contiguity(outer_indices): + """ + Whether indexing with the given indices (from outer to inner in + physical layout order) can keep an array contiguous. + """ + for i, ty in enumerate(outer_indices[:-1]): + # An index is still "innermost" for contiguity purposes if + # every index after it is a newaxis, since those don't + # correspond to any physical dimension of the source array. + is_innermost = all( + is_nonelike(t) for t in outer_indices[i + 1:] + ) + if not keeps_contiguity(ty, is_innermost): + return False + if outer_indices and not keeps_contiguity(outer_indices[-1], True): + return False + return True + + if layout == 'C': + # Integer indexing on the left keeps the array C-contiguous + if n_indices == ary.ndim: + # If all indices are there, ellipsis's place is indifferent + left_indices = left_indices + right_indices + right_indices = [] + if right_indices: + layout = 'A' + elif not check_contiguity(left_indices): + layout = 'A' + elif layout == 'F': + # Integer indexing on the right keeps the array F-contiguous + if n_indices == ary.ndim: + # If all indices are there, ellipsis's place is indifferent + right_indices = left_indices + right_indices + left_indices = [] + if left_indices: + layout = 'A' + elif not check_contiguity(right_indices[::-1]): + layout = 'A' + + if ndim == 0: + # Implicitly convert to a scalar if the output ndim==0 + res = ary.dtype + else: + res = ary.copy(ndim=ndim, layout=layout) + + # Re-wrap indices + if isinstance(idx, types.BaseTuple): + idx = types.BaseTuple.from_types(all_indices) + else: + idx, = all_indices + + return Indexing(idx, res, advanced) + + +@infer_global(operator.getitem) +class GetItemBuffer(AbstractTemplate): + def generic(self, args, kws): + assert not kws + [ary, idx] = args + out = get_array_index_type(ary, idx) + if out is not None: + return signature(out.result, ary, out.index) + + +@infer_global(operator.setitem) +class SetItemBuffer(AbstractTemplate): + def generic(self, args, kws): + assert not kws + ary, idx, val = args + if not isinstance(ary, types.Buffer): + return + if not ary.mutable: + msg = f"Cannot modify readonly array of type: {ary}" + raise NumbaTypeError(msg) + out = get_array_index_type(ary, idx) + if out is None: + return + + idx = out.index + res = out.result # res is the result type of the access ary[idx] + if isinstance(res, types.Array): + # Indexing produces an array + if isinstance(val, types.Array): + if not self.context.can_convert(val.dtype, res.dtype): + # DType conversion not possible + return + else: + res = val + elif isinstance(val, types.Sequence): + if (res.ndim == 1 and + self.context.can_convert(val.dtype, res.dtype)): + # Allow assignment of sequence to 1d array + res = val + else: + # NOTE: sequence-to-array broadcasting is unsupported + return + else: + # Allow scalar broadcasting + if self.context.can_convert(val, res.dtype): + res = res.dtype + else: + # Incompatible scalar type + return + elif not isinstance(val, types.Array): + # Single item assignment + if not self.context.can_convert(val, res): + # if the array dtype is not yet defined + if not res.is_precise(): + # set the array type to use the dtype of value (RHS) + newary = ary.copy(dtype=val) + return signature(types.none, newary, idx, res) + else: + return + res = val + elif (isinstance(val, types.Array) and val.ndim == 0 + and self.context.can_convert(val.dtype, res)): + # val is an array(T, 0d, O), where T is the type of res, O is order + res = val + else: + return + return signature(types.none, ary, idx, res) + + +def normalize_shape(shape): + if isinstance(shape, types.UniTuple): + if isinstance(shape.dtype, types.Integer): + dimtype = types.intp if shape.dtype.signed else types.uintp + return types.UniTuple(dimtype, len(shape)) + + elif isinstance(shape, types.Tuple) and shape.count == 0: + # Force (0 x intp) for consistency with other shapes + return types.UniTuple(types.intp, 0) + + +@infer_getattr +class ArrayAttribute(AttributeTemplate): + key = types.Array + + def resolve_dtype(self, ary): + return types.DType(ary.dtype) + + def resolve_nbytes(self, ary): + return types.intp + + def resolve_itemsize(self, ary): + return types.intp + + def resolve_shape(self, ary): + return types.UniTuple(types.intp, ary.ndim) + + def resolve_strides(self, ary): + return types.UniTuple(types.intp, ary.ndim) + + def resolve_ndim(self, ary): + return types.intp + + def resolve_size(self, ary): + return types.intp + + def resolve_flat(self, ary): + return types.NumpyFlatType(ary) + + def resolve_ctypes(self, ary): + return types.ArrayCTypes(ary) + + def resolve_flags(self, ary): + return types.ArrayFlags(ary) + + def resolve_T(self, ary): + if ary.ndim <= 1: + retty = ary + else: + layout = {"C": "F", "F": "C"}.get(ary.layout, "A") + retty = ary.copy(layout=layout) + return retty + + def resolve_real(self, ary): + return self._resolve_real_imag(ary, attr='real') + + def resolve_imag(self, ary): + return self._resolve_real_imag(ary, attr='imag') + + def _resolve_real_imag(self, ary, attr): + if ary.dtype in types.complex_domain: + return ary.copy(dtype=ary.dtype.underlying_float, layout='A') + elif ary.dtype in types.number_domain: + res = ary.copy(dtype=ary.dtype) + if attr == 'imag': + res = res.copy(readonly=True) + return res + else: + msg = "cannot access .{} of array of {}" + raise TypingError(msg.format(attr, ary.dtype)) + + @bound_function("array.transpose") + def resolve_transpose(self, ary, args, kws): + def sentry_shape_scalar(ty): + if ty in types.number_domain: + # Guard against non integer type + if not isinstance(ty, types.Integer): + msg = "transpose() arg cannot be {0}".format(ty) + raise TypingError(msg) + return True + else: + return False + + assert not kws + if len(args) == 0: + return signature(self.resolve_T(ary)) + + if len(args) == 1: + shape, = args + + if sentry_shape_scalar(shape): + assert ary.ndim == 1 + return signature(ary, *args) + + if isinstance(shape, types.NoneType): + return signature(self.resolve_T(ary)) + + shape = normalize_shape(shape) + if shape is None: + return + + assert ary.ndim == shape.count + return signature(self.resolve_T(ary).copy(layout="A"), shape) + + else: + if any(not sentry_shape_scalar(a) for a in args): + msg = "transpose({0}) is not supported".format( + ', '.join(args)) + raise TypingError(msg) + assert ary.ndim == len(args) + return signature(self.resolve_T(ary).copy(layout="A"), *args) + + @bound_function("array.copy") + def resolve_copy(self, ary, args, kws): + assert not args + assert not kws + retty = ary.copy(layout="C", readonly=False) + return signature(retty) + + @bound_function("array.item") + def resolve_item(self, ary, args, kws): + assert not kws + # We don't support explicit arguments as that's exactly equivalent + # to regular indexing. The no-argument form is interesting to + # allow some degree of genericity when writing functions. + if not args: + return signature(ary.dtype) + + if numpy_version < (2, 0): + @bound_function("array.itemset") + def resolve_itemset(self, ary, args, kws): + assert not kws + # We don't support explicit arguments as that's exactly equivalent + # to regular indexing. The no-argument form is interesting to + # allow some degree of genericity when writing functions. + if len(args) == 1: + return signature(types.none, ary.dtype) + + @bound_function("array.nonzero") + def resolve_nonzero(self, ary, args, kws): + assert not args + assert not kws + if ary.ndim == 0 and numpy_version >= (2, 1): + raise NumbaValueError( + "Calling nonzero on 0d arrays is not allowed." + " Use np.atleast_1d(scalar).nonzero() instead." + ) + # 0-dim arrays return one result array + ndim = max(ary.ndim, 1) + retty = types.UniTuple(types.Array(types.intp, 1, 'C'), ndim) + return signature(retty) + + @bound_function("array.reshape") + def resolve_reshape(self, ary, args, kws): + def sentry_shape_scalar(ty): + if ty in types.number_domain: + # Guard against non integer type + if not isinstance(ty, types.Integer): + raise TypingError("reshape() arg cannot be {0}".format(ty)) + return True + else: + return False + + assert not kws + if ary.layout not in 'CF': + # only work for contiguous array + raise TypingError("reshape() supports contiguous array only") + + if len(args) == 1: + # single arg + shape, = args + + if sentry_shape_scalar(shape): + ndim = 1 + else: + shape = normalize_shape(shape) + if shape is None: + return + ndim = shape.count + retty = ary.copy(ndim=ndim) + return signature(retty, shape) + + elif len(args) == 0: + # no arg + raise TypingError("reshape() take at least one arg") + + else: + # vararg case + if any(not sentry_shape_scalar(a) for a in args): + raise TypingError("reshape({0}) is not supported".format( + ', '.join(map(str, args)))) + + retty = ary.copy(ndim=len(args)) + return signature(retty, *args) + + @bound_function("array.sort") + def resolve_sort(self, ary, args, kws): + assert not args + kwargs = dict(kws) + kind = kwargs.pop('kind', types.StringLiteral('quicksort')) + if not isinstance(kind, types.StringLiteral): + raise TypingError('"kind" must be a string literal') + if kind.literal_value not in ('quicksort', 'mergesort', 'stable'): + msg = 'Unsupported "kind": {!r}' + raise TypingError(msg.format(kind.literal_value)) + if kwargs: + msg = "Unsupported keywords: {!r}" + raise TypingError(msg.format([k for k in kwargs.keys()])) + def sort_stub(kind='quicksort'): + pass + pysig = utils.pysignature(sort_stub) + return signature(types.none, kind).replace(pysig=pysig) + + @bound_function("array.argsort") + def resolve_argsort(self, ary, args, kws): + assert not args + kwargs = dict(kws) + kind = kwargs.pop('kind', types.StringLiteral('quicksort')) + if not isinstance(kind, types.StringLiteral): + raise TypingError('"kind" must be a string literal') + if kind.literal_value not in ('quicksort', 'mergesort', 'stable'): + msg = 'Unsupported "kind": {!r}' + raise TypingError(msg.format(kind.literal_value)) + if kwargs: + msg = "Unsupported keywords: {!r}" + raise TypingError(msg.format([k for k in kwargs.keys()])) + if ary.ndim == 1: + def argsort_stub(kind='quicksort'): + pass + pysig = utils.pysignature(argsort_stub) + sig = signature(types.Array(types.intp, 1, 'C'), kind).replace(pysig=pysig) + return sig + + @bound_function("array.view") + def resolve_view(self, ary, args, kws): + from .npydecl import parse_dtype + assert not kws + dtype, = args + dtype = parse_dtype(dtype) + if dtype is None: + return + retty = ary.copy(dtype=dtype) + return signature(retty, *args) + + @bound_function("array.astype") + def resolve_astype(self, ary, args, kws): + from .npydecl import parse_dtype + assert not kws + dtype, = args + if isinstance(dtype, types.UnicodeType): + raise RequireLiteralValue(("array.astype if dtype is a string it " + "must be constant")) + dtype = parse_dtype(dtype) + if dtype is None: + return + if not self.context.can_convert(ary.dtype, dtype): + raise TypingError("astype(%s) not supported on %s: " + "cannot convert from %s to %s" + % (dtype, ary, ary.dtype, dtype)) + layout = ary.layout if ary.layout in 'CF' else 'C' + # reset the write bit irrespective of whether the cast type is the same + # as the current dtype, this replicates numpy + retty = ary.copy(dtype=dtype, layout=layout, readonly=False) + return signature(retty, *args) + + @bound_function("array.ravel") + def resolve_ravel(self, ary, args, kws): + # Only support no argument version (default order='C') + assert not kws + assert not args + copy_will_be_made = ary.layout != 'C' + readonly = not (copy_will_be_made or ary.mutable) + return signature(ary.copy(ndim=1, layout='C', readonly=readonly)) + + @bound_function("array.flatten") + def resolve_flatten(self, ary, args, kws): + # Only support no argument version (default order='C') + assert not kws + assert not args + # To ensure that Numba behaves exactly like NumPy, + # we also clear the read-only flag when doing a "flatten" + # Why? Two reasons: + # Because flatten always returns a copy. (see NumPy docs for "flatten") + # And because a copy always returns a writeable array. + # ref: https://numpy.org/doc/stable/reference/generated/numpy.copy.html + return signature(ary.copy(ndim=1, layout='C', readonly=False)) + + def generic_resolve(self, ary, attr): + # Resolution of other attributes, for record arrays + if isinstance(ary.dtype, types.Record): + if attr in ary.dtype.fields: + attr_dtype = ary.dtype.typeof(attr) + if isinstance(attr_dtype, types.NestedArray): + return ary.copy( + dtype=attr_dtype.dtype, + ndim=ary.ndim + attr_dtype.ndim, + layout='A' + ) + else: + return ary.copy(dtype=attr_dtype, layout='A') + + +@infer_getattr +class DTypeAttr(AttributeTemplate): + key = types.DType + + def resolve_type(self, ary): + # Wrap the numeric type in NumberClass + return types.NumberClass(ary.dtype) + + def resolve_kind(self, ary): + if isinstance(ary.key, types.scalars.Float): + val = 'f' + elif isinstance(ary.key, types.scalars.Integer): + val = 'i' + else: + return None # other types not supported yet + return types.StringLiteral(val) + + +@infer +class StaticGetItemArray(AbstractTemplate): + key = "static_getitem" + + def generic(self, args, kws): + # Resolution of members for record and structured arrays + ary, idx = args + if (isinstance(ary, types.Array) and isinstance(idx, str) and + isinstance(ary.dtype, types.Record)): + if idx in ary.dtype.fields: + attr_dtype = ary.dtype.typeof(idx) + if isinstance(attr_dtype, types.NestedArray): + ret = ary.copy( + dtype=attr_dtype.dtype, + ndim=ary.ndim + attr_dtype.ndim, + layout='A' + ) + return signature(ret, *args) + else: + ret = ary.copy(dtype=attr_dtype, layout='A') + return signature(ret, *args) + + +@infer_getattr +class RecordAttribute(AttributeTemplate): + key = types.Record + + def generic_resolve(self, record, attr): + ret = record.typeof(attr) + assert ret + return ret + + +@infer +class StaticGetItemRecord(AbstractTemplate): + key = "static_getitem" + + def generic(self, args, kws): + # Resolution of members for records + record, idx = args + if isinstance(record, types.Record) and isinstance(idx, str): + if idx not in record.fields: + raise NumbaKeyError(f"Field '{idx}' was not found in record " + "with fields " + f"{tuple(record.fields.keys())}") + ret = record.typeof(idx) + assert ret + return signature(ret, *args) + + +@infer_global(operator.getitem) +class StaticGetItemLiteralRecord(AbstractTemplate): + def generic(self, args, kws): + # Resolution of members for records + record, idx = args + if isinstance(record, types.Record): + if isinstance(idx, types.StringLiteral): + if idx.literal_value not in record.fields: + msg = (f"Field '{idx.literal_value}' was not found in " + f"record with fields {tuple(record.fields.keys())}") + raise NumbaKeyError(msg) + ret = record.typeof(idx.literal_value) + assert ret + return signature(ret, *args) + elif isinstance(idx, types.IntegerLiteral): + if idx.literal_value >= len(record.fields): + msg = f"Requested index {idx.literal_value} is out of range" + raise NumbaIndexError(msg) + field_names = list(record.fields) + ret = record.typeof(field_names[idx.literal_value]) + assert ret + return signature(ret, *args) + + +@infer +class StaticSetItemRecord(AbstractTemplate): + key = "static_setitem" + + def generic(self, args, kws): + # Resolution of members for record and structured arrays + record, idx, value = args + if isinstance(record, types.Record): + if isinstance(idx, str): + expectedty = record.typeof(idx) + if self.context.can_convert(value, expectedty) is not None: + return signature(types.void, record, types.literal(idx), + value) + elif isinstance(idx, int): + if idx >= len(record.fields): + msg = f"Requested index {idx} is out of range" + raise NumbaIndexError(msg) + str_field = list(record.fields)[idx] + expectedty = record.typeof(str_field) + if self.context.can_convert(value, expectedty) is not None: + return signature(types.void, record, types.literal(idx), + value) + + +@infer_global(operator.setitem) +class StaticSetItemLiteralRecord(AbstractTemplate): + def generic(self, args, kws): + # Resolution of members for records + target, idx, value = args + if isinstance(target, types.Record) and isinstance(idx, types.StringLiteral): + if idx.literal_value not in target.fields: + msg = (f"Field '{idx.literal_value}' was not found in record " + f"with fields {tuple(target.fields.keys())}") + raise NumbaKeyError(msg) + expectedty = target.typeof(idx.literal_value) + if self.context.can_convert(value, expectedty) is not None: + return signature(types.void, target, idx, value) + + +@infer_getattr +class ArrayCTypesAttribute(AttributeTemplate): + key = types.ArrayCTypes + + def resolve_data(self, ctinfo): + return types.uintp + + +@infer_getattr +class ArrayFlagsAttribute(AttributeTemplate): + key = types.ArrayFlags + + def resolve_contiguous(self, ctflags): + return types.boolean + + def resolve_c_contiguous(self, ctflags): + return types.boolean + + def resolve_f_contiguous(self, ctflags): + return types.boolean + + +@infer_getattr +class NestedArrayAttribute(ArrayAttribute): + key = types.NestedArray + + +@infer_global(operator.eq) +class CmpOpEqArray(AbstractTemplate): + #key = operator.eq + + def generic(self, args, kws): + assert not kws + [va, vb] = args + if isinstance(va, types.Array) and va == vb: + return signature(va.copy(dtype=types.boolean), va, vb) diff --git a/shared/package-files/34/3476a6383ba3480ab522b6ed149e47b840dcb85a63343b73b588c25e5663c984/blob b/shared/package-files/34/3476a6383ba3480ab522b6ed149e47b840dcb85a63343b73b588c25e5663c984/blob new file mode 100644 index 0000000000000000000000000000000000000000..11e88625d1db4258561254ff7eda958c53efdccf --- /dev/null +++ b/shared/package-files/34/3476a6383ba3480ab522b6ed149e47b840dcb85a63343b73b588c25e5663c984/blob @@ -0,0 +1,124 @@ +""" Import Qt in a manner suitable for an IPython kernel. + +This is the import used for the `gui=qt` or `matplotlib=qt` initialization. + +Import Priority: + +if Qt has been imported anywhere else: + use that + +if matplotlib has been imported and doesn't support v2 (<= 1.0.1): + use PyQt4 @v1 + +Next, ask QT_API env variable + +if QT_API not set: + ask matplotlib what it's using. If Qt4Agg or Qt5Agg, then use the + version matplotlib is configured with + + else: (matplotlib said nothing) + # this is the default path - nobody told us anything + try in this order: + PyQt default version, PySide, PyQt5 +else: + use what QT_API says + + Note that %gui's implementation will always set a `QT_API`, see + `IPython.terminal.pt_inputhooks.get_inputhook_name_and_func` + +""" +# NOTE: This is no longer an external, third-party module, and should be +# considered part of IPython. For compatibility however, it is being kept in +# IPython/external. + +import os +import sys + +from IPython.external.qt_loaders import ( + load_qt, + loaded_api, + enum_factory, + # QT6 + QT_API_PYQT6, + QT_API_PYSIDE6, + # QT5 + QT_API_PYQT5, + QT_API_PYSIDE2, + # QT4 + QT_API_PYQT, + QT_API_PYSIDE, + # default + QT_API_PYQT_DEFAULT, +) + +_qt_apis = ( + # QT6 + QT_API_PYQT6, + QT_API_PYSIDE6, + # QT5 + QT_API_PYQT5, + QT_API_PYSIDE2, + # default + QT_API_PYQT_DEFAULT, +) + + +def matplotlib_options(mpl): + """Constraints placed on an imported matplotlib.""" + if mpl is None: + return + backend = mpl.rcParams.get('backend', None) + if backend == 'Qt4Agg': + mpqt = mpl.rcParams.get('backend.qt4', None) + if mpqt is None: + return None + if mpqt.lower() == 'pyside': + return [QT_API_PYSIDE] + elif mpqt.lower() == 'pyqt4': + return [QT_API_PYQT_DEFAULT] + elif mpqt.lower() == 'pyqt4v2': + return [QT_API_PYQT] + raise ImportError("unhandled value for backend.qt4 from matplotlib: %r" % + mpqt) + elif backend == 'Qt5Agg': + mpqt = mpl.rcParams.get('backend.qt5', None) + if mpqt is None: + return None + if mpqt.lower() == 'pyqt5': + return [QT_API_PYQT5] + raise ImportError("unhandled value for backend.qt5 from matplotlib: %r" % + mpqt) + +def get_options(): + """Return a list of acceptable QT APIs, in decreasing order of preference.""" + #already imported Qt somewhere. Use that + loaded = loaded_api() + if loaded is not None: + return [loaded] + + mpl = sys.modules.get("matplotlib", None) + + if mpl is not None and tuple(mpl.__version__.split(".")) < ("1", "0", "2"): + # 1.0.1 only supports PyQt4 v1 + return [QT_API_PYQT_DEFAULT] + + qt_api = os.environ.get('QT_API', None) + if qt_api is None: + #no ETS variable. Ask mpl, then use default fallback path + return matplotlib_options(mpl) or [ + QT_API_PYQT_DEFAULT, + QT_API_PYQT6, + QT_API_PYSIDE6, + QT_API_PYQT5, + QT_API_PYSIDE2, + ] + elif qt_api not in _qt_apis: + raise RuntimeError("Invalid Qt API %r, valid values are: %r" % + (qt_api, ', '.join(_qt_apis))) + else: + return [qt_api] + + +api_opts = get_options() +QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts) +enum_helper = enum_factory(QT_API, QtCore) diff --git a/shared/package-files/34/3478368a5fac6ef11814a044488d8fa1d72357b3c99f4fe03b0864a260e06ce0/blob b/shared/package-files/34/3478368a5fac6ef11814a044488d8fa1d72357b3c99f4fe03b0864a260e06ce0/blob new file mode 100644 index 0000000000000000000000000000000000000000..dfe4c1f6f7da435fd0c9ab1ae62496452cb5702e Binary files /dev/null and b/shared/package-files/34/3478368a5fac6ef11814a044488d8fa1d72357b3c99f4fe03b0864a260e06ce0/blob differ diff --git a/shared/package-files/34/34799b6c13e99c8ccb37b25164d3350633b0307b6364e780c13c77c7c732d209/blob b/shared/package-files/34/34799b6c13e99c8ccb37b25164d3350633b0307b6364e780c13c77c7c732d209/blob new file mode 100644 index 0000000000000000000000000000000000000000..7785e6643a7327822b3fb18026f0fbfdd2e28781 --- /dev/null +++ b/shared/package-files/34/34799b6c13e99c8ccb37b25164d3350633b0307b6364e780c13c77c7c732d209/blob @@ -0,0 +1,26 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeimplicitautograd { + +TORCH_API at::Tensor arctanh(const at::Tensor & self); +TORCH_API at::Tensor & arctanh_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & arctanh_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API at::Tensor & arctanh_(at::Tensor & self); + +} // namespace compositeimplicitautograd +} // namespace at diff --git a/shared/package-files/34/347bf426685a80f1659a3f88609acee63c09b1e5495c406f4610d11ada47bbfa/blob b/shared/package-files/34/347bf426685a80f1659a3f88609acee63c09b1e5495c406f4610d11ada47bbfa/blob new file mode 100644 index 0000000000000000000000000000000000000000..71880dcdaa8b006dea6eeb2529fab2a4a2a61914 Binary files /dev/null and b/shared/package-files/34/347bf426685a80f1659a3f88609acee63c09b1e5495c406f4610d11ada47bbfa/blob differ diff --git a/shared/package-files/34/347c4ca3bb09091c12653f0d4a4796363333def1ffb7650a503222ffb4f7c522/blob b/shared/package-files/34/347c4ca3bb09091c12653f0d4a4796363333def1ffb7650a503222ffb4f7c522/blob new file mode 100644 index 0000000000000000000000000000000000000000..d27a72f5ceddec909cedea1db65697dede3d5edf --- /dev/null +++ b/shared/package-files/34/347c4ca3bb09091c12653f0d4a4796363333def1ffb7650a503222ffb4f7c522/blob @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:347c4ca3bb09091c12653f0d4a4796363333def1ffb7650a503222ffb4f7c522 +size 254040 diff --git a/shared/package-files/34/3480b75989c634f671266de4f019ace40e70b60f0e5e3d658bd24f6dd3d21b10/blob b/shared/package-files/34/3480b75989c634f671266de4f019ace40e70b60f0e5e3d658bd24f6dd3d21b10/blob new file mode 100644 index 0000000000000000000000000000000000000000..7626514022216e00d6b3524a9010df39531087ef --- /dev/null +++ b/shared/package-files/34/3480b75989c634f671266de4f019ace40e70b60f0e5e3d658bd24f6dd3d21b10/blob @@ -0,0 +1,252 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "arrow/util/span.h" + +#include "parquet/column_writer.h" +#include "parquet/file_writer.h" + +namespace parquet { + +/// \brief A class for writing Parquet files using an output stream type API. +/// +/// The values given must be of the correct type i.e. the type must +/// match the file schema exactly otherwise a ParquetException will be +/// thrown. +/// +/// The user must explicitly indicate the end of the row using the +/// EndRow() function or EndRow output manipulator. +/// +/// A maximum row group size can be configured, the default size is +/// 512MB. Alternatively the row group size can be set to zero and the +/// user can create new row groups by calling the EndRowGroup() +/// function or using the EndRowGroup output manipulator. +/// +/// Required and optional fields are supported: +/// - Required fields are written using operator<<(T) +/// - Optional fields are written using +/// operator<<(std::optional). +/// +/// Note that operator<<(T) can be used to write optional fields. +/// +/// Similarly, operator<<(std::optional) can be used to +/// write required fields. However if the optional parameter does not +/// have a value (i.e. it is nullopt) then a ParquetException will be +/// raised. +/// +/// Currently there is no support for repeated fields. +/// +class PARQUET_EXPORT StreamWriter { + public: + template + using optional = ::std::optional; + + // N.B. Default constructed objects are not usable. This + // constructor is provided so that the object may be move + // assigned afterwards. + StreamWriter() = default; + + explicit StreamWriter(std::unique_ptr writer); + + ~StreamWriter() = default; + + static void SetDefaultMaxRowGroupSize(int64_t max_size); + + void SetMaxRowGroupSize(int64_t max_size); + + int current_column() const { return column_index_; } + + int64_t current_row() const { return current_row_; } + + int num_columns() const; + + // Moving is possible. + StreamWriter(StreamWriter&&) = default; + StreamWriter& operator=(StreamWriter&&) = default; + + // Copying is not allowed. + StreamWriter(const StreamWriter&) = delete; + StreamWriter& operator=(const StreamWriter&) = delete; + + /// \brief Output operators for required fields. + /// These can also be used for optional fields when a value must be set. + StreamWriter& operator<<(bool v); + + StreamWriter& operator<<(int8_t v); + + StreamWriter& operator<<(uint8_t v); + + StreamWriter& operator<<(int16_t v); + + StreamWriter& operator<<(uint16_t v); + + StreamWriter& operator<<(int32_t v); + + StreamWriter& operator<<(uint32_t v); + + StreamWriter& operator<<(int64_t v); + + StreamWriter& operator<<(uint64_t v); + + StreamWriter& operator<<(const std::chrono::milliseconds& v); + + StreamWriter& operator<<(const std::chrono::microseconds& v); + + StreamWriter& operator<<(float v); + + StreamWriter& operator<<(double v); + + StreamWriter& operator<<(char v); + + /// \brief Helper class to write fixed length strings. + /// This is useful as the standard string view (such as + /// std::string_view) is for variable length data. + struct PARQUET_EXPORT FixedStringView { + FixedStringView() = default; + + explicit FixedStringView(const char* data_ptr); + + FixedStringView(const char* data_ptr, std::size_t data_len); + + const char* data{NULLPTR}; + std::size_t size{0}; + }; + + /// \brief Output operators for fixed length strings. + template + StreamWriter& operator<<(const char (&v)[N]) { + return WriteFixedLength(v, N); + } + template + StreamWriter& operator<<(const std::array& v) { + return WriteFixedLength(v.data(), N); + } + StreamWriter& operator<<(FixedStringView v); + + /// \brief Output operators for variable length strings. + StreamWriter& operator<<(const char* v); + StreamWriter& operator<<(const std::string& v); + StreamWriter& operator<<(::std::string_view v); + + /// \brief Helper class to write variable length raw data. + using RawDataView = ::arrow::util::span; + + /// \brief Output operators for variable length raw data. + StreamWriter& operator<<(RawDataView v); + + /// \brief Output operator for optional fields. + template + StreamWriter& operator<<(const optional& v) { + if (v) { + return operator<<(*v); + } + SkipOptionalColumn(); + return *this; + } + + /// \brief Skip the next N columns of optional data. If there are + /// less than N columns remaining then the excess columns are + /// ignored. + /// \throws ParquetException if there is an attempt to skip any + /// required column. + /// \return Number of columns actually skipped. + int64_t SkipColumns(int num_columns_to_skip); + + /// \brief Terminate the current row and advance to next one. + /// \throws ParquetException if all columns in the row were not + /// written or skipped. + void EndRow(); + + /// \brief Terminate the current row group and create new one. + void EndRowGroup(); + + protected: + template + StreamWriter& Write(const T v) { + auto writer = static_cast(row_group_writer_->column(column_index_++)); + + writer->WriteBatch(kBatchSizeOne, &kDefLevelOne, &kRepLevelZero, &v); + + if (max_row_group_size_ > 0) { + row_group_size_ += writer->estimated_buffered_value_bytes(); + } + return *this; + } + + StreamWriter& WriteVariableLength(const char* data_ptr, std::size_t data_len, + ConvertedType::type converted_type); + + StreamWriter& WriteFixedLength(const char* data_ptr, std::size_t data_len); + + void CheckColumn(Type::type physical_type, ConvertedType::type converted_type, + int length = -1); + + /// \brief Skip the next column which must be optional. + /// \throws ParquetException if the next column does not exist or is + /// not optional. + void SkipOptionalColumn(); + + void WriteNullValue(ColumnWriter* writer); + + private: + using node_ptr_type = std::shared_ptr; + + struct null_deleter { + void operator()(void*) {} + }; + + int32_t column_index_{0}; + int64_t current_row_{0}; + int64_t row_group_size_{0}; + int64_t max_row_group_size_{default_row_group_size_}; + + std::unique_ptr file_writer_; + std::unique_ptr row_group_writer_; + std::vector nodes_; + + static constexpr int16_t kDefLevelZero = 0; + static constexpr int16_t kDefLevelOne = 1; + static constexpr int16_t kRepLevelZero = 0; + static constexpr int64_t kBatchSizeOne = 1; + + static int64_t default_row_group_size_; +}; + +struct PARQUET_EXPORT EndRowType {}; +constexpr EndRowType EndRow = {}; + +struct PARQUET_EXPORT EndRowGroupType {}; +constexpr EndRowGroupType EndRowGroup = {}; + +PARQUET_EXPORT +StreamWriter& operator<<(StreamWriter&, EndRowType); + +PARQUET_EXPORT +StreamWriter& operator<<(StreamWriter&, EndRowGroupType); + +} // namespace parquet diff --git a/shared/package-files/34/3486302894d3b8a8d5c4421dcb6a57837736694c0cc95bfb49282fab11081e00/blob b/shared/package-files/34/3486302894d3b8a8d5c4421dcb6a57837736694c0cc95bfb49282fab11081e00/blob new file mode 100644 index 0000000000000000000000000000000000000000..7da07f53e388f9aeecbc6f97ba1e8ffadcc5062d --- /dev/null +++ b/shared/package-files/34/3486302894d3b8a8d5c4421dcb6a57837736694c0cc95bfb49282fab11081e00/blob @@ -0,0 +1,843 @@ +Metadata-Version: 2.1 +Name: optree +Version: 0.11.0 +Summary: Optimized PyTree Utilities. +Author: OpTree Contributors +Author-email: Xuehai Pan , Jie Ren +License: Apache License, Version 2.0 +Project-URL: Homepage, https://github.com/metaopt/optree +Project-URL: Repository, https://github.com/metaopt/optree +Project-URL: Documentation, https://optree.readthedocs.io +Project-URL: Bug Report, https://github.com/metaopt/optree/issues +Keywords: PyTree,Tree Manipulation,Tree Traversal,Functional Programming +Classifier: Development Status :: 4 - Beta +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Programming Language :: C++ +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: MacOS +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: Science/Research +Classifier: Topic :: Utilities +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: typing-extensions >=4.0.0 +Provides-Extra: benchmark +Requires-Dist: jax[cpu] <0.5.0a0,>=0.4.6 ; extra == 'benchmark' +Requires-Dist: torch <2.1.0a0,>=2.0 ; extra == 'benchmark' +Requires-Dist: torchvision ; extra == 'benchmark' +Requires-Dist: dm-tree <0.2.0a0,>=0.1 ; extra == 'benchmark' +Requires-Dist: pandas ; extra == 'benchmark' +Requires-Dist: tabulate ; extra == 'benchmark' +Requires-Dist: termcolor ; extra == 'benchmark' +Provides-Extra: docs +Requires-Dist: sphinx >=5.2.1 ; extra == 'docs' +Requires-Dist: sphinx-autoapi ; extra == 'docs' +Requires-Dist: sphinx-autobuild ; extra == 'docs' +Requires-Dist: sphinx-copybutton ; extra == 'docs' +Requires-Dist: sphinx-rtd-theme ; extra == 'docs' +Requires-Dist: sphinxcontrib-bibtex ; extra == 'docs' +Requires-Dist: sphinx-autodoc-typehints >=1.19.2 ; extra == 'docs' +Requires-Dist: docutils ; extra == 'docs' +Requires-Dist: jax[cpu] ; extra == 'docs' +Requires-Dist: numpy ; extra == 'docs' +Requires-Dist: torch ; extra == 'docs' +Provides-Extra: jax +Requires-Dist: jax ; extra == 'jax' +Provides-Extra: lint +Requires-Dist: isort >=5.11.0 ; extra == 'lint' +Requires-Dist: black >=22.6.0 ; extra == 'lint' +Requires-Dist: pylint[spelling] >=2.15.0 ; extra == 'lint' +Requires-Dist: mypy >=0.990 ; extra == 'lint' +Requires-Dist: flake8 ; extra == 'lint' +Requires-Dist: flake8-bugbear ; extra == 'lint' +Requires-Dist: flake8-comprehensions ; extra == 'lint' +Requires-Dist: flake8-docstrings ; extra == 'lint' +Requires-Dist: flake8-pyi ; extra == 'lint' +Requires-Dist: flake8-simplify ; extra == 'lint' +Requires-Dist: ruff ; extra == 'lint' +Requires-Dist: doc8 <1.0.0a0 ; extra == 'lint' +Requires-Dist: pydocstyle ; extra == 'lint' +Requires-Dist: pyenchant ; extra == 'lint' +Requires-Dist: xdoctest ; extra == 'lint' +Requires-Dist: cpplint ; extra == 'lint' +Requires-Dist: pre-commit ; extra == 'lint' +Provides-Extra: numpy +Requires-Dist: numpy ; extra == 'numpy' +Provides-Extra: test +Requires-Dist: pytest ; extra == 'test' +Requires-Dist: pytest-cov ; extra == 'test' +Requires-Dist: pytest-xdist ; extra == 'test' +Provides-Extra: torch +Requires-Dist: torch ; extra == 'torch' + + + +# OpTree + +![Python 3.7+](https://img.shields.io/badge/Python-3.7%2B-brightgreen) +[![PyPI](https://img.shields.io/pypi/v/optree?logo=pypi)](https://pypi.org/project/optree) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/metaopt/optree/build.yml?label=build&logo=github) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/metaopt/optree/tests.yml?label=tests&logo=github) +[![Codecov](https://img.shields.io/codecov/c/github/metaopt/optree/main?logo=codecov)](https://codecov.io/gh/metaopt/optree) +[![Documentation Status](https://img.shields.io/readthedocs/optree?logo=readthedocs)](https://optree.readthedocs.io) +[![Downloads](https://static.pepy.tech/personalized-badge/optree?period=total&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/optree) +[![GitHub Repo Stars](https://img.shields.io/github/stars/metaopt/optree?color=brightgreen&logo=github)](https://github.com/metaopt/optree/stargazers) + +Optimized PyTree Utilities. + +-------------------------------------------------------------------------------- + +### Table of Contents + +- [Installation](#installation) +- [PyTrees](#pytrees) + - [Tree Nodes and Leaves](#tree-nodes-and-leaves) + - [Built-in PyTree Node Types](#built-in-pytree-node-types) + - [Registering a Container-like Custom Type as Non-leaf Nodes](#registering-a-container-like-custom-type-as-non-leaf-nodes) + - [Notes about the PyTree Type Registry](#notes-about-the-pytree-type-registry) + - [`None` is Non-leaf Node vs. `None` is Leaf](#none-is-non-leaf-node-vs-none-is-leaf) + - [Key Ordering for Dictionaries](#key-ordering-for-dictionaries) +- [Benchmark](#benchmark) + - [Tree Flatten](#tree-flatten) + - [Tree UnFlatten](#tree-unflatten) + - [Tree Flatten with Path](#tree-flatten-with-path) + - [Tree Copy](#tree-copy) + - [Tree Map](#tree-map) + - [Tree Map (nargs)](#tree-map-nargs) + - [Tree Map with Path](#tree-map-with-path) + - [Tree Map with Path (nargs)](#tree-map-with-path-nargs) +- [Changelog](#changelog) +- [License](#license) + +-------------------------------------------------------------------------------- + +## Installation + +Install from PyPI ([![PyPI](https://img.shields.io/pypi/v/optree?logo=pypi)](https://pypi.org/project/optree) / ![Status](https://img.shields.io/pypi/status/optree)): + +```bash +pip3 install --upgrade optree +``` + +Install from conda-forge ([![conda-forge](https://img.shields.io/conda/v/conda-forge/optree?logo=condaforge)](https://anaconda.org/conda-forge/optree)): + +```bash +conda install -c conda-forge optree +``` + +Install the latest version from GitHub: + +```bash +pip3 install git+https://github.com/metaopt/optree.git#egg=optree +``` + +Or, clone this repo and install manually: + +```bash +git clone --depth=1 https://github.com/metaopt/optree.git +cd optree +pip3 install . +``` + +Compiling from the source requires Python 3.7+, a compiler (`gcc` / `clang` / `icc` / `cl.exe`) that supports C++20 and a `cmake` installation. + +-------------------------------------------------------------------------------- + +## PyTrees + +A PyTree is a recursive structure that can be an arbitrarily nested Python container (e.g., `tuple`, `list`, `dict`, `OrderedDict`, `NamedTuple`, etc.) or an opaque Python object. +The key concepts of tree operations are tree flattening and its inverse (tree unflattening). +Additional tree operations can be performed based on these two basic functions (e.g., `tree_map = tree_unflatten ∘ map ∘ tree_flatten`). + +Tree flattening is traversing the entire tree in a left-to-right depth-first manner and returning the leaves of the tree in a deterministic order. + +```python +>>> tree = {'b': (2, [3, 4]), 'a': 1, 'c': 5, 'd': 6} +>>> optree.tree_flatten(tree) +([1, 2, 3, 4, 5, 6], PyTreeSpec({'a': *, 'b': (*, [*, *]), 'c': *, 'd': *})) +>>> optree.tree_flatten(1) +([1], PyTreeSpec(*)) +>>> optree.tree_flatten(None) +([], PyTreeSpec(None)) +``` + +This usually implies that the equal pytrees return equal lists of leaves and the same tree structure. +See also section [Key Ordering for Dictionaries](#key-ordering-for-dictionaries). + +```python +>>> {'a': [1, 2], 'b': [3]} == {'b': [3], 'a': [1, 2]} +True +>>> optree.tree_leaves({'a': [1, 2], 'b': [3]}) == optree.tree_leaves({'b': [3], 'a': [1, 2]}) +True +>>> optree.tree_structure({'a': [1, 2], 'b': [3]}) == optree.tree_structure({'b': [3], 'a': [1, 2]}) +True +``` + +### Tree Nodes and Leaves + +A tree is a collection of non-leaf nodes and leaf nodes, where the leaf nodes have no children to flatten. +`optree.tree_flatten(...)` will flatten the tree and return a list of leaf nodes while the non-leaf nodes will store in the tree specification. + +#### Built-in PyTree Node Types + +OpTree out-of-box supports the following Python container types in the registry: + +- [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple) +- [`list`](https://docs.python.org/3/library/stdtypes.html#list) +- [`dict`](https://docs.python.org/3/library/stdtypes.html#dict) +- [`collections.namedtuple`](https://docs.python.org/3/library/collections.html#collections.namedtuple) and its subclasses +- [`collections.OrderedDict`](https://docs.python.org/3/library/collections.html#collections.OrderedDict) +- [`collections.defaultdict`](https://docs.python.org/3/library/collections.html#collections.defaultdict) +- [`collections.deque`](https://docs.python.org/3/library/collections.html#collections.deque) +- [`PyStructSequence`](https://docs.python.org/3/c-api/tuple.html#struct-sequence-objects) types created by C API [`PyStructSequence_NewType`](https://docs.python.org/3/c-api/tuple.html#c.PyStructSequence_NewType) + +which are considered non-leaf nodes in the tree. +Python objects that the type is not registered will be treated as leaf nodes. +The registration lookup uses the `is` operator to determine whether the type is matched. +So subclasses will need to explicitly register in the registry, otherwise, an object of that type will be considered a leaf. +The [`NoneType`](https://docs.python.org/3/library/constants.html#None) is a special case discussed in section [`None` is non-leaf Node vs. `None` is Leaf](#none-is-non-leaf-node-vs-none-is-leaf). + +#### Registering a Container-like Custom Type as Non-leaf Nodes + +A container-like Python type can be registered in the type registry with a pair of functions that specify: + +- `flatten_func(container) -> (children, metadata, entries)`: convert an instance of the container type to a `(children, metadata, entries)` triple, where `children` is an iterable of subtrees and `entries` is an iterable of path entries of the container (e.g., indices or keys). +- `unflatten_func(metadata, children) -> container`: convert such a pair back to an instance of the container type. + +The `metadata` is some necessary data apart from the children to reconstruct the container, e.g., the keys of the dictionary (the children are values). + +The `entries` can be omitted (only returns a pair) or is optional to implement (returns `None`). If so, use `range(len(children))` (i.e., flat indices) as path entries of the current node. The function signature can be `flatten_func(container) -> (children, metadata)` or `flatten_func(container) -> (children, metadata, None)`. + +The following examples show how to register custom types and utilize them for `tree_flatten` and `tree_map`. Please refer to section [Notes about the PyTree Type Registry](#notes-about-the-pytree-type-registry) for more information. + +```python +# Registry a Python type with lambda functions +optree.register_pytree_node( + set, + # (set) -> (children, metadata, None) + lambda s: (sorted(s), None, None), + # (metadata, children) -> (set) + lambda _, children: set(children), + namespace='set', +) + +# Register a Python type into a namespace +import torch + +optree.register_pytree_node( + torch.Tensor, + # (tensor) -> (children, metadata) + flatten_func=lambda tensor: ( + (tensor.cpu().detach().numpy(),), + {'dtype': tensor.dtype, 'device': tensor.device, 'requires_grad': tensor.requires_grad}, + ), + # (metadata, children) -> tensor + unflatten_func=lambda metadata, children: torch.tensor(children[0], **metadata), + namespace='torch2numpy', +) +``` + +```python +>>> tree = {'weight': torch.ones(size=(1, 2)).cuda(), 'bias': torch.zeros(size=(2,))} +>>> tree +{'weight': tensor([[1., 1.]], device='cuda:0'), 'bias': tensor([0., 0.])} + +# Flatten without specifying the namespace +>>> optree.tree_flatten(tree) # `torch.Tensor`s are leaf nodes +([tensor([0., 0.]), tensor([[1., 1.]], device='cuda:0')], PyTreeSpec({'bias': *, 'weight': *})) + +# Flatten with the namespace +>>> leaves, treespec = optree.tree_flatten(tree, namespace='torch2numpy') +>>> leaves, treespec +( + [array([0., 0.], dtype=float32), array([[1., 1.]], dtype=float32)], + PyTreeSpec( + { + 'bias': CustomTreeNode(Tensor[{'dtype': torch.float32, 'device': device(type='cpu'), 'requires_grad': False}], [*]), + 'weight': CustomTreeNode(Tensor[{'dtype': torch.float32, 'device': device(type='cuda', index=0), 'requires_grad': False}], [*]) + }, + namespace='torch2numpy' + ) +) + +# `entries` are not defined and use `range(len(children))` +>>> optree.tree_paths(tree, namespace='torch2numpy') +[('bias', 0), ('weight', 0)] + +# Unflatten back to a copy of the original object +>>> optree.tree_unflatten(treespec, leaves) +{'weight': tensor([[1., 1.]], device='cuda:0'), 'bias': tensor([0., 0.])} +``` + +Users can also extend the pytree registry by decorating the custom class and defining an instance method `tree_flatten` and a class method `tree_unflatten`. + +```python +from collections import UserDict + +@optree.register_pytree_node_class(namespace='mydict') +class MyDict(UserDict): + def tree_flatten(self): # -> (children, metadata, entries) + reversed_keys = sorted(self.keys(), reverse=True) + return ( + [self[key] for key in reversed_keys], # children + reversed_keys, # metadata + reversed_keys, # entries + ) + + @classmethod + def tree_unflatten(cls, metadata, children): + return cls(zip(metadata, children)) +``` + +```python +>>> tree = MyDict(b=4, a=(2, 3), c=MyDict({'d': 5, 'f': 6})) + +# Flatten without specifying the namespace +>>> optree.tree_flatten_with_path(tree) # `MyDict`s are leaf nodes +( + [()], + [MyDict(b=4, a=(2, 3), c=MyDict({'d': 5, 'f': 6}))], + PyTreeSpec(*) +) + +# Flatten with the namespace +>>> optree.tree_flatten_with_path(tree, namespace='mydict') +( + [('c', 'f'), ('c', 'd'), ('b',), ('a', 0), ('a', 1)], + [6, 5, 4, 2, 3], + PyTreeSpec( + CustomTreeNode(MyDict[['c', 'b', 'a']], [CustomTreeNode(MyDict[['f', 'd']], [*, *]), *, (*, *)]), + namespace='mydict' + ) +) +``` + +#### Notes about the PyTree Type Registry + +There are several key attributes of the pytree type registry: + +1. **The type registry is per-interpreter-dependent.** This means registering a custom type in the registry affects all modules that use OpTree. + +> [!WARNING] +> For safety reasons, a `namespace` must be specified while registering a custom type. It is +> used to isolate the behavior of flattening and unflattening a pytree node type. This is to +> prevent accidental collisions between different libraries that may register the same type. + +2. **The elements in the type registry are immutable.** Users can neither register the same type twice in the same namespace (i.e., update the type registry), nor remove a type from the type registry. To update the behavior of an already registered type, simply register it again with another `namespace`. + +3. **Users cannot modify the behavior of already registered built-in types** listed in [Built-in PyTree Node Types](#built-in-pytree-node-types), such as key order sorting for `dict` and `collections.defaultdict`. + +4. **Inherited subclasses are not implicitly registered.** The registration lookup uses `type(obj) is registered_type` rather than `isinstance(obj, registered_type)`. Users need to register the subclasses explicitly. To register all subclasses, it is easy to implement with [`metaclass`](https://docs.python.org/3/reference/datamodel.html#metaclasses) or [`__init_subclass__`](https://docs.python.org/3/reference/datamodel.html#customizing-class-creation), for example: + + ```python + from collections import UserDict + + @optree.register_pytree_node_class(namespace='mydict') + class MyDict(UserDict): + def __init_subclass__(cls): # define this in the base class + super().__init_subclass__() + # Register a subclass to namespace 'mydict' + optree.register_pytree_node_class(cls, namespace='mydict') + + def tree_flatten(self): # -> (children, metadata, entries) + reversed_keys = sorted(self.keys(), reverse=True) + return ( + [self[key] for key in reversed_keys], # children + reversed_keys, # metadata + reversed_keys, # entries + ) + + @classmethod + def tree_unflatten(cls, metadata, children): + return cls(zip(metadata, children)) + + # Subclasses will be automatically registered in namespace 'mydict' + class MyAnotherDict(MyDict): + pass + ``` + + ```python + >>> tree = MyDict(b=4, a=(2, 3), c=MyAnotherDict({'d': 5, 'f': 6})) + >>> optree.tree_flatten_with_path(tree, namespace='mydict') + ( + [('c', 'f'), ('c', 'd'), ('b',), ('a', 0), ('a', 1)], + [6, 5, 4, 2, 3], + PyTreeSpec( + CustomTreeNode(MyDict[['c', 'b', 'a']], [CustomTreeNode(MyAnotherDict[['f', 'd']], [*, *]), *, (*, *)]), + namespace='mydict' + ) + ) + ``` + +5. **Be careful about the potential infinite recursion of the custom flatten function.** The returned `children` from the custom flatten function are considered subtrees. They will be further flattened recursively. The `children` can have the same type as the current node. Users must design their termination condition carefully. + + ```python + import numpy as np + import torch + + optree.register_pytree_node( + np.ndarray, + # Children are nest lists of Python objects + lambda array: (np.atleast_1d(array).tolist(), array.ndim == 0), + lambda scalar, rows: np.asarray(rows) if not scalar else np.asarray(rows[0]), + namespace='numpy1', + ) + + optree.register_pytree_node( + np.ndarray, + # Children are Python objects + lambda array: ( + list(array.ravel()), # list(1DArray[T]) -> List[T] + dict(shape=array.shape, dtype=array.dtype) + ), + lambda metadata, children: np.asarray(children, dtype=metadata['dtype']).reshape(metadata['shape']), + namespace='numpy2', + ) + + optree.register_pytree_node( + np.ndarray, + # Returns a list of `np.ndarray`s without termination condition + lambda array: ([array.ravel()], array.dtype), + lambda shape, children: children[0].reshape(shape), + namespace='numpy3', + ) + + optree.register_pytree_node( + torch.Tensor, + # Children are nest lists of Python objects + lambda tensor: (torch.atleast_1d(tensor).tolist(), tensor.ndim == 0), + lambda scalar, rows: torch.tensor(rows) if not scalar else torch.tensor(rows[0])), + namespace='torch1', + ) + + optree.register_pytree_node( + torch.Tensor, + # Returns a list of `torch.Tensor`s without termination condition + lambda tensor: ( + list(tensor.view(-1)), # list(1DTensor[T]) -> List[0DTensor[T]] (STILL TENSORS!) + tensor.shape + ), + lambda shape, children: torch.stack(children).reshape(shape), + namespace='torch2', + ) + ``` + + ```python + >>> optree.tree_flatten(np.arange(9).reshape(3, 3), namespace='numpy1') + ( + [0, 1, 2, 3, 4, 5, 6, 7, 8], + PyTreeSpec( + CustomTreeNode(ndarray[False], [[*, *, *], [*, *, *], [*, *, *]]), + namespace='numpy1' + ) + ) + # Implicitly casts `float`s to `np.float64` + >>> optree.tree_map(lambda x: x + 1.5, np.arange(9).reshape(3, 3), namespace='numpy1') + array([[1.5, 2.5, 3.5], + [4.5, 5.5, 6.5], + [7.5, 8.5, 9.5]]) + + >>> optree.tree_flatten(np.arange(9).reshape(3, 3), namespace='numpy2') + ( + [0, 1, 2, 3, 4, 5, 6, 7, 8], + PyTreeSpec( + CustomTreeNode(ndarray[{'shape': (3, 3), 'dtype': dtype('int64')}], [*, *, *, *, *, *, *, *, *]), + namespace='numpy2' + ) + ) + # Explicitly casts `float`s to `np.int64` + >>> optree.tree_map(lambda x: x + 1.5, np.arange(9).reshape(3, 3), namespace='numpy2') + array([[1, 2, 3], + [4, 5, 6], + [7, 8, 9]]) + + # Children are also `np.ndarray`s, recurse without termination condition. + >>> optree.tree_flatten(np.arange(9).reshape(3, 3), namespace='numpy3') + Traceback (most recent call last): + ... + RecursionError: Maximum recursion depth exceeded during flattening the tree. + + >>> optree.tree_flatten(torch.arange(9).reshape(3, 3), namespace='torch1') + ( + [0, 1, 2, 3, 4, 5, 6, 7, 8], + PyTreeSpec( + CustomTreeNode(Tensor[False], [[*, *, *], [*, *, *], [*, *, *]]), + namespace='torch1' + ) + ) + # Implicitly casts `float`s to `torch.float32` + >>> optree.tree_map(lambda x: x + 1.5, torch.arange(9).reshape(3, 3), namespace='torch1') + tensor([[1.5000, 2.5000, 3.5000], + [4.5000, 5.5000, 6.5000], + [7.5000, 8.5000, 9.5000]]) + + # Children are also `torch.Tensor`s, recurse without termination condition. + >>> optree.tree_flatten(torch.arange(9).reshape(3, 3), namespace='torch2') + Traceback (most recent call last): + ... + RecursionError: Maximum recursion depth exceeded during flattening the tree. + ``` + +### `None` is Non-leaf Node vs. `None` is Leaf + +The [`None`](https://docs.python.org/3/library/constants.html#None) object is a special object in the Python language. +It serves some of the same purposes as `null` (a pointer does not point to anything) in other programming languages, which denotes a variable is empty or marks default parameters. +However, the `None` object is a singleton object rather than a pointer. +It may also serve as a sentinel value. +In addition, if a function has returned without any return value or the return statement is omitted, the function will also implicitly return the `None` object. + +By default, the `None` object is considered a non-leaf node in the tree with arity 0, i.e., _**a non-leaf node that has no children**_. +This is like the behavior of an empty tuple. +While flattening a tree, it will remain in the tree structure definitions rather than in the leaves list. + +```python +>>> tree = {'b': (2, [3, 4]), 'a': 1, 'c': None, 'd': 5} +>>> optree.tree_flatten(tree) +([1, 2, 3, 4, 5], PyTreeSpec({'a': *, 'b': (*, [*, *]), 'c': None, 'd': *})) +>>> optree.tree_flatten(tree, none_is_leaf=True) +([1, 2, 3, 4, None, 5], PyTreeSpec({'a': *, 'b': (*, [*, *]), 'c': *, 'd': *}, NoneIsLeaf)) +>>> optree.tree_flatten(1) +([1], PyTreeSpec(*)) +>>> optree.tree_flatten(None) +([], PyTreeSpec(None)) +>>> optree.tree_flatten(None, none_is_leaf=True) +([None], PyTreeSpec(*, NoneIsLeaf)) +``` + +OpTree provides a keyword argument `none_is_leaf` to determine whether to consider the `None` object as a leaf, like other opaque objects. +If `none_is_leaf=True`, the `None` object will place in the leaves list. +Otherwise, the `None` object will remain in the tree specification (structure). + +```python +>>> import torch + +>>> linear = torch.nn.Linear(in_features=3, out_features=2, bias=False) +>>> linear._parameters # a container has None +OrderedDict([ + ('weight', Parameter containing: + tensor([[-0.6677, 0.5209, 0.3295], + [-0.4876, -0.3142, 0.1785]], requires_grad=True)), + ('bias', None) +]) + +>>> optree.tree_map(torch.zeros_like, linear._parameters) +OrderedDict([ + ('weight', tensor([[0., 0., 0.], + [0., 0., 0.]])), + ('bias', None) +]) + +>>> optree.tree_map(torch.zeros_like, linear._parameters, none_is_leaf=True) +Traceback (most recent call last): + ... +TypeError: zeros_like(): argument 'input' (position 1) must be Tensor, not NoneType + +>>> optree.tree_map(lambda t: torch.zeros_like(t) if t is not None else 0, linear._parameters, none_is_leaf=True) +OrderedDict([ + ('weight', tensor([[0., 0., 0.], + [0., 0., 0.]])), + ('bias', 0) +]) +``` + +### Key Ordering for Dictionaries + +The built-in Python dictionary (i.e., [`builtins.dict`](https://docs.python.org/3/library/stdtypes.html#dict)) is an unordered mapping that holds the keys and values. +The leaves of a dictionary are the values. Although since Python 3.6, the built-in dictionary is insertion ordered ([PEP 468](https://peps.python.org/pep-0468)). +The dictionary equality operator (`==`) does not check for key ordering. +To ensure [referential transparency](https://en.wikipedia.org/wiki/Referential_transparency) that "equal `dict`" implies "equal ordering of leaves", the order of values of the dictionary is sorted by the keys. +This behavior is also applied to [`collections.defaultdict`](https://docs.python.org/3/library/collections.html#collections.defaultdict). + +```python +>>> optree.tree_flatten({'a': [1, 2], 'b': [3]}) +([1, 2, 3], PyTreeSpec({'a': [*, *], 'b': [*]})) +>>> optree.tree_flatten({'b': [3], 'a': [1, 2]}) +([1, 2, 3], PyTreeSpec({'a': [*, *], 'b': [*]})) +``` + +If users want to keep the values in the insertion order in pytree traversal, they should use [`collections.OrderedDict`](https://docs.python.org/3/library/collections.html#collections.OrderedDict), which will take the order of keys under consideration: + +```python +>>> OrderedDict([('a', [1, 2]), ('b', [3])]) == OrderedDict([('b', [3]), ('a', [1, 2])]) +False +>>> optree.tree_flatten(OrderedDict([('a', [1, 2]), ('b', [3])])) +([1, 2, 3], PyTreeSpec(OrderedDict([('a', [*, *]), ('b', [*])]))) +>>> optree.tree_flatten(OrderedDict([('b', [3]), ('a', [1, 2])])) +([3, 1, 2], PyTreeSpec(OrderedDict([('b', [*]), ('a', [*, *])]))) +``` + +**Since OpTree v0.9.0, the key order of the reconstructed output dictionaries from `tree_unflatten` is guaranteed to be consistent with the key order of the input dictionaries in `tree_flatten`.** + +```python +>>> leaves, treespec = optree.tree_flatten({'b': [3], 'a': [1, 2]}) +>>> leaves, treespec +([1, 2, 3], PyTreeSpec({'a': [*, *], 'b': [*]})) +>>> optree.tree_unflatten(treespec, leaves) +{'b': [3], 'a': [1, 2]} +>>> optree.tree_map(lambda x: x, {'b': [3], 'a': [1, 2]}) +{'b': [3], 'a': [1, 2]} +>>> optree.tree_map(lambda x: x + 1, {'b': [3], 'a': [1, 2]}) +{'b': [4], 'a': [2, 3]} +``` + +This property is also preserved during serialization/deserialization. + +```python +>>> leaves, treespec = optree.tree_flatten({'b': [3], 'a': [1, 2]}) +>>> leaves, treespec +([1, 2, 3], PyTreeSpec({'a': [*, *], 'b': [*]})) +>>> restored_treespec = pickle.loads(pickle.dumps(treespec)) +>>> optree.tree_unflatten(treespec, leaves) +{'b': [3], 'a': [1, 2]} +>>> optree.tree_unflatten(restored_treespec, leaves) +{'b': [3], 'a': [1, 2]} +``` + +> [!NOTE] +> Note that there are no restrictions on the `dict` to require the keys to be comparable (sortable). +> There can be multiple types of keys in the dictionary. +> The keys are sorted in ascending order by `key=lambda k: k` first if capable otherwise fallback to `key=lambda k: (f'{k.__class__.__module__}.{k.__class__.__qualname__}', k)`. This handles most cases. +> +> ```python +> >>> sorted({1: 2, 1.5: 1}.keys()) +> [1, 1.5] +> >>> sorted({'a': 3, 1: 2, 1.5: 1}.keys()) +> Traceback (most recent call last): +> ... +> TypeError: '<' not supported between instances of 'int' and 'str' +> >>> sorted({'a': 3, 1: 2, 1.5: 1}.keys(), key=lambda k: (f'{k.__class__.__module__}.{k.__class__.__qualname__}', k)) +> [1.5, 1, 'a'] +> ``` + +-------------------------------------------------------------------------------- + +## Benchmark + +We benchmark the performance of: + +- tree flatten +- tree unflatten +- tree copy (i.e., `unflatten(flatten(...))`) +- tree map + +compared with the following libraries: + +- OpTree ([`@v0.9.0`](https://github.com/metaopt/optree/tree/v0.9.0)) +- JAX XLA ([`jax[cpu] == 0.4.6`](https://pypi.org/project/jax/0.4.6)) +- PyTorch ([`torch == 2.0.0`](https://pypi.org/project/torch/2.0.0)) +- DM-Tree ([`dm-tree == 0.1.8`](https://pypi.org/project/dm-tree/0.1.8)) + +| Average Time Cost (↓) | OpTree (v0.9.0) | JAX XLA (v0.4.6) | PyTorch (v2.0.0) | DM-Tree (v0.1.8) | +| :------------------------- | --------------: | ---------------: | ---------------: | ---------------: | +| Tree Flatten | x1.00 | 2.33 | 22.05 | 1.12 | +| Tree UnFlatten | x1.00 | 2.69 | 4.28 | 16.23 | +| Tree Flatten with Path | x1.00 | 16.16 | Not Supported | 27.59 | +| Tree Copy | x1.00 | 2.56 | 9.97 | 11.02 | +| Tree Map | x1.00 | 2.56 | 9.58 | 10.62 | +| Tree Map (nargs) | x1.00 | 2.89 | Not Supported | 31.33 | +| Tree Map with Path | x1.00 | 7.23 | Not Supported | 19.66 | +| Tree Map with Path (nargs) | x1.00 | 6.56 | Not Supported | 29.61 | + +All results are reported on a workstation with an AMD Ryzen 9 5950X CPU @ 4.45GHz in an isolated virtual environment with Python 3.10.9. +Run with the following commands: + +```bash +conda create --name optree-benchmark anaconda::python=3.10 --yes --no-default-packages +conda activate optree-benchmark +python3 -m pip install --editable '.[benchmark]' --extra-index-url https://download.pytorch.org/whl/cpu +python3 benchmark.py --number=10000 --repeat=5 +``` + +The test inputs are nested containers (i.e., pytrees) extracted from `torch.nn.Module` objects. +They are: + +```python +tiny_mlp = nn.Sequential( + nn.Linear(1, 1, bias=True), + nn.BatchNorm1d(1, affine=True, track_running_stats=True), + nn.ReLU(), + nn.Linear(1, 1, bias=False), + nn.Sigmoid(), +) +``` + +and AlexNet, ResNet18, ResNet34, ResNet50, ResNet101, ResNet152, VisionTransformerH14 (ViT-H/14), and SwinTransformerB (Swin-B) from [`torchvsion`](https://github.com/pytorch/vision). +Please refer to [`benchmark.py`](https://github.com/metaopt/optree/blob/HEAD/benchmark.py) for more details. + +### Tree Flatten + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 29.70 | 71.06 | 583.66 | 31.32 | 2.39 | 19.65 | 1.05 | +| AlexNet | 188 | 103.92 | 262.56 | 2304.36 | 119.61 | 2.53 | 22.17 | 1.15 | +| ResNet18 | 698 | 368.06 | 852.69 | 8440.31 | 420.43 | 2.32 | 22.93 | 1.14 | +| ResNet34 | 1242 | 644.96 | 1461.55 | 14498.81 | 712.81 | 2.27 | 22.48 | 1.11 | +| ResNet50 | 1702 | 919.95 | 2080.58 | 20995.96 | 1006.42 | 2.26 | 22.82 | 1.09 | +| ResNet101 | 3317 | 1806.36 | 3996.90 | 40314.12 | 1955.48 | 2.21 | 22.32 | 1.08 | +| ResNet152 | 4932 | 2656.92 | 5812.38 | 57775.53 | 2826.92 | 2.19 | 21.75 | 1.06 | +| ViT-H/14 | 3420 | 1863.50 | 4418.24 | 41334.64 | 2128.71 | 2.37 | 22.18 | 1.14 | +| Swin-B | 2881 | 1631.06 | 3944.13 | 36131.54 | 2032.77 | 2.42 | 22.15 | 1.25 | +| | | | | | **Average** | **2.33** | **22.05** | **1.12** | + +
+ +
+ +### Tree UnFlatten + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 55.13 | 152.07 | 231.94 | 940.11 | 2.76 | 4.21 | 17.05 | +| AlexNet | 188 | 226.29 | 678.29 | 972.90 | 4195.04 | 3.00 | 4.30 | 18.54 | +| ResNet18 | 698 | 766.54 | 1953.26 | 3137.86 | 12049.88 | 2.55 | 4.09 | 15.72 | +| ResNet34 | 1242 | 1309.22 | 3526.12 | 5759.16 | 20966.75 | 2.69 | 4.40 | 16.01 | +| ResNet50 | 1702 | 1914.96 | 5002.83 | 8369.43 | 29597.10 | 2.61 | 4.37 | 15.46 | +| ResNet101 | 3317 | 3672.61 | 9633.29 | 15683.16 | 57240.20 | 2.62 | 4.27 | 15.59 | +| ResNet152 | 4932 | 5407.58 | 13970.88 | 23074.68 | 82072.54 | 2.58 | 4.27 | 15.18 | +| ViT-H/14 | 3420 | 4013.18 | 11146.31 | 17633.07 | 66723.58 | 2.78 | 4.39 | 16.63 | +| Swin-B | 2881 | 3595.34 | 9505.31 | 15054.88 | 57310.03 | 2.64 | 4.19 | 15.94 | +| | | | | | **Average** | **2.69** | **4.28** | **16.23** | + +
+ +
+ +### Tree Flatten with Path + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 36.49 | 543.67 | N/A | 919.13 | 14.90 | N/A | 25.19 | +| AlexNet | 188 | 115.44 | 2185.21 | N/A | 3752.11 | 18.93 | N/A | 32.50 | +| ResNet18 | 698 | 431.84 | 7106.55 | N/A | 12286.70 | 16.46 | N/A | 28.45 | +| ResNet34 | 1242 | 845.61 | 13431.99 | N/A | 22860.48 | 15.88 | N/A | 27.03 | +| ResNet50 | 1702 | 1166.27 | 18426.52 | N/A | 31225.05 | 15.80 | N/A | 26.77 | +| ResNet101 | 3317 | 2312.77 | 34770.49 | N/A | 59346.86 | 15.03 | N/A | 25.66 | +| ResNet152 | 4932 | 3304.74 | 50557.25 | N/A | 85847.91 | 15.30 | N/A | 25.98 | +| ViT-H/14 | 3420 | 2235.25 | 37473.53 | N/A | 64105.24 | 16.76 | N/A | 28.68 | +| Swin-B | 2881 | 1970.25 | 32205.83 | N/A | 55177.50 | 16.35 | N/A | 28.01 | +| | | | | | **Average** | **16.16** | N/A | **27.59** | + +
+ +
+ +### Tree Copy + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 89.81 | 232.26 | 845.20 | 981.48 | 2.59 | 9.41 | 10.93 | +| AlexNet | 188 | 334.58 | 959.32 | 3360.46 | 4316.05 | 2.87 | 10.04 | 12.90 | +| ResNet18 | 698 | 1128.11 | 2840.71 | 11471.07 | 12297.07 | 2.52 | 10.17 | 10.90 | +| ResNet34 | 1242 | 2160.57 | 5333.10 | 20563.06 | 21901.91 | 2.47 | 9.52 | 10.14 | +| ResNet50 | 1702 | 2746.84 | 6823.88 | 29705.99 | 28927.88 | 2.48 | 10.81 | 10.53 | +| ResNet101 | 3317 | 5762.05 | 13481.45 | 56968.78 | 60115.93 | 2.34 | 9.89 | 10.43 | +| ResNet152 | 4932 | 8151.21 | 20805.61 | 81024.06 | 84079.57 | 2.55 | 9.94 | 10.31 | +| ViT-H/14 | 3420 | 5963.61 | 15665.91 | 59813.52 | 68377.82 | 2.63 | 10.03 | 11.47 | +| Swin-B | 2881 | 5401.59 | 14255.33 | 53361.77 | 62317.07 | 2.64 | 9.88 | 11.54 | +| | | | | | **Average** | **2.56** | **9.97** | **11.02** | + +
+ +
+ +### Tree Map + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 95.13 | 243.86 | 867.34 | 1026.99 | 2.56 | 9.12 | 10.80 | +| AlexNet | 188 | 348.44 | 987.57 | 3398.32 | 4354.81 | 2.83 | 9.75 | 12.50 | +| ResNet18 | 698 | 1190.62 | 2982.66 | 11719.94 | 12559.01 | 2.51 | 9.84 | 10.55 | +| ResNet34 | 1242 | 2205.87 | 5417.60 | 20935.72 | 22308.51 | 2.46 | 9.49 | 10.11 | +| ResNet50 | 1702 | 3128.48 | 7579.55 | 30372.71 | 31638.67 | 2.42 | 9.71 | 10.11 | +| ResNet101 | 3317 | 6173.05 | 14846.57 | 59167.85 | 60245.42 | 2.41 | 9.58 | 9.76 | +| ResNet152 | 4932 | 8641.22 | 22000.74 | 84018.65 | 86182.21 | 2.55 | 9.72 | 9.97 | +| ViT-H/14 | 3420 | 6211.79 | 17077.49 | 59790.25 | 69763.86 | 2.75 | 9.63 | 11.23 | +| Swin-B | 2881 | 5673.66 | 14339.69 | 53309.17 | 59764.61 | 2.53 | 9.40 | 10.53 | +| | | | | | **Average** | **2.56** | **9.58** | **10.62** | + +
+ +
+ +### Tree Map (nargs) + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 137.06 | 389.96 | N/A | 3908.77 | 2.85 | N/A | 28.52 | +| AlexNet | 188 | 467.24 | 1496.96 | N/A | 15395.13 | 3.20 | N/A | 32.95 | +| ResNet18 | 698 | 1603.79 | 4534.01 | N/A | 50323.76 | 2.83 | N/A | 31.38 | +| ResNet34 | 1242 | 2907.64 | 8435.33 | N/A | 90389.23 | 2.90 | N/A | 31.09 | +| ResNet50 | 1702 | 4183.77 | 11382.51 | N/A | 121777.01 | 2.72 | N/A | 29.11 | +| ResNet101 | 3317 | 7721.13 | 22247.85 | N/A | 238755.17 | 2.88 | N/A | 30.92 | +| ResNet152 | 4932 | 11508.05 | 31429.39 | N/A | 360257.74 | 2.73 | N/A | 31.30 | +| ViT-H/14 | 3420 | 8294.20 | 24524.86 | N/A | 270514.87 | 2.96 | N/A | 32.61 | +| Swin-B | 2881 | 7074.62 | 20854.80 | N/A | 241120.41 | 2.95 | N/A | 34.08 | +| | | | | | **Average** | **2.89** | N/A | **31.33** | + +
+ +
+ +### Tree Map with Path + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 109.82 | 778.30 | N/A | 2186.40 | 7.09 | N/A | 19.91 | +| AlexNet | 188 | 365.16 | 2939.36 | N/A | 8355.37 | 8.05 | N/A | 22.88 | +| ResNet18 | 698 | 1308.26 | 9529.58 | N/A | 25758.24 | 7.28 | N/A | 19.69 | +| ResNet34 | 1242 | 2527.21 | 18084.89 | N/A | 45942.32 | 7.16 | N/A | 18.18 | +| ResNet50 | 1702 | 3226.03 | 22935.53 | N/A | 61275.34 | 7.11 | N/A | 18.99 | +| ResNet101 | 3317 | 6663.52 | 46878.89 | N/A | 126642.14 | 7.04 | N/A | 19.01 | +| ResNet152 | 4932 | 9378.19 | 66136.44 | N/A | 176981.01 | 7.05 | N/A | 18.87 | +| ViT-H/14 | 3420 | 7033.69 | 50418.37 | N/A | 142508.11 | 7.17 | N/A | 20.26 | +| Swin-B | 2881 | 6078.15 | 43173.22 | N/A | 116612.71 | 7.10 | N/A | 19.19 | +| | | | | | **Average** | **7.23** | N/A | **19.66** | + +
+ +
+ +### Tree Map with Path (nargs) + +| Module | Nodes | OpTree (μs) | JAX XLA (μs) | PyTorch (μs) | DM-Tree (μs) | Speedup (J / O) | Speedup (P / O) | Speedup (D / O) | +| :-------- | ----: | ----------: | -----------: | -----------: | -----------: | --------------: | --------------: | --------------: | +| TinyMLP | 53 | 146.05 | 917.00 | N/A | 3940.61 | 6.28 | N/A | 26.98 | +| AlexNet | 188 | 489.27 | 3560.76 | N/A | 15434.71 | 7.28 | N/A | 31.55 | +| ResNet18 | 698 | 1712.79 | 11171.44 | N/A | 50219.86 | 6.52 | N/A | 29.32 | +| ResNet34 | 1242 | 3112.83 | 21024.58 | N/A | 95505.71 | 6.75 | N/A | 30.68 | +| ResNet50 | 1702 | 4220.70 | 26600.82 | N/A | 121897.57 | 6.30 | N/A | 28.88 | +| ResNet101 | 3317 | 8631.34 | 54372.37 | N/A | 236555.54 | 6.30 | N/A | 27.41 | +| ResNet152 | 4932 | 12710.49 | 77643.13 | N/A | 353600.32 | 6.11 | N/A | 27.82 | +| ViT-H/14 | 3420 | 8753.09 | 58712.71 | N/A | 286365.36 | 6.71 | N/A | 32.72 | +| Swin-B | 2881 | 7359.29 | 50112.23 | N/A | 228866.66 | 6.81 | N/A | 31.10 | +| | | | | | **Average** | **6.56** | N/A | **29.61** | + +
+ +
+ +-------------------------------------------------------------------------------- + +## Changelog + +See [CHANGELOG.md](https://github.com/metaopt/optree/blob/HEAD/CHANGELOG.md). + +-------------------------------------------------------------------------------- + +## License + +OpTree is released under the Apache License 2.0. + +OpTree is heavily based on JAX's implementation of the PyTree utility, with deep refactoring and several improvements. +The original licenses can be found at [JAX's Apache License 2.0](https://github.com/google/jax/blob/HEAD/LICENSE) and [Tensorflow's Apache License 2.0](https://github.com/tensorflow/tensorflow/blob/HEAD/LICENSE). diff --git a/shared/package-files/34/3489178ff6d47b63148cae654a50c0b331bb4e1de596b2d6b5d3afddcd4032b5/blob b/shared/package-files/34/3489178ff6d47b63148cae654a50c0b331bb4e1de596b2d6b5d3afddcd4032b5/blob new file mode 100644 index 0000000000000000000000000000000000000000..7fa987c425584d4f4222394a8ebe8c5c2b876831 --- /dev/null +++ b/shared/package-files/34/3489178ff6d47b63148cae654a50c0b331bb4e1de596b2d6b5d3afddcd4032b5/blob @@ -0,0 +1,228 @@ +""" +Usecases of recursive functions. + +Some functions are compiled at import time, hence a separate module. +""" + +from numba import jit + + +@jit("i8(i8)", nopython=True) +def fib1(n): + if n < 2: + return n + # Note the second call uses a named argument + return fib1(n - 1) + fib1(n=n - 2) + + +def make_fib2(): + @jit("i8(i8)", nopython=True) + def fib2(n): + if n < 2: + return n + return fib2(n - 1) + fib2(n=n - 2) + + return fib2 + +fib2 = make_fib2() + + +def make_type_change_self(jit=lambda x: x): + @jit + def type_change_self(x, y): + if x > 1 and y > 0: + return x + type_change_self(x - y, y) + else: + return y + return type_change_self + + +# Implicit signature +@jit(nopython=True) +def fib3(n): + if n < 2: + return n + return fib3(n - 1) + fib3(n - 2) + + +# Run-away self recursion +@jit(nopython=True) +def runaway_self(x): + return runaway_self(x) + + +@jit(nopython=True) +def raise_self(x): + if x == 1: + raise ValueError("raise_self") + elif x > 0: + return raise_self(x - 1) + else: + return 1 + + +# Mutual recursion +@jit(nopython=True) +def outer_fac(n): + if n < 1: + return 1 + return n * inner_fac(n - 1) + + +@jit(nopython=True) +def inner_fac(n): + if n < 1: + return 1 + return n * outer_fac(n - 1) + + +# Mutual recursion with different arg names +def make_mutual2(jit=lambda x: x): + @jit + def foo(x): + if x > 0: + return 2 * bar(z=1, y=x) + return 1 + x + + @jit + def bar(y, z): + return foo(x=y - z) + + return foo, bar + + +# Mutual runaway recursion + +@jit(nopython=True) +def runaway_mutual(x): + return runaway_mutual_inner(x) + + +@jit(nopython=True) +def runaway_mutual_inner(x): + return runaway_mutual(x) + + +# Mutual type changing recursion + +def make_type_change_mutual(jit=lambda x: x): + @jit + def foo(x, y): + if x > 1 and y > 0: + # call bar first to exercise partial type inference. + # typeinferer suspended at the call to bar() and haven't determined + # the potential return type from the else-branch + return x + bar(x - y, y) + else: + return y + + @jit + def bar(x, y): + if x > 1 and y > 0: + return x + foo(x - y, y) + else: + return y + + return foo + + +# Indirect mutual recursion +def make_four_level(jit=lambda x: x): + @jit + def first(x): + # The recursing call must have a path that is non-recursing. + if x > 0: + return second(x) * 2 + else: + return 1 + + @jit + def second(x): + return third(x) * 3 + + @jit + def third(x): + return fourth(x) * 4 + + @jit + def fourth(x): + return first(x / 2 - 1) + + return first + + +def make_inner_error(jit=lambda x: x): + @jit + def outer(x): + if x > 0: + return inner(x) + + else: + return 1 + + @jit + def inner(x): + if x > 0: + return outer(x - 1) + else: + # this branch is actually never executed + return error_fun(x) + + @jit + def error_fun(x): + # to trigger an untyped attribute error + return x.ndim + + return outer + + +def make_raise_mutual(jit=lambda x: x): + @jit + def outer(x): + if x > 0: + return inner(x) + else: + return 1 + + @jit + def inner(x): + if x == 1: + raise ValueError('raise_mutual') + elif x > 0: + return outer(x - 1) + else: + return 1 + + return outer + + +def make_optional_return_case(jit=lambda x: x): + @jit + def foo(x): + if x > 5: + return x - 1 + else: + return + + @jit + def bar(x): + out = foo(x) + if out is None: + return out + elif out < 8: + return out + else: + return x * bar(out) + + return bar + + +def make_growing_tuple_case(jit=lambda x: x): + # From issue #4387 + @jit + def make_list(n): + if n <= 0: + return None + + return (n, make_list(n - 1)) + return make_list diff --git a/shared/package-files/34/348978095d9b02c210ed4d6e1e270c543720e413d88729bd4fb2ad0bca5ebaf8/blob b/shared/package-files/34/348978095d9b02c210ed4d6e1e270c543720e413d88729bd4fb2ad0bca5ebaf8/blob new file mode 100644 index 0000000000000000000000000000000000000000..46cb7e8ae4d7fdafe25a0ed18957f5789893dd59 --- /dev/null +++ b/shared/package-files/34/348978095d9b02c210ed4d6e1e270c543720e413d88729bd4fb2ad0bca5ebaf8/blob @@ -0,0 +1,27 @@ +######################################################################################################### +# # +# This archive is part of the free distribution of data and statistical software code for # +# "Generalized Linear Models: A Unified Approach", Jeff Gill, Sage QASS Series. You are # +# free to use, modify, distribute, publish, etc. provided attribution. Please forward # +# bugs, complaints, comments, and useful changes to: jgill@latte.harvard.edu. # +# # +######################################################################################################### + +Electoral Politics in Scotland. These data are from the 1997 vote that established a Scottish +Parliament with taxing powers. The data are culled from several different official UK documents +provided by the Office for National Statistics, the General Register Office for Scotland, the +Scottish Office: Education and Industry Department, the Scottish Department for Education +and Employment, The Scottish Office Office: Development Department, and David Boothroyd (thank you). +The files in this zip archive are: + +scotland.readme this file +scotvote.dat the data file with a header indicating + +scotland_births.html +scotland_changes.html +scotland_devolution.html +scotland_econ_summary.html +scotland_economics.html +scotland_education.html +scotland_housing.html +scotland_population.html these are html files with various details on the variables included. diff --git a/shared/package-files/34/348a88781900d7c345ac0fe4c8c1c0b89e76db0893d8a4c629c92c95e3195dc9/blob b/shared/package-files/34/348a88781900d7c345ac0fe4c8c1c0b89e76db0893d8a4c629c92c95e3195dc9/blob new file mode 100644 index 0000000000000000000000000000000000000000..cc534cdb0b4af532207f1fa48b6af4d369ebc768 --- /dev/null +++ b/shared/package-files/34/348a88781900d7c345ac0fe4c8c1c0b89e76db0893d8a4c629c92c95e3195dc9/blob @@ -0,0 +1,14 @@ +from .graph import Graph +from .digraph import DiGraph +from .multigraph import MultiGraph +from .multidigraph import MultiDiGraph +from .backends import _dispatch + +from .function import * + +from networkx.classes import filters + +from networkx.classes import coreviews +from networkx.classes import graphviews +from networkx.classes import reportviews +from networkx.classes import backends diff --git a/shared/package-files/34/348bf31a10d753368fb7915805d50bab8421c3ad89adc71a00f35ffb3b217fff/blob b/shared/package-files/34/348bf31a10d753368fb7915805d50bab8421c3ad89adc71a00f35ffb3b217fff/blob new file mode 100644 index 0000000000000000000000000000000000000000..3cfcefab9fb735aa327111a773741c1f6696ff90 --- /dev/null +++ b/shared/package-files/34/348bf31a10d753368fb7915805d50bab8421c3ad89adc71a00f35ffb3b217fff/blob @@ -0,0 +1,113 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::empty_permuted(SymInt[] size, int[] physical_layout, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor +inline at::Tensor empty_permuted(at::IntArrayRef size, at::IntArrayRef physical_layout, at::TensorOptions options={}) { + return at::_ops::empty_permuted::call(c10::fromIntArrayRefSlow(size), physical_layout, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt()); +} +namespace symint { + template ::value>> + at::Tensor empty_permuted(at::IntArrayRef size, at::IntArrayRef physical_layout, at::TensorOptions options={}) { + return at::_ops::empty_permuted::call(c10::fromIntArrayRefSlow(size), physical_layout, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt()); + } +} + +// aten::empty_permuted(SymInt[] size, int[] physical_layout, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor +inline at::Tensor empty_permuted(at::IntArrayRef size, at::IntArrayRef physical_layout, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory) { + return at::_ops::empty_permuted::call(c10::fromIntArrayRefSlow(size), physical_layout, dtype, layout, device, pin_memory); +} +namespace symint { + template ::value>> + at::Tensor empty_permuted(at::IntArrayRef size, at::IntArrayRef physical_layout, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory) { + return at::_ops::empty_permuted::call(c10::fromIntArrayRefSlow(size), physical_layout, dtype, layout, device, pin_memory); + } +} + +// aten::empty_permuted(SymInt[] size, int[] physical_layout, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor +inline at::Tensor empty_permuted_symint(c10::SymIntArrayRef size, at::IntArrayRef physical_layout, at::TensorOptions options={}) { + return at::_ops::empty_permuted::call(size, physical_layout, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt()); +} +namespace symint { + template ::value>> + at::Tensor empty_permuted(c10::SymIntArrayRef size, at::IntArrayRef physical_layout, at::TensorOptions options={}) { + return at::_ops::empty_permuted::call(size, physical_layout, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt()); + } +} + +// aten::empty_permuted(SymInt[] size, int[] physical_layout, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor +inline at::Tensor empty_permuted_symint(c10::SymIntArrayRef size, at::IntArrayRef physical_layout, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory) { + return at::_ops::empty_permuted::call(size, physical_layout, dtype, layout, device, pin_memory); +} +namespace symint { + template ::value>> + at::Tensor empty_permuted(c10::SymIntArrayRef size, at::IntArrayRef physical_layout, c10::optional dtype, c10::optional layout, c10::optional device, c10::optional pin_memory) { + return at::_ops::empty_permuted::call(size, physical_layout, dtype, layout, device, pin_memory); + } +} + +// aten::empty_permuted.out(SymInt[] size, int[] physical_layout, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & empty_permuted_out(at::Tensor & out, at::IntArrayRef size, at::IntArrayRef physical_layout) { + return at::_ops::empty_permuted_out::call(c10::fromIntArrayRefSlow(size), physical_layout, out); +} +namespace symint { + template ::value>> + at::Tensor & empty_permuted_out(at::Tensor & out, at::IntArrayRef size, at::IntArrayRef physical_layout) { + return at::_ops::empty_permuted_out::call(c10::fromIntArrayRefSlow(size), physical_layout, out); + } +} + +// aten::empty_permuted.out(SymInt[] size, int[] physical_layout, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & empty_permuted_outf(at::IntArrayRef size, at::IntArrayRef physical_layout, at::Tensor & out) { + return at::_ops::empty_permuted_out::call(c10::fromIntArrayRefSlow(size), physical_layout, out); +} +namespace symint { + template ::value>> + at::Tensor & empty_permuted_outf(at::IntArrayRef size, at::IntArrayRef physical_layout, at::Tensor & out) { + return at::_ops::empty_permuted_out::call(c10::fromIntArrayRefSlow(size), physical_layout, out); + } +} + +// aten::empty_permuted.out(SymInt[] size, int[] physical_layout, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & empty_permuted_symint_out(at::Tensor & out, c10::SymIntArrayRef size, at::IntArrayRef physical_layout) { + return at::_ops::empty_permuted_out::call(size, physical_layout, out); +} +namespace symint { + template ::value>> + at::Tensor & empty_permuted_out(at::Tensor & out, c10::SymIntArrayRef size, at::IntArrayRef physical_layout) { + return at::_ops::empty_permuted_out::call(size, physical_layout, out); + } +} + +// aten::empty_permuted.out(SymInt[] size, int[] physical_layout, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & empty_permuted_symint_outf(c10::SymIntArrayRef size, at::IntArrayRef physical_layout, at::Tensor & out) { + return at::_ops::empty_permuted_out::call(size, physical_layout, out); +} +namespace symint { + template ::value>> + at::Tensor & empty_permuted_outf(c10::SymIntArrayRef size, at::IntArrayRef physical_layout, at::Tensor & out) { + return at::_ops::empty_permuted_out::call(size, physical_layout, out); + } +} + +} diff --git a/shared/package-files/34/348d03455325b3d0907086e4ed943d688c934011b21f5b41da8782d73896ae93/blob b/shared/package-files/34/348d03455325b3d0907086e4ed943d688c934011b21f5b41da8782d73896ae93/blob new file mode 100644 index 0000000000000000000000000000000000000000..062ae20866c71d27358f8fc6acc46e7a1098d616 --- /dev/null +++ b/shared/package-files/34/348d03455325b3d0907086e4ed943d688c934011b21f5b41da8782d73896ae93/blob @@ -0,0 +1,25 @@ +#pragma once +// @generated by torchgen/gen.py from DispatchKeyFunction.h + +// NB: The implementing C++ file is RegisterDispatchKey.cpp + +// The only #includes we need are for custom classes that have defaults in the C++ API +#include +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { + +namespace compositeexplicitautograd { + +TORCH_API at::Tensor & median_out(at::Tensor & out, const at::Tensor & self); +TORCH_API at::Tensor & median_outf(const at::Tensor & self, at::Tensor & out); +TORCH_API ::std::tuple median(const at::Tensor & self, int64_t dim, bool keepdim=false); + +} // namespace compositeexplicitautograd +} // namespace at diff --git a/shared/package-files/34/348dba0ab631a125eb4cc5068d7d3f22b39456104a38834c98867960d8080dcd/blob b/shared/package-files/34/348dba0ab631a125eb4cc5068d7d3f22b39456104a38834c98867960d8080dcd/blob new file mode 100644 index 0000000000000000000000000000000000000000..6b5645d4b906e1781c44a31af078677e8f718abd --- /dev/null +++ b/shared/package-files/34/348dba0ab631a125eb4cc5068d7d3f22b39456104a38834c98867960d8080dcd/blob @@ -0,0 +1,75 @@ +# mypy: ignore-errors + +import logging +import warnings + +from functorch.compile import make_boxed_func + +from ..backends.common import aot_autograd +from .registry import register_backend, register_experimental_backend + +log = logging.getLogger(__name__) + + +@register_experimental_backend +def torchxla_trivial(gm, fake_tensor_inputs): + return gm + + +@register_experimental_backend +def torchxla_trace_once(model, fake_tensor_inputs): + warnings.warn( + "This backend will be deprecated in 2.2, please use `openxla` backend instead" + ) + + return xla_backend_helper(model, fake_tensor_inputs) + + +@register_backend +def openxla_eval(model, fake_tensor_inputs): + return xla_backend_helper(model, fake_tensor_inputs, boxed=False) + + +def openxla_eval_boxed(model, fake_tensor_inputs): + return xla_backend_helper(model, fake_tensor_inputs, boxed=True) + + +def xla_backend_helper(model, fake_tensor_inputs, boxed=False): + try: + import torch_xla.core.dynamo_bridge as bridge + except ImportError as e: + raise ImportError( + "Please follow the instruction in https://github.com/pytorch/xla#pytorchxla to install torch_xla" + ) from e + + compiled_graph = None + + def fwd(*args): + nonlocal model + nonlocal compiled_graph + if compiled_graph is None: + compiled_graph = bridge.extract_compiled_graph(model, args) + del model + return compiled_graph(*args) + + return make_boxed_func(fwd) if boxed else fwd + + +aot_torchxla_trivial = aot_autograd( + fw_compiler=torchxla_trivial, +) +register_experimental_backend( + name="aot_torchxla_trivial", compiler_fn=aot_torchxla_trivial +) + +aot_torchxla_trace_once = aot_autograd( + fw_compiler=torchxla_trace_once, +) +register_experimental_backend( + name="aot_torchxla_trace_once", compiler_fn=aot_torchxla_trace_once +) + +openxla = aot_autograd( + fw_compiler=openxla_eval_boxed, +) +register_backend(name="openxla", compiler_fn=openxla) diff --git a/shared/package-files/34/3490d19035637b4d2ea20c915970a50d06cab182ba4e75f3210dbea77fb53a15/blob b/shared/package-files/34/3490d19035637b4d2ea20c915970a50d06cab182ba4e75f3210dbea77fb53a15/blob new file mode 100644 index 0000000000000000000000000000000000000000..d2265958a50cdd51219258c67cb4c8e77e24acf2 --- /dev/null +++ b/shared/package-files/34/3490d19035637b4d2ea20c915970a50d06cab182ba4e75f3210dbea77fb53a15/blob @@ -0,0 +1,50 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _foreach_atan { + using schema = ::std::vector (at::TensorList); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_foreach_atan") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_foreach_atan(Tensor[] self) -> Tensor[]") + static ::std::vector call(at::TensorList self); + static ::std::vector redispatch(c10::DispatchKeySet dispatchKeySet, at::TensorList self); +}; + +struct TORCH_API _foreach_atan_ { + using schema = void (at::TensorList); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_foreach_atan_") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_foreach_atan_(Tensor(a!)[] self) -> ()") + static void call(at::TensorList self); + static void redispatch(c10::DispatchKeySet dispatchKeySet, at::TensorList self); +}; + +struct TORCH_API _foreach_atan_out { + using schema = void (at::TensorList, at::TensorList); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_foreach_atan") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_foreach_atan.out(Tensor[] self, *, Tensor(a!)[] out) -> ()") + static void call(at::TensorList self, at::TensorList out); + static void redispatch(c10::DispatchKeySet dispatchKeySet, at::TensorList self, at::TensorList out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/34/34925b5d9f4be59785190a42a6f61558536ac97dda9a46ee0d01012fbc028b1c/blob b/shared/package-files/34/34925b5d9f4be59785190a42a6f61558536ac97dda9a46ee0d01012fbc028b1c/blob new file mode 100644 index 0000000000000000000000000000000000000000..1cb404064fe3bedbf1695f5bc4a773a7d146da90 --- /dev/null +++ b/shared/package-files/34/34925b5d9f4be59785190a42a6f61558536ac97dda9a46ee0d01012fbc028b1c/blob @@ -0,0 +1,66 @@ +"""Unit tests for the :mod:`networkx.algorithms.wiener` module.""" + + +from networkx import DiGraph, complete_graph, empty_graph, path_graph, wiener_index + + +class TestWienerIndex: + """Unit tests for computing the Wiener index of a graph.""" + + def test_disconnected_graph(self): + """Tests that the Wiener index of a disconnected graph is + positive infinity. + + """ + assert wiener_index(empty_graph(2)) == float("inf") + + def test_directed(self): + """Tests that each pair of nodes in the directed graph is + counted once when computing the Wiener index. + + """ + G = complete_graph(3) + H = DiGraph(G) + assert (2 * wiener_index(G)) == wiener_index(H) + + def test_complete_graph(self): + """Tests that the Wiener index of the complete graph is simply + the number of edges. + + """ + n = 10 + G = complete_graph(n) + assert wiener_index(G) == (n * (n - 1) / 2) + + def test_path_graph(self): + """Tests that the Wiener index of the path graph is correctly + computed. + + """ + # In P_n, there are n - 1 pairs of vertices at distance one, n - + # 2 pairs at distance two, n - 3 at distance three, ..., 1 at + # distance n - 1, so the Wiener index should be + # + # 1 * (n - 1) + 2 * (n - 2) + ... + (n - 2) * 2 + (n - 1) * 1 + # + # For example, in P_5, + # + # 1 * 4 + 2 * 3 + 3 * 2 + 4 * 1 = 2 (1 * 4 + 2 * 3) + # + # and in P_6, + # + # 1 * 5 + 2 * 4 + 3 * 3 + 4 * 2 + 5 * 1 = 2 (1 * 5 + 2 * 4) + 3 * 3 + # + # assuming n is *odd*, this gives the formula + # + # 2 \sum_{i = 1}^{(n - 1) / 2} [i * (n - i)] + # + # assuming n is *even*, this gives the formula + # + # 2 \sum_{i = 1}^{n / 2} [i * (n - i)] - (n / 2) ** 2 + # + n = 9 + G = path_graph(n) + expected = 2 * sum(i * (n - i) for i in range(1, (n // 2) + 1)) + actual = wiener_index(G) + assert expected == actual diff --git a/shared/package-files/34/3492d3b9fffc53cbbe163b7fa9f5a6ef3854b4f41dbe31f5255f1f637a11bfe6/blob b/shared/package-files/34/3492d3b9fffc53cbbe163b7fa9f5a6ef3854b4f41dbe31f5255f1f637a11bfe6/blob new file mode 100644 index 0000000000000000000000000000000000000000..72bfd6f2212f8fae6ea7786599de44beaeb3f902 --- /dev/null +++ b/shared/package-files/34/3492d3b9fffc53cbbe163b7fa9f5a6ef3854b4f41dbe31f5255f1f637a11bfe6/blob @@ -0,0 +1,174 @@ +from __future__ import annotations + +import json +from typing import TYPE_CHECKING + +import pyarrow + +from pandas.compat import pa_version_under14p1 + +from pandas.core.dtypes.dtypes import ( + IntervalDtype, + PeriodDtype, +) + +from pandas.core.arrays.interval import VALID_CLOSED + +if TYPE_CHECKING: + from pandas._typing import IntervalClosedType + + +class ArrowPeriodType(pyarrow.ExtensionType): + def __init__(self, freq) -> None: + # attributes need to be set first before calling + # super init (as that calls serialize) + self._freq = freq + pyarrow.ExtensionType.__init__(self, pyarrow.int64(), "pandas.period") + + @property + def freq(self): + return self._freq + + def __arrow_ext_serialize__(self) -> bytes: + metadata = {"freq": self.freq} + return json.dumps(metadata).encode() + + @classmethod + def __arrow_ext_deserialize__(cls, storage_type, serialized) -> ArrowPeriodType: + metadata = json.loads(serialized.decode()) + return ArrowPeriodType(metadata["freq"]) + + def __eq__(self, other): + if isinstance(other, pyarrow.BaseExtensionType): + return type(self) == type(other) and self.freq == other.freq + else: + return NotImplemented + + def __ne__(self, other) -> bool: + return not self == other + + def __hash__(self) -> int: + return hash((str(self), self.freq)) + + def to_pandas_dtype(self) -> PeriodDtype: + return PeriodDtype(freq=self.freq) + + +# register the type with a dummy instance +_period_type = ArrowPeriodType("D") +pyarrow.register_extension_type(_period_type) + + +class ArrowIntervalType(pyarrow.ExtensionType): + def __init__(self, subtype, closed: IntervalClosedType) -> None: + # attributes need to be set first before calling + # super init (as that calls serialize) + assert closed in VALID_CLOSED + self._closed: IntervalClosedType = closed + if not isinstance(subtype, pyarrow.DataType): + subtype = pyarrow.type_for_alias(str(subtype)) + self._subtype = subtype + + storage_type = pyarrow.struct([("left", subtype), ("right", subtype)]) + pyarrow.ExtensionType.__init__(self, storage_type, "pandas.interval") + + @property + def subtype(self): + return self._subtype + + @property + def closed(self) -> IntervalClosedType: + return self._closed + + def __arrow_ext_serialize__(self) -> bytes: + metadata = {"subtype": str(self.subtype), "closed": self.closed} + return json.dumps(metadata).encode() + + @classmethod + def __arrow_ext_deserialize__(cls, storage_type, serialized) -> ArrowIntervalType: + metadata = json.loads(serialized.decode()) + subtype = pyarrow.type_for_alias(metadata["subtype"]) + closed = metadata["closed"] + return ArrowIntervalType(subtype, closed) + + def __eq__(self, other): + if isinstance(other, pyarrow.BaseExtensionType): + return ( + type(self) == type(other) + and self.subtype == other.subtype + and self.closed == other.closed + ) + else: + return NotImplemented + + def __ne__(self, other) -> bool: + return not self == other + + def __hash__(self) -> int: + return hash((str(self), str(self.subtype), self.closed)) + + def to_pandas_dtype(self) -> IntervalDtype: + return IntervalDtype(self.subtype.to_pandas_dtype(), self.closed) + + +# register the type with a dummy instance +_interval_type = ArrowIntervalType(pyarrow.int64(), "left") +pyarrow.register_extension_type(_interval_type) + + +_ERROR_MSG = """\ +Disallowed deserialization of 'arrow.py_extension_type': +storage_type = {storage_type} +serialized = {serialized} +pickle disassembly:\n{pickle_disassembly} + +Reading of untrusted Parquet or Feather files with a PyExtensionType column +allows arbitrary code execution. +If you trust this file, you can enable reading the extension type by one of: + +- upgrading to pyarrow >= 14.0.1, and call `pa.PyExtensionType.set_auto_load(True)` +- install pyarrow-hotfix (`pip install pyarrow-hotfix`) and disable it by running + `import pyarrow_hotfix; pyarrow_hotfix.uninstall()` + +We strongly recommend updating your Parquet/Feather files to use extension types +derived from `pyarrow.ExtensionType` instead, and register this type explicitly. +""" + + +def patch_pyarrow(): + # starting from pyarrow 14.0.1, it has its own mechanism + if not pa_version_under14p1: + return + + # if https://github.com/pitrou/pyarrow-hotfix was installed and enabled + if getattr(pyarrow, "_hotfix_installed", False): + return + + class ForbiddenExtensionType(pyarrow.ExtensionType): + def __arrow_ext_serialize__(self): + return b"" + + @classmethod + def __arrow_ext_deserialize__(cls, storage_type, serialized): + import io + import pickletools + + out = io.StringIO() + pickletools.dis(serialized, out) + raise RuntimeError( + _ERROR_MSG.format( + storage_type=storage_type, + serialized=serialized, + pickle_disassembly=out.getvalue(), + ) + ) + + pyarrow.unregister_extension_type("arrow.py_extension_type") + pyarrow.register_extension_type( + ForbiddenExtensionType(pyarrow.null(), "arrow.py_extension_type") + ) + + pyarrow._hotfix_installed = True + + +patch_pyarrow() diff --git a/shared/package-files/34/349cdf449610c097894bc7c25667bf8581ac6ebb75e21ec418072cd96d1f98bf/blob b/shared/package-files/34/349cdf449610c097894bc7c25667bf8581ac6ebb75e21ec418072cd96d1f98bf/blob new file mode 100644 index 0000000000000000000000000000000000000000..87e9bc310e48db4f45d889a2d96ddcbcc452e147 --- /dev/null +++ b/shared/package-files/34/349cdf449610c097894bc7c25667bf8581ac6ebb75e21ec418072cd96d1f98bf/blob @@ -0,0 +1,8 @@ +from typing import Dict, Iterator, List, Set + +from django.db.migrations.operations.base import Operation + +def topological_sort_as_sets(dependency_graph: Dict[Operation, Set[Operation]]) -> Iterator[Set[Operation]]: ... +def stable_topological_sort( + l: List[Operation], dependency_graph: Dict[Operation, Set[Operation]] +) -> List[Operation]: ... diff --git a/shared/package-files/34/349cf6d32d97063861eabf05519ffb2990515380de1a62e1cf178c6155ceb846/blob b/shared/package-files/34/349cf6d32d97063861eabf05519ffb2990515380de1a62e1cf178c6155ceb846/blob new file mode 100644 index 0000000000000000000000000000000000000000..3d267f62fdc92a763ffcbd8f110510fe6598b87c --- /dev/null +++ b/shared/package-files/34/349cf6d32d97063861eabf05519ffb2990515380de1a62e1cf178c6155ceb846/blob @@ -0,0 +1,26 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + + +} diff --git a/shared/package-files/34/34a133ed7b5d16487d700f0cbd8f92dd4399955d98fc9ded3045851718fb4128/blob b/shared/package-files/34/34a133ed7b5d16487d700f0cbd8f92dd4399955d98fc9ded3045851718fb4128/blob new file mode 100644 index 0000000000000000000000000000000000000000..b053a4ca2d68b6a96f7363418509622bc3cfc8dc --- /dev/null +++ b/shared/package-files/34/34a133ed7b5d16487d700f0cbd8f92dd4399955d98fc9ded3045851718fb4128/blob @@ -0,0 +1,344 @@ +StartFontMetrics 2.0 +Comment Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved. +Comment Creation Date: Tue Sep 17 09:42:19 1991 +Comment UniqueID 36350 +Comment VMusage 9174 52297 +FontName Courier-Oblique +FullName Courier Oblique +FamilyName Courier +Weight Medium +ItalicAngle -12 +IsFixedPitch true +FontBBox -28 -250 742 805 +UnderlinePosition -100 +UnderlineThickness 50 +Version 002.004 +Notice Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved. +EncodingScheme AdobeStandardEncoding +CapHeight 562 +XHeight 426 +Ascender 629 +Descender -157 +StartCharMetrics 260 +C 32 ; WX 600 ; N space ; B 0 0 0 0 ; +C 33 ; WX 600 ; N exclam ; B 243 -15 464 572 ; +C 34 ; WX 600 ; N quotedbl ; B 273 328 532 562 ; +C 35 ; WX 600 ; N numbersign ; B 133 -32 596 639 ; +C 36 ; WX 600 ; N dollar ; B 108 -126 596 662 ; +C 37 ; WX 600 ; N percent ; B 134 -15 599 622 ; +C 38 ; WX 600 ; N ampersand ; B 87 -15 580 543 ; +C 39 ; WX 600 ; N quoteright ; B 283 328 495 562 ; +C 40 ; WX 600 ; N parenleft ; B 313 -108 572 622 ; +C 41 ; WX 600 ; N parenright ; B 137 -108 396 622 ; +C 42 ; WX 600 ; N asterisk ; B 212 257 580 607 ; +C 43 ; WX 600 ; N plus ; B 129 44 580 470 ; +C 44 ; WX 600 ; N comma ; B 157 -112 370 122 ; +C 45 ; WX 600 ; N hyphen ; B 152 231 558 285 ; +C 46 ; WX 600 ; N period ; B 238 -15 382 109 ; +C 47 ; WX 600 ; N slash ; B 112 -80 604 629 ; +C 48 ; WX 600 ; N zero ; B 154 -15 575 622 ; +C 49 ; WX 600 ; N one ; B 98 0 515 622 ; +C 50 ; WX 600 ; N two ; B 70 0 568 622 ; +C 51 ; WX 600 ; N three ; B 82 -15 538 622 ; +C 52 ; WX 600 ; N four ; B 108 0 541 622 ; +C 53 ; WX 600 ; N five ; B 99 -15 589 607 ; +C 54 ; WX 600 ; N six ; B 155 -15 629 622 ; +C 55 ; WX 600 ; N seven ; B 182 0 612 607 ; +C 56 ; WX 600 ; N eight ; B 132 -15 588 622 ; +C 57 ; WX 600 ; N nine ; B 93 -15 574 622 ; +C 58 ; WX 600 ; N colon ; B 238 -15 441 385 ; +C 59 ; WX 600 ; N semicolon ; B 157 -112 441 385 ; +C 60 ; WX 600 ; N less ; B 96 42 610 472 ; +C 61 ; WX 600 ; N equal ; B 109 138 600 376 ; +C 62 ; WX 600 ; N greater ; B 85 42 599 472 ; +C 63 ; WX 600 ; N question ; B 222 -15 583 572 ; +C 64 ; WX 600 ; N at ; B 127 -15 582 622 ; +C 65 ; WX 600 ; N A ; B 3 0 607 562 ; +C 66 ; WX 600 ; N B ; B 43 0 616 562 ; +C 67 ; WX 600 ; N C ; B 93 -18 655 580 ; +C 68 ; WX 600 ; N D ; B 43 0 645 562 ; +C 69 ; WX 600 ; N E ; B 53 0 660 562 ; +C 70 ; WX 600 ; N F ; B 53 0 660 562 ; +C 71 ; WX 600 ; N G ; B 83 -18 645 580 ; +C 72 ; WX 600 ; N H ; B 32 0 687 562 ; +C 73 ; WX 600 ; N I ; B 96 0 623 562 ; +C 74 ; WX 600 ; N J ; B 52 -18 685 562 ; +C 75 ; WX 600 ; N K ; B 38 0 671 562 ; +C 76 ; WX 600 ; N L ; B 47 0 607 562 ; +C 77 ; WX 600 ; N M ; B 4 0 715 562 ; +C 78 ; WX 600 ; N N ; B 7 -13 712 562 ; +C 79 ; WX 600 ; N O ; B 94 -18 625 580 ; +C 80 ; WX 600 ; N P ; B 79 0 644 562 ; +C 81 ; WX 600 ; N Q ; B 95 -138 625 580 ; +C 82 ; WX 600 ; N R ; B 38 0 598 562 ; +C 83 ; WX 600 ; N S ; B 76 -20 650 580 ; +C 84 ; WX 600 ; N T ; B 108 0 665 562 ; +C 85 ; WX 600 ; N U ; B 125 -18 702 562 ; +C 86 ; WX 600 ; N V ; B 105 -13 723 562 ; +C 87 ; WX 600 ; N W ; B 106 -13 722 562 ; +C 88 ; WX 600 ; N X ; B 23 0 675 562 ; +C 89 ; WX 600 ; N Y ; B 133 0 695 562 ; +C 90 ; WX 600 ; N Z ; B 86 0 610 562 ; +C 91 ; WX 600 ; N bracketleft ; B 246 -108 574 622 ; +C 92 ; WX 600 ; N backslash ; B 249 -80 468 629 ; +C 93 ; WX 600 ; N bracketright ; B 135 -108 463 622 ; +C 94 ; WX 600 ; N asciicircum ; B 175 354 587 622 ; +C 95 ; WX 600 ; N underscore ; B -27 -125 584 -75 ; +C 96 ; WX 600 ; N quoteleft ; B 343 328 457 562 ; +C 97 ; WX 600 ; N a ; B 76 -15 569 441 ; +C 98 ; WX 600 ; N b ; B 29 -15 625 629 ; +C 99 ; WX 600 ; N c ; B 106 -15 608 441 ; +C 100 ; WX 600 ; N d ; B 85 -15 640 629 ; +C 101 ; WX 600 ; N e ; B 106 -15 598 441 ; +C 102 ; WX 600 ; N f ; B 114 0 662 629 ; L i fi ; L l fl ; +C 103 ; WX 600 ; N g ; B 61 -157 657 441 ; +C 104 ; WX 600 ; N h ; B 33 0 592 629 ; +C 105 ; WX 600 ; N i ; B 95 0 515 657 ; +C 106 ; WX 600 ; N j ; B 52 -157 550 657 ; +C 107 ; WX 600 ; N k ; B 58 0 633 629 ; +C 108 ; WX 600 ; N l ; B 95 0 515 629 ; +C 109 ; WX 600 ; N m ; B -5 0 615 441 ; +C 110 ; WX 600 ; N n ; B 26 0 585 441 ; +C 111 ; WX 600 ; N o ; B 102 -15 588 441 ; +C 112 ; WX 600 ; N p ; B -24 -157 605 441 ; +C 113 ; WX 600 ; N q ; B 85 -157 682 441 ; +C 114 ; WX 600 ; N r ; B 60 0 636 441 ; +C 115 ; WX 600 ; N s ; B 78 -15 584 441 ; +C 116 ; WX 600 ; N t ; B 167 -15 561 561 ; +C 117 ; WX 600 ; N u ; B 101 -15 572 426 ; +C 118 ; WX 600 ; N v ; B 90 -10 681 426 ; +C 119 ; WX 600 ; N w ; B 76 -10 695 426 ; +C 120 ; WX 600 ; N x ; B 20 0 655 426 ; +C 121 ; WX 600 ; N y ; B -4 -157 683 426 ; +C 122 ; WX 600 ; N z ; B 99 0 593 426 ; +C 123 ; WX 600 ; N braceleft ; B 233 -108 569 622 ; +C 124 ; WX 600 ; N bar ; B 222 -250 485 750 ; +C 125 ; WX 600 ; N braceright ; B 140 -108 477 622 ; +C 126 ; WX 600 ; N asciitilde ; B 116 197 600 320 ; +C 161 ; WX 600 ; N exclamdown ; B 225 -157 445 430 ; +C 162 ; WX 600 ; N cent ; B 151 -49 588 614 ; +C 163 ; WX 600 ; N sterling ; B 124 -21 621 611 ; +C 164 ; WX 600 ; N fraction ; B 84 -57 646 665 ; +C 165 ; WX 600 ; N yen ; B 120 0 693 562 ; +C 166 ; WX 600 ; N florin ; B -26 -143 671 622 ; +C 167 ; WX 600 ; N section ; B 104 -78 590 580 ; +C 168 ; WX 600 ; N currency ; B 94 58 628 506 ; +C 169 ; WX 600 ; N quotesingle ; B 345 328 460 562 ; +C 170 ; WX 600 ; N quotedblleft ; B 262 328 541 562 ; +C 171 ; WX 600 ; N guillemotleft ; B 92 70 652 446 ; +C 172 ; WX 600 ; N guilsinglleft ; B 204 70 540 446 ; +C 173 ; WX 600 ; N guilsinglright ; B 170 70 506 446 ; +C 174 ; WX 600 ; N fi ; B 3 0 619 629 ; +C 175 ; WX 600 ; N fl ; B 3 0 619 629 ; +C 177 ; WX 600 ; N endash ; B 124 231 586 285 ; +C 178 ; WX 600 ; N dagger ; B 217 -78 546 580 ; +C 179 ; WX 600 ; N daggerdbl ; B 163 -78 546 580 ; +C 180 ; WX 600 ; N periodcentered ; B 275 189 434 327 ; +C 182 ; WX 600 ; N paragraph ; B 100 -78 630 562 ; +C 183 ; WX 600 ; N bullet ; B 224 130 485 383 ; +C 184 ; WX 600 ; N quotesinglbase ; B 185 -134 397 100 ; +C 185 ; WX 600 ; N quotedblbase ; B 115 -134 478 100 ; +C 186 ; WX 600 ; N quotedblright ; B 213 328 576 562 ; +C 187 ; WX 600 ; N guillemotright ; B 58 70 618 446 ; +C 188 ; WX 600 ; N ellipsis ; B 46 -15 575 111 ; +C 189 ; WX 600 ; N perthousand ; B 59 -15 627 622 ; +C 191 ; WX 600 ; N questiondown ; B 105 -157 466 430 ; +C 193 ; WX 600 ; N grave ; B 294 497 484 672 ; +C 194 ; WX 600 ; N acute ; B 348 497 612 672 ; +C 195 ; WX 600 ; N circumflex ; B 229 477 581 654 ; +C 196 ; WX 600 ; N tilde ; B 212 489 629 606 ; +C 197 ; WX 600 ; N macron ; B 232 525 600 565 ; +C 198 ; WX 600 ; N breve ; B 279 501 576 609 ; +C 199 ; WX 600 ; N dotaccent ; B 360 477 466 580 ; +C 200 ; WX 600 ; N dieresis ; B 262 492 570 595 ; +C 202 ; WX 600 ; N ring ; B 332 463 500 627 ; +C 203 ; WX 600 ; N cedilla ; B 197 -151 344 10 ; +C 205 ; WX 600 ; N hungarumlaut ; B 239 497 683 672 ; +C 206 ; WX 600 ; N ogonek ; B 207 -151 348 0 ; +C 207 ; WX 600 ; N caron ; B 262 492 614 669 ; +C 208 ; WX 600 ; N emdash ; B 49 231 661 285 ; +C 225 ; WX 600 ; N AE ; B 3 0 655 562 ; +C 227 ; WX 600 ; N ordfeminine ; B 209 249 512 580 ; +C 232 ; WX 600 ; N Lslash ; B 47 0 607 562 ; +C 233 ; WX 600 ; N Oslash ; B 94 -80 625 629 ; +C 234 ; WX 600 ; N OE ; B 59 0 672 562 ; +C 235 ; WX 600 ; N ordmasculine ; B 210 249 535 580 ; +C 241 ; WX 600 ; N ae ; B 41 -15 626 441 ; +C 245 ; WX 600 ; N dotlessi ; B 95 0 515 426 ; +C 248 ; WX 600 ; N lslash ; B 95 0 583 629 ; +C 249 ; WX 600 ; N oslash ; B 102 -80 588 506 ; +C 250 ; WX 600 ; N oe ; B 54 -15 615 441 ; +C 251 ; WX 600 ; N germandbls ; B 48 -15 617 629 ; +C -1 ; WX 600 ; N Odieresis ; B 94 -18 625 731 ; +C -1 ; WX 600 ; N logicalnot ; B 155 108 591 369 ; +C -1 ; WX 600 ; N minus ; B 129 232 580 283 ; +C -1 ; WX 600 ; N merge ; B 187 -15 503 436 ; +C -1 ; WX 600 ; N degree ; B 214 269 576 622 ; +C -1 ; WX 600 ; N dectab ; B 18 0 593 227 ; +C -1 ; WX 600 ; N ll ; B 33 0 616 629 ; +C -1 ; WX 600 ; N IJ ; B 32 -18 702 562 ; +C -1 ; WX 600 ; N Eacute ; B 53 0 668 793 ; +C -1 ; WX 600 ; N Ocircumflex ; B 94 -18 625 775 ; +C -1 ; WX 600 ; N ucircumflex ; B 101 -15 572 654 ; +C -1 ; WX 600 ; N left ; B 114 68 580 348 ; +C -1 ; WX 600 ; N threesuperior ; B 213 240 501 622 ; +C -1 ; WX 600 ; N up ; B 223 0 503 437 ; +C -1 ; WX 600 ; N multiply ; B 103 43 607 470 ; +C -1 ; WX 600 ; N Scaron ; B 76 -20 673 805 ; +C -1 ; WX 600 ; N tab ; B 19 0 641 562 ; +C -1 ; WX 600 ; N Ucircumflex ; B 125 -18 702 775 ; +C -1 ; WX 600 ; N divide ; B 136 48 573 467 ; +C -1 ; WX 600 ; N Acircumflex ; B 3 0 607 775 ; +C -1 ; WX 600 ; N eacute ; B 106 -15 612 672 ; +C -1 ; WX 600 ; N uacute ; B 101 -15 602 672 ; +C -1 ; WX 600 ; N Aacute ; B 3 0 658 793 ; +C -1 ; WX 600 ; N copyright ; B 53 -18 667 580 ; +C -1 ; WX 600 ; N twosuperior ; B 230 249 535 622 ; +C -1 ; WX 600 ; N Ecircumflex ; B 53 0 660 775 ; +C -1 ; WX 600 ; N ntilde ; B 26 0 629 606 ; +C -1 ; WX 600 ; N down ; B 187 -15 467 426 ; +C -1 ; WX 600 ; N center ; B 103 14 623 580 ; +C -1 ; WX 600 ; N onesuperior ; B 231 249 491 622 ; +C -1 ; WX 600 ; N ij ; B 37 -157 630 657 ; +C -1 ; WX 600 ; N edieresis ; B 106 -15 598 595 ; +C -1 ; WX 600 ; N graybox ; B 76 0 652 599 ; +C -1 ; WX 600 ; N odieresis ; B 102 -15 588 595 ; +C -1 ; WX 600 ; N Ograve ; B 94 -18 625 793 ; +C -1 ; WX 600 ; N threequarters ; B 73 -56 659 666 ; +C -1 ; WX 600 ; N plusminus ; B 96 44 594 558 ; +C -1 ; WX 600 ; N prescription ; B 27 -15 617 562 ; +C -1 ; WX 600 ; N eth ; B 102 -15 639 629 ; +C -1 ; WX 600 ; N largebullet ; B 315 220 395 297 ; +C -1 ; WX 600 ; N egrave ; B 106 -15 598 672 ; +C -1 ; WX 600 ; N ccedilla ; B 106 -151 614 441 ; +C -1 ; WX 600 ; N notegraphic ; B 143 -15 564 572 ; +C -1 ; WX 600 ; N Udieresis ; B 125 -18 702 731 ; +C -1 ; WX 600 ; N Gcaron ; B 83 -18 645 805 ; +C -1 ; WX 600 ; N arrowdown ; B 152 -15 520 608 ; +C -1 ; WX 600 ; N format ; B -28 -157 185 607 ; +C -1 ; WX 600 ; N Otilde ; B 94 -18 656 732 ; +C -1 ; WX 600 ; N Idieresis ; B 96 0 623 731 ; +C -1 ; WX 600 ; N adieresis ; B 76 -15 570 595 ; +C -1 ; WX 600 ; N ecircumflex ; B 106 -15 598 654 ; +C -1 ; WX 600 ; N Eth ; B 43 0 645 562 ; +C -1 ; WX 600 ; N onequarter ; B 65 -57 674 665 ; +C -1 ; WX 600 ; N LL ; B 8 0 647 562 ; +C -1 ; WX 600 ; N agrave ; B 76 -15 569 672 ; +C -1 ; WX 600 ; N Zcaron ; B 86 0 643 805 ; +C -1 ; WX 600 ; N Scedilla ; B 76 -151 650 580 ; +C -1 ; WX 600 ; N Idot ; B 96 0 623 716 ; +C -1 ; WX 600 ; N Iacute ; B 96 0 638 793 ; +C -1 ; WX 600 ; N indent ; B 108 68 574 348 ; +C -1 ; WX 600 ; N Ugrave ; B 125 -18 702 793 ; +C -1 ; WX 600 ; N scaron ; B 78 -15 614 669 ; +C -1 ; WX 600 ; N overscore ; B 123 579 734 629 ; +C -1 ; WX 600 ; N Aring ; B 3 0 607 753 ; +C -1 ; WX 600 ; N Ccedilla ; B 93 -151 658 580 ; +C -1 ; WX 600 ; N Igrave ; B 96 0 623 793 ; +C -1 ; WX 600 ; N brokenbar ; B 238 -175 469 675 ; +C -1 ; WX 600 ; N Oacute ; B 94 -18 638 793 ; +C -1 ; WX 600 ; N otilde ; B 102 -15 629 606 ; +C -1 ; WX 600 ; N Yacute ; B 133 0 695 793 ; +C -1 ; WX 600 ; N lira ; B 118 -21 621 611 ; +C -1 ; WX 600 ; N Icircumflex ; B 96 0 623 775 ; +C -1 ; WX 600 ; N Atilde ; B 3 0 656 732 ; +C -1 ; WX 600 ; N Uacute ; B 125 -18 702 793 ; +C -1 ; WX 600 ; N Ydieresis ; B 133 0 695 731 ; +C -1 ; WX 600 ; N ydieresis ; B -4 -157 683 595 ; +C -1 ; WX 600 ; N idieresis ; B 95 0 540 595 ; +C -1 ; WX 600 ; N Adieresis ; B 3 0 607 731 ; +C -1 ; WX 600 ; N mu ; B 72 -157 572 426 ; +C -1 ; WX 600 ; N trademark ; B 75 263 742 562 ; +C -1 ; WX 600 ; N oacute ; B 102 -15 612 672 ; +C -1 ; WX 600 ; N acircumflex ; B 76 -15 581 654 ; +C -1 ; WX 600 ; N Agrave ; B 3 0 607 793 ; +C -1 ; WX 600 ; N return ; B 79 0 700 562 ; +C -1 ; WX 600 ; N atilde ; B 76 -15 629 606 ; +C -1 ; WX 600 ; N square ; B 19 0 700 562 ; +C -1 ; WX 600 ; N registered ; B 53 -18 667 580 ; +C -1 ; WX 600 ; N stop ; B 19 0 700 562 ; +C -1 ; WX 600 ; N udieresis ; B 101 -15 572 595 ; +C -1 ; WX 600 ; N arrowup ; B 209 0 577 623 ; +C -1 ; WX 600 ; N igrave ; B 95 0 515 672 ; +C -1 ; WX 600 ; N Edieresis ; B 53 0 660 731 ; +C -1 ; WX 600 ; N zcaron ; B 99 0 624 669 ; +C -1 ; WX 600 ; N arrowboth ; B 36 115 692 483 ; +C -1 ; WX 600 ; N gcaron ; B 61 -157 657 669 ; +C -1 ; WX 600 ; N arrowleft ; B 40 115 693 483 ; +C -1 ; WX 600 ; N aacute ; B 76 -15 612 672 ; +C -1 ; WX 600 ; N ocircumflex ; B 102 -15 588 654 ; +C -1 ; WX 600 ; N scedilla ; B 78 -151 584 441 ; +C -1 ; WX 600 ; N ograve ; B 102 -15 588 672 ; +C -1 ; WX 600 ; N onehalf ; B 65 -57 669 665 ; +C -1 ; WX 600 ; N ugrave ; B 101 -15 572 672 ; +C -1 ; WX 600 ; N Ntilde ; B 7 -13 712 732 ; +C -1 ; WX 600 ; N iacute ; B 95 0 612 672 ; +C -1 ; WX 600 ; N arrowright ; B 34 115 688 483 ; +C -1 ; WX 600 ; N Thorn ; B 79 0 606 562 ; +C -1 ; WX 600 ; N Egrave ; B 53 0 660 793 ; +C -1 ; WX 600 ; N thorn ; B -24 -157 605 629 ; +C -1 ; WX 600 ; N aring ; B 76 -15 569 627 ; +C -1 ; WX 600 ; N yacute ; B -4 -157 683 672 ; +C -1 ; WX 600 ; N icircumflex ; B 95 0 551 654 ; +EndCharMetrics +StartComposites 58 +CC Aacute 2 ; PCC A 0 0 ; PCC acute 46 121 ; +CC Acircumflex 2 ; PCC A 0 0 ; PCC circumflex -4 121 ; +CC Adieresis 2 ; PCC A 0 0 ; PCC dieresis -1 136 ; +CC Agrave 2 ; PCC A 0 0 ; PCC grave -4 121 ; +CC Aring 2 ; PCC A 0 0 ; PCC ring 12 126 ; +CC Atilde 2 ; PCC A 0 0 ; PCC tilde 27 126 ; +CC Eacute 2 ; PCC E 0 0 ; PCC acute 56 121 ; +CC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 26 121 ; +CC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 29 136 ; +CC Egrave 2 ; PCC E 0 0 ; PCC grave 26 121 ; +CC Gcaron 2 ; PCC G 0 0 ; PCC caron 29 136 ; +CC Iacute 2 ; PCC I 0 0 ; PCC acute 26 121 ; +CC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 26 121 ; +CC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 29 136 ; +CC Igrave 2 ; PCC I 0 0 ; PCC grave 26 121 ; +CC Ntilde 2 ; PCC N 0 0 ; PCC tilde 27 126 ; +CC Oacute 2 ; PCC O 0 0 ; PCC acute 26 121 ; +CC Ocircumflex 2 ; PCC O 0 0 ; PCC circumflex 26 121 ; +CC Odieresis 2 ; PCC O 0 0 ; PCC dieresis 29 136 ; +CC Ograve 2 ; PCC O 0 0 ; PCC grave 26 121 ; +CC Otilde 2 ; PCC O 0 0 ; PCC tilde 27 126 ; +CC Scaron 2 ; PCC S 0 0 ; PCC caron 59 136 ; +CC Uacute 2 ; PCC U 0 0 ; PCC acute 56 121 ; +CC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 26 121 ; +CC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 29 136 ; +CC Ugrave 2 ; PCC U 0 0 ; PCC grave -4 121 ; +CC Yacute 2 ; PCC Y 0 0 ; PCC acute 56 121 ; +CC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 29 136 ; +CC Zcaron 2 ; PCC Z 0 0 ; PCC caron 29 136 ; +CC aacute 2 ; PCC a 0 0 ; PCC acute 0 0 ; +CC acircumflex 2 ; PCC a 0 0 ; PCC circumflex 0 0 ; +CC adieresis 2 ; PCC a 0 0 ; PCC dieresis 0 0 ; +CC agrave 2 ; PCC a 0 0 ; PCC grave 0 0 ; +CC aring 2 ; PCC a 0 0 ; PCC ring 0 0 ; +CC atilde 2 ; PCC a 0 0 ; PCC tilde 0 0 ; +CC eacute 2 ; PCC e 0 0 ; PCC acute 0 0 ; +CC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 0 0 ; +CC edieresis 2 ; PCC e 0 0 ; PCC dieresis 0 0 ; +CC egrave 2 ; PCC e 0 0 ; PCC grave 0 0 ; +CC gcaron 2 ; PCC g 0 0 ; PCC caron -30 0 ; +CC iacute 2 ; PCC dotlessi 0 0 ; PCC acute 0 0 ; +CC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -30 0 ; +CC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -30 0 ; +CC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -30 0 ; +CC ntilde 2 ; PCC n 0 0 ; PCC tilde 0 0 ; +CC oacute 2 ; PCC o 0 0 ; PCC acute 0 0 ; +CC ocircumflex 2 ; PCC o 0 0 ; PCC circumflex 0 0 ; +CC odieresis 2 ; PCC o 0 0 ; PCC dieresis 0 0 ; +CC ograve 2 ; PCC o 0 0 ; PCC grave 0 0 ; +CC otilde 2 ; PCC o 0 0 ; PCC tilde 0 0 ; +CC scaron 2 ; PCC s 0 0 ; PCC caron 0 0 ; +CC uacute 2 ; PCC u 0 0 ; PCC acute -10 0 ; +CC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex -10 0 ; +CC udieresis 2 ; PCC u 0 0 ; PCC dieresis 0 0 ; +CC ugrave 2 ; PCC u 0 0 ; PCC grave -30 0 ; +CC yacute 2 ; PCC y 0 0 ; PCC acute -20 0 ; +CC ydieresis 2 ; PCC y 0 0 ; PCC dieresis -10 0 ; +CC zcaron 2 ; PCC z 0 0 ; PCC caron 10 0 ; +EndComposites +EndFontMetrics diff --git a/shared/package-files/34/34a1d6412f78309939ff2be380921af7ced2f5f70a65ed15bf620f2d58bafdc5/blob b/shared/package-files/34/34a1d6412f78309939ff2be380921af7ced2f5f70a65ed15bf620f2d58bafdc5/blob new file mode 100644 index 0000000000000000000000000000000000000000..34df2e3ed20e752bd9c2d773ed59175cfced1dc6 --- /dev/null +++ b/shared/package-files/34/34a1d6412f78309939ff2be380921af7ced2f5f70a65ed15bf620f2d58bafdc5/blob @@ -0,0 +1,91 @@ +#pragma once + +// @generated by torchgen/gen.py from Function.h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#include + +namespace at { + + +// aten::cudnn_convolution_add_relu(Tensor self, Tensor weight, Tensor z, Scalar? alpha, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, SymInt groups) -> Tensor +inline at::Tensor cudnn_convolution_add_relu(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups) { + return at::_ops::cudnn_convolution_add_relu::call(self, weight, z, alpha, bias, c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(dilation), groups); +} +namespace symint { + template ::value>> + at::Tensor cudnn_convolution_add_relu(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups) { + return at::_ops::cudnn_convolution_add_relu::call(self, weight, z, alpha, bias, c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(dilation), groups); + } +} + +// aten::cudnn_convolution_add_relu(Tensor self, Tensor weight, Tensor z, Scalar? alpha, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, SymInt groups) -> Tensor +inline at::Tensor cudnn_convolution_add_relu_symint(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups) { + return at::_ops::cudnn_convolution_add_relu::call(self, weight, z, alpha, bias, stride, padding, dilation, groups); +} +namespace symint { + template ::value>> + at::Tensor cudnn_convolution_add_relu(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups) { + return at::_ops::cudnn_convolution_add_relu::call(self, weight, z, alpha, bias, stride, padding, dilation, groups); + } +} + +// aten::cudnn_convolution_add_relu.out(Tensor self, Tensor weight, Tensor z, Scalar? alpha, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, SymInt groups, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & cudnn_convolution_add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(dilation), groups, out); +} +namespace symint { + template ::value>> + at::Tensor & cudnn_convolution_add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(dilation), groups, out); + } +} + +// aten::cudnn_convolution_add_relu.out(Tensor self, Tensor weight, Tensor z, Scalar? alpha, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, SymInt groups, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & cudnn_convolution_add_relu_outf(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups, at::Tensor & out) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(dilation), groups, out); +} +namespace symint { + template ::value>> + at::Tensor & cudnn_convolution_add_relu_outf(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, int64_t groups, at::Tensor & out) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, c10::fromIntArrayRefSlow(stride), c10::fromIntArrayRefSlow(padding), c10::fromIntArrayRefSlow(dilation), groups, out); + } +} + +// aten::cudnn_convolution_add_relu.out(Tensor self, Tensor weight, Tensor z, Scalar? alpha, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, SymInt groups, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & cudnn_convolution_add_relu_symint_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, stride, padding, dilation, groups, out); +} +namespace symint { + template ::value>> + at::Tensor & cudnn_convolution_add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, stride, padding, dilation, groups, out); + } +} + +// aten::cudnn_convolution_add_relu.out(Tensor self, Tensor weight, Tensor z, Scalar? alpha, Tensor? bias, SymInt[] stride, SymInt[] padding, SymInt[] dilation, SymInt groups, *, Tensor(a!) out) -> Tensor(a!) +inline at::Tensor & cudnn_convolution_add_relu_symint_outf(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups, at::Tensor & out) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, stride, padding, dilation, groups, out); +} +namespace symint { + template ::value>> + at::Tensor & cudnn_convolution_add_relu_outf(const at::Tensor & self, const at::Tensor & weight, const at::Tensor & z, const c10::optional & alpha, const c10::optional & bias, c10::SymIntArrayRef stride, c10::SymIntArrayRef padding, c10::SymIntArrayRef dilation, c10::SymInt groups, at::Tensor & out) { + return at::_ops::cudnn_convolution_add_relu_out::call(self, weight, z, alpha, bias, stride, padding, dilation, groups, out); + } +} + +} diff --git a/shared/package-files/34/34a1e41697a14794034f956b084484aa367d6bf16ad0991c87399716dccb45db/blob b/shared/package-files/34/34a1e41697a14794034f956b084484aa367d6bf16ad0991c87399716dccb45db/blob new file mode 100644 index 0000000000000000000000000000000000000000..29d1f740e021fd30d3bfc7d72a5e6baefe62ac4c --- /dev/null +++ b/shared/package-files/34/34a1e41697a14794034f956b084484aa367d6bf16ad0991c87399716dccb45db/blob @@ -0,0 +1,118 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +import numpy as np + +from pandas.compat._optional import import_optional_dependency + + +def generate_online_numba_ewma_func( + nopython: bool, + nogil: bool, + parallel: bool, +): + """ + Generate a numba jitted groupby ewma function specified by values + from engine_kwargs. + + Parameters + ---------- + nopython : bool + nopython to be passed into numba.jit + nogil : bool + nogil to be passed into numba.jit + parallel : bool + parallel to be passed into numba.jit + + Returns + ------- + Numba function + """ + if TYPE_CHECKING: + import numba + else: + numba = import_optional_dependency("numba") + + @numba.jit(nopython=nopython, nogil=nogil, parallel=parallel) + def online_ewma( + values: np.ndarray, + deltas: np.ndarray, + minimum_periods: int, + old_wt_factor: float, + new_wt: float, + old_wt: np.ndarray, + adjust: bool, + ignore_na: bool, + ): + """ + Compute online exponentially weighted mean per column over 2D values. + + Takes the first observation as is, then computes the subsequent + exponentially weighted mean accounting minimum periods. + """ + result = np.empty(values.shape) + weighted_avg = values[0].copy() + nobs = (~np.isnan(weighted_avg)).astype(np.int64) + result[0] = np.where(nobs >= minimum_periods, weighted_avg, np.nan) + + for i in range(1, len(values)): + cur = values[i] + is_observations = ~np.isnan(cur) + nobs += is_observations.astype(np.int64) + for j in numba.prange(len(cur)): + if not np.isnan(weighted_avg[j]): + if is_observations[j] or not ignore_na: + # note that len(deltas) = len(vals) - 1 and deltas[i] is to be + # used in conjunction with vals[i+1] + old_wt[j] *= old_wt_factor ** deltas[j - 1] + if is_observations[j]: + # avoid numerical errors on constant series + if weighted_avg[j] != cur[j]: + weighted_avg[j] = ( + (old_wt[j] * weighted_avg[j]) + (new_wt * cur[j]) + ) / (old_wt[j] + new_wt) + if adjust: + old_wt[j] += new_wt + else: + old_wt[j] = 1.0 + elif is_observations[j]: + weighted_avg[j] = cur[j] + + result[i] = np.where(nobs >= minimum_periods, weighted_avg, np.nan) + + return result, old_wt + + return online_ewma + + +class EWMMeanState: + def __init__(self, com, adjust, ignore_na, axis, shape) -> None: + alpha = 1.0 / (1.0 + com) + self.axis = axis + self.shape = shape + self.adjust = adjust + self.ignore_na = ignore_na + self.new_wt = 1.0 if adjust else alpha + self.old_wt_factor = 1.0 - alpha + self.old_wt = np.ones(self.shape[self.axis - 1]) + self.last_ewm = None + + def run_ewm(self, weighted_avg, deltas, min_periods, ewm_func): + result, old_wt = ewm_func( + weighted_avg, + deltas, + min_periods, + self.old_wt_factor, + self.new_wt, + self.old_wt, + self.adjust, + self.ignore_na, + ) + self.old_wt = old_wt + self.last_ewm = result[-1] + return result + + def reset(self) -> None: + self.old_wt = np.ones(self.shape[self.axis - 1]) + self.last_ewm = None diff --git a/shared/package-files/34/34a5d2cde2e00a03acd84768ccd352ebdc3ac008a8f41ab1caee698e4a474ca0/blob b/shared/package-files/34/34a5d2cde2e00a03acd84768ccd352ebdc3ac008a8f41ab1caee698e4a474ca0/blob new file mode 100644 index 0000000000000000000000000000000000000000..870c39fe7f5037152dd5b430e6b6f3f7e5d7a8de --- /dev/null +++ b/shared/package-files/34/34a5d2cde2e00a03acd84768ccd352ebdc3ac008a8f41ab1caee698e4a474ca0/blob @@ -0,0 +1,169 @@ +"""Simple class to read IFF chunks. + +An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File +Format)) has the following structure: + ++----------------+ +| ID (4 bytes) | ++----------------+ +| size (4 bytes) | ++----------------+ +| data | +| ... | ++----------------+ + +The ID is a 4-byte string which identifies the type of chunk. + +The size field (a 32-bit value, encoded using big-endian byte order) +gives the size of the whole chunk, including the 8-byte header. + +Usually an IFF-type file consists of one or more chunks. The proposed +usage of the Chunk class defined here is to instantiate an instance at +the start of each chunk and read from the instance until it reaches +the end, after which a new instance can be instantiated. At the end +of the file, creating a new instance will fail with an EOFError +exception. + +Usage: +while True: + try: + chunk = Chunk(file) + except EOFError: + break + chunktype = chunk.getname() + while True: + data = chunk.read(nbytes) + if not data: + pass + # do something with data + +The interface is file-like. The implemented methods are: +read, close, seek, tell, isatty. +Extra methods are: skip() (called by close, skips to the end of the chunk), +getname() (returns the name (ID) of the chunk) + +The __init__ method has one required argument, a file-like object +(including a chunk instance), and one optional argument, a flag which +specifies whether or not chunks are aligned on 2-byte boundaries. The +default is 1, i.e. aligned. +""" + +class Chunk: + def __init__(self, file, align=True, bigendian=True, inclheader=False): + import struct + self.closed = False + self.align = align # whether to align to word (2-byte) boundaries + if bigendian: + strflag = '>' + else: + strflag = '<' + self.file = file + self.chunkname = file.read(4) + if len(self.chunkname) < 4: + raise EOFError + try: + self.chunksize = struct.unpack_from(strflag+'L', file.read(4))[0] + except struct.error: + raise EOFError from None + if inclheader: + self.chunksize = self.chunksize - 8 # subtract header + self.size_read = 0 + try: + self.offset = self.file.tell() + except (AttributeError, OSError): + self.seekable = False + else: + self.seekable = True + + def getname(self): + """Return the name (ID) of the current chunk.""" + return self.chunkname + + def getsize(self): + """Return the size of the current chunk.""" + return self.chunksize + + def close(self): + if not self.closed: + try: + self.skip() + finally: + self.closed = True + + def isatty(self): + if self.closed: + raise ValueError("I/O operation on closed file") + return False + + def seek(self, pos, whence=0): + """Seek to specified position into the chunk. + Default position is 0 (start of chunk). + If the file is not seekable, this will result in an error. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if not self.seekable: + raise OSError("cannot seek") + if whence == 1: + pos = pos + self.size_read + elif whence == 2: + pos = pos + self.chunksize + if pos < 0 or pos > self.chunksize: + raise RuntimeError + self.file.seek(self.offset + pos, 0) + self.size_read = pos + + def tell(self): + if self.closed: + raise ValueError("I/O operation on closed file") + return self.size_read + + def read(self, size=-1): + """Read at most size bytes from the chunk. + If size is omitted or negative, read until the end + of the chunk. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if self.size_read >= self.chunksize: + return b'' + if size < 0: + size = self.chunksize - self.size_read + if size > self.chunksize - self.size_read: + size = self.chunksize - self.size_read + data = self.file.read(size) + self.size_read = self.size_read + len(data) + if self.size_read == self.chunksize and \ + self.align and \ + (self.chunksize & 1): + dummy = self.file.read(1) + self.size_read = self.size_read + len(dummy) + return data + + def skip(self): + """Skip the rest of the chunk. + If you are not interested in the contents of the chunk, + this method should be called so that the file points to + the start of the next chunk. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if self.seekable: + try: + n = self.chunksize - self.size_read + # maybe fix alignment + if self.align and (self.chunksize & 1): + n = n + 1 + self.file.seek(n, 1) + self.size_read = self.size_read + n + return + except OSError: + pass + while self.size_read < self.chunksize: + n = min(8192, self.chunksize - self.size_read) + dummy = self.read(n) + if not dummy: + raise EOFError diff --git a/shared/package-files/34/34aa2cf7c8f9e2e63db5d5f372d23f9ff9f0151ad734ec1a9f12c3a8364e370e/blob b/shared/package-files/34/34aa2cf7c8f9e2e63db5d5f372d23f9ff9f0151ad734ec1a9f12c3a8364e370e/blob new file mode 100644 index 0000000000000000000000000000000000000000..87f23b2bbe8007fc36fd01b0ff5dfdc27ef7366e --- /dev/null +++ b/shared/package-files/34/34aa2cf7c8f9e2e63db5d5f372d23f9ff9f0151ad734ec1a9f12c3a8364e370e/blob @@ -0,0 +1,191 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include "arrow/status.h" +#include "arrow/type_fwd.h" +#include "arrow/util/visibility.h" + +namespace arrow { + +/// \brief Abstract array visitor class +/// +/// Subclass this to create a visitor that can be used with the Array::Accept() +/// method. +class ARROW_EXPORT ArrayVisitor { + public: + virtual ~ArrayVisitor() = default; + + virtual Status Visit(const NullArray& array); + virtual Status Visit(const BooleanArray& array); + virtual Status Visit(const Int8Array& array); + virtual Status Visit(const Int16Array& array); + virtual Status Visit(const Int32Array& array); + virtual Status Visit(const Int64Array& array); + virtual Status Visit(const UInt8Array& array); + virtual Status Visit(const UInt16Array& array); + virtual Status Visit(const UInt32Array& array); + virtual Status Visit(const UInt64Array& array); + virtual Status Visit(const HalfFloatArray& array); + virtual Status Visit(const FloatArray& array); + virtual Status Visit(const DoubleArray& array); + virtual Status Visit(const StringArray& array); + virtual Status Visit(const StringViewArray& array); + virtual Status Visit(const BinaryArray& array); + virtual Status Visit(const BinaryViewArray& array); + virtual Status Visit(const LargeStringArray& array); + virtual Status Visit(const LargeBinaryArray& array); + virtual Status Visit(const FixedSizeBinaryArray& array); + virtual Status Visit(const Date32Array& array); + virtual Status Visit(const Date64Array& array); + virtual Status Visit(const Time32Array& array); + virtual Status Visit(const Time64Array& array); + virtual Status Visit(const TimestampArray& array); + virtual Status Visit(const DayTimeIntervalArray& array); + virtual Status Visit(const MonthDayNanoIntervalArray& array); + virtual Status Visit(const MonthIntervalArray& array); + virtual Status Visit(const DurationArray& array); + virtual Status Visit(const Decimal32Array& array); + virtual Status Visit(const Decimal64Array& array); + virtual Status Visit(const Decimal128Array& array); + virtual Status Visit(const Decimal256Array& array); + virtual Status Visit(const ListArray& array); + virtual Status Visit(const LargeListArray& array); + virtual Status Visit(const ListViewArray& array); + virtual Status Visit(const LargeListViewArray& array); + virtual Status Visit(const MapArray& array); + virtual Status Visit(const FixedSizeListArray& array); + virtual Status Visit(const StructArray& array); + virtual Status Visit(const SparseUnionArray& array); + virtual Status Visit(const DenseUnionArray& array); + virtual Status Visit(const DictionaryArray& array); + virtual Status Visit(const RunEndEncodedArray& array); + virtual Status Visit(const ExtensionArray& array); +}; + +/// \brief Abstract type visitor class +/// +/// Subclass this to create a visitor that can be used with the DataType::Accept() +/// method. +class ARROW_EXPORT TypeVisitor { + public: + virtual ~TypeVisitor() = default; + + virtual Status Visit(const NullType& type); + virtual Status Visit(const BooleanType& type); + virtual Status Visit(const Int8Type& type); + virtual Status Visit(const Int16Type& type); + virtual Status Visit(const Int32Type& type); + virtual Status Visit(const Int64Type& type); + virtual Status Visit(const UInt8Type& type); + virtual Status Visit(const UInt16Type& type); + virtual Status Visit(const UInt32Type& type); + virtual Status Visit(const UInt64Type& type); + virtual Status Visit(const HalfFloatType& type); + virtual Status Visit(const FloatType& type); + virtual Status Visit(const DoubleType& type); + virtual Status Visit(const StringType& type); + virtual Status Visit(const StringViewType& type); + virtual Status Visit(const BinaryType& type); + virtual Status Visit(const BinaryViewType& type); + virtual Status Visit(const LargeStringType& type); + virtual Status Visit(const LargeBinaryType& type); + virtual Status Visit(const FixedSizeBinaryType& type); + virtual Status Visit(const Date64Type& type); + virtual Status Visit(const Date32Type& type); + virtual Status Visit(const Time32Type& type); + virtual Status Visit(const Time64Type& type); + virtual Status Visit(const TimestampType& type); + virtual Status Visit(const MonthDayNanoIntervalType& type); + virtual Status Visit(const MonthIntervalType& type); + virtual Status Visit(const DayTimeIntervalType& type); + virtual Status Visit(const DurationType& type); + virtual Status Visit(const Decimal32Type& type); + virtual Status Visit(const Decimal64Type& type); + virtual Status Visit(const Decimal128Type& type); + virtual Status Visit(const Decimal256Type& type); + virtual Status Visit(const ListType& type); + virtual Status Visit(const LargeListType& type); + virtual Status Visit(const ListViewType& scalar); + virtual Status Visit(const LargeListViewType& scalar); + virtual Status Visit(const MapType& type); + virtual Status Visit(const FixedSizeListType& type); + virtual Status Visit(const StructType& type); + virtual Status Visit(const SparseUnionType& type); + virtual Status Visit(const DenseUnionType& type); + virtual Status Visit(const DictionaryType& type); + virtual Status Visit(const RunEndEncodedType& type); + virtual Status Visit(const ExtensionType& type); +}; + +/// \brief Abstract scalar visitor class +/// +/// Subclass this to create a visitor that can be used with the Scalar::Accept() +/// method. +class ARROW_EXPORT ScalarVisitor { + public: + virtual ~ScalarVisitor() = default; + + virtual Status Visit(const NullScalar& scalar); + virtual Status Visit(const BooleanScalar& scalar); + virtual Status Visit(const Int8Scalar& scalar); + virtual Status Visit(const Int16Scalar& scalar); + virtual Status Visit(const Int32Scalar& scalar); + virtual Status Visit(const Int64Scalar& scalar); + virtual Status Visit(const UInt8Scalar& scalar); + virtual Status Visit(const UInt16Scalar& scalar); + virtual Status Visit(const UInt32Scalar& scalar); + virtual Status Visit(const UInt64Scalar& scalar); + virtual Status Visit(const HalfFloatScalar& scalar); + virtual Status Visit(const FloatScalar& scalar); + virtual Status Visit(const DoubleScalar& scalar); + virtual Status Visit(const StringScalar& scalar); + virtual Status Visit(const StringViewScalar& scalar); + virtual Status Visit(const BinaryScalar& scalar); + virtual Status Visit(const BinaryViewScalar& scalar); + virtual Status Visit(const LargeStringScalar& scalar); + virtual Status Visit(const LargeBinaryScalar& scalar); + virtual Status Visit(const FixedSizeBinaryScalar& scalar); + virtual Status Visit(const Date64Scalar& scalar); + virtual Status Visit(const Date32Scalar& scalar); + virtual Status Visit(const Time32Scalar& scalar); + virtual Status Visit(const Time64Scalar& scalar); + virtual Status Visit(const TimestampScalar& scalar); + virtual Status Visit(const DayTimeIntervalScalar& scalar); + virtual Status Visit(const MonthDayNanoIntervalScalar& type); + virtual Status Visit(const MonthIntervalScalar& scalar); + virtual Status Visit(const DurationScalar& scalar); + virtual Status Visit(const Decimal32Scalar& scalar); + virtual Status Visit(const Decimal64Scalar& scalar); + virtual Status Visit(const Decimal128Scalar& scalar); + virtual Status Visit(const Decimal256Scalar& scalar); + virtual Status Visit(const ListScalar& scalar); + virtual Status Visit(const LargeListScalar& scalar); + virtual Status Visit(const ListViewScalar& scalar); + virtual Status Visit(const LargeListViewScalar& scalar); + virtual Status Visit(const MapScalar& scalar); + virtual Status Visit(const FixedSizeListScalar& scalar); + virtual Status Visit(const StructScalar& scalar); + virtual Status Visit(const DictionaryScalar& scalar); + virtual Status Visit(const SparseUnionScalar& scalar); + virtual Status Visit(const DenseUnionScalar& scalar); + virtual Status Visit(const RunEndEncodedScalar& scalar); + virtual Status Visit(const ExtensionScalar& scalar); +}; + +} // namespace arrow diff --git a/shared/package-files/34/34aa3c56a2e2a09e279d75c6996e0a75ab3117dd04147919687797d5f4f4f02f/blob b/shared/package-files/34/34aa3c56a2e2a09e279d75c6996e0a75ab3117dd04147919687797d5f4f4f02f/blob new file mode 100644 index 0000000000000000000000000000000000000000..72bd6f25a554b303d0bf5028145cf3a5c71b3e06 --- /dev/null +++ b/shared/package-files/34/34aa3c56a2e2a09e279d75c6996e0a75ab3117dd04147919687797d5f4f4f02f/blob @@ -0,0 +1,120 @@ +""" +A module that implements tooling to enable easy warnings about deprecations. +""" + +import logging +import warnings +from typing import Any, Optional, TextIO, Type, Union + +from pip._vendor.packaging.version import parse + +from pip import __version__ as current_version # NOTE: tests patch this name. + +DEPRECATION_MSG_PREFIX = "DEPRECATION: " + + +class PipDeprecationWarning(Warning): + pass + + +_original_showwarning: Any = None + + +# Warnings <-> Logging Integration +def _showwarning( + message: Union[Warning, str], + category: Type[Warning], + filename: str, + lineno: int, + file: Optional[TextIO] = None, + line: Optional[str] = None, +) -> None: + if file is not None: + if _original_showwarning is not None: + _original_showwarning(message, category, filename, lineno, file, line) + elif issubclass(category, PipDeprecationWarning): + # We use a specially named logger which will handle all of the + # deprecation messages for pip. + logger = logging.getLogger("pip._internal.deprecations") + logger.warning(message) + else: + _original_showwarning(message, category, filename, lineno, file, line) + + +def install_warning_logger() -> None: + # Enable our Deprecation Warnings + warnings.simplefilter("default", PipDeprecationWarning, append=True) + + global _original_showwarning + + if _original_showwarning is None: + _original_showwarning = warnings.showwarning + warnings.showwarning = _showwarning + + +def deprecated( + *, + reason: str, + replacement: Optional[str], + gone_in: Optional[str], + feature_flag: Optional[str] = None, + issue: Optional[int] = None, +) -> None: + """Helper to deprecate existing functionality. + + reason: + Textual reason shown to the user about why this functionality has + been deprecated. Should be a complete sentence. + replacement: + Textual suggestion shown to the user about what alternative + functionality they can use. + gone_in: + The version of pip does this functionality should get removed in. + Raises an error if pip's current version is greater than or equal to + this. + feature_flag: + Command-line flag of the form --use-feature={feature_flag} for testing + upcoming functionality. + issue: + Issue number on the tracker that would serve as a useful place for + users to find related discussion and provide feedback. + """ + + # Determine whether or not the feature is already gone in this version. + is_gone = gone_in is not None and parse(current_version) >= parse(gone_in) + + message_parts = [ + (reason, f"{DEPRECATION_MSG_PREFIX}{{}}"), + ( + gone_in, + "pip {} will enforce this behaviour change." + if not is_gone + else "Since pip {}, this is no longer supported.", + ), + ( + replacement, + "A possible replacement is {}.", + ), + ( + feature_flag, + "You can use the flag --use-feature={} to test the upcoming behaviour." + if not is_gone + else None, + ), + ( + issue, + "Discussion can be found at https://github.com/pypa/pip/issues/{}", + ), + ] + + message = " ".join( + format_str.format(value) + for value, format_str in message_parts + if format_str is not None and value is not None + ) + + # Raise as an error if this behaviour is deprecated. + if is_gone: + raise PipDeprecationWarning(message) + + warnings.warn(message, category=PipDeprecationWarning, stacklevel=2) diff --git a/shared/package-files/34/34ac08c7f2d1277baef68242f7f6a9765468a19fae47f8b32b5fdd781c9f110a/blob b/shared/package-files/34/34ac08c7f2d1277baef68242f7f6a9765468a19fae47f8b32b5fdd781c9f110a/blob new file mode 100644 index 0000000000000000000000000000000000000000..82134328c803dc87a89564638540a6cbcfa2d906 --- /dev/null +++ b/shared/package-files/34/34ac08c7f2d1277baef68242f7f6a9765468a19fae47f8b32b5fdd781c9f110a/blob @@ -0,0 +1,78 @@ +# Find the CUDNN libraries +# +# The following variables are optionally searched for defaults +# CUDNN_ROOT: Base directory where CUDNN is found +# CUDNN_INCLUDE_DIR: Directory where CUDNN header is searched for +# CUDNN_LIBRARY: Directory where CUDNN library is searched for +# CUDNN_STATIC: Are we looking for a static library? (default: no) +# +# The following are set after configuration is done: +# CUDNN_FOUND +# CUDNN_INCLUDE_PATH +# CUDNN_LIBRARY_PATH +# + +include(FindPackageHandleStandardArgs) + +set(CUDNN_ROOT $ENV{CUDNN_ROOT_DIR} CACHE PATH "Folder containing NVIDIA cuDNN") +if (DEFINED $ENV{CUDNN_ROOT_DIR}) + message(WARNING "CUDNN_ROOT_DIR is deprecated. Please set CUDNN_ROOT instead.") +endif() +list(APPEND CUDNN_ROOT $ENV{CUDNN_ROOT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}) + +# Compatible layer for CMake <3.12. CUDNN_ROOT will be accounted in for searching paths and libraries for CMake >=3.12. +list(APPEND CMAKE_PREFIX_PATH ${CUDNN_ROOT}) + +set(CUDNN_INCLUDE_DIR $ENV{CUDNN_INCLUDE_DIR} CACHE PATH "Folder containing NVIDIA cuDNN header files") + +find_path(CUDNN_INCLUDE_PATH cudnn.h + HINTS ${CUDNN_INCLUDE_DIR} + PATH_SUFFIXES cuda/include cuda include) + +option(CUDNN_STATIC "Look for static CUDNN" OFF) +if (CUDNN_STATIC) + set(CUDNN_LIBNAME "libcudnn_static.a") +else() + set(CUDNN_LIBNAME "cudnn") +endif() + +set(CUDNN_LIBRARY $ENV{CUDNN_LIBRARY} CACHE PATH "Path to the cudnn library file (e.g., libcudnn.so)") +if (CUDNN_LIBRARY MATCHES ".*cudnn_static.a" AND NOT CUDNN_STATIC) + message(WARNING "CUDNN_LIBRARY points to a static library (${CUDNN_LIBRARY}) but CUDNN_STATIC is OFF.") +endif() + +find_library(CUDNN_LIBRARY_PATH ${CUDNN_LIBNAME} + PATHS ${CUDNN_LIBRARY} + PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64) + +find_package_handle_standard_args(CUDNN DEFAULT_MSG CUDNN_LIBRARY_PATH CUDNN_INCLUDE_PATH) + +if(CUDNN_FOUND) + # Get cuDNN version + if(EXISTS ${CUDNN_INCLUDE_PATH}/cudnn_version.h) + file(READ ${CUDNN_INCLUDE_PATH}/cudnn_version.h CUDNN_HEADER_CONTENTS) + else() + file(READ ${CUDNN_INCLUDE_PATH}/cudnn.h CUDNN_HEADER_CONTENTS) + endif() + string(REGEX MATCH "define CUDNN_MAJOR * +([0-9]+)" + CUDNN_VERSION_MAJOR "${CUDNN_HEADER_CONTENTS}") + string(REGEX REPLACE "define CUDNN_MAJOR * +([0-9]+)" "\\1" + CUDNN_VERSION_MAJOR "${CUDNN_VERSION_MAJOR}") + string(REGEX MATCH "define CUDNN_MINOR * +([0-9]+)" + CUDNN_VERSION_MINOR "${CUDNN_HEADER_CONTENTS}") + string(REGEX REPLACE "define CUDNN_MINOR * +([0-9]+)" "\\1" + CUDNN_VERSION_MINOR "${CUDNN_VERSION_MINOR}") + string(REGEX MATCH "define CUDNN_PATCHLEVEL * +([0-9]+)" + CUDNN_VERSION_PATCH "${CUDNN_HEADER_CONTENTS}") + string(REGEX REPLACE "define CUDNN_PATCHLEVEL * +([0-9]+)" "\\1" + CUDNN_VERSION_PATCH "${CUDNN_VERSION_PATCH}") + # Assemble cuDNN version + if(NOT CUDNN_VERSION_MAJOR) + set(CUDNN_VERSION "?") + else() + set(CUDNN_VERSION + "${CUDNN_VERSION_MAJOR}.${CUDNN_VERSION_MINOR}.${CUDNN_VERSION_PATCH}") + endif() +endif() + +mark_as_advanced(CUDNN_ROOT CUDNN_INCLUDE_DIR CUDNN_LIBRARY CUDNN_VERSION) diff --git a/shared/package-files/34/34ad3b125c2e794d0e3fc80e46d717514ba0ff7bf8774e2ec5f5473149cb33d5/blob b/shared/package-files/34/34ad3b125c2e794d0e3fc80e46d717514ba0ff7bf8774e2ec5f5473149cb33d5/blob new file mode 100644 index 0000000000000000000000000000000000000000..a595e60eeae161b68617bb401d4acc53dbac1846 Binary files /dev/null and b/shared/package-files/34/34ad3b125c2e794d0e3fc80e46d717514ba0ff7bf8774e2ec5f5473149cb33d5/blob differ diff --git a/shared/package-files/34/34ae1b2ede18c1e8099f20d1ec5ed7b8dc0f790e1647e02a5d5bded48e6f9046/blob b/shared/package-files/34/34ae1b2ede18c1e8099f20d1ec5ed7b8dc0f790e1647e02a5d5bded48e6f9046/blob new file mode 100644 index 0000000000000000000000000000000000000000..7e516d71b6f988710b71c2b8d575a80e42e87d65 --- /dev/null +++ b/shared/package-files/34/34ae1b2ede18c1e8099f20d1ec5ed7b8dc0f790e1647e02a5d5bded48e6f9046/blob @@ -0,0 +1,677 @@ +import warnings + +import numpy as np +import pytest +from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal + +from sklearn.cross_decomposition import CCA, PLSSVD, PLSCanonical, PLSRegression +from sklearn.cross_decomposition._pls import ( + _center_scale_xy, + _get_first_singular_vectors_power_method, + _get_first_singular_vectors_svd, + _svd_flip_1d, +) +from sklearn.datasets import load_linnerud, make_regression +from sklearn.ensemble import VotingRegressor +from sklearn.exceptions import ConvergenceWarning +from sklearn.linear_model import LinearRegression +from sklearn.utils import check_random_state +from sklearn.utils.extmath import svd_flip + + +def assert_matrix_orthogonal(M): + K = np.dot(M.T, M) + assert_array_almost_equal(K, np.diag(np.diag(K))) + + +def test_pls_canonical_basics(): + # Basic checks for PLSCanonical + d = load_linnerud() + X = d.data + y = d.target + + pls = PLSCanonical(n_components=X.shape[1]) + pls.fit(X, y) + + assert_matrix_orthogonal(pls.x_weights_) + assert_matrix_orthogonal(pls.y_weights_) + assert_matrix_orthogonal(pls._x_scores) + assert_matrix_orthogonal(pls._y_scores) + + # Check X = TP' and y = UQ' + T = pls._x_scores + P = pls.x_loadings_ + U = pls._y_scores + Q = pls.y_loadings_ + # Need to scale first + Xc, yc, x_mean, y_mean, x_std, y_std = _center_scale_xy( + X.copy(), y.copy(), scale=True + ) + assert_array_almost_equal(Xc, np.dot(T, P.T)) + assert_array_almost_equal(yc, np.dot(U, Q.T)) + + # Check that rotations on training data lead to scores + Xt = pls.transform(X) + assert_array_almost_equal(Xt, pls._x_scores) + Xt, yt = pls.transform(X, y) + assert_array_almost_equal(Xt, pls._x_scores) + assert_array_almost_equal(yt, pls._y_scores) + + # Check that inverse_transform works + X_back = pls.inverse_transform(Xt) + assert_array_almost_equal(X_back, X) + _, y_back = pls.inverse_transform(Xt, yt) + assert_array_almost_equal(y_back, y) + + +def test_sanity_check_pls_regression(): + # Sanity check for PLSRegression + # The results were checked against the R-packages plspm, misOmics and pls + + d = load_linnerud() + X = d.data + y = d.target + + pls = PLSRegression(n_components=X.shape[1]) + X_trans, _ = pls.fit_transform(X, y) + + # FIXME: one would expect y_trans == pls.y_scores_ but this is not + # the case. + # xref: https://github.com/scikit-learn/scikit-learn/issues/22420 + assert_allclose(X_trans, pls.x_scores_) + + expected_x_weights = np.array( + [ + [-0.61330704, -0.00443647, 0.78983213], + [-0.74697144, -0.32172099, -0.58183269], + [-0.25668686, 0.94682413, -0.19399983], + ] + ) + + expected_x_loadings = np.array( + [ + [-0.61470416, -0.24574278, 0.78983213], + [-0.65625755, -0.14396183, -0.58183269], + [-0.51733059, 1.00609417, -0.19399983], + ] + ) + + expected_y_weights = np.array( + [ + [+0.32456184, 0.29892183, 0.20316322], + [+0.42439636, 0.61970543, 0.19320542], + [-0.13143144, -0.26348971, -0.17092916], + ] + ) + + expected_y_loadings = np.array( + [ + [+0.32456184, 0.29892183, 0.20316322], + [+0.42439636, 0.61970543, 0.19320542], + [-0.13143144, -0.26348971, -0.17092916], + ] + ) + + assert_array_almost_equal(np.abs(pls.x_loadings_), np.abs(expected_x_loadings)) + assert_array_almost_equal(np.abs(pls.x_weights_), np.abs(expected_x_weights)) + assert_array_almost_equal(np.abs(pls.y_loadings_), np.abs(expected_y_loadings)) + assert_array_almost_equal(np.abs(pls.y_weights_), np.abs(expected_y_weights)) + + # The R / Python difference in the signs should be consistent across + # loadings, weights, etc. + x_loadings_sign_flip = np.sign(pls.x_loadings_ / expected_x_loadings) + x_weights_sign_flip = np.sign(pls.x_weights_ / expected_x_weights) + y_weights_sign_flip = np.sign(pls.y_weights_ / expected_y_weights) + y_loadings_sign_flip = np.sign(pls.y_loadings_ / expected_y_loadings) + assert_array_almost_equal(x_loadings_sign_flip, x_weights_sign_flip) + assert_array_almost_equal(y_loadings_sign_flip, y_weights_sign_flip) + + +def test_sanity_check_pls_regression_constant_column_y(): + # Check behavior when the first column of y is constant + # The results are checked against a modified version of plsreg2 + # from the R-package plsdepot + d = load_linnerud() + X = d.data + y = d.target + y[:, 0] = 1 + pls = PLSRegression(n_components=X.shape[1]) + pls.fit(X, y) + + expected_x_weights = np.array( + [ + [-0.6273573, 0.007081799, 0.7786994], + [-0.7493417, -0.277612681, -0.6011807], + [-0.2119194, 0.960666981, -0.1794690], + ] + ) + + expected_x_loadings = np.array( + [ + [-0.6273512, -0.22464538, 0.7786994], + [-0.6643156, -0.09871193, -0.6011807], + [-0.5125877, 1.01407380, -0.1794690], + ] + ) + + expected_y_loadings = np.array( + [ + [0.0000000, 0.0000000, 0.0000000], + [0.4357300, 0.5828479, 0.2174802], + [-0.1353739, -0.2486423, -0.1810386], + ] + ) + + assert_array_almost_equal(np.abs(expected_x_weights), np.abs(pls.x_weights_)) + assert_array_almost_equal(np.abs(expected_x_loadings), np.abs(pls.x_loadings_)) + # For the PLSRegression with default parameters, y_loadings == y_weights + assert_array_almost_equal(np.abs(pls.y_loadings_), np.abs(expected_y_loadings)) + assert_array_almost_equal(np.abs(pls.y_weights_), np.abs(expected_y_loadings)) + + x_loadings_sign_flip = np.sign(expected_x_loadings / pls.x_loadings_) + x_weights_sign_flip = np.sign(expected_x_weights / pls.x_weights_) + # we ignore the first full-zeros row for y + y_loadings_sign_flip = np.sign(expected_y_loadings[1:] / pls.y_loadings_[1:]) + + assert_array_equal(x_loadings_sign_flip, x_weights_sign_flip) + assert_array_equal(x_loadings_sign_flip[1:], y_loadings_sign_flip) + + +def test_sanity_check_pls_canonical(): + # Sanity check for PLSCanonical + # The results were checked against the R-package plspm + + d = load_linnerud() + X = d.data + y = d.target + + pls = PLSCanonical(n_components=X.shape[1]) + pls.fit(X, y) + + expected_x_weights = np.array( + [ + [-0.61330704, 0.25616119, -0.74715187], + [-0.74697144, 0.11930791, 0.65406368], + [-0.25668686, -0.95924297, -0.11817271], + ] + ) + + expected_x_rotations = np.array( + [ + [-0.61330704, 0.41591889, -0.62297525], + [-0.74697144, 0.31388326, 0.77368233], + [-0.25668686, -0.89237972, -0.24121788], + ] + ) + + expected_y_weights = np.array( + [ + [+0.58989127, 0.7890047, 0.1717553], + [+0.77134053, -0.61351791, 0.16920272], + [-0.23887670, -0.03267062, 0.97050016], + ] + ) + + expected_y_rotations = np.array( + [ + [+0.58989127, 0.7168115, 0.30665872], + [+0.77134053, -0.70791757, 0.19786539], + [-0.23887670, -0.00343595, 0.94162826], + ] + ) + + assert_array_almost_equal(np.abs(pls.x_rotations_), np.abs(expected_x_rotations)) + assert_array_almost_equal(np.abs(pls.x_weights_), np.abs(expected_x_weights)) + assert_array_almost_equal(np.abs(pls.y_rotations_), np.abs(expected_y_rotations)) + assert_array_almost_equal(np.abs(pls.y_weights_), np.abs(expected_y_weights)) + + x_rotations_sign_flip = np.sign(pls.x_rotations_ / expected_x_rotations) + x_weights_sign_flip = np.sign(pls.x_weights_ / expected_x_weights) + y_rotations_sign_flip = np.sign(pls.y_rotations_ / expected_y_rotations) + y_weights_sign_flip = np.sign(pls.y_weights_ / expected_y_weights) + assert_array_almost_equal(x_rotations_sign_flip, x_weights_sign_flip) + assert_array_almost_equal(y_rotations_sign_flip, y_weights_sign_flip) + + assert_matrix_orthogonal(pls.x_weights_) + assert_matrix_orthogonal(pls.y_weights_) + + assert_matrix_orthogonal(pls._x_scores) + assert_matrix_orthogonal(pls._y_scores) + + +def test_sanity_check_pls_canonical_random(): + # Sanity check for PLSCanonical on random data + # The results were checked against the R-package plspm + n = 500 + p_noise = 10 + q_noise = 5 + # 2 latents vars: + rng = check_random_state(11) + l1 = rng.normal(size=n) + l2 = rng.normal(size=n) + latents = np.array([l1, l1, l2, l2]).T + X = latents + rng.normal(size=4 * n).reshape((n, 4)) + y = latents + rng.normal(size=4 * n).reshape((n, 4)) + X = np.concatenate((X, rng.normal(size=p_noise * n).reshape(n, p_noise)), axis=1) + y = np.concatenate((y, rng.normal(size=q_noise * n).reshape(n, q_noise)), axis=1) + + pls = PLSCanonical(n_components=3) + pls.fit(X, y) + + expected_x_weights = np.array( + [ + [0.65803719, 0.19197924, 0.21769083], + [0.7009113, 0.13303969, -0.15376699], + [0.13528197, -0.68636408, 0.13856546], + [0.16854574, -0.66788088, -0.12485304], + [-0.03232333, -0.04189855, 0.40690153], + [0.1148816, -0.09643158, 0.1613305], + [0.04792138, -0.02384992, 0.17175319], + [-0.06781, -0.01666137, -0.18556747], + [-0.00266945, -0.00160224, 0.11893098], + [-0.00849528, -0.07706095, 0.1570547], + [-0.00949471, -0.02964127, 0.34657036], + [-0.03572177, 0.0945091, 0.3414855], + [0.05584937, -0.02028961, -0.57682568], + [0.05744254, -0.01482333, -0.17431274], + ] + ) + + expected_x_loadings = np.array( + [ + [0.65649254, 0.1847647, 0.15270699], + [0.67554234, 0.15237508, -0.09182247], + [0.19219925, -0.67750975, 0.08673128], + [0.2133631, -0.67034809, -0.08835483], + [-0.03178912, -0.06668336, 0.43395268], + [0.15684588, -0.13350241, 0.20578984], + [0.03337736, -0.03807306, 0.09871553], + [-0.06199844, 0.01559854, -0.1881785], + [0.00406146, -0.00587025, 0.16413253], + [-0.00374239, -0.05848466, 0.19140336], + [0.00139214, -0.01033161, 0.32239136], + [-0.05292828, 0.0953533, 0.31916881], + [0.04031924, -0.01961045, -0.65174036], + [0.06172484, -0.06597366, -0.1244497], + ] + ) + + expected_y_weights = np.array( + [ + [0.66101097, 0.18672553, 0.22826092], + [0.69347861, 0.18463471, -0.23995597], + [0.14462724, -0.66504085, 0.17082434], + [0.22247955, -0.6932605, -0.09832993], + [0.07035859, 0.00714283, 0.67810124], + [0.07765351, -0.0105204, -0.44108074], + [-0.00917056, 0.04322147, 0.10062478], + [-0.01909512, 0.06182718, 0.28830475], + [0.01756709, 0.04797666, 0.32225745], + ] + ) + + expected_y_loadings = np.array( + [ + [0.68568625, 0.1674376, 0.0969508], + [0.68782064, 0.20375837, -0.1164448], + [0.11712173, -0.68046903, 0.12001505], + [0.17860457, -0.6798319, -0.05089681], + [0.06265739, -0.0277703, 0.74729584], + [0.0914178, 0.00403751, -0.5135078], + [-0.02196918, -0.01377169, 0.09564505], + [-0.03288952, 0.09039729, 0.31858973], + [0.04287624, 0.05254676, 0.27836841], + ] + ) + + assert_array_almost_equal(np.abs(pls.x_loadings_), np.abs(expected_x_loadings)) + assert_array_almost_equal(np.abs(pls.x_weights_), np.abs(expected_x_weights)) + assert_array_almost_equal(np.abs(pls.y_loadings_), np.abs(expected_y_loadings)) + assert_array_almost_equal(np.abs(pls.y_weights_), np.abs(expected_y_weights)) + + x_loadings_sign_flip = np.sign(pls.x_loadings_ / expected_x_loadings) + x_weights_sign_flip = np.sign(pls.x_weights_ / expected_x_weights) + y_weights_sign_flip = np.sign(pls.y_weights_ / expected_y_weights) + y_loadings_sign_flip = np.sign(pls.y_loadings_ / expected_y_loadings) + assert_array_almost_equal(x_loadings_sign_flip, x_weights_sign_flip) + assert_array_almost_equal(y_loadings_sign_flip, y_weights_sign_flip) + + assert_matrix_orthogonal(pls.x_weights_) + assert_matrix_orthogonal(pls.y_weights_) + + assert_matrix_orthogonal(pls._x_scores) + assert_matrix_orthogonal(pls._y_scores) + + +def test_convergence_fail(): + # Make sure ConvergenceWarning is raised if max_iter is too small + d = load_linnerud() + X = d.data + y = d.target + pls_nipals = PLSCanonical(n_components=X.shape[1], max_iter=2) + with pytest.warns(ConvergenceWarning): + pls_nipals.fit(X, y) + + +@pytest.mark.parametrize("Est", (PLSSVD, PLSRegression, PLSCanonical)) +def test_attibutes_shapes(Est): + # Make sure attributes are of the correct shape depending on n_components + d = load_linnerud() + X = d.data + y = d.target + n_components = 2 + pls = Est(n_components=n_components) + pls.fit(X, y) + assert all( + attr.shape[1] == n_components for attr in (pls.x_weights_, pls.y_weights_) + ) + + +@pytest.mark.parametrize("Est", (PLSRegression, PLSCanonical, CCA)) +def test_univariate_equivalence(Est): + # Ensure 2D y with 1 column is equivalent to 1D y + d = load_linnerud() + X = d.data + y = d.target + + est = Est(n_components=1) + one_d_coeff = est.fit(X, y[:, 0]).coef_ + two_d_coeff = est.fit(X, y[:, :1]).coef_ + + assert one_d_coeff.shape == two_d_coeff.shape + assert_array_almost_equal(one_d_coeff, two_d_coeff) + + +@pytest.mark.parametrize("Est", (PLSRegression, PLSCanonical, CCA, PLSSVD)) +def test_copy(Est): + # check that the "copy" keyword works + d = load_linnerud() + X = d.data + y = d.target + X_orig = X.copy() + + # copy=True won't modify inplace + pls = Est(copy=True).fit(X, y) + assert_array_equal(X, X_orig) + + # copy=False will modify inplace + with pytest.raises(AssertionError): + Est(copy=False).fit(X, y) + assert_array_almost_equal(X, X_orig) + + if Est is PLSSVD: + return # PLSSVD does not support copy param in predict or transform + + X_orig = X.copy() + with pytest.raises(AssertionError): + pls.transform(X, y, copy=False) + assert_array_almost_equal(X, X_orig) + + X_orig = X.copy() + with pytest.raises(AssertionError): + pls.predict(X, copy=False) + assert_array_almost_equal(X, X_orig) + + # Make sure copy=True gives same transform and predictions as predict=False + assert_array_almost_equal( + pls.transform(X, y, copy=True), pls.transform(X.copy(), y.copy(), copy=False) + ) + assert_array_almost_equal( + pls.predict(X, copy=True), pls.predict(X.copy(), copy=False) + ) + + +def _generate_test_scale_and_stability_datasets(): + """Generate dataset for test_scale_and_stability""" + # dataset for non-regression 7818 + rng = np.random.RandomState(0) + n_samples = 1000 + n_targets = 5 + n_features = 10 + Q = rng.randn(n_targets, n_features) + y = rng.randn(n_samples, n_targets) + X = np.dot(y, Q) + 2 * rng.randn(n_samples, n_features) + 1 + X *= 1000 + yield X, y + + # Data set where one of the features is constraint + X, y = load_linnerud(return_X_y=True) + # causes X[:, -1].std() to be zero + X[:, -1] = 1.0 + yield X, y + + X = np.array([[0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [2.0, 2.0, 2.0], [3.0, 5.0, 4.0]]) + y = np.array([[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]]) + yield X, y + + # Seeds that provide a non-regression test for #18746, where CCA fails + seeds = [530, 741] + for seed in seeds: + rng = np.random.RandomState(seed) + X = rng.randn(4, 3) + y = rng.randn(4, 2) + yield X, y + + +@pytest.mark.parametrize("Est", (CCA, PLSCanonical, PLSRegression, PLSSVD)) +@pytest.mark.parametrize("X, y", _generate_test_scale_and_stability_datasets()) +def test_scale_and_stability(Est, X, y): + """scale=True is equivalent to scale=False on centered/scaled data + This allows to check numerical stability over platforms as well""" + + X_s, y_s, *_ = _center_scale_xy(X, y) + + X_score, y_score = Est(scale=True).fit_transform(X, y) + X_s_score, y_s_score = Est(scale=False).fit_transform(X_s, y_s) + + assert_allclose(X_s_score, X_score, atol=1e-4) + assert_allclose(y_s_score, y_score, atol=1e-4) + + +@pytest.mark.parametrize("Estimator", (PLSSVD, PLSRegression, PLSCanonical, CCA)) +def test_n_components_upper_bounds(Estimator): + """Check the validation of `n_components` upper bounds for `PLS` regressors.""" + rng = np.random.RandomState(0) + X = rng.randn(10, 5) + y = rng.randn(10, 3) + est = Estimator(n_components=10) + err_msg = "`n_components` upper bound is .*. Got 10 instead. Reduce `n_components`." + with pytest.raises(ValueError, match=err_msg): + est.fit(X, y) + + +def test_n_components_upper_PLSRegression(): + """Check the validation of `n_components` upper bounds for PLSRegression.""" + rng = np.random.RandomState(0) + X = rng.randn(20, 64) + y = rng.randn(20, 3) + est = PLSRegression(n_components=30) + err_msg = "`n_components` upper bound is 20. Got 30 instead. Reduce `n_components`." + with pytest.raises(ValueError, match=err_msg): + est.fit(X, y) + + +@pytest.mark.parametrize("n_samples, n_features", [(100, 10), (100, 200)]) +def test_singular_value_helpers(n_samples, n_features, global_random_seed): + # Make sure SVD and power method give approximately the same results + X, y = make_regression( + n_samples, n_features, n_targets=5, random_state=global_random_seed + ) + u1, v1, _ = _get_first_singular_vectors_power_method(X, y, norm_y_weights=True) + u2, v2 = _get_first_singular_vectors_svd(X, y) + + _svd_flip_1d(u1, v1) + _svd_flip_1d(u2, v2) + + rtol = 1e-3 + # Setting atol because some coordinates are very close to zero + assert_allclose(u1, u2, atol=u2.max() * rtol) + assert_allclose(v1, v2, atol=v2.max() * rtol) + + +def test_one_component_equivalence(global_random_seed): + # PLSSVD, PLSRegression and PLSCanonical should all be equivalent when + # n_components is 1 + X, y = make_regression(100, 10, n_targets=5, random_state=global_random_seed) + svd = PLSSVD(n_components=1).fit(X, y).transform(X) + reg = PLSRegression(n_components=1).fit(X, y).transform(X) + canonical = PLSCanonical(n_components=1).fit(X, y).transform(X) + + rtol = 1e-3 + # Setting atol because some entries are very close to zero + assert_allclose(svd, reg, atol=reg.max() * rtol) + assert_allclose(svd, canonical, atol=canonical.max() * rtol) + + +def test_svd_flip_1d(): + # Make sure svd_flip_1d is equivalent to svd_flip + u = np.array([1, -4, 2]) + v = np.array([1, 2, 3]) + + u_expected, v_expected = svd_flip(u.reshape(-1, 1), v.reshape(1, -1)) + _svd_flip_1d(u, v) # inplace + + assert_allclose(u, u_expected.ravel()) + assert_allclose(u, [-1, 4, -2]) + + assert_allclose(v, v_expected.ravel()) + assert_allclose(v, [-1, -2, -3]) + + +def test_loadings_converges(global_random_seed): + """Test that CCA converges. Non-regression test for #19549.""" + X, y = make_regression( + n_samples=200, n_features=20, n_targets=20, random_state=global_random_seed + ) + + cca = CCA(n_components=10, max_iter=500) + + with warnings.catch_warnings(): + warnings.simplefilter("error", ConvergenceWarning) + + cca.fit(X, y) + + # Loadings converges to reasonable values + assert np.all(np.abs(cca.x_loadings_) < 1) + + +def test_pls_constant_y(): + """Checks warning when y is constant. Non-regression test for #19831""" + rng = np.random.RandomState(42) + x = rng.rand(100, 3) + y = np.zeros(100) + + pls = PLSRegression() + + msg = "y residual is constant at iteration" + with pytest.warns(UserWarning, match=msg): + pls.fit(x, y) + + assert_allclose(pls.x_rotations_, 0) + + +@pytest.mark.parametrize("PLSEstimator", [PLSRegression, PLSCanonical, CCA]) +def test_pls_coef_shape(PLSEstimator): + """Check the shape of `coef_` attribute. + + Non-regression test for: + https://github.com/scikit-learn/scikit-learn/issues/12410 + """ + d = load_linnerud() + X = d.data + y = d.target + + pls = PLSEstimator(copy=True).fit(X, y) + + n_targets, n_features = y.shape[1], X.shape[1] + assert pls.coef_.shape == (n_targets, n_features) + + +@pytest.mark.parametrize("scale", [True, False]) +@pytest.mark.parametrize("PLSEstimator", [PLSRegression, PLSCanonical, CCA]) +def test_pls_prediction(PLSEstimator, scale): + """Check the behaviour of the prediction function.""" + d = load_linnerud() + X = d.data + y = d.target + + pls = PLSEstimator(copy=True, scale=scale).fit(X, y) + y_pred = pls.predict(X, copy=True) + + y_mean = y.mean(axis=0) + X_trans = X - X.mean(axis=0) + + assert_allclose(pls.intercept_, y_mean) + assert_allclose(y_pred, X_trans @ pls.coef_.T + pls.intercept_) + + +@pytest.mark.parametrize("Klass", [CCA, PLSSVD, PLSRegression, PLSCanonical]) +def test_pls_feature_names_out(Klass): + """Check `get_feature_names_out` cross_decomposition module.""" + X, y = load_linnerud(return_X_y=True) + + est = Klass().fit(X, y) + names_out = est.get_feature_names_out() + + class_name_lower = Klass.__name__.lower() + expected_names_out = np.array( + [f"{class_name_lower}{i}" for i in range(est.x_weights_.shape[1])], + dtype=object, + ) + assert_array_equal(names_out, expected_names_out) + + +@pytest.mark.parametrize("Klass", [CCA, PLSSVD, PLSRegression, PLSCanonical]) +def test_pls_set_output(Klass): + """Check `set_output` in cross_decomposition module.""" + pd = pytest.importorskip("pandas") + X, y = load_linnerud(return_X_y=True, as_frame=True) + + est = Klass().set_output(transform="pandas").fit(X, y) + X_trans, y_trans = est.transform(X, y) + assert isinstance(y_trans, np.ndarray) + assert isinstance(X_trans, pd.DataFrame) + assert_array_equal(X_trans.columns, est.get_feature_names_out()) + + +def test_pls_regression_fit_1d_y(): + """Check that when fitting with 1d `y`, prediction should also be 1d. + + Non-regression test for Issue #26549. + """ + X = np.array([[1, 1], [2, 4], [3, 9], [4, 16], [5, 25], [6, 36]]) + y = np.array([2, 6, 12, 20, 30, 42]) + expected = y.copy() + + plsr = PLSRegression().fit(X, y) + y_pred = plsr.predict(X) + assert y_pred.shape == expected.shape + + # Check that it works in VotingRegressor + lr = LinearRegression().fit(X, y) + vr = VotingRegressor([("lr", lr), ("plsr", plsr)]) + y_pred = vr.fit(X, y).predict(X) + assert y_pred.shape == expected.shape + assert_allclose(y_pred, expected) + + +def test_pls_regression_scaling_coef(): + """Check that when using `scale=True`, the coefficients are using the std. dev. from + both `X` and `y`. + + Non-regression test for: + https://github.com/scikit-learn/scikit-learn/issues/27964 + """ + # handcrafted data where we can predict y from X with an additional scaling factor + rng = np.random.RandomState(0) + coef = rng.uniform(size=(3, 5)) + X = rng.normal(scale=10, size=(30, 5)) # add a std of 10 + y = X @ coef.T + + # we need to make sure that the dimension of the latent space is large enough to + # perfectly predict `y` from `X` (no information loss) + pls = PLSRegression(n_components=5, scale=True).fit(X, y) + assert_allclose(pls.coef_, coef) + + # we therefore should be able to predict `y` from `X` + assert_allclose(pls.predict(X), y) diff --git a/shared/package-files/34/34b1d178ba1748aa00e8a3c13516e317ce24b60e4f11a6a4b488f60082374836/blob b/shared/package-files/34/34b1d178ba1748aa00e8a3c13516e317ce24b60e4f11a6a4b488f60082374836/blob new file mode 100644 index 0000000000000000000000000000000000000000..0c0fad9f5ca474a6b547a399f8f284f7ff6e33a4 --- /dev/null +++ b/shared/package-files/34/34b1d178ba1748aa00e8a3c13516e317ce24b60e4f11a6a4b488f60082374836/blob @@ -0,0 +1,249 @@ +import pytest + +import networkx as nx +from networkx.algorithms import flow +from networkx.utils import pairwise + +flow_funcs = [ + flow.boykov_kolmogorov, + flow.edmonds_karp, + flow.dinitz, + flow.preflow_push, + flow.shortest_augmenting_path, +] + + +def is_path(G, path): + return all(v in G[u] for u, v in pairwise(path)) + + +def are_edge_disjoint_paths(G, paths): + if not paths: + return False + for path in paths: + assert is_path(G, path) + paths_edges = [list(pairwise(p)) for p in paths] + num_of_edges = sum(len(e) for e in paths_edges) + num_unique_edges = len(set.union(*[set(es) for es in paths_edges])) + if num_of_edges == num_unique_edges: + return True + return False + + +def are_node_disjoint_paths(G, paths): + if not paths: + return False + for path in paths: + assert is_path(G, path) + # first and last nodes are source and target + st = {paths[0][0], paths[0][-1]} + num_of_nodes = len([n for path in paths for n in path if n not in st]) + num_unique_nodes = len({n for path in paths for n in path if n not in st}) + if num_of_nodes == num_unique_nodes: + return True + return False + + +def test_graph_from_pr_2053(): + G = nx.Graph() + G.add_edges_from( + [ + ("A", "B"), + ("A", "D"), + ("A", "F"), + ("A", "G"), + ("B", "C"), + ("B", "D"), + ("B", "G"), + ("C", "D"), + ("C", "E"), + ("C", "Z"), + ("D", "E"), + ("D", "F"), + ("E", "F"), + ("E", "Z"), + ("F", "Z"), + ("G", "Z"), + ] + ) + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + # edge disjoint paths + edge_paths = list(nx.edge_disjoint_paths(G, "A", "Z", **kwargs)) + assert are_edge_disjoint_paths(G, edge_paths), errmsg + assert nx.edge_connectivity(G, "A", "Z") == len(edge_paths), errmsg + # node disjoint paths + node_paths = list(nx.node_disjoint_paths(G, "A", "Z", **kwargs)) + assert are_node_disjoint_paths(G, node_paths), errmsg + assert nx.node_connectivity(G, "A", "Z") == len(node_paths), errmsg + + +def test_florentine_families(): + G = nx.florentine_families_graph() + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + # edge disjoint paths + edge_dpaths = list(nx.edge_disjoint_paths(G, "Medici", "Strozzi", **kwargs)) + assert are_edge_disjoint_paths(G, edge_dpaths), errmsg + assert nx.edge_connectivity(G, "Medici", "Strozzi") == len(edge_dpaths), errmsg + # node disjoint paths + node_dpaths = list(nx.node_disjoint_paths(G, "Medici", "Strozzi", **kwargs)) + assert are_node_disjoint_paths(G, node_dpaths), errmsg + assert nx.node_connectivity(G, "Medici", "Strozzi") == len(node_dpaths), errmsg + + +def test_karate(): + G = nx.karate_club_graph() + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + # edge disjoint paths + edge_dpaths = list(nx.edge_disjoint_paths(G, 0, 33, **kwargs)) + assert are_edge_disjoint_paths(G, edge_dpaths), errmsg + assert nx.edge_connectivity(G, 0, 33) == len(edge_dpaths), errmsg + # node disjoint paths + node_dpaths = list(nx.node_disjoint_paths(G, 0, 33, **kwargs)) + assert are_node_disjoint_paths(G, node_dpaths), errmsg + assert nx.node_connectivity(G, 0, 33) == len(node_dpaths), errmsg + + +def test_petersen_disjoint_paths(): + G = nx.petersen_graph() + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + # edge disjoint paths + edge_dpaths = list(nx.edge_disjoint_paths(G, 0, 6, **kwargs)) + assert are_edge_disjoint_paths(G, edge_dpaths), errmsg + assert 3 == len(edge_dpaths), errmsg + # node disjoint paths + node_dpaths = list(nx.node_disjoint_paths(G, 0, 6, **kwargs)) + assert are_node_disjoint_paths(G, node_dpaths), errmsg + assert 3 == len(node_dpaths), errmsg + + +def test_octahedral_disjoint_paths(): + G = nx.octahedral_graph() + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + # edge disjoint paths + edge_dpaths = list(nx.edge_disjoint_paths(G, 0, 5, **kwargs)) + assert are_edge_disjoint_paths(G, edge_dpaths), errmsg + assert 4 == len(edge_dpaths), errmsg + # node disjoint paths + node_dpaths = list(nx.node_disjoint_paths(G, 0, 5, **kwargs)) + assert are_node_disjoint_paths(G, node_dpaths), errmsg + assert 4 == len(node_dpaths), errmsg + + +def test_icosahedral_disjoint_paths(): + G = nx.icosahedral_graph() + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + # edge disjoint paths + edge_dpaths = list(nx.edge_disjoint_paths(G, 0, 6, **kwargs)) + assert are_edge_disjoint_paths(G, edge_dpaths), errmsg + assert 5 == len(edge_dpaths), errmsg + # node disjoint paths + node_dpaths = list(nx.node_disjoint_paths(G, 0, 6, **kwargs)) + assert are_node_disjoint_paths(G, node_dpaths), errmsg + assert 5 == len(node_dpaths), errmsg + + +def test_cutoff_disjoint_paths(): + G = nx.icosahedral_graph() + for flow_func in flow_funcs: + kwargs = {"flow_func": flow_func} + errmsg = f"Assertion failed in function: {flow_func.__name__}" + for cutoff in [2, 4]: + kwargs["cutoff"] = cutoff + # edge disjoint paths + edge_dpaths = list(nx.edge_disjoint_paths(G, 0, 6, **kwargs)) + assert are_edge_disjoint_paths(G, edge_dpaths), errmsg + assert cutoff == len(edge_dpaths), errmsg + # node disjoint paths + node_dpaths = list(nx.node_disjoint_paths(G, 0, 6, **kwargs)) + assert are_node_disjoint_paths(G, node_dpaths), errmsg + assert cutoff == len(node_dpaths), errmsg + + +def test_missing_source_edge_paths(): + with pytest.raises(nx.NetworkXError): + G = nx.path_graph(4) + list(nx.edge_disjoint_paths(G, 10, 1)) + + +def test_missing_source_node_paths(): + with pytest.raises(nx.NetworkXError): + G = nx.path_graph(4) + list(nx.node_disjoint_paths(G, 10, 1)) + + +def test_missing_target_edge_paths(): + with pytest.raises(nx.NetworkXError): + G = nx.path_graph(4) + list(nx.edge_disjoint_paths(G, 1, 10)) + + +def test_missing_target_node_paths(): + with pytest.raises(nx.NetworkXError): + G = nx.path_graph(4) + list(nx.node_disjoint_paths(G, 1, 10)) + + +def test_not_weakly_connected_edges(): + with pytest.raises(nx.NetworkXNoPath): + G = nx.DiGraph() + nx.add_path(G, [1, 2, 3]) + nx.add_path(G, [4, 5]) + list(nx.edge_disjoint_paths(G, 1, 5)) + + +def test_not_weakly_connected_nodes(): + with pytest.raises(nx.NetworkXNoPath): + G = nx.DiGraph() + nx.add_path(G, [1, 2, 3]) + nx.add_path(G, [4, 5]) + list(nx.node_disjoint_paths(G, 1, 5)) + + +def test_not_connected_edges(): + with pytest.raises(nx.NetworkXNoPath): + G = nx.Graph() + nx.add_path(G, [1, 2, 3]) + nx.add_path(G, [4, 5]) + list(nx.edge_disjoint_paths(G, 1, 5)) + + +def test_not_connected_nodes(): + with pytest.raises(nx.NetworkXNoPath): + G = nx.Graph() + nx.add_path(G, [1, 2, 3]) + nx.add_path(G, [4, 5]) + list(nx.node_disjoint_paths(G, 1, 5)) + + +def test_isolated_edges(): + with pytest.raises(nx.NetworkXNoPath): + G = nx.Graph() + G.add_node(1) + nx.add_path(G, [4, 5]) + list(nx.edge_disjoint_paths(G, 1, 5)) + + +def test_isolated_nodes(): + with pytest.raises(nx.NetworkXNoPath): + G = nx.Graph() + G.add_node(1) + nx.add_path(G, [4, 5]) + list(nx.node_disjoint_paths(G, 1, 5)) + + +def test_invalid_auxiliary(): + with pytest.raises(nx.NetworkXError): + G = nx.complete_graph(5) + list(nx.node_disjoint_paths(G, 0, 3, auxiliary=G)) diff --git a/shared/package-files/34/34b25bc02a6e83394d6da4b25256dbe8d1e84fff5d1eea178f4db710340cacd2/blob b/shared/package-files/34/34b25bc02a6e83394d6da4b25256dbe8d1e84fff5d1eea178f4db710340cacd2/blob new file mode 100644 index 0000000000000000000000000000000000000000..cbfdffb9304b49488756752ca198fd4067087437 --- /dev/null +++ b/shared/package-files/34/34b25bc02a6e83394d6da4b25256dbe8d1e84fff5d1eea178f4db710340cacd2/blob @@ -0,0 +1,57 @@ +from sympy.core.add import Add +from sympy.core.kind import NumberKind, UndefinedKind +from sympy.core.mul import Mul +from sympy.core.numbers import pi, zoo, I, AlgebraicNumber +from sympy.core.singleton import S +from sympy.core.symbol import Symbol +from sympy.integrals.integrals import Integral +from sympy.core.function import Derivative +from sympy.matrices import (Matrix, SparseMatrix, ImmutableMatrix, + ImmutableSparseMatrix, MatrixSymbol, MatrixKind, MatMul) + +comm_x = Symbol('x') +noncomm_x = Symbol('x', commutative=False) + +def test_NumberKind(): + assert S.One.kind is NumberKind + assert pi.kind is NumberKind + assert S.NaN.kind is NumberKind + assert zoo.kind is NumberKind + assert I.kind is NumberKind + assert AlgebraicNumber(1).kind is NumberKind + +def test_Add_kind(): + assert Add(2, 3, evaluate=False).kind is NumberKind + assert Add(2,comm_x).kind is NumberKind + assert Add(2,noncomm_x).kind is UndefinedKind + +def test_mul_kind(): + assert Mul(2,comm_x, evaluate=False).kind is NumberKind + assert Mul(2,3, evaluate=False).kind is NumberKind + assert Mul(noncomm_x,2, evaluate=False).kind is UndefinedKind + assert Mul(2,noncomm_x, evaluate=False).kind is UndefinedKind + +def test_Symbol_kind(): + assert comm_x.kind is NumberKind + assert noncomm_x.kind is UndefinedKind + +def test_Integral_kind(): + A = MatrixSymbol('A', 2,2) + assert Integral(comm_x, comm_x).kind is NumberKind + assert Integral(A, comm_x).kind is MatrixKind(NumberKind) + +def test_Derivative_kind(): + A = MatrixSymbol('A', 2,2) + assert Derivative(comm_x, comm_x).kind is NumberKind + assert Derivative(A, comm_x).kind is MatrixKind(NumberKind) + +def test_Matrix_kind(): + classes = (Matrix, SparseMatrix, ImmutableMatrix, ImmutableSparseMatrix) + for cls in classes: + m = cls.zeros(3, 2) + assert m.kind is MatrixKind(NumberKind) + +def test_MatMul_kind(): + M = Matrix([[1,2],[3,4]]) + assert MatMul(2, M).kind is MatrixKind(NumberKind) + assert MatMul(comm_x, M).kind is MatrixKind(NumberKind) diff --git a/shared/package-files/34/34b33431d9128109839c7d94b9dd758eef46f064acdf44d906fdf67940c811b0/blob b/shared/package-files/34/34b33431d9128109839c7d94b9dd758eef46f064acdf44d906fdf67940c811b0/blob new file mode 100644 index 0000000000000000000000000000000000000000..c3f118354be7db75a152bb43a7415c684baf024c --- /dev/null +++ b/shared/package-files/34/34b33431d9128109839c7d94b9dd758eef46f064acdf44d906fdf67940c811b0/blob @@ -0,0 +1,39 @@ +#pragma once + +// @generated by torchgen/gen.py from Operator.h + +#include +#include + +// Forward declarations of any types needed in the operator signatures. +// We can't directly include these classes because it will cause circular include dependencies. +// This file is included by TensorBody.h, which defines the Tensor class. +#include + +namespace at { +namespace _ops { + + +struct TORCH_API _conj_copy { + using schema = at::Tensor (const at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_conj_copy") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_conj_copy(Tensor self) -> Tensor") + static at::Tensor call(const at::Tensor & self); + static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self); +}; + +struct TORCH_API _conj_copy_out { + using schema = at::Tensor & (const at::Tensor &, at::Tensor &); + using ptr_schema = schema*; + // See Note [static constexpr char* members for windows NVCC] + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_conj_copy") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out") + STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_conj_copy.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)") + static at::Tensor & call(const at::Tensor & self, at::Tensor & out); + static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out); +}; + +}} // namespace at::_ops diff --git a/shared/package-files/34/34b3427dedefce9a8dc2928233858c04f7a9c5c87be7a56387b27b18e9d498da/blob b/shared/package-files/34/34b3427dedefce9a8dc2928233858c04f7a9c5c87be7a56387b27b18e9d498da/blob new file mode 100644 index 0000000000000000000000000000000000000000..97823c97b6ad6360b9b3585f35c47100bcdf9163 --- /dev/null +++ b/shared/package-files/34/34b3427dedefce9a8dc2928233858c04f7a9c5c87be7a56387b27b18e9d498da/blob @@ -0,0 +1,267 @@ +""" +Created on Fri Feb 12 10:42:00 2021 + +Author: Josef Perktold +License: BSD-3 + +""" + +import numpy as np +from numpy.testing import assert_allclose, assert_equal +import pytest +from scipy import stats + +import statsmodels.distributions.tools as dt + + +def test_grid(): + # test bivariate independent beta + k1, k2 = 3, 5 + xg1 = np.arange(k1) / (k1 - 1) + xg2 = np.arange(k2) / (k2 - 1) + + # histogram values for distribution + distr1 = stats.beta(2, 5) + distr2 = stats.beta(4, 3) + cdf1 = distr1.cdf(xg1) + cdf2 = distr2.cdf(xg2) + prob1 = np.diff(cdf1, prepend=0) + prob2 = np.diff(cdf2, prepend=0) + cd2d = cdf1[:, None] * cdf2 + pd2d = prob1[:, None] * prob2 + + probs = dt.cdf2prob_grid(cd2d) + cdfs = dt.prob2cdf_grid(pd2d) + + assert_allclose(cdfs, cd2d, atol=1e-12) + assert_allclose(probs, pd2d, atol=1e-12) + + # check random sample + nobs = 1000 + rs = np.random.RandomState(789123) + rvs = np.column_stack( + [distr1.rvs(size=nobs, random_state=rs), distr2.rvs(size=nobs, random_state=rs)] + ) + hist = np.histogramdd(rvs, [xg1, xg2]) + assert_allclose(probs[1:, 1:], hist[0] / len(rvs), atol=0.02) + + +def test_average_grid(): + x1 = np.arange(1, 4) + x2 = np.arange(4) + y = x1[:, None] * x2 + + res1 = np.array([[0.75, 2.25, 3.75], [1.25, 3.75, 6.25]]) + + res0 = dt.average_grid(y, coords=[x1, x2]) + assert_allclose(res0, res1, rtol=1e-13) + res0 = dt.average_grid(y, coords=[x1, x2], _method="slicing") + assert_allclose(res0, res1, rtol=1e-13) + res0 = dt.average_grid(y, coords=[x1, x2], _method="convolve") + assert_allclose(res0, res1, rtol=1e-13) + + res0 = dt.average_grid(y, coords=[x1 / x1.max(), x2 / x2.max()]) + assert_allclose(res0, res1 / x1.max() / x2.max(), rtol=1e-13) + res0 = dt.average_grid(y, coords=[x1 / x1.max(), x2 / x2.max()], _method="convolve") + assert_allclose(res0, res1 / x1.max() / x2.max(), rtol=1e-13) + + with pytest.raises(ValueError, match="_method"): + dt.average_grid(y, coords=[x1, x2], _method="not-a-method") + + +def test_grid_class(): + + res = { + "k_grid": [3, 5], + "x_marginal": [ + np.array([0.0, 0.5, 1.0]), + np.array([0.0, 0.25, 0.5, 0.75, 1.0]), + ], + "idx_flat.T": np.array( + [ + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + ], + [ + 0.0, + 1.0, + 2.0, + 3.0, + 4.0, + 0.0, + 1.0, + 2.0, + 3.0, + 4.0, + 0.0, + 1.0, + 2.0, + 3.0, + 4.0, + ], + ] + ), + } + gg = dt._Grid([3, 5]) + assert_equal(gg.k_grid, res["k_grid"]) + assert gg.x_marginal, res["x_marginal"] + assert_allclose(gg.idx_flat, res["idx_flat.T"].T, atol=1e-12) + assert_allclose(gg.x_flat, res["idx_flat.T"].T / [2, 4], atol=1e-12) + + gg = dt._Grid([3, 5], eps=0.001) + assert_allclose(gg.x_flat.min(), 0.001, atol=1e-12) + assert_allclose(gg.x_flat.max(), 0.999, atol=1e-12) + xmf = np.concatenate(gg.x_marginal) + assert_allclose(xmf.min(), 0.001, atol=1e-12) + assert_allclose(xmf.max(), 0.999, atol=1e-12) + + # 1-dim + gg = dt._Grid([5], eps=0.001) + res = { + "k_grid": [5], + "x_marginal": [np.array([0.001, 0.25, 0.5, 0.75, 0.999])], + "idx_flat.T": np.array([[0.0, 1.0, 2.0, 3.0, 4.0]]), + } + assert_equal(gg.k_grid, res["k_grid"]) + assert gg.x_marginal, res["x_marginal"] + assert_allclose(gg.idx_flat, res["idx_flat.T"].T, atol=1e-12) + # x_flat is 2-dim even if grid is 1-dim, TODO: maybe change + assert_allclose(gg.x_flat, res["x_marginal"][0][:, None], atol=1e-12) + + # 3-dim + gg = dt._Grid([3, 3, 2], eps=0.0) + res = { + "k_grid": [3, 3, 2], + "x_marginal": [ + np.array([0.0, 0.5, 1.0]), + np.array([0.0, 0.5, 1.0]), + np.array([0.0, 1.0]), + ], + "idx_flat.T": np.array( + [ + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, + ], + [ + 0.0, + 0.0, + 1.0, + 1.0, + 2.0, + 2.0, + 0.0, + 0.0, + 1.0, + 1.0, + 2.0, + 2.0, + 0.0, + 0.0, + 1.0, + 1.0, + 2.0, + 2.0, + ], + [ + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + ], + ] + ), + } + assert_equal(gg.k_grid, res["k_grid"]) + assert gg.x_marginal, res["x_marginal"] + assert_allclose(gg.idx_flat, res["idx_flat.T"].T, atol=1e-12) + assert_allclose(gg.x_flat, res["idx_flat.T"].T / [2, 2, 1], atol=1e-12) + + +def test_bernstein_1d(): + k = 5 + xg1 = np.arange(k) / (k - 1) + xg2 = np.arange(2 * k) / (2 * k - 1) + # verify linear coefficients are mapped to themselves + res_bp = dt._eval_bernstein_1d(xg2, xg1) + assert_allclose(res_bp, xg2, atol=1e-12) + + res_bp = dt._eval_bernstein_1d(xg2, xg1, method="beta") + assert_allclose(res_bp, xg2, atol=1e-12) + + res_bp = dt._eval_bernstein_1d(xg2, xg1, method="bpoly") + assert_allclose(res_bp, xg2, atol=1e-12) + + with pytest.raises(ValueError, match="method"): + dt._eval_bernstein_1d(xg2, xg1, method="not-a-method") + + +def test_bernstein_2d(): + k = 5 + xg1 = np.arange(k) / (k - 1) + cd2d = xg1[:, None] * xg1 + # verify linear coefficients are mapped to themselves + for evalbp in (dt._eval_bernstein_2d, dt._eval_bernstein_dd): + k_x = 2 * k + # create flattened grid of bivariate values + x2d = np.column_stack( + np.unravel_index(np.arange(k_x * k_x), (k_x, k_x)) + ).astype(float) + x2d /= x2d.max(0) + + res_bp = evalbp(x2d, cd2d) + assert_allclose(res_bp, np.prod(x2d, axis=1), atol=1e-12) + + # check univariate margins + x2d = np.column_stack((np.arange(k_x) / (k_x - 1), np.ones(k_x))) + res_bp = evalbp(x2d, cd2d) + assert_allclose(res_bp, x2d[:, 0], atol=1e-12) + + # check univariate margins + x2d = np.column_stack((np.ones(k_x), np.arange(k_x) / (k_x - 1))) + res_bp = evalbp(x2d, cd2d) + assert_allclose(res_bp, x2d[:, 1], atol=1e-12) diff --git a/shared/package-files/34/34b3ae6f60b57eb3d6c3b76554a1d3965236feb2c5e41700cc5120e1adc58247/blob b/shared/package-files/34/34b3ae6f60b57eb3d6c3b76554a1d3965236feb2c5e41700cc5120e1adc58247/blob new file mode 100644 index 0000000000000000000000000000000000000000..56265dfbe4c7a7bad85ed863fdef7315121b4a07 --- /dev/null +++ b/shared/package-files/34/34b3ae6f60b57eb3d6c3b76554a1d3965236feb2c5e41700cc5120e1adc58247/blob @@ -0,0 +1,47 @@ +import gc + +from numba import jit, int32 +import unittest + + +def foo(a, b): + return a + b + + +def bar(a, b): + return cfoo(a, b) + b + +@jit +def inner(x, y): + return x + y + +@jit(nopython=True) +def outer(x, y): + return inner(x, y) + + +class TestInterProc(unittest.TestCase): + + def test_bar_call_foo(self): + global cfoo + cfoo = jit((int32, int32), nopython=True)(foo) + cbar = jit((int32, int32), nopython=True)(bar) + self.assertEqual(cbar(1, 2), 1 + 2 + 2) + + def test_bar_call_foo_compiled_twice(self): + # When a function is compiled twice, then called from another + # compiled function, check that the right target is called. + # (otherwise, LLVM would assert out or crash) + global cfoo + for i in range(2): + cfoo = jit((int32, int32), nopython=True)(foo) + gc.collect() + cbar = jit((int32, int32), nopython=True)(bar) + self.assertEqual(cbar(1, 2), 1 + 2 + 2) + + def test_callsite_compilation(self): + self.assertEqual(outer(1, 2), 1 + 2) + + +if __name__ == '__main__': + unittest.main() diff --git a/shared/package-files/34/34b4c48f2d86cf56803036700a0b2c2325277b4b9b8c9aae91f624a6c2f78173/blob b/shared/package-files/34/34b4c48f2d86cf56803036700a0b2c2325277b4b9b8c9aae91f624a6c2f78173/blob new file mode 100644 index 0000000000000000000000000000000000000000..9b65251900a3b36fe58050fdeafd2716280344ca --- /dev/null +++ b/shared/package-files/34/34b4c48f2d86cf56803036700a0b2c2325277b4b9b8c9aae91f624a6c2f78173/blob @@ -0,0 +1,47 @@ +from typing import Any, TypeVar, overload + +from numpy import generic, integer, floating, complexfloating +from numpy._typing import ( + NDArray, + ArrayLike, + _ShapeLike, + _ArrayLike, + _ArrayLikeFloat_co, + _ArrayLikeComplex_co, +) + +_SCT = TypeVar("_SCT", bound=generic) + +__all__: list[str] + +@overload +def fftshift(x: _ArrayLike[_SCT], axes: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +@overload +def fftshift(x: ArrayLike, axes: None | _ShapeLike = ...) -> NDArray[Any]: ... + +@overload +def ifftshift(x: _ArrayLike[_SCT], axes: None | _ShapeLike = ...) -> NDArray[_SCT]: ... +@overload +def ifftshift(x: ArrayLike, axes: None | _ShapeLike = ...) -> NDArray[Any]: ... + +@overload +def fftfreq( + n: int | integer[Any], + d: _ArrayLikeFloat_co = ..., +) -> NDArray[floating[Any]]: ... +@overload +def fftfreq( + n: int | integer[Any], + d: _ArrayLikeComplex_co = ..., +) -> NDArray[complexfloating[Any, Any]]: ... + +@overload +def rfftfreq( + n: int | integer[Any], + d: _ArrayLikeFloat_co = ..., +) -> NDArray[floating[Any]]: ... +@overload +def rfftfreq( + n: int | integer[Any], + d: _ArrayLikeComplex_co = ..., +) -> NDArray[complexfloating[Any, Any]]: ... diff --git a/shared/package-files/34/34b4fa19957b0e6b8d7076fe9539f6479993f95d766e26d159ed768adb5639ea/blob b/shared/package-files/34/34b4fa19957b0e6b8d7076fe9539f6479993f95d766e26d159ed768adb5639ea/blob new file mode 100644 index 0000000000000000000000000000000000000000..f068a3ded32350765e35418d5c4750f9d08c2019 --- /dev/null +++ b/shared/package-files/34/34b4fa19957b0e6b8d7076fe9539f6479993f95d766e26d159ed768adb5639ea/blob @@ -0,0 +1,7 @@ +from typing import Any, Callable + +def _clear() -> None: ... +def _ncallbacks() -> int: ... +def _run_exitfuncs() -> None: ... +def register(func: Callable[..., Any], *args: Any, **kwargs: Any) -> Callable[..., Any]: ... +def unregister(func: Callable[..., Any]) -> None: ... diff --git a/shared/package-files/34/34b89424d7e673d02dd79b3b254462c2fa8c123522f46e4f30646b98c6333523/blob b/shared/package-files/34/34b89424d7e673d02dd79b3b254462c2fa8c123522f46e4f30646b98c6333523/blob new file mode 100644 index 0000000000000000000000000000000000000000..78620c472c9d799a14ccb02a0233f4669b3bcdcb --- /dev/null +++ b/shared/package-files/34/34b89424d7e673d02dd79b3b254462c2fa8c123522f46e4f30646b98c6333523/blob @@ -0,0 +1 @@ +tqdm diff --git a/shared/package-files/34/34baa6b31f99159ea00dabd8821da81f465237e2919a971d1172190e7632f4f8/blob b/shared/package-files/34/34baa6b31f99159ea00dabd8821da81f465237e2919a971d1172190e7632f4f8/blob new file mode 100644 index 0000000000000000000000000000000000000000..3825653907a25e6c53a51b0e07f01029da5f7683 --- /dev/null +++ b/shared/package-files/34/34baa6b31f99159ea00dabd8821da81f465237e2919a971d1172190e7632f4f8/blob @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: flit 3.0.0 +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any diff --git a/shared/package-files/34/34bb43aefa365c81f42af51402f84ea8c7a85c48c65b422e4e4fe8b2ee57883c/blob b/shared/package-files/34/34bb43aefa365c81f42af51402f84ea8c7a85c48c65b422e4e4fe8b2ee57883c/blob new file mode 100644 index 0000000000000000000000000000000000000000..89dfc75fdabad1c95bb1f968d6dcb827459e1005 Binary files /dev/null and b/shared/package-files/34/34bb43aefa365c81f42af51402f84ea8c7a85c48c65b422e4e4fe8b2ee57883c/blob differ diff --git a/shared/package-files/34/34be5f848272c0958eb121cc0c0e89be31a14bbc40e3e67a098200411cb51515/blob b/shared/package-files/34/34be5f848272c0958eb121cc0c0e89be31a14bbc40e3e67a098200411cb51515/blob new file mode 100644 index 0000000000000000000000000000000000000000..6ceec8b56a00ba5ad66682aa3f8cdd7015a304a4 --- /dev/null +++ b/shared/package-files/34/34be5f848272c0958eb121cc0c0e89be31a14bbc40e3e67a098200411cb51515/blob @@ -0,0 +1,14 @@ +# from .conv import _conv, conv +from . import blocksparse +from .cross_entropy import _cross_entropy, cross_entropy +from .flash_attention import attention +from .matmul import _matmul, matmul + +__all__ = [ + "blocksparse", + "_cross_entropy", + "cross_entropy", + "_matmul", + "matmul", + "attention", +] diff --git a/shared/package-files/34/34c272591c5d115f2b74174f223a1822a9b7e110a21378a1117cef4b4c916c96/blob b/shared/package-files/34/34c272591c5d115f2b74174f223a1822a9b7e110a21378a1117cef4b4c916c96/blob new file mode 100644 index 0000000000000000000000000000000000000000..27c98b7c30c90e077eae29ae932d260ade0f10e1 --- /dev/null +++ b/shared/package-files/34/34c272591c5d115f2b74174f223a1822a9b7e110a21378a1117cef4b4c916c96/blob @@ -0,0 +1,222 @@ +"""upload_docs + +Implements a Distutils 'upload_docs' subcommand (upload documentation to +sites other than PyPi such as devpi). +""" + +from base64 import standard_b64encode +from distutils import log +from distutils.errors import DistutilsOptionError +import os +import socket +import zipfile +import tempfile +import shutil +import itertools +import functools +import http.client +import urllib.parse + +from .._importlib import metadata +from ..warnings import SetuptoolsDeprecationWarning + +from .upload import upload + + +def _encode(s): + return s.encode('utf-8', 'surrogateescape') + + +class upload_docs(upload): + # override the default repository as upload_docs isn't + # supported by Warehouse (and won't be). + DEFAULT_REPOSITORY = 'https://pypi.python.org/pypi/' + + description = 'Upload documentation to sites other than PyPi such as devpi' + + user_options = [ + ( + 'repository=', + 'r', + "url of repository [default: %s]" % upload.DEFAULT_REPOSITORY, + ), + ('show-response', None, 'display full response text from server'), + ('upload-dir=', None, 'directory to upload'), + ] + boolean_options = upload.boolean_options + + def has_sphinx(self): + return bool( + self.upload_dir is None + and metadata.entry_points(group='distutils.commands', name='build_sphinx') + ) + + sub_commands = [('build_sphinx', has_sphinx)] + + def initialize_options(self): + upload.initialize_options(self) + self.upload_dir = None + self.target_dir = None + + def finalize_options(self): + log.warn( + "Upload_docs command is deprecated. Use Read the Docs " + "(https://readthedocs.org) instead." + ) + upload.finalize_options(self) + if self.upload_dir is None: + if self.has_sphinx(): + build_sphinx = self.get_finalized_command('build_sphinx') + self.target_dir = dict(build_sphinx.builder_target_dirs)['html'] + else: + build = self.get_finalized_command('build') + self.target_dir = os.path.join(build.build_base, 'docs') + else: + self.ensure_dirname('upload_dir') + self.target_dir = self.upload_dir + self.announce('Using upload directory %s' % self.target_dir) + + def create_zipfile(self, filename): + zip_file = zipfile.ZipFile(filename, "w") + try: + self.mkpath(self.target_dir) # just in case + for root, dirs, files in os.walk(self.target_dir): + if root == self.target_dir and not files: + tmpl = "no files found in upload directory '%s'" + raise DistutilsOptionError(tmpl % self.target_dir) + for name in files: + full = os.path.join(root, name) + relative = root[len(self.target_dir) :].lstrip(os.path.sep) + dest = os.path.join(relative, name) + zip_file.write(full, dest) + finally: + zip_file.close() + + def run(self): + SetuptoolsDeprecationWarning.emit( + "Deprecated command", + """ + upload_docs is deprecated and will be removed in a future version. + Instead, use tools like devpi and Read the Docs; or lower level tools like + httpie and curl to interact directly with your hosting service API. + """, + due_date=(2023, 9, 26), # warning introduced in 27 Jul 2022 + ) + + # Run sub commands + for cmd_name in self.get_sub_commands(): + self.run_command(cmd_name) + + tmp_dir = tempfile.mkdtemp() + name = self.distribution.metadata.get_name() + zip_file = os.path.join(tmp_dir, "%s.zip" % name) + try: + self.create_zipfile(zip_file) + self.upload_file(zip_file) + finally: + shutil.rmtree(tmp_dir) + + @staticmethod + def _build_part(item, sep_boundary): + key, values = item + title = '\nContent-Disposition: form-data; name="%s"' % key + # handle multiple entries for the same name + if not isinstance(values, list): + values = [values] + for value in values: + if isinstance(value, tuple): + title += '; filename="%s"' % value[0] + value = value[1] + else: + value = _encode(value) + yield sep_boundary + yield _encode(title) + yield b"\n\n" + yield value + if value and value[-1:] == b'\r': + yield b'\n' # write an extra newline (lurve Macs) + + @classmethod + def _build_multipart(cls, data): + """ + Build up the MIME payload for the POST data + """ + boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' + sep_boundary = b'\n--' + boundary.encode('ascii') + end_boundary = sep_boundary + b'--' + end_items = ( + end_boundary, + b"\n", + ) + builder = functools.partial( + cls._build_part, + sep_boundary=sep_boundary, + ) + part_groups = map(builder, data.items()) + parts = itertools.chain.from_iterable(part_groups) + body_items = itertools.chain(parts, end_items) + content_type = 'multipart/form-data; boundary=%s' % boundary + return b''.join(body_items), content_type + + def upload_file(self, filename): + with open(filename, 'rb') as f: + content = f.read() + meta = self.distribution.metadata + data = { + ':action': 'doc_upload', + 'name': meta.get_name(), + 'content': (os.path.basename(filename), content), + } + # set up the authentication + credentials = _encode(self.username + ':' + self.password) + credentials = standard_b64encode(credentials).decode('ascii') + auth = "Basic " + credentials + + body, ct = self._build_multipart(data) + + msg = "Submitting documentation to %s" % (self.repository) + self.announce(msg, log.INFO) + + # build the Request + # We can't use urllib2 since we need to send the Basic + # auth right with the first request + schema, netloc, url, params, query, fragments = urllib.parse.urlparse( + self.repository + ) + assert not params and not query and not fragments + if schema == 'http': + conn = http.client.HTTPConnection(netloc) + elif schema == 'https': + conn = http.client.HTTPSConnection(netloc) + else: + raise AssertionError("unsupported schema " + schema) + + data = '' + try: + conn.connect() + conn.putrequest("POST", url) + content_type = ct + conn.putheader('Content-type', content_type) + conn.putheader('Content-length', str(len(body))) + conn.putheader('Authorization', auth) + conn.endheaders() + conn.send(body) + except socket.error as e: + self.announce(str(e), log.ERROR) + return + + r = conn.getresponse() + if r.status == 200: + msg = 'Server response (%s): %s' % (r.status, r.reason) + self.announce(msg, log.INFO) + elif r.status == 301: + location = r.getheader('Location') + if location is None: + location = 'https://pythonhosted.org/%s/' % meta.get_name() + msg = 'Upload successful. Visit %s' % location + self.announce(msg, log.INFO) + else: + msg = 'Upload failed (%s): %s' % (r.status, r.reason) + self.announce(msg, log.ERROR) + if self.show_response: + print('-' * 75, r.read(), '-' * 75) diff --git a/shared/package-files/34/34c39db0d23cb8bd45276441d61a62f11b4dc259c81562f510d9ef1d540b0bdb/blob b/shared/package-files/34/34c39db0d23cb8bd45276441d61a62f11b4dc259c81562f510d9ef1d540b0bdb/blob new file mode 100644 index 0000000000000000000000000000000000000000..d13ebe6dd1af3044794b28f5375d06ed60787966 --- /dev/null +++ b/shared/package-files/34/34c39db0d23cb8bd45276441d61a62f11b4dc259c81562f510d9ef1d540b0bdb/blob @@ -0,0 +1,421 @@ +import datetime +import os +import sys +from os.path import join as pjoin + +from io import StringIO + +import numpy as np + +from numpy.testing import (assert_array_almost_equal, + assert_array_equal, assert_equal, assert_) +from pytest import raises as assert_raises + +from scipy.io.arff import loadarff +from scipy.io.arff._arffread import read_header, ParseArffError + + +data_path = pjoin(os.path.dirname(__file__), 'data') + +test1 = pjoin(data_path, 'test1.arff') +test2 = pjoin(data_path, 'test2.arff') +test3 = pjoin(data_path, 'test3.arff') + +test4 = pjoin(data_path, 'test4.arff') +test5 = pjoin(data_path, 'test5.arff') +test6 = pjoin(data_path, 'test6.arff') +test7 = pjoin(data_path, 'test7.arff') +test8 = pjoin(data_path, 'test8.arff') +test9 = pjoin(data_path, 'test9.arff') +test10 = pjoin(data_path, 'test10.arff') +test11 = pjoin(data_path, 'test11.arff') +test_quoted_nominal = pjoin(data_path, 'quoted_nominal.arff') +test_quoted_nominal_spaces = pjoin(data_path, 'quoted_nominal_spaces.arff') + +expect4_data = [(0.1, 0.2, 0.3, 0.4, 'class1'), + (-0.1, -0.2, -0.3, -0.4, 'class2'), + (1, 2, 3, 4, 'class3')] +expected_types = ['numeric', 'numeric', 'numeric', 'numeric', 'nominal'] + +missing = pjoin(data_path, 'missing.arff') +expect_missing_raw = np.array([[1, 5], [2, 4], [np.nan, np.nan]]) +expect_missing = np.empty(3, [('yop', float), ('yap', float)]) +expect_missing['yop'] = expect_missing_raw[:, 0] # type: ignore[call-overload] +expect_missing['yap'] = expect_missing_raw[:, 1] # type: ignore[call-overload] + + +class TestData: + def test1(self): + # Parsing trivial file with nothing. + self._test(test4) + + def test2(self): + # Parsing trivial file with some comments in the data section. + self._test(test5) + + def test3(self): + # Parsing trivial file with nominal attribute of 1 character. + self._test(test6) + + def test4(self): + # Parsing trivial file with trailing spaces in attribute declaration. + self._test(test11) + + def _test(self, test_file): + data, meta = loadarff(test_file) + for i in range(len(data)): + for j in range(4): + assert_array_almost_equal(expect4_data[i][j], data[i][j]) + assert_equal(meta.types(), expected_types) + + def test_filelike(self): + # Test reading from file-like object (StringIO) + with open(test1) as f1: + data1, meta1 = loadarff(f1) + with open(test1) as f2: + data2, meta2 = loadarff(StringIO(f2.read())) + assert_(data1 == data2) + assert_(repr(meta1) == repr(meta2)) + + def test_path(self): + # Test reading from `pathlib.Path` object + from pathlib import Path + + with open(test1) as f1: + data1, meta1 = loadarff(f1) + + data2, meta2 = loadarff(Path(test1)) + + assert_(data1 == data2) + assert_(repr(meta1) == repr(meta2)) + + +class TestMissingData: + def test_missing(self): + data, meta = loadarff(missing) + for i in ['yop', 'yap']: + assert_array_almost_equal(data[i], expect_missing[i]) + + +class TestNoData: + def test_nodata(self): + # The file nodata.arff has no data in the @DATA section. + # Reading it should result in an array with length 0. + nodata_filename = os.path.join(data_path, 'nodata.arff') + data, meta = loadarff(nodata_filename) + if sys.byteorder == 'big': + end = '>' + else: + end = '<' + expected_dtype = np.dtype([('sepallength', f'{end}f8'), + ('sepalwidth', f'{end}f8'), + ('petallength', f'{end}f8'), + ('petalwidth', f'{end}f8'), + ('class', 'S15')]) + assert_equal(data.dtype, expected_dtype) + assert_equal(data.size, 0) + + +class TestHeader: + def test_type_parsing(self): + # Test parsing type of attribute from their value. + with open(test2) as ofile: + rel, attrs = read_header(ofile) + + expected = ['numeric', 'numeric', 'numeric', 'numeric', 'numeric', + 'numeric', 'string', 'string', 'nominal', 'nominal'] + + for i in range(len(attrs)): + assert_(attrs[i].type_name == expected[i]) + + def test_badtype_parsing(self): + # Test parsing wrong type of attribute from their value. + def badtype_read(): + with open(test3) as ofile: + _, _ = read_header(ofile) + + assert_raises(ParseArffError, badtype_read) + + def test_fullheader1(self): + # Parsing trivial header with nothing. + with open(test1) as ofile: + rel, attrs = read_header(ofile) + + # Test relation + assert_(rel == 'test1') + + # Test numerical attributes + assert_(len(attrs) == 5) + for i in range(4): + assert_(attrs[i].name == 'attr%d' % i) + assert_(attrs[i].type_name == 'numeric') + + # Test nominal attribute + assert_(attrs[4].name == 'class') + assert_(attrs[4].values == ('class0', 'class1', 'class2', 'class3')) + + def test_dateheader(self): + with open(test7) as ofile: + rel, attrs = read_header(ofile) + + assert_(rel == 'test7') + + assert_(len(attrs) == 5) + + assert_(attrs[0].name == 'attr_year') + assert_(attrs[0].date_format == '%Y') + + assert_(attrs[1].name == 'attr_month') + assert_(attrs[1].date_format == '%Y-%m') + + assert_(attrs[2].name == 'attr_date') + assert_(attrs[2].date_format == '%Y-%m-%d') + + assert_(attrs[3].name == 'attr_datetime_local') + assert_(attrs[3].date_format == '%Y-%m-%d %H:%M') + + assert_(attrs[4].name == 'attr_datetime_missing') + assert_(attrs[4].date_format == '%Y-%m-%d %H:%M') + + def test_dateheader_unsupported(self): + def read_dateheader_unsupported(): + with open(test8) as ofile: + _, _ = read_header(ofile) + + assert_raises(ValueError, read_dateheader_unsupported) + + +class TestDateAttribute: + def setup_method(self): + self.data, self.meta = loadarff(test7) + + def test_year_attribute(self): + expected = np.array([ + '1999', + '2004', + '1817', + '2100', + '2013', + '1631' + ], dtype='datetime64[Y]') + + assert_array_equal(self.data["attr_year"], expected) + + def test_month_attribute(self): + expected = np.array([ + '1999-01', + '2004-12', + '1817-04', + '2100-09', + '2013-11', + '1631-10' + ], dtype='datetime64[M]') + + assert_array_equal(self.data["attr_month"], expected) + + def test_date_attribute(self): + expected = np.array([ + '1999-01-31', + '2004-12-01', + '1817-04-28', + '2100-09-10', + '2013-11-30', + '1631-10-15' + ], dtype='datetime64[D]') + + assert_array_equal(self.data["attr_date"], expected) + + def test_datetime_local_attribute(self): + expected = np.array([ + datetime.datetime(year=1999, month=1, day=31, hour=0, minute=1), + datetime.datetime(year=2004, month=12, day=1, hour=23, minute=59), + datetime.datetime(year=1817, month=4, day=28, hour=13, minute=0), + datetime.datetime(year=2100, month=9, day=10, hour=12, minute=0), + datetime.datetime(year=2013, month=11, day=30, hour=4, minute=55), + datetime.datetime(year=1631, month=10, day=15, hour=20, minute=4) + ], dtype='datetime64[m]') + + assert_array_equal(self.data["attr_datetime_local"], expected) + + def test_datetime_missing(self): + expected = np.array([ + 'nat', + '2004-12-01T23:59', + 'nat', + 'nat', + '2013-11-30T04:55', + '1631-10-15T20:04' + ], dtype='datetime64[m]') + + assert_array_equal(self.data["attr_datetime_missing"], expected) + + def test_datetime_timezone(self): + assert_raises(ParseArffError, loadarff, test8) + + +class TestRelationalAttribute: + def setup_method(self): + self.data, self.meta = loadarff(test9) + + def test_attributes(self): + assert_equal(len(self.meta._attributes), 1) + + relational = list(self.meta._attributes.values())[0] + + assert_equal(relational.name, 'attr_date_number') + assert_equal(relational.type_name, 'relational') + assert_equal(len(relational.attributes), 2) + assert_equal(relational.attributes[0].name, + 'attr_date') + assert_equal(relational.attributes[0].type_name, + 'date') + assert_equal(relational.attributes[1].name, + 'attr_number') + assert_equal(relational.attributes[1].type_name, + 'numeric') + + def test_data(self): + dtype_instance = [('attr_date', 'datetime64[D]'), + ('attr_number', np.float64)] + + expected = [ + np.array([('1999-01-31', 1), ('1935-11-27', 10)], + dtype=dtype_instance), + np.array([('2004-12-01', 2), ('1942-08-13', 20)], + dtype=dtype_instance), + np.array([('1817-04-28', 3)], + dtype=dtype_instance), + np.array([('2100-09-10', 4), ('1957-04-17', 40), + ('1721-01-14', 400)], + dtype=dtype_instance), + np.array([('2013-11-30', 5)], + dtype=dtype_instance), + np.array([('1631-10-15', 6)], + dtype=dtype_instance) + ] + + for i in range(len(self.data["attr_date_number"])): + assert_array_equal(self.data["attr_date_number"][i], + expected[i]) + + +class TestRelationalAttributeLong: + def setup_method(self): + self.data, self.meta = loadarff(test10) + + def test_attributes(self): + assert_equal(len(self.meta._attributes), 1) + + relational = list(self.meta._attributes.values())[0] + + assert_equal(relational.name, 'attr_relational') + assert_equal(relational.type_name, 'relational') + assert_equal(len(relational.attributes), 1) + assert_equal(relational.attributes[0].name, + 'attr_number') + assert_equal(relational.attributes[0].type_name, 'numeric') + + def test_data(self): + dtype_instance = [('attr_number', np.float64)] + + expected = np.array([(n,) for n in range(30000)], + dtype=dtype_instance) + + assert_array_equal(self.data["attr_relational"][0], + expected) + + +class TestQuotedNominal: + """ + Regression test for issue #10232: + + Exception in loadarff with quoted nominal attributes. + """ + + def setup_method(self): + self.data, self.meta = loadarff(test_quoted_nominal) + + def test_attributes(self): + assert_equal(len(self.meta._attributes), 2) + + age, smoker = self.meta._attributes.values() + + assert_equal(age.name, 'age') + assert_equal(age.type_name, 'numeric') + assert_equal(smoker.name, 'smoker') + assert_equal(smoker.type_name, 'nominal') + assert_equal(smoker.values, ['yes', 'no']) + + def test_data(self): + + age_dtype_instance = np.float64 + smoker_dtype_instance = '