Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


@pytest.mark.nightly
@pytest.mark.xfail()
@pytest.mark.check_crash
@pytest.mark.parametrize("variant", variants)
def test_speecht5_text_to_speech(variant):
# Record Forge properties
Expand Down
11 changes: 9 additions & 2 deletions forge/test/models/paddlepaddle/text/glm/test_glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@

from paddlenlp.transformers import GLMTokenizer, GLMForConditionalGeneration

variants = ["THUDM/glm-515m", "THUDM/glm-2b", "THUDM/glm-large-chinese"]
variants = [
"THUDM/glm-515m",

Check warning

Code scanning / flake8

trailing whitespace Warning test

trailing whitespace
"THUDM/glm-2b",

Check warning

Code scanning / flake8

trailing whitespace Warning test

trailing whitespace
pytest.param(
"THUDM/glm-large-chinese",
marks=[pytest.mark.check_crash]
)
]


@pytest.mark.nightly
@pytest.mark.xfail()
#@pytest.mark.xfail()

Check failure

Code scanning / flake8

block comment should start with '# ' Error test

block comment should start with '# '
@pytest.mark.parametrize("variant", variants)
def test_glm(variant):
# Record Forge properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@


@pytest.mark.nightly
@pytest.mark.xfail()
@pytest.mark.check_crash
@pytest.mark.parametrize("variant", variants)
def test_roberta_causal_lm(variant):
# Record Forge properties
Expand All @@ -68,7 +68,7 @@
)

# Load Model and Tokenizer
tokenizer = RobertaChineseTokenizer.from_pretrained(variant)

Check failure on line 71 in forge/test/models/paddlepaddle/text/roberta/test_roberta.py

View workflow job for this annotation

GitHub Actions / TT-Forge-FE Tests

test_roberta.test_roberta_causal_lm[hfl/rbt4]

OSError: Can't load the model for 'hfl/rbt4'. If you were trying to load it from 'BOS', make sure you don't have a local directory with the same name. Otherwise, make sure 'hfl/rbt4' is the correct path to a directory containing one of the ['https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt']
Raw output
self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f56df8faf10>
method = 'GET', url = '/paddlenlp/models/transformers/rbt4/vocab.txt'
body = None
headers = {'User-Agent': 'python-requests/2.28.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
retries = Retry(total=0, connect=None, read=False, redirect=None, status=None)
redirect = False, assert_same_host = False
timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None
release_conn = False, chunked = False, body_pos = None
response_kw = {'decode_content': False, 'preload_content': False}
parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/paddlenlp/models/transformers/rbt4/vocab.txt', query=None, fragment=None)
destination_scheme = None, conn = None, release_this_conn = True
http_tunnel_required = True, err = None, clean_exit = False

    def urlopen(
        self,
        method,
        url,
        body=None,
        headers=None,
        retries=None,
        redirect=True,
        assert_same_host=True,
        timeout=_Default,
        pool_timeout=None,
        release_conn=None,
        chunked=False,
        body_pos=None,
        **response_kw
    ):
        """
        Get a connection from the pool and perform an HTTP request. This is the
        lowest level call for making a request, so you'll need to specify all
        the raw details.
    
        .. note::
    
           More commonly, it's appropriate to use a convenience method provided
           by :class:`.RequestMethods`, such as :meth:`request`.
    
        .. note::
    
           `release_conn` will only behave as expected if
           `preload_content=False` because we want to make
           `preload_content=False` the default behaviour someday soon without
           breaking backwards compatibility.
    
        :param method:
            HTTP request method (such as GET, POST, PUT, etc.)
    
        :param url:
            The URL to perform the request on.
    
        :param body:
            Data to send in the request body, either :class:`str`, :class:`bytes`,
            an iterable of :class:`str`/:class:`bytes`, or a file-like object.
    
        :param headers:
            Dictionary of custom headers to send, such as User-Agent,
            If-None-Match, etc. If None, pool headers are used. If provided,
            these headers completely replace any pool-specific headers.
    
        :param retries:
            Configure the number of retries to allow before raising a
            :class:`~urllib3.exceptions.MaxRetryError` exception.
    
            Pass ``None`` to retry until you receive a response. Pass a
            :class:`~urllib3.util.retry.Retry` object for fine-grained control
            over different types of retries.
            Pass an integer number to retry connection errors that many times,
            but no other types of errors. Pass zero to never retry.
    
            If ``False``, then retries are disabled and any exception is raised
            immediately. Also, instead of raising a MaxRetryError on redirects,
            the redirect response will be returned.
    
        :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
    
        :param redirect:
            If True, automatically handle redirects (status codes 301, 302,
            303, 307, 308). Each redirect counts as a retry. Disabling retries
            will disable redirect, too.
    
        :param assert_same_host:
            If ``True``, will make sure that the host of the pool requests is
            consistent else will raise HostChangedError. When ``False``, you can
            use the pool on an HTTP proxy and request foreign hosts.
    
        :param timeout:
            If specified, overrides the default timeout for this one
            request. It may be a float (in seconds) or an instance of
            :class:`urllib3.util.Timeout`.
    
        :param pool_timeout:
            If set and the pool is set to block=True, then this method will
            block for ``pool_timeout`` seconds and raise EmptyPoolError if no
            connection is available within the time period.
    
        :param release_conn:
            If False, then the urlopen call will not release the connection
            back into the pool once a response is received (but will release if
            you read the entire contents of the response such as when
            `preload_content=True`). This is useful if you're not preloading
            the response's content immediately. You will need to call
            ``r.release_conn()`` on the response ``r`` to return the connection
            back into the pool. If None, it takes the value of
            ``response_kw.get('preload_content', True)``.
    
        :param chunked:
            If True, urllib3 will send the body using chunked transfer
            encoding. Otherwise, urllib3 will send the body using the standard
            content-length form. Defaults to False.
    
        :param int body_pos:
            Position to seek to in file-like body in the event of a retry or
            redirect. Typically this won't need to be set because urllib3 will
            auto-populate the value when needed.
    
        :param \\**response_kw:
            Additional parameters are passed to
            :meth:`urllib3.response.HTTPResponse.from_httplib`
        """
    
        parsed_url = parse_url(url)
        destination_scheme = parsed_url.scheme
    
        if headers is None:
            headers = self.headers
    
        if not isinstance(retries, Retry):
            retries = Retry.from_int(retries, redirect=redirect, default=self.retries)
    
        if release_conn is None:
            release_conn = response_kw.get("preload_content", True)
    
        # Check host
        if assert_same_host and not self.is_same_host(url):
            raise HostChangedError(self, url, retries)
    
        # Ensure that the URL we're connecting to is properly encoded
        if url.startswith("/"):
            url = six.ensure_str(_encode_target(url))
        else:
            url = six.ensure_str(parsed_url.url)
    
        conn = None
    
        # Track whether `conn` needs to be released before
        # returning/raising/recursing. Update this variable if necessary, and
        # leave `release_conn` constant throughout the function. That way, if
        # the function recurses, the original value of `release_conn` will be
        # passed down into the recursive call, and its value will be respected.
        #
        # See issue #651 [1] for details.
        #
        # [1] <https://github.com/urllib3/urllib3/issues/651>
        release_this_conn = release_conn
    
        http_tunnel_required = connection_requires_http_tunnel(
            self.proxy, self.proxy_config, destination_scheme
        )
    
        # Merge the proxy headers. Only done when not using HTTP CONNECT. We
        # have to copy the headers dict so we can safely change it without those
        # changes being reflected in anyone else's copy.
        if not http_tunnel_required:
            headers = headers.copy()
            headers.update(self.proxy_headers)
    
        # Must keep the exception bound to a separate variable or else Python 3
        # complains about UnboundLocalError.
        err = None
    
        # Keep track of whether we cleanly exited the except block. This
        # ensures we do proper cleanup in finally.
        clean_exit = False
    
        # Rewind body position, if needed. Record current position
        # for future rewinds in the event of a redirect/retry.
        body_pos = set_file_position(body, body_pos)
    
        try:
            # Request a connection from the queue.
            timeout_obj = self._get_timeout(timeout)
            conn = self._get_conn(timeout=pool_timeout)
    
            conn.timeout = timeout_obj.connect_timeout
    
            is_new_proxy_conn = self.proxy is not None and not getattr(
                conn, "sock", None
            )
            if is_new_proxy_conn and http_tunnel_required:
>               self._prepare_proxy(conn)

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:713: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f56df8faf10>
conn = <urllib3.connection.HTTPSConnection object at 0x7f56df8faf50>

    def _prepare_proxy(self, conn):
        """
        Establishes a tunnel connection through HTTP CONNECT.
    
        Tunnel connection is established early because otherwise httplib would
        improperly set Host: header to proxy's IP:port.
        """
    
        conn.set_tunnel(self._proxy_host, self.port, self.proxy_headers)
    
        if self.proxy.scheme == "https":
            conn.tls_in_tls_required = True
    
>       conn.connect()

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1015: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib3.connection.HTTPSConnection object at 0x7f56df8faf50>

    def connect(self):
        # Add certificate verification
        self.sock = conn = self._new_conn()
        hostname = self.host
        tls_in_tls = False
    
        if self._is_using_tunnel():
            if self.tls_in_tls_required:
                self.sock = conn = self._connect_tls_proxy(hostname, conn)
                tls_in_tls = True
    
            # Calls self._set_hostport(), so self.host is
            # self._tunnel_host below.
>           self._tunnel()

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/urllib3/connection.py:374: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib3.connection.HTTPSConnection object at 0x7f56df8faf50>

    def _tunnel(self):
        connect = b"CONNECT %s:%d HTTP/1.0\r\n" % (
            self._wrap_ipv6(self._tunnel_host.encode("ascii")),
            self._tunnel_port)
        headers = [connect]
        for header, value in self._tunnel_headers.items():
            headers.append(f"{header}: {value}\r\n".encode("latin-1"))
        headers.append(b"\r\n")
        # Making a single send() call instead of one per line encourages
        # the host OS to use a more optimal packet size instead of
        # potentially emitting a series of small packets.
        self.send(b"".join(headers))
        del headers
    
        response = self.response_class(self.sock, method=self._method)
        try:
            (version, code, message) = response._read_status()
    
            if code != http.HTTPStatus.OK:
                self.close()
>               raise OSError(f"Tunnel connection failed: {code} {message.strip()}")
E               OSError: Tunnel connection failed: 403 Forbidden

/usr/lib/python3.11/http/client.py:943: OSError

During handling of the above exception, another exception occurred:

self = <requests.adapters.HTTPAdapter object at 0x7f56df832310>
request = <PreparedRequest [GET]>, stream = True
timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None
proxies = OrderedDict([('no', 'http://large-file-cache.large-file-cache.svc.cluster.local'), ('https', 'http://proxy.restricted-proxy.svc.cluster.local:3128'), ('http', 'http://proxy.restricted-proxy.svc.cluster.local:3128')])

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection(request.url, proxies)
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            if not chunked:
>               resp = conn.urlopen(
                    method=request.method,
                    url=url,
                    body=request.body,
                    headers=request.headers,
                    redirect=False,
                    assert_same_host=False,
                    preload_content=False,
                    decode_content=False,
                    retries=self.max_retries,
                    timeout=timeout,
                )

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/requests/adapters.py:489: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f56df8faf10>
method = 'GET', url = '/paddlenlp/models/transformers/rbt4/vocab.txt'
body = None
headers = {'User-Agent': 'python-requests/2.28.2', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
retries = Retry(total=0, connect=None, read=False, redirect=None, status=None)
redirect = False, assert_same_host = False
timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None
release_conn = False, chunked = False, body_pos = None
response_kw = {'decode_content': False, 'preload_content': False}
parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/paddlenlp/models/transformers/rbt4/vocab.txt', query=None, fragment=None)
destination_scheme = None, conn = None, release_this_conn = True
http_tunnel_required = True, err = None, clean_exit = False

    def urlopen(
        self,
        method,
        url,
        body=None,
        headers=None,
        retries=None,
        redirect=True,
        assert_same_host=True,
        timeout=_Default,
        pool_timeout=None,
        release_conn=None,
        chunked=False,
        body_pos=None,
        **response_kw
    ):
        """
        Get a connection from the pool and perform an HTTP request. This is the
        lowest level call for making a request, so you'll need to specify all
        the raw details.
    
        .. note::
    
           More commonly, it's appropriate to use a convenience method provided
           by :class:`.RequestMethods`, such as :meth:`request`.
    
        .. note::
    
           `release_conn` will only behave as expected if
           `preload_content=False` because we want to make
           `preload_content=False` the default behaviour someday soon without
           breaking backwards compatibility.
    
        :param method:
            HTTP request method (such as GET, POST, PUT, etc.)
    
        :param url:
            The URL to perform the request on.
    
        :param body:
            Data to send in the request body, either :class:`str`, :class:`bytes`,
            an iterable of :class:`str`/:class:`bytes`, or a file-like object.
    
        :param headers:
            Dictionary of custom headers to send, such as User-Agent,
            If-None-Match, etc. If None, pool headers are used. If provided,
            these headers completely replace any pool-specific headers.
    
        :param retries:
            Configure the number of retries to allow before raising a
            :class:`~urllib3.exceptions.MaxRetryError` exception.
    
            Pass ``None`` to retry until you receive a response. Pass a
            :class:`~urllib3.util.retry.Retry` object for fine-grained control
            over different types of retries.
            Pass an integer number to retry connection errors that many times,
            but no other types of errors. Pass zero to never retry.
    
            If ``False``, then retries are disabled and any exception is raised
            immediately. Also, instead of raising a MaxRetryError on redirects,
            the redirect response will be returned.
    
        :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
    
        :param redirect:
            If True, automatically handle redirects (status codes 301, 302,
            303, 307, 308). Each redirect counts as a retry. Disabling retries
            will disable redirect, too.
    
        :param assert_same_host:
            If ``True``, will make sure that the host of the pool requests is
            consistent else will raise HostChangedError. When ``False``, you can
            use the pool on an HTTP proxy and request foreign hosts.
    
        :param timeout:
            If specified, overrides the default timeout for this one
            request. It may be a float (in seconds) or an instance of
            :class:`urllib3.util.Timeout`.
    
        :param pool_timeout:
            If set and the pool is set to block=True, then this method will
            block for ``pool_timeout`` seconds and raise EmptyPoolError if no
            connection is available within the time period.
    
        :param release_conn:
            If False, then the urlopen call will not release the connection
            back into the pool once a response is received (but will release if
            you read the entire contents of the response such as when
            `preload_content=True`). This is useful if you're not preloading
            the response's content immediately. You will need to call
            ``r.release_conn()`` on the response ``r`` to return the connection
            back into the pool. If None, it takes the value of
            ``response_kw.get('preload_content', True)``.
    
        :param chunked:
            If True, urllib3 will send the body using chunked transfer
            encoding. Otherwise, urllib3 will send the body using the standard
            content-length form. Defaults to False.
    
        :param int body_pos:
            Position to seek to in file-like body in the event of a retry or
            redirect. Typically this won't need to be set because urllib3 will
            auto-populate the value when needed.
    
        :param \\**response_kw:
            Additional parameters are passed to
            :meth:`urllib3.response.HTTPResponse.from_httplib`
        """
    
        parsed_url = parse_url(url)
        destination_scheme = parsed_url.scheme
    
        if headers is None:
            headers = self.headers
    
        if not isinstance(retries, Retry):
            retries = Retry.from_int(retries, redirect=redirect, default=self.retries)
    
        if release_conn is None:
            release_conn = response_kw.get("preload_content", True)
    
        # Check host
        if assert_same_host and not self.is_same_host(url):
            raise HostChangedError(self, url, retries)
    
        # Ensure that the URL we're connecting to is properly encoded
        if url.startswith("/"):
            url = six.ensure_str(_encode_target(url))
        else:
            url = six.ensure_str(parsed_url.url)
    
        conn = None
    
        # Track whether `conn` needs to be released before
        # returning/raising/recursing. Update this variable if necessary, and
        # leave `release_conn` constant throughout the function. That way, if
        # the function recurses, the original value of `release_conn` will be
        # passed down into the recursive call, and its value will be respected.
        #
        # See issue #651 [1] for details.
        #
        # [1] <https://github.com/urllib3/urllib3/issues/651>
        release_this_conn = release_conn
    
        http_tunnel_required = connection_requires_http_tunnel(
            self.proxy, self.proxy_config, destination_scheme
        )
    
        # Merge the proxy headers. Only done when not using HTTP CONNECT. We
        # have to copy the headers dict so we can safely change it without those
        # changes being reflected in anyone else's copy.
        if not http_tunnel_required:
            headers = headers.copy()
            headers.update(self.proxy_headers)
    
        # Must keep the exception bound to a separate variable or else Python 3
        # complains about UnboundLocalError.
        err = None
    
        # Keep track of whether we cleanly exited the except block. This
        # ensures we do proper cleanup in finally.
        clean_exit = False
    
        # Rewind body position, if needed. Record current position
        # for future rewinds in the event of a redirect/retry.
        body_pos = set_file_position(body, body_pos)
    
        try:
            # Request a connection from the queue.
            timeout_obj = self._get_timeout(timeout)
            conn = self._get_conn(timeout=pool_timeout)
    
            conn.timeout = timeout_obj.connect_timeout
    
            is_new_proxy_conn = self.proxy is not None and not getattr(
                conn, "sock", None
            )
            if is_new_proxy_conn and http_tunnel_required:
                self._prepare_proxy(conn)
    
            # Make the request on the httplib connection object.
            httplib_response = self._make_request(
                conn,
                method,
                url,
                timeout=timeout_obj,
                body=body,
                headers=headers,
                chunked=chunked,
            )
    
            # If we're going to release the connection in ``finally:``, then
            # the response doesn't need to know about the connection. Otherwise
            # it will also try to release it and we'll have a double-release
            # mess.
            response_conn = conn if not release_conn else None
    
            # Pass method to Response for length checking
            response_kw["request_method"] = method
    
            # Import httplib's response into our own wrapper object
            response = self.ResponseCls.from_httplib(
                httplib_response,
                pool=self,
                connection=response_conn,
                retries=retries,
                **response_kw
            )
    
            # Everything went great!
            clean_exit = True
    
        except EmptyPoolError:
            # Didn't get a connection from the pool, no need to clean up
            clean_exit = True
            release_this_conn = False
            raise
    
        except (
            TimeoutError,
            HTTPException,
            SocketError,
            ProtocolError,
            BaseSSLError,
            SSLError,
            CertificateError,
        ) as e:
            # Discard the connection for these exceptions. It will be
            # replaced during the next _get_conn() call.
            clean_exit = False
    
            def _is_ssl_error_message_from_http_proxy(ssl_error):
                # We're trying to detect the message 'WRONG_VERSION_NUMBER' but
                # SSLErrors are kinda all over the place when it comes to the message,
                # so we try to cover our bases here!
                message = " ".join(re.split("[^a-z]", str(ssl_error).lower()))
                return (
                    "wrong version number" in message
                    or "unknown protocol" in message
                    or "record layer failure" in message
                )
    
            # Try to detect a common user error with proxies which is to
            # set an HTTP proxy to be HTTPS when it should be 'http://'
            # (ie {'http': 'http://proxy', 'https': 'https://proxy'})
            # Instead we add a nice error message and point to a URL.
            if (
                isinstance(e, BaseSSLError)
                and self.proxy
                and _is_ssl_error_message_from_http_proxy(e)
                and conn.proxy
                and conn.proxy.scheme == "https"
            ):
                e = ProxyError(
                    "Your proxy appears to only use HTTP and not HTTPS, "
                    "try changing your proxy URL to be HTTP. See: "
                    "https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html"
                    "#https-proxy-error-http-proxy",
                    SSLError(e),
                )
            elif isinstance(e, (BaseSSLError, CertificateError)):
                e = SSLError(e)
            elif isinstance(e, (SocketError, NewConnectionError)) and self.proxy:
                e = ProxyError("Cannot connect to proxy.", e)
            elif isinstance(e, (SocketError, HTTPException)):
                e = ProtocolError("Connection aborted.", e)
    
>           retries = retries.increment(
                method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
            )

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:802: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Retry(total=0, connect=None, read=False, redirect=None, status=None)
method = 'GET', url = '/paddlenlp/models/transformers/rbt4/vocab.txt'
response = None
error = ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'))
_pool = <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f56df8faf10>
_stacktrace = <traceback object at 0x7f56e0b5c8c0>

    def increment(
        self,
        method=None,
        url=None,
        response=None,
        error=None,
        _pool=None,
        _stacktrace=None,
    ):
        """Return a new Retry object with incremented retry counters.
    
        :param response: A response object, or None, if the server did not
            return a response.
        :type response: :class:`~urllib3.response.HTTPResponse`
        :param Exception error: An error encountered during the request, or
            None if the response was received successfully.
    
        :return: A new ``Retry`` object.
        """
        if self.total is False and error:
            # Disabled, indicate to re-raise the error.
            raise six.reraise(type(error), error, _stacktrace)
    
        total = self.total
        if total is not None:
            total -= 1
    
        connect = self.connect
        read = self.read
        redirect = self.redirect
        status_count = self.status
        other = self.other
        cause = "unknown"
        status = None
        redirect_location = None
    
        if error and self._is_connection_error(error):
            # Connect retry?
            if connect is False:
                raise six.reraise(type(error), error, _stacktrace)
            elif connect is not None:
                connect -= 1
    
        elif error and self._is_read_error(error):
            # Read retry?
            if read is False or not self._is_method_retryable(method):
                raise six.reraise(type(error), error, _stacktrace)
            elif read is not None:
                read -= 1
    
        elif error:
            # Other retry?
            if other is not None:
                other -= 1
    
        elif response and response.get_redirect_location():
            # Redirect retry?
            if redirect is not None:
                redirect -= 1
            cause = "too many redirects"
            redirect_location = response.get_redirect_location()
            status = response.status
    
        else:
            # Incrementing because of a server error like a 500 in
            # status_forcelist and the given method is in the allowed_methods
            cause = ResponseError.GENERIC_ERROR
            if response and response.status:
                if status_count is not None:
                    status_count -= 1
                cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status)
                status = response.status
    
        history = self.history + (
            RequestHistory(method, url, error, status, redirect_location),
        )
    
        new_retry = self.new(
            total=total,
            connect=connect,
            read=read,
            redirect=redirect,
            status=status_count,
            other=other,
            history=history,
        )
    
        if new_retry.is_exhausted():
>           raise MaxRetryError(_pool, url, error or ResponseError(cause))
E           urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='bj.bcebos.com', port=443): Max retries exceeded with url: /paddlenlp/models/transformers/rbt4/vocab.txt (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/urllib3/util/retry.py:594: MaxRetryError

During handling of the above exception, another exception occurred:

repo_id = 'hfl/rbt4'
filenames = ['https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt']
subfolder = '', repo_type = None, revision = None, library_name = 'PaddleNLP'
library_version = '2.6.2', cache_dir = None, local_dir = None
local_dir_use_symlinks = 'auto', user_agent = None, force_download = False
proxies = None, etag_timeout = 10, resume_download = False, token = None
local_files_only = False, endpoint = None, url = None, from_aistudio = False
from_hf_hub = False, from_bos = True

    def resolve_file_path(
        repo_id: str = None,
        filenames: Union[str, list] = None,
        subfolder: Optional[str] = None,
        repo_type: Optional[str] = None,
        revision: Optional[str] = None,
        library_name: Optional[str] = "PaddleNLP",
        library_version: Optional[str] = __version__,
        cache_dir: Union[str, Path, None] = None,
        local_dir: Union[str, Path, None] = None,
        local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto",
        user_agent: Union[Dict, str, None] = None,
        force_download: bool = False,
        proxies: Optional[Dict] = None,
        etag_timeout: float = 10,
        resume_download: bool = False,
        token: Union[bool, str, None] = None,
        local_files_only: bool = False,
        endpoint: Optional[str] = None,
        url: Optional[str] = None,
        from_aistudio: bool = False,
        from_hf_hub: bool = False,
        from_bos: bool = True,
    ) -> str:
        """
        This is a general download function, mainly called by the from_pretrained function.
    
        It supports downloading files from four different download sources, including BOS, AiStudio,
        HuggingFace Hub and ModelScope.
    
        If you want to download a file from ModelScope, you need to set os.environ["from_modelscope"] = "True"
    
        Args:
            repo_id('str'): A path to a folder containing the file, a path of the file, a url or repo name.
            filenames('str' or list): Name of the file to be downloaded. If it is a str, the file will be downloaded directly,
                if it is a list, it will try to download the file in turn, and when one exists, it will be returned directly.
            subfolder('str'): Some repos will exist subfolder.
            repo_type('str'): The default is model.
            cache_dir('str' or Path): Where to save or load the file after downloading.
            url('str'): If it is not None, then it will be downloaded from BOS.
            from_aistudio('bool'): If this value is true, it will be downloaded from aistudio.
            from_hf_hub('bool'): If this value is true, it will be downloaded from hf hub.
            from_bos('bool'): If this value is true, it will be downloaded from bos (default).
    
    
        Returns:
            cached_file('str'): The path of file or None.
        """
        assert repo_id is not None, "repo_id cannot be None"
        assert filenames is not None, "filenames cannot be None"
    
        if isinstance(filenames, str):
            filenames = [filenames]
    
        download_kwargs = dict(
            repo_id=repo_id,
            filename=filenames[0],
            subfolder=subfolder if subfolder is not None else "",
            repo_type=repo_type,
            revision=revision,
            library_name=library_name,
            library_version=library_version,
            cache_dir=cache_dir,
            local_dir=local_dir,
            local_dir_use_symlinks=local_dir_use_symlinks,
            user_agent=user_agent,
            force_download=force_download,
            proxies=proxies,
            etag_timeout=etag_timeout,
            resume_download=resume_download,
            token=token,
            local_files_only=local_files_only,
            endpoint=endpoint,
        )
        cached_file = None
        log_endpoint = "N/A"
        # log_filename = os.path.join(download_kwargs["subfolder"], filename)
    
        # return file path from local file, eg: /cache/path/model_config.json
        if os.path.isfile(repo_id):
            return repo_id
        # return the file path from local dir with filename, eg: /local/path
        elif os.path.isdir(repo_id):
            for index, filename in enumerate(filenames):
                if os.path.exists(os.path.join(repo_id, download_kwargs["subfolder"], filename)):
                    if not os.path.isfile(os.path.join(repo_id, download_kwargs["subfolder"], filename)):
                        raise EnvironmentError(f"{repo_id} does not appear to have file named {filename}.")
                    return os.path.join(repo_id, download_kwargs["subfolder"], filename)
                elif index < len(filenames) - 1:
                    continue
                else:
                    raise FileNotFoundError(f"please make sure one of the {filenames} under the dir {repo_id}")
    
        # check cache
        for filename in filenames:
            cache_file_name = bos_aistudio_hf_try_to_load_from_cache(
                repo_id, filename, cache_dir, subfolder, revision, repo_type, from_bos, from_aistudio, from_hf_hub
            )
            if from_hf_hub and cache_file_name is _CACHED_NO_EXIST:
                cache_file_name = None
            if cache_file_name is not None:
                return cache_file_name
    
        from_modelscope = strtobool(os.environ.get("from_modelscope", False))
    
        # download file from different origins
        try:
            if filenames[0].startswith("http://") or filenames[0].startswith("https://"):
                log_endpoint = "BOS"
                download_kwargs["url"] = filenames[0]
                download_kwargs["repo_id"] = repo_id
                if filenames[0].split("/")[-1].endswith("pdparams"):
                    download_kwargs["filename"] = "model_state.pdparams"
                else:
                    download_kwargs["filename"] = None
>               cached_file = bos_download(
                    **download_kwargs,
                )

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/paddlenlp/utils/download/__init__.py:169: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

repo_id = 'hfl/rbt4', filename = 'vocab.txt', subfolder = None, repo_type = None
revision = None, library_name = 'PaddleNLP', library_version = '2.6.2'
cache_dir = '/github/home/.paddlenlp/models', local_dir = None
local_dir_use_symlinks = 'auto', user_agent = None, force_download = False
proxies = None, etag_timeout = 10, resume_download = False, token = None
local_files_only = False, endpoint = None
url = 'https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt'
kwargs = {}, locks_dir = '/github/home/.paddlenlp/models/.locks'
storage_folder = '/github/home/.paddlenlp/models/hfl/rbt4', headers = None
url_to_download = 'https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt'
lock_path = '/github/home/.paddlenlp/models/.locks/hfl/rbt4/vocab.txt.lock'
file_path = '/github/home/.paddlenlp/models/hfl/rbt4/vocab.txt'

    def bos_download(
        repo_id: str = None,
        filename: str = None,
        subfolder: Optional[str] = None,
        repo_type: Optional[str] = None,
        revision: Optional[str] = None,
        library_name: Optional[str] = None,
        library_version: Optional[str] = None,
        cache_dir: Union[str, Path, None] = None,
        local_dir: Union[str, Path, None] = None,
        local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto",
        user_agent: Union[Dict, str, None] = None,
        force_download: bool = False,
        proxies: Optional[Dict] = None,
        etag_timeout: float = DEFAULT_ETAG_TIMEOUT,
        resume_download: bool = False,
        token: Optional[str] = None,
        local_files_only: bool = False,
        endpoint: Optional[str] = None,
        url: Optional[str] = None,
        **kwargs,
    ):
        if url is not None:
            if repo_id is None:
                if url.startswith(ENDPOINT):
                    repo_id = "/".join(url[len(ENDPOINT) + 1 :].split("/")[:-1])
                else:
                    repo_id = "/".join(url[len(ENDPOINT_v2) + 1 :].split("/")[:-1])
            if filename is None:
                filename = url.split("/")[-1]
            subfolder = None
    
        if cache_dir is None:
            cache_dir = MODEL_HOME
        if isinstance(cache_dir, Path):
            cache_dir = str(cache_dir)
    
        if subfolder == "":
            subfolder = None
        if subfolder is not None:
            # This is used to create a URL, and not a local path, hence the forward slash.
            filename = f"{subfolder}/{filename}"
    
        locks_dir = os.path.join(cache_dir, ".locks")
    
        storage_folder = os.path.join(cache_dir, repo_id)
        os.makedirs(storage_folder, exist_ok=True)
    
        if url is None:
            url = bos_url(repo_id, filename, repo_type=REPO_TYPE, endpoint=endpoint)
        headers = None
        url_to_download = url
        lock_path = os.path.join(locks_dir, repo_id, f"{filename}.lock")
        file_path = os.path.join(cache_dir, repo_id, filename)
    
        if os.name == "nt" and len(os.path.abspath(lock_path)) > 255:
            lock_path = "\\\\?\\" + os.path.abspath(lock_path)
    
        if os.name == "nt" and len(os.path.abspath(file_path)) > 255:
            file_path = "\\\\?\\" + os.path.abspath(file_path)
    
        Path(lock_path).parent.mkdir(parents=True, exist_ok=True)
        with FileLock(lock_path):
            # If the download just completed while the lock was activated.
            if os.path.exists(file_path) and not force_download:
                # Even if returning early like here, the lock will be released.
                return file_path
    
            if resume_download:
                incomplete_path = file_path + ".incomplete"
    
                @contextmanager
                def _resumable_file_manager():
                    with open(incomplete_path, "ab") as f:
                        yield f
    
                temp_file_manager = _resumable_file_manager
                if os.path.exists(incomplete_path):
                    resume_size = os.stat(incomplete_path).st_size
                else:
                    resume_size = 0
            else:
                temp_file_manager = partial(  # type: ignore
                    tempfile.NamedTemporaryFile, mode="wb", dir=cache_dir, delete=False
                )
                resume_size = 0
    
            # Download to temporary file, then copy to cache dir once finished.
            # Otherwise you get corrupt cache entries if the download gets interrupted.
            with temp_file_manager() as temp_file:
                logger.info("downloading %s to %s", url_to_download, temp_file.name)
    
>               http_get(
                    url_to_download,
                    temp_file,
                    proxies=proxies,
                    resume_size=resume_size,
                    headers=headers,
                )

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/paddlenlp/utils/download/bos_download.py:238: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt'
temp_file = <tempfile._TemporaryFileWrapper object at 0x7f56e1b95e50>

    def http_get(
        url: str,
        temp_file: BinaryIO,
        *,
        proxies=None,
        resume_size: float = 0,
        headers: Optional[Dict[str, str]] = None,
        expected_size: Optional[int] = None,
        _nb_retries: int = 5,
    ):
        """
        Download a remote file. Do not gobble up errors, and will return errors tailored to the Hugging Face Hub.
    
        If ConnectionError (SSLError) or ReadTimeout happen while streaming data from the server, it is most likely a
        transient error (network outage?). We log a warning message and try to resume the download a few times before
        giving up. The method gives up after 5 attempts if no new data has being received from the server.
        """
        initial_headers = headers
        headers = copy.deepcopy(headers) or {}
        if resume_size > 0:
            headers["Range"] = "bytes=%d-" % (resume_size,)
    
>       r = _request_wrapper(
            method="GET", url=url, stream=True, proxies=proxies, headers=headers, timeout=DEFAULT_DOWNLOAD_TIMEOUT
        )

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/paddlenlp/utils/download/common.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

method = 'GET'
url = 'https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt'
follow_relative_redirects = False
params = {'headers': {}, 'proxies': None, 'stream': True, 'timeout': 10}

    def _request_wrapper(
        method: HTTP_METHOD_T, url: str, *, follow_relative_redirects: bool = False, **params
    ) -> requests.Response:
        """Wrapper around requests methods to follow relative redirects if `follow_relative_redirects=True` even when
        `allow_redirection=False`.
    
        Args:
            method (`str`):
                HTTP method, such as 'GET' or 'HEAD'.
            url (`str`):
                The URL of the resource to fetch.
            follow_relative_redirects (`bool`, *optional*, defaults to `False`)
                If True, relative redirection (redirection to the same site) will be resolved even when `allow_redirection`
                kwarg is set to False. Useful when we want to follow a redirection to a renamed repository without
                following redirection to a CDN.
            **params (`dict`, *optional*):
                Params to pass to `requests.request`.
        """
        # Recursively follow relative redirects
        if follow_relative_redirects:
            response = _request_wrapper(
                method=method,
                url=url,
                follow_relative_redirects=False,
                **params,
            )
    
            # If redirection, we redirect only relative paths.
            # This is useful in case of a renamed repository.
            if 300 <= response.status_code <= 399:
                parsed_target = urlparse(response.headers["Location"])
                if parsed_target.netloc == "":
                    # This means it is a relative 'location' headers, as allowed by RFC 7231.
                    # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
                    # We want to follow this relative redirect !
                    #
                    # Highly inspired by `resolve_redirects` from requests library.
                    # See https://github.com/psf/requests/blob/main/requests/sessions.py#L159
                    next_url = urlparse(url)._replace(path=parsed_target.path).geturl()
                    return _request_wrapper(method=method, url=next_url, follow_relative_redirects=True, **params)
            return response
        # Perform request and return if status_code is not in the retry list.
>       response = get_session().request(method=method, url=url, **params)

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/paddlenlp/utils/download/common.py:368: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.sessions.Session object at 0x7f56e0da8210>, method = 'GET'
url = 'https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt'
params = None, data = None, headers = {}, cookies = None, files = None
auth = None, timeout = 10, allow_redirects = True
proxies = {'http': 'http://proxy.restricted-proxy.svc.cluster.local:3128', 'https': 'http://proxy.restricted-proxy.svc.cluster.local:3128', 'no': 'http://large-file-cache.large-file-cache.svc.cluster.local'}
hooks = None, stream = True, verify = None, cert = None, json = None

    def request(
        self,
        method,
        url,
        params=None,
        data=None,
        headers=None,
        cookies=None,
        files=None,
        auth=None,
        timeout=None,
        allow_redirects=True,
        proxies=None,
        hooks=None,
        stream=None,
        verify=None,
        cert=None,
        json=None,
    ):
        """Constructs a :class:`Request <Request>`, prepares it and sends it.
        Returns :class:`Response <Response>` object.
    
        :param method: method for the new :class:`Request` object.
        :param url: URL for the new :class:`Request` object.
        :param params: (optional) Dictionary or bytes to be sent in the query
            string for the :class:`Request`.
        :param data: (optional) Dictionary, list of tuples, bytes, or file-like
            object to send in the body of the :class:`Request`.
        :param json: (optional) json to send in the body of the
            :class:`Request`.
        :param headers: (optional) Dictionary of HTTP Headers to send with the
            :class:`Request`.
        :param cookies: (optional) Dict or CookieJar object to send with the
            :class:`Request`.
        :param files: (optional) Dictionary of ``'filename': file-like-objects``
            for multipart encoding upload.
        :param auth: (optional) Auth tuple or callable to enable
            Basic/Digest/Custom HTTP Auth.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple
        :param allow_redirects: (optional) Set to True by default.
        :type allow_redirects: bool
        :param proxies: (optional) Dictionary mapping protocol or protocol and
            hostname to the URL of the proxy.
        :param stream: (optional) whether to immediately download the response
            content. Defaults to ``False``.
        :param verify: (optional) Either a boolean, in which case it controls whether we verify
            the server's TLS certificate, or a string, in which case it must be a path
            to a CA bundle to use. Defaults to ``True``. When set to
            ``False``, requests will accept any TLS certificate presented by
            the server, and will ignore hostname mismatches and/or expired
            certificates, which will make your application vulnerable to
            man-in-the-middle (MitM) attacks. Setting verify to ``False``
            may be useful during local development or testing.
        :param cert: (optional) if String, path to ssl client cert file (.pem).
            If Tuple, ('cert', 'key') pair.
        :rtype: requests.Response
        """
        # Create the Request.
        req = Request(
            method=method.upper(),
            url=url,
            headers=headers,
            files=files,
            data=data or {},
            json=json,
            params=params or {},
            auth=auth,
            cookies=cookies,
            hooks=hooks,
        )
        prep = self.prepare_request(req)
    
        proxies = proxies or {}
    
        settings = self.merge_environment_settings(
            prep.url, proxies, stream, verify, cert
        )
    
        # Send the request.
        send_kwargs = {
            "timeout": timeout,
            "allow_redirects": allow_redirects,
        }
        send_kwargs.update(settings)
>       resp = self.send(prep, **send_kwargs)

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/requests/sessions.py:587: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.sessions.Session object at 0x7f56e0da8210>
request = <PreparedRequest [GET]>
kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'http://large-file-cache.large-file-cache.svc.cluster.local'), ('https',...r.local:3128'), ('http', 'http://proxy.restricted-proxy.svc.cluster.local:3128')]), 'stream': True, 'timeout': 10, ...}
allow_redirects = True, stream = True, hooks = {'response': []}
adapter = <requests.adapters.HTTPAdapter object at 0x7f56df832310>
start = 1759756420.8202548

    def send(self, request, **kwargs):
        """Send a given PreparedRequest.
    
        :rtype: requests.Response
        """
        # Set defaults that the hooks can utilize to ensure they always have
        # the correct parameters to reproduce the previous request.
        kwargs.setdefault("stream", self.stream)
        kwargs.setdefault("verify", self.verify)
        kwargs.setdefault("cert", self.cert)
        if "proxies" not in kwargs:
            kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env)
    
        # It's possible that users might accidentally send a Request object.
        # Guard against that specific failure case.
        if isinstance(request, Request):
            raise ValueError("You can only send PreparedRequests.")
    
        # Set up variables needed for resolve_redirects and dispatching of hooks
        allow_redirects = kwargs.pop("allow_redirects", True)
        stream = kwargs.get("stream")
        hooks = request.hooks
    
        # Get the appropriate adapter to use
        adapter = self.get_adapter(url=request.url)
    
        # Start time (approximately) of the request
        start = preferred_clock()
    
        # Send the request
>       r = adapter.send(request, **kwargs)

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/requests/sessions.py:701: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f56df832310>
request = <PreparedRequest [GET]>, stream = True
timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None
proxies = OrderedDict([('no', 'http://large-file-cache.large-file-cache.svc.cluster.local'), ('https', 'http://proxy.restricted-proxy.svc.cluster.local:3128'), ('http', 'http://proxy.restricted-proxy.svc.cluster.local:3128')])

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection(request.url, proxies)
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            if not chunked:
                resp = conn.urlopen(
                    method=request.method,
                    url=url,
                    body=request.body,
                    headers=request.headers,
                    redirect=False,
                    assert_same_host=False,
                    preload_content=False,
                    decode_content=False,
                    retries=self.max_retries,
                    timeout=timeout,
                )
    
            # Send the request.
            else:
                if hasattr(conn, "proxy_pool"):
                    conn = conn.proxy_pool
    
                low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)
    
                try:
                    skip_host = "Host" in request.headers
                    low_conn.putrequest(
                        request.method,
                        url,
                        skip_accept_encoding=True,
                        skip_host=skip_host,
                    )
    
                    for header, value in request.headers.items():
                        low_conn.putheader(header, value)
    
                    low_conn.endheaders()
    
                    for i in request.body:
                        low_conn.send(hex(len(i))[2:].encode("utf-8"))
                        low_conn.send(b"\r\n")
                        low_conn.send(i)
                        low_conn.send(b"\r\n")
                    low_conn.send(b"0\r\n\r\n")
    
                    # Receive the response from the server
                    r = low_conn.getresponse()
    
                    resp = HTTPResponse.from_httplib(
                        r,
                        pool=conn,
                        connection=low_conn,
                        preload_content=False,
                        decode_content=False,
                    )
                except Exception:
                    # If we hit any problems here, clean up the connection.
                    # Then, raise so that we can handle the actual exception.
                    low_conn.close()
                    raise
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
>               raise ProxyError(e, request=request)
E               requests.exceptions.ProxyError: HTTPSConnectionPool(host='bj.bcebos.com', port=443): Max retries exceeded with url: /paddlenlp/models/transformers/rbt4/vocab.txt (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/requests/adapters.py:559: ProxyError

During handling of the above exception, another exception occurred:

variant = 'hfl/rbt4'

    @pytest.mark.nightly
    @pytest.mark.check_crash
    @pytest.mark.parametrize("variant", variants)
    def test_roberta_causal_lm(variant):
        # Record Forge properties
        module_name = record_model_properties(
            framework=Framework.PADDLE,
            model=ModelArch.ROBERTA,
            variant="rbt4-ch",
            task=Task.CAUSAL_LM,
            source=Source.PADDLENLP,
        )
    
        # Load Model and Tokenizer
>       tokenizer = RobertaChineseTokenizer.from_pretrained(variant)

forge/test/models/paddlepaddle/text/roberta/test_roberta.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/paddlenlp/transformers/tokenizer_utils.py:709: in from_pretrained
    tokenizer, tokenizer_config_file_dir = super().from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
/opt/ttforge-toolchain/venv/lib/python3.11/site-packages/paddlenlp/transformers/tokenizer_utils_base.py:1495: in from_pretrained
    resolved_vocab_files[file_id] = resolve_file_path(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

repo_id = 'hfl/rbt4'
filenames = ['https://bj.bcebos.com/paddlenlp/models/transformers/rbt4/vocab.txt']
subfolder = '', repo_type = None, revision = None, library_name = 'PaddleNLP'
library_version = '2.6.2', cache_dir = None, local_dir = None
local_dir_use_symlinks = 'auto', user_agent = None, force_download = False
proxies = None, etag_timeout = 10, resume_download = False, token = None
local_files_only = False, endpoint = None, url = None, from_aistudio = False
from_hf_hub = False, from_bos = True

    def resolve_file_path(
        repo_id: str = None,
        filenames: Union[str, list] = None,
        subfolder: Optional[str] = None,
        repo_type: Optional[str] = None,
        revision: Optional[str] = None,
        library_name: Optional[str] = "PaddleNLP",
        library_version: Optional[str] = __version__,
        cache_dir: Union[str, Path, None] = None,
        local_dir: Union[str, Path, None] = None,
        local_dir_use_symlinks: Union[bool, Literal["auto"]] = "auto",
        user_agent: Union[Dict, str, None] = None,
        force_download: bool = False,
        proxies: Optional[Dict] = None,
        etag_timeout: float = 10,
        resume_download: bool = False,
        token: Union[bool, str, None] = None,
        local_files_only: bool = False,
        endpoint: Optional[str] = None,
        url: Optional[str] = None,
        from_aistudio: bool = False,
        from_hf_hub: bool = False,
        from_bos: bool = True,
    ) -> str:
        """
        This is a general download function, mainly called by the from_pretrained function.
    
        It supports downloading files from four different download sources, including BOS, AiStudio,
        HuggingFace Hub and ModelScope.
    
        If you want to download a file from ModelScope, you need to set os.environ["from_modelscope"] = "True"
    
        Args:
            repo_id('str'): A path to a folder containing the file, a path of the file, a url or repo name.
            filenames('str' or list): Name of the file to be downloaded. If it is a str, the file will be downloaded directly,
                if it is a list, it will try to download the file in turn, and when one exists, it will be returned directly.
            subfolder('str'): Some repos will exist subfolder.
            repo_type('str'): The default is model.
            cache_dir('str' or Path): Where to save or load the file after downloading.
            url('str'): If it is not None, then it will be downloaded from BOS.
            from_aistudio('bool'): If this value is true, it will be downloaded from aistudio.
            from_hf_hub('bool'): If this value is true, it will be downloaded from hf hub.
            from_bos('bool'): If this value is true, it will be downloaded from bos (default).
    
    
        Returns:
            cached_file('str'): The path of file or None.
        """
        assert repo_id is not None, "repo_id cannot be None"
        assert filenames is not None, "filenames cannot be None"
    
        if isinstance(filenames, str):
            filenames = [filenames]
    
        download_kwargs = dict(
            repo_id=repo_id,
            filename=filenames[0],
            subfolder=subfolder if subfolder is not None else "",
            repo_type=repo_type,
            revision=revision,
            library_name=library_name,
            library_version=library_version,
            cache_dir=cache_dir,
            local_dir=local_dir,
            local_dir_use_symlinks=local_dir_use_symlinks,
            user_agent=user_agent,
            force_download=force_download,
            proxies=proxies,
            etag_timeout=etag_timeout,
            resume_download=resume_download,
            token=token,
            local_files_only=local_files_only,
            endpoint=endpoint,
        )
        cached_file = None
        log_endpoint = "N/A"
        # log_filename = os.path.join(download_kwargs["subfolder"], filename)
    
        # return file path from local file, eg: /cache/path/model_config.json
        if os.path.isfile(repo_id):
            return repo_id
        # return the file path from local dir with filename, eg: /local/path
        elif os.path.isdir(repo_id):
            for index, filename in enumerate(filenames):
                if os.path.exists(os.path.join(repo_id, download_kwargs["subfolder"], filename)):
                    if not os.path.isfile(os.path.join(repo_id, download_kwargs["subfolder"], filename)):
                        raise EnvironmentError(f"{repo_id} does not appear to have file named {filename}.")
                    return os.path.join(repo_id, download_kwargs["subfolder"], filename)
                elif index < len(filenames) - 1:
                    continue
                else:
                    raise FileNotFoundError(f"please make sure one of the {filenames} under the dir {repo_id}")
    
        # check cache
        for filename in filenames:
            cache_file_name = bos_aistudio_hf_try_to_load_from_cache(
                repo_id, filename, cache_dir, subfolder, revision, repo_type, from_bos, from_aistudio, from_hf_hub
            )
            if from_hf_hub and cache_file_name is _CACHED_NO_EXIST:
                cache_file_name = None
            if cache_file_name is not None:
                return cache_file_name
    
        from_modelscope = strtobool(os.environ.get("from_modelscope", False))
    
        # download file from different origins
        try:
            if filenames[0].startswith("http://") or filenames[0].startswith("https://"):
                log_endpoint = "BOS"
                download_kwargs["url"] = filenames[0]
                download_kwargs["repo_id"] = repo_id
                if filenames[0].split("/")[-1].endswith("pdparams"):
                    download_kwargs["filename"] = "model_state.pdparams"
                else:
                    download_kwargs["filename"] = None
                cached_file = bos_download(
                    **download_kwargs,
                )
                return cached_file
    
            elif from_modelscope:
                for index, filename in enumerate(filenames):
                    try:
                        from modelscope.hub.file_download import (
                            model_file_download as modelscope_download,
                        )
    
                        return modelscope_download(repo_id, filename, revision, cache_dir, user_agent, local_files_only)
                    except Exception:
                        if index < len(filenames) - 1:
                            continue
   
model = RobertaForCausalLM.from_pretrained(variant, ignore_mismatched_sizes=True)

# Load sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def forward(self, latent_model_input, timestep, prompt_embeds):
[
pytest.param(
ModelVariant.STABLE_DIFFUSION_XL_BASE_1_0,
marks=[pytest.mark.xfail],
marks=[pytest.mark.check_crash],
),
],
)
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ markers =
out_of_memory: marks tests as out_of_memory
xfail_if_models_ops_training: marks models ops tests as xfail only when training_test is True
skip_if_models_ops_training: marks models ops tests as skip only when training_test is True
check_crash: test crash cases

# Where pytest should look for tests
testpaths =
Expand Down
Loading